Commit 1384a87c authored by Laurent Belcour's avatar Laurent Belcour

Adding the Cosines parametrizations:

 * COS_TLV: the retro cosine
 * COS_TLR: the classic reflected and light cosine
parent c53aa578
......@@ -18,6 +18,8 @@ std::map<params::input, const param_info> create_map()
/* 1D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TH, param_info("COS_TH", 1, "Cosine of the Half angle")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TK, param_info("COS_TK", 1, "Cosine of the Back angle")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TLV, param_info("COS_TLV", 1, "Cosine of the Light and View directions")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TLR, param_info("COS_TLR", 1, "Cosine of the Light and Reflected directions")));
/* 2D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_TD, param_info("RUSIN_TH_TD", 2, "Radialy symmetric Half angle parametrization")));
......@@ -82,6 +84,22 @@ void params::to_cartesian(const double* invec, params::input intype,
outvec[4] = 0.0;
outvec[5] = invec[0];
break;
case params::COS_TLV:
outvec[0] = sqrt(1.0 - invec[0]*invec[0]);
outvec[1] = 0.0;
outvec[2] = invec[0];
outvec[3] = 0.0;
outvec[4] = 0.0;
outvec[5] = 1.0;
break;
case params::COS_TLR:
outvec[0] = - sqrt(1.0 - invec[0]*invec[0]);
outvec[1] = 0.0;
outvec[2] = invec[0];
outvec[3] = 0.0;
outvec[4] = 0.0;
outvec[5] = 1.0;
break;
// 2D Parametrizations
case params::COS_TH_TD:
......@@ -232,6 +250,12 @@ void params::from_cartesian(const double* invec, params::input outtype,
outvec[0] = (invec[2] + invec[5]) / sqrt(Kx*Kx + Ky*Ky + Kz*Kz);
}
break;
case params::COS_TLV:
outvec[0] = invec[0]*invec[3] + invec[1]*invec[4] + invec[2]*invec[5];
break;
case params::COS_TLR:
outvec[0] = invec[0]*invec[3] - (invec[1]*invec[4] + invec[2]*invec[5]);
break;
// 2D Parametrizations
case params::COS_TH_TD:
......
......@@ -57,6 +57,8 @@ class params
STEREOGRAPHIC, /*!< Stereographic projection of the Light and View vectors */
SPHERICAL_TL_PL_TV_PV, /*!< Light and View vectors represented in spherical coordinates */
COS_TLV, /*!< Dot product between the Light and View vector */
COS_TLR, /*!< Dot product between the Light and Reflected vector */
ISOTROPIC_TV_TL, /*!< Light and View vectors represented in spherical coordinates, */
ISOTROPIC_TV_TL_DPHI, /*!< Light and View vectors represented in spherical coordinates,
with the difference of azimutal coordinates in the last component */
......
......@@ -18,7 +18,7 @@ SUBDIRS = \
nonlinear_fresnel_normalized_schlick \
nonlinear_fresnel_retroschlick \
nonlinear_function_diffuse \
nonlinear_function_microfacets \
# nonlinear_function_microfacets \
nonlinear_function_abc \
nonlinear_function_beckmann \
nonlinear_function_retrobeckmann \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment