commit 49fe822cb02f667cadc312b32e49d771ed6e94da
parent f0d2d5bee7af58720a56835704a6c11c236d0eee
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 7 Jun 2017 16:08:20 +0200
Bump version number of the dependencies
Fix the code to take into account the update of the dependencies.
Diffstat:
5 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
@@ -25,7 +25,7 @@ project from the `cmake/CMakeLists.txt` file by appending to the
## License
-Star-4V/S is Copyright (C) |Meso|Star> 2015-2016 (<contact@meso-star.com>).
+Star-4V/S is Copyright (C) |Meso|Star> 2015-2017 (<contact@meso-star.com>).
It is a free software released under the [OSI](http://opensource.org)-approved
CeCILL license. You are welcome to redistribute it under certain conditions;
refer to the COPYING files for details.
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com)
+# Copyright (C) |Meso|Star> 2015-2017 (contact@meso-star.com)
#
# This software is governed by the CeCILL license under French law and
# abiding by the rules of distribution of free software. You can use,
@@ -34,17 +34,19 @@ set(S4VS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src/)
################################################################################
# Check dependencies
################################################################################
-find_package(RCMake 0.2 REQUIRED)
-find_package(RSys 0.2.1 REQUIRED)
-find_package(Star3D 0.3 REQUIRED)
-find_package(Star3DAW 0.1.2 REQUIRED)
-find_package(StarSP 0.3 REQUIRED)
+find_package(RCMake 0.3 REQUIRED)
+find_package(RSys 0.4 REQUIRED)
+find_package(Star3D 0.4.1 REQUIRED)
+find_package(Star3DAW 0.1.3 REQUIRED)
+find_package(StarSP 0.4 REQUIRED)
find_package(StarMC 0.3 REQUIRED)
include_directories(
${RSys_INCLUDE_DIR}
${Star3D_INCLUDE_DIR}
- ${StarSP_INCLUDE_DIR})
+ ${Star3DAW_INCLUDE_DIR}
+ ${StarSP_INCLUDE_DIR}
+ ${StarMC_INCLUDE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
include(rcmake)
diff --git a/src/s4vs.c b/src/s4vs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com)
+/* Copyright (C) |Meso|Star> 2015-2017 (contact@meso-star.com)
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
@@ -40,20 +40,20 @@ static res_T
compute_4v_s(struct s3d_scene* scene, const size_t max_steps, const double ks)
{
struct s4vs_context ctx;
+ struct s3d_scene_view* view = NULL;
struct smc_device* smc = NULL;
struct smc_integrator integrator;
struct smc_estimator* estimator = NULL;
struct smc_estimator_status estimator_status;
float S, V, reference;
- int mask;
res_T res = RES_OK;
ASSERT(scene && max_steps > 0 && ks > 0);
- S3D(scene_begin_session(scene, S3D_SAMPLE|S3D_TRACE));
+ S3D(scene_view_create(scene, S3D_SAMPLE|S3D_TRACE, &view));
/* Compute the expected result using a mesh-based method */
- S3D(scene_compute_area(scene, &S));
- S3D(scene_compute_volume(scene, &V));
+ S3D(scene_view_compute_area(view, &S));
+ S3D(scene_view_compute_volume(view, &V));
if(eq_epsf(S, 0, 1.e-6f) || S < 0) {
fprintf(stderr, "No surface to sample. Is the scene empty?\n");
res = RES_BAD_ARG;
@@ -69,7 +69,7 @@ compute_4v_s(struct s3d_scene* scene, const size_t max_steps, const double ks)
reference = 4*V/S;
/* Initialize context for MC computation */
- ctx.scene = scene;
+ ctx.view = view;
ctx.ks = ks;
ctx.g = PI/4.0;
@@ -102,10 +102,9 @@ compute_4v_s(struct s3d_scene* scene, const size_t max_steps, const double ks)
exit:
/* Clean-up data */
+ if(view) S3D(scene_view_ref_put(view));
if(smc) SMC(device_ref_put(smc));
if(estimator) SMC(estimator_ref_put(estimator));
- S3D(scene_get_session_mask(scene, &mask));
- if(mask) S3D(scene_end_session(scene));
return res;
error:
diff --git a/src/s4vs_realization.c b/src/s4vs_realization.c
@@ -1,4 +1,4 @@
-/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com)
+/* Copyright (C) |Meso|Star> 2015-2017 (contact@meso-star.com)
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
@@ -49,7 +49,6 @@ s4vs_discard_self_hit
/* Avoid unused variable warn */
(void)ray_org, (void)ray_dir, (void)filter_data;
-
return prim_from ? S3D_PRIMITIVE_EQ(prim_from, &hit->prim) : 0;
}
@@ -62,7 +61,9 @@ s4vs_realization(void* out_length, struct ssp_rng* rng, void* context)
struct s4vs_context* ctx = (struct s4vs_context*)context;
struct s3d_attrib attrib;
struct s3d_primitive prim;
- float normal[3], u[4], x[3], st[2];
+ double sample[4];
+ double normal[3];
+ float u[3], x[3], st[2];
const float range[2] = {0.f, FLT_MAX};
struct s3d_hit hit;
double w = 0;
@@ -74,19 +75,20 @@ s4vs_realization(void* out_length, struct ssp_rng* rng, void* context)
r0 = ssp_rng_canonical_float(rng);
r1 = ssp_rng_canonical_float(rng);
r2 = ssp_rng_canonical_float(rng);
- S3D(scene_sample(ctx->scene, r0, r1, r2, &prim, st));
+ S3D(scene_view_sample(ctx->view, r0, r1, r2, &prim, st));
/* retrieve the sampled geometric normal and position */
S3D(primitive_get_attrib(&prim, S3D_GEOMETRY_NORMAL, st, &attrib));
- f3_normalize(normal, attrib.value);
+ d3_normalize(normal, d3_set_f3(normal, attrib.value));
S3D(primitive_get_attrib(&prim, S3D_POSITION, st, &attrib));
f3_set(x, attrib.value);
/* Cosine weighted sampling of the hemisphere around the sampled normal */
- ssp_ran_hemisphere_cos(rng, normal, u);
+ ssp_ran_hemisphere_cos(rng, normal, sample);
+ f3_set_d3(u, sample);
/* Find the 1st hit from the sampled location along the sampled direction */
- S3D(scene_trace_ray(ctx->scene, x, u, range, &prim, &hit));
+ S3D(scene_view_trace_ray(ctx->view, x, u, range, &prim, &hit));
/* No intersection <=> numerical imprecision or geometry leakage */
if(S3D_HIT_NONE(&hit)) return RES_UNKNOWN_ERR;
@@ -98,10 +100,11 @@ s4vs_realization(void* out_length, struct ssp_rng* rng, void* context)
if(sigma < hit.distance) {
int i;
FOR_EACH(i, 0, 3) x[i] = x[i] + (float)sigma*u[i];
- ssp_ran_sphere_hg(rng, u, ctx->g, u);
+ d3_normalize(sample, d3_set_f3(sample, u));
+ f3_set_d3(u, ssp_ran_sphere_hg(rng, sample, ctx->g, sample));
/* sample a new direction */
- S3D(scene_trace_ray(ctx->scene, x, u, range, NULL, &hit));
+ S3D(scene_view_trace_ray(ctx->view, x, u, range, NULL, &hit));
w = w + sigma;
diff --git a/src/s4vs_realization.h b/src/s4vs_realization.h
@@ -1,4 +1,4 @@
-/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com)
+/* Copyright (C) |Meso|Star> 2015-2017 (contact@meso-star.com)
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
@@ -35,7 +35,7 @@
struct ssp_rng;
struct s4vs_context {
- struct s3d_scene* scene;
+ struct s3d_scene_view* view;
double ks;
double g;
};