star-sf

Set of surface and volume scattering functions
git clone git://git.meso-star.fr/star-sf.git
Log | Files | Refs | README | LICENSE

commit 5b1c996b2ff3ed94cf48041b0f6f34d7020b3057
parent a87af66e64385f762d8e7e736751aa4a22aad3b8
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 12 Sep 2016 15:26:16 +0200

Add a (very) basic test on the dielectric/conductor Fresnel term

Diffstat:
Mcmake/CMakeLists.txt | 1+
Asrc/test_ssf_fresnel_dielectric_conductor.c | 49+++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -93,6 +93,7 @@ if(NOT NO_TEST) new_test(test_ssf_bsdf) new_test(test_ssf_bxdf) new_test(test_ssf_fresnel) + new_test(test_ssf_fresnel_dielectric_conductor) new_test(test_ssf_fresnel_dielectric_dielectric) new_test(test_ssf_fresnel_no_op) new_test(test_ssf_specular_reflection) diff --git a/src/test_ssf_fresnel_dielectric_conductor.c b/src/test_ssf_fresnel_dielectric_conductor.c @@ -0,0 +1,49 @@ +/* Copyright (C) |Meso|Star> 2016 (contact@meso-star.com) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "ssf.h" +#include "test_ssf_utils.h" + +#include <rsys/math.h> + +int +main(int argc, char** argv) +{ + struct ssf_fresnel* fresnel; + struct ssf_fresnel* dummy; + struct mem_allocator allocator; + (void)argc, (void)argv; + + mem_init_proxy_allocator(&allocator, &mem_default_allocator); + CHECK(ssf_fresnel_create(&allocator, &fresnel_dummy, &dummy), RES_OK); + CHECK(ssf_fresnel_create + (&allocator, &ssf_fresnel_dielectric_conductor, &fresnel), RES_OK); + + CHECK(ssf_fresnel_dielectric_conductor_setup(NULL, 1.0, 1.0, 1.0), RES_BAD_ARG); + CHECK(ssf_fresnel_dielectric_conductor_setup(fresnel, 1.0, 1.0, 1.0), RES_OK); + CHECK(ssf_fresnel_dielectric_conductor_setup(dummy, 1.0, 1.0, 1.0), RES_BAD_ARG); + + /* TODO eval a dielectric->conductor Fresnel term on a reference */ + /*CHECK(ssf_fresnel_eval(fresnel, 1), ref);*/ + + CHECK(ssf_fresnel_ref_put(fresnel), RES_OK); + CHECK(ssf_fresnel_ref_put(dummy), RES_OK); + + check_memory_allocator(&allocator); + mem_shutdown_proxy_allocator(&allocator); + CHECK(mem_allocated_size(), 0); + return 0; +} +