From ca6e646f1d570c301f8a67f3a7fec026ec11906c Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Wed, 27 Mar 2024 21:08:24 +0000 Subject: [PATCH] Updates --- .../{index-2eie-ZMi.js => index-OF4JcjfY.js} | 120 ++++++++++-------- index.html | 2 +- 2 files changed, 66 insertions(+), 56 deletions(-) rename assets/{index-2eie-ZMi.js => index-OF4JcjfY.js} (99%) diff --git a/assets/index-2eie-ZMi.js b/assets/index-OF4JcjfY.js similarity index 99% rename from assets/index-2eie-ZMi.js rename to assets/index-OF4JcjfY.js index deb52fb..fb9fdbc 100644 --- a/assets/index-2eie-ZMi.js +++ b/assets/index-OF4JcjfY.js @@ -5049,6 +5049,16 @@ vec3 coat_brdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uint rn }\r `,gb=`#ifdef THIN_FILM_ENABLED\r \r +/*\r + Simplified implementation of thin-film Fresnel, based on:\r +\r + "A Practical Extension to Microfacet Theory for the Modeling of Varying Iridescence", Belcour & Barla, SIGGRAPH 2017\r +\r + Here we ignore the true spectral dependence of the RGB channels,\r + and just do a monochromatic computation for each channel assuming a fixed wavelength.\r + This doesn't match the ground truth, but is a plausible, fast approximation.\r +*/\r +\r vec2 complex(float a, float b) { return vec2(a, b); }\r vec2 complex_mul(in vec2 z1, in vec2 z2) { return vec2(z1.x*z2.x - z1.y*z2.y, z1.x*z2.y + z1.y*z2.x); }\r vec2 complex_conj(in vec2 z) { return complex(z.x, -z.y); }\r @@ -5726,30 +5736,6 @@ vec3 specular_btdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uin // The original Oren-Nayar model, full and "qualitative" version\r ////////////////////////////////////////////////////////////////////////////////////\r \r -vec3 ON_qualitative(in vec3 Albedo, float sigma,\r - in vec3 V, in vec3 L)\r -{\r - // Qualitative model / Fast approximation\r - float cosThetaI = V.z, sinThetaI = sqrt(1.0 - cosThetaI * cosThetaI);\r - float cosThetaO = L.z, sinThetaO = sqrt(1.0 - cosThetaO * cosThetaO);\r - float cosPhiDiff = 0.0;\r - float sinAlpha, tanBeta;\r - if (cosThetaI > cosThetaO)\r - {\r - sinAlpha = sinThetaO;\r - tanBeta = sinThetaI / cosThetaI;\r - }\r - else\r - {\r - sinAlpha = sinThetaI;\r - tanBeta = sinThetaO / cosThetaO;\r - }\r - float sigma2 = sqr(sigma);\r - float A = 1.0f - 0.5f * sigma2 / (sigma2 + 0.33f);\r - float B = 0.45f * sigma2 / (sigma2 + 0.09f);\r - return Albedo * (cosThetaO / PI) * (A + B * max(cosPhiDiff, 0.0) * sinAlpha * tanBeta);\r -}\r -\r float safeacos(const float x)\r {\r return acos(clamp(x, -1.0, 1.0));\r @@ -5762,6 +5748,18 @@ vec3 ON_full(in vec3 Albedo, float sigma,\r float cosThetaI = V.z, sinThetaI = sqrt(1.0 - cosThetaI * cosThetaI);\r float cosThetaO = L.z, sinThetaO = sqrt(1.0 - cosThetaO * cosThetaO);\r float cosPhiDiff = 0.0;\r + if (sinThetaI > 0.0 && sinThetaO > 0.0)\r + {\r + /* Compute cos(phiO-phiI) using the half-angle formulae */\r + vec3 wi = V;\r + vec3 wo = L;\r + float sinPhiI = clamp(wi.y / sinThetaI, -1.0, 1.0),\r + cosPhiI = clamp(wi.x / sinThetaI, -1.0, 1.0),\r + sinPhiO = clamp(wo.y / sinThetaO, -1.0, 1.0),\r + cosPhiO = clamp(wo.x / sinThetaO, -1.0, 1.0);\r + cosPhiDiff = cosPhiI * cosPhiO + sinPhiI * sinPhiO;\r + }\r +\r float thetaI = safeacos(V.z),\r thetaO = safeacos(L.z),\r alpha = max(thetaI, thetaO),\r @@ -5804,6 +5802,19 @@ vec3 ON_full(in vec3 Albedo, float sigma,\r return (snglScat + dblScat) * (cosThetaO / PI);\r }\r \r +vec3 ON_qualitative(in vec3 Albedo, float sigma,\r + in vec3 V, in vec3 L)\r +{\r + float NdotV = V.z;\r + float NdotL = L.z;\r + float s = dot(L, V) - NdotV * NdotL;\r + float stinv = (s > 0.0f) ? s / max(NdotL, NdotV) : 0.0;\r + float sigma2 = sqr(sigma);\r + float A = 1.0f - 0.5f * (sigma2 / (sigma2 + 0.33f));\r + float B = 0.45f * sigma2 / (sigma2 + 0.09f);\r + return Albedo * NdotL / PI * (A + B * stinv);\r +}\r +\r \r ////////////////////////////////////////////////////////////////////////////////////\r // Fujii models\r @@ -5812,23 +5823,12 @@ vec3 ON_full(in vec3 Albedo, float sigma,\r vec3 fujii_brdf(in vec3 Albedo, float sigma, float stinv)\r {\r // Recommended A,B are different from Oren-Nayar's\r - float A = 1.0 / (PI + (PI / 2.0 - 2.0 / 3.0) * sigma);\r + float A = 1.0 / (1.0 + (0.5 - 2.0/(3.0*PI)) * sigma);\r float B = sigma * A;\r - return Albedo * max(A + B * stinv, 0.0);\r + return Albedo / PI * max(A + B * stinv, 0.0);\r }\r \r vec3 fujii_qualitative(in vec3 Albedo, float roughness, in vec3 V, in vec3 L)\r -{\r - // Has dark ring artifact + gains energy at grazing angles\r - float NdotV = V.z;\r - float NdotL = L.z;\r - float s = dot(L, V) - NdotV * NdotL;\r - float stinv = s > 0.0 ? s / max(NdotV, NdotL) : 0.0;\r - float sigma = roughness;\r - return NdotL * fujii_brdf(Albedo, sigma, stinv);\r -}\r -\r -vec3 fujii_improved(in vec3 Albedo, float roughness, in vec3 V, in vec3 L)\r {\r // No more dark ring, but loses a bit of energy as roughness->1.0\r float NdotV = V.z;\r @@ -5855,6 +5855,26 @@ vec3 fujii_materialx(in vec3 Albedo, float roughness, in vec3 V, in vec3 L)\r return Albedo * NdotL / PI * (A + B * stinv);\r }\r \r +vec3 fujii_energy_conserving(in vec3 rho, float sigma, in vec3 wi, in vec3 wo)\r +{\r + float eps = 1.0e-7;\r + float muI = wi.z, siI = max(0.0, sqrt(1.0 - muI * muI));\r + float muO = wo.z, siO = max(0.0, sqrt(1.0 - muO * muO));\r + float s = dot(wi, wo) - muI * muO;\r + float stinv = s > 0.0 ? s / max(muI, muO) : s; // Fujii model stinv\r + float AF = 1.0 / (1.0 + (0.5 - 2.0/(3.0*PI)) * sigma); // Fujii model A coefficient\r + float BF = sigma * AF; // Fujii model B coefficient\r + vec3 f_ss = (rho / PI) * (AF + BF * stinv); // Fujii single-scattering BRDF\r + float GFo = siO * (safeacos(muO) - siO*muO) + 2.0*((siO/muO)*(1.0 - pow(siO, 3.0)) - siO)/3.0; // GF integral at wo\r + float GFi = siI * (safeacos(muI) - siI*muI) + 2.0*((siI/muI)*(1.0 - pow(siI, 3.0)) - siI)/3.0; // GF integral at wi\r + float EFo = AF + (BF/PI)*GFo; // directional albedo EFo\r + float EFi = AF + (BF/PI)*GFi; // directional albedo EFi\r + float avgEF = AF + (2.0/3.0 - 28.0/(15.0*PI))*BF; // average albedo avgEF\r + vec3 rho_ms = rho * avgEF / (vec3(1.0) - rho*max(0.0, 1.0 - avgEF)); // multiple-scattering albedo rho_ms\r + vec3 f_ms = (rho_ms / PI) * max(eps, 1.0 - EFo) * max(eps, 1.0 - EFi) / max(eps, 1.0 - avgEF); // thus multiple-scattering BRDF\r + return muO * (f_ss + f_ms);\r +}\r +\r \r ////////////////////////////////////////////////////////////////////////////////////\r // d'Eon Lambertian Microsphere BRDF\r @@ -5950,15 +5970,15 @@ vec3 diffuse_brdf_eval_implementations(in vec3 woutputL, in vec3 winputL)\r case 1: // ON Qualitative (Mitsuba)\r case 2: // ON Full (Mitsuba)\r {\r - float sigma = base_roughness / sqrt(2.0);\r + float sigma = PI/2.0 * base_roughness;\r if (diffuse_mode == 1) return ON_qualitative(Albedo, sigma, V, L) / NdotL;\r else return ON_full( Albedo, sigma, V, L) / NdotL;\r }\r - case 3: return deon_lambertian_sphere(Albedo, V, L) / NdotL;\r - case 4: return fujii_qualitative (Albedo, base_roughness, V, L) / NdotL;\r - case 5: return fujii_improved (Albedo, base_roughness, V, L) / NdotL;\r - case 6: return fujii_materialx (Albedo, base_roughness, V, L) / NdotL;\r - case 7: return chan_unreal_diffuse (Albedo, base_roughness, V, L) / NdotL;\r + case 3: return deon_lambertian_sphere (Albedo, V, L) / NdotL;\r + case 4: return fujii_qualitative (Albedo, base_roughness, V, L) / NdotL;\r + case 5: return fujii_materialx (Albedo, base_roughness, V, L) / NdotL;\r + case 6: return chan_unreal_diffuse (Albedo, base_roughness, V, L) / NdotL;\r + case 7: return fujii_energy_conserving(Albedo, base_roughness, V, L) / NdotL;\r }\r }\r \r @@ -6296,16 +6316,6 @@ void fill_subsurface_medium(inout Volume internal_medium)\r internal_medium.extinction = mu_t;\r break;\r }\r - case 8: // "interfaced van de Hulst"\r - {\r - float K = 1.0 - (1.0 - average_dielectric_fresnel(specular_ior))/sqr(specular_ior);\r - vec3 Ap = A * (1.0 - K) / (1.0 - A*K);\r - s2 = sqr(4.09712 + Ap*4.20863 - sqrt(max(vec3(0.0), 9.59217 + Ap*41.6808 + sqr(Ap)*17.7126)));\r - vec3 mu_t = 1.0 / max(mfp_epsilon, r);\r - internal_medium.extinction = mu_t;\r - break;\r - }\r -\r }\r internal_medium.albedo = (1.0 - s2) / (1.0 - g*s2); // single-scattering albedo accounting for anisotropy\r internal_medium.anisotropy = g;\r @@ -7013,7 +7023,7 @@ void main()\r }\r `;function na(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Kf={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){return function(){function t(n,i,s){function o(c,u){if(!i[c]){if(!n[c]){var f=typeof na=="function"&&na;if(!u&&f)return f(c,!0);if(a)return a(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var p=i[c]={exports:{}};n[c][0].call(p.exports,function(_){var g=n[c][1][_];return o(g||_)},p,p.exports,t,n,i,s)}return i[c].exports}for(var a=typeof na=="function"&&na,l=0;l-1}function Sr(L,U){var $=this.__data__,Te=xt($,L);return Te<0?(++this.size,$.push([L,U])):$[Te][1]=U,this}ln.prototype.clear=Pi,ln.prototype.delete=yr,ln.prototype.get=ri,ln.prototype.has=br,ln.prototype.set=Sr;function Xn(L){var U=-1,$=L==null?0:L.length;for(this.clear();++U<$;){var Te=L[U];this.set(Te[0],Te[1])}}function Di(){this.size=0,this.__data__={hash:new gt,map:new(he||ln),string:new gt}}function Es(L){var U=Be(this,L).delete(L);return this.size-=U?1:0,U}function R(L){return Be(this,L).get(L)}function H(L){return Be(this,L).has(L)}function j(L,U){var $=Be(this,L),Te=$.size;return $.set(L,U),this.size+=$.size==Te?0:1,this}Xn.prototype.clear=Di,Xn.prototype.delete=Es,Xn.prototype.get=R,Xn.prototype.has=H,Xn.prototype.set=j;function K(L){var U=this.__data__=new ln(L);this.size=U.size}function Y(){this.__data__=new ln,this.size=0}function Ee(L){var U=this.__data__,$=U.delete(L);return this.size=U.size,$}function Ie(L){return this.__data__.get(L)}function He(L){return this.__data__.has(L)}function Xe(L,U){var $=this.__data__;if($ instanceof ln){var Te=$.__data__;if(!he||Te.length1?$[ut-1]:void 0,Dt=ut>2?$[2]:void 0;for(wt=L.length>3&&typeof wt=="function"?(ut--,wt):void 0,Dt&&Pt($[0],$[1],Dt)&&(wt=ut<3?void 0:wt,ut=1),U=Object(U);++Te-1&&L%1==0&&L0){if(++U>=l)return arguments[0]}else U=0;return L.apply(void 0,arguments)}}function Qt(L){if(L!=null){try{return le.call(L)}catch{}try{return L+""}catch{}}return""}function dn(L,U){return L===U||L!==L&&U!==U}var An=at(function(){return arguments}())?at:function(L){return ws(L)&&re.call(L,"callee")&&!we.call(L,"callee")},qn=Array.isArray;function wr(L){return L!=null&&yc(L.length)&&!Ta(L)}function Jf(L){return ws(L)&&wr(L)}var xc=ge||id;function Ta(L){if(!Qi(L))return!1;var U=cn(L);return U==d||U==x||U==p||U==T}function yc(L){return typeof L=="number"&&L>-1&&L%1==0&&L<=u}function Qi(L){var U=typeof L;return L!=null&&(U=="object"||U=="function")}function ws(L){return L!=null&&typeof L=="object"}function Qf(L){if(!ws(L)||cn(L)!=M)return!1;var U=Ae(L);if(U===null)return!0;var $=re.call(U,"constructor")&&U.constructor;return typeof $=="function"&&$ instanceof $&&le.call($)==pe}var bc=ze?ke(ze):Ji;function ed(L){return G(L,Sc(L))}function Sc(L){return wr(L)?et(L,!0):yt(L)}var td=ue(function(L,U,$){Fn(L,U,$)});function nd(L){return function(){return L}}function Ec(L){return L}function id(){return!1}n.exports=td}).call(this)}).call(this,typeof Gl<"u"?Gl:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(t,n,i){/*! For license information please see shifty.js.LICENSE.txt */(function(s,o){typeof i=="object"&&typeof n=="object"?n.exports=o():typeof i=="object"?i.shifty=o():s.shifty=o()})(self,function(){return function(){var s={720:function(l,c,u){u.r(c),u.d(c,{Scene:function(){return Wt},Tweenable:function(){return ft},interpolate:function(){return Ji},processTweens:function(){return ae},setBezierFunction:function(){return $e},shouldScheduleUpdate:function(){return Re},tween:function(){return Sn},unsetBezierFunction:function(){return ze}});var f={};u.r(f),u.d(f,{bounce:function(){return _e},bouncePast:function(){return qe},easeFrom:function(){return Fe},easeFromTo:function(){return We},easeInBack:function(){return se},easeInCirc:function(){return Z},easeInCubic:function(){return d},easeInExpo:function(){return W},easeInOutBack:function(){return ve},easeInOutCirc:function(){return ce},easeInOutCubic:function(){return v},easeInOutExpo:function(){return V},easeInOutQuad:function(){return m},easeInOutQuart:function(){return M},easeInOutQuint:function(){return S},easeInOutSine:function(){return O},easeInQuad:function(){return _},easeInQuart:function(){return y},easeInQuint:function(){return T},easeInSine:function(){return A},easeOutBack:function(){return me},easeOutBounce:function(){return ie},easeOutCirc:function(){return J},easeOutCubic:function(){return x},easeOutExpo:function(){return D},easeOutQuad:function(){return g},easeOutQuart:function(){return b},easeOutQuint:function(){return I},easeOutSine:function(){return z},easeTo:function(){return Ye},elastic:function(){return Q},linear:function(){return p},swingFrom:function(){return Se},swingFromTo:function(){return oe},swingTo:function(){return De}});var h={};u.r(h),u.d(h,{afterTween:function(){return xt},beforeTween:function(){return Ze},doesApply:function(){return et},tweenCreated:function(){return je}});var p=function(w){return w},_=function(w){return Math.pow(w,2)},g=function(w){return-(Math.pow(w-1,2)-1)},m=function(w){return(w/=.5)<1?.5*Math.pow(w,2):-.5*((w-=2)*w-2)},d=function(w){return Math.pow(w,3)},x=function(w){return Math.pow(w-1,3)+1},v=function(w){return(w/=.5)<1?.5*Math.pow(w,3):.5*(Math.pow(w-2,3)+2)},y=function(w){return Math.pow(w,4)},b=function(w){return-(Math.pow(w-1,4)-1)},M=function(w){return(w/=.5)<1?.5*Math.pow(w,4):-.5*((w-=2)*Math.pow(w,3)-2)},T=function(w){return Math.pow(w,5)},I=function(w){return Math.pow(w-1,5)+1},S=function(w){return(w/=.5)<1?.5*Math.pow(w,5):.5*(Math.pow(w-2,5)+2)},A=function(w){return 1-Math.cos(w*(Math.PI/2))},z=function(w){return Math.sin(w*(Math.PI/2))},O=function(w){return-.5*(Math.cos(Math.PI*w)-1)},W=function(w){return w===0?0:Math.pow(2,10*(w-1))},D=function(w){return w===1?1:1-Math.pow(2,-10*w)},V=function(w){return w===0?0:w===1?1:(w/=.5)<1?.5*Math.pow(2,10*(w-1)):.5*(2-Math.pow(2,-10*--w))},Z=function(w){return-(Math.sqrt(1-w*w)-1)},J=function(w){return Math.sqrt(1-Math.pow(w-1,2))},ce=function(w){return(w/=.5)<1?-.5*(Math.sqrt(1-w*w)-1):.5*(Math.sqrt(1-(w-=2)*w)+1)},ie=function(w){return w<1/2.75?7.5625*w*w:w<2/2.75?7.5625*(w-=1.5/2.75)*w+.75:w<2.5/2.75?7.5625*(w-=2.25/2.75)*w+.9375:7.5625*(w-=2.625/2.75)*w+.984375},se=function(w){var B=1.70158;return w*w*((B+1)*w-B)},me=function(w){var B=1.70158;return(w-=1)*w*((B+1)*w+B)+1},ve=function(w){var B=1.70158;return(w/=.5)<1?w*w*((1+(B*=1.525))*w-B)*.5:.5*((w-=2)*w*((1+(B*=1.525))*w+B)+2)},Q=function(w){return-1*Math.pow(4,-8*w)*Math.sin((6*w-1)*(2*Math.PI)/2)+1},oe=function(w){var B=1.70158;return(w/=.5)<1?w*w*((1+(B*=1.525))*w-B)*.5:.5*((w-=2)*w*((1+(B*=1.525))*w+B)+2)},Se=function(w){var B=1.70158;return w*w*((B+1)*w-B)},De=function(w){var B=1.70158;return(w-=1)*w*((B+1)*w+B)+1},_e=function(w){return w<1/2.75?7.5625*w*w:w<2/2.75?7.5625*(w-=1.5/2.75)*w+.75:w<2.5/2.75?7.5625*(w-=2.25/2.75)*w+.9375:7.5625*(w-=2.625/2.75)*w+.984375},qe=function(w){return w<1/2.75?7.5625*w*w:w<2/2.75?2-(7.5625*(w-=1.5/2.75)*w+.75):w<2.5/2.75?2-(7.5625*(w-=2.25/2.75)*w+.9375):2-(7.5625*(w-=2.625/2.75)*w+.984375)},We=function(w){return(w/=.5)<1?.5*Math.pow(w,4):-.5*((w-=2)*Math.pow(w,3)-2)},Fe=function(w){return Math.pow(w,4)},Ye=function(w){return Math.pow(w,.25)};function X(w,B,te,G,ue,Ne){var Be,rt,dt,Ft,St,Pt=0,kt=0,rn=0,gi=function(Et){return((Pt*Et+kt)*Et+rn)*Et},si=function(Et){return(3*Pt*Et+2*kt)*Et+rn},oi=function(Et){return Et>=0?Et:0-Et};return Pt=1-(rn=3*B)-(kt=3*(G-B)-rn),dt=1-(St=3*te)-(Ft=3*(ue-te)-St),Be=w,rt=function(Et){return 1/(200*Et)}(Ne),function(Et){return((dt*Et+Ft)*Et+St)*Et}(function(Et,ai){var li,vi,Qt,dn,An,qn;for(Qt=Et,qn=0;qn<8;qn++){if(dn=gi(Qt)-Et,oi(dn)(vi=1))return vi;for(;lidn?li=Qt:vi=Qt,Qt=.5*(vi-li)+li}return Qt}(Be,rt))}var Lt,Ce=function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:.25,B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.25,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:.75,G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.75;return function(ue){return X(ue,w,B,te,G,1)}},$e=function(w,B,te,G,ue){var Ne=Ce(B,te,G,ue);return Ne.displayName=w,Ne.x1=B,Ne.y1=te,Ne.x2=G,Ne.y2=ue,ft.formulas[w]=Ne},ze=function(w){return delete ft.formulas[w]};function _t(w,B){if(!(w instanceof B))throw new TypeError("Cannot call a class as a function")}function Ke(w,B){for(var te=0;tew.length)&&(B=w.length);for(var te=0,G=new Array(B);tert?rt:B;w._hasEnded=dt>=rt;var Ft=Ne-(rt-dt),St=w._filters.length>0;if(w._hasEnded)return w._render(Be,w._data,Ft),w.stop(!0);St&&w._applyFilter(N),dt1&&arguments[1]!==void 0?arguments[1]:fe,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Array.isArray(B)){var G=Ce.apply(void 0,ot(B));return G}var ue=ke(B);if(Ge[B])return Ge[B];if(ue===Oe||ue===ne)for(var Ne in w)te[Ne]=B;else for(var Be in w)te[Be]=B[Be]||fe;return te},Vt=function(w){w===we?(we=w._next)?we._previous=null:be=null:w===be?(be=w._previous)?be._next=null:we=null:(le=w._previous,re=w._next,le._next=re,re._previous=le),w._previous=w._next=null},ht=typeof Promise=="function"?Promise:null;Lt=Symbol.toStringTag;var ft=function(){function w(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;_t(this,w),E(this,Lt,"Promise"),this._config={},this._data={},this._delay=0,this._filters=[],this._next=null,this._previous=null,this._timestamp=null,this._hasEnded=!1,this._resolve=null,this._reject=null,this._currentState=G||{},this._originalState={},this._targetState={},this._start=Pe,this._render=Pe,this._promiseCtor=ht,ue&&this.setConfig(ue)}var B,te;return B=w,te=[{key:"_applyFilter",value:function(G){for(var ue=this._filters.length;ue>0;ue--){var Ne=this._filters[ue-ue][G];Ne&&Ne(this)}}},{key:"tween",value:function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return this._isPlaying&&this.stop(),!G&&this._config||this.setConfig(G),this._pausedAtTime=null,this._timestamp=w.now(),this._start(this.get(),this._data),this._delay&&this._render(this._currentState,this._data,0),this._resume(this._timestamp)}},{key:"setConfig",value:function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=this._config;for(var Ne in G)ue[Ne]=G[Ne];var Be=ue.promise,rt=Be===void 0?this._promiseCtor:Be,dt=ue.start,Ft=dt===void 0?Pe:dt,St=ue.finish,Pt=ue.render,kt=Pt===void 0?this._config.step||Pe:Pt,rn=ue.step,gi=rn===void 0?Pe:rn;this._data=ue.data||ue.attachment||this._data,this._isPlaying=!1,this._pausedAtTime=null,this._scheduleId=null,this._delay=G.delay||0,this._start=Ft,this._render=kt||gi,this._duration=ue.duration||500,this._promiseCtor=rt,St&&(this._resolve=St);var si=G.from,oi=G.to,Et=oi===void 0?{}:oi,ai=this._currentState,li=this._originalState,vi=this._targetState;for(var Qt in si)ai[Qt]=si[Qt];var dn=!1;for(var An in ai){var qn=ai[An];dn||ke(qn)!==Oe||(dn=!0),li[An]=qn,vi[An]=Et.hasOwnProperty(An)?Et[An]:qn}if(this._easing=gt(this._currentState,ue.easing,this._easing),this._filters.length=0,dn){for(var wr in w.filters)w.filters[wr].doesApply(this)&&this._filters.push(w.filters[wr]);this._applyFilter(de)}return this}},{key:"then",value:function(G,ue){var Ne=this;return this._promise=new this._promiseCtor(function(Be,rt){Ne._resolve=Be,Ne._reject=rt}),this._promise.then(G,ue)}},{key:"catch",value:function(G){return this.then().catch(G)}},{key:"finally",value:function(G){return this.then().finally(G)}},{key:"get",value:function(){return P({},this._currentState)}},{key:"set",value:function(G){this._currentState=G}},{key:"pause",value:function(){if(this._isPlaying)return this._pausedAtTime=w.now(),this._isPlaying=!1,Vt(this),this}},{key:"resume",value:function(){return this._resume()}},{key:"_resume",value:function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:w.now();return this._timestamp===null?this.tween():this._isPlaying?this._promise:(this._pausedAtTime&&(this._timestamp+=G-this._pausedAtTime,this._pausedAtTime=null),this._isPlaying=!0,we===null?(we=this,be=this):(this._previous=be,be._next=this,be=this),this)}},{key:"seek",value:function(G){G=Math.max(G,0);var ue=w.now();return this._timestamp+G===0||(this._timestamp=ue-G,ge(this,ue)),this}},{key:"stop",value:function(){var G=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(!this._isPlaying)return this;this._isPlaying=!1,Vt(this);var ue=this._filters.length>0;return G&&(ue&&this._applyFilter(N),F(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),ue&&(this._applyFilter(pe),this._applyFilter(ye))),this._resolve&&this._resolve({data:this._data,state:this._currentState,tweenable:this}),this._resolve=null,this._reject=null,this}},{key:"cancel",value:function(){var G=arguments.length>0&&arguments[0]!==void 0&&arguments[0],ue=this._currentState,Ne=this._data,Be=this._isPlaying;return Be?(this._reject&&this._reject({data:Ne,state:ue,tweenable:this}),this._resolve=null,this._reject=null,this.stop(G)):this}},{key:"isPlaying",value:function(){return this._isPlaying}},{key:"hasEnded",value:function(){return this._hasEnded}},{key:"setScheduleFunction",value:function(G){w.setScheduleFunction(G)}},{key:"data",value:function(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return G&&(this._data=P({},G)),this._data}},{key:"dispose",value:function(){for(var G in this)delete this[G]}}],te&&Ke(B.prototype,te),w}();function Sn(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},B=new ft;return B.tween(w),B.tweenable=B,B}E(ft,"now",function(){return q}),E(ft,"setScheduleFunction",function(w){return Ae=w}),E(ft,"filters",{}),E(ft,"formulas",Ge),Re(!0);var ii,ln,Pi=/(\d|-|\.)/,yr=/([^\-0-9.]+)/g,ri=/[0-9.-]+/g,br=(ii=ri.source,ln=/,\s*/.source,new RegExp("rgba?\\(".concat(ii).concat(ln).concat(ii).concat(ln).concat(ii,"(").concat(ln).concat(ii,")?\\)"),"g")),Sr=/^.*\(/,Xn=/#([0-9]|[a-f]){3,6}/gi,Di="VAL",Es=function(w,B){return w.map(function(te,G){return"_".concat(B,"_").concat(G)})};function R(w){return parseInt(w,16)}var H=function(w){return"rgb(".concat((B=w,(B=B.replace(/#/,"")).length===3&&(B=(B=B.split(""))[0]+B[0]+B[1]+B[1]+B[2]+B[2]),[R(B.substr(0,2)),R(B.substr(2,2)),R(B.substr(4,2))]).join(","),")");var B},j=function(w,B,te){var G=B.match(w),ue=B.replace(w,Di);return G&&G.forEach(function(Ne){return ue=ue.replace(Di,te(Ne))}),ue},K=function(w){for(var B in w){var te=w[B];typeof te=="string"&&te.match(Xn)&&(w[B]=j(Xn,te,H))}},Y=function(w){var B=w.match(ri),te=B.slice(0,3).map(Math.floor),G=w.match(Sr)[0];if(B.length===3)return"".concat(G).concat(te.join(","),")");if(B.length===4)return"".concat(G).concat(te.join(","),",").concat(B[3],")");throw new Error("Invalid rgbChunk: ".concat(w))},Ee=function(w){return w.match(ri)},Ie=function(w,B){var te={};return B.forEach(function(G){te[G]=w[G],delete w[G]}),te},He=function(w,B){return B.map(function(te){return w[te]})},Xe=function(w,B){return B.forEach(function(te){return w=w.replace(Di,+te.toFixed(4))}),w},et=function(w){for(var B in w._currentState)if(typeof w._currentState[B]=="string")return!0;return!1};function je(w){var B=w._currentState;[B,w._originalState,w._targetState].forEach(K),w._tokenData=function(te){var G,ue,Ne={};for(var Be in te){var rt=te[Be];typeof rt=="string"&&(Ne[Be]={formatString:(G=rt,ue=void 0,ue=G.match(yr),ue?(ue.length===1||G.charAt(0).match(Pi))&&ue.unshift(""):ue=["",""],ue.join(Di)),chunkNames:Es(Ee(rt),Be)})}return Ne}(B)}function Ze(w){var B=w._currentState,te=w._originalState,G=w._targetState,ue=w._easing,Ne=w._tokenData;(function(Be,rt){var dt=function(St){var Pt=rt[St].chunkNames,kt=Be[St];if(typeof kt=="string"){var rn=kt.split(" "),gi=rn[rn.length-1];Pt.forEach(function(si,oi){return Be[si]=rn[oi]||gi})}else Pt.forEach(function(si){return Be[si]=kt});delete Be[St]};for(var Ft in rt)dt(Ft)})(ue,Ne),[B,te,G].forEach(function(Be){return function(rt,dt){var Ft=function(Pt){Ee(rt[Pt]).forEach(function(kt,rn){return rt[dt[Pt].chunkNames[rn]]=+kt}),delete rt[Pt]};for(var St in dt)Ft(St)}(Be,Ne)})}function xt(w){var B=w._currentState,te=w._originalState,G=w._targetState,ue=w._easing,Ne=w._tokenData;[B,te,G].forEach(function(Be){return function(rt,dt){for(var Ft in dt){var St=dt[Ft],Pt=St.chunkNames,kt=St.formatString,rn=Xe(kt,He(Ie(rt,Pt),Pt));rt[Ft]=j(br,rn,Y)}}(Be,Ne)}),function(Be,rt){for(var dt in rt){var Ft=rt[dt].chunkNames,St=Be[Ft[0]];Be[dt]=typeof St=="string"?Ft.map(function(Pt){var kt=Be[Pt];return delete Be[Pt],kt}).join(" "):St}}(ue,Ne)}function Gt(w,B){var te=Object.keys(w);if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(w);B&&(G=G.filter(function(ue){return Object.getOwnPropertyDescriptor(w,ue).enumerable})),te.push.apply(te,G)}return te}function zt(w){for(var B=1;B4&&arguments[4]!==void 0?arguments[4]:0,Ne=zt({},w),Be=gt(w,G);for(var rt in at._filters.length=0,at.set({}),at._currentState=Ne,at._originalState=w,at._targetState=B,at._easing=Be,Je)Je[rt].doesApply(at)&&at._filters.push(Je[rt]);at._applyFilter("tweenCreated"),at._applyFilter("beforeTween");var dt=F(te,Ne,w,B,1,ue,Be);return at._applyFilter("afterTween"),dt};function yt(w,B){(B==null||B>w.length)&&(B=w.length);for(var te=0,G=new Array(B);tec.strokeWidth&&(u=c.trailWidth);var f=50-u/2;return o.render(this._pathTemplate,{radius:f,"2radius":f*2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],4:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate=u.vertical?"M {center},100 L {center},0":"M 0,{center} L 100,{center}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._initializeSvg=function(c,u){var f=u.vertical?"0 0 "+u.strokeWidth+" 100":"0 0 100 "+u.strokeWidth;c.setAttribute("viewBox",f),c.setAttribute("preserveAspectRatio","none")},a.prototype._pathString=function(c){return o.render(this._pathTemplate,{center:c.strokeWidth/2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],5:[function(t,n,i){n.exports={Line:t("./line"),Circle:t("./circle"),SemiCircle:t("./semicircle"),Square:t("./square"),Path:t("./path"),Shape:t("./shape"),utils:t("./utils")}},{"./circle":3,"./line":4,"./path":6,"./semicircle":7,"./shape":8,"./square":9,"./utils":10}],6:[function(t,n,i){var s=t("shifty"),o=t("./utils"),a=s.Tweenable,l={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},c=function u(f,h){if(!(this instanceof u))throw new Error("Constructor was called without new keyword");h=o.extend({delay:0,duration:800,easing:"linear",from:{},to:{},step:function(){}},h);var p;o.isString(f)?p=document.querySelector(f):p=f,this.path=p,this._opts=h,this._tweenable=null;var _=this.path.getTotalLength();this.path.style.strokeDasharray=_+" "+_,this.set(0)};c.prototype.value=function(){var f=this._getComputedDashOffset(),h=this.path.getTotalLength(),p=1-f/h;return parseFloat(p.toFixed(6),10)},c.prototype.set=function(f){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(f);var h=this._opts.step;if(o.isFunction(h)){var p=this._easing(this._opts.easing),_=this._calculateTo(f,p),g=this._opts.shape||this;h(_,g,this._opts.attachment)}},c.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},c.prototype.animate=function(f,h,p){h=h||{},o.isFunction(h)&&(p=h,h={});var _=o.extend({},h),g=o.extend({},this._opts);h=o.extend(g,h);var m=this._easing(h.easing),d=this._resolveFromAndTo(f,m,_);this.stop(),this.path.getBoundingClientRect();var x=this._getComputedDashOffset(),v=this._progressToOffset(f),y=this;this._tweenable=new a,this._tweenable.tween({from:o.extend({offset:x},d.from),to:o.extend({offset:v},d.to),duration:h.duration,delay:h.delay,easing:m,step:function(b){y.path.style.strokeDashoffset=b.offset;var M=h.shape||y;h.step(b,M,h.attachment)}}).then(function(b){o.isFunction(p)&&p()}).catch(function(b){throw console.error("Error in tweening:",b),b})},c.prototype._getComputedDashOffset=function(){var f=window.getComputedStyle(this.path,null);return parseFloat(f.getPropertyValue("stroke-dashoffset"),10)},c.prototype._progressToOffset=function(f){var h=this.path.getTotalLength();return h-f*h},c.prototype._resolveFromAndTo=function(f,h,p){return p.from&&p.to?{from:p.from,to:p.to}:{from:this._calculateFrom(h),to:this._calculateTo(f,h)}},c.prototype._calculateFrom=function(f){return s.interpolate(this._opts.from,this._opts.to,this.value(),f)},c.prototype._calculateTo=function(f,h){return s.interpolate(this._opts.from,this._opts.to,f,h)},c.prototype._stopTween=function(){this._tweenable!==null&&(this._tweenable.stop(!0),this._tweenable=null)},c.prototype._easing=function(f){return l.hasOwnProperty(f)?l[f]:f},n.exports=c},{"./utils":10,shifty:2}],7:[function(t,n,i){var s=t("./shape"),o=t("./circle"),a=t("./utils"),l=function(u,f){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,s.apply(this,arguments)};l.prototype=new s,l.prototype.constructor=l,l.prototype._initializeSvg=function(u,f){u.setAttribute("viewBox","0 0 100 50")},l.prototype._initializeTextContainer=function(u,f,h){u.text.style&&(h.style.top="auto",h.style.bottom="0",u.text.alignToBottom?a.setStyle(h,"transform","translate(-50%, 0)"):a.setStyle(h,"transform","translate(-50%, 50%)"))},l.prototype._pathString=o.prototype._pathString,l.prototype._trailString=o.prototype._trailString,n.exports=l},{"./circle":3,"./shape":8,"./utils":10}],8:[function(t,n,i){var s=t("./path"),o=t("./utils"),a="Object is destroyed",l=function c(u,f){if(!(this instanceof c))throw new Error("Constructor was called without new keyword");if(arguments.length!==0){this._opts=o.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},f,!0),o.isObject(f)&&f.svgStyle!==void 0&&(this._opts.svgStyle=f.svgStyle),o.isObject(f)&&o.isObject(f.text)&&f.text.style!==void 0&&(this._opts.text.style=f.text.style);var h=this._createSvgView(this._opts),p;if(o.isString(u)?p=document.querySelector(u):p=u,!p)throw new Error("Container does not exist: "+u);this._container=p,this._container.appendChild(h.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&o.setStyles(h.svg,this._opts.svgStyle),this.svg=h.svg,this.path=h.path,this.trail=h.trail,this.text=null;var _=o.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new s(h.path,_),o.isObject(this._opts.text)&&this._opts.text.value!==null&&this.setText(this._opts.text.value)}};l.prototype.animate=function(u,f,h){if(this._progressPath===null)throw new Error(a);this._progressPath.animate(u,f,h)},l.prototype.stop=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath.stop()},l.prototype.pause=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.pause()},l.prototype.resume=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.resume()},l.prototype.destroy=function(){if(this._progressPath===null)throw new Error(a);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,this.text!==null&&(this.text.parentNode.removeChild(this.text),this.text=null)},l.prototype.set=function(u){if(this._progressPath===null)throw new Error(a);this._progressPath.set(u)},l.prototype.value=function(){if(this._progressPath===null)throw new Error(a);return this._progressPath===void 0?0:this._progressPath.value()},l.prototype.setText=function(u){if(this._progressPath===null)throw new Error(a);this.text===null&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),o.isObject(u)?(o.removeChildren(this.text),this.text.appendChild(u)):this.text.innerHTML=u},l.prototype._createSvgView=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(f,u);var h=null;(u.trailColor||u.trailWidth)&&(h=this._createTrail(u),f.appendChild(h));var p=this._createPath(u);return f.appendChild(p),{svg:f,path:p,trail:h}},l.prototype._initializeSvg=function(u,f){u.setAttribute("viewBox","0 0 100 100")},l.prototype._createPath=function(u){var f=this._pathString(u);return this._createPathElement(f,u)},l.prototype._createTrail=function(u){var f=this._trailString(u),h=o.extend({},u);return h.trailColor||(h.trailColor="#eee"),h.trailWidth||(h.trailWidth=h.strokeWidth),h.color=h.trailColor,h.strokeWidth=h.trailWidth,h.fill=null,this._createPathElement(f,h)},l.prototype._createPathElement=function(u,f){var h=document.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d",u),h.setAttribute("stroke",f.color),h.setAttribute("stroke-width",f.strokeWidth),f.fill?h.setAttribute("fill",f.fill):h.setAttribute("fill-opacity","0"),h},l.prototype._createTextContainer=function(u,f){var h=document.createElement("div");h.className=u.text.className;var p=u.text.style;return p&&(u.text.autoStyleContainer&&(f.style.position="relative"),o.setStyles(h,p),p.color||(h.style.color=u.color)),this._initializeTextContainer(u,f,h),h},l.prototype._initializeTextContainer=function(c,u,f){},l.prototype._pathString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._trailString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._warnContainerAspectRatio=function(u){if(this.containerAspectRatio){var f=window.getComputedStyle(u,null),h=parseFloat(f.getPropertyValue("width"),10),p=parseFloat(f.getPropertyValue("height"),10);o.floatEquals(this.containerAspectRatio,h/p)||(console.warn("Incorrect aspect ratio of container","#"+u.id,"detected:",f.getPropertyValue("width")+"(width)","/",f.getPropertyValue("height")+"(height)","=",h/p),console.warn("Aspect ratio of should be",this.containerAspectRatio))}},n.exports=l},{"./path":6,"./utils":10}],9:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._pathString=function(c){var u=100-c.strokeWidth/2;return o.render(this._pathTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2})},a.prototype._trailString=function(c){var u=100-c.strokeWidth/2;return o.render(this._trailTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2,startMargin:c.strokeWidth/2-c.trailWidth/2})},n.exports=a},{"./shape":8,"./utils":10}],10:[function(t,n,i){var s=t("lodash.merge"),o="Webkit Moz O ms".split(" "),a=.001;function l(v,y){var b=v;for(var M in y)if(y.hasOwnProperty(M)){var T=y[M],I="\\{"+M+"\\}",S=new RegExp(I,"g");b=b.replace(S,T)}return b}function c(v,y,b){for(var M=v.style,T=0;T{if(o.isMesh){const a=new nb(o);a.attributes=["position","color","normal","tangent","uv","uv2"],a.applyWorldTransforms=!1;const l={strategy:Gf,maxLeafTris:1};let c=new mc(a.generate(),l);return new Mn(a.generate(),o.material),this.result={scene:t.scene,bvh:c,mesh:o},console.log("==> loaded mesh ",e),this.result}});return this.result}}function Bn(r){return new C(r[0],r[1],r[2])}const k={smooth_normals:!0,bounces:6,max_samples:1024,max_volume_steps:8,wireframe:!0,neutral_color:[.5,.5,.5],skyPower:.5,skyColor:[.8,.8,1],sunPower:.35,sunAngularSize:40,sunLatitude:40,sunLongitude:180,sunColor:[1,1,.8],base_weight:1,base_color:[.8,.8,.8],base_roughness:0,base_metalness:0,diffuse_mode:1,specular_weight:1,specular_color:[1,1,1],specular_roughness:.1,specular_anisotropy:0,specular_rotation:0,specular_ior:1.6,transmission_weight:0,transmission_color:[1,1,1],transmission_depth:0,transmission_scatter:[0,0,0],transmission_scatter_anisotropy:0,transmission_dispersion_abbe_number:20,transmission_dispersion_scale:0,subsurface_weight:0,subsurface_color:[.8,.8,.8],subsurface_radius:.2,subsurface_radius_scale:[1,.5,.25],subsurface_anisotropy:0,subsurface_mode:0,coat_weight:0,coat_color:[1,1,1],coat_roughness:0,coat_anisotropy:0,coat_rotation:0,coat_ior:1.3,coat_darkening:1,fuzz_weight:0,fuzz_color:[1,1,1],fuzz_roughness:.5,emission_luminance:0,emission_color:[1,1,1],thin_film_weight:0,thin_film_thickness:1e3,thin_film_ior:1.4,geometry_opacity:1,geometry_thin_walled:!1,reset_camera:function(){vc()}};let qt,Mt,Ot,fr,Gi,as,ma,Qe,Zf,io,cr=0,es,ts,Tl,Al;var _n,gc,_a,Ks,Tb={"OpenPBR (orig, 3-float)":0,"OpenPBR (luminace)":1,"OpenPBR (average)":2,"OpenPBR (max value)":3,"OpenPBR (weighted average)":4,"SPI / Arnold v1":5,"Arnold v2":6,"Uniform scattering":7,"Interfaced van de Hulst":8},Ab={Lambert:0,"ON Qualitative (Mitsuba)":1,"ON Full (Mitsuba)":2,"d'Eon sphere model":3,"Fujii - Qualitative":4,"Fujii - Improved":5,"Fujii - MaterialX":6,"Chan Diffuse (Unreal)":7};Lb();Zs();function Rb(){let r=(90-k.sunLatitude)*Math.PI/180,e=k.sunLongitude*Math.PI/180,t=Math.cos(r),n=Math.sin(r),i=Math.cos(e),s=Math.sin(e),o=n*i,a=n*s,l=t;k.sunDir=[o,l,a]}function Lb(){_n=new wb.Circle("#progress_overlay",{color:"rgba(255, 128, 64, 0.75)",strokeWidth:5,trailColor:"rgba(255, 128, 64, 0.333)",trailWidth:3,svgStyle:{display:"block",width:"100%"},text:{value:"",className:"progressbar__label",style:{color:"rgba(169, 85, 42, 1.0)",position:"absolute",fontWeight:"bold",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0},fill:null,duration:2e3,easing:"linear",from:{color:"rgba( 0, 0, 0, 0.0)"},to:{color:"rgba(32, 255, 32, 1.0)"},warnings:!0}),_n.set(0),_n.setText(""),_a=!1,es=null,ts=null,Tl=null,Al=null,qt=new Pf({antialias:!0,preserveDrawingBuffer:!0}),qt.setPixelRatio(window.devicePixelRatio),qt.setClearColor(594970),qt.setSize(window.innerWidth,window.innerHeight),qt.outputEncoding=Yi,document.body.appendChild(qt.domElement),fr=new x0;const r=new Bf(16777215,1);r.position.set(1,1,1),fr.add(r),fr.add(new Y0(11583173,.5)),as=new qx,document.body.appendChild(as.dom);let e=document.getElementById("samples");e.style.visibility="visible";let t=document.getElementById("info");t.style.visibility="visible",Qe=new Ki({defines:{BOUNCES:k.bounces,MAX_VOLUME_STEPS:k.max_volume_steps,COAT_ENABLED:!1,TRANSMISSION_ENABLED:!1,VOLUME_ENABLED:!1,DISPERSION_ENABLED:!1,THIN_FILM_ENABLED:!1},uniforms:{bvh_surface:{value:new kh},normalAttribute_surface:{value:new Vs},tangentAttribute_surface:{value:new Vs},has_normals_surface:{value:1},has_tangents_surface:{value:0},bvh_props:{value:new kh},normalAttribute_props:{value:new Vs},tangentAttribute_props:{value:new Vs},has_normals_props:{value:1},has_tangents_props:{value:0},cameraWorldMatrix:{value:new Ve},invProjectionMatrix:{value:new Ve},invModelMatrix:{value:new Ve},resolution:{value:new Ue},samples:{value:0},accumulation_weight:{value:1},wireframe:{value:k.wireframe},neutral_color:{value:new C().fromArray(k.neutral_color)},smooth_normals:{value:k.smooth_normals},skyPower:{value:k.skyPower},skyColor:{value:Bn(k.skyColor)},sunPower:{value:Math.pow(10,k.sunPower)},sunAngularSize:{value:k.sunAngularSize},sunColor:{value:Bn(k.sunColor)},sunDir:{value:Bn([0,0,0])},diffuse_mode:{value:k.diffuse_mode},base_weight:{value:k.base_weight},base_color:{value:Bn(k.base_color)},base_roughness:{value:k.base_roughness},base_metalness:{value:k.base_metalness},specular_weight:{value:k.specular_weight},specular_color:{value:Bn(k.specular_color)},specular_roughness:{value:k.specular_roughness},specular_anisotropy:{value:k.specular_anisotropy},specular_rotation:{value:k.specular_rotation},specular_ior:{value:k.specular_ior},transmission_weight:{value:k.transmission_weight},transmission_color:{value:Bn(k.transmission_color)},transmission_depth:{value:k.transmission_depth},transmission_scatter:{value:Bn(k.transmission_scatter)},transmission_scatter_anisotropy:{value:k.transmission_scatter_anisotropy},transmission_dispersion_abbe_number:{value:k.transmission_dispersion_abbe_number},transmission_dispersion_scale:{value:k.transmission_dispersion_scale},subsurface_weight:{value:k.subsurface_weight},subsurface_color:{value:Bn(k.subsurface_color)},subsurface_radius:{value:k.subsurface_radius},subsurface_radius_scale:{value:Bn(k.subsurface_radius_scale)},subsurface_anisotropy:{value:k.subsurface_anisotropy},subsurface_mode:{value:k.subsurface_mode},coat_weight:{value:k.coat_weight},coat_color:{value:Bn(k.coat_color)},coat_roughness:{value:k.coat_roughness},coat_anisotropy:{value:k.coat_anisotropy},coat_rotation:{value:k.coat_rotation},coat_ior:{value:k.coat_ior},coat_darkening:{value:k.coat_darkening},fuzz_weight:{value:k.fuzz_weight},fuzz_color:{value:Bn(k.fuzz_color)},fuzz_roughness:{value:k.fuzz_roughness},emission_luminance:{value:k.emission_luminance},emission_color:{value:Bn(k.emission_color)},thin_film_weight:{value:k.thin_film_weight},thin_film_thickness:{value:k.thin_film_thickness},thin_film_ior:{value:k.thin_film_ior},geometry_opacity:{value:k.geometry_opacity},geometry_thin_walled:{value:k.geometry_thin_walled}},vertexShader:` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}();var G}},{key:"playingTweenables",get:function(){return Jt(this,nn).filter(function(G){return!G.hasEnded()})}},{key:"promises",get:function(){return Jt(this,nn).map(function(G){return G.then()})}}])&&Er(B.prototype,te),w}();ft.filters.token=h}},o={};function a(l){if(o[l])return o[l].exports;var c=o[l]={exports:{}};return s[l](c,c.exports,a),c.exports}return a.d=function(l,c){for(var u in c)a.o(c,u)&&!a.o(l,u)&&Object.defineProperty(l,u,{enumerable:!0,get:c[u]})},a.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),a.o=function(l,c){return Object.prototype.hasOwnProperty.call(l,c)},a.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},a(720)}()})},{}],3:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate="M 50,50 m 0,-{radius} a {radius},{radius} 0 1 1 0,{2radius} a {radius},{radius} 0 1 1 0,-{2radius}",this.containerAspectRatio=1,s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._pathString=function(c){var u=c.strokeWidth;c.trailWidth&&c.trailWidth>c.strokeWidth&&(u=c.trailWidth);var f=50-u/2;return o.render(this._pathTemplate,{radius:f,"2radius":f*2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],4:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate=u.vertical?"M {center},100 L {center},0":"M 0,{center} L 100,{center}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._initializeSvg=function(c,u){var f=u.vertical?"0 0 "+u.strokeWidth+" 100":"0 0 100 "+u.strokeWidth;c.setAttribute("viewBox",f),c.setAttribute("preserveAspectRatio","none")},a.prototype._pathString=function(c){return o.render(this._pathTemplate,{center:c.strokeWidth/2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],5:[function(t,n,i){n.exports={Line:t("./line"),Circle:t("./circle"),SemiCircle:t("./semicircle"),Square:t("./square"),Path:t("./path"),Shape:t("./shape"),utils:t("./utils")}},{"./circle":3,"./line":4,"./path":6,"./semicircle":7,"./shape":8,"./square":9,"./utils":10}],6:[function(t,n,i){var s=t("shifty"),o=t("./utils"),a=s.Tweenable,l={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},c=function u(f,h){if(!(this instanceof u))throw new Error("Constructor was called without new keyword");h=o.extend({delay:0,duration:800,easing:"linear",from:{},to:{},step:function(){}},h);var p;o.isString(f)?p=document.querySelector(f):p=f,this.path=p,this._opts=h,this._tweenable=null;var _=this.path.getTotalLength();this.path.style.strokeDasharray=_+" "+_,this.set(0)};c.prototype.value=function(){var f=this._getComputedDashOffset(),h=this.path.getTotalLength(),p=1-f/h;return parseFloat(p.toFixed(6),10)},c.prototype.set=function(f){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(f);var h=this._opts.step;if(o.isFunction(h)){var p=this._easing(this._opts.easing),_=this._calculateTo(f,p),g=this._opts.shape||this;h(_,g,this._opts.attachment)}},c.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},c.prototype.animate=function(f,h,p){h=h||{},o.isFunction(h)&&(p=h,h={});var _=o.extend({},h),g=o.extend({},this._opts);h=o.extend(g,h);var m=this._easing(h.easing),d=this._resolveFromAndTo(f,m,_);this.stop(),this.path.getBoundingClientRect();var x=this._getComputedDashOffset(),v=this._progressToOffset(f),y=this;this._tweenable=new a,this._tweenable.tween({from:o.extend({offset:x},d.from),to:o.extend({offset:v},d.to),duration:h.duration,delay:h.delay,easing:m,step:function(b){y.path.style.strokeDashoffset=b.offset;var M=h.shape||y;h.step(b,M,h.attachment)}}).then(function(b){o.isFunction(p)&&p()}).catch(function(b){throw console.error("Error in tweening:",b),b})},c.prototype._getComputedDashOffset=function(){var f=window.getComputedStyle(this.path,null);return parseFloat(f.getPropertyValue("stroke-dashoffset"),10)},c.prototype._progressToOffset=function(f){var h=this.path.getTotalLength();return h-f*h},c.prototype._resolveFromAndTo=function(f,h,p){return p.from&&p.to?{from:p.from,to:p.to}:{from:this._calculateFrom(h),to:this._calculateTo(f,h)}},c.prototype._calculateFrom=function(f){return s.interpolate(this._opts.from,this._opts.to,this.value(),f)},c.prototype._calculateTo=function(f,h){return s.interpolate(this._opts.from,this._opts.to,f,h)},c.prototype._stopTween=function(){this._tweenable!==null&&(this._tweenable.stop(!0),this._tweenable=null)},c.prototype._easing=function(f){return l.hasOwnProperty(f)?l[f]:f},n.exports=c},{"./utils":10,shifty:2}],7:[function(t,n,i){var s=t("./shape"),o=t("./circle"),a=t("./utils"),l=function(u,f){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,s.apply(this,arguments)};l.prototype=new s,l.prototype.constructor=l,l.prototype._initializeSvg=function(u,f){u.setAttribute("viewBox","0 0 100 50")},l.prototype._initializeTextContainer=function(u,f,h){u.text.style&&(h.style.top="auto",h.style.bottom="0",u.text.alignToBottom?a.setStyle(h,"transform","translate(-50%, 0)"):a.setStyle(h,"transform","translate(-50%, 50%)"))},l.prototype._pathString=o.prototype._pathString,l.prototype._trailString=o.prototype._trailString,n.exports=l},{"./circle":3,"./shape":8,"./utils":10}],8:[function(t,n,i){var s=t("./path"),o=t("./utils"),a="Object is destroyed",l=function c(u,f){if(!(this instanceof c))throw new Error("Constructor was called without new keyword");if(arguments.length!==0){this._opts=o.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},f,!0),o.isObject(f)&&f.svgStyle!==void 0&&(this._opts.svgStyle=f.svgStyle),o.isObject(f)&&o.isObject(f.text)&&f.text.style!==void 0&&(this._opts.text.style=f.text.style);var h=this._createSvgView(this._opts),p;if(o.isString(u)?p=document.querySelector(u):p=u,!p)throw new Error("Container does not exist: "+u);this._container=p,this._container.appendChild(h.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&o.setStyles(h.svg,this._opts.svgStyle),this.svg=h.svg,this.path=h.path,this.trail=h.trail,this.text=null;var _=o.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new s(h.path,_),o.isObject(this._opts.text)&&this._opts.text.value!==null&&this.setText(this._opts.text.value)}};l.prototype.animate=function(u,f,h){if(this._progressPath===null)throw new Error(a);this._progressPath.animate(u,f,h)},l.prototype.stop=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath.stop()},l.prototype.pause=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.pause()},l.prototype.resume=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.resume()},l.prototype.destroy=function(){if(this._progressPath===null)throw new Error(a);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,this.text!==null&&(this.text.parentNode.removeChild(this.text),this.text=null)},l.prototype.set=function(u){if(this._progressPath===null)throw new Error(a);this._progressPath.set(u)},l.prototype.value=function(){if(this._progressPath===null)throw new Error(a);return this._progressPath===void 0?0:this._progressPath.value()},l.prototype.setText=function(u){if(this._progressPath===null)throw new Error(a);this.text===null&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),o.isObject(u)?(o.removeChildren(this.text),this.text.appendChild(u)):this.text.innerHTML=u},l.prototype._createSvgView=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(f,u);var h=null;(u.trailColor||u.trailWidth)&&(h=this._createTrail(u),f.appendChild(h));var p=this._createPath(u);return f.appendChild(p),{svg:f,path:p,trail:h}},l.prototype._initializeSvg=function(u,f){u.setAttribute("viewBox","0 0 100 100")},l.prototype._createPath=function(u){var f=this._pathString(u);return this._createPathElement(f,u)},l.prototype._createTrail=function(u){var f=this._trailString(u),h=o.extend({},u);return h.trailColor||(h.trailColor="#eee"),h.trailWidth||(h.trailWidth=h.strokeWidth),h.color=h.trailColor,h.strokeWidth=h.trailWidth,h.fill=null,this._createPathElement(f,h)},l.prototype._createPathElement=function(u,f){var h=document.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d",u),h.setAttribute("stroke",f.color),h.setAttribute("stroke-width",f.strokeWidth),f.fill?h.setAttribute("fill",f.fill):h.setAttribute("fill-opacity","0"),h},l.prototype._createTextContainer=function(u,f){var h=document.createElement("div");h.className=u.text.className;var p=u.text.style;return p&&(u.text.autoStyleContainer&&(f.style.position="relative"),o.setStyles(h,p),p.color||(h.style.color=u.color)),this._initializeTextContainer(u,f,h),h},l.prototype._initializeTextContainer=function(c,u,f){},l.prototype._pathString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._trailString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._warnContainerAspectRatio=function(u){if(this.containerAspectRatio){var f=window.getComputedStyle(u,null),h=parseFloat(f.getPropertyValue("width"),10),p=parseFloat(f.getPropertyValue("height"),10);o.floatEquals(this.containerAspectRatio,h/p)||(console.warn("Incorrect aspect ratio of container","#"+u.id,"detected:",f.getPropertyValue("width")+"(width)","/",f.getPropertyValue("height")+"(height)","=",h/p),console.warn("Aspect ratio of should be",this.containerAspectRatio))}},n.exports=l},{"./path":6,"./utils":10}],9:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._pathString=function(c){var u=100-c.strokeWidth/2;return o.render(this._pathTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2})},a.prototype._trailString=function(c){var u=100-c.strokeWidth/2;return o.render(this._trailTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2,startMargin:c.strokeWidth/2-c.trailWidth/2})},n.exports=a},{"./shape":8,"./utils":10}],10:[function(t,n,i){var s=t("lodash.merge"),o="Webkit Moz O ms".split(" "),a=.001;function l(v,y){var b=v;for(var M in y)if(y.hasOwnProperty(M)){var T=y[M],I="\\{"+M+"\\}",S=new RegExp(I,"g");b=b.replace(S,T)}return b}function c(v,y,b){for(var M=v.style,T=0;T{if(o.isMesh){const a=new nb(o);a.attributes=["position","color","normal","tangent","uv","uv2"],a.applyWorldTransforms=!1;const l={strategy:Gf,maxLeafTris:1};let c=new mc(a.generate(),l);return new Mn(a.generate(),o.material),this.result={scene:t.scene,bvh:c,mesh:o},console.log("==> loaded mesh ",e),this.result}});return this.result}}function Bn(r){return new C(r[0],r[1],r[2])}const k={smooth_normals:!0,bounces:6,max_samples:1024,max_volume_steps:8,wireframe:!0,neutral_color:[.5,.5,.5],skyPower:.5,skyColor:[.8,.8,1],sunPower:.35,sunAngularSize:40,sunLatitude:40,sunLongitude:180,sunColor:[1,1,.8],base_weight:1,base_color:[.8,.8,.8],base_roughness:0,base_metalness:0,diffuse_mode:1,specular_weight:1,specular_color:[1,1,1],specular_roughness:.1,specular_anisotropy:0,specular_rotation:0,specular_ior:1.6,transmission_weight:0,transmission_color:[1,1,1],transmission_depth:0,transmission_scatter:[0,0,0],transmission_scatter_anisotropy:0,transmission_dispersion_abbe_number:20,transmission_dispersion_scale:0,subsurface_weight:0,subsurface_color:[.8,.8,.8],subsurface_radius:.2,subsurface_radius_scale:[1,.5,.25],subsurface_anisotropy:0,subsurface_mode:0,coat_weight:0,coat_color:[1,1,1],coat_roughness:0,coat_anisotropy:0,coat_rotation:0,coat_ior:1.3,coat_darkening:1,fuzz_weight:0,fuzz_color:[1,1,1],fuzz_roughness:.5,emission_luminance:0,emission_color:[1,1,1],thin_film_weight:0,thin_film_thickness:1e3,thin_film_ior:1.4,geometry_opacity:1,geometry_thin_walled:!1,reset_camera:function(){vc()}};let qt,Mt,Ot,fr,Gi,as,ma,Qe,Zf,io,cr=0,es,ts,Tl,Al;var _n,gc,_a,Ks,Tb={"OpenPBR (orig, 3-float)":0,"OpenPBR (luminace)":1,"OpenPBR (average)":2,"OpenPBR (max value)":3,"OpenPBR (weighted average)":4,"SPI / Arnold v1":5,"Arnold v2":6,"Uniform scattering":7},Ab={Lambert:0,"ON Qualitative (QON)":1,"ON Full (Mitsuba)":2,"d'Eon sphere model":3,"Fujii - Qualitative (FON)":4,"Fujii - MaterialX":5,"Chan Diffuse (Unreal)":6,"Fujii - Energy Conserving (EON)":7};Lb();Zs();function Rb(){let r=(90-k.sunLatitude)*Math.PI/180,e=k.sunLongitude*Math.PI/180,t=Math.cos(r),n=Math.sin(r),i=Math.cos(e),s=Math.sin(e),o=n*i,a=n*s,l=t;k.sunDir=[o,l,a]}function Lb(){_n=new wb.Circle("#progress_overlay",{color:"rgba(255, 128, 64, 0.75)",strokeWidth:5,trailColor:"rgba(255, 128, 64, 0.333)",trailWidth:3,svgStyle:{display:"block",width:"100%"},text:{value:"",className:"progressbar__label",style:{color:"rgba(169, 85, 42, 1.0)",position:"absolute",fontWeight:"bold",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0},fill:null,duration:2e3,easing:"linear",from:{color:"rgba( 0, 0, 0, 0.0)"},to:{color:"rgba(32, 255, 32, 1.0)"},warnings:!0}),_n.set(0),_n.setText(""),_a=!1,es=null,ts=null,Tl=null,Al=null,qt=new Pf({antialias:!0,preserveDrawingBuffer:!0}),qt.setPixelRatio(window.devicePixelRatio),qt.setClearColor(594970),qt.setSize(window.innerWidth,window.innerHeight),qt.outputEncoding=Yi,document.body.appendChild(qt.domElement),fr=new x0;const r=new Bf(16777215,1);r.position.set(1,1,1),fr.add(r),fr.add(new Y0(11583173,.5)),as=new qx,document.body.appendChild(as.dom);let e=document.getElementById("samples");e.style.visibility="visible";let t=document.getElementById("info");t.style.visibility="visible",Qe=new Ki({defines:{BOUNCES:k.bounces,MAX_VOLUME_STEPS:k.max_volume_steps,COAT_ENABLED:!1,TRANSMISSION_ENABLED:!1,VOLUME_ENABLED:!1,DISPERSION_ENABLED:!1,THIN_FILM_ENABLED:!1},uniforms:{bvh_surface:{value:new kh},normalAttribute_surface:{value:new Vs},tangentAttribute_surface:{value:new Vs},has_normals_surface:{value:1},has_tangents_surface:{value:0},bvh_props:{value:new kh},normalAttribute_props:{value:new Vs},tangentAttribute_props:{value:new Vs},has_normals_props:{value:1},has_tangents_props:{value:0},cameraWorldMatrix:{value:new Ve},invProjectionMatrix:{value:new Ve},invModelMatrix:{value:new Ve},resolution:{value:new Ue},samples:{value:0},accumulation_weight:{value:1},wireframe:{value:k.wireframe},neutral_color:{value:new C().fromArray(k.neutral_color)},smooth_normals:{value:k.smooth_normals},skyPower:{value:k.skyPower},skyColor:{value:Bn(k.skyColor)},sunPower:{value:Math.pow(10,k.sunPower)},sunAngularSize:{value:k.sunAngularSize},sunColor:{value:Bn(k.sunColor)},sunDir:{value:Bn([0,0,0])},diffuse_mode:{value:k.diffuse_mode},base_weight:{value:k.base_weight},base_color:{value:Bn(k.base_color)},base_roughness:{value:k.base_roughness},base_metalness:{value:k.base_metalness},specular_weight:{value:k.specular_weight},specular_color:{value:Bn(k.specular_color)},specular_roughness:{value:k.specular_roughness},specular_anisotropy:{value:k.specular_anisotropy},specular_rotation:{value:k.specular_rotation},specular_ior:{value:k.specular_ior},transmission_weight:{value:k.transmission_weight},transmission_color:{value:Bn(k.transmission_color)},transmission_depth:{value:k.transmission_depth},transmission_scatter:{value:Bn(k.transmission_scatter)},transmission_scatter_anisotropy:{value:k.transmission_scatter_anisotropy},transmission_dispersion_abbe_number:{value:k.transmission_dispersion_abbe_number},transmission_dispersion_scale:{value:k.transmission_dispersion_scale},subsurface_weight:{value:k.subsurface_weight},subsurface_color:{value:Bn(k.subsurface_color)},subsurface_radius:{value:k.subsurface_radius},subsurface_radius_scale:{value:Bn(k.subsurface_radius_scale)},subsurface_anisotropy:{value:k.subsurface_anisotropy},subsurface_mode:{value:k.subsurface_mode},coat_weight:{value:k.coat_weight},coat_color:{value:Bn(k.coat_color)},coat_roughness:{value:k.coat_roughness},coat_anisotropy:{value:k.coat_anisotropy},coat_rotation:{value:k.coat_rotation},coat_ior:{value:k.coat_ior},coat_darkening:{value:k.coat_darkening},fuzz_weight:{value:k.fuzz_weight},fuzz_color:{value:Bn(k.fuzz_color)},fuzz_roughness:{value:k.fuzz_roughness},emission_luminance:{value:k.emission_luminance},emission_color:{value:Bn(k.emission_color)},thin_film_weight:{value:k.thin_film_weight},thin_film_thickness:{value:k.thin_film_thickness},thin_film_ior:{value:k.thin_film_ior},geometry_opacity:{value:k.geometry_opacity},geometry_thin_walled:{value:k.geometry_thin_walled}},vertexShader:` varying vec2 vUv; void main() { @@ -7027,4 +7037,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho precision highp int; ${Ky} ${Zy} - `+mb+_b+gb+xb+yb+vb+bb+Sb+Eb}),_n.setText("loading meshes..."),_n.animate(.5);const n=new Mb;n.load("standard-shader-ball/neutral_objects.gltf").then(()=>{fr.add(n.result.scene),ts=n.result.mesh,Al=n.result.bvh,Qe.uniforms.bvh_props.value.updateFrom(Al),Qe.uniforms.has_normals_props.value=!1,Qe.uniforms.has_tangents_props.value=!1,ts.geometry.attributes.normal&&(Qe.uniforms.normalAttribute_props.value.updateFrom(ts.geometry.attributes.normal),Qe.uniforms.has_normals_props.value=!0),ts.geometry.attributes.tangent&&(Qe.uniforms.tangentAttribute_props.value.updateFrom(ts.geometry.attributes.tangent),Qe.uniforms.has_tangents_props.value=!0),console.log(" has_normals_scene: ",Qe.uniforms.has_normals_props),console.log(" has_tangents_scene: ",Qe.uniforms.has_tangents_props),_n.animate(.75),n.reset(),n.load("standard-shader-ball/shaderball.gltf").then(()=>{fr.add(n.result.scene),es=n.result.mesh,Tl=n.result.bvh,Qe.uniforms.bvh_surface.value.updateFrom(Tl),Qe.uniforms.has_normals_surface.value=!1,Qe.uniforms.has_tangents_surface.value=!1,es.geometry.attributes.normal&&(Qe.uniforms.normalAttribute_surface.value.updateFrom(es.geometry.attributes.normal),Qe.uniforms.has_normals_surface.value=!0),es.geometry.attributes.tangent&&(Qe.uniforms.tangentAttribute_surface.value.updateFrom(es.geometry.attributes.tangent),Qe.uniforms.has_tangents_surface.value=!0),console.log(" has_normals_surface: ",Qe.uniforms.has_normals_surface),console.log(" has_tangents_surface: ",Qe.uniforms.has_tangents_surface),console.log("===> LOADED"),_a=!0,Cb(),_n.animate(1),document.getElementById("progress_overlay"),gc=performance.now()})})}function vc(){let r=23.6701655,e=.01,t=1e3;Mt=new gn(r,window.innerWidth/window.innerHeight,e,t),Ot=new ox(Mt,qt.domElement),Ot.addEventListener("change",()=>{Le()});let n=new Ve;n.set(.9396926207859084,0,-.3420201433256687,0,-.2203032561704394,.7649214009184319,-.6052782217606094,0,.26161852717499334,.6441236297613865,.7187909959242699,0,6.531538924716362,19.5,17.948521838355774,1),n.transpose(),Mt.matrixAutoUpdate=!1,Mt.applyMatrix4(n),Mt.matrixAutoUpdate=!0,Mt.updateMatrixWorld();let i=new C;Mt.getWorldDirection(i);let s=Mt.position.clone();s.addScaledVector(i,23.39613),Ot.target.copy(s),Ot.zoomSpeed=1.5,Ot.flySpeed=.01,Ot.update()}function jh(){return k.coat_weight!=0}function ki(){return k.base_metalness==1?!1:k.transmission_weight>0&&k.transmission_depth>0||k.subsurface_weight>0}function ia(){return k.transmission_weight>0||k.subsurface_weight>0}function Yh(){return k.transmission_dispersion_scale>0}function $h(){return k.thin_film_weight>0}function Cb(){ma=new gh(Qe),Qe.transparent=!0,Qe.depthWrite=!1,io=new $i(1,1,{format:sn,type:vn}),Zf=new gh(new Wi({map:io.texture})),zn(),vc(),Gi=new _c({width:300});const r=Gi.addFolder("Material"),e=r.addFolder("Base");e.add(k,"base_weight",0,1).onChange(h=>{Le()}),e.addColor(k,"base_color").onChange(h=>{Le()}),e.add(k,"base_roughness",0,1).onChange(h=>{Le()}),e.add(k,"base_metalness",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn())}),e.add(k,"diffuse_mode",Ab).onChange(h=>{Le()});const t=r.addFolder("Specular");t.add(k,"specular_weight",0,1).onChange(h=>{Le()}),t.addColor(k,"specular_color").onChange(h=>{Le()}),t.add(k,"specular_roughness",0,1).onChange(h=>{Le()}),t.add(k,"specular_ior",1,5).onChange(h=>{Le()}),t.add(k,"specular_anisotropy",0,1).onChange(h=>{Le()}),t.add(k,"specular_rotation",0,1).onChange(h=>{Le()});const n=r.addFolder("Transmission");n.add(k,"transmission_weight",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn()),ia()!=Qe.defines.TRANSMISSION_ENABLED&&(Qe.defines.TRANSMISSION_ENABLED=ia(),zn())}),n.addColor(k,"transmission_color").onChange(h=>{Le()}),n.add(k,"transmission_depth",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn())}),n.addColor(k,"transmission_scatter").onChange(h=>{Le()}),n.add(k,"transmission_scatter_anisotropy",-1,1).onChange(h=>{Le()}),n.add(k,"transmission_dispersion_abbe_number",9,91).onChange(h=>{Le()}),n.add(k,"transmission_dispersion_scale",0,1).onChange(h=>{Le(),Yh()!=Qe.defines.DISPERSION_ENABLED&&(Qe.defines.DISPERSION_ENABLED=Yh(),zn())}),n.close();const i=r.addFolder("Subsurface");i.add(k,"subsurface_weight",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn()),ia()!=Qe.defines.TRANSMISSION_ENABLED&&(Qe.defines.TRANSMISSION_ENABLED=ia(),zn())}),i.addColor(k,"subsurface_color").onChange(h=>{Le()}),i.add(k,"subsurface_radius",0,1).onChange(h=>{Le()}),i.addColor(k,"subsurface_radius_scale").onChange(h=>{Le()}),i.add(k,"subsurface_anisotropy",-1,1).onChange(h=>{Le()}),i.add(k,"subsurface_mode",Tb).onChange(h=>{Le()}),i.close();const s=r.addFolder("Coat");s.add(k,"coat_weight",0,1).onChange(h=>{Le(),jh()!=Qe.defines.COAT_ENABLED&&(Qe.defines.COAT_ENABLED=jh(),zn())}),s.addColor(k,"coat_color").onChange(h=>{Le()}),s.add(k,"coat_roughness",0,1).onChange(h=>{Le()}),s.add(k,"coat_ior",1,3).onChange(h=>{Le()}),s.add(k,"coat_anisotropy",0,1).onChange(h=>{Le()}),s.add(k,"coat_rotation",0,1).onChange(h=>{Le()}),s.add(k,"coat_darkening",0,1).onChange(h=>{Le()}),s.close();const o=r.addFolder("Fuzz");o.add(k,"fuzz_weight",0,1).onChange(h=>{Le()}),o.addColor(k,"fuzz_color").onChange(h=>{Le()}),o.add(k,"fuzz_roughness",0,1).onChange(h=>{Le()}),o.close();const a=r.addFolder("Emission");a.add(k,"emission_luminance",0,10).onChange(h=>{Le()}),a.addColor(k,"emission_color").onChange(h=>{Le()}),a.close();const l=r.addFolder("Thin Film");l.add(k,"thin_film_weight",0,1).onChange(h=>{Le(),$h()!=Qe.defines.THIN_FILM_ENABLED&&(Qe.defines.THIN_FILM_ENABLED=$h(),zn())}),l.add(k,"thin_film_thickness",0,2e3).onChange(h=>{Le()}),l.add(k,"thin_film_ior",1,3).onChange(h=>{Le()}),l.close();const c=r.addFolder("Geometry");c.add(k,"geometry_opacity",0,1).onChange(h=>{Le()}),c.add(k,"geometry_thin_walled").onChange(h=>{Le()}),c.close();const u=Gi.addFolder("Lighting");u.add(k,"skyPower",0,2).onChange(h=>{Le()}),u.addColor(k,"skyColor").onChange(h=>{Le()}),u.add(k,"sunPower",-4,4).onChange(h=>{Le()}),u.add(k,"sunAngularSize",0,40).onChange(h=>{Le()}),u.add(k,"sunLatitude",0,90).onChange(h=>{Le()}),u.add(k,"sunLongitude",0,360).onChange(h=>{Le()}),u.addColor(k,"sunColor").onChange(h=>{Le()}),u.close();const f=Gi.addFolder("Renderer");f.add(k,"smooth_normals").onChange(h=>{Le()}),f.add(k,"wireframe").onChange(h=>{Le()}),f.addColor(k,"neutral_color").onChange(h=>{Le()}),f.add(k,"bounces",0,100,1).onChange(h=>{Qe.defines.BOUNCES=parseInt(h),Le(),zn()}),f.add(k,"max_samples").onChange(h=>{Le()}),f.add(k,"max_volume_steps",1,100,1).onChange(h=>{Qe.defines.MAX_VOLUME_STEPS=parseInt(h),Le(),zn()}),f.close(),Gi.add(k,"reset_camera"),Gi.open(),window.addEventListener("resize",Kh,!1),Kh()}function zn(){qt.setRenderTarget(io);let r=new oo(-1,1,1,-1,0,1);Pb(),qt.compileAsync(ma._mesh,r).then(t=>{console.log("shaders successfully compiled."),Db()}).catch(t=>{console.log("shader compilation error: "+t)}).finally(()=>{})}function Pb(){let r=document.getElementById("progress_overlay");r.style.display="block",r.style.opacity=1,_n.set(0),_n.setText("shaders compiling..."),Ks=!0}function Db(){_n.set(1),gc=performance.now(),Ks=!1}function Kh(){Mt.aspect=window.innerWidth/window.innerHeight,Mt.updateProjectionMatrix();const r=window.innerWidth,e=window.innerHeight;qt.setSize(r,e),qt.setPixelRatio(1),io.setSize(r,e),Le()}function Pn(r){return new C(r[0],r[1],r[2])}function Le(){Qe&&(Qe.needsUpdate=!0),cr=0}function Ib(r){let e=document.getElementById("progress_overlay");var t=setInterval(function(){e.style.opacity||(e.style.opacity=1),e.style.opacity>0?e.style.opacity-=.025:(e.style.display="none",e.style.opacity=0,clearInterval(t))},r)}function Zs(){if(!_a){console.log("not LOADED"),requestAnimationFrame(Zs);return}if(qt.domElement.style.imageRendering="auto",cr>=k.max_samples){requestAnimationFrame(Zs);return}if(!Ks&&_a){Mt.updateMatrixWorld();const r=ma.material.uniforms,e=window.innerWidth,t=window.innerHeight;r.cameraWorldMatrix.value.copy(Mt.matrixWorld),r.invProjectionMatrix.value.copy(Mt.projectionMatrixInverse),r.invModelMatrix.value.copy(fr.matrixWorld).invert();let n=new Ue(e,t);r.resolution.value.copy(n),r.accumulation_weight.value=1/(cr+1),r.samples.value=cr,r.wireframe.value=k.wireframe,r.neutral_color.value.copy(Pn(k.neutral_color)),r.smooth_normals.value=k.smooth_normals,r.base_weight.value=k.base_weight,r.base_color.value.copy(Pn(k.base_color)),r.base_roughness.value=k.base_roughness,r.base_metalness.value=k.base_metalness,r.diffuse_mode.value=k.diffuse_mode,r.specular_weight.value=k.specular_weight,r.specular_color.value.copy(Pn(k.specular_color)),r.specular_roughness.value=k.specular_roughness,r.specular_anisotropy.value=k.specular_anisotropy,r.specular_rotation.value=k.specular_rotation,r.specular_ior.value=k.specular_ior,r.transmission_weight.value=k.transmission_weight,r.transmission_color.value.copy(Pn(k.transmission_color)),r.transmission_depth.value=k.transmission_depth,r.transmission_scatter.value.copy(Pn(k.transmission_scatter)),r.transmission_scatter_anisotropy.value=k.transmission_scatter_anisotropy,r.transmission_dispersion_abbe_number.value=k.transmission_dispersion_abbe_number,r.transmission_dispersion_scale.value=k.transmission_dispersion_scale,r.subsurface_weight.value=k.subsurface_weight,r.subsurface_color.value.copy(Pn(k.subsurface_color)),r.subsurface_radius.value=k.subsurface_radius,r.subsurface_radius_scale.value.copy(Pn(k.subsurface_radius_scale)),r.subsurface_anisotropy.value=k.subsurface_anisotropy,r.subsurface_mode.value=k.subsurface_mode,r.coat_weight.value=k.coat_weight,r.coat_color.value.copy(Pn(k.coat_color)),r.coat_roughness.value=k.coat_roughness,r.coat_anisotropy.value=k.coat_anisotropy,r.coat_rotation.value=k.coat_rotation,r.coat_ior.value=k.coat_ior,r.coat_darkening.value=k.coat_darkening,r.fuzz_weight.value=k.fuzz_weight,r.fuzz_color.value.copy(Pn(k.fuzz_color)),r.fuzz_roughness.value=k.fuzz_roughness,r.emission_luminance.value=k.emission_luminance,r.emission_color.value.copy(Pn(k.emission_color)),r.thin_film_weight.value=k.thin_film_weight,r.thin_film_thickness.value=k.thin_film_thickness,r.thin_film_ior.value=k.thin_film_ior,r.geometry_opacity.value=k.geometry_opacity,r.geometry_thin_walled.value=k.geometry_thin_walled,r.skyPower.value=k.skyPower,r.skyColor.value.copy(Pn(k.skyColor)),r.sunPower.value=Math.pow(10,k.sunPower),r.sunAngularSize.value=k.sunAngularSize,r.sunColor.value.copy(Pn(k.sunColor)),Rb(),r.sunDir.value.copy(Pn(k.sunDir)),qt.autoClear=cr===0,qt.setRenderTarget(io),ma.render(qt),qt.setRenderTarget(null),Zf.render(qt),qt.autoClear=!0,cr++}else Le(),Mt.updateProjectionMatrix(),Mt.clearViewOffset(),qt.render(fr,Mt);document.getElementById("samples").innerText=`samples: ${cr}`,Ks||document.getElementById("progress_overlay").style.display!="none"&&performance.now()-gc>300&&Ib(300),Ks&&(_n.value()<.01?_n.animate(1):_n.value()>.99&&(_n.set(0),_n.animate(1))),as.update(),requestAnimationFrame(Zs)}document.onkeydown=function(r){r=r||window.event;var e=r.which?r.which:r.keyCode;switch(e){case 122:{var t=document.body;"webkitCancelFullScreen"in document?t.webkitRequestFullScreen():"mozCancelFullScreen"in document?t.mozRequestFullScreen():console.assert(!1),Ot.update(),Le();break}case 70:{vc();break}case 72:{Gi.show(Gi._hidden),document.body.contains(as.dom)?document.body.removeChild(as.dom):document.body.appendChild(as.dom);let a=document.getElementById("info");a.style.visibility=="visible"?a.style.visibility="hidden":a.style.visibility="visible";let l=document.getElementById("samples");l.style.visibility=="visible"?l.style.visibility="hidden":l.style.visibility="visible";break}case 87:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();a.normalize();var n=new C;n.copy(a),n.multiplyScalar(Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 65:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();var i=new C(1,0,0),s=i.transformDirection(Mt.matrix),n=new C;n.copy(s),n.multiplyScalar(-Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 83:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();a.normalize();var n=new C;n.copy(a),n.multiplyScalar(-Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 68:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();var i=new C(1,0,0),s=i.transformDirection(Mt.matrix),n=new C;n.copy(s),n.multiplyScalar(Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 80:{var o=document.createElement("a");let a="openpbr-example-screenshot.png";o.download=a,qt.domElement.toBlob(function(l){o.href=URL.createObjectURL(l);var c=new MouseEvent("click");o.dispatchEvent(c),requestAnimationFrame(Zs)},"image/png",1);break}}}; + `+mb+_b+gb+xb+yb+vb+bb+Sb+Eb}),_n.setText("loading meshes..."),_n.animate(.5);const n=new Mb;n.load("standard-shader-ball/neutral_objects.gltf").then(()=>{fr.add(n.result.scene),ts=n.result.mesh,Al=n.result.bvh,Qe.uniforms.bvh_props.value.updateFrom(Al),Qe.uniforms.has_normals_props.value=!1,Qe.uniforms.has_tangents_props.value=!1,ts.geometry.attributes.normal&&(Qe.uniforms.normalAttribute_props.value.updateFrom(ts.geometry.attributes.normal),Qe.uniforms.has_normals_props.value=!0),ts.geometry.attributes.tangent&&(Qe.uniforms.tangentAttribute_props.value.updateFrom(ts.geometry.attributes.tangent),Qe.uniforms.has_tangents_props.value=!0),console.log(" has_normals_scene: ",Qe.uniforms.has_normals_props),console.log(" has_tangents_scene: ",Qe.uniforms.has_tangents_props),_n.animate(.75),n.reset(),n.load("standard-shader-ball/shaderball.gltf").then(()=>{fr.add(n.result.scene),es=n.result.mesh,Tl=n.result.bvh,Qe.uniforms.bvh_surface.value.updateFrom(Tl),Qe.uniforms.has_normals_surface.value=!1,Qe.uniforms.has_tangents_surface.value=!1,es.geometry.attributes.normal&&(Qe.uniforms.normalAttribute_surface.value.updateFrom(es.geometry.attributes.normal),Qe.uniforms.has_normals_surface.value=!0),es.geometry.attributes.tangent&&(Qe.uniforms.tangentAttribute_surface.value.updateFrom(es.geometry.attributes.tangent),Qe.uniforms.has_tangents_surface.value=!0),console.log(" has_normals_surface: ",Qe.uniforms.has_normals_surface),console.log(" has_tangents_surface: ",Qe.uniforms.has_tangents_surface),console.log("===> LOADED"),_a=!0,Cb(),_n.animate(1),document.getElementById("progress_overlay"),gc=performance.now()})})}function vc(){let r=23.6701655,e=.01,t=1e3;Mt=new gn(r,window.innerWidth/window.innerHeight,e,t),Ot=new ox(Mt,qt.domElement),Ot.addEventListener("change",()=>{Le()});let n=new Ve;n.set(.9396926207859084,0,-.3420201433256687,0,-.2203032561704394,.7649214009184319,-.6052782217606094,0,.26161852717499334,.6441236297613865,.7187909959242699,0,6.531538924716362,19.5,17.948521838355774,1),n.transpose(),Mt.matrixAutoUpdate=!1,Mt.applyMatrix4(n),Mt.matrixAutoUpdate=!0,Mt.updateMatrixWorld();let i=new C;Mt.getWorldDirection(i);let s=Mt.position.clone();s.addScaledVector(i,23.39613),Ot.target.copy(s),Ot.zoomSpeed=1.5,Ot.flySpeed=.01,Ot.update()}function jh(){return k.coat_weight!=0}function ki(){return k.base_metalness==1?!1:k.transmission_weight>0&&k.transmission_depth>0||k.subsurface_weight>0}function ia(){return k.transmission_weight>0||k.subsurface_weight>0}function Yh(){return k.transmission_dispersion_scale>0}function $h(){return k.thin_film_weight>0}function Cb(){ma=new gh(Qe),Qe.transparent=!0,Qe.depthWrite=!1,io=new $i(1,1,{format:sn,type:vn}),Zf=new gh(new Wi({map:io.texture})),zn(),vc(),Gi=new _c({width:300});const r=Gi.addFolder("Material"),e=r.addFolder("Base");e.add(k,"base_weight",0,1).onChange(h=>{Le()}),e.addColor(k,"base_color").onChange(h=>{Le()}),e.add(k,"base_roughness",0,1).onChange(h=>{Le()}),e.add(k,"base_metalness",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn())}),e.add(k,"diffuse_mode",Ab).onChange(h=>{Le()});const t=r.addFolder("Specular");t.add(k,"specular_weight",0,1).onChange(h=>{Le()}),t.addColor(k,"specular_color").onChange(h=>{Le()}),t.add(k,"specular_roughness",0,1).onChange(h=>{Le()}),t.add(k,"specular_ior",1,5).onChange(h=>{Le()}),t.add(k,"specular_anisotropy",0,1).onChange(h=>{Le()}),t.add(k,"specular_rotation",0,1).onChange(h=>{Le()});const n=r.addFolder("Transmission");n.add(k,"transmission_weight",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn()),ia()!=Qe.defines.TRANSMISSION_ENABLED&&(Qe.defines.TRANSMISSION_ENABLED=ia(),zn())}),n.addColor(k,"transmission_color").onChange(h=>{Le()}),n.add(k,"transmission_depth",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn())}),n.addColor(k,"transmission_scatter").onChange(h=>{Le()}),n.add(k,"transmission_scatter_anisotropy",-1,1).onChange(h=>{Le()}),n.add(k,"transmission_dispersion_abbe_number",9,91).onChange(h=>{Le()}),n.add(k,"transmission_dispersion_scale",0,1).onChange(h=>{Le(),Yh()!=Qe.defines.DISPERSION_ENABLED&&(Qe.defines.DISPERSION_ENABLED=Yh(),zn())}),n.close();const i=r.addFolder("Subsurface");i.add(k,"subsurface_weight",0,1).onChange(h=>{Le(),ki()!=Qe.defines.VOLUME_ENABLED&&(Qe.defines.VOLUME_ENABLED=ki(),zn()),ia()!=Qe.defines.TRANSMISSION_ENABLED&&(Qe.defines.TRANSMISSION_ENABLED=ia(),zn())}),i.addColor(k,"subsurface_color").onChange(h=>{Le()}),i.add(k,"subsurface_radius",0,1).onChange(h=>{Le()}),i.addColor(k,"subsurface_radius_scale").onChange(h=>{Le()}),i.add(k,"subsurface_anisotropy",-1,1).onChange(h=>{Le()}),i.add(k,"subsurface_mode",Tb).onChange(h=>{Le()}),i.close();const s=r.addFolder("Coat");s.add(k,"coat_weight",0,1).onChange(h=>{Le(),jh()!=Qe.defines.COAT_ENABLED&&(Qe.defines.COAT_ENABLED=jh(),zn())}),s.addColor(k,"coat_color").onChange(h=>{Le()}),s.add(k,"coat_roughness",0,1).onChange(h=>{Le()}),s.add(k,"coat_ior",1,3).onChange(h=>{Le()}),s.add(k,"coat_anisotropy",0,1).onChange(h=>{Le()}),s.add(k,"coat_rotation",0,1).onChange(h=>{Le()}),s.add(k,"coat_darkening",0,1).onChange(h=>{Le()}),s.close();const o=r.addFolder("Fuzz");o.add(k,"fuzz_weight",0,1).onChange(h=>{Le()}),o.addColor(k,"fuzz_color").onChange(h=>{Le()}),o.add(k,"fuzz_roughness",0,1).onChange(h=>{Le()}),o.close();const a=r.addFolder("Emission");a.add(k,"emission_luminance",0,10).onChange(h=>{Le()}),a.addColor(k,"emission_color").onChange(h=>{Le()}),a.close();const l=r.addFolder("Thin Film");l.add(k,"thin_film_weight",0,1).onChange(h=>{Le(),$h()!=Qe.defines.THIN_FILM_ENABLED&&(Qe.defines.THIN_FILM_ENABLED=$h(),zn())}),l.add(k,"thin_film_thickness",0,2e3).onChange(h=>{Le()}),l.add(k,"thin_film_ior",1,3).onChange(h=>{Le()}),l.close();const c=r.addFolder("Geometry");c.add(k,"geometry_opacity",0,1).onChange(h=>{Le()}),c.add(k,"geometry_thin_walled").onChange(h=>{Le()}),c.close();const u=Gi.addFolder("Lighting");u.add(k,"skyPower",0,2).onChange(h=>{Le()}),u.addColor(k,"skyColor").onChange(h=>{Le()}),u.add(k,"sunPower",-4,4).onChange(h=>{Le()}),u.add(k,"sunAngularSize",0,40).onChange(h=>{Le()}),u.add(k,"sunLatitude",0,90).onChange(h=>{Le()}),u.add(k,"sunLongitude",0,360).onChange(h=>{Le()}),u.addColor(k,"sunColor").onChange(h=>{Le()}),u.close();const f=Gi.addFolder("Renderer");f.add(k,"smooth_normals").onChange(h=>{Le()}),f.add(k,"wireframe").onChange(h=>{Le()}),f.addColor(k,"neutral_color").onChange(h=>{Le()}),f.add(k,"bounces",0,100,1).onChange(h=>{Qe.defines.BOUNCES=parseInt(h),Le(),zn()}),f.add(k,"max_samples").onChange(h=>{Le()}),f.add(k,"max_volume_steps",1,100,1).onChange(h=>{Qe.defines.MAX_VOLUME_STEPS=parseInt(h),Le(),zn()}),f.close(),Gi.add(k,"reset_camera"),Gi.open(),window.addEventListener("resize",Kh,!1),Kh()}function zn(){qt.setRenderTarget(io);let r=new oo(-1,1,1,-1,0,1);Pb(),qt.compileAsync(ma._mesh,r).then(t=>{console.log("shaders successfully compiled."),Db()}).catch(t=>{console.log("shader compilation error: "+t)}).finally(()=>{})}function Pb(){let r=document.getElementById("progress_overlay");r.style.display="block",r.style.opacity=1,_n.set(0),_n.setText("shaders compiling..."),Ks=!0}function Db(){_n.set(1),gc=performance.now(),Ks=!1}function Kh(){Mt.aspect=window.innerWidth/window.innerHeight,Mt.updateProjectionMatrix();const r=window.innerWidth,e=window.innerHeight;qt.setSize(r,e),qt.setPixelRatio(1),io.setSize(r,e),Le()}function Pn(r){return new C(r[0],r[1],r[2])}function Le(){Qe&&(Qe.needsUpdate=!0),cr=0}function Ib(r){let e=document.getElementById("progress_overlay");var t=setInterval(function(){e.style.opacity||(e.style.opacity=1),e.style.opacity>0?e.style.opacity-=.025:(e.style.display="none",e.style.opacity=0,clearInterval(t))},r)}function Zs(){if(!_a){console.log("not LOADED"),requestAnimationFrame(Zs);return}if(qt.domElement.style.imageRendering="auto",cr>=k.max_samples){requestAnimationFrame(Zs);return}if(!Ks&&_a){Mt.updateMatrixWorld();const r=ma.material.uniforms,e=window.innerWidth,t=window.innerHeight;r.cameraWorldMatrix.value.copy(Mt.matrixWorld),r.invProjectionMatrix.value.copy(Mt.projectionMatrixInverse),r.invModelMatrix.value.copy(fr.matrixWorld).invert();let n=new Ue(e,t);r.resolution.value.copy(n),r.accumulation_weight.value=1/(cr+1),r.samples.value=cr,r.wireframe.value=k.wireframe,r.neutral_color.value.copy(Pn(k.neutral_color)),r.smooth_normals.value=k.smooth_normals,r.base_weight.value=k.base_weight,r.base_color.value.copy(Pn(k.base_color)),r.base_roughness.value=k.base_roughness,r.base_metalness.value=k.base_metalness,r.diffuse_mode.value=k.diffuse_mode,r.specular_weight.value=k.specular_weight,r.specular_color.value.copy(Pn(k.specular_color)),r.specular_roughness.value=k.specular_roughness,r.specular_anisotropy.value=k.specular_anisotropy,r.specular_rotation.value=k.specular_rotation,r.specular_ior.value=k.specular_ior,r.transmission_weight.value=k.transmission_weight,r.transmission_color.value.copy(Pn(k.transmission_color)),r.transmission_depth.value=k.transmission_depth,r.transmission_scatter.value.copy(Pn(k.transmission_scatter)),r.transmission_scatter_anisotropy.value=k.transmission_scatter_anisotropy,r.transmission_dispersion_abbe_number.value=k.transmission_dispersion_abbe_number,r.transmission_dispersion_scale.value=k.transmission_dispersion_scale,r.subsurface_weight.value=k.subsurface_weight,r.subsurface_color.value.copy(Pn(k.subsurface_color)),r.subsurface_radius.value=k.subsurface_radius,r.subsurface_radius_scale.value.copy(Pn(k.subsurface_radius_scale)),r.subsurface_anisotropy.value=k.subsurface_anisotropy,r.subsurface_mode.value=k.subsurface_mode,r.coat_weight.value=k.coat_weight,r.coat_color.value.copy(Pn(k.coat_color)),r.coat_roughness.value=k.coat_roughness,r.coat_anisotropy.value=k.coat_anisotropy,r.coat_rotation.value=k.coat_rotation,r.coat_ior.value=k.coat_ior,r.coat_darkening.value=k.coat_darkening,r.fuzz_weight.value=k.fuzz_weight,r.fuzz_color.value.copy(Pn(k.fuzz_color)),r.fuzz_roughness.value=k.fuzz_roughness,r.emission_luminance.value=k.emission_luminance,r.emission_color.value.copy(Pn(k.emission_color)),r.thin_film_weight.value=k.thin_film_weight,r.thin_film_thickness.value=k.thin_film_thickness,r.thin_film_ior.value=k.thin_film_ior,r.geometry_opacity.value=k.geometry_opacity,r.geometry_thin_walled.value=k.geometry_thin_walled,r.skyPower.value=k.skyPower,r.skyColor.value.copy(Pn(k.skyColor)),r.sunPower.value=Math.pow(10,k.sunPower),r.sunAngularSize.value=k.sunAngularSize,r.sunColor.value.copy(Pn(k.sunColor)),Rb(),r.sunDir.value.copy(Pn(k.sunDir)),qt.autoClear=cr===0,qt.setRenderTarget(io),ma.render(qt),qt.setRenderTarget(null),Zf.render(qt),qt.autoClear=!0,cr++}else Le(),Mt.updateProjectionMatrix(),Mt.clearViewOffset(),qt.render(fr,Mt);document.getElementById("samples").innerText=`samples: ${cr}`,Ks||document.getElementById("progress_overlay").style.display!="none"&&performance.now()-gc>300&&Ib(300),Ks&&(_n.value()<.01?_n.animate(1):_n.value()>.99&&(_n.set(0),_n.animate(1))),as.update(),requestAnimationFrame(Zs)}document.onkeydown=function(r){r=r||window.event;var e=r.which?r.which:r.keyCode;switch(e){case 122:{var t=document.body;"webkitCancelFullScreen"in document?t.webkitRequestFullScreen():"mozCancelFullScreen"in document?t.mozRequestFullScreen():console.assert(!1),Ot.update(),Le();break}case 70:{vc();break}case 72:{Gi.show(Gi._hidden),document.body.contains(as.dom)?document.body.removeChild(as.dom):document.body.appendChild(as.dom);let a=document.getElementById("info");a.style.visibility=="visible"?a.style.visibility="hidden":a.style.visibility="visible";let l=document.getElementById("samples");l.style.visibility=="visible"?l.style.visibility="hidden":l.style.visibility="visible";break}case 87:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();a.normalize();var n=new C;n.copy(a),n.multiplyScalar(Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 65:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();var i=new C(1,0,0),s=i.transformDirection(Mt.matrix),n=new C;n.copy(s),n.multiplyScalar(-Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 83:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();a.normalize();var n=new C;n.copy(a),n.multiplyScalar(-Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 68:{let a=new C;a.copy(Ot.target),a.sub(Mt.position);let l=a.length();var i=new C(1,0,0),s=i.transformDirection(Mt.matrix),n=new C;n.copy(s),n.multiplyScalar(Ot.flySpeed*l),Mt.position.add(n),Ot.target.add(n),Ot.update(),Le();break}case 80:{var o=document.createElement("a");let a="openpbr-viewer-screenshot.png";o.download=a,qt.domElement.toBlob(function(l){o.href=URL.createObjectURL(l);var c=new MouseEvent("click");o.dispatchEvent(c),requestAnimationFrame(Zs)},"image/png",1);break}}}; diff --git a/index.html b/index.html index 5b61cdf..02f242c 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@ overflow:hidden; } - +