Commit c0709c9e authored by Laurent Belcour's avatar Laurent Belcour

Adding a 1D parametrization for blinn-phong shading model.

parent 74e59925
...@@ -21,6 +21,7 @@ class params ...@@ -21,6 +21,7 @@ class params
RUSIN_TH_PH_TD, RUSIN_TH_PH_TD,
RUSIN_TH_TD_PD, RUSIN_TH_TD_PD,
RUSIN_TH_PH_TD_PD, RUSIN_TH_PH_TD_PD,
COS_TH,
COS_TH_TD, COS_TH_TD,
ISOTROPIC_TV_TL_DPHI, ISOTROPIC_TV_TL_DPHI,
ISOTROPIC_TD_PD, // Difference between two directions such as R and H ISOTROPIC_TD_PD, // Difference between two directions such as R and H
...@@ -70,10 +71,13 @@ class params ...@@ -70,10 +71,13 @@ class params
static void to_cartesian(const double* invec, params::type intype, static void to_cartesian(const double* invec, params::type intype,
double* outvec) double* outvec)
{ {
double half[3];
switch(intype) switch(intype)
{ {
// 1D Parametrizations
case params::COS_TH:
half_to_cartesian(acos(invec[0]), 0.0, 0.0, 0.0, outvec);
break;
// 2D Parametrizations // 2D Parametrizations
case params::COS_TH_TD: case params::COS_TH_TD:
half_to_cartesian(acos(invec[0]), 0.0, acos(invec[1]), 0.0, outvec); half_to_cartesian(acos(invec[0]), 0.0, acos(invec[1]), 0.0, outvec);
...@@ -123,6 +127,11 @@ class params ...@@ -123,6 +127,11 @@ class params
switch(outtype) switch(outtype)
{ {
// 1D Parametrizations
case params::COS_TH:
outvec[0] = half[2];
break;
// 2D Parametrizations // 2D Parametrizations
case params::COS_TH_TD: case params::COS_TH_TD:
outvec[0] = half[2]; outvec[0] = half[2];
...@@ -152,6 +161,11 @@ class params ...@@ -152,6 +161,11 @@ class params
{ {
switch(t) switch(t)
{ {
// 1D Parametrizations
case params::COS_TH:
return 1;
break;
// 2D Parametrizations // 2D Parametrizations
case params::ISOTROPIC_TD_PD: case params::ISOTROPIC_TD_PD:
case params::ROMEIRO_TH_TD: case params::ROMEIRO_TH_TD:
......
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