From 32e5f5dfc71518294e89036d630b8cc4b4d295fb Mon Sep 17 00:00:00 2001 From: Roland Schregle Date: Mon, 22 Feb 2021 13:27:49 +0000 Subject: [PATCH] style(mkpmap): revised headers and indentation/linebreaks --- src/rt/pmapmat.c | 104 ++++++++++++++++++++++++++++------------------- src/rt/pmapmat.h | 7 +++- 2 files changed, 68 insertions(+), 43 deletions(-) diff --git a/src/rt/pmapmat.c b/src/rt/pmapmat.c index 7ddd884ca..e838d3e56 100644 --- a/src/rt/pmapmat.c +++ b/src/rt/pmapmat.c @@ -1,15 +1,19 @@ #ifndef lint -static const char RCSid[] = "$Id: pmapmat.c,v 2.23 2021/01/20 19:44:15 rschregle Exp $"; +static const char RCSid[] = "$Id: pmapmat.c,v 2.24 2021/02/22 13:27:49 rschregle Exp $"; #endif /* - ================================================================== + + ====================================================================== Photon map support routines for scattering by materials. Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Fraunhofer Institute for Solar Energy Systems, + supported by the German Research Foundation + (DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme FARESYS") (c) Lucerne University of Applied Sciences and Arts, - supported by the Swiss National Science Foundation (SNSF, #147053) - ================================================================== + supported by the Swiss National Science Foundation + (SNSF #147053, "Daylight Redirecting Components") + ====================================================================== */ @@ -1711,34 +1715,37 @@ int brdf2PhotonScatter (OBJREC *mat, RAY *rayIn) /* - ================================================================== + ====================================================================== The following code is (c) Lucerne University of Applied Sciences and Arts, - supported by the Swiss National Science Foundation (SNSF, #147053) - ================================================================== + supported by the Swiss National Science Foundation + (SNSF #147053, "Daylight Redirecting Components") + ====================================================================== */ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) /* Generate new photon ray for BSDF modifier and recurse. */ { - int hasthick = (mat->otype == MAT_BSDF); - int hitFront; - SDError err; - SDValue bsdfVal; - FVECT upvec; - MFUNC *mf; - BSDFDAT nd; - RAY rayOut; - COLOR bsdfRGB; - int transmitted; - double prDiff, ptDiff, prDiffSD, ptDiffSD, prSpecSD, ptSpecSD, - albedo, xi; - const double patAlb = bright(rayIn -> pcol); + int hasthick = (mat->otype == MAT_BSDF); + int hitFront; + SDError err; + SDValue bsdfVal; + FVECT upvec; + MFUNC *mf; + BSDFDAT nd; + RAY rayOut; + COLOR bsdfRGB; + int transmitted; + double prDiff, ptDiff, prDiffSD, ptDiffSD, prSpecSD, ptSpecSD, + albedo, xi; + const double patAlb = bright(rayIn -> pcol); /* Following code adapted from m_bsdf() */ /* Check arguments */ - if (mat -> oargs.nsargs < hasthick+5 || mat -> oargs.nfargs > 9 || - mat -> oargs.nfargs % 3) + if ( + mat -> oargs.nsargs < hasthick+5 || + mat -> oargs.nfargs > 9 || mat -> oargs.nfargs % 3 + ) objerror(mat, USER, "bad # arguments"); hitFront = (rayIn -> rod > 0); @@ -1749,9 +1756,9 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) /* Get thickness */ nd.thick = 0; if (hasthick) { - nd.thick = evalue(mf -> ep [0]); - if ((-FTINY <= nd.thick) & (nd.thick <= FTINY)) - nd.thick = .0; + nd.thick = evalue(mf -> ep [0]); + if ((-FTINY <= nd.thick) & (nd.thick <= FTINY)) + nd.thick = .0; } /* Get BSDF data */ @@ -1761,8 +1768,10 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) if (hitFront) { if (mat -> oargs.nfargs < 3) setcolor(nd.rdiff, .0, .0, .0); - else setcolor(nd.rdiff, mat -> oargs.farg [0], mat -> oargs.farg [1], - mat -> oargs.farg [2]); + else setcolor( + nd.rdiff, + mat -> oargs.farg [0], mat -> oargs.farg [1], mat -> oargs.farg [2] + ); } else if (mat -> oargs.nfargs < 6) { /* Check for absorbing backside */ @@ -1773,14 +1782,18 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) setcolor(nd.rdiff, .0, .0, .0); } - else setcolor(nd.rdiff, mat -> oargs.farg [3], mat -> oargs.farg [4], - mat -> oargs.farg [5]); + else setcolor( + nd.rdiff, + mat -> oargs.farg [3], mat -> oargs.farg [4], mat -> oargs.farg [5] + ); /* Extra diffuse transmittance from material def */ if (mat -> oargs.nfargs < 9) setcolor(nd.tdiff, .0, .0, .0); - else setcolor(nd.tdiff, mat -> oargs.farg [6], mat -> oargs.farg [7], - mat -> oargs.farg [8]); + else setcolor( + nd.tdiff, + mat -> oargs.farg [6], mat -> oargs.farg [7], mat -> oargs.farg [8] + ); nd.mp = mat; nd.pr = rayIn; @@ -1829,8 +1842,9 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) } /* Determine BSDF resolution */ - err = SDsizeBSDF(nd.sr_vpsa, nd.vray, NULL, - SDqueryMin + SDqueryMax, nd.sd); + err = SDsizeBSDF( + nd.sr_vpsa, nd.vray, NULL, SDqueryMin + SDqueryMax, nd.sd + ); if (err) objerror(mat, USER, transSDError(err)); @@ -1891,8 +1905,10 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) else { /* Sample SDF */ if ((xi -= prDiffSD) <= 0) { /* Diffuse SDF reflection (constant component) */ - if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState), - SDsampDf | SDsampR, nd.sd))) + if ((err = SDsampBSDF( + &bsdfVal, nd.vray, pmapRandom(scatterState), + SDsampDf | SDsampR, nd.sd + ))) objerror(mat, USER, transSDError(err)); /* Apply pattern to spectral component */ @@ -1903,8 +1919,10 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) else if ((xi -= ptDiffSD) <= 0) { /* Diffuse SDF transmission (constant component) */ - if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState), - SDsampDf | SDsampT, nd.sd))) + if ((err = SDsampBSDF( + &bsdfVal, nd.vray, pmapRandom(scatterState), + SDsampDf | SDsampT, nd.sd + ))) objerror(mat, USER, transSDError(err)); /* Apply pattern to spectral component */ @@ -1917,8 +1935,10 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) else if ((xi -= prSpecSD) <= 0) { /* Non-diffuse ("specular") SDF reflection */ - if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState), - SDsampSp | SDsampR, nd.sd))) + if ((err = SDsampBSDF( + &bsdfVal, nd.vray, pmapRandom(scatterState), + SDsampSp | SDsampR, nd.sd + ))) objerror(mat, USER, transSDError(err)); ccy2rgb(&bsdfVal.spec, bsdfVal.cieY, bsdfRGB); @@ -1927,8 +1947,10 @@ static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn) else { /* Non-diffuse ("specular") SDF transmission */ - if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState), - SDsampSp | SDsampT, nd.sd))) + if ((err = SDsampBSDF( + &bsdfVal, nd.vray, pmapRandom(scatterState), + SDsampSp | SDsampT, nd.sd + ))) objerror(mat, USER, transSDError(err)); /* Apply pattern to spectral component */ diff --git a/src/rt/pmapmat.h b/src/rt/pmapmat.h index a7f8ad635..5518c79a1 100644 --- a/src/rt/pmapmat.h +++ b/src/rt/pmapmat.h @@ -1,12 +1,15 @@ -/* RCSid $Id: pmapmat.h,v 2.13 2019/02/04 18:20:27 rschregle Exp $ */ +/* RCSid $Id: pmapmat.h,v 2.14 2021/02/22 13:27:49 rschregle Exp $ */ /* ====================================================================== Photon map support routines for scattering by materials. Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Fraunhofer Institute for Solar Energy Systems, + supported by the German Research Foundation + (DFG LU-204/10-2, "Fassadenintegrierte Regelsysteme FARESYS") (c) Lucerne University of Applied Sciences and Arts, - supported by the Swiss National Science Foundation (SNSF, #147053) + supported by the Swiss National Science Foundation + (SNSF #147053, "Daylight Redirecting Components") ====================================================================== */