commit fb2953f658fcf76c9961ed82f1cee58f30689ed6
parent 8f00487e49d32218b354d9f885868b72bab223c2
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 23 Jul 2018 12:03:06 +0200
Remove the specular_transmission "dead" test
Diffstat:
1 file changed, 0 insertions(+), 103 deletions(-)
diff --git a/src/test_ssf_specular_transmission.c b/src/test_ssf_specular_transmission.c
@@ -1,103 +0,0 @@
-/* Copyright (C) |Meso|Star> 2016-2018 (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 "ssf_optics.h"
-#include "test_ssf_utils.h"
-
-#include <rsys/double3.h>
-
-int
-main(int argc, char** argv)
-{
- struct mem_allocator allocator;
- struct ssp_rng* rng;
- struct ssf_bxdf* btdf;
- struct ssf_bxdf* dummy;
- struct ssf_fresnel* fresnel;
- double wo[3], wi[3], tmp[3];
- double N[3];
- double pdf;
- double R;
- int type;
- (void)argc, (void)argv;
-
- mem_init_proxy_allocator(&allocator, &mem_default_allocator);
- CHK(ssp_rng_create(&allocator, &ssp_rng_threefry, &rng) == RES_OK);
- CHK(ssf_bxdf_create(&allocator, &ssf_specular_transmission, &btdf) == RES_OK);
- CHK(ssf_bxdf_create(&allocator, &bxdf_dummy, &dummy) == RES_OK);
- CHECK(ssf_fresnel_create
- (&allocator, &ssf_fresnel_dielectric_dielectric, &fresnel), RES_OK);
- CHK(ssf_fresnel_dielectric_dielectric_setup(fresnel, 1.00027, 1.5) == RES_OK);
-
- CHK(ssf_specular_transmission_setup(NULL, -1, -1) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(btdf, -1, -1) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(NULL, 1.00027, -1) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(btdf, 1.00027, -1) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(NULL, -1, 1.5) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(btdf, -1, 1.5) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(NULL, 1.00027, 1.5) == RES_BAD_ARG);
- CHK(ssf_specular_transmission_setup(btdf, 1.00027, 1.5) == RES_OK);
- CHK(ssf_specular_transmission_setup(dummy, 1.00027, 1.5) == RES_BAD_ARG);
-
- d3(N, 0.0, 1.0, 0.0);
- d3_normalize(wo, d3(wo, 1.0, 1.0, 0.0));
- R = ssf_bxdf_sample(btdf, rng, wo, N, wi, &type, &pdf);
- CHK(eq_eps(R, ssf_fresnel_eval(fresnel, fabs(d3_dot(N, wi))), 1.e-6) == RES_OK);
- CHK(d3_eq_eps(wi, d3_minus(tmp, wo), 1.e-6) == 0);
- CHK(wi[1] < 0 == 1);
- CHK(IS_INF(pdf) == 1);
- CHK(type == SSF_SPECULAR|SSF_TRANSMISSION);
-
- CHK(ssf_bxdf_eval(btdf, wo, N, wi) == 0.0);
- CHK(ssf_bxdf_pdf(btdf, wo, N, wi) == 0.0);
-
- d3(wo, 0.0, 1.0, 0.0);
- R = ssf_bxdf_sample(btdf, rng, wo, N, wi, &type, &pdf);
- CHK(eq_eps(R, ssf_fresnel_eval(fresnel, fabs(d3_dot(N, wi))), 1.e-6) == RES_OK);
- CHK(IS_INF(pdf) == 1);
- CHK(d3_eq_eps(wi, d3_minus(tmp, wo), 1.e-6) == 1);
- CHK(type == SSF_SPECULAR|SSF_TRANSMISSION);
-
- d3_normalize(wo, d3(wo, -1.0, 1.0, 0.0));
- R = ssf_bxdf_sample(btdf, rng, wo, N, wi, &type, &pdf);
- reflect(tmp, wi, N);
- CHK(type == SSF_SPECULAR|SSF_TRANSMISSION);
- d3_normalize(wo, d3(wo, 1.0, 1.0, 0.0));
- R = ssf_bxdf_sample(btdf, rng, wo, N, wi, &type, &pdf);
- CHK(d3_eq_eps(wi, tmp, 1.e-6) == 1);
- CHK(type == SSF_SPECULAR|SSF_TRANSMISSION);
-
- d3_normalize(wo, d3(wo, -1, 1.e-6, 0));
- R = ssf_bxdf_sample(btdf, rng, wo, N, wi, &type, &pdf);
- CHK(eq_eps(R, 0, 1.e-3) == 1);
- CHK(type == SSF_SPECULAR|SSF_TRANSMISSION);
-
- /* Check total internal reflection */
- CHK(ssf_specular_transmission_setup(btdf, 1.5, 1.00027) == RES_OK);
- R = ssf_bxdf_sample(btdf, rng, wo, N, wi, &type, &pdf);
- CHK(eq_eps(R, 0, 1.e-3) == 1);
- CHK(type == SSF_SPECULAR|SSF_REFLECTION);
-
- CHK(ssf_fresnel_ref_put(fresnel) == RES_OK);
- CHK(ssf_bxdf_ref_put(btdf) == RES_OK);
- CHK(ssf_bxdf_ref_put(dummy) == RES_OK);
- CHK(ssp_rng_ref_put(rng) == RES_OK);
-
- check_memory_allocator(&allocator);
- mem_shutdown_proxy_allocator(&allocator);
- CHK(mem_allocated_size() == 0);
- return 0;
-}