solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit 5239086c3a2496bb7948f10bdc7cf8f4bc5dab37
parent 33b4f65383e3de7709d893c80ce0bcf12cbefac0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 19 Oct 2021 15:28:37 +0200

Set the required version of Star-3D to 0.8

Fix the API break introduced by this version. Furthermore, with this new
version, the range_min variable of the per ray context had become
obsolete since the ray range is now submitted as an input parameter of
the filter function.

Diffstat:
Mcmake/CMakeLists.txt | 2+-
Msrc/ssol_c.h | 4++--
Msrc/ssol_scene.c | 9+++++----
Msrc/ssol_solver.c | 1-
4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -25,7 +25,7 @@ option(NO_TEST "Do not build tests" OFF) ################################################################################ find_package(RCMake 0.4 REQUIRED) find_package(RSys 0.10 REQUIRED) -find_package(Star3D 0.7.2 REQUIRED) +find_package(Star3D 0.8 REQUIRED) find_package(Star3DUT 0.3.1 REQUIRED) find_package(StarCPR 0.1.2 REQUIRED) find_package(StarSF 0.6 REQUIRED) diff --git a/src/ssol_c.h b/src/ssol_c.h @@ -38,7 +38,6 @@ struct ray_data { enum ssol_side_flag side_from; /* Primitive side from which the ray starts */ short discard_virtual_materials; /* Define if virtual materials are not RT */ short reversed_ray; /* Define if the ray direction is reversed */ - float range_min; int point_init_closest_point; /* Output data */ @@ -47,7 +46,7 @@ struct ray_data { }; static const struct ray_data RAY_DATA_NULL = { - NULL, S3D_PRIMITIVE_NULL__, NULL, NULL, SSOL_INVALID_SIDE, 0, 0, 0, 0, + NULL, S3D_PRIMITIVE_NULL__, NULL, NULL, SSOL_INVALID_SIDE, 0, 0, 0, {0,0,0}, FLT_MAX }; @@ -68,6 +67,7 @@ hit_filter_function (const struct s3d_hit* hit, const float org[3], const float dir[3], + const float range[2], void* realisation, void* filter_data); diff --git a/src/ssol_scene.c b/src/ssol_scene.c @@ -439,6 +439,7 @@ hit_filter_function (const struct s3d_hit* hit, const float orgf[3], const float dirf[3], + const float rangef[2], void* ray_data, void* filter_data) { @@ -449,13 +450,13 @@ hit_filter_function enum ssol_side_flag hit_side = SSOL_INVALID_SIDE; double org[3], dir[3], N[3], dst = FLT_MAX; size_t id; - (void)filter_data; + (void)filter_data, (void)rangef; ASSERT(hit && orgf && dirf); /* No ray data => nothing to filter */ if(!ray_data) return 0; /* Handle numerical imprecision */ - if(hit->distance < rdata->range_min) return 1; + if(hit->distance < rangef[0]) return 1; /* When searching for closest_point accept any point on the expected object */ if(rdata->point_init_closest_point) { @@ -473,7 +474,7 @@ hit_filter_function switch(sshape->shape->type) { case SHAPE_MESH: if(hit->distance <= 1.e-6 /* FIXME hack */ - || hit->distance <= rdata->range_min + || hit->distance <= rangef[0] || S3D_PRIMITIVE_EQ(&hit->prim, &rdata->prim_from)) { /* Discard self intersection for mesh, i.e. when the intersected * primitive is the primitive from which the ray starts */ @@ -493,7 +494,7 @@ hit_filter_function /* No projection found => the ray does not intersect the quadric */ return 1; } - if((float)dst <= rdata->range_min) { + if((float)dst <= rangef[0]) { /* Handle RT numerical imprecision, the hit is below the lower bound * of the ray range. */ return 1; diff --git a/src/ssol_solver.c b/src/ssol_solver.c @@ -1006,7 +1006,6 @@ trace_radiative_path ray_data.side_from = pt.side; ray_data.discard_virtual_materials = 0; ray_data.reversed_ray = 0; - ray_data.range_min = range[0]; ray_data.dst = FLT_MAX; S3D(scene_view_trace_ray(view_rt, org, dir, range, &ray_data, &hit)); if(S3D_HIT_NONE(&hit)) { /* The ray is lost! */