htsky

Load and structure a vertically stratified atmosphere
git clone git://git.meso-star.fr/htsky.git
Log | Files | Refs | README | LICENSE

commit 4ae9c32d34a7e02661a84464ba374a196d9fe85e
parent 08cadcd17336a5493e8ed0069652e0c0ebc1c6f5
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 22 Jan 2020 16:16:37 +0100

Remove the dependency to Star-SP

Diffstat:
Msrc/htsky.c | 30++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/htsky.c b/src/htsky.c @@ -17,7 +17,6 @@ #include "htsky.h" #include "htsky_c.h" -#include <star/ssp.h> #include <star/svx.h> #include <high_tune/htcp.h> #include <high_tune/htgop.h> @@ -90,23 +89,23 @@ error: static void sample_sw_spectral_data (struct htgop* htgop, - struct ssp_rng* rng, + const double r0, + const double r1, res_T (*sample_sw_band)(const struct htgop*, const double, size_t*), size_t* ispectral_band, size_t* iquadrature_pt) { struct htgop_spectral_interval specint; - double r1, r2; res_T res = RES_OK; - ASSERT(htgop && rng && sample_sw_band && ispectral_band && iquadrature_pt); + ASSERT(htgop && sample_sw_band && ispectral_band && iquadrature_pt); ASSERT(ispectral_band && iquadrature_pt); + ASSERT(r0 >= 0 && r0 < 1); + ASSERT(r1 >= 0 && r1 < 1); (void)res; - r1 = ssp_rng_canonical(rng); - r2 = ssp_rng_canonical(rng); - res = sample_sw_band(htgop, r1, ispectral_band); + res = sample_sw_band(htgop, r0, ispectral_band); ASSERT(res == RES_OK); HTGOP(get_sw_spectral_interval(htgop, *ispectral_band, &specint)); - HTGOP(spectral_interval_sample_quadrature(&specint, r2, iquadrature_pt)); + HTGOP(spectral_interval_sample_quadrature(&specint, r1, iquadrature_pt)); } static void @@ -532,36 +531,39 @@ htsky_get_sw_spectral_band_bounds void htsky_sample_sw_spectral_data_CIE_1931_X (const struct htsky* sky, - struct ssp_rng* rng, + const double r0, /* Random number in [0, 1[ */ + const double r1, /* Random number in [0, 1[ */ size_t* ispectral_band, size_t* iquadrature_pt) { sample_sw_spectral_data - (sky->htgop, rng, htgop_sample_sw_spectral_interval_CIE_1931_X, + (sky->htgop, r0, r1, htgop_sample_sw_spectral_interval_CIE_1931_X, ispectral_band, iquadrature_pt); } void htsky_sample_sw_spectral_data_CIE_1931_Y (const struct htsky* sky, - struct ssp_rng* rng, + const double r0, /* Random number in [0, 1[ */ + const double r1, /* Random number in [0, 1[ */ size_t* ispectral_band, size_t* iquadrature_pt) { sample_sw_spectral_data - (sky->htgop, rng, htgop_sample_sw_spectral_interval_CIE_1931_Y, + (sky->htgop, r0, r1, htgop_sample_sw_spectral_interval_CIE_1931_Y, ispectral_band, iquadrature_pt); } void htsky_sample_sw_spectral_data_CIE_1931_Z (const struct htsky* sky, - struct ssp_rng* rng, + const double r0, /* Random number in [0, 1[ */ + const double r1, /* Random number in [0, 1[ */ size_t* ispectral_band, size_t* iquadrature_pt) { sample_sw_spectral_data - (sky->htgop, rng, htgop_sample_sw_spectral_interval_CIE_1931_Z, + (sky->htgop, r0, r1, htgop_sample_sw_spectral_interval_CIE_1931_Z, ispectral_band, iquadrature_pt); }