@roomle/web-sdk 2.20.0 → 2.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{banana-for-scale-5f9ad0e3.nomodule.js → banana-for-scale-b9868da9.nomodule.js} +2 -2
- package/lib/{banana-for-scale-5f9ad0e3.nomodule.js.map → banana-for-scale-b9868da9.nomodule.js.map} +1 -1
- package/lib/{banana-for-scale-a8541870.js → banana-for-scale-c464bcaf.js} +2 -2
- package/lib/{banana-for-scale-a8541870.js.map → banana-for-scale-c464bcaf.js.map} +1 -1
- package/lib/{budgeteer-measure-5fd28189.js → budgeteer-measure-a6f7fd55.js} +2 -2
- package/lib/{budgeteer-measure-5fd28189.js.map → budgeteer-measure-a6f7fd55.js.map} +1 -1
- package/lib/budgeteer-measure.nomodule.js +1 -1
- package/lib/{component-dimensioning-15849d03.js → component-dimensioning-0d089d5d.js} +2 -2
- package/lib/component-dimensioning-0d089d5d.js.map +1 -0
- package/lib/{component-dimensioning-3816fed6.nomodule.js → component-dimensioning-aac668c8.nomodule.js} +2 -2
- package/lib/component-dimensioning-aac668c8.nomodule.js.map +1 -0
- package/lib/configurator-7915999f.js +2 -0
- package/lib/{configurator-02c1a087.js.map → configurator-7915999f.js.map} +1 -1
- package/lib/configurator-d6e39b21.nomodule.js +2 -0
- package/lib/{configurator-b94915ee.nomodule.js.map → configurator-d6e39b21.nomodule.js.map} +1 -1
- package/lib/configurator-main-cf5bb9fe.js +2 -0
- package/lib/configurator-main-cf5bb9fe.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/configurator-mesh-generator-bf1a5b3c.nomodule.js +2 -0
- package/lib/configurator-mesh-generator-bf1a5b3c.nomodule.js.map +1 -0
- package/lib/configurator-mesh-generator-ec0e9982.js +2 -0
- package/lib/configurator-mesh-generator-ec0e9982.js.map +1 -0
- package/lib/{default-light-setting-0d38ca56.nomodule.js → default-light-setting-76d539f8.nomodule.js} +2 -2
- package/lib/default-light-setting-76d539f8.nomodule.js.map +1 -0
- package/lib/{default-light-setting-740fe05f.js → default-light-setting-fe844872.js} +2 -2
- package/lib/default-light-setting-fe844872.js.map +1 -0
- package/lib/definitions/common-core/mock/mock-pixotron.d.ts +3 -0
- package/lib/definitions/common-core/src/cameracontrol/camera-control-3d.d.ts +2 -2
- package/lib/definitions/common-core/src/utils/common-utils.d.ts +1 -0
- package/lib/definitions/common-core/src/utils/init-data.d.ts +4 -0
- package/lib/definitions/common-core/src/utils/shims.d.ts +5 -0
- package/lib/definitions/common-core/src/view-model/configurator-view-model.d.ts +1 -1
- package/lib/definitions/common-core/src/webgl/mesh-generator.d.ts +1 -1
- package/lib/definitions/configurator-core/src/webgl/configurator-mesh-generator.d.ts +1 -1
- package/lib/definitions/configurator-core/src/webgl/scene-helper.d.ts +3 -1
- package/lib/definitions/typings/pixotron.d.ts +2 -0
- package/lib/{dimensioning-helper-df61f3e4.nomodule.js → dimensioning-helper-9a706cfd.nomodule.js} +2 -2
- package/lib/dimensioning-helper-9a706cfd.nomodule.js.map +1 -0
- package/lib/{dimensioning-helper-67518ab9.js → dimensioning-helper-f7e39056.js} +2 -2
- package/lib/dimensioning-helper-f7e39056.js.map +1 -0
- package/lib/glb-viewer-0d92b638.js +2 -0
- package/lib/{glb-viewer-0a44ad1e.js.map → glb-viewer-0d92b638.js.map} +1 -1
- package/lib/glb-viewer-d278030c.nomodule.js +2 -0
- package/lib/{glb-viewer-a7947024.nomodule.js.map → glb-viewer-d278030c.nomodule.js.map} +1 -1
- package/lib/glb-viewer-main-ae7df6ed.js +2 -0
- package/lib/glb-viewer-main-ae7df6ed.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/{image-renderer-32588b0f.js → image-renderer-a3e7c1a5.js} +2 -2
- package/lib/{image-renderer-32588b0f.js.map → image-renderer-a3e7c1a5.js.map} +1 -1
- package/lib/{image-renderer-58be56f9.nomodule.js → image-renderer-b1e31df3.nomodule.js} +2 -2
- package/lib/{image-renderer-58be56f9.nomodule.js.map → image-renderer-b1e31df3.nomodule.js.map} +1 -1
- package/lib/legacy/{banana-for-scale-7fe6982a.legacy.js → banana-for-scale-07c4ef73.legacy.js} +2 -2
- package/lib/legacy/{banana-for-scale-7fe6982a.legacy.js.map → banana-for-scale-07c4ef73.legacy.js.map} +1 -1
- package/lib/legacy/budgeteer-measure.legacy.js +1 -1
- package/lib/legacy/{component-dimensioning-474e71c0.legacy.js → component-dimensioning-d17748a9.legacy.js} +2 -2
- package/lib/legacy/component-dimensioning-d17748a9.legacy.js.map +1 -0
- package/lib/legacy/configurator-4672929e.legacy.js +2 -0
- package/lib/legacy/{configurator-e33d83c7.legacy.js.map → configurator-4672929e.legacy.js.map} +1 -1
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/configurator-mesh-generator-b171f5d8.legacy.js +2 -0
- package/lib/legacy/configurator-mesh-generator-b171f5d8.legacy.js.map +1 -0
- package/lib/legacy/{default-light-setting-e5427dcc.legacy.js → default-light-setting-3fcc55d4.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-3fcc55d4.legacy.js.map +1 -0
- package/lib/legacy/{dimensioning-helper-b6b2fae5.legacy.js → dimensioning-helper-25f07743.legacy.js} +2 -2
- package/lib/legacy/dimensioning-helper-25f07743.legacy.js.map +1 -0
- package/lib/legacy/glb-viewer-9b9d37a8.legacy.js +2 -0
- package/lib/legacy/{glb-viewer-8cd61b1e.legacy.js.map → glb-viewer-9b9d37a8.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{image-renderer-06f566f5.legacy.js → image-renderer-04df50a7.legacy.js} +2 -2
- package/lib/legacy/{image-renderer-06f566f5.legacy.js.map → image-renderer-04df50a7.legacy.js.map} +1 -1
- package/lib/legacy/{main-thread-to-worker-45106055.legacy.js → main-thread-to-worker-46ba1413.legacy.js} +2 -2
- package/lib/legacy/main-thread-to-worker-46ba1413.legacy.js.map +1 -0
- package/lib/legacy/{material-viewer-c853ad32.legacy.js → material-viewer-6cddff1d.legacy.js} +2 -2
- package/lib/legacy/material-viewer-6cddff1d.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/mesh-generator-572ad2f8.legacy.js +2 -0
- package/lib/legacy/mesh-generator-572ad2f8.legacy.js.map +1 -0
- package/lib/legacy/pixotron-66b4f690.legacy.js +2 -0
- package/lib/legacy/{pixotron-84b6fe67.legacy.js.map → pixotron-66b4f690.legacy.js.map} +1 -1
- package/lib/legacy/{planner-90ac969a.legacy.js → planner-2cc59b21.legacy.js} +2 -2
- package/lib/legacy/{planner-90ac969a.legacy.js.map → planner-2cc59b21.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/{rapi-access-21dc9ae2.legacy.js → rapi-access-a73fc03b.legacy.js} +3 -3
- package/lib/legacy/{rapi-access-21dc9ae2.legacy.js.map → rapi-access-a73fc03b.legacy.js.map} +1 -1
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/scene-manager-47b24f6e.legacy.js +2 -0
- package/lib/legacy/scene-manager-47b24f6e.legacy.js.map +1 -0
- package/lib/legacy/static/pi.min-0272f873b3a4380a.js +1 -0
- package/lib/legacy/static/{rthree-9a98e3318d68245d.js → rthree-508a6ceb9a1516ce.js} +1 -1
- package/lib/legacy/static/shaders-d304d03a461ead46.json +1 -0
- package/lib/legacy/{stats-helper-e04ccf23.legacy.js → stats-helper-ef9054e8.legacy.js} +2 -2
- package/lib/legacy/{stats-helper-e04ccf23.legacy.js.map → stats-helper-ef9054e8.legacy.js.map} +1 -1
- package/lib/main-thread-to-worker-4c9942ce.js +2 -0
- package/lib/main-thread-to-worker-4c9942ce.js.map +1 -0
- package/lib/{main-thread-to-worker-2526203d.nomodule.js → main-thread-to-worker-4f826ab0.nomodule.js} +2 -2
- package/lib/main-thread-to-worker-4f826ab0.nomodule.js.map +1 -0
- package/lib/{material-viewer-d3c453fc.js → material-viewer-590448c5.js} +2 -2
- package/lib/material-viewer-590448c5.js.map +1 -0
- package/lib/{material-viewer-7c63aa7f.nomodule.js → material-viewer-8b280e30.nomodule.js} +2 -2
- package/lib/material-viewer-8b280e30.nomodule.js.map +1 -0
- package/lib/material-viewer-main-e776f7e5.js +2 -0
- package/lib/material-viewer-main-e776f7e5.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/mesh-generator-55c80a53.nomodule.js +2 -0
- package/lib/mesh-generator-55c80a53.nomodule.js.map +1 -0
- package/lib/mesh-generator-a718d07a.js +2 -0
- package/lib/mesh-generator-a718d07a.js.map +1 -0
- package/lib/pixotron-9df61cfe.js +2 -0
- package/lib/{pixotron-0b81eb7c.js.map → pixotron-9df61cfe.js.map} +1 -1
- package/lib/pixotron-e40b75d2.nomodule.js +2 -0
- package/lib/{pixotron-7a1f9ec8.nomodule.js.map → pixotron-e40b75d2.nomodule.js.map} +1 -1
- package/lib/{planner-fab4fbbe.js → planner-0bdfa18a.js} +2 -2
- package/lib/{planner-fab4fbbe.js.map → planner-0bdfa18a.js.map} +1 -1
- package/lib/{planner-77af0a69.nomodule.js → planner-fb33bbd5.nomodule.js} +2 -2
- package/lib/{planner-77af0a69.nomodule.js.map → planner-fb33bbd5.nomodule.js.map} +1 -1
- package/lib/planner-main-cd1ee6e0.js +2 -0
- package/lib/planner-main-cd1ee6e0.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/{rapi-access-d3bc3ce4.nomodule.js → rapi-access-c8981c13.nomodule.js} +3 -3
- package/lib/{rapi-access-d3bc3ce4.nomodule.js.map → rapi-access-c8981c13.nomodule.js.map} +1 -1
- package/lib/{rapi-access-ff57cd9e.js → rapi-access-d433b66a.js} +3 -3
- package/lib/{rapi-access-ff57cd9e.js.map → rapi-access-d433b66a.js.map} +1 -1
- package/lib/{roomle-sdk-6e4fd2d6.js → roomle-sdk-8fee3247.js} +2 -2
- package/lib/roomle-sdk-8fee3247.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/scene-manager-b3bd3bed.js +2 -0
- package/lib/scene-manager-b3bd3bed.js.map +1 -0
- package/lib/scene-manager-cbf9f557.nomodule.js +2 -0
- package/lib/scene-manager-cbf9f557.nomodule.js.map +1 -0
- package/lib/static/pi.min-0272f873b3a4380a.js +1 -0
- package/lib/static/pi.min-0272f873b3a4380a.js.map +1 -0
- package/lib/static/{rthree-9a98e3318d68245d.js → rthree-508a6ceb9a1516ce.js} +1 -1
- package/lib/static/rthree-508a6ceb9a1516ce.js.map +1 -0
- package/lib/static/shaders-d304d03a461ead46.json +1 -0
- package/lib/{stats-helper-670aea9b.js → stats-helper-5fadbfc2.js} +2 -2
- package/lib/{stats-helper-670aea9b.js.map → stats-helper-5fadbfc2.js.map} +1 -1
- package/lib/{stats-helper-b294fd7a.nomodule.js → stats-helper-efa282ca.nomodule.js} +2 -2
- package/lib/{stats-helper-b294fd7a.nomodule.js.map → stats-helper-efa282ca.nomodule.js.map} +1 -1
- package/package.json +2 -2
- package/lib/component-dimensioning-15849d03.js.map +0 -1
- package/lib/component-dimensioning-3816fed6.nomodule.js.map +0 -1
- package/lib/configurator-02c1a087.js +0 -2
- package/lib/configurator-b94915ee.nomodule.js +0 -2
- package/lib/configurator-main-31ba572b.js +0 -2
- package/lib/configurator-main-31ba572b.js.map +0 -1
- package/lib/configurator-mesh-generator-2b2535f8.js +0 -2
- package/lib/configurator-mesh-generator-2b2535f8.js.map +0 -1
- package/lib/configurator-mesh-generator-470760e6.nomodule.js +0 -2
- package/lib/configurator-mesh-generator-470760e6.nomodule.js.map +0 -1
- package/lib/default-light-setting-0d38ca56.nomodule.js.map +0 -1
- package/lib/default-light-setting-740fe05f.js.map +0 -1
- package/lib/dimensioning-helper-67518ab9.js.map +0 -1
- package/lib/dimensioning-helper-df61f3e4.nomodule.js.map +0 -1
- package/lib/glb-viewer-0a44ad1e.js +0 -2
- package/lib/glb-viewer-a7947024.nomodule.js +0 -2
- package/lib/glb-viewer-main-c9ea66e6.js +0 -2
- package/lib/glb-viewer-main-c9ea66e6.js.map +0 -1
- package/lib/legacy/component-dimensioning-474e71c0.legacy.js.map +0 -1
- package/lib/legacy/configurator-e33d83c7.legacy.js +0 -2
- package/lib/legacy/configurator-mesh-generator-7c2a1b65.legacy.js +0 -2
- package/lib/legacy/configurator-mesh-generator-7c2a1b65.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-e5427dcc.legacy.js.map +0 -1
- package/lib/legacy/dimensioning-helper-b6b2fae5.legacy.js.map +0 -1
- package/lib/legacy/glb-viewer-8cd61b1e.legacy.js +0 -2
- package/lib/legacy/main-thread-to-worker-45106055.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-c853ad32.legacy.js.map +0 -1
- package/lib/legacy/mesh-generator-c9c5cf92.legacy.js +0 -2
- package/lib/legacy/mesh-generator-c9c5cf92.legacy.js.map +0 -1
- package/lib/legacy/pixotron-84b6fe67.legacy.js +0 -2
- package/lib/legacy/scene-manager-c1df3327.legacy.js +0 -2
- package/lib/legacy/scene-manager-c1df3327.legacy.js.map +0 -1
- package/lib/legacy/static/pi.min-6875d25247d9711b.js +0 -1
- package/lib/legacy/static/shaders-695d00691ea12f08.json +0 -1
- package/lib/main-thread-to-worker-2526203d.nomodule.js.map +0 -1
- package/lib/main-thread-to-worker-815feb19.js +0 -2
- package/lib/main-thread-to-worker-815feb19.js.map +0 -1
- package/lib/material-viewer-7c63aa7f.nomodule.js.map +0 -1
- package/lib/material-viewer-d3c453fc.js.map +0 -1
- package/lib/material-viewer-main-43691932.js +0 -2
- package/lib/material-viewer-main-43691932.js.map +0 -1
- package/lib/mesh-generator-0b2ac98c.js +0 -2
- package/lib/mesh-generator-0b2ac98c.js.map +0 -1
- package/lib/mesh-generator-739f8058.nomodule.js +0 -2
- package/lib/mesh-generator-739f8058.nomodule.js.map +0 -1
- package/lib/pixotron-0b81eb7c.js +0 -2
- package/lib/pixotron-7a1f9ec8.nomodule.js +0 -2
- package/lib/planner-main-1426a336.js +0 -2
- package/lib/planner-main-1426a336.js.map +0 -1
- package/lib/roomle-sdk-6e4fd2d6.js.map +0 -1
- package/lib/scene-manager-1c0fa594.js +0 -2
- package/lib/scene-manager-1c0fa594.js.map +0 -1
- package/lib/scene-manager-e7cf547f.nomodule.js +0 -2
- package/lib/scene-manager-e7cf547f.nomodule.js.map +0 -1
- package/lib/static/pi.min-6875d25247d9711b.js +0 -1
- package/lib/static/pi.min-6875d25247d9711b.js.map +0 -1
- package/lib/static/rthree-9a98e3318d68245d.js.map +0 -1
- package/lib/static/shaders-695d00691ea12f08.json +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./query-params-helper-c231e1b8.nomodule.js","./rapi-access-d3bc3ce4.nomodule.js","./main-thread-to-worker-2526203d.nomodule.js"],(function(t){var e,i,s,a,n,o,h,r,_,l,d,c,u,g,m,p,w,E,P,y,S,v,b;return{setters:[function(t){e=t.g},function(t){i=t.s,s=t.B,a=t.I,n=t._,o=t.i,h=t.t,r=t.u,_=t.v,l=t.w,d=t.x,c=t.y,u=t.h,g=t.G,m=t.z,p=t.F,w=t.H,E=t.J,P=t.K,y=t.N},function(t){S=t.d,v=t.g,b=t.h}],execute:function(){t("f","static/dat.gui.min-b5cbb61e5c62f0bf.js"),t("T","static/Tween-d024b02fe34f25ab.js"),t("M",class{constructor(t){this._context=t||i.getContext(this.getContextName()),s.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){i.setup(a);const t=e();this.lookup("global-init-data").setOverrides(t),this.lookup("init-data",this._context).setOverrides(t)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const t in window.THREE)if(window.THREE.hasOwnProperty(t))try{delete window.THREE[t]}catch(t){console.error(t)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(t){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(t),this.setupDependencies(),this.bootFinished()}lookup(t,e){return window.__RML__DI__.lookup(t,e)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(t){t&&this.lookup("dom-helper",this._context).setDomElement(t),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),i.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}});class x{constructor(){this._listeners={}}_addEventListener(t,e,i){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push({callback:e,scope:i})}addEventListener(t,e,i){this._addEventListener(t,e,i)}dispatchEvent(t,e){if(!this._listeners[t])return;const i=this._listeners[t];let s=i.length;for(let t=0;t<s;t++){const s=i[t];e?s.callback.apply(s.scope,[e]):s.callback.call(s.scope)}}removeEventListener(t,e){const i=this._listeners[t];if(i)for(let t=0,s=i.length;t<s;t++)if(i[t].callback===e)return void i.splice(t,1)}}t("E",x);const T=t("h",10);let f=t("d",(()=>{class t extends x{constructor(t,e,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=h(T),this._yaw=h(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=t,this._inputManager=e,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new THREE.Vector3,this._targetPosition=new THREE.Vector3,i?this._cameraPosition.copy(i):this._cameraPosition=new THREE.Vector3(0,.5,3),this._initData.debug){const t=this.getDebugCameraPosition();t&&this._setCurrentCameraParameters(t)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=S(this._dispatchCameraIdle.bind(this),16)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.addEventListener(t.key,t.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.removeEventListener(t.key,t.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(t){let e=this._cameraPosition;if(!e||r(e,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,this._dispatchCameraIdle(),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,this._lerpEnabled&&!this._tweenEnd){let i=this.getCamera().position.clone();const s=Math.min(10*t,1);i.lerp(e,s),this.getCamera().position.copy(i)}else this.getCamera().position.copy(e);return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this._getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_areEqual(t,e){return t.yaw.toFixed(5)===e.yaw.toFixed(5)&&t.pitch.toFixed(5)===e.pitch.toFixed(5)&&t.distance.toFixed(5)===e.distance.toFixed(5)&&t.targetX===e.targetX&&t.targetY===e.targetY&&t.targetZ===e.targetZ}_tweenCameraParameter(t,e,i){return new Promise(i=>{if(e.yaw-t.yaw<=-Math.PI?t.yaw-=2*Math.PI:e.yaw-t.yaw>=Math.PI&&(t.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=e,new TWEEN.Tween(t).to(e,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._update(new THREE.Vector3(t.targetX,t.targetY,t.targetZ))}).onComplete(()=>{this.dispatchEvent(2,3),this._tweenEnd=null,i()}).start(),this.dispatchEvent(0,3)}})}_getCurrentCameraParameters(){const t=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z}}_setCurrentCameraParameters(t){this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._targetPosition.copy(new THREE.Vector3(t.targetX,t.targetY,t.targetZ))}_rotateHorizontal(t){this._yaw-=t,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(t){this._pitch+=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(t){if(t||!this._stateSaved){let t=this._yaw,e=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:t,pitch:e,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let t=this._getCamera();this._stateSaved.fov=t.fov,this._stateSaved.near=t.near,this._stateSaved.far=t.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let t=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z},this._stateSaved,!0)}this._stateSaved=null}setToState(t,e){this._tweenCameraParameter(t,e,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(t){const{x:e,y:i}=this._domHelper.getClientDimensions();return new THREE.Vector3(t.x/e*2-1,-t.y/i*2+1,.5)}addLightContainer(t){t.name="lights";const e=this._getCamera(),i=e.children.find(t=>"lights"===t.name);i&&e.remove(i),e.add(t)}checkNearFarDistance(t){if(!t)return;const e=this._cameraPosition.distanceTo(t),i=this._getCamera();i instanceof THREE.PerspectiveCamera&&e>i.far&&(i.far=e+1)}}return n([o],t.prototype,"_domHelper",void 0),n([o],t.prototype,"_initData",void 0),t})());class M{constructor(t,e){this.minZoom=!1,this.maxZoom=!1,this.minZoom=t,this.maxZoom=e}}t("C",class extends f{constructor(t,e,i,s){super(t,e,i),this._bounds=new THREE.Vector3,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=h(0),this.maxPolarAngle=h(85),this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,s?this._camera=s:this._initCamera(),this._targetPosition||(this._targetPosition=new THREE.Vector3(0,0,0));const{cameraRestriction:a,zoomDistance:n,minVerticalCameraAngle:o,maxVerticalCameraAngle:r,minHorizontalCameraAngle:_,maxHorizontalCameraAngle:l}=this._initData;if(n&&(this._zoomDistance=n/100),void 0!==o&&(this.minPolarAngle=h(o<0?o:-1*o)),void 0!==r&&(this.maxPolarAngle=h(r)),void 0!==_&&(this.minAzimuthAngle=h(_<0?_:-1*_)),void 0!==l&&(this.maxAzimuthAngle=h(l)),void 0!==a){let t=Math.abs(h(a));this.minAzimuthAngle=-t,this.maxAzimuthAngle=t,this.maxPolarAngle=Math.min(t,h(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}_initCamera(){this._camera=new THREE.PerspectiveCamera,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(5),this._camera.layers.enable(4)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t))return!1;let e=this._targetPosition;return!!e&&(this.getCamera().lookAt(e),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._userInteraction=!0,this._move(new THREE.Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:11,fun:t=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new THREE.Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2,t.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:t})=>{this._maxZoomedIn||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:t})=>{this._maxZoomedOut||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomOut())}})}_panTargetPosition(t){const e=t.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),a=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-e.x/i.clientHeight*a,s.y=s.y+e.y/i.clientHeight*a,this._targetPosition.copy(s.unproject(this._camera))}_pan(t,e){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0,e)),this._panTargetPosition(t),_(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}_move(t,e){this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0,e));const i=t.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(t):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),_(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}setBounds(t){this._boundingBox=t}zoomToFitBounds(t){this.setBounds(t);const e=t.getSize(new THREE.Vector3);if(this._initData.debug||e.x+e.y+e.z===0)return;const i=this._getCurrentCameraParameters(),s=t.getCenter(new THREE.Vector3);this._targetPosition=new THREE.Vector3(s.x,s.y,s.z);const a=this._setDistanceAndRangesBasedOnBounds(e);this._distance=a,this._checkZoomDistance(t,a),this._tweenCameraParameter(i,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},!1)}updateToBounds(t,e,i=!0,s){if(this.setBounds(t),this._initData.debug)return;const a=this._getCurrentCameraParameters(),n=t.getSize(new THREE.Vector3);if(i){const i=t.getCenter(new THREE.Vector3);this._targetPosition=s?s.clone():new THREE.Vector3(i.x,i.y,i.z);const o=this._setDistanceAndRangesBasedOnBounds(n);this._distance=o,this._checkZoomDistance(t,o),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},e):this._update()}}_checkZoomDistance(t,e){const i=t.getBoundingSphere(new THREE.Sphere);e-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=e-i.radius)}_setDistanceAndRangesBasedOnBounds(t){const e=this._domHelper.getClientDimensions(),i=e.x,s=e.y,a=this._camera.offset?i-i*this._camera.offset.left-i*(1-this._camera.offset.right):i,n=this._camera.offset?s-s*this._camera.offset.bottom-s*(1-this._camera.offset.top):s;this._bounds.copy(t);const{cameraSpacing:o}=this._initData;t.addScalar(o/100),this.minDistance=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);const h=Math.max(t.x,t.y),{x:r,y:_}=this._getMargin(a,n),d=l(t.x+r,t.y+_,t.z,this._camera.fov,a,n);return this._distance<d&&(this._distance=d),this.maxDistance=d+h,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,d}_getMargin(t,e){let i=this._bounds.x/2,s=this._bounds.y/2;return t>1080&&(i+=this._bounds.x<.3?.2:0,i+=this._bounds.x*(t/1080-1)),e>1080&&(i+=this._bounds.y<.3?.2:0,s+=this._bounds.y*(e/1080-1)),{x:i,y:s}}reset(t,e,i,s,a=!0){if(t){e?this._targetPosition.copy(e):this._targetPosition=new THREE.Vector3(0,t.y/2,0);const n=this._getCurrentCameraParameters();i||(i=-30),s||(s=T),this._pitch=h(s),this._yaw=h(i),this._setDistanceAndRangesBasedOnBounds(t);let o=this._targetPosition.clone();a?this._tweenCameraParameter(n,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:o.x,targetY:o.y,targetZ:o.z},!0):this._update(this._targetPosition)}else console.warn("you cant reset without bounds!")}updateAndReset(t,e,i,s,a,n=!0){const o=new THREE.Vector3(-t.x/2,0,-t.z/2),r=new THREE.Vector3(t.x/2,t.y,t.z/2);if(this._boundingBox=new THREE.Box3(o,r),a&&t.addScalar(a),e?this._targetPosition.copy(e):this._targetPosition=new THREE.Vector3(0,t.y/2,0),-1===this._distance){const e=this._setDistanceAndRangesBasedOnBounds(t);this._distance=Math.max(2,e)}const _=this._getCurrentCameraParameters();i||(i=-30),s||(s=T),this._pitch=h(s),this._yaw=h(i),this._setDistanceAndRangesBasedOnBounds(t);let l=this._targetPosition.clone();n?this._tweenCameraParameter(_,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:l.x,targetY:l.y,targetZ:l.z},!0):this._update(this._targetPosition)}_update(t){this._initData.debug?this._pitch=Math.max(h(-89),Math.min(h(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const e=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX"),i=(new THREE.Quaternion).setFromEuler(e),s=new THREE.Vector3(0,0,-1);s.applyQuaternion(i),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),t&&this._targetPosition.copy(t);const a=this._targetPosition.clone().sub(s.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(a);else{const t=this._getCameraSphere(a);null!=this._boundingBox&&this._boundingBox.intersectsSphere(t)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(t)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(a),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(t,e){let i=t+""+e;0!==this._currentZoomHash.length&&this._currentZoomHash===i||(this.dispatchEvent(5,new M(t,e)),this._currentZoomHash=i),this._maxZoomedIn=e,this._maxZoomedOut=t}zoomTo(t,e,i,s,a,n){return this._tweenCameraParameter(this._getCurrentCameraParameters(),{yaw:s,pitch:a,distance:2.725*l(t.x,t.y,t.z,this._camera.fov,e,i),targetX:n.x,targetY:n.y,targetZ:n.z,blockOtherTweens:!0},!0)}_getCameraSphere(t){const e=Math.max(this._bounds.x,this._bounds.y),i=Math.max(e/10,this._zoomDistance);return new THREE.Sphere(t,i)}zoomIn(t){this._lerpEnabled=!0,this._scale*=t?Math.pow(.95,t):this._zoomSpeed,this._update(),this.dispatchEvent(3)}zoomOut(t){this._lerpEnabled=!0,this._scale/=t?Math.pow(.95,t):this._zoomSpeed,this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new THREE.Vector3(0,0,0))}async moveCamera(t){return this._tweenCameraParameter(this._getCurrentCameraParameters(),t,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}});let R={},C={};t("S",(()=>{class t{constructor(t){this._creator_=t}fetch(t,e){return this._singlePromiseFactory.create(5,t,(i,a)=>{!function(t,e,i,a){if(-1===t.indexOf("http")&&(t=v()+t),R[t])return i();if(e.id&&C[e.id])return a(new Error('There is already a script with ID "'+e.id+'"'));const n=s.start("load_"+e.id.replace(/-/g,"_")),o=document.createElement("script");o.async=!1,o.src=t,o.id=e.id,o.onload=()=>{R[t]=!0,C[e.id]=!0,s.end(n),Object.defineProperty(i,"name",{value:"resolve-"+e.id}),i()},o.onerror=t=>{a(t)},document.body.appendChild(o)}(t,e,i,a)})}loadScripts(t){const e=[];return t.forEach(t=>{let i=this.fetch(t.name,{id:t.id});e.push(i)}),Promise.all(e)}cleanUp(){for(let t in C)if(C.hasOwnProperty(t)){const e=document.getElementById(t);e&&e.parentElement.removeChild(e)}R={},C={}}}return n([o],t.prototype,"_singlePromiseFactory",void 0),t})());const A={MOUSE_MOVE:"mousemove",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_LEAVE:"mouseleave",MOUSE_ENTER:"mouseenter",MOUSE_WHEEL:"wheel",TOUCH_MOVE:"touchmove",TOUCH_START:"touchstart",TOUCH_END:"touchend",CONTEXT_MENU:"contextmenu"};class k{constructor(t,e,i,s,a){this.position=t,this.positionRelative=e,this.type=i,this.rotation=s,this.event=a}}const D=t("i",5*window.devicePixelRatio),H=3*window.devicePixelRatio;t("I",(()=>{class t extends x{constructor(t){super(),this._debug=!1,this._elementHit=!1,this._delta=-1,this._state=0,this._pinchDistance=-1,this._rotationAngle=-1,this._lastMouseWheelEvent=null,this._lastTouchEvent=null,this._events=Object.keys(A).map(t=>A[t]),this._creator_=t,this._downPosition={x:0,y:0},this._downPositionRelative={x:0,y:0},this._boundingClientRect=this._domHelper.element.getBoundingClientRect()}enableDragIn(t){this._setState(1),this._dragEnabled=!0,t&&(this._dragMV=this._dragM.bind(this),this._dragEV=this._dragE.bind(this),this._dragTarget=t.currentTarget||t.target,this._delta=-1,this._dragMVName="drag",this._dragEVName="dragend",window.TouchEvent&&t instanceof TouchEvent?(this._dragMVName="touchmove",this._dragEVName="touchend"):t.dataTransfer&&t.dataTransfer.setData&&t.dataTransfer.setData("text/plain"," "),this._firefoxDragPosition={x:0,y:0},document.ondragover=t=>{t=t||window.event,this._firefoxDragPosition.x=t.pageX,this._firefoxDragPosition.y=t.pageY},this._dragTarget.addEventListener(this._dragMVName,this._dragMV,!1),this._dragTarget.addEventListener(this._dragEVName,this._dragEV,!1))}_dragM(t){let e=t,i=null,s=null;window.TouchEvent&&t instanceof TouchEvent?(i=this._getTouchPosition(e),s=this._getTouchPositionRelative(e)):(i=this._getMousePosition(e),s=this._getMousePositionRelative(e)),i.x>0&&i.y>0&&this._move(i,s)}_dragE(t){let e=t;document.ondragover=null,this._firefoxDragPosition=null,this._dragTarget.removeEventListener(this._dragMVName,this._dragMV),this._dragTarget.removeEventListener(this._dragEVName,this._dragEV),window.TouchEvent&&t instanceof TouchEvent?this._onUp(this._getTouchPosition(e),this._getTouchPositionRelative(e),2):this._onUp(this._getMousePosition(e),this._getMousePositionRelative(e),1)}addEvents(t){this._events.forEach(e=>t.addEventListener(e,this,!1))}removeEvents(t){this._events.forEach(e=>t.removeEventListener(e,this,!1))}_move2(t){if(this._lastTouchEvent&&t.timeStamp-this._lastTouchEvent.timeStamp<16)return;const e=t.touches[0],i=t.touches[1],s=e.pageX-i.pageX,a=e.pageY-i.pageY,n=Math.abs(s)+Math.abs(a);this._pinchDistance>-1&&(n>this._pinchDistance+H?(this._setState(3),this.dispatchEvent(7,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t)))):n<this._pinchDistance-H?(this._setState(3),this.dispatchEvent(8,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t)))):n<=this._pinchDistance+H&&n>=this._pinchDistance-H&&(this._setState(5),this.dispatchEvent(11,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t))))),this._pinchDistance=n,this._lastTouchEvent=t}_setState(t){this._state=t}_move(t,e,i){void 0===i&&(i=0),void 0===this._dragEnabled&&(this._dragEnabled=!1),1===this._state&&this._canDrag(i)&&(this._delta=this._getDelta(t),this._delta>D&&(this._setState(2),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(0,new k(t,e)))),2===this._state&&this.dispatchEvent(1,new k(t,e)),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(6,new k(t,e,i))}_longClick(){this._setState(2),this._longClickTimer&&clearTimeout(this._longClickTimer),this.dispatchEvent(0,new k(this._downPosition,this._downPositionRelative)),this.dispatchEvent(1,new k(this._downPosition,this._downPositionRelative))}_onUp(t,e,i){this.dispatchEvent(4,new k(t,e,i)),this._getDelta(t)<=D&&this.dispatchEvent(5,new k(t,e)),2===this._state&&this.dispatchEvent(2,new k(t,e)),4===this._state&&(this.dispatchEvent(10,new k(t,e)),this._rotationAngle=-1),3===this._state&&(this._pinchDistance=-1),this._lastTouchEvent=null,this._setState(0),this._dragTarget=null,this._elementHit=!1,this._longClickTimer&&clearTimeout(this._longClickTimer)}_getTouchPosition(t){if(t.touches.length){let{clientX:e,clientY:i}=t.touches[0];if(t.touches.length>1){const s=t.touches[1],a=s.clientX,n=s.clientY;e=(e+a)/2,i=(i+n)/2}return{x:e,y:i}}const e=t.changedTouches[0];return{x:e.clientX,y:e.clientY}}_getTouchPositionRelative(t){const e=this._boundingClientRect,{clientWidth:i,clientHeight:s}=this._domHelper.element;if(t.touches.length){const{clientX:a,clientY:n}=t.touches[0];return{x:(a-e.left)/i*2-1,y:-(n-e.top)/s*2+1}}const a=t.changedTouches[0];return{x:(a.clientX-e.left)/i*2-1,y:-(a.clientY-e.top)/s*2+1}}_getMousePosition(t){if(0!==t.clientX&&0!==t.clientY)return{x:t.clientX,y:t.clientY};{let{x:e,y:i}=this._getFireFoxMousePosition(t);return{x:e,y:i}}}_getFireFoxMousePosition(t){let{x:e,y:i}=this._domHelper.getClientDimensions();return{x:e-(e+t.offsetX),y:i-(i+t.offsetY)}}_getMousePositionRelative(t){const e=this._boundingClientRect;return 0!==t.clientX&&0!==t.clientY?{x:(t.clientX-e.left)/this._domHelper.element.clientWidth*2-1,y:-(t.clientY-e.top)/this._domHelper.element.clientHeight*2+1}:this._firefoxDragPosition&&0!==this._firefoxDragPosition.x&&0!==this._firefoxDragPosition.y?{x:(this._firefoxDragPosition.x-e.left)/this._domHelper.element.clientWidth*2-1,y:-(this._firefoxDragPosition.y-e.top)/this._domHelper.element.clientHeight*2+1}:(console.trace("this should not happen"),{x:0,y:0})}_getDelta(t){return Math.abs(this._downPosition.y-t.y)+Math.abs(this._downPosition.x-t.x)}setDragEnabled(t){this._dragEnabled=t}handleEvent(t){switch(this._debug&&t.type,t.type){case A.MOUSE_MOVE:this._onMouseMove(t);break;case A.MOUSE_DOWN:this._onMouseDown(t);break;case A.MOUSE_UP:this._onMouseUp(t);break;case A.MOUSE_LEAVE:this._onMouseLeave(t);break;case A.MOUSE_ENTER:this._onMouseEnter(t);break;case A.MOUSE_WHEEL:this._onMouseWheel(t);break;case A.TOUCH_MOVE:this._onTouchMove(t);break;case A.TOUCH_START:this._onTouchStart(t);break;case A.TOUCH_END:this._onTouchEnd(t);break;case A.CONTEXT_MENU:this._onContextMenu(t)}}_onMouseDown(t){t.preventDefault();let{x:e,y:i}=this._getMousePosition(t);this._downPosition={x:e,y:i},this._downPositionRelative=this._getMousePositionRelative(t),this.dispatchEvent(3,new k({x:e,y:i},this._downPositionRelative,1)),this._setState(1)}_onMouseUp(t){t.preventDefault(),this._onUp(this._getMousePosition(t),this._getMousePositionRelative(t),1)}_onMouseMove(t){t.preventDefault(),this._move(this._getMousePosition(t),this._getMousePositionRelative(t),1)}_onMouseLeave(t){this._delta=-1,this._onMouseUp(t)}_onMouseEnter(t){t.preventDefault()}_onMouseWheel(t){if(this._lastMouseWheelEvent&&t.timeStamp-this._lastMouseWheelEvent.timeStamp<40)return t.preventDefault(),void t.stopPropagation();t.deltaY<0?this.dispatchEvent(7,new k(this._getMousePosition(t),this._getMousePositionRelative(t),1,0,t)):this.dispatchEvent(8,new k(this._getMousePosition(t),this._getMousePositionRelative(t),1,0,t)),this._lastMouseWheelEvent=t}_onTouchMove(t){if(t.preventDefault(),!this._dragTarget)if(1===t.touches.length)this._move(this._getTouchPosition(t),this._getTouchPositionRelative(t),2);else if(2===t.touches.length)if(this._elementHit||4===this._state){const e=t.touches[0],i=t.touches[1];let s={x:e.pageX,y:e.pageY},a={x:i.pageX,y:i.pageY};const n=d(c(s,a));this._rotationAngle<0&&(this._rotationAngle=n);const o=n-this._rotationAngle;this._rotationAngle=n,this.dispatchEvent(9,new k(this._getTouchPosition(t),this._getTouchPositionRelative(t),2,h(o))),this._setState(4)}else this._move2(t)}_onTouchStart(t){if(t.preventDefault(),1===t.touches.length){let{x:e,y:i}=this._getTouchPosition(t);this._downPosition={x:e,y:i},this._downPositionRelative=this._getTouchPositionRelative(t),this.dispatchEvent(3,new k({x:e,y:i},this._downPositionRelative,2)),this._setState(1),this._longClickTimer=window.setTimeout(this._longClick.bind(this),350)}else 2===t.touches.length&&(1!==this._state&&2!==this._state||this._onUp(this._getTouchPosition(t),this._getTouchPositionRelative(t),2),this._setState(3))}_onTouchEnd(t){t.preventDefault(),t.touches.length>1&&5===this._state||3===this._state||this._onUp(this._getTouchPosition(t),this._getTouchPositionRelative(t),2)}_onContextMenu(t){t.preventDefault()}_canDrag(t){return this._dragEnabled}onElementHit(){this._elementHit=!0}updateSize(){this._boundingClientRect=this._domHelper.element.getBoundingClientRect()}}return n([o],t.prototype,"_domHelper",void 0),t})());var L=t("P","static/PhotoStudioRoom-5b94763849f82256.glb");class O{constructor(t,e){this._scene=t,e&&e.removeFromScene()}needsBounds(){return!1}updateBounds(t){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new THREE.Object3D),this._cameraContainer}}t("L",O),t("D",(()=>{class t extends O{constructor(t,e){super(t,e),this._lights=[]}needsBounds(){return!0}updateBounds(t){if(this._cameraLight){const e=this._cameraLight,i=new THREE.Vector3;t.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,e.shadow.camera.top=s/2,e.shadow.camera.bottom=-s/2,e.shadow.camera.left=-s/2,e.shadow.camera.right=s/2,e.shadow.camera.updateProjectionMatrix()}}loadFromJSON(t){return new Promise(e=>{this._lights=this._dynamicLightSettingLoader.parse(t),this.addToScene(),e()})}loadFromObject(t){return new Promise(e=>{t.lights||e(),this._lights=this._dynamicLightSettingLoader.load(t),this._lights.forEach((t,e)=>{t.userData.movesWithCamera&&(this._cameraLight=t,this._lights.splice(e,1))}),this.addToScene(),e()})}loadFromURL(t){return new Promise((e,i)=>{fetch(new Request(t,{method:"GET"})).then(b).then(t=>this.loadFromObject(t).then(e,i))})}addToScene(){this._lights.forEach(t=>{this._scene.add(t)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(t,e){if(!this._cameraLight)return;let i=new THREE.Vector3;t.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=e.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(t=>{this._scene.remove(t)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let t=u();this._cameraLight&&this._addToGUI(t,this._cameraLight),this._lights.forEach(e=>{this._addToGUI(t,e)})}_addToGUI(t,e){t&&(e instanceof THREE.SpotLight&&this._addSpotLightToGUI(t,e),e instanceof THREE.AmbientLight&&this._addAmbientLightToGUI(t,e),e instanceof THREE.DirectionalLight&&this._addDirectionalLightToGUI(t,e),e instanceof THREE.RectAreaLight&&this._addRectAreaLightToGUI(t,e))}_addRectAreaLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),intensity:e.intensity*(e.width*e.height)};i.add(e,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(t=>{e.intensity=t/(e.width*e.height)}),i.add(e,"castShadow"),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}_addSpotLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),angle:180*e.angle/Math.PI};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.add(e,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(s,"angle").min(10).max(180).step(1).onChange(t=>{e.angle=t*Math.PI/180}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}_addAmbientLightToGUI(t,e){let i={name:e.name,color:"#"+e.color.getHexString()},s=t.addFolder(e.name);s.add(e,"visible"),s.add(e,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(t=>{e.color=new THREE.Color(t)})}_addDirectionalLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString()};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new THREE.Color(t)}),i.add(e,"castShadow"),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new THREE.Vector3(0,0,0))})}}return n([o],t.prototype,"_dynamicLightSettingLoader",void 0),t})());class B{constructor(t,e){this._scene=t,e&&(e.removeFromScene(),e.cleanUp())}updateCamera(t){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(t,e){this._bounds=t}cleanUp(){this._scene=null}}let Q=t("G",(()=>{class t extends B{constructor(t,e){super(t,e),this._gltfLoaderPromise=this._scriptLoader.fetch(g,{id:"gltf-loader-js"}).then(()=>{this._gltfLoader=new THREE.GLTFLoader})}needsBounds(){return!0}needsCamera(){return!0}updateBounds(t){if(super.updateBounds(t),this._backgroundMesh){let e=Math.max(t.x,t.z)/6;e=Math.max(e,1),this._backgroundMesh.scale.copy(new THREE.Vector3(e,e,e))}}updateCamera(t){if(this._backgroundMesh){let e=t.getWorldDirection(new THREE.Vector3);e.y=0,e.lengthSq()<.01&&(e=new THREE.Vector3(0,1,0),e.applyQuaternion(t.quaternion),e.y=0),e.multiplyScalar(-1),e.normalize();let i=Math.asin(e.x);e.z<0&&(i=Math.PI-i),this._backgroundMesh.rotation.set(0,i,0)}}addToScene(){this._scene&&this._backgroundMesh&&this._scene.add(this._backgroundMesh)}removeFromScene(){this._scene&&this._backgroundMesh&&this._scene.remove(this._backgroundMesh)}loadBackground(t,e){this._backgroundMaterial=e,this._backgroundMaterial||(this._backgroundMaterial=new THREE.MeshBasicMaterial),this._gltfLoaderPromise.then(()=>{this._gltfLoader.load(t,this._onBackgroundLoaded.bind(this),t=>{},t=>{console.error(t)})})}_onBackgroundLoaded(t){this._scene&&(this._backgroundMaterial.vertexColors=!0,t&&t.scene&&t.scene.children&&t.scene.children.length>0&&(t.scene.children[0].material=this._backgroundMaterial,t.scene.children[0].layers.set(2),t.scene.position.copy(new THREE.Vector3(0,0,0)),this._backgroundMesh=t.scene,this._backgroundMesh.layers.set(2),this._backgroundMesh.receiveShadow=!0,m(this._backgroundMesh,!0,!1),this.removeFromScene(),this.addToScene()))}showGUI(){console.warn("gui not implemented for gltf environment")}}return n([o],t.prototype,"_scriptLoader",void 0),t})());const I={enable:!0,shadowMapResolution:512,smoothTransition:!0,numSamples:500,numSamplesPerFrame:4,bShadowMaterial:!0,falloff:1.5,darkness:.2,size:1.6,lightSolidAngle:40,yPosition:0};class z extends B{constructor(t,e){super(t,e),this._pixotronGuard=new p,this._params=Object.assign(I,{lightDirection:new THREE.Vector3(0,1,.5),onComplete:this._addGroundShadows.bind(this),onProgress:this._progressCallback.bind(this)})}_progressCallback(t){}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}setPixotron(t,e,i,s){t&&(this._pixotron=t,this._renderer=e,this._camera=i,this._shadowBaker||(this._shadowBaker=new window.PIXOTRON.PlaneShadowBakePass(Object.assign(this._params,s))),this._shadowBaker.enable?this._shadowBaker.startBake(this._renderer,this._scene,this._camera):this._shadowBaker.enable=!0,this._wasAAEnabled=this._pixotron.enableAA,this._pixotronGuard.resolve())}async _addGroundShadows(){await this._pixotronGuard.wait(),this._pixotron.needsUpdate=!0,this._shadowPlane=this._shadowBaker.getShadowPlane(),this._shadowPlane.name="Shadow plane",this._shadowPlane.receiveShadow=!1,0!==this._params.yPosition&&(this._shadowPlane.position.y=this._params.yPosition),this._shadowPlane.visible=!0,this.addToScene(),this._loadedCallback&&this._loadedCallback()}setLoadedCallback(t){this._loadedCallback=t}update(){const t=this._getNumberOfChildren();this._bake(),this._sceneChildren=t}updateBounds(t,e){const i=this._getNumberOfChildren();return!(w(this._bounds,t,1e-4)&&this._scene&&i===this._sceneChildren&&!e||(super.updateBounds(t),this._bake(),this._sceneChildren=i,0))}_bake(){this._pixotronGuard.wait().then(()=>{this._shadowPlane&&(this._shadowPlane.visible=!1),this._shadowBaker.startBake(this._renderer,this._scene,this._camera)})}_getNumberOfChildren(){let t=0;return this._scene.traverse(e=>{"Shadow plane"!==e.name&&t++}),t}addToScene(){this._scene&&this._shadowPlane&&(this._shadowPlane.material.needsUpdate=!0,E(this._shadowPlane),this._scene.add(this._shadowPlane))}removeFromScene(){this._shadowPlane&&(this._scene.remove(this._shadowPlane),this._pixotron&&(this._pixotron.enableAA=this._wasAAEnabled))}showGUI(){}}t("B",z);class U{constructor(t){this._innerSize=1,this._outerSize=100,this._plane=new THREE.Object3D,this._plane.rotation.x=-Math.PI/2;const e=new THREE.MeshStandardMaterial;this._innerPlaneMesh=new THREE.Mesh,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=e,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new THREE.Mesh,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=e,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=t,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(t){this._innerSize=t,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(t,e){const i=new THREE.Shape;i.moveTo(-t/2,-t/2),i.lineTo(-t/2,t/2),i.lineTo(t/2,t/2),i.lineTo(t/2,-t/2),i.lineTo(-t/2,-t/2);const s=new THREE.Shape;s.moveTo(-e/2,-e/2),s.lineTo(-e/2,e/2),s.lineTo(e/2,e/2),s.lineTo(e/2,-e/2),s.lineTo(-e/2,-e/2);const a=new THREE.Path;a.moveTo(-t/2,-t/2),a.lineTo(-t/2,t/2),a.lineTo(t/2,t/2),a.lineTo(t/2,-t/2),a.lineTo(-t/2,-t/2),s.holes.push(a);const n=new THREE.ShapeBufferGeometry(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=n;const o=new THREE.ShapeBufferGeometry(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const h=n.attributes.uv.clone();n.setAttribute("uv2",h);const r=n.attributes.uv2.array;for(let t=0;t<r.length;++t)r[t]+=.5}}let V=t("F",(()=>{class t extends z{constructor(t,e,i){super(t,e),this._longestSide=2,this._bakedShadowPlane=new U(100),this._fog=i||!1,this._textureLoader=new THREE.TextureLoader,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(t){return super.updateBounds(t),this._longestSide=Math.max(t.x,t.z),this._update(),!0}updateCamera(t){this._cameraDistance=t.position.distanceTo(new THREE.Vector3(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let t=this._longestSide/2;this._scene.fog=new THREE.Fog(16185078,this._cameraDistance+t+3,this._cameraDistance+t+3+1),this._scene.background=new THREE.Color(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let t=this._width/1e3,e=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=THREE.RepeatWrapping,this._floorTexture.wrapT=THREE.RepeatWrapping,this._floorTexture.repeat.set(100/t,100/e));let i=new THREE.MeshStandardMaterial({map:this._floorTexture,side:THREE.DoubleSide});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&(this._shadowPlane&&(this._bakedShadowPlane.updateSize(this._shadowPlane.scale.x),this._bakedShadowPlane.getRootNode().position.copy(this._shadowPlane.position),this._bakedShadowPlane.getInnerPlane().material.aoMap=this._shadowPlane.material.aoMap),this._scene.add(this._bakedShadowPlane.getRootNode()))}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(t,e,i,s){return this._width=e,this._height=i,this._repeatable=s,this._floorPromise=new Promise((e,i)=>{this._textureLoader.load(t,t=>{this._floorTexture=t,e()},null,i)}),new Promise((t,e)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),t()},e)})}changeFloorMaterial(t,e){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=P(t,this._environmentLoader),this._rapiAccess.getTexturesOf(t).then(t=>{if(t.length>0){let a=[];t.forEach(t=>{a.push(y(this._dataSyncer.requestAsset(t.image,!0),t,this._floorMaterial,e,1,1))}),Promise.all(a).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((t,e)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),t()},e)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let t=u();if(!t)return;let e=t.addFolder("Floor");e.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),e.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),e.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}return n([o],t.prototype,"_rapiAccess",void 0),n([o],t.prototype,"_dataSyncer",void 0),n([o],t.prototype,"_environmentLoader",void 0),t})());class N extends z{constructor(t,e,i,s,a){if(super(t,e),this._color=i,this._oldBackground=t.background,s&&a){this._canvas=s,this._style=document.createElement("style");let t='background-image: url("'+a+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+t+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){super.addToScene(),this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"),this._pixotron&&(this._pixotron.enableAA=!1))}removeFromScene(){super.removeFromScene(),this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}}t("a",N),t("c",(()=>{class t{parse(t,e,i,s){let a=JSON.parse(s);return a.environment?this.load(t,e,i,a):null}load(t,e,i,s){let a,n=s.environment;if(!n)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(n.type){case"color":a=new Promise(e=>e(new N(t,i,new THREE.Color(n.details.color))));break;case"image":a=new Promise(s=>s(new N(t,i,null,e,n.details.imageUrl)));break;case"gltf":a=new Promise(e=>{let s=new Q(t,i);s.loadBackground(v()+L),e(s)});break;case"floor":a=new Promise(e=>{this._rapiAccess.getMaterial(n.details.material).then(s=>{let a=void 0===n.details.fog||n.details.fog,o=new V(t,i,a);o.changeFloorMaterial(s).then(()=>{e(o)})})});break;case"baked_shadow":a=new Promise(s=>{n.details&&n.details.color?s(new N(t,i,new THREE.Color(n.details.color))):n.details&&n.details.imageUrl?s(new N(t,i,null,e,n.details.imageUrl)):s(new z(t,i))});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(t=>t(i))}return a}}return n([o],t.prototype,"_rapiAccess",void 0),t})());class F{constructor(){this._settings=new window.PIXOTRON.QualitySettings(5),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!0,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class G{constructor(){this._settings=new window.PIXOTRON.QualitySettings(4),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!0,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class X{constructor(){this._settings=new window.PIXOTRON.QualitySettings(3),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!0,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!0},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class j{constructor(){this._settings=new window.PIXOTRON.QualitySettings(2),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class W{constructor(){this._settings=new window.PIXOTRON.QualitySettings(1),this._settings.enableAA=!0,this._settings.useAreaLight=!0,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}class Y{constructor(){this._settings=new window.PIXOTRON.QualitySettings(0),this._settings.enableAA=!1,this._settings.useAreaLight=!1,this._settings.useDevicePixelRatio=!1,this._settings.useHDREnv=!1,this._settings.useGBuffer=!0,this._settings.saoQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1,enableBlur:!1},this._settings.shadowQualitySettings={enabled:!1,downscale:1,enabledOnMove:!0}}getSettings(){return this._settings}}t("b",class{constructor(t){this._sceneBoundingSphere=new THREE.Sphere,this._pixotron=t,this._initializeQualitySettings(),this._initializeQualityAdapters()}getPixotronInstance(t){const e={saoparams:{intensity:.5,occlusionWorldRadius:.6,smoothTransition:!0,bias:.02,accumulative:!1},shadowparams:{shadowQuality:1,smoothTransition:!0,enableAccumulation:!0,shadowBiasMultiplier:.05,nearPlane:.01,farPlane:50,fov:40,numSamples:100,side:THREE.FrontSide}};return t=t||e,new window.PIXOTRON.Pixotron(t)}showGUI(){let t=u();if(!t)return;let e=t.addFolder("Renderer");e.add(this._pixotron.getSAOPass(),"enabled"),this._pixotron.getSAOPass().smoothTransition&&e.add(this._pixotron.getSAOPass(),"smoothTransition"),e.add(this._pixotron.getSAOPass(),"occlusionWorldRadius").min(0).max(1).step(1e-4).onChange(t=>{this._adjustSaoRadius(t)}),e.add(this._pixotron.getSAOPass(),"intensity").min(.1).max(2).step(.05),e.add(this._pixotron.getSAOPass(),"bias").min(0).max(1).step(1e-4).onChange(t=>{this._adjustSaoBias(t)}),this._pixotron.getSAOPass().numSamples&&e.add(this._pixotron.getSAOPass(),"numSamples").min(10).max(3e3).step(10),void 0!==this._pixotron.getShadowPass().enabled&&e.add(this._pixotron.getShadowPass(),"enabled"),e.add(this._pixotron.getShadowPass(),"smoothTransition"),e.add(this._pixotron.getShadowPass(),"enableAccumulation"),e.add(this._pixotron.getShadowPass(),"shadowRadius").min(0).max(5).step(.1),e.add(this._pixotron.getShadowPass(),"shadowBiasMultiplier").min(0).max(3).step(.01),e.add(this._pixotron.getShadowPass(),"numSamples").min(10).max(3e3).step(10)}updateBounds(t){this._sceneBoundingSphere.copy(t);const e=.25*this._getMaxSaoRadius();this._adjustSaoRadius(e);const i=2*this._getMinSaoBias();this._adjustSaoBias(i)}_getSaoRadius(){return this._sceneBoundingSphere.radius}_adjustSaoRadius(t){const e=this._pixotron.getSAOPass(),i=this._getMinSaoRadius(),s=this._getMaxSaoRadius();e.occlusionWorldRadius=Math.min(Math.max(t,i),s)}_adjustSaoBias(t){const e=this._pixotron.getSAOPass(),i=this._getMinSaoBias(),s=this._getMaxSaoBias();e.bias=Math.min(Math.max(t,i),s)}_getMinSaoRadius(){return.001*this._getSaoRadius()}_getMaxSaoRadius(){return.6*this._getSaoRadius()}_getMinSaoBias(){return.001*this._getSaoRadius()}_getMaxSaoBias(){return.01*this._getSaoRadius()}updatePixelRatio(t){const e=new THREE.Vector2;t.getDrawingBufferSize(e),this._pixotron.setSize(Math.floor(e.width),Math.floor(e.height))}getHighPixelRatioQualitySetting(){return this._highPixelRatioQualitySetting.getSettings()}getLowestQualitySetting(){return this._lowQualitySetting.getSettings()}_initializeQualitySettings(){this._highestQualitySetting=new G,this._highPixelRatioQualitySetting=new F,this._highQualitySetting=new X,this._midQualitySetting=new j,this._lowQualitySetting=new W,this._lowestQualitySetting=new Y}_initializeQualityAdapters(){this._autoQualityAdapter=new window.PIXOTRON.AutoQualityAdapter(this._pixotron),this._autoQualityAdapter.addQuality(this._highestQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._highQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._midQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._lowQualitySetting.getSettings()),this._autoQualityAdapter.addQuality(this._lowestQualitySetting.getSettings()),this._autoQualityAdapter.setDesiredFps(30),this._manualQualityAdapter=new window.PIXOTRON.ManualQualityAdapter(this._pixotron)}onAutoQualityChange(t){this._autoQualityAdapter.onQualityChange(t)}onManualQualityChange(t){this._manualQualityAdapter.onQualityChange(t)}getAutoAdapter(){return this._autoQualityAdapter}lockAdapter(){this._autoQualityAdapter.getCurrentQualitySetting().lock()}unLockAdapter(){this._autoQualityAdapter.getCurrentQualitySetting().unLock()}enablePixotronAutoQuality(){this._currentQualityAdapter||(this._currentQualityAdapter=this._autoQualityAdapter,this._pixotron.setQualityAdapter(this._autoQualityAdapter))}movingCameraStarts(){this._currentQualityAdapter&&(this._currentQualityAdapter=this._autoQualityAdapter,this._currentQualitySetting&&(this._manualQualityAdapter.setQualitySetting(this._currentQualitySetting),this._pixotron.setQualityAdapter(this._manualQualityAdapter)),this._pixotron.setQualityAdapter(this._autoQualityAdapter))}movingCameraStops(){this._currentQualityAdapter&&(this._currentQualitySetting=this._currentQualityAdapter.getCurrentQualitySetting(),this._currentQualityAdapter=this._manualQualityAdapter,this._pixotron.setQualityAdapter(this._manualQualityAdapter),this._manualQualityAdapter.setQualitySetting(this._highestQualitySetting.getSettings()))}}),t("g","static/pi.min-6875d25247d9711b.js"),t("e",["static/CopyShader-cde53240fcc3e06e.js","static/EffectComposer-1e936e5d03ff43cc.js","static/RenderPass-bc5df3810a01b2c6.js","static/ShaderPass-31f36160e0ea282d.js","static/LuminosityHighPassShader-dd5826656142421d.js","static/OutlinePass-f4bcd337cdd89b8d.js","static/RectAreaLightUniformsLib-4b74882185efd473.js","static/GammaCorrectionShader-b3b56f244f0d1e0e.js"])}}}));
|
|
2
|
-
//# sourceMappingURL=pixotron-7a1f9ec8.nomodule.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./query-params-helper-a271f9dc.js";import"./rapi-access-ff57cd9e.js";import"./main-thread-to-worker-815feb19.js";import"./image-renderer-32588b0f.js";import{Planner}from"./planner-fab4fbbe.js";import"./pixotron-0b81eb7c.js";import"./mesh-generator-0b2ac98c.js";import"./default-light-setting-740fe05f.js";import"./scene-manager-1c0fa594.js";(new Planner).boot(),window.requestIdleCallback||(window.requestIdleCallback=e=>setTimeout(()=>{let a=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-a))})},1)),window.cancelIdleCallback||(window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)});
|
|
2
|
-
//# sourceMappingURL=planner-main-1426a336.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"planner-main-1426a336.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roomle-sdk-6e4fd2d6.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as toRadiant,u as position3VectorsAreEqual,a8 as rotationQuaternionsAreEqual,a9 as getDelta,v as position2VectorsAreEqual,_ as __decorate,i as inject,e as dispose,h as getGUI,f as DynamicLightSettingLoader,R as RoomleComponentFactoryInitializer,aa as DynamicQualitySettingLoader}from"./rapi-access-ff57cd9e.js";import{d as CameraControl,i as MIN_MOVE_DISTANCE,D as DynamicLightSetting,C as CameraControl3D,b as PixotronUtil,B as BakedShadowEnvironment,f as DAT_GUI_FILE_NAME,c as DynamicEnvironmentSettingLoader}from"./pixotron-0b81eb7c.js";class CameraControl2D extends CameraControl{constructor(t,e,i){super(t,e,i),this._scale=1,this._state=0,this._size=20,this._center=new THREE.Vector3,this._raycaster=new THREE.Raycaster,this._lastPosition=new THREE.Vector2,this._zoomPosition=new THREE.Vector3,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),this._cameraZoom=1,this._initCamera(i||new THREE.Vector3(0,10,0));let s=new THREE.PlaneGeometry(1e3,1e3);s.rotateX(-Math.PI/2),this._plane=new THREE.Mesh(s,new THREE.MeshStandardMaterial)}_getCamera(){return this._camera||this._initCamera(new THREE.Vector3(0,10,0)),this._camera}_initCamera(t){let{x:e,y:i}=this._domHelper.getClientDimensions(),s=e/i*this._size,n=this._size;this._camera=new THREE.OrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3),this._camera.position.copy(t),this._cameraPosition=t,this._camera.lookAt(new THREE.Vector3(0,0,0))}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions(),i=t/e*this._size,s=this._size;this._camera.left=i/-2,this._camera.right=i/2,this._camera.top=s/2,this._camera.bottom=s/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:t=>{this._locked||(this._state=1,this._lastPosition.set(t.position.x,t.position.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._move(new THREE.Vector2(t.position.x,t.position.y),t.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this._scale/=this._zoomSpeed,this._zoomTo(t.position,1),this._update()}}),this._inputListeners.push({key:8,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this._scale*=this._zoomSpeed,this._zoomTo(t.position,-1),this._update()}})}_zoomTo(t,e){if(Date.now()-this._lastZoom>200){if(e>0||this._cameraZoom>=1){const e=this.getInputPosition(t);this._raycaster.setFromCamera(e,this._camera);const i=this._raycaster.intersectObject(this._plane);if(i.length<=0)return;const s=i.pop().point;this._zoomPosition.copy(s)}else this._zoomPosition.copy(this._center);this._cameraPosition.x=this._zoomPosition.x,this._cameraPosition.z=this._zoomPosition.z}this._lastZoom=Date.now()}_move(t,e){let i=new THREE.Vector2;i.subVectors(this._lastPosition,t),i.divideScalar(100),this._cameraPosition.x+=i.x*(2===e?1.1:1),this._cameraPosition.z+=i.y*(2===e?1.1:1),this._lastPosition.copy(t)}updateToBounds(t,e){let{x:i,y:s}=this._domHelper.getClientDimensions(),n=i/s;this._size=Math.max(t.x,t.z);let a=this._size,r=this._size;n>1?a=this._size*n:r=this._size*(s/i),this._center.copy(e),this._camera.left=a/-2,this._camera.right=a/2,this._camera.top=r/2,this._camera.bottom=r/-2,this._camera.zoom=1,this._camera.position.set(this._center.x,10,this._center.z),this._cameraPosition.copy(this._camera.position)}_update(t){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.8),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(t){return!(!super.animateCamera(t)&&Math.abs(this._cameraZoom-this._camera.zoom)<=.01||(this._camera.zoom=THREE.MathUtils.lerp(this._camera.zoom,this._cameraZoom,10*t),0))}}const KEYBOARD_ROTATION_ANGLE=Math.PI/4;class CameraControlFirstPerson extends CameraControl{constructor(t,e,i,s){super(t,e,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=toRadiant(-60),this.maxPolarAngle=toRadiant(60),this._camera=s||new THREE.PerspectiveCamera,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(5),this._camera.layers.enable(4),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new THREE.Vector3,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new THREE.Quaternion,this._pitch=0,this._yaw=0;let n=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(t){this.startButtonPressListener()}_gamepadDisconnected(t){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let t=navigator.getGamepads()[0];this._checkRightStick(t),this._checkLeftStick(t),this._checkButtons(t),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(t){let e=t.axes[2],i=t.axes[3];Math.abs(e)>.2&&(this._rotateHorizontal(.01*KEYBOARD_ROTATION_ANGLE*e),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*KEYBOARD_ROTATION_ANGLE*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(t){let e=t.axes[0],i=t.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):t.buttons&&t.buttons[12]&&t.buttons[12].pressed?this._keyMap.set(87,!0):t.buttons&&t.buttons[13]&&t.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(e)>.2?e<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(t){t.buttons&&t.buttons[6]&&t.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),t.buttons&&t.buttons[14]&&t.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),t.buttons&&t.buttons[15]&&t.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(t){let e=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=position3VectorsAreEqual(e,s.position),a=rotationQuaternionsAreEqual(i,s.quaternion);if(!e||n&&a)return!1;let r=this.getCamera().position.clone(),o=Math.min(10*t,1);r.lerp(e,o),this.getCamera().position.copy(r);let h=this.getCamera().quaternion.clone(),_=Math.min(5*t,1);h.slerp(i,_),this.getCamera().setRotationFromQuaternion(h);let d=!1;return this._keyMap.forEach(t=>{t&&(d=!0)}),d&&this._processKeyMap(this._keyMap,t),!0}_getCamera(){return this._camera}_initInputListener(){window.addEventListener("keyup",this._onKeyChanged.bind(this),!1),window.addEventListener("keydown",this._onKeyChanged.bind(this),!1),this._inputListeners.push({key:3,fun:t=>{this._down(t)}}),this._inputListeners.push({key:6,fun:t=>{this._move(t)}}),this._inputListeners.push({key:4,fun:t=>{this._up(t)}})}_down(t){this._downPosition=t.position,this._position=t.position,this._state=1,2===t.type&&window.setTimeout(this._onLongDown.bind(this),350),2===t.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(t){this._position=t.position,1!==this._state||this._locked||this._orbit(new THREE.Vector2(t.position.x,t.position.y)),2!==this._state||this._locked||(this._orbit(new THREE.Vector2(t.position.x,t.position.y)),this._moveForward())}_up(t){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){getDelta(this._downPosition,this._position)<MIN_MOVE_DISTANCE&&1===this._state&&(this._state=2,this._orbit(new THREE.Vector2(this._position.x,this._position.y)),this._moveForward())}_update(t){let e=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(e)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}_onKeyChanged(t){this._keyMap.set(t.keyCode,"keydown"===t.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&t.preventDefault()}_processKeyMap(t,e){e=Math.min(e,.1);let i=new THREE.Vector3(0,0,0),s=!1;return this._processUpDown(t,i,e),t.get(65)&&(i.x=-1*e),t.get(68)&&(i.x=1*e),t.get(37)&&(this._rotateHorizontal(-KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*e),s=!0),t.get(39)&&(this._rotateHorizontal(KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*e),s=!0),t.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new THREE.Vector3(i.x,0,i.z)),this._update(),0))}_processUpDown(t,e,i){(t.get(87)||t.get(38))&&(e.z=-1*i),(t.get(83)||t.get(40))&&(e.z=1*i)}_orbit(t){this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0));let e=t.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;e.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*e.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*e.y/i.clientHeight*1),position2VectorsAreEqual(this._orbitPosition,t)||this.dispatchEvent(1),this._orbitPosition.copy(t),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(t){let e=this._pitch+t;e>this.maxPolarAngle||e<this.minPolarAngle||(this._pitch=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}}let SceneManager=(()=>{class t{constructor(t,e,i,s,n){this._maxAnisotropy=1,this._clock=new THREE.Clock,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._onAfterRender=()=>{},this._creator_=t,this._canvasID=i,this.createCameraControl(s),this._addCameraControlListener(),this._setupScene(e,n),document.addEventListener("visibilitychange",this._tabVisible.bind(this)),this._renderListener=()=>{this._requestRender(!0)},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this._lifeCycleManager.addEventListener(this)}onBeforeRender(){}_changeCameraControl(t){this._cameraControl&&this._cameraControl.cleanUp(),t instanceof CameraControlFirstPerson&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraControl instanceof CameraControlFirstPerson&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this._cameraControl=t,this.cameraControlChanged()}cameraControlChanged(){}_addCameraControlListener(){this._cameraControl.addEventListener(0,this._requestRender,this),this._cameraControl.addEventListener(1,this._requestRender,this),this._cameraControl.addEventListener(2,this._requestRender,this),this._cameraControl.addEventListener(6,this._requestRender,this)}_requestRender(t){if(!this._renderer)return;this._pixotron&&(this._pixotron.needsUpdate=!0,t&&(this._forceRender=!0));const e=()=>{this._delta=this._clock.getDelta(),this._animateCamera(),this._cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._statsHelper&&this._statsHelper.updateRenderInfo(this._renderer.info),this._pixotron?(this._forceRender&&(this._pixotron.autoShadowsClear=!0,this._pixotron.autoSAOClear=!0),this._pixotron.render(this._renderer,this._scene,this._cameraControl.getCamera(),this._renderTarget),this._forceRender=!1,this._pixotron.blit()):(this._renderer.clear(),this._renderer.render(this._scene,this._cameraControl.getCamera()),this._renderer.clearDepth()),this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_animateCamera(){this._cameraControl&&(this._cameraControl.animateCamera(this._delta)||!this._pixotron||this._forceRender?(this._lightSetting instanceof DynamicLightSetting&&this._cameraControl.getCamera()instanceof THREE.PerspectiveCamera&&this._lightSetting.update(this._cameraControl.getCamera(),this._cameraControl.getTargetPosition()),this._pixotron&&(this._pixotron.needsUpdate=!0)):(this._pixotron.autoShadowsClear=!1,this._pixotron.autoSAOClear=!1)),this._environment&&this._environment.needsCamera()&&this._cameraControl instanceof CameraControl3D&&this._environment.updateCamera(this._cameraControl.getCamera())}_setupScene(t,e){const{x:i,y:s}=this._domHelper.getClientDimensions();this._scene=new THREE.Scene,(e=e||!1)||(this._scene.background=new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)),THREE.Math={DEG2RAD:THREE.MathUtils.DEG2RAD};const n={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter},a=THREE.sRGBEncoding,r=Math.floor(i*window.devicePixelRatio),o=Math.floor(s*window.devicePixelRatio);this._renderTarget=new THREE.WebGLRenderTarget(r,o,n),this._renderTarget.texture.encoding=a,this._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(i,s),this._renderer.outputEncoding=THREE.sRGBEncoding,this._renderer.gammaFactor=2.2,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=THREE.PCFSoftShadowMap,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._environmentLoader.setRendererAndScene(this._renderer,this._scene),this._environmentLoader.registerEnvironmentChangedCallback(()=>this._requestRender(!0)),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),this.sceneChanged()}_tabVisible(t){this.updateCamera(),this._requestRender(!0)}setupScene(t,e){this._setupScene(t,e)}updateCamera(){const{x:t,y:e}=this._domHelper.getClientDimensions();this._renderer.setSize(t,e);const i=this._renderer.getPixelRatio();if(this._renderTarget){const s=Math.floor(t*i),n=Math.floor(e*i);this._renderTarget.setSize(s,n)}if(this._pixotron){this._pixotron.autoShadowsClear=!0,this._pixotron.autoSAOClear=!0,this._forceRender=!0;try{this._pixotron.setSize(t,e)}catch(t){console.warn(t)}}this._cameraControl.updateCamera(),this._requestRender(!0)}_onWindowResize(){const t=this._getInputManager();t&&t.updateSize(),this.updateCamera(),this._requestRender(!0)}_isPartOfScene(t){return"Object3D"===t.type||"Mesh"===t.type||"GLB"===t.type||"GLTF"===t.type||"Group"===t.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this._cameraControl&&this._cameraControl.cleanUp()}clearScene(){let t=[];this._scene.children.forEach(e=>{this._isPartOfScene(e)&&t.push(e)}),t.forEach(t=>{dispose(t),this._scene.remove(t)}),this._renderer.renderLists.dispose()}enableHD(){this._pixotron=new window.PIXOTRON.Pixotron(this.getPixotronParams()),this._pixotronUtil=new PixotronUtil(this._pixotron),this._environment instanceof BakedShadowEnvironment&&(this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera(),this.getBakedShadowParams()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._requestRender(!0),500))),this._requestRender()}_loadGLTF(t,e,i,s,n,a,r){return new Promise((o,h)=>{this._staticItemLoader.loadGLTF(t,e,i,s,n,a,null,r).then(t=>{this._setCamera("GLTF",t),o(t)},h)})}_loadGLB(t,e,i,s,n,a,r,o){return new Promise((h,_)=>{this._staticItemLoader.loadGLB(t,e,i,s,n,a,r,o).then(t=>{this._setCamera("GLB",t),h(t)},_)})}_setCamera(t,e){if(!e)return void console.warn("could not set camera for gltf",e);const i=new THREE.Box3;i.setFromObject(e),"GLB"===t?this._cameraControl instanceof CameraControl3D&&this._cameraControl.updateToBounds(i,!1):"GLTF"===t&&(this._cameraControl instanceof CameraControl3D&&this._cameraControl.updateAndReset(i.getSize(new THREE.Vector3),i.getCenter(new THREE.Vector3),-15,70,5,!1),this._cameraControl instanceof CameraControl2D&&this._cameraControl.updateToBounds(i.getSize(new THREE.Vector3),i.getCenter(new THREE.Vector3))),this.updateCamera()}showGUI(){if(this._initData.disableDebugGUI)return;const t=document.createElement("style");t.innerText=".dg.main{position:absolute;z-index:100;top:0;left:0;}",document.head.appendChild(t),this._scriptLoader.fetch(DAT_GUI_FILE_NAME,{id:"dat-gui-js"}).then(()=>{let t=getGUI(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())},t=>console.error(t))}_guiLoaded(){let t=getGUI();t&&(this._lightSetting&&this._lightSetting.showGUI(),this._pixotron&&this._pixotronUtil.showGUI(),this._environment&&this._environment.showGUI(),this._addGUIListener(t))}_addGUIListener(t){let e=t.__folders;Object.keys(e).forEach(t=>{let i=e[t];i.__folders&&Object.keys(i.__folders).forEach(t=>{let i=e[t];this._addGUIListener(i)}),i.__controllers&&i.__controllers.forEach(t=>{t.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._requestRender()}showStats(){import("./stats-helper-670aea9b.js").then(t=>this._statsHelper=new t.default)}_onKeyDown(t){}_onKeyUp(t){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1)}resume(){this.updateCamera(),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),this._requestRender(!0)}destroy(){this.pause(),this.cleanUp()}handleEvent(t){switch(t.type){case"resize":this._onWindowResize();break;case"keydown":this._onKeyDown(t);break;case"keyup":this._onKeyUp(t)}}loadSceneSettings(t){let e,i;return e=t.environment?new Promise(e=>{(new DynamicEnvironmentSettingLoader).load(this._scene,this._renderer.domElement,this._environment,t).then(t=>{this._setEnvironment(t),e()})}):Promise.resolve(),t.lights?(this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(t)):i=Promise.resolve(),new Promise((t,s)=>{Promise.all([e,i]).then(()=>{this._requestRender(!0),t()},s)})}_setEnvironment(t){this._environment=t,this._pixotron&&this._environment instanceof BakedShadowEnvironment&&(this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera(),this.getBakedShadowParams()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._requestRender(!0),500)))}loadQualitySetting(t){this._pixotron&&(new DynamicQualitySettingLoader).set(this._pixotron,t)}async loadDynamicLightSetting(t){this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting);let e=!1;if(t.url)await this._lightSetting.loadFromURL(t.url),e=!0;else if(t.json)await this._lightSetting.loadFromJSON(t.json),e=!0;else if(t.object)await this._lightSetting.loadFromObject(t.object),e=!0;else if(t.ls){const i=DynamicLightSettingLoader.createDynamicLightSettingSource(null,t.ls);await this._lightSetting.loadFromURL(i.url),e=!0}if(!e)throw new Error("No dynamic light setting source set");this._requestRender(!0)}getScene(){return this._scene}updateScene(){this._updateBounds(this.getBounds()),this._requestRender(!0)}_updateBounds(t){if(t){if(this.updateEnvironment(t),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(t),this._pixotronUtil){const e=new THREE.Sphere;t.getBoundingSphere(e),this._pixotronUtil.updateBounds(e)}this._requestRender(!0)}}setCameraOffset(t){const e=this._cameraControl.getCamera();e.offset?(e.offset=t,this._requestRender(!0)):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){const t=this._cameraControl.getCamera();return t.offset?JSON.parse(JSON.stringify(t.offset)):{left:0,top:0,right:1,bottom:1}}getPerspectiveOffsetCamera(){const t=this._domHelper.getClientDimensions(),e=t.x,i=t.y;return RoomleComponentFactoryInitializer().createCamera(30,e/i,.1,20)}updateEnvironment(t,e=!1){if(t&&this._environment&&this._environment.needsBounds()){const i=t.getSize(new THREE.Vector3);i.x+i.y+i.z!==0&&this._environment.updateBounds(t.getSize(new THREE.Vector3),e)}}}return __decorate([inject],t.prototype,"_domHelper",void 0),__decorate([inject],t.prototype,"_scriptLoader",void 0),__decorate([inject],t.prototype,"_lifeCycleManager",void 0),__decorate([inject],t.prototype,"_staticItemLoader",void 0),__decorate([inject],t.prototype,"_environmentLoader",void 0),__decorate([inject],t.prototype,"_initData",void 0),t})();export{CameraControl2D as C,SceneManager as S,CameraControlFirstPerson as a};
|
|
2
|
-
//# sourceMappingURL=scene-manager-1c0fa594.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scene-manager-1c0fa594.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
System.register(["./rapi-access-d3bc3ce4.nomodule.js","./pixotron-7a1f9ec8.nomodule.js"],(function(t,e){var i,s,n,r,o,a,h,_,d,c,m,p,l,u,g,E,w,C,y,v;return{setters:[function(t){i=t.t,s=t.u,n=t.a8,r=t.a9,o=t.v,a=t._,h=t.i,_=t.e,d=t.h,c=t.f,m=t.R,p=t.aa},function(t){l=t.d,u=t.i,g=t.D,E=t.C,w=t.b,C=t.B,y=t.f,v=t.c}],execute:function(){class R extends l{constructor(t,e,i){super(t,e,i),this._scale=1,this._state=0,this._size=20,this._center=new THREE.Vector3,this._raycaster=new THREE.Raycaster,this._lastPosition=new THREE.Vector2,this._zoomPosition=new THREE.Vector3,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),this._cameraZoom=1,this._initCamera(i||new THREE.Vector3(0,10,0));let s=new THREE.PlaneGeometry(1e3,1e3);s.rotateX(-Math.PI/2),this._plane=new THREE.Mesh(s,new THREE.MeshStandardMaterial)}_getCamera(){return this._camera||this._initCamera(new THREE.Vector3(0,10,0)),this._camera}_initCamera(t){let{x:e,y:i}=this._domHelper.getClientDimensions(),s=e/i*this._size,n=this._size;this._camera=new THREE.OrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3),this._camera.position.copy(t),this._cameraPosition=t,this._camera.lookAt(new THREE.Vector3(0,0,0))}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions(),i=t/e*this._size,s=this._size;this._camera.left=i/-2,this._camera.right=i/2,this._camera.top=s/2,this._camera.bottom=s/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:t=>{this._locked||(this._state=1,this._lastPosition.set(t.position.x,t.position.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._move(new THREE.Vector2(t.position.x,t.position.y),t.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this._scale/=this._zoomSpeed,this._zoomTo(t.position,1),this._update()}}),this._inputListeners.push({key:8,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this._scale*=this._zoomSpeed,this._zoomTo(t.position,-1),this._update()}})}_zoomTo(t,e){if(Date.now()-this._lastZoom>200){if(e>0||this._cameraZoom>=1){const e=this.getInputPosition(t);this._raycaster.setFromCamera(e,this._camera);const i=this._raycaster.intersectObject(this._plane);if(i.length<=0)return;const s=i.pop().point;this._zoomPosition.copy(s)}else this._zoomPosition.copy(this._center);this._cameraPosition.x=this._zoomPosition.x,this._cameraPosition.z=this._zoomPosition.z}this._lastZoom=Date.now()}_move(t,e){let i=new THREE.Vector2;i.subVectors(this._lastPosition,t),i.divideScalar(100),this._cameraPosition.x+=i.x*(2===e?1.1:1),this._cameraPosition.z+=i.y*(2===e?1.1:1),this._lastPosition.copy(t)}updateToBounds(t,e){let{x:i,y:s}=this._domHelper.getClientDimensions(),n=i/s;this._size=Math.max(t.x,t.z);let r=this._size,o=this._size;n>1?r=this._size*n:o=this._size*(s/i),this._center.copy(e),this._camera.left=r/-2,this._camera.right=r/2,this._camera.top=o/2,this._camera.bottom=o/-2,this._camera.zoom=1,this._camera.position.set(this._center.x,10,this._center.z),this._cameraPosition.copy(this._camera.position)}_update(t){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.8),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(t){return!(!super.animateCamera(t)&&Math.abs(this._cameraZoom-this._camera.zoom)<=.01||(this._camera.zoom=THREE.MathUtils.lerp(this._camera.zoom,this._cameraZoom,10*t),0))}}t("C",R);const f=Math.PI/4;class L extends l{constructor(t,e,s,n){super(t,e,s),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=i(-60),this.maxPolarAngle=i(60),this._camera=n||new THREE.PerspectiveCamera,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(5),this._camera.layers.enable(4),s?this._camera.position.set(s.x,1.5,s.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new THREE.Vector3,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new THREE.Quaternion,this._pitch=0,this._yaw=0;let r=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(r),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(t){this.startButtonPressListener()}_gamepadDisconnected(t){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let t=navigator.getGamepads()[0];this._checkRightStick(t),this._checkLeftStick(t),this._checkButtons(t),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(t){let e=t.axes[2],i=t.axes[3];Math.abs(e)>.2&&(this._rotateHorizontal(.01*f*e),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*f*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(t){let e=t.axes[0],i=t.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):t.buttons&&t.buttons[12]&&t.buttons[12].pressed?this._keyMap.set(87,!0):t.buttons&&t.buttons[13]&&t.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(e)>.2?e<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(t){t.buttons&&t.buttons[6]&&t.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),t.buttons&&t.buttons[14]&&t.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),t.buttons&&t.buttons[15]&&t.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(t){let e=this._cameraPosition,i=this._cameraRotation,r=this.getCamera(),o=s(e,r.position),a=n(i,r.quaternion);if(!e||o&&a)return!1;let h=this.getCamera().position.clone(),_=Math.min(10*t,1);h.lerp(e,_),this.getCamera().position.copy(h);let d=this.getCamera().quaternion.clone(),c=Math.min(5*t,1);d.slerp(i,c),this.getCamera().setRotationFromQuaternion(d);let m=!1;return this._keyMap.forEach(t=>{t&&(m=!0)}),m&&this._processKeyMap(this._keyMap,t),!0}_getCamera(){return this._camera}_initInputListener(){window.addEventListener("keyup",this._onKeyChanged.bind(this),!1),window.addEventListener("keydown",this._onKeyChanged.bind(this),!1),this._inputListeners.push({key:3,fun:t=>{this._down(t)}}),this._inputListeners.push({key:6,fun:t=>{this._move(t)}}),this._inputListeners.push({key:4,fun:t=>{this._up(t)}})}_down(t){this._downPosition=t.position,this._position=t.position,this._state=1,2===t.type&&window.setTimeout(this._onLongDown.bind(this),350),2===t.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(t){this._position=t.position,1!==this._state||this._locked||this._orbit(new THREE.Vector2(t.position.x,t.position.y)),2!==this._state||this._locked||(this._orbit(new THREE.Vector2(t.position.x,t.position.y)),this._moveForward())}_up(t){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){r(this._downPosition,this._position)<u&&1===this._state&&(this._state=2,this._orbit(new THREE.Vector2(this._position.x,this._position.y)),this._moveForward())}_update(t){let e=new THREE.Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(e)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}_onKeyChanged(t){this._keyMap.set(t.keyCode,"keydown"===t.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&t.preventDefault()}_processKeyMap(t,e){e=Math.min(e,.1);let i=new THREE.Vector3(0,0,0),s=!1;return this._processUpDown(t,i,e),t.get(65)&&(i.x=-1*e),t.get(68)&&(i.x=1*e),t.get(37)&&(this._rotateHorizontal(-f*this._rotationSpeed*e),s=!0),t.get(39)&&(this._rotateHorizontal(f*this._rotationSpeed*e),s=!0),t.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new THREE.Vector3(i.x,0,i.z)),this._update(),0))}_processUpDown(t,e,i){(t.get(87)||t.get(38))&&(e.z=-1*i),(t.get(83)||t.get(40))&&(e.z=1*i)}_orbit(t){this._orbitPosition||(this._orbitPosition=new THREE.Vector2(t.x,t.y),this.dispatchEvent(0));let e=t.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;e.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*e.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*e.y/i.clientHeight*1),o(this._orbitPosition,t)||this.dispatchEvent(1),this._orbitPosition.copy(t),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(t){let e=this._pitch+t;e>this.maxPolarAngle||e<this.minPolarAngle||(this._pitch=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}}t("a",L),t("S",(()=>{class t{constructor(t,e,i,s,n){this._maxAnisotropy=1,this._clock=new THREE.Clock,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._onAfterRender=()=>{},this._creator_=t,this._canvasID=i,this.createCameraControl(s),this._addCameraControlListener(),this._setupScene(e,n),document.addEventListener("visibilitychange",this._tabVisible.bind(this)),this._renderListener=()=>{this._requestRender(!0)},this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this),this._lifeCycleManager.addEventListener(this)}onBeforeRender(){}_changeCameraControl(t){this._cameraControl&&this._cameraControl.cleanUp(),t instanceof L&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraControl instanceof L&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this._cameraControl=t,this.cameraControlChanged()}cameraControlChanged(){}_addCameraControlListener(){this._cameraControl.addEventListener(0,this._requestRender,this),this._cameraControl.addEventListener(1,this._requestRender,this),this._cameraControl.addEventListener(2,this._requestRender,this),this._cameraControl.addEventListener(6,this._requestRender,this)}_requestRender(t){if(!this._renderer)return;this._pixotron&&(this._pixotron.needsUpdate=!0,t&&(this._forceRender=!0));const e=()=>{this._delta=this._clock.getDelta(),this._animateCamera(),this._cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._statsHelper&&this._statsHelper.updateRenderInfo(this._renderer.info),this._pixotron?(this._forceRender&&(this._pixotron.autoShadowsClear=!0,this._pixotron.autoSAOClear=!0),this._pixotron.render(this._renderer,this._scene,this._cameraControl.getCamera(),this._renderTarget),this._forceRender=!1,this._pixotron.blit()):(this._renderer.clear(),this._renderer.render(this._scene,this._cameraControl.getCamera()),this._renderer.clearDepth()),this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(e))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(e))}_animateCamera(){this._cameraControl&&(this._cameraControl.animateCamera(this._delta)||!this._pixotron||this._forceRender?(this._lightSetting instanceof g&&this._cameraControl.getCamera()instanceof THREE.PerspectiveCamera&&this._lightSetting.update(this._cameraControl.getCamera(),this._cameraControl.getTargetPosition()),this._pixotron&&(this._pixotron.needsUpdate=!0)):(this._pixotron.autoShadowsClear=!1,this._pixotron.autoSAOClear=!1)),this._environment&&this._environment.needsCamera()&&this._cameraControl instanceof E&&this._environment.updateCamera(this._cameraControl.getCamera())}_setupScene(t,e){const{x:i,y:s}=this._domHelper.getClientDimensions();this._scene=new THREE.Scene,(e=e||!1)||(this._scene.background=new THREE.Color(this._initData.colors.DEFAULT_BACKGROUND)),THREE.Math={DEG2RAD:THREE.MathUtils.DEG2RAD};const n={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter},r=THREE.sRGBEncoding,o=Math.floor(i*window.devicePixelRatio),a=Math.floor(s*window.devicePixelRatio);this._renderTarget=new THREE.WebGLRenderTarget(o,a,n),this._renderTarget.texture.encoding=r,this._renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(i,s),this._renderer.outputEncoding=THREE.sRGBEncoding,this._renderer.gammaFactor=2.2,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=THREE.PCFSoftShadowMap,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._environmentLoader.setRendererAndScene(this._renderer,this._scene),this._environmentLoader.registerEnvironmentChangedCallback(()=>this._requestRender(!0)),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),this.sceneChanged()}_tabVisible(t){this.updateCamera(),this._requestRender(!0)}setupScene(t,e){this._setupScene(t,e)}updateCamera(){const{x:t,y:e}=this._domHelper.getClientDimensions();this._renderer.setSize(t,e);const i=this._renderer.getPixelRatio();if(this._renderTarget){const s=Math.floor(t*i),n=Math.floor(e*i);this._renderTarget.setSize(s,n)}if(this._pixotron){this._pixotron.autoShadowsClear=!0,this._pixotron.autoSAOClear=!0,this._forceRender=!0;try{this._pixotron.setSize(t,e)}catch(t){console.warn(t)}}this._cameraControl.updateCamera(),this._requestRender(!0)}_onWindowResize(){const t=this._getInputManager();t&&t.updateSize(),this.updateCamera(),this._requestRender(!0)}_isPartOfScene(t){return"Object3D"===t.type||"Mesh"===t.type||"GLB"===t.type||"GLTF"===t.type||"Group"===t.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this._cameraControl&&this._cameraControl.cleanUp()}clearScene(){let t=[];this._scene.children.forEach(e=>{this._isPartOfScene(e)&&t.push(e)}),t.forEach(t=>{_(t),this._scene.remove(t)}),this._renderer.renderLists.dispose()}enableHD(){this._pixotron=new window.PIXOTRON.Pixotron(this.getPixotronParams()),this._pixotronUtil=new w(this._pixotron),this._environment instanceof C&&(this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera(),this.getBakedShadowParams()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._requestRender(!0),500))),this._requestRender()}_loadGLTF(t,e,i,s,n,r,o){return new Promise((a,h)=>{this._staticItemLoader.loadGLTF(t,e,i,s,n,r,null,o).then(t=>{this._setCamera("GLTF",t),a(t)},h)})}_loadGLB(t,e,i,s,n,r,o,a){return new Promise((h,_)=>{this._staticItemLoader.loadGLB(t,e,i,s,n,r,o,a).then(t=>{this._setCamera("GLB",t),h(t)},_)})}_setCamera(t,e){if(!e)return void console.warn("could not set camera for gltf",e);const i=new THREE.Box3;i.setFromObject(e),"GLB"===t?this._cameraControl instanceof E&&this._cameraControl.updateToBounds(i,!1):"GLTF"===t&&(this._cameraControl instanceof E&&this._cameraControl.updateAndReset(i.getSize(new THREE.Vector3),i.getCenter(new THREE.Vector3),-15,70,5,!1),this._cameraControl instanceof R&&this._cameraControl.updateToBounds(i.getSize(new THREE.Vector3),i.getCenter(new THREE.Vector3))),this.updateCamera()}showGUI(){if(this._initData.disableDebugGUI)return;const t=document.createElement("style");t.innerText=".dg.main{position:absolute;z-index:100;top:0;left:0;}",document.head.appendChild(t),this._scriptLoader.fetch(y,{id:"dat-gui-js"}).then(()=>{let t=d(!1);t&&(this._domHelper.element.appendChild(t.domElement),this._guiLoaded())},t=>console.error(t))}_guiLoaded(){let t=d();t&&(this._lightSetting&&this._lightSetting.showGUI(),this._pixotron&&this._pixotronUtil.showGUI(),this._environment&&this._environment.showGUI(),this._addGUIListener(t))}_addGUIListener(t){let e=t.__folders;Object.keys(e).forEach(t=>{let i=e[t];i.__folders&&Object.keys(i.__folders).forEach(t=>{let i=e[t];this._addGUIListener(i)}),i.__controllers&&i.__controllers.forEach(t=>{t.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._requestRender()}showStats(){e.import("./stats-helper-b294fd7a.nomodule.js").then(t=>this._statsHelper=new t.default)}_onKeyDown(t){}_onKeyUp(t){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1)}resume(){this.updateCamera(),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),this._requestRender(!0)}destroy(){this.pause(),this.cleanUp()}handleEvent(t){switch(t.type){case"resize":this._onWindowResize();break;case"keydown":this._onKeyDown(t);break;case"keyup":this._onKeyUp(t)}}loadSceneSettings(t){let e,i;return e=t.environment?new Promise(e=>{(new v).load(this._scene,this._renderer.domElement,this._environment,t).then(t=>{this._setEnvironment(t),e()})}):Promise.resolve(),t.lights?(this._lightSetting=new g(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(t)):i=Promise.resolve(),new Promise((t,s)=>{Promise.all([e,i]).then(()=>{this._requestRender(!0),t()},s)})}_setEnvironment(t){this._environment=t,this._pixotron&&this._environment instanceof C&&(this._environment.setPixotron(this._pixotron,this._renderer,this._cameraControl.getCamera(),this.getBakedShadowParams()),this._environment.setLoadedCallback(()=>setTimeout(()=>this._requestRender(!0),500)))}loadQualitySetting(t){this._pixotron&&(new p).set(this._pixotron,t)}async loadDynamicLightSetting(t){this._lightSetting=new g(this._scene,this._lightSetting);let e=!1;if(t.url)await this._lightSetting.loadFromURL(t.url),e=!0;else if(t.json)await this._lightSetting.loadFromJSON(t.json),e=!0;else if(t.object)await this._lightSetting.loadFromObject(t.object),e=!0;else if(t.ls){const i=c.createDynamicLightSettingSource(null,t.ls);await this._lightSetting.loadFromURL(i.url),e=!0}if(!e)throw new Error("No dynamic light setting source set");this._requestRender(!0)}getScene(){return this._scene}updateScene(){this._updateBounds(this.getBounds()),this._requestRender(!0)}_updateBounds(t){if(t){if(this.updateEnvironment(t),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(t),this._pixotronUtil){const e=new THREE.Sphere;t.getBoundingSphere(e),this._pixotronUtil.updateBounds(e)}this._requestRender(!0)}}setCameraOffset(t){const e=this._cameraControl.getCamera();e.offset?(e.offset=t,this._requestRender(!0)):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){const t=this._cameraControl.getCamera();return t.offset?JSON.parse(JSON.stringify(t.offset)):{left:0,top:0,right:1,bottom:1}}getPerspectiveOffsetCamera(){const t=this._domHelper.getClientDimensions(),e=t.x,i=t.y;return m().createCamera(30,e/i,.1,20)}updateEnvironment(t,e=!1){if(t&&this._environment&&this._environment.needsBounds()){const i=t.getSize(new THREE.Vector3);i.x+i.y+i.z!==0&&this._environment.updateBounds(t.getSize(new THREE.Vector3),e)}}}return a([h],t.prototype,"_domHelper",void 0),a([h],t.prototype,"_scriptLoader",void 0),a([h],t.prototype,"_lifeCycleManager",void 0),a([h],t.prototype,"_staticItemLoader",void 0),a([h],t.prototype,"_environmentLoader",void 0),a([h],t.prototype,"_initData",void 0),t})())}}}));
|
|
2
|
-
//# sourceMappingURL=scene-manager-e7cf547f.nomodule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scene-manager-e7cf547f.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e){var t={};function i(s){if(t[s])return t[s].exports;var a=t[s]={i:s,l:!1,exports:{}};return e[s].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:s})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=5)}([function(e,t,i){function s(e){const t=Math.floor(Math.random()*e.length),i=e[t];return e.splice(t,1),i}function a(e,t,i){this.width=e,this.height=t,this.cellSize=i,this.array=new Array(e);for(let i=0;i<e;i++)this.array[i]=new Array(t)}function r(e,t){const i=t*(Math.random()+1),s=6.283185307178*Math.random(),a=e.x+i*Math.cos(s),r=e.y+i*Math.sin(s);return new THREE.Vector2(a,r)}i(3),a.prototype={constructor:a,t:function(e){const t=Math.floor(e.x/this.cellSize),i=Math.floor(e.y/this.cellSize);this.array[t][i]=e},h:function(e,t){const i=Math.floor(e.x/this.cellSize),s=Math.floor(e.y/this.cellSize);for(let a=i-5;a<i+5;a++)for(let i=s-5;i<s+5;i++)if(a>=0&&a<this.width&&i>=0&&i<this.height){const s=this.array[a][i];let r=1e10;if(void 0!==s&&(r=s.distanceTo(e)),r<t)return!0}return!1}},e.exports=(PIXOTRON.lerpDistribution=function(e,t,i){return(t=t||.47)*(1-e)+(i=i||7)*e},PIXOTRON.uniformDistribution=function(){return 1},PIXOTRON.cosineDistribution=function(e){const t=e*Math.PI/2,i=Math.cos(t);return.47*(1-i)+7*i},PIXOTRON.generateQuasiRandomPoints=function(e,t,i,o){i=i||PIXOTRON.uniformDistribution,o=o||PIXOTRON.insideCircle,t<0&&(t=Math.sqrt(e)/e);const n=[],l=[],h=t/Math.sqrt(2),u=new a(Math.ceil(1/h),Math.ceil(1/h),h),c=new THREE.Vector2(.5,.5);let d=!1;do{c.x=Math.random(),c.y=Math.random(),d=o(c.x,c.y)}while(!d);for(l.push(c),n.push(c),u.t(c);0!==l.length&&n.length<e;){const e=s(l);for(let s=0;s<30;s++){const s=e.x-.5,a=e.y-.5,h=i(Math.sqrt(s*s+a*a)),c=r(e,h*t);!o(c.x,c.y)||u.h(c,h*t)||(l.push(c),n.push(c),u.t(c))}}return n})},function(e,t,i){i(11),e.exports=PIXOTRON.QualityAdapter=class{constructor(e){this.u=e,this.currentQualitySetting=null,this.previousQualitySetting=null,this.v=!1,this.R=!1,this.T=!1}enable(){}disable(){}getCurrentQualitySetting(){return this.currentQualitySetting}update(){}onQualityChange(e){this.qualityChangedCallBack!==e&&(this.qualityChangedCallBack=e)}O(e){this.N(e,this.currentQualitySetting)?this.T:(this.previousQualitySetting=this.currentQualitySetting,this.currentQualitySetting=e,this.previousQualitySetting&&this.previousQualitySetting.exit(),this.currentQualitySetting.enter(),this.currentQualitySetting.change(this.u),this.qualityChangedCallBack&&this.qualityChangedCallBack(this.currentQualitySetting,this.previousQualitySetting))}N(e,t){return!(!e||!t)&&e.getQuality()===t.getQuality()}}},function(e,t){e.exports=PIXOTRON.SmoothTransitionAOShader={uniforms:{saoAccumulationBuffer:{value:null},transition:{value:0}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:["varying vec2 vUv;","uniform float transition;","uniform sampler2D saoAccumulationBuffer;","void main() {","float aoValue = texture2D( saoAccumulationBuffer, vUv).r;","gl_FragColor = vec4(mix(0., aoValue, transition));","}"].join("\n")},e.exports=PIXOTRON.SmoothTransitionShadowShader={uniforms:{shadowAccumulationBuffer:{value:null},firstFrameShadowBuffer:{value:null},transition:{value:0}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:["#include <packing>","varying vec2 vUv;","uniform float transition;","uniform sampler2D shadowAccumulationBuffer;","uniform sampler2D firstFrameShadowBuffer;","void main() {","float shadowValueFirstFrame = unpackRGBAToDepth(texture2D( firstFrameShadowBuffer, vUv));","float shadowValue = unpackRGBAToDepth(texture2D( shadowAccumulationBuffer, vUv));","gl_FragColor = vec4(mix(shadowValueFirstFrame, shadowValue, pow(transition, 4.)));","}"].join("\n")},e.exports=PIXOTRON.SmoothTransitionSoftShadowShadowShader={defines:{SHADOW_MATERIAL:1},uniforms:{shadowAccumulationBuffer:{value:null},transition:{value:0},shadowData:{value:new THREE.Vector3(1,2,1)}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:["#include <packing>","varying vec2 vUv;","uniform float transition;","uniform vec3 shadowData;","uniform sampler2D shadowAccumulationBuffer;","void main() {","#if SHADOW_MATERIAL == 1","float shadowValue = unpackRGBAToDepth(texture2D( shadowAccumulationBuffer, vUv));","float mask = (1. - shadowValue) * shadowData.x;","mask = pow(mask, shadowData.y);","gl_FragColor = vec4(mix(vec4(0.), vec4(vec3(0.), mask), pow(transition, 4.)));","#else","float shadowValue = unpackRGBAToDepth(texture2D( shadowAccumulationBuffer, vUv));","float mask = (1. - shadowValue);","mask = pow(shadowValue, shadowData.y);","gl_FragColor = vec4(mask + shadowData.x);","#endif","}"].join("\n")}},function(e,t){function i(e){return 0==(e&e-1)&&0!==e}THREE.ShaderChunk.utilshader=["vec2 pack16(float value){","float sMax = 65535.0;","int v = int(clamp(value, 0.0, 1.0)*sMax+0.5);","int digit0 = v/256;","int digit1 = v-digit0*256;","return vec2(float(digit0)/255.0, float(digit1)/255.0);","}","vec2 packNormal(vec3 n){","float p = sqrt(n.z*8.0+8.0);","return vec2(n.xy/p + 0.5);","}","vec3 unpackNormal(vec2 enc){","vec2 fenc = enc*4.0-2.0;","float f = dot(fenc,fenc);","float g = sqrt(1.0-f/4.0);","return vec3(fenc*g, 1.0-f/2.0);","}","float unpack16(vec2 value){","return (","value.x*0.996108949416342426275150501169264316558837890625 +","value.y*0.00389105058365758760263730664519243873655796051025390625",");","}","vec3 getViewNormal(const in vec2 uv ) {","#if DEPTH_NORMAL_TEXTURE == 1","return unpackNormal( texture2D( tNormalDepth, uv ).zw );","#else","return unpackRGBToNormal( texture2D( tNormal, uv ).xyz );","#endif","}","float linstep(float edge0, float edge1, float value){","return clamp((value-edge0)/(edge1-edge0), 0.0, 1.0);","}","vec3 packFloatToRGB(const in float x) {","const vec3 code = vec3(1.0, 255.0, 65025.0);","vec3 pack = vec3(code * x);","pack.gb = fract(pack.gb);","pack.rg -= pack.gb * (1.0 / 256.0);","return pack;","}","float decodeDepth( const in vec2 uv ) {","vec4 uncodedDepth;","#if DEPTH_PACKING_MODE == 2","uncodedDepth = texture2D( tNormalDepth, uv );","#else","uncodedDepth = texture2D( tDepth, uv );","#endif","#if DEPTH_PACKING_MODE == 0","return uncodedDepth.x;","#elif DEPTH_PACKING_MODE == 1","#if LINEAR_DEPTH == 1","return pow2(unpackRGBAToDepth(uncodedDepth));","#else","return unpackRGBAToDepth( uncodedDepth );","#endif","#else","return pow2(unpack16(uncodedDepth.xy));","#endif","}"].join("\n"),function(){const e=THREE.CopyShader;PIXOTRON.D=THREE.UniformsUtils.clone(e.uniforms),PIXOTRON.P=new THREE.ShaderMaterial({uniforms:PIXOTRON.D,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,depthWrite:!1,depthTest:!1}),PIXOTRON.S=new THREE.ShaderMaterial({uniforms:PIXOTRON.D,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:THREE.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),PIXOTRON.M=new THREE.Scene,PIXOTRON.H=new THREE.OrthographicCamera(-1,1,1,-1,0,1),PIXOTRON.quad=new THREE.Mesh(new THREE.PlaneGeometry(2,2),PIXOTRON.P),PIXOTRON.quad.frustumCulled=!1,PIXOTRON.M.add(PIXOTRON.quad)}(),e.exports=PIXOTRON.randomizeArray=function(e){let t,i,s=e.length;for(;0!==s;)i=Math.floor(Math.random()*s),t=e[s-=1],e[s]=e[i],e[i]=t;return e},e.exports=PIXOTRON.createTextureFromRawData=function(e,t){(t=t||{}).type=t.type||THREE.FloatType,t.format=t.format||THREE.LuminanceAlphaFormat,t.minFilter=t.minFilter||THREE.NearestFilter,t.magFilter=t.magFilter||THREE.NearestFilter;const i=new Float32Array(2*e.length);for(let t=0;t<2*e.length;t+=2)i[t]=e[t/2].x-.5,i[t+1]=e[t/2].y-.5;const s=new THREE.DataTexture(i,e.length,1);return s.format=t.format,s.type=t.type,s.minFilter=t.minFilter,s.magFilter=t.magFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s},e.exports=PIXOTRON.jitterCamera=function(e,t,i,s,a){a=void 0!==a?a:.5;const r=(2*t.x-1)*a,o=(2*t.y-1)*a;e.setViewOffset(i,s,r,o,i,s)},e.exports=PIXOTRON.insideCircle=function(e,t,i){const s=e-.5,a=t-.5;return s*s+a*a<=(i=void 0!==i?i:.5)*i},e.exports=PIXOTRON.insideRectangle=function(e,t,i,s){return i=void 0!==i?i:1,s=void 0!==s?s:1,e>=0&&t>=0&&e<=i&&t<=s},e.exports=PIXOTRON.blit=function(e,t,i,s){s=void 0!==s&&s,PIXOTRON.D.tDiffuse.value=t,PIXOTRON.quad.material=PIXOTRON.P,e.setRenderTarget(i),e.render(PIXOTRON.M,PIXOTRON.H),e.setRenderTarget(null)},e.exports=PIXOTRON.blitTransparent=function(e,t,i,s){s=void 0!==s&&s,PIXOTRON.D.tDiffuse.value=t,PIXOTRON.quad.material=PIXOTRON.S,e.setRenderTarget(i),e.render(PIXOTRON.M,PIXOTRON.H),e.setRenderTarget(null)},e.exports=PIXOTRON.renderPass=function(e,t,i,s){s=void 0!==s&&s,PIXOTRON.quad.material=t,e.setRenderTarget(i),e.render(PIXOTRON.M,PIXOTRON.H),e.setRenderTarget(null)},e.exports=PIXOTRON.calculateFOV=function(e,t,i){let s;e.isBox3?s=e:(s=new THREE.Box3).setFromObject(e);const a=new THREE.Vector3;s.getCenter(a);const r=new THREE.Vector3;s.getSize(r);const o=new THREE.Vector3;o.set(r.x/2,r.y/2,r.z/2),o.add(a),o.sub(t),o.normalize();let n=i.dot(o);return o.set(-r.x/2,r.y/2,r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),o.set(r.x/2,-r.y/2,r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),o.set(r.x/2,r.y/2,-r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),o.set(-r.x/2,-r.y/2,-r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),o.set(-r.x/2,r.y/2,-r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),o.set(r.x/2,-r.y/2,-r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),o.set(-r.x/2,-r.y/2,r.z/2),o.add(a),o.sub(t),o.normalize(),n=Math.min(i.dot(o),n),180*Math.acos(n)/Math.PI*2},e.exports=PIXOTRON.isPowerOfTwo=function(e){return i(e.width)&&i(e.height)},e.exports=PIXOTRON.makePowerOfTwo=function(e){function t(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageBitmap){const i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=t(e.width),i.height=t(e.height),i.getContext("2d").drawImage(e,0,0,i.width,i.height),i}return e},e.exports=PIXOTRON.getDataFromImage=function(e,t){const i=document.createElement("canvas"),s=t,a=t/(e.width/e.height);i.width=s,i.height=a;const r=i.getContext("2d");return r.drawImage(e,0,0,s,a),r.getImageData(0,0,s,a)},e.exports=PIXOTRON.getPixelFromImageData=function(e,t,i){const s=4*(t+e.width*i),a=e.data;return{r:a[s],g:a[s+1],b:a[s+2],a:a[s+3]}},e.exports=PIXOTRON.squareToUniformDiskConcentric=function(){const e=new THREE.Vector2;return function(t){const i=2*t.x-1,s=2*t.y-1;let a,r;0===i&&0===s?r=a=0:i*i>s*s?(r=i,a=Math.PI/4*(s/i)):(r=s,a=Math.PI/2-i/s*(Math.PI/4));const o=Math.sin(a),n=Math.cos(a);return e.x=r*n,e.y=r*o,e}}(),e.exports=PIXOTRON.squareToCosineHemisphere=function(){const e=new THREE.Vector3;return function(t){const i=PIXOTRON.squareToUniformDiskConcentric(t),s=Math.sqrt(1-i.x*i.x-i.y*i.y);return e.set(i.x,i.y,s),e}}(),e.exports=PIXOTRON.startPerformanceTest=function(e){return PIXOTRON.gpuProfiler&&PIXOTRON.gpuProfiler.start(e)},e.exports=PIXOTRON.endPerformanceTest=function(e,t){const i=PIXOTRON.gpuProfiler&&PIXOTRON.gpuProfiler.result(e);return i&&t.callback&&t.callback({time:i,name:t.name}),i}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),i(25),t.default=PIXOTRON.SuperSampleAAPass=class extends THREE.Pass{constructor(){super(),this.needsSwap=!0,this.needsUpdate=!0,this.C=0,this._=new THREE.ShaderMaterial(PIXOTRON.SuperSampleAAShader),this.oldClearColor=new THREE.Color}dispose(){this.pingpongRT&&this.pingpongRT.dispose(),this._.dispose()}render(e,t,i){e.getClearColor(this.oldClearColor);const s=e.getClearAlpha(),a=e.autoClear;e.autoClear=!1,e.setClearColor(new THREE.Color(0,0,0),0),this.needsUpdate&&(this.C=0,this.needsUpdate=!1),this.I||this.X(e),this.C++,this._.uniforms.tCurrent.value=i.texture,this._.uniforms.tSumPrevious.value=this.I.texture,this._.uniforms.accIndex.value=this.C,PIXOTRON.renderPass(e,this._,t),PIXOTRON.blit(e,t,this.I),e.autoClear=a,e.setClearColor(this.oldClearColor,s)}setSize(e,t){this.I&&this.I.setSize(e,t)}X(e){const t={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat},i=new THREE.Vector2;e.getDrawingBufferSize(i);const s=i.x,a=i.y;this.I=new THREE.WebGLRenderTarget(s,a,t)}}},function(e,t,i){e.exports=PIXOTRON={},i(6),i(3),i(7),i(9),i(10),i(1),i(12),i(13),i(0),i(14),i(16),i(18),i(20),i(22),i(4),i(26),i(28),i(30),i(32),i(33),i(35);const s=new THREE.Vector2;e.exports=PIXOTRON.Pixotron=class extends THREE.EventDispatcher{constructor(e){super(),(e=e||{}).saoparams=e.saoparams||{},e.shadowparams=e.shadowparams||{},e.gbufferparams=e.gbufferparams||{},e.outlineparams=e.outlineparams||{},this.needsUpdate=!0,this.autoSAOClear=!0,this.autoShadowsClear=!0,this.enableAA=!0,this.A=new PIXOTRON.BilateralFilterPass(3,1),this.F=new PIXOTRON.GBufferPass(e.gbufferparams);const t=void 0===e.saoparams.accumulative||e.saoparams.accumulative;this.U=t?new PIXOTRON.AccumulativeSAOPass(e.saoparams):new PIXOTRON.SAOPass(e.saoparams),this.V=new PIXOTRON.ShadowPass(e.shadowparams),this.L=new PIXOTRON.SuperSampleAAPass,this.B=PIXOTRON.generateQuasiRandomPoints(30,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle),this.k=new PIXOTRON.OutlinePass(e.outlineparams);const i={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter};this.W=new THREE.WebGLRenderTarget(1,1,i),this.j=new THREE.WebGLRenderTarget(1,1,i),this.C=0,this.Z=null,this.G=null,this.q=[],this.q.push(this.A),this.q.push(this.F),this.q.push(this.U),this.q.push(this.V),this.q.push(this.k),this.K=0,this.debug=!1,this.J=new PIXOTRON.Performance(this),this.Y=null;const s=e.giParams||{};this.enableGI=!!s.enable,this.enableGI&&this.initializeGI(s),this.$=new PIXOTRON.BVHManager}addNodeToAccelerationStructure(e,t){t?this.$.add(e):e.traverse(e=>{e.isMesh&&e.castShadow&&(e.updateMatrixWorld(),this.$.add(e))})}addRenderCompleteCallback(e){this.renderCompleteCallback=e,this.addEventListener("onRenderConverged",e)}removeRenderCompleteCallback(){this.removeEventListener("onRenderConverged",this.renderCompleteCallback),this.renderCompleteCallback=null}blit(e){if(this.tt){const t=e||null;PIXOTRON.blit(this.renderer,this.tt,t,!1)}this.blitHighlights()}dispose(){this.q.forEach(e=>{e.dispose()}),this.et.renderTarget1.dispose(),this.et.renderTarget2.dispose(),this.W.dispose(),this.j.dispose()}enableVPLGeneration(){this.it&&(this.it.st=!0)}getBloomPass(){return this.ot}getGBufferPass(){return this.F}getHighLightPass(){return this.k}getRenderPass(){return this.at}getSAOPass(){return this.U}getShadowPass(){return this.V}getTotalRenderTime(){return this.K}getVPLGenerationPass(){return this.it}highlightObjects(e){this.nt=e}initializeGI(e){this.it=new PIXOTRON.VPLGenerationPass(500),this.ht=new PIXOTRON.InstantRadiosityPass,this.q.push(this.it),this.q.push(this.ht)}insertPass(e,t){this.et.insertPass(e,t)}isAccumulationConverged(){const e=this.V.enableAccumulation,t=this.U.convergenceMetric()>=1,i=!e||this.V.convergenceMetric()>=1,s=!this.enableGI||this.ht.convergenceMetric()>=1;return i&&t&&s}isSuperSamplingConverged(){return this.C/this.B.length>=1}renderFrame(e,t,i,s){for(this.needsUpdate=!0;!this.isSuperSamplingConverged();)this.render(e,t,i,s)}render(e,t,i,s){if(this.needsUpdate&&(this.rt(),this.C=0,this.jitterIndex=0,this.needsUpdate=!1,this.autoSAOClear=!0,this.autoShadowsClear=!0),!this.Z||this.Z.uuid===i.uuid&&this.G.uuid===t.uuid||(this.Z=i,this.G=t,this.at.camera=this.Z,this.at.scene=this.G,this.lt.Z=this.Z,this.lt.ct.copy(this.Z.projectionMatrix)),this.bInitialized||this.X(e,t,i,s),this.ut(t),this.enableGI&&this.it.generateVPLs(t,this.areaLights[0],10,this.$),this.isSuperSamplingConverged()&&this.dt(),!this.isSuperSamplingConverged()){this.vt(e,t,i),this.ft();const s=this.isAccumulationConverged();this.L.enabled=s||0!==this.C,this.lt.enabled=this.enableAA&&(0===this.C||!s),this.pt(i),this.et.writeBuffer=this.et.renderTarget1,this.et.readBuffer=this.et.renderTarget2,this.K=0,this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),this.et.render(),this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"Composer Render"}),i.clearViewOffset(),this.jitterIndex++,this.L.enabled&&this.C++,this.J.update(),this.Y&&this.Y.update()}s&&this.Et(this.G,this.Z)}setQualityAdapter(e){if(this.Y&&this.Y.disable(),e&&this.Y){const t=this.Y.getCurrentQualitySetting(),i=e.getCurrentQualitySetting();t&&i&&t.getQuality()!==i.getQuality()&&e.setQualitySetting(t)}this.Y=e,this.Y.enable()}setSize(e,t){let i=e,s=t;this.renderer&&(i*=this.renderer.getPixelRatio(),s*=this.renderer.getPixelRatio(),i=Math.floor(i),s=Math.floor(s),this.renderer.screenBufferSize=new THREE.Vector2(i,s)),this.F.setSize(i,s),this.U.setSize(i,s),this.A.setSize(i,s),this.V.setSize(i,s),this.k&&this.k.setSize(i,s),this.et&&this.et.setSize(i,s),this.lt.needsUpdate(),this.needsUpdate=!0}setAntiAliasingFeedBackParams(e,t){this.lt&&(this.lt.feedBack.x=e,this.lt.feedBack.y=t)}pt(e){if(this.enableAA||this.isAccumulationConverged()){this.renderer.getDrawingBufferSize(s);const t=s.x,i=s.y,a=this.B[this.jitterIndex%this.B.length];PIXOTRON.jitterCamera(e,a,t,i)}if(this.isAccumulationConverged()){const e=this.B[this.jitterIndex%this.B.length];this.wt(e)}}ft(){this.U.enabled||(this.renderer.saoBuffer=this.j.texture);const e=this,t=!this.V.enabled,i=!function(){let t=!0;return e.areaLights.forEach(e=>{e.castShadow||(t=!1)}),t}(),s=0===this.areaLights.length;(t||i||s)&&this.V.lights.forEach(e=>{e.shadow.map=this.W})}blitHighlights(){if(!this.getHighLightPass()||!this.nt)return;if(!this.nt[0])return;const e=this.renderer.autoClear;this.renderer.autoClear=!1,PIXOTRON.blitTransparent(this.renderer,this.getHighLightPass().Rt,null),this.renderer.autoClear=e}Tt(){this.K+=this.F.getTotalRenderTime(),this.K+=this.U.getTotalRenderTime(),this.K+=this.V.getTotalRenderTime()}dt(){this.renderCompleteCallbackCalled||(this.dispatchEvent({type:"onRenderConverged",message:""}),this.renderCompleteCallbackCalled=!0)}ut(e){const t=this;this.punctualLights=[],this.areaLights=[],e.traverseVisible((function(e){(e instanceof THREE.DirectionalLight||e instanceof THREE.SpotLight)&&e.castShadow&&t.punctualLights.push(e),e instanceof THREE.RectAreaLight&&e.castShadow&&(e.shadow=e.shadow?e.shadow:{},e.C=e.C?e.C:0,t.areaLights.push(e))})),this.V.lights=this.areaLights}wt(e){this.punctualLights.forEach(t=>{PIXOTRON.jitterCamera(t.shadow.camera,e,t.shadow.mapSize.x,t.shadow.mapSize.y)})}X(e,t,i,s){this.renderer=e,this.Z=i,this.G=t,this.tt=s,this.at=new THREE.RenderPass(t,i),this.et=new THREE.EffectComposer(this.renderer,s);const a=new THREE.Vector2;e.getDrawingBufferSize(a),this.L.setSize(a.x,a.y),this.renderer.screenBufferSize=new THREE.Vector2(a.x,a.y),this.lt=new PIXOTRON.TemporalAAPass(i,this.F),this.et.addPass(this.at),this.ot=new PIXOTRON.UnrealBloomPass(this.F,new THREE.Vector2(a.width,a.height),.86,1,.98),this.et.addPass(this.ot),this.q.push(this.ot),this.et.addPass(this.L),this.et.addPass(this.lt),this.q.push(this.L),this.q.push(this.lt),this.ot.enabled=!1;const r=s?new THREE.ShaderPass(THREE.CopyShader):new THREE.ShaderPass(THREE.GammaCorrectionShader);r.needsSwap=!1,this.et.addPass(r),this.et.renderToScreen=!s,this.bInitialized=!0;const o=new THREE.MeshBasicMaterial({color:16777215}),n=new THREE.MeshBasicMaterial({color:0});PIXOTRON.renderPass(e,o,this.W),PIXOTRON.renderPass(e,n,this.j),this.xt=e.getContext(),this.Ot=this.xt&&this.xt.getExtension("EXT_disjoint_timer_query"),PIXOTRON.gpuProfiler=this.Ot&&new PIXOTRON.GPUProfiler(this.xt),this.punctualLights=[],this.areaLights=[],this.jitterIndex=0}vt(e,t,i){e.getDrawingBufferSize(s);const a=s.x,r=s.y,o=this.B[this.jitterIndex%this.B.length];PIXOTRON.jitterCamera(i,o,a,r),this.F.render(e,t,i),this.U.render(e,i,this.F,this.A),this.V.render(e,t,i),this.enableGI&&this.ht.render(e,t,i,this.it,this.areaLights[0]),i.clearViewOffset(),!this.et.renderTarget1.depthTexture&&this.F.Nt&&(this.et.renderTarget1.depthTexture=this.F.Nt,this.et.renderTarget2.depthTexture=this.F.Nt)}Et(e,t){if(this.k&&this.nt&&this.nt[0]){const i=1===this.jitterIndex||this.Dt();this.k.needsUpdate=i,!i&&this.k.isConverged()||this.k.render(this.renderer,e,t,this.nt)}this.gt=this.nt}Dt(){if(!this.gt)return!0;if(this.nt===this.gt)return!1;if(null===this.nt||null===this.gt)return!1;if(this.nt.length!==this.gt.length)return!0;for(let e=0;e<this.nt.length;++e)if(this.gt[e]&&this.nt[e].id!==this.gt[e].id)return!0;return!1}rt(){this.U.needsUpdate=!!this.autoSAOClear,this.V.needsUpdate=!!this.autoShadowsClear,this.L.needsUpdate=!0,this.k&&(this.k.needsUpdate=!0),this.enableGI&&(this.ht.needsUpdate=!0),this.renderCompleteCallbackCalled=!1}}},function(e,t){e.exports=PIXOTRON.Performance=class{constructor(e){this.u=e,this.Pt=performance.now(),this.St=performance.now(),this.converged=this.converged.bind(this),this.Mt=0,this.Ht=0,this.Ct=0,this.rt=!0,this.FPS_UPDATE_TIME=500,this.u.addEventListener("onRenderConverged",this.converged)}update(){if(this.Mt++,this.Pt=performance.now(),this.rt&&(this.yt(),this.rt=!1),this.Pt>=this.St+this.FPS_UPDATE_TIME){const e=this.Pt-this.St;this.Ht=1e3*this.Mt/e,this.Mt=0,this.St=this.Pt,this.u.dispatchEvent({type:"onFPSUpdate",fps:this.Ht,delta:e})}}yt(){this.Mt=0,this.Pt=performance.now(),this.St=performance.now()}converged(){this.rt=!0}}},function(e,t,i){i(8),e.exports=PIXOTRON.TextureAreaLightFilter=class{constructor(e){this._t=e,PIXOTRON.isPowerOfTwo(this._t.image)||(this._t.image=PIXOTRON.makePowerOfTwo(this._t.image));const t={format:THREE.RGBAFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter,type:this._t.type,generateMipmaps:!1,anisotropy:this._t.anisotropy,encoding:this._t.encoding},i={x:e.image.width,y:e.image.height},s=Math.max(i.x,i.y);this.It=Math.log(s)/Math.log(2)+1,this.zt=[],this.Xt=[],this.At=[],this.At.push(.1);for(let e=0;e<this.It;e++){let s=new THREE.WebGLRenderTarget(i.x,i.y,t);this.zt.push(s),s=new THREE.WebGLRenderTarget(i.x,i.y,t),this.Xt.push(s),i.x=Math.ceil(i.x/2),i.y=Math.ceil(i.y/2),e<2&&this.At.push(1),e<5&&this.At.push(2),e>5&&this.At.push(3)}const a=PIXOTRON.AreaLightTextureFilterShader;this.Ft=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{NUM_SAMPLES:16}})}update(e){let t=this._t;const i=new THREE.DataTexture(null,this._t.image.width,this._t.image.height);i.minFilter=THREE.LinearMipMapLinearFilter;for(let s=0;s<this.It;s++){this.Ft.uniforms.filterRadius.value=this.At[s],this.Ft.uniforms.texSize.value.set(this.zt[s].width,this.zt[s].height),this.Ft.uniforms.direction.value.set(1,0),this.Ft.uniforms.colorTexture.value=t,PIXOTRON.renderPass(e,this.Ft,this.zt[s],!0),this.Ft.uniforms.direction.value.set(0,1),this.Ft.uniforms.colorTexture.value=this.zt[s].texture,PIXOTRON.renderPass(e,this.Ft,this.Xt[s],!0),t=this.Xt[s];const a=new Uint8Array(4*t.width*t.height);e.setRenderTarget(t),e.readRenderTargetPixels(t,0,0,t.width,t.height,a),i.mipmaps[s]={data:a,width:t.width,height:t.height}}return i.generateMipmaps=!1,i.needsUpdate=!0,this.bt(),i}bt(){for(let e=0;e<this.It;e++)this.zt[e].dispose(),this.zt[e]=null,this.Xt[e].dispose(),this.Xt[e]=null}}},function(e,t){e.exports=PIXOTRON.AreaLightTextureFilterShader={uniforms:{colorTexture:{value:null},texSize:{value:new THREE.Vector2(.5,.5)},direction:{value:new THREE.Vector2(.5,.5)},filterRadius:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D colorTexture;","uniform float filterRadius;","uniform vec2 texSize;","uniform vec2 direction;","void main() {","float INV_NUM_SAMPLES = 1.0/float(NUM_SAMPLES - 1);","vec2 delta = direction * filterRadius * INV_NUM_SAMPLES/ texSize;","float fSigma = filterRadius;","float weightSum = 1.;","vec4 colorSum = texture2D( colorTexture, vUv) * weightSum;","for( int i = 1; i < NUM_SAMPLES; i ++ ) {","float x = float(i);","vec2 uvOffset = delta * x;","vec2 vUv1 = vUv + uvOffset;","float w = 1.;","if( vUv1.x < 0.0 || vUv1.x > 1.0 || vUv1.y < 0.0 || vUv1.y > 1.0 ) {","w = 0.0;","}","colorSum += texture2D( colorTexture, vUv1) * w;","weightSum += w;","vec2 vUv2 = vUv - uvOffset;","w = 1.;","if( vUv2.x < 0.0 || vUv2.x > 1.0 || vUv2.y < 0.0 || vUv2.y > 1.0 ) {","w = 0.0;","}","colorSum += texture2D( colorTexture, vUv2) * w;","weightSum += w;","}","gl_FragColor = vec4(colorSum/weightSum);","}"].join("\n")}},function(e,t){e.exports=PIXOTRON.BVHManager=class{constructor(){this.meshes=[]}buildBVHTree(e){let t=null;e.geometry.index&&(t=e.geometry.index.array);let s=e.geometry.attributes.position.array,c=e.geometry.attributes.uv?e.geometry.attributes.uv.array:void 0;if(t){const e=new Float32Array(3*t.length);for(let i=0;i<t.length;i++){const a=3*t[i];e[3*i]=s[a],e[3*i+1]=s[a+1],e[3*i+2]=s[a+2]}if(s=e,c){const e=new Float32Array(2*t.length);for(let i=0;i<t.length;i++){const s=2*t[i];e[2*i]=c[s],e[2*i+1]=c[s+1]}c=e}}return new class{constructor(e,t,s){this.positions=e,this.uvs=t,this._maxTrianglesPerNode=s||10,this._bboxArray=function(e){let t,i,s,a,r,o,n,l,u,c,d,m,f,v,p;const g=e.length/9,x=new Float32Array(7*g);for(let T=0;T<g;T++)t=e[9*T],i=e[9*T+1],s=e[9*T+2],a=e[9*T+3],r=e[9*T+4],o=e[9*T+5],n=e[9*T+6],l=e[9*T+7],u=e[9*T+8],c=Math.min(Math.min(t,a),n),d=Math.min(Math.min(i,r),l),m=Math.min(Math.min(s,o),u),f=Math.max(Math.max(t,a),n),v=Math.max(Math.max(i,r),l),p=Math.max(Math.max(s,o),u),h(x,T,T,c,d,m,f,v,p);return x}(e),this._bboxHelper=new Float32Array(this._bboxArray.length),this._bboxHelper.set(this._bboxArray);const a=e.length/9,r=this.calcExtents(0,a,i);for(this._rootNode=new u(r[0],r[1],0,a,0),this._nodesToSplit=[this._rootNode];this._nodesToSplit.length>0;){const e=this._nodesToSplit.pop();this.splitNode(e)}}calcExtents(e,t,i){if(i=i||0,e>=t)return[{x:0,y:0,z:0},{x:0,y:0,z:0}];let s=Number.MAX_VALUE,a=Number.MAX_VALUE,r=Number.MAX_VALUE,o=-Number.MAX_VALUE,n=-Number.MAX_VALUE,l=-Number.MAX_VALUE;for(let i=e;i<t;i++)s=Math.min(this._bboxArray[7*i+1],s),a=Math.min(this._bboxArray[7*i+2],a),r=Math.min(this._bboxArray[7*i+3],r),o=Math.max(this._bboxArray[7*i+4],o),n=Math.max(this._bboxArray[7*i+5],n),l=Math.max(this._bboxArray[7*i+6],l);return[{x:s-i,y:a-i,z:r-i},{x:o+i,y:n+i,z:l+i}]}splitNode(e){if(e.elementCount()<=this._maxTrianglesPerNode||0===e.elementCount())return;const t=e._startIndex,s=e._endIndex,a=[[],[],[]],r=[[],[],[]],o=[e.centerX(),e.centerY(),e.centerZ()],n=[e._extentsMax.x-e._extentsMin.x,e._extentsMax.y-e._extentsMin.y,e._extentsMax.z-e._extentsMin.z],h=[];h.length=3;for(let e=t;e<s;e++){h[0]=.5*(this._bboxArray[7*e+1]+this._bboxArray[7*e+4]),h[1]=.5*(this._bboxArray[7*e+2]+this._bboxArray[7*e+5]),h[2]=.5*(this._bboxArray[7*e+3]+this._bboxArray[7*e+6]);for(let t=0;t<3;t++)h[t]<o[t]?a[t].push(e):r[t].push(e)}const c=[];if(c.length=3,c[0]=0===a[0].length||0===r[0].length,c[1]=0===a[1].length||0===r[1].length,c[2]=0===a[2].length||0===r[2].length,c[0]&&c[1]&&c[2])return;const d=[0,1,2];let m,f;d.sort((function(e,t){return n[t]-n[e]}));for(let e=0;e<3;e++){const t=d[e];if(!c[t]){m=a[t],f=r[t];break}}const v=t,p=v+m.length,g=p,x=s;let T,w=e._startIndex;const R=m.concat(f);for(let e=0;e<R.length;e++)T=R[e],l(this._bboxArray,T,this._bboxHelper,w),w++;const E=this._bboxHelper.subarray(7*e._startIndex,7*e._endIndex);this._bboxArray.set(E,7*e._startIndex);const P=this.calcExtents(v,p,i),S=this.calcExtents(g,x,i),y=new u(P[0],P[1],v,p,e._level+1),D=new u(S[0],S[1],g,x,e._level+1);e._node0=y,e._node1=D,e.clearShapes(),this._nodesToSplit.push(y),this._nodesToSplit.push(D)}intersectRay(e,t,i){const s=[this._rootNode],l=[],h=[];let u;const c=new THREE.Vector3(1/t.x,1/t.y,1/t.z);for(;s.length>0;){const t=s.pop();if(r(e,c,t))for(t._node0&&s.push(t._node0),t._node1&&s.push(t._node1),u=t._startIndex;u<t._endIndex;u++)l.push(this._bboxArray[7*u])}const d=new THREE.Vector3,m=new THREE.Vector3,f=new THREE.Vector3,v=new THREE.Vector2,p=new THREE.Vector2,g=new THREE.Vector2,x=new THREE.Vector3,T=new THREE.Vector3,w=new THREE.Vector2,R=new THREE.Vector3(e.x,e.y,e.z),E=new THREE.Vector3(t.x,t.y,t.z);for(u=0;u<l.length;u++){const e=l[u];d.fromArray(this.positions,9*e),m.fromArray(this.positions,9*e+3),f.fromArray(this.positions,9*e+6);const t=a(d,m,f,R,E,i);t&&(this.uvs&&(v.fromArray(this.uvs,6*e),p.fromArray(this.uvs,6*e+2),g.fromArray(this.uvs,6*e+4),o(t,d,m,f,v,p,g,x,w)),n(d,m,f,T),h.push({point:t,uv:w,face:{index:e,a:d.clone(),b:m.clone(),c:f.clone(),normal:T}}))}return h}}(s,c,7)}add(e){this.meshes[e.uuid]||(this.meshes.push({id:e.uuid,val:e}),e.bvh=this.buildBVHTree(e))}intersectRay(e){const t=new THREE.Ray,i=new THREE.Matrix4;let s=[];for(let a=0;a<this.meshes.length;a++){const r=this.meshes[a].val;t.origin.copy(e.origin),t.direction.copy(e.direction),i.getInverse(r.matrixWorld),t.origin.applyMatrix4(i),t.direction.transformDirection(i);const o=r.bvh.intersectRay(t.origin,t.direction,!0);o.length>0&&o.forEach((function(t){t.object=r,t.point.applyMatrix4(r.matrixWorld),t.distance=e.origin.distanceToSquared(t.point)})),s=s.concat(o)}return s.sort((function(e,t){return e.distance>t.distance})),s}};const i=1e-6;function s(e,t,i,s){const a={min:0,max:0};return s>=0?(a.min=(e-i)*s,a.max=(t-i)*s):(a.min=(t-i)*s,a.max=(e-i)*s),a}const a=function(){const e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3,s=new THREE.Vector3;return function(a,r,o,n,l,h){t.subVectors(r,a),i.subVectors(o,a),s.crossVectors(t,i);let u,c=l.dot(s);if(c>0){if(h)return null;u=1}else{if(!(c<0))return null;u=-1,c=-c}e.subVectors(n,a);const d=u*l.dot(i.crossVectors(e,i));if(d<0)return null;const m=u*l.dot(t.cross(e));if(m<0)return null;if(d+m>c)return null;const f=-u*e.dot(s);if(f<0)return null;const v=f/c;return(new THREE.Vector3).copy(l).multiplyScalar(v).add(n)}}();function r(e,t,i){const a=s(i._extentsMin.x,i._extentsMax.x,e.x,t.x),r=s(i._extentsMin.y,i._extentsMax.y,e.y,t.y);if(a.min>r.max||r.min>a.max)return!1;(r.min>a.min||a.min!=a.min)&&(a.min=r.min),(r.max<a.max||a.max!=a.max)&&(a.max=r.max);const o=s(i._extentsMin.z,i._extentsMax.z,e.z,t.z);return!(a.min>o.max||o.min>a.max||((o.min>a.min||a.min!=a.min)&&(a.min=o.min),(o.max<a.max||a.max!=a.max)&&(a.max=o.max),a.max<0))}function o(e,t,i,s,a,r,o,n,l){return THREE.Triangle.getBarycoord(e,t,i,s,n),a.multiplyScalar(n.x),r.multiplyScalar(n.y),o.multiplyScalar(n.z),a.add(r).add(o),l.copy(a),l}function n(e,t,i,s){const a=s||new THREE.Vector3,r=new THREE.Vector3;a.subVectors(i,t),r.subVectors(e,t),a.cross(r);const o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}function l(e,t,i,s){i[7*s]=e[7*t],i[7*s+1]=e[7*t+1],i[7*s+2]=e[7*t+2],i[7*s+3]=e[7*t+3],i[7*s+4]=e[7*t+4],i[7*s+5]=e[7*t+5],i[7*s+6]=e[7*t+6]}function h(e,t,i,s,a,r,o,n,l){e[7*t]=i,e[7*t+1]=s,e[7*t+2]=a,e[7*t+3]=r,e[7*t+4]=o,e[7*t+5]=n,e[7*t+6]=l}class u{constructor(e,t,i,s,a){this._extentsMin=e,this._extentsMax=t,this._startIndex=i,this._endIndex=s,this._level=a,this._node0=null,this._node1=null}elementCount(){return this._endIndex-this._startIndex}centerX(){return.5*(this._extentsMin.x+this._extentsMax.x)}centerY(){return.5*(this._extentsMin.y+this._extentsMax.y)}centerZ(){return.5*(this._extentsMin.z+this._extentsMax.z)}clearShapes(){this._startIndex=-1,this._endIndex=-1}}},function(e,t){PIXOTRON.queryId=-1,e.exports=PIXOTRON.GPUProfiler=class{constructor(e){this.xt=e,this.Ot=this.xt.getExtension("EXT_disjoint_timer_query"),this.queryPool={},this.Ot||console.warn("GPUProfiler::EXT_disjoint_timer_query not supported!")}start(e){const t=this.popAvailableQuery(e);return this.Ot&&t&&t.start(this.Ot),t.id}result(e){let t;const i=this.queryPool[e];if(i)return this.end(i),this.available(i)&&(t=this.value(i)),t}end(e){this.Ot&&e&&e.end(this.Ot)}available(e){if(this.Ot)return this.Ot.getQueryObjectEXT(e.Ut,this.Ot.QUERY_RESULT_AVAILABLE_EXT)}value(e){if(this.Ot){let t;return this.xt.getParameter(this.Ot.GPU_DISJOINT_EXT)||(t=1e-6*this.Ot.getQueryObjectEXT(e.Ut,this.Ot.QUERY_RESULT_EXT),e.dirty=!1),t}}Vt(e){let t=this.queryPool[e];return t||(t=new class{constructor(e){this.dirty=!1,this.id=++PIXOTRON.queryId,this.Ut=e.createQueryEXT()}start(e){this.dirty||e.beginQueryEXT(e.TIME_ELAPSED_EXT,this.Ut)}end(e){this.dirty||e.endQueryEXT(e.TIME_ELAPSED_EXT),this.dirty=!0}}(this.Ot),this.queryPool[t.id]=t),t}}},function(e,t){e.exports=PIXOTRON.QualitySettings=class{constructor(e){this.Lt=void 0!==e?e:-1,this.Bt=!1,this.kt()}kt(){this.enableAA=!0,this.useAreaLight=!0,this.pixelRatio=1,this.useHDREnv=!1,this.useGBuffer=!0,this.saoQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1},this.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}change(e){const t=e.getSAOPass();t.enabled=this.saoQualitySettings.enabled,t.setDownscaleLevel(this.saoQualitySettings.downscale),t.blurEnabled=this.saoQualitySettings.enableBlur;const i=e.getShadowPass();i.enabled=this.shadowQualitySettings.enabled,i.setDownscaleLevel(this.shadowQualitySettings.downscale),e.enableAA=this.enableAA,e.needsUpdate=!0}setQuality(e){this.Lt=e}getQuality(){return this.Lt}lock(){this.Bt=!0}unLock(){this.Bt=!1}isLocked(){return this.Bt}onEnter(e){this.Wt=e}onExit(e){this.jt=e}onUpdate(e){this.Zt=e}enter(){this.Wt&&this.Wt()}update(){this.Zt&&this.Zt()}exit(){this.jt&&this.jt()}},e.exports=PIXOTRON.TestQualitySettings=class extends PIXOTRON.QualitySettings{constructor(e){super(e),this.Gt=0}setTestFps(e){this.Gt=e}getTestFps(){return this.Gt}},e.exports=PIXOTRON.HighestQualitySettings=class extends PIXOTRON.QualitySettings{constructor(){super(3),this.enableAA=!0,this.useAreaLight=!1,this.pixelRatio=2,this.useHDREnv=!1,this.useGBuffer=!1,this.saoQualitySettings={enabled:!0,downscale:1,enableBlur:!0,enabledOnMove:!1,useNormalWeights:!1,useAccumulative:!1},this.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!1}}},e.exports=PIXOTRON.HighQualitySettings=class extends PIXOTRON.QualitySettings{constructor(){super(2),this.enableAA=!0,this.useAreaLight=!0,this.pixelRatio=1,this.useHDREnv=!1,this.useGBuffer=!0,this.saoQualitySettings={enabled:!0,downscale:1,enableBlur:!0,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1},this.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!0}}},e.exports=PIXOTRON.MidQualitySettings=class extends PIXOTRON.QualitySettings{constructor(){super(1),this.enableAA=!0,this.useAreaLight=!0,this.pixelRatio=1,this.useHDREnv=!1,this.useGBuffer=!0,this.saoQualitySettings={enabled:!0,downscale:1,enableBlur:!1,enabledOnMove:!0,useNormalWeights:!0,useAccumulative:!1},this.shadowQualitySettings={enabled:!0,downscale:1,enabledOnMove:!1}}},e.exports=PIXOTRON.LowQualitySettings=class extends PIXOTRON.QualitySettings{constructor(){super(0),this.enableAA=!0,this.useAreaLight=!0,this.pixelRatio=1,this.useHDREnv=!1,this.useGBuffer=!1,this.saoQualitySettings={enabled:!1,downscale:2,enableBlur:!1,enabledOnMove:!1,useNormalWeights:!1,useAccumulative:!1},this.shadowQualitySettings={enabled:!0,downscale:2,enabledOnMove:!1}}},e.exports=PIXOTRON.LowestQualitySettings=class extends PIXOTRON.QualitySettings{constructor(){super(-1),this.enableAA=!1,this.useAreaLight=!1,this.pixelRatio=1,this.useHDREnv=!1,this.useGBuffer=!1,this.saoQualitySettings={enabled:!1,downscale:2,enableBlur:!1,enabledOnMove:!1,useNormalWeights:!1,useAccumulative:!1},this.shadowQualitySettings={enabled:!1,downscale:2,enabledOnMove:!1}}}},function(e,t,i){i(1),e.exports=PIXOTRON.AutoQualityAdapter=class extends PIXOTRON.QualityAdapter{constructor(e){super(e),this.Qt=this.Qt.bind(this),this.qt=this.qt.bind(this),this.Kt=[],this.Jt=0,this.Yt=0,this.$t=3,this.te=5e3,this.ee=0,this.timeElapsed=0,this.ie=30,this.se=!1,this.T=!1}addQuality(e){this.Kt.push(e),this.Kt.sort((e,t)=>e.getQuality()>t.getQuality()?-1:1);const t=this.Kt[0];this.O(t)}needsChange(){this.se=!0}tryUpgrade(){this.R=!0}setQualitySetting(e){if(this.rt(),!this.oe(e))throw new Error("AutoQualityAdapter:: quality not added");this.tryUpgrade(),this.O(e)}setDesiredFps(e){this.ie=e}setMaxWaitTime(e){this.te=e}setNumWaitCycles(e){this.$t=e}enable(){this.v=!0,this.u.addEventListener("onFPSUpdate",this.Qt),this.u.addEventListener("onRenderConverged",this.qt)}disable(){this.v=!1,this.u.removeEventListener("onFPSUpdate",this.Qt),this.u.removeEventListener("onRenderConverged",this.qt)}getAverageFps(){return this.Yt}update(){this.ae()&&(this.currentQualitySetting.update(),this.ne(),this.ee=0)}oe(e){for(let t=0;t<this.Kt.length;++t)if(e.getQuality()===this.Kt[t].getQuality())return!0;return!1}rt(){this.timeElapsed=0,this.Jt=0}Qt(e){this.timeElapsed+=e.delta,this.he(e.fps),this.T&&this.Yt}ae(){const e=this.ee>=this.$t,t=this.timeElapsed>this.te,i=this.se||e||t;return this.se=!1,i}qt(){this.ee++}he(e){this.Jt++,this.Yt=this.Yt*(this.Jt-1)+e,this.Yt/=this.Jt}re(e){return this.Yt>=e}le(){let e;for(let t=0;t<this.Kt.length;++t)this.Kt[t].getQuality()===this.currentQualitySetting.getQuality()&&(e=t);return e}ce(){let e=this.le()-1;return e=Math.max(e,0),this.Kt[e]}ue(){let e=this.le()+1;return e=Math.min(e,this.Kt.length-1),this.Kt[e]}de(){return!this.previousQualitySetting||!!this.R||this.previousQualitySetting.getQuality()<=this.currentQualitySetting.getQuality()}ne(){if(this.rt(),this.currentQualitySetting.isLocked())this.T;else{if(this.re(this.ie)){if(!this.de())return void this.T;{const e=this.ce();this.O(e)}}else{const e=this.ue();this.O(e)}this.R=!1}}},e.exports=PIXOTRON.AutoTestQualityAdapter=class extends PIXOTRON.AutoQualityAdapter{constructor(e){super(e)}getAverageFps(){return this.currentQualitySetting.getTestFps()}Qt(e){this.timeElapsed+=e.delta,e.fps=this.currentQualitySetting.getTestFps(),this.he(e.fps),this.T&&this.Yt}}},function(e,t,i){i(1),e.exports=PIXOTRON.ManualQualityAdapter=class extends PIXOTRON.QualityAdapter{constructor(e){super(e),this.update=this.update.bind(this),this.qualitySettings=0}setQualitySetting(e){this.O(e)}}},function(e,t,i){i(15),e.exports=PIXOTRON.GBufferPass=class{constructor(e){e=e||{},this.forceDepthAndNormalPass=void 0===e.forceDepthAndNormalPass||e.forceDepthAndNormalPass,this.packingMode=void 0!==e.packingMode?e.packingMode:PIXOTRON.GBufferPass.DEPTH_NORMAL_16,this.ve=new THREE.MeshNormalMaterial,this.me=new THREE.ShaderMaterial(PIXOTRON.PackingShader_DepthNormal16),this.fe=void 0===e.linearDepth||e.linearDepth,this.fe?(this.pe=new THREE.ShaderMaterial(PIXOTRON.PackingShader_Depth32),this.forceDepthAndNormalPass=!0):(this.pe=new THREE.MeshDepthMaterial,this.pe.depthPacking=THREE.RGBADepthPacking),this.debug=!1,this.K=0,this.oldClearColor=new THREE.Color}dispose(){this.Ee&&this.Ee.dispose(),this.we&&this.we.dispose(),this.Re&&this.Re.dispose(),this.ve.dispose(),this.me.dispose(),this.pe.dispose()}getTotalRenderTime(){return this.K}setSize(e,t){this.Ee&&this.Ee.setSize(e,t),this.we&&this.we.setSize(e,t),this.Re&&this.Re.setSize(e,t)}render(e,t,i){this.Te||this.X(e),e.getClearColor(this.oldClearColor);const s=e.getClearAlpha(),a=e.autoClear,r=e.shadowMap.enabled;e.shadowMap.enabled=!1,e.autoClear=!1,e.setClearColor(new THREE.Color(0,0,0),0),this.xe(e,t,i),e.autoClear=a,e.shadowMap.enabled=r,e.setClearColor(this.oldClearColor,s)}X(e){const t=e.extensions,i=e.capabilities.isWebGL2||t.get("WEBGL_depth_texture"),s=new THREE.Vector2;e.getDrawingBufferSize(s);const a=s.x,r=s.y;if(!this.forceDepthAndNormalPass&&i&&!this.Re){const e={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.Re=new THREE.WebGLRenderTarget(a,r,e),this.Nt||(this.Nt=new THREE.DepthTexture,this.Nt.type=THREE.UnsignedShortType),this.Re.depthTexture=this.Nt}if(!i||this.forceDepthAndNormalPass){const e={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.packingMode===PIXOTRON.GBufferPass.NONE&&(this.we||(this.we=new THREE.WebGLRenderTarget(a,r,e),this.we.depthTexture=this.Nt),this.Re||(this.Re=new THREE.WebGLRenderTarget(a,r,e),this.Re.depthTexture=this.Nt)),this.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(this.Ee||(this.Ee=new THREE.WebGLRenderTarget(a,r,e),this.Ee.depthTexture=this.Nt))}this.Te=!0}xe(e,t,i){!function(e){e.traverse((function(e){if(e.isMesh||e.isLineSegments||e.isLine||e.isLineLoop||e.isPoints){let t=e.material&&e.material.transparent||e.castAO;(t=(t=e.material&&e.material.transparent&&!e.material.isShadowMaterial||!!e.castAO)||e.material.alphaTest>0)&&(e.aoVisibility=e.visible,e.visible=!1)}}))}(t),this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),this.K=0;const s=e.extensions,a=e.capabilities.isWebGL2||s.get("WEBGL_depth_texture");a&&!this.forceDepthAndNormalPass&&(t.overrideMaterial=this.ve,e.setRenderTarget(this.Re),e.clear(!0,!0,!1),e.render(t,i),e.setRenderTarget(null),t.overrideMaterial=null),a&&!this.forceDepthAndNormalPass||(this.packingMode===PIXOTRON.GBufferPass.NONE&&(t.overrideMaterial=this.ve,e.setRenderTarget(this.Re),e.clear(!0,!0,!1),e.render(t,i),e.setRenderTarget(null),t.overrideMaterial=null,t.overrideMaterial=this.pe,this.pe.isMeshDepthMaterial||(this.pe.uniforms.cameraNearFar.value.x=i.near,this.pe.uniforms.cameraNearFar.value.y=i.far),e.setRenderTarget(this.we),e.clear(!0,!0,!1),e.render(t,i,this.we),e.setRenderTarget(null),t.overrideMaterial=null),this.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(t.overrideMaterial=this.me,this.me.uniforms.cameraNearFar.value.x=i.near,this.me.uniforms.cameraNearFar.value.y=i.far,e.setRenderTarget(this.Ee),e.clear(!0,!0,!1),e.render(t,i),e.setRenderTarget(null),t.overrideMaterial=null));const r=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"GBuffer Pass"});r&&(this.K+=r),function(e){e.traverse((function(e){e.aoVisibility&&(e.visible=e.aoVisibility,e.aoVisibility=void 0)}))}(t)}},PIXOTRON.GBufferPass.NONE=0,PIXOTRON.GBufferPass.DEPTH_NORMAL_16=1},function(e,t){e.exports=PIXOTRON.PackingShader_DepthNormal16={uniforms:{cameraNearFar:{type:"v2",value:new THREE.Vector2}},vertexShader:"varying vec3 viewNormal; varying vec3 viewPosition; void main() { viewNormal = normalMatrix * normal; viewPosition = (modelViewMatrix * vec4( position, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }",fragmentShader:"varying vec3 viewNormal; uniform vec2 cameraNearFar; varying vec3 viewPosition; vec2 pack16(float value){ float sMax = 65535.0; int v = int(clamp(value, 0.0, 1.0)*sMax+0.5); int digit0 = v/256; int digit1 = v-digit0*256; return vec2(float(digit0)/255.0, float(digit1)/255.0); } vec2 packNormal(vec3 n){ float p = sqrt(n.z*8.0+8.0); return vec2(n.xy/p + 0.5); } float linstep(float edge0, float edge1, float value){ return clamp((value-edge0)/(edge1-edge0), 0.0, 1.0); } void main() { float linearZ = linstep(-cameraNearFar.x, -cameraNearFar.y, viewPosition.z); vec2 packedZ = pack16(pow(linearZ, 0.5)); vec2 packedNormal = packNormal(normalize(viewNormal)); gl_FragColor = vec4(packedZ.x, packedZ.y, packedNormal.x, packedNormal.y); }"},e.exports=PIXOTRON.PackingShader_Depth32={uniforms:{cameraNearFar:{type:"v2",value:new THREE.Vector2}},vertexShader:"varying vec3 viewPosition; void main() { viewPosition = (modelViewMatrix * vec4( position, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }",fragmentShader:"#include <packing> uniform vec2 cameraNearFar; varying vec3 viewPosition; float linstep(float edge0, float edge1, float value){ return clamp((value-edge0)/(edge1-edge0), 0.0, 1.0); } void main() { float linearZ = linstep(-cameraNearFar.x, -cameraNearFar.y, viewPosition.z); vec4 packedZ = packDepthToRGBA(pow(linearZ, 0.5)); gl_FragColor = packedZ; }"}},function(e,t,i){i(0),i(17),i(2);const s=new THREE.Vector2;e.exports=PIXOTRON.AccumulativeSAOPass=class{constructor(e){e=e||{},this.intensity=void 0!==e.intensity?e.intensity:.25,this.occlusionWorldRadius=void 0!==e.occlusionWorldRadius?e.occlusionWorldRadius:.8,this.smoothTransition=void 0===e.smoothTransition||e.smoothTransition,this.bias=void 0!==e.bias?e.bias:.001,this.numSamples=void 0!==e.numSamples?e.numSamples:600,this.Oe=void 0!==e.samplesPerFrame?e.samplesPerFrame:4,this.Ne=void 0!==e.downscaleLevel?e.downscaleLevel:1,this.Ne=this.Ne<1?1:this.Ne,this.falloff=void 0!==e.falloff?e.falloff:1,this.blurEnabled=!0,this.edgeSharpness=10,this.debug=!1,this.enabled=!0,this.needsUpdate=!0,this.De=0,this.ge(this.numSamples),this.Pe=new THREE.ShaderMaterial(PIXOTRON.AccumulativeSAOShader),this.Pe.uniforms=THREE.UniformsUtils.clone(this.Pe.uniforms),this.Pe.defines.SAMPLES_PER_FRAME=this.Oe,this.Se=new THREE.ShaderMaterial(PIXOTRON.SmoothTransitionAOShader),this.C=0,this.Me=[],this.K=0,this.oldClearColor=new THREE.Color}convergenceMetric(){return this.enabled?this.C*this.Oe/(this.He-1):1}dispose(){this.Ce&&(this.Ce.dispose(),this.ye.dispose(),this.Pe.dispose(),this.Se.dispose())}getTotalRenderTime(){return this.K}render(e,t,i,a){if(this.needsUpdate&&(this.C=0,this.needsUpdate=!1),this.convergenceMetric()>=1)return;this.C++,this.C=Math.min(this.C,this.He-1),this.Ce||this.X(e),this.ge(this.numSamples),this._e(this.C-1),e.getClearColor(this.oldClearColor);const r=e.getClearAlpha(),o=e.autoClear;e.autoClear=!1,e.getDrawingBufferSize(s);const n=s.x/this.Ne,l=s.y/this.Ne;this.Pe.uniforms.size.value.set(n,l),this.Ie(n,l),this.ze(t,i);const h=this.C%2==0?this.ye:this.Ce,u=this.C%2==0?this.Ce:this.ye;this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),this.K=0,this.Xe(e,h,u);const c=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"Acc SAO Render"});if(c&&(this.K+=c),this.blurEnabled&&this.convergenceMetric()>.9){this.blurQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.blurQueryId),a.edgeSharpness=this.edgeSharpness,a.render(e,u,t,i);const s=this.debug&&PIXOTRON.endPerformanceTest(this.blurQueryId,{callback:this.debugCallback,name:"Acc SAO Blur"});s&&(this.K+=s)}this.Ae(e,h,u),e.autoClear=o,e.setClearColor(this.oldClearColor),e.setClearAlpha(r),e.saoBuffer=this.smoothTransition?h:u}setDownscaleLevel(e){this.Ne=e||1,this.Ne=this.Ne<1?1:this.Ne,this.needsUpdate=!0}setSize(e,t){this.ye&&this.ye.setSize(e,t),this.Ce&&this.Ce.setSize(e,t),this.Pe.uniforms.size.value.set(e,t)}X(e){e.getDrawingBufferSize(s);const t=s.x/this.Ne,i=s.y/this.Ne;if(!this.Ce){const e={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.Ce=new THREE.WebGLRenderTarget(t,i,e),this.ye=new THREE.WebGLRenderTarget(t,i,e)}}Xe(e,t,i){this.Pe.uniforms.tAOSumPrevious.value=t.texture,PIXOTRON.renderPass(e,this.Pe,i)}Ae(e,t,i){if(this.smoothTransition){this.Se.uniforms.saoAccumulationBuffer.value=i.texture,this.Se.uniforms.transition.value=this.convergenceMetric(),this.transitionQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.transitionQueryId),PIXOTRON.renderPass(e,this.Se,t);const s=this.debug&&PIXOTRON.endPerformanceTest(this.transitionQueryId,{callback:this.debugCallback,name:"Acc SAO Transition"});s&&(this.K+=s)}}Ie(e,t){(this.Ce.width!==e||this.Ce.height!==t)&&this.Ce.setSize(e,t)}ze(e,t){const i=1/(2*Math.tan(THREE.MathUtils.DEG2RAD*e.fov/2)),s=this.Pe.uniforms.saoData.value;s.x=i,s.y=this.intensity,s.z=this.occlusionWorldRadius,s.w=this.C;const a=this.Pe.uniforms.saoBiasEpsilon.value;a.x=this.bias,a.y=.001,a.z=this.falloff;const r=this.Pe.uniforms.cameraNearFar.value;let o;r.x=e.near,r.y=e.far,this.Pe.uniforms.ProjectionMatrix.value=e.projectionMatrix,o=t.Nt?t.Nt:t.we?t.we.texture:null;const n=t.Re?t.Re.texture:null;let l;t.we||(l=t.Ee?t.Ee.texture:null);let h=t.Nt?0:1;t.forceDepthAndNormalPass&&t.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(h=2),this.Pe.defines.DEPTH_PACKING_MODE=h,this.Pe.defines.DEPTH_NORMAL_TEXTURE=l?1:0,this.Pe.defines.LINEAR_DEPTH=t.fe?1:0,this.Pe.uniforms.quasiRandomSamples.value=this.Me,l?this.Pe.uniforms.tNormalDepth.value=l:(this.Pe.uniforms.tNormal.value=n,this.Pe.uniforms.tDepth.value=o)}_e(e){let t=this.Oe*e,i=0;for(i=0;i<this.Oe;i++)this.Me[i]=this.Fe[t++],void 0===this.Me[i]&&(this.Me[i]=this.Fe[t%this.Oe])}ge(e){e!==this.De&&(this.De=e,this.Fe=PIXOTRON.generateQuasiRandomPoints(e,-1,PIXOTRON.lerpDistribution,PIXOTRON.insideCircle),this.Fe=PIXOTRON.randomizeArray(this.Fe),this.He=this.Fe.length)}}},function(e,t){e.exports=PIXOTRON.AccumulativeSAOShader={blending:THREE.NoBlending,defines:{SAMPLES_PER_FRAME:4,DEPTH_PACKING_MODE:1,PERSPECTIVE_CAMERA:1,LINEAR_DEPTH:1},uniforms:{tAOSumPrevious:{type:"t",value:null},tDepth:{type:"t",value:null},tNormal:{type:"t",value:null},tNormalDepth:{type:"t",value:null},cameraNearFar:{type:"v2",value:new THREE.Vector2},saoData:{type:"v4",value:new THREE.Vector4},ProjectionMatrix:{type:"m4",value:new THREE.Matrix4},quasiRandomSamples:{type:"v2v",value:null},saoBiasEpsilon:{type:"v3",value:new THREE.Vector3(1,1,1)},size:{type:"v2",value:new THREE.Vector2(512,512)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","varying vec2 vUv;","uniform sampler2D tAOSumPrevious;","uniform sampler2D tDepth;","#if DEPTH_NORMAL_TEXTURE == 1","uniform sampler2D tNormalDepth;","#else","uniform sampler2D tNormal;","#endif","uniform mat4 ProjectionMatrix;","uniform vec4 saoData;","uniform vec3 saoBiasEpsilon;","uniform vec2 size;","uniform vec2 cameraNearFar;","uniform vec2 quasiRandomSamples[SAMPLES_PER_FRAME];","const float f_sampleCount = float( SAMPLES_PER_FRAME );","#include <utilshader>","float getViewDepth( const in float ndcDepth ) {","#if PERSPECTIVE_CAMERA == 1","return perspectiveDepthToViewZ( ndcDepth, cameraNearFar.x, cameraNearFar.y );","#else","return orthographicDepthToViewZ( ndcDepth, cameraNearFar.x, cameraNearFar.y );","#endif","}","vec3 getViewPositionFromViewZ(const in vec2 uv, const in float viewDepth) {","vec2 uv_ = 2. * uv - 1.;","float xe = -(uv_.x + ProjectionMatrix[2][0]) * viewDepth/ProjectionMatrix[0][0];","float ye = -(uv_.y + ProjectionMatrix[2][1]) * viewDepth/ProjectionMatrix[1][1];","return vec3(xe, ye, viewDepth);","}","float getOcclusionFromPositionNormal( const in vec3 centerPosition, const in vec3 centerNormal, const in vec3 samplePosition ) {","vec3 direction = samplePosition - centerPosition;","float d2 = dot( direction, direction );","return max( ( dot( centerNormal, direction ) + centerPosition.z * saoBiasEpsilon.x ) / ( saoBiasEpsilon.z * d2 + saoBiasEpsilon.y ), 0.0 );","}","vec4 getOcclusion( const in vec3 centerPosition ) {","vec3 centerNormal = getViewNormal( vUv );","float screenOcclusionRadius = 200. * saoData.z * saoData.x / -centerPosition.z;","if( screenOcclusionRadius < 1. ) {","discard;","}","float random = rand( vUv );","float randomAngle = random * PI2 + 2. * PI2 * (saoData.w - 1.0);","float cosAngle = cos(randomAngle); float sinAngle = sin(randomAngle);","mat2 randomRotationMatrix = mat2(cosAngle, sinAngle, -sinAngle, cosAngle);","float occlusionSum = 0.0;","for( int i = 0; i < SAMPLES_PER_FRAME; i ++ ) {","vec2 randomSample = randomRotationMatrix * (quasiRandomSamples[i] - vec2(0.5)) * screenOcclusionRadius/size;","vec2 sampleUv = vUv + randomSample;","float sampleDepthNDC = decodeDepth( sampleUv );","if( sampleDepthNDC >= ( 1.0 - EPSILON ) ) {","continue;","}","#if LINEAR_DEPTH == 0","float sampleViewDepth = getViewDepth( sampleDepthNDC );","vec3 samplePosition = getViewPositionFromViewZ( sampleUv, sampleViewDepth );","#else","sampleDepthNDC = mix(-cameraNearFar.x, -cameraNearFar.y, sampleDepthNDC);","vec3 samplePosition = getViewPositionFromViewZ(sampleUv, sampleDepthNDC);","#endif","float occlusion = getOcclusionFromPositionNormal( centerPosition, centerNormal, samplePosition );","occlusionSum += occlusion;","}","float occlusion = occlusionSum * saoData.y * 2.0 / f_sampleCount;","return vec4(clamp(occlusion,0., 1.));","}","void main() {","float centerDepth = decodeDepth( vUv );","if( centerDepth >= ( 1.0 - EPSILON ) ) {","discard;","}","#if LINEAR_DEPTH == 0","float centerViewDepth = getViewDepth( centerDepth );","#else","float centerViewDepth = mix(-cameraNearFar.x, -cameraNearFar.y, centerDepth);","#endif","vec3 viewPosition = getViewPositionFromViewZ(vUv, centerViewDepth);","float occlusion = getOcclusion( viewPosition ).r;","float prevOcclusionSum = texture2D(tAOSumPrevious, vUv).r;","float finalOcclusion = mix(prevOcclusionSum, occlusion, 1./saoData.w);","gl_FragColor.gba = packFloatToRGB( centerDepth );","gl_FragColor.r = clamp(finalOcclusion, 0., 1.);","}"].join("\n")}},function(e,t,i){i(0),i(19);const s=new THREE.Vector2;e.exports=PIXOTRON.SAOPass=class{constructor(e){e=e||{},this.intensity=void 0!==e.intensity?e.intensity:.25,this.occlusionWorldRadius=void 0!==e.occlusionWorldRadius?e.occlusionWorldRadius:.8,this.bias=void 0!==e.bias?e.bias:.001,this.Ne=void 0!==e.downscaleLevel?e.downscaleLevel:1,this.Ne=this.Ne<1?1:this.Ne,this.falloff=void 0!==e.falloff?e.falloff:1,this.blurEnabled=!0,this.edgeSharpness=1,this.debug=!1,this.enabled=!0,this.needsUpdate=!0,this.be=new THREE.ShaderMaterial(PIXOTRON.SAOShader),this.be.uniforms=THREE.UniformsUtils.clone(this.be.uniforms),this.be.defines=Object.assign({},this.be.defines),this.C=0,this.K=0,this.oldClearColor=new THREE.Color}dispose(){this.Ce&&(this.Ce.dispose(),this.Ce=null,this.be.dispose())}getTotalRenderTime(){return this.K}setDownscaleLevel(e){this.Ne=e||1,this.Ne=this.Ne<1?1:this.Ne,this.needsUpdate=!0}setSize(e,t){this.Ce&&this.Ce.setSize(e,t),this.be.uniforms.size.value.set(e,t)}convergenceMetric(){return this.enabled?this.C>1?1:0:1}render(e,t,i,a){if(!this.enabled)return;this.needsUpdate&&(this.C=0,this.needsUpdate=!1),this.Ce||this.X(e),e.getDrawingBufferSize(s);const r=s.x/this.Ne,o=s.y/this.Ne;this.be.uniforms.size.value.set(r,o),this.Ie(r,o),this.ze(t,i),e.getClearColor(this.oldClearColor);const n=e.getClearAlpha(),l=e.autoClear;e.autoClear=!1,this.K=0,this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),PIXOTRON.renderPass(e,this.be,this.Ce);const h=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"SAO Render"});if(h&&(this.K+=h),this.blurEnabled){this.blurQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.blurQueryId),a.edgeSharpness=this.edgeSharpness,a.render(e,this.Ce,t,i);const s=this.debug&&PIXOTRON.endPerformanceTest(this.blurQueryId,{callback:this.debugCallback,name:"SAO Blur"});s&&(this.K+=s)}e.autoClear=l,e.setClearColor(this.oldClearColor),e.setClearAlpha(n),e.saoBuffer=this.Ce}X(e){e.getDrawingBufferSize(s);const t=s.x/this.Ne,i=s.y/this.Ne;if(!this.Ce){const e={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.Ce=new THREE.WebGLRenderTarget(t,i,e)}}Ie(e,t){(this.Ce.width!==e||this.Ce.height!==t)&&this.Ce.setSize(e,t)}ze(e,t){const i=1/(2*Math.tan(THREE.MathUtils.DEG2RAD*e.fov/2)),s=this.be.uniforms.saoData.value;s.x=i,s.y=this.intensity,s.z=this.occlusionWorldRadius,s.w=this.C++;const a=this.be.uniforms.saoBiasEpsilon.value;a.x=this.bias,a.y=.001,a.z=this.falloff;const r=this.be.uniforms.cameraNearFar.value;let o;r.x=e.near,r.y=e.far,this.be.uniforms.ProjectionMatrix.value=e.projectionMatrix,o=t.Nt?t.Nt:t.we?t.we.texture:null;const n=t.Re?t.Re.texture:null;let l;t.we||(l=t.Ee?t.Ee.texture:null);let h=t.Nt?0:1;t.forceDepthAndNormalPass&&t.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(h=2),this.be.defines.DEPTH_PACKING_MODE=h,this.be.defines.DEPTH_NORMAL_TEXTURE=l?1:0,this.be.defines.LINEAR_DEPTH=t.fe?1:0,l?this.be.uniforms.tNormalDepth.value=l:(this.be.uniforms.tNormal.value=n,this.be.uniforms.tDepth.value=o)}}},function(e,t){e.exports=PIXOTRON.SAOShader={defines:{NUM_SAMPLES:11,NUM_SPIRAL_TURNS:3,DEPTH_NORMAL_TEXTURE:0,DEPTH_PACKING_MODE:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{type:"t",value:null},tNormal:{type:"t",value:null},tNormalDepth:{type:"t",value:null},cameraNearFar:{type:"v2",value:new THREE.Vector2},saoData:{type:"v4",value:new THREE.Vector4},size:{type:"v2",value:new THREE.Vector2(512,512)},ProjectionMatrix:{type:"m4",value:new THREE.Matrix4},saoBiasEpsilon:{type:"v3",value:new THREE.Vector3(1,1,1)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","varying vec2 vUv;","uniform sampler2D tDepth;","#if DEPTH_NORMAL_TEXTURE == 1","uniform sampler2D tNormalDepth;","#else","uniform sampler2D tNormal;","#endif","uniform vec2 cameraNearFar;","uniform mat4 ProjectionMatrix;","uniform vec4 saoData;","uniform vec3 saoBiasEpsilon;","uniform vec2 size;","#include <utilshader>","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getViewZFromNDCZ( const in float depth ) {","#if PERSPECTIVE_CAMERA == 1","return perspectiveDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );","#else","return orthographicDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );","#endif","}","vec3 getViewPositionFromViewZ(const in vec2 uv, const in float viewDepth) {","vec2 uv_ = 2. * uv - 1.;","float xe = -(uv_.x + ProjectionMatrix[2][0]) * viewDepth/ProjectionMatrix[0][0];","float ye = -(uv_.y + ProjectionMatrix[2][1]) * viewDepth/ProjectionMatrix[1][1];","return vec3(xe, ye, viewDepth);","}","float random3(vec3 v) { ","v = fract(v * 443.8975);","v += dot(v, v.yzx + 19.19);","return fract((v.x + v.y) * v.z);","}","vec3 getPositionFromOffset(const in vec2 uv, const in vec2 offset, const in float screenSpaceRadius) {","vec2 uvOffset = uv + floor(screenSpaceRadius * offset)/size;","float d = decodeDepth(uvOffset);","#if LINEAR_DEPTH == 0","float centerViewZ = getViewZFromNDCZ( d );","return getViewPositionFromViewZ( uvOffset, centerViewZ );","#else","d = mix(-cameraNearFar.x, -cameraNearFar.y, d);","return getViewPositionFromViewZ(uvOffset, d);","#endif","}","float getOcclusion(const in vec2 uv, const in int id, const in float randomAngle, const in float occlusionSphereRadius, const in vec3 centerPosition, const in vec3 centerNormal) {","float screenSpaceRadius = (float(id) + mod(randomAngle, 1.) + 0.5) * INV_NUM_SAMPLES; ","float angle = screenSpaceRadius * (float(NUM_SPIRAL_TURNS) * 6.28) + randomAngle; ","screenSpaceRadius = (screenSpaceRadius * occlusionSphereRadius);","vec2 offset = vec2(cos(angle), sin(angle));","vec3 samplePosition = getPositionFromOffset(uv, offset, screenSpaceRadius);","vec3 direction = samplePosition - centerPosition;","float d2 = dot( direction, direction );","float ao = max( ( dot( centerNormal, direction ) + centerPosition.z * saoBiasEpsilon.x ) / ( saoBiasEpsilon.z * d2 + saoBiasEpsilon.y ), 0.0 );","return ao;","}","void main() {","float centerDepth = decodeDepth( vUv );","if( centerDepth >= ( 1.0 - EPSILON ) ) {","discard;","}","#if LINEAR_DEPTH == 0","float centerViewZ = getViewZFromNDCZ( centerDepth );","#else","float centerViewZ = mix(-cameraNearFar.x, -cameraNearFar.y, centerDepth);","#endif","vec3 centerPosition = getViewPositionFromViewZ( vUv, centerViewZ );","vec3 centerNormal = getViewNormal(vUv);","float occlusionSphereScreenRadius = 200. * saoData.z/ (-centerPosition.z);","if( occlusionSphereScreenRadius < 1. ) {","discard;","}","float randomAngle = 6.2 * random3( vec3( vUv, saoData.w * 0.1 ) );","float sum = 0.0;","sum += getOcclusion(vUv, 0, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 1, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 2, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 3, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 4, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 5, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 6, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 7, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 8, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 9, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","sum += getOcclusion(vUv, 10, randomAngle, occlusionSphereScreenRadius, centerPosition, centerNormal);","float aoValue = sum * saoData.y * INV_NUM_SAMPLES;","gl_FragColor.gba = packFloatToRGB( centerDepth );","gl_FragColor.r = max( aoValue, 0.0 );","}"].join("\n")}},function(e,t,i){i(0),i(2),i(21);const s=new THREE.Vector2;function a(e,t){e.traverse((function(e){(e.isMesh||e.isLineSegments||e.isLine||e.isLineLoop||e.isPoints)&&((t?e.castShadow:e.receiveShadow)||(e.oldVisibility=e.visible,e.visible=!1))}))}function r(e){e.traverse((function(e){e.oldVisibility&&(e.visible=e.oldVisibility,e.oldVisibility=void 0)}))}e.exports=PIXOTRON.ShadowPass=class{constructor(e){e=e||{},this.linearDepth=void 0!==e.linearDepth?e.linearDepth:1,this.shadowMapResolution=void 0!==e.shadowMapResolution?e.shadowMapResolution:1024,this.shadowRadius=void 0!==e.shadowRadius?e.shadowRadius:1,this.shadowQuality=void 0!==e.shadowQuality?e.shadowQuality:1,this.smoothTransition=void 0===e.smoothTransition||e.smoothTransition,this.shadowBiasMultiplier=void 0!==e.shadowBiasMultiplier?e.shadowBiasMultiplier:1,this.numSamples=void 0!==e.numSamples?e.numSamples:100,this.side=void 0!==e.side?e.side:THREE.FrontSide,this.Ne=void 0!==e.downscaleLevel?e.downscaleLevel:1,this.Ne=this.Ne<1?1:this.Ne;const t=void 0!==e.nearPlane?e.nearPlane:.1,i=void 0!==e.farPlane?e.farPlane:10,s=void 0!==e.fov?e.fov:110;this.Ue=new THREE.PerspectiveCamera(s,1,t,i),this.De=0,this.Ve(this.numSamples),this.C=0,this.Le=0,this.Be=new THREE.Vector3,this.ke=new THREE.Vector3(0,-1,0),this.We=new THREE.Vector3,this.je=new THREE.Matrix4,this.lights=[],this.enabled=!0,this.enableAccumulation=!0,this.needsUpdate=!0,this.shadowRecieverBBox=null,this.debug=!1,this.K=0,this.oldClearColor=new THREE.Color}convergenceMetric(){if(!this.enabled)return 1;let e=0;return this.lights.forEach(t=>{t.castShadow&&e++}),0!==e?this.C/(e*this.Ze.length):1}dispose(){this.Ge&&(this.Ge.dispose(),this.Qe.dispose(),this.qe.dispose(),this.Ke.dispose(),this.pe.dispose()),this.Je&&this.Je.dispose(),this.Se&&this.Se.dispose()}getTotalRenderTime(){return this.K}render(e,t,i){if(this.needsUpdate&&(this.C=0,this.Le=0,this.needsUpdate=!1,this.lights.forEach(e=>{e.C=0})),!this.enableAccumulation&&this.C>0)return;if(this.convergenceMetric()>=1)return;e.getDrawingBufferSize(s);const a=s.x/this.Ne,r=s.y/this.Ne;this.Ge||(this.Ue.layers.mask=i.layers.mask,this.Ye(a,r)),this.$e(a,r),this.Ve(this.numSamples),e.getClearColor(this.oldClearColor);const o=e.getClearAlpha(),n=e.autoClear;let l,h;if(this.K=0,this.lights.forEach(s=>{this.C=Math.min(this.C,this.lights.length*this.Ze.length),this.C++,s.C++,this.Le+=s.intensity,this.ti(s),this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),this.ei(e,t,this.Be,this.Ge),l=this.C%2==0?this.Qe:this.qe,h=this.C%2==0?this.qe:this.Qe,this.ii(e,t,i,l,h,s),this.smoothTransition&&this.C===this.lights.length&&PIXOTRON.blit(e,h.texture,this.Ke);const a=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"Shadow Pass"});a&&(this.K+=a)}),this.smoothTransition){this.smoothTransitionQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.smoothTransitionQueryId),this.Se.uniforms.shadowAccumulationBuffer.value=h.texture,this.Se.uniforms.firstFrameShadowBuffer.value=this.Ke.texture,this.Se.uniforms.transition.value=this.convergenceMetric(),PIXOTRON.renderPass(e,this.Se,l);const t=this.debug&&PIXOTRON.endPerformanceTest(this.smoothTransitionQueryId,{callback:this.debugCallback,name:"Shadow Transition"});t&&(this.K+=t)}e.autoClear=n,e.setClearColor(this.oldClearColor),e.setClearAlpha(o),this.lights.forEach(e=>{e.shadow.map=this.smoothTransition?l:h})}setDownscaleLevel(e){this.Ne=e||1,this.Ne=this.Ne<1?1:this.Ne,this.needsUpdate=!0}setSize(e,t){this.Qe&&this.Qe.setSize(e,t),this.qe&&this.qe.setSize(e,t),this.Ge&&this.Ge.setSize(e,t),this.Ke&&this.Ke.setSize(e,t),this.Je&&this.Je.uniforms.shadowBufferSize.value.set(e,t)}$e(e,t){(this.Qe.width!==e||this.Qe.height!==t)&&(this.Qe.setSize(e,t),this.qe.setSize(e,t),this.Ke.setSize(e,t),this.Je.uniforms.shadowBufferSize.value=new THREE.Vector2(e,t))}Ye(e,t){const i={format:THREE.RGBAFormat,minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter};this.Ge=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,i),this.Qe=new THREE.WebGLRenderTarget(e,t,i),this.qe=new THREE.WebGLRenderTarget(e,t,i),this.Ke=new THREE.WebGLRenderTarget(e,t,i),this.Ge.texture.generateMipmaps=!1,this.Qe.texture.generateMipmaps=!1,this.qe.texture.generateMipmaps=!1,this.Ke.texture.generateMipmaps=!1,this.linearDepth?(this.pe=new THREE.ShaderMaterial(PIXOTRON.PackingShader_Depth32),this.pe.uniforms=THREE.UniformsUtils.clone(this.pe.uniforms),this.pe.side=this.side):this.pe=new THREE.MeshDepthMaterial({depthPacking:THREE.RGBADepthPacking,side:this.side}),this.Je=new THREE.ShaderMaterial(PIXOTRON.AccumulativeShadowsShader),this.Je.uniforms=THREE.UniformsUtils.clone(this.Je.uniforms),this.Je.uniforms.shadowBufferSize.value=new THREE.Vector2(e,t),this.Je.uniforms.shadowMap.value=this.Ge.texture,this.Je.uniforms.shadowData.value=new THREE.Vector4(0,1,1,1),this.Je.uniforms.shadowMapResolution.value=new THREE.Vector2(this.shadowMapResolution,this.shadowMapResolution),this.Je.defines.SHADOW_QUALITY=this.shadowQuality,this.Je.defines.LINEAR_DEPTH=this.linearDepth,this.Se=new THREE.ShaderMaterial(PIXOTRON.SmoothTransitionShadowShader),this.Se.uniforms=THREE.UniformsUtils.clone(this.Se.uniforms)}ii(e,t,i,s,o,n){this.Ue.matrixWorldInverse.copy(this.Ue.matrixWorld).invert(),this.je.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.je.multiply(this.Ue.projectionMatrix),this.je.multiply(this.Ue.matrixWorldInverse),this.Je.uniforms.shadowMatrix.value.copy(this.je),this.Je.uniforms.shadowData.value.x=this.Le,this.Je.uniforms.shadowData.value.y=this.shadowRadius,this.Je.uniforms.shadowData.value.z=this.shadowBiasMultiplier,this.Je.uniforms.shadowData.value.w=n.intensity,this.Je.uniforms.shadowAccumulationBuffer.value=s.texture,this.Je.uniforms.vplPosition.value=this.Ue.position,this.Je.uniforms.cameraNearFar.value.x=this.Ue.near,this.Je.uniforms.cameraNearFar.value.y=this.Ue.far,e.setClearColor(0),a(t,!1);const l=e.shadowMap.enabled;e.shadowMap.enabled=!1,t.overrideMaterial=this.Je,e.setRenderTarget(o),e.clear(!0,!0,!1),e.render(t,i),e.setRenderTarget(null),t.overrideMaterial=null,r(t),e.shadowMap.enabled=l}ei(e,t,i,s){a(t,!0),this.Ue.position.copy(i),this.We.copy(i),this.We.addScaledVector(this.ke,10),this.Ue.lookAt(this.We),this.Ue.updateMatrixWorld(),t.overrideMaterial=this.pe,this.linearDepth&&(this.pe.uniforms.cameraNearFar.value.x=this.Ue.near,this.pe.uniforms.cameraNearFar.value.y=this.Ue.far),e.setClearColor(0),e.setRenderTarget(s),e.clear(!0,!0,!1),e.render(t,this.Ue),e.setRenderTarget(null),t.overrideMaterial=null,r(t)}ti(e){let t=e.C-1;const i=e.matrixWorld;t%=this.Ze.length-1;const s=this.Ze[t];if(this.Be.x=(s.x-.5)*e.width,this.Be.z=0,this.Be.y=(s.y-.5)*e.height,this.Be.applyMatrix4(i),this.ke.set(0,0,-1),this.ke.transformDirection(i),this.shadowRecieverBBox){const e=PIXOTRON.calculateFOV(this.shadowRecieverBBox,this.Be,this.ke);this.setFOV(e)}}setShadowRecieverBBox(e){this.shadowRecieverBBox=e}setFOV(e){this.Ue.fov=e,this.Ue.updateProjectionMatrix()}Ve(e){e!==this.De&&(this.De=e,this.Ze=PIXOTRON.generateQuasiRandomPoints(e,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle),this.Ze=PIXOTRON.randomizeArray(this.Ze),this.Ze.splice(0,0,new THREE.Vector2(.5,.5)))}}},function(e,t){e.exports=PIXOTRON.AccumulativeShadowsShader={defines:{SHADOW_QUALITY:1,LINEAR_DEPTH:1},uniforms:{shadowMap:{value:null},shadowAccumulationBuffer:{value:null},shadowBufferSize:{value:null},shadowMatrix:{value:new THREE.Matrix4},vplPosition:{value:new THREE.Vector3},shadowData:{value:new THREE.Vector4},cameraNearFar:{value:new THREE.Vector2},shadowMapResolution:{value:null},normalBias:{value:1}},vertexShader:["varying vec3 viewNormal;","varying vec3 lightVector;","varying vec4 shadowCoord;","uniform vec3 vplPosition;","uniform mat4 shadowMatrix;","uniform float normalBias;","void main() {","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","viewNormal = normalize(normalMatrix * normal);","vec3 vplPositionEyeSpace = (viewMatrix * vec4(vplPosition, 1.0)).xyz;","lightVector = vplPositionEyeSpace - (modelViewMatrix * vec4( position, 1.0 )).xyz;","lightVector = normalize(lightVector);","shadowCoord = shadowMatrix * worldPosition;","float nDotL = clamp( dot(lightVector, viewNormal), 0.0, 1.0);","worldPosition.xyz += normalize((modelMatrix * vec4( normal, 0.0 )).xyz) * 0.02 * normalBias * pow( 1.0 - nDotL * nDotL, 4.);","shadowCoord.xy = (shadowMatrix * worldPosition).xy;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","varying vec3 viewNormal;","varying vec3 lightVector;","varying vec4 shadowCoord;","uniform vec2 shadowBufferSize;","uniform vec2 shadowMapResolution;","uniform sampler2D shadowMap;","uniform sampler2D shadowAccumulationBuffer;","uniform vec4 shadowData;","uniform vec2 cameraNearFar;","float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {","#if LINEAR_DEPTH == 0","float shadowDepth = unpackRGBAToDepth( texture2D( depths, uv ) );","#else","float nDotL = clamp( dot(normalize(lightVector), normalize(viewNormal)), 0.0, 1.0);","float shadowDepth = pow2(unpackRGBAToDepth(texture2D( depths, uv ))) + 0.01 * shadowData.z;","shadowDepth = shadowDepth * ( cameraNearFar.y - cameraNearFar.x ) + cameraNearFar.x;","#endif","return step( compare, shadowDepth );","}","float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {","const vec2 offset = vec2( 0.0, 1.0 );","vec2 texelSize = vec2( 1.0 ) / size;","vec2 centroidUV = floor( uv * size + 0.5 ) / size;","float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );","float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );","float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );","float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );","vec2 f = fract( uv * size + 0.5 );","float a = mix( lb, lt, f.y );","float b = mix( rb, rt, f.y );","float c = mix( a, b, f.x );","return c;","}","void main() {","float shadowValue = 1.0;","float shadowRadius = shadowData.y;","float shadowBiasMultiplier = shadowData.z;","float nDotL = clamp( dot(lightVector, normalize(viewNormal)), 0.0, 1.0);","float shadowBias = 0.02 * sqrt( 1.0 - nDotL * nDotL) / clamp(nDotL, 0.0006, 1.0);","shadowBias = clamp(shadowBias, 0.0001, 0.0003) * shadowBiasMultiplier;","vec3 shadowCoordNDC = shadowCoord.xyz/shadowCoord.w;","shadowCoordNDC.z -= shadowBias;","#if LINEAR_DEPTH == 1","float linearDepth = shadowCoord.z + 2.0*cameraNearFar.y*cameraNearFar.x/(cameraNearFar.y - cameraNearFar.x);","linearDepth *= -((cameraNearFar.y - cameraNearFar.x)/(cameraNearFar.y + cameraNearFar.x));","linearDepth = -linearDepth;","#endif","bvec4 inFrustumVec = bvec4 ( shadowCoordNDC.x >= 0.0, shadowCoordNDC.x <= 1.0, shadowCoordNDC.y >= 0.0, shadowCoordNDC.y <= 1.0 );","bool inFrustum = all( inFrustumVec );","bvec2 frustumTestVec = bvec2( inFrustum, shadowCoordNDC.z <= 1.0 );","bool frustumTest = all( frustumTestVec );","#if LINEAR_DEPTH == 1","shadowCoordNDC.z = linearDepth;","#endif","if(frustumTest) {","#if SHADOW_QUALITY == 0","shadowValue = texture2DCompare(shadowMap, shadowCoordNDC.xy, shadowCoordNDC.z);","#elif SHADOW_QUALITY == 1","vec2 texelSize = vec2( 1.0 ) / shadowMapResolution;","float dx0 = - texelSize.x * shadowRadius;","float dy0 = - texelSize.y * shadowRadius;","float dx1 = + texelSize.x * shadowRadius;","float dy1 = + texelSize.y * shadowRadius;","float theta = rand( shadowCoord.xy ) * PI2;","float snTheta = sin(theta);","float csTheta = cos(theta);","mat2 randomRotationMatrix = mat2(csTheta, snTheta, -snTheta, csTheta);","shadowValue = (","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, 0.0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy, shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, 0.0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy1 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy1 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy1 ), shadowCoordNDC.z )",") * ( 1.0 / 9.0 );","#elif SHADOW_QUALITY == 2","vec2 texelSize = vec2( 1.0 ) / shadowMapResolution;","float dx0 = - texelSize.x * shadowRadius;","float dy0 = - texelSize.y * shadowRadius;","float dx1 = + texelSize.x * shadowRadius;","float dy1 = + texelSize.y * shadowRadius;","float theta = rand( shadowCoord.xy ) * PI2;","float snTheta = sin(theta);","float csTheta = cos(theta);","mat2 randomRotationMatrix = mat2(csTheta, snTheta, -snTheta, csTheta);","shadowValue = ( ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, 0.0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy, shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, 0.0 ), shadowCoordNDC.z ) +","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy1 ), shadowCoordNDC.z ) +","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy1 ), shadowCoordNDC.z ) +","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy1 ), shadowCoordNDC.z )",") * ( 1.0 / 9.0 );","#endif","}","float previousAccumulation = unpackRGBAToDepth(texture2D( shadowAccumulationBuffer, gl_FragCoord.xy/shadowBufferSize ));","float t = shadowData.w/shadowData.x;","float shadowAccumulation = mix(previousAccumulation, shadowValue, t);","gl_FragColor = packDepthToRGBA(shadowAccumulation);","}"].join("\n")}},function(e,t,i){i(0),i(2),i(23),i(24),e.exports=PIXOTRON.PlaneShadowBakePass=class{constructor(e){e=e||{},this.linearDepth=void 0!==e.linearDepth?e.linearDepth:1,this.shadowMapResolution=void 0!==e.shadowMapResolution?e.shadowMapResolution:1024,this.shadowRadius=void 0!==e.shadowRadius?e.shadowRadius:1,this.shadowQuality=void 0!==e.shadowQuality?e.shadowQuality:1,this.smoothTransition=void 0===e.smoothTransition||e.smoothTransition,this.shadowBiasMultiplier=void 0!==e.shadowBiasMultiplier?e.shadowBiasMultiplier:1,this.numSamples=void 0!==e.numSamples?e.numSamples:2e3,this.numSamplesPerFrame=void 0!==e.numSamplesPerFrame?e.numSamplesPerFrame:2,this.darkness=void 0!==e.darkness?e.darkness:1,this.falloff=void 0!==e.falloff?e.falloff:2,this.size=void 0!==e.size?e.size:1,this.lightDirection=e.lightDirection?e.lightDirection:new THREE.Vector3(0,1,0),this.lightSolidAngle=e.lightSolidAngle?e.lightSolidAngle:45,this.onComplete=e.onComplete,this.onProgress=e.onProgress,this.enable=void 0===e.enable||e.enable,this.si=void 0===e.enableBlur||e.enableBlur;const t=void 0===e.bShadowMaterial||e.bShadowMaterial,i=void 0!==e.nearPlane?e.nearPlane:.1,s=void 0!==e.farPlane?e.farPlane:10;this.Ue=new THREE.OrthographicCamera(-3,3,3,-3,i,s),this.boundingRadius=10,this.De=0,this.Ve(this.numSamples),this.C=0,this.Be=new THREE.Vector3,this.ke=new THREE.Vector3(0,-1,0),this.We=new THREE.Vector3,this.je=new THREE.Matrix4,this.needsUpdate=!0,this.oi=new THREE.Mesh(new THREE.PlaneBufferGeometry(1,1),new THREE.MeshBasicMaterial({color:16777215})),this.oi.rotation.x=-Math.PI/2,this.oi.receiveShadow=!0,this.ai=new THREE.Scene,this.ai.add(this.oi);const a=t?new THREE.MeshBasicMaterial({color:16777215,transparent:!0}):new THREE.MeshStandardMaterial({roughness:1,metalness:0});this.ni=new THREE.Mesh(new THREE.PlaneBufferGeometry(1,1),a);const r=this.ni.geometry.attributes.uv.array;this.ni.geometry.setAttribute("uv2",new THREE.BufferAttribute(r,2)),this.ni.rotation.x=-Math.PI/2,this.ni.receiveShadow=!0,this.oldClearColor=new THREE.Color}convergenceMetric(){return this.C/this.Ze.length}dispose(){this.Ge.dispose(),this.Qe.dispose(),this.qe.dispose(),this.ni.geometry.dispose()}getShadowPlane(){return this.ni}hi(e){e.updateMatrixWorld(),this.ri=new THREE.Box3,e.traverse(e=>{e.isMesh&&e.castShadow&&this.ri.expandByObject(e)});const t=new THREE.Sphere;this.ri.getBoundingSphere(t);const i=2.5*t.radius*this.size;if(0===i)return;this.oi.scale.set(i,i,i);const s=new THREE.Vector3;this.ri.getCenter(s),this.oi.position.set(s.x,this.ri.min.y,s.z),this.ni.position.set(s.x,this.ri.min.y,s.z),this.ni.scale.copy(this.oi.scale),this.boundingRadius=2*t.radius,this.Ue.left=-t.radius,this.Ue.right=t.radius,this.Ue.bottom=-t.radius,this.Ue.top=t.radius,this.Ue.far=this.boundingRadius+10,this.Ue.updateProjectionMatrix(),this.needsUpdate=!0}startBake(e,t,i){this.li&&cancelAnimationFrame(this.li),this.needsUpdate=!0;const s=()=>{this.ci(e,t,i),this.li=requestAnimationFrame(s),this.convergenceMetric()>=1&&(this.onComplete&&this.onComplete(this.ni),cancelAnimationFrame(this.li))};this.li=requestAnimationFrame(s)}ci(e,t,i){if(!this.enable)return;if(this.needsUpdate&&(this.hi(t),this.C=0,this.needsUpdate=!1),this.onProgress){const e=this.convergenceMetric();this.onProgress(e)}this.Ge||(this.Ue.layers.mask=i.layers.mask,this.Ye()),this.Ve(this.numSamples),e.getClearColor(this.oldClearColor);const s=e.getClearAlpha(),a=e.autoClear;let r,o;for(let s=0;s<this.numSamplesPerFrame;s++)this.C=Math.min(this.C,this.Ze.length-1),this.C++,this.ui(),this.ei(e,t,this.Be,this.Ge),r=this.C%2==0?this.Qe:this.qe,o=this.C%2==0?this.qe:this.Qe,this.ii(e,t,i,r,o);this.si&&this.di(e,o,r),this.Se.uniforms.shadowAccumulationBuffer.value=o,this.Se.uniforms.transition.value=this.smoothTransition?this.convergenceMetric():1;const n=this.Se.uniforms.shadowData.value;n.x=this.ni.material.isMeshBasicMaterial?1-this.darkness:this.darkness,n.y=this.falloff,PIXOTRON.renderPass(e,this.Se,r),e.autoClear=a,e.setClearColor(this.oldClearColor),e.setClearAlpha(s),this.ni.material.isMeshBasicMaterial?this.ni.material.map=r.texture:this.ni.material.aoMap=r.texture}setSize(e,t){this.Qe&&this.Qe.setSize(e,t),this.qe&&this.qe.setSize(e,t),this.Ge&&this.Ge.setSize(e,t),this.Je.uniforms.shadowBufferSize.value.set(e,t)}di(e,t,i){this.vi||(this.vi=new THREE.ShaderMaterial(PIXOTRON.BlurShader)),this.vi.uniforms.tDiffuse.value=t,this.vi.uniforms.direction.value=new THREE.Vector3(1,0),this.vi.uniforms.size.value.x=i.width,this.vi.uniforms.size.value.y=i.height,PIXOTRON.renderPass(e,this.vi,i),this.vi.uniforms.tDiffuse.value=i,this.vi.uniforms.direction.value=new THREE.Vector3(0,1),this.vi.uniforms.size.value.x=i.width,this.vi.uniforms.size.value.y=i.height,PIXOTRON.renderPass(e,this.vi,t)}Ye(){const e={format:THREE.RGBAFormat,minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter};this.Ge=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,e),this.Qe=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,e),this.qe=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,e),this.Ge.texture.generateMipmaps=!1,this.Qe.texture.generateMipmaps=!1,this.qe.texture.generateMipmaps=!1,this.linearDepth?(this.pe=new THREE.ShaderMaterial(PIXOTRON.PackingShader_Depth32),this.pe.uniforms=THREE.UniformsUtils.clone(this.pe.uniforms)):this.pe=new THREE.MeshDepthMaterial({depthPacking:THREE.RGBADepthPacking}),this.Je=new THREE.ShaderMaterial(PIXOTRON.SoftShadowPlaneShader),this.Je.uniforms=THREE.UniformsUtils.clone(this.Je.uniforms),this.Je.uniforms.shadowBufferSize.value=new THREE.Vector2(this.shadowMapResolution,this.shadowMapResolution),this.Je.uniforms.shadowMap.value=this.Ge,this.Je.uniforms.shadowData.value=new THREE.Vector4(0,1,1,1),this.Je.uniforms.shadowMapResolution.value=new THREE.Vector2(this.shadowMapResolution,this.shadowMapResolution),this.Je.defines.SHADOW_QUALITY=this.shadowQuality,this.Je.defines.LINEAR_DEPTH=this.linearDepth,this.Se=new THREE.ShaderMaterial(PIXOTRON.SmoothTransitionSoftShadowShadowShader),this.Se.defines.SHADOW_MATERIAL=this.ni.material.isMeshBasicMaterial?1:0,this.Se.uniforms=THREE.UniformsUtils.clone(this.Se.uniforms)}ii(e,t,i,s,a){this.Ue.matrixWorldInverse.copy(this.Ue.matrixWorld).invert(),this.je.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.je.multiply(this.Ue.projectionMatrix),this.je.multiply(this.Ue.matrixWorldInverse),this.Je.uniforms.shadowMatrix.value.copy(this.je),this.Je.uniforms.shadowData.value.x=this.C,this.Je.uniforms.shadowData.value.y=this.shadowRadius,this.Je.uniforms.shadowData.value.z=this.shadowBiasMultiplier,this.Je.uniforms.shadowAccumulationBuffer.value=s,this.Je.uniforms.vplPosition.value=this.Ue.position,this.Je.uniforms.cameraNearFar.value.x=this.Ue.near,this.Je.uniforms.cameraNearFar.value.y=this.Ue.far,this.Je.uniforms.lightVector.value.x=-this.ke.x,this.Je.uniforms.lightVector.value.y=-this.ke.y,this.Je.uniforms.lightVector.value.z=-this.ke.z,this.Je.uniforms.weightSum.value=1/this.Ze.length,e.setClearColor(0);const r=e.shadowMap.enabled;e.shadowMap.enabled=!1,this.ai.overrideMaterial=this.Je,e.setRenderTarget(a),e.clear(!0,!0,!1),e.render(this.ai,i),e.setRenderTarget(null),this.ai.overrideMaterial=null,e.shadowMap.enabled=r}ei(e,t,i,s){!function(e,t){e.traverse((function(e){(e.isMesh||e.isLineSegments||e.isLine||e.isLineLoop||e.isPoints)&&(e.castShadow||(e.oldVisibility=e.visible,e.visible=!1))}))}(t),this.Ue.position.copy(i),this.We.copy(i),this.We.addScaledVector(this.ke,10),this.Ue.lookAt(this.We),this.Ue.updateMatrixWorld(),t.overrideMaterial=this.pe,this.linearDepth&&(this.pe.uniforms.cameraNearFar.value.x=this.Ue.near,this.pe.uniforms.cameraNearFar.value.y=this.Ue.far),e.setClearColor(0),e.setRenderTarget(s),e.clear(!0,!0,!1),e.render(t,this.Ue),e.setRenderTarget(null),t.overrideMaterial=null,function(e){e.traverse((function(e){e.oldVisibility&&(e.visible=e.oldVisibility,e.oldVisibility=void 0)}))}(t)}sampleUniformCone(e,t,i){const s=1-e.x+e.x*t,a=Math.sqrt(1-s*s),r=2*e.y*Math.PI;i.x=Math.cos(r)*a,i.y=Math.sin(r)*a,i.z=s}ui(){const e=this.boundingRadius,t=this.Ze[this.C-1];let i=this.lightSolidAngle>45?45:this.lightSolidAngle;i=this.lightSolidAngle<0?0:i;const s=Math.cos(i*Math.PI/180);this.sampleUniformCone(t,s,this.ke),this.ke.multiplyScalar(-1),this.ke.normalize();const a=new THREE.Matrix4;this.lightDirection.normalize(),a.lookAt(this.lightDirection,new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0)),this.ke.transformDirection(a),this.ke.normalize();const r=new THREE.Vector3(-e*this.ke.x,-e*this.ke.y,-e*this.ke.z);this.Be.copy(r),this.Be.add(this.oi.position)}Ve(e){e!==this.De&&(this.De=e,this.Ze=PIXOTRON.generateQuasiRandomPoints(e,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectngle),this.Ze=PIXOTRON.randomizeArray(this.Ze))}}},function(e,t){e.exports=PIXOTRON.SoftShadowPlaneShader={defines:{SHADOW_QUALITY:0,LINEAR_DEPTH:1},uniforms:{shadowMap:{value:null},shadowAccumulationBuffer:{value:null},shadowBufferSize:{value:null},shadowMatrix:{value:new THREE.Matrix4},vplPosition:{value:new THREE.Vector3},lightVector:{value:new THREE.Vector3},shadowData:{value:new THREE.Vector4},cameraNearFar:{value:new THREE.Vector2},shadowMapResolution:{value:null},normalBias:{value:1},weightSum:{value:0}},vertexShader:["varying vec3 viewNormal;","varying vec4 shadowCoord;","uniform vec3 vplPosition;","uniform mat4 shadowMatrix;","uniform float normalBias;","void main() {","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","viewNormal = normalize(normalMatrix * normal);","vec3 vplPositionEyeSpace = (viewMatrix * vec4(vplPosition, 1.0)).xyz;","//lightVector = vplPositionEyeSpace - (modelViewMatrix * vec4( position, 1.0 )).xyz;","//lightVector = normalize(lightVector);","shadowCoord = shadowMatrix * worldPosition;","// nDotL = clamp( dot(lightVector, viewNormal), 0.0, 1.0);","//worldPosition.xyz += normalize((modelMatrix * vec4( normal, 0.0 )).xyz) * 0.02 * normalBias * pow( 1.0 - nDotL * nDotL, 4.);","//shadowCoord.xy = (shadowMatrix * worldPosition).xy;","//gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","gl_Position = vec4( 2. * uv.x - 1., 2. * uv.y - 1., 0., 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","varying vec3 viewNormal;","uniform vec3 lightVector;","varying vec4 shadowCoord;","uniform vec2 shadowBufferSize;","uniform vec2 shadowMapResolution;","uniform sampler2D shadowMap;","uniform sampler2D shadowAccumulationBuffer;","uniform vec4 shadowData;","uniform vec2 cameraNearFar;","uniform float weightSum;","float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {","#if LINEAR_DEPTH == 0","float shadowDepth = unpackRGBAToDepth( texture2D( depths, uv ) );","#else","float shadowDepth = pow2(unpackRGBAToDepth(texture2D( depths, uv ))) + 0.01 * shadowData.z;","shadowDepth = shadowDepth * ( cameraNearFar.y - cameraNearFar.x ) + cameraNearFar.x;","#endif","return step( compare, shadowDepth );","}","float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {","const vec2 offset = vec2( 0.0, 1.0 );","vec2 texelSize = vec2( 1.0 ) / size;","vec2 centroidUV = floor( uv * size + 0.5 ) / size;","float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );","float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );","float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );","float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );","vec2 f = fract( uv * size + 0.5 );","float a = mix( lb, lt, f.y );","float b = mix( rb, rt, f.y );","float c = mix( a, b, f.x );","return c;","}","void main() {","float shadowValue = 1.0;","float shadowRadius = shadowData.y;","float shadowBiasMultiplier = shadowData.z;","float nDotL = clamp( dot(lightVector, normalize(viewNormal)), 0.0, 1.0);","float shadowBias = 0.02 * sqrt( 1.0 - nDotL * nDotL) / clamp(nDotL, 0.0006, 1.0);","shadowBias = clamp(shadowBias, 0.0001, 0.0003) * shadowBiasMultiplier;","vec3 shadowCoordNDC = shadowCoord.xyz;///shadowCoord.w;","shadowCoordNDC.z -= shadowBias;","#if LINEAR_DEPTH == 1","float linearDepth = shadowCoord.z + (cameraNearFar.y + cameraNearFar.x)/(cameraNearFar.y - cameraNearFar.x);","linearDepth *= -(cameraNearFar.y - cameraNearFar.x) * 0.5;","linearDepth = -linearDepth;","#endif","bvec4 inFrustumVec = bvec4 ( shadowCoordNDC.x >= 0.0, shadowCoordNDC.x <= 1.0, shadowCoordNDC.y >= 0.0, shadowCoordNDC.y <= 1.0 );","bool inFrustum = all( inFrustumVec );","bvec2 frustumTestVec = bvec2( inFrustum, shadowCoordNDC.z <= 1.0 );","bool frustumTest = all( frustumTestVec );","#if LINEAR_DEPTH == 1","shadowCoordNDC.z = linearDepth;","#endif","if(frustumTest) {","#if SHADOW_QUALITY == 0","shadowValue = texture2DCompare(shadowMap, shadowCoordNDC.xy, shadowCoordNDC.z);","#elif SHADOW_QUALITY == 1","vec2 texelSize = vec2( 1.0 ) / shadowMapResolution;","float dx0 = - texelSize.x * shadowRadius;","float dy0 = - texelSize.y * shadowRadius;","float dx1 = + texelSize.x * shadowRadius;","float dy1 = + texelSize.y * shadowRadius;","float theta = rand( shadowCoord.xy ) * PI2;","float snTheta = sin(theta);","float csTheta = cos(theta);","mat2 randomRotationMatrix = mat2(csTheta, snTheta, -snTheta, csTheta);","shadowValue = (","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, 0.0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy, shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, 0.0 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy1 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy1 ), shadowCoordNDC.z ) + ","texture2DCompare( shadowMap, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy1 ), shadowCoordNDC.z )",") * ( 1.0 / 9.0 );","#elif SHADOW_QUALITY == 2","vec2 texelSize = vec2( 1.0 ) / shadowMapResolution;","float dx0 = - texelSize.x * shadowRadius;","float dy0 = - texelSize.y * shadowRadius;","float dx1 = + texelSize.x * shadowRadius;","float dy1 = + texelSize.y * shadowRadius;","float theta = rand( shadowCoord.xy ) * PI2;","float snTheta = sin(theta);","float csTheta = cos(theta);","mat2 randomRotationMatrix = mat2(csTheta, snTheta, -snTheta, csTheta);","shadowValue = ( ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, 0.0 ), shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy, shadowCoordNDC.z ) + ","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, 0.0 ), shadowCoordNDC.z ) +","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx0, dy1 ), shadowCoordNDC.z ) +","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( 0.0, dy1 ), shadowCoordNDC.z ) +","texture2DShadowLerp( shadowMap, shadowMapResolution, shadowCoordNDC.xy + randomRotationMatrix * vec2( dx1, dy1 ), shadowCoordNDC.z )",") * ( 1.0 / 9.0 );","#endif","}","float previousAccumulation = unpackRGBAToDepth(texture2D( shadowAccumulationBuffer, gl_FragCoord.xy/shadowBufferSize ));","if(shadowData.x == 1.) {","previousAccumulation = 0.;","}","float shadowAccumulation = previousAccumulation + shadowValue * weightSum;//mix(previousAccumulation, shadowValue, 1./shadowData.x);","gl_FragColor = packDepthToRGBA(shadowAccumulation);","}"].join("\n")}},function(e,t){e.exports=PIXOTRON.BlurShader={uniforms:{tDiffuse:{value:null},size:{value:new THREE.Vector3},direction:{value:new THREE.Vector3(1,0)},step:{value:.5}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <packing>","uniform sampler2D tDiffuse;","uniform vec2 size;","uniform vec2 direction;","uniform float step;","varying vec2 vUv;","void main() {","float sum = 0.0;","vec2 uvDelta = step * direction / size;","//sum += texture2D( tDiffuse, vUv - 3. * uvDelta ) * 0.0918;","//sum += texture2D( tDiffuse, vUv - 2. * uvDelta ) * 0.2;","sum += unpackRGBAToDepth(texture2D( tDiffuse, vUv - 1. * uvDelta )) * 0.3333;","sum += unpackRGBAToDepth(texture2D( tDiffuse, vec2( vUv.x, vUv.y ) )) * 0.3333;","sum += unpackRGBAToDepth(texture2D( tDiffuse, vUv + 1. * uvDelta )) * 0.3333;","//sum += texture2D( tDiffuse, vUv + 2. * uvDelta ) * 0.2;","//sum += texture2D( tDiffuse, vUv + 3. * uvDelta ) * 0.0918;","gl_FragColor = packDepthToRGBA(sum);//texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );","}"].join("\n")}},function(e,t,i){PIXOTRON.SuperSampleAAShader={uniforms:{tCurrent:{type:"t",value:null},tSumPrevious:{type:"t",value:null},accIndex:{type:"f",value:0}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }",fragmentShader:"varying vec2 vUv; uniform sampler2D tCurrent; uniform sampler2D tSumPrevious; uniform float accIndex; void main() { vec4 currentColor = texture2D(tCurrent, vUv); vec4 previousSum = texture2D(tSumPrevious, vUv); gl_FragColor = mix(previousSum, currentColor, 1./accIndex); } "}},function(e,t,i){i(27);const s=new THREE.Vector2;e.exports=PIXOTRON.TemporalAAPass=class extends THREE.Pass{constructor(e,t){super(),this.feedBack=new THREE.Vector2(.8,.9),this.mi=!0,this.Z=e,this.F=t,this.fi=new THREE.ShaderMaterial(PIXOTRON.TemporalAAShader),this.pi=new THREE.Matrix4,this.Ei=new THREE.Matrix4,this.ct=new THREE.Matrix4,this.ct.copy(this.Z.projectionMatrix),this.oldClearColor=new THREE.Color}needsUpdate(){this.mi=!0}dispose(){this.wi&&(this.wi.dispose(),this.fi.dispose())}setSize(e,t){this.wi&&this.wi.setSize(e,t),this.ct.copy(this.Z.projectionMatrix)}render(e,t,i){this.X(e),e.getClearColor(this.oldClearColor);const s=e.getClearAlpha(),a=e.autoClear;e.autoClear=!1,e.setClearColor(new THREE.Color(0,0,0),0),this.Ei.multiplyMatrices(this.ct,this.Z.matrixWorldInverse),this.Ri(e,i),PIXOTRON.renderPass(e,this.fi,t),PIXOTRON.blit(e,t.texture,this.wi),e.setClearColor(this.oldClearColor,s),e.autoClear=a,this.pi.copy(this.Ei),this.mi=!1}X(e){e.getDrawingBufferSize(s);const t=s.x,i=s.y;if(!this.wi){const e={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};this.wi=new THREE.WebGLRenderTarget(t,i,e)}}Ri(e,t){let i,a;i=this.F.Nt?this.F.Nt:this.F.we?this.F.we.texture:null,this.F.we||(a=this.F.Ee?this.F.Ee.texture:null),this.fi.uniforms.currentRT.value=t.texture,this.fi.uniforms.previousRT.value=this.wi.texture,this.fi.uniforms.tDepth.value=i||a;let r=this.F.Nt?0:1;this.F.forceDepthAndNormalPass&&this.F.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(r=2),this.fi.defines.DEPTH_PACKING_MODE=r,this.fi.uniforms.currentProjectionViewMatrix.value.copy(this.Ei),this.fi.uniforms.lastProjectionViewMatrix.value.copy(this.pi),this.fi.uniforms.ProjectionMatrix.value.copy(this.ct),this.fi.uniforms.InverseViewMatrix.value.copy(this.Z.matrixWorld),this.fi.uniforms.firstFrame.value=this.mi,this.fi.uniforms.feedBack.value.x=this.feedBack.x,this.fi.uniforms.feedBack.value.y=this.feedBack.y;const o=this.fi.uniforms.cameraNearFar.value;o.x=this.Z.near,o.y=this.Z.far,e.getDrawingBufferSize(s);const n=s.x,l=s.y,h=this.fi.uniforms.textureSize.value;h.x=n,h.y=l,this.fi.defines.LINEAR_DEPTH=this.F.fe?1:0}}},function(e,t){e.exports=PIXOTRON.TemporalAAShader={defines:{DEPTH_PACKING_MODE:1,PERSPECTIVE_CAMERA:1,LINEAR_DEPTH:1,QUALITY:1,UNJITTER:0},uniforms:{currentRT:{value:null},previousRT:{value:null},tDepth:{value:null},cameraNearFar:{value:new THREE.Vector2},textureSize:{value:new THREE.Vector2},lastProjectionViewMatrix:{value:new THREE.Matrix4},currentProjectionViewMatrix:{value:new THREE.Matrix4},ProjectionMatrix:{value:new THREE.Matrix4},InverseViewMatrix:{value:new THREE.Matrix4},jitterSample:{value:new THREE.Vector2},feedBack:{value:new THREE.Vector2(.88,.97)},firstFrame:{value:!1}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }",fragmentShader:["#include <common>","varying vec2 vUv;","uniform sampler2D currentRT;","uniform sampler2D previousRT;","uniform sampler2D tDepth;","uniform vec2 textureSize;","uniform mat4 lastProjectionViewMatrix;","uniform mat4 currentProjectionViewMatrix;","uniform mat4 ProjectionMatrix;","uniform mat4 InverseViewMatrix;","uniform vec2 cameraNearFar;","uniform vec2 jitterSample;","uniform vec2 feedBack;","uniform bool firstFrame;","#include <packing>","float unpack16(vec2 value) {","return (","value.x*0.996108949416342426275150501169264316558837890625 +","value.y*0.00389105058365758760263730664519243873655796051025390625",");","}","float decodeDepth( const in vec2 uv ) {","#if DEPTH_PACKING_MODE == 1","#if LINEAR_DEPTH == 0","return unpackRGBAToDepth( texture2D( tDepth, uv ) );","#else","return pow2(unpackRGBAToDepth(texture2D( tDepth, uv )));","#endif","#elif DEPTH_PACKING_MODE == 2","#if LINEAR_DEPTH == 1","return pow2(unpack16(texture2D( tDepth, uv ).xy));","#else","return pow2(unpack16( texture2D( tDepth, uv ).xy ));","#endif","#else","return texture2D( tDepth, uv ).x;","#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );","\t#else","\treturn orthoDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );","\t#endif","}","vec3 find_closest_fragment_3x3(const in vec2 uv) { ","const vec3 offset = vec3(-1.0, 1.0, 0.0);","vec2 texelSize = 1.0/textureSize; ","vec3 dtr = vec3(-1, 1, decodeDepth( uv + offset.yx * texelSize) ); ","vec3 dtc = vec3( 0, 1, decodeDepth( uv + offset.zx * texelSize) );","vec3 dtl = vec3( 1, 1, decodeDepth( uv + offset.xx * texelSize) );","vec3 dml = vec3(-1, 0, decodeDepth( uv + offset.yz * texelSize) );","vec3 dmc = vec3( 0, 0, decodeDepth( uv ) );","vec3 dmr = vec3( 1, 0, decodeDepth( uv + offset.xz * texelSize) );","vec3 dbl = vec3(-1, -1, decodeDepth( uv + offset.yy * texelSize) );","vec3 dbc = vec3( 0, -1, decodeDepth( uv + offset.zy * texelSize) );","vec3 dbr = vec3( 1, -1, decodeDepth( uv + offset.xy * texelSize) );","vec3 dmin = dtl;","if ( dmin.z > dtc.z ) dmin = dtc;","if ( dmin.z > dtr.z ) dmin = dtr;","if ( dmin.z > dml.z ) dmin = dml;","if ( dmin.z > dmc.z ) dmin = dmc;","if ( dmin.z > dmr.z ) dmin = dmr;","if ( dmin.z > dbl.z ) dmin = dbl;","if ( dmin.z > dbc.z ) dmin = dbc;","if ( dmin.z > dbr.z ) dmin = dbr;","return vec3(uv + texelSize.xy * dmin.xy, dmin.z);","}","vec3 find_closest_fragment_5tap(const in vec2 uv) ","{ ","vec2 texelSize = 1.0/textureSize; ","vec2 offset = vec2(1.0, -1.0);","vec3 dtl = vec3(-1, 1, decodeDepth( uv + offset.yx * texelSize) ); ","vec3 dtr = vec3( 1, 1, decodeDepth( uv + offset.xx * texelSize) );","vec3 dmc = vec3( 0, 0, decodeDepth( uv) );","vec3 dbl = vec3(-1, -1, decodeDepth( uv + offset.yy * texelSize) );","vec3 dbr = vec3( 1, -1, decodeDepth( uv + offset.xy * texelSize) );","vec3 dmin = dtl;","if ( dmin.z > dtr.z ) dmin = dtr;","if ( dmin.z > dmc.z ) dmin = dmc;","if ( dmin.z > dbl.z ) dmin = dbl;","if ( dmin.z > dbr.z ) dmin = dbr;","return vec3(uv + dmin.xy * texelSize, dmin.z);","}","vec4 clip_aabb(const in vec4 aabb_min, const in vec4 aabb_max, vec4 p )","{ ","const float FLT_EPS = 1e-8;","vec4 p_clip = 0.5 * (aabb_max + aabb_min); ","vec4 e_clip = 0.5 * (aabb_max - aabb_min) + FLT_EPS; ","vec4 v_clip = p - p_clip;","vec4 v_unit = abs(v_clip / e_clip);","float ma_unit = max(v_unit.x, max(v_unit.y, v_unit.z));","if (ma_unit > 1.0) ","return p_clip + v_clip / ma_unit;","else ","return p;","}","vec2 computeScreenSpaceVelocity(const in vec3 worldPosition) {","vec4 currentPositionClip = currentProjectionViewMatrix * vec4(worldPosition, 1.0);","vec4 prevPositionClip = lastProjectionViewMatrix * vec4(worldPosition, 1.0);","vec2 currentPositionNDC = currentPositionClip.xy / currentPositionClip.w;","vec2 prevPositionNDC = prevPositionClip.xy / prevPositionClip.w;","if(prevPositionNDC.x >= 1.0 || prevPositionNDC.x <= -1.0 || prevPositionNDC.x >= 1.0 || prevPositionNDC.y <= -1.0) {","return vec2(0.0);","}","return 0.5 * (currentPositionNDC - prevPositionNDC);","}","vec4 computeTAA(const in vec2 uv, const in vec2 screenSpaceVelocity) {","vec2 jitterOffset = jitterSample/textureSize;","vec2 uvUnJitter = uv;","vec4 currentColor = texture2D(currentRT, uvUnJitter);","vec4 previousColor = texture2D(previousRT, uv - screenSpaceVelocity);","const vec3 offset = vec3(1., -1., 0.);","vec2 texelSize = 1./textureSize;","float texelSpeed = length( screenSpaceVelocity );","vec4 tl = texture2D(currentRT, uvUnJitter + offset.yx * texelSize);","vec4 tc = texture2D(currentRT, uvUnJitter + offset.zx * texelSize);","vec4 tr = texture2D(currentRT, uvUnJitter + offset.xx * texelSize);","vec4 ml = texture2D(currentRT, uvUnJitter + offset.yz * texelSize);","vec4 mc = currentColor;","vec4 mr = texture2D(currentRT, uvUnJitter + offset.xz * texelSize);","vec4 bl = texture2D(currentRT, uvUnJitter + offset.yy * texelSize);","vec4 bc = texture2D(currentRT, uvUnJitter + offset.zy * texelSize);","vec4 br = texture2D(currentRT, uvUnJitter + offset.xy * texelSize);","vec4 corners = 2.0 * (tr + bl + br + tl) - 2.0 * mc;","mc += (mc - (corners * 0.166667)) * 2.718282 * 0.3;","mc = max(vec4(0.0), mc);","vec4 min5 = min(tc, min(ml, min(mc, min(mr, bc))));","vec4 max5 = max(tc, max(ml, max(mc, max(mr, bc))));","vec4 cmin = min(min5, min(tl, min(tr, min(bl, br))));","vec4 cmax = max(min5, max(tl, max(tr, max(bl, br))));;","cmin = 0.5 * (cmin + min5);","cmax = 0.5 * (cmax + max5);","previousColor = clip_aabb(cmin, cmax, previousColor);","float lum0 = linearToRelativeLuminance(currentColor.rgb);","float lum1 = linearToRelativeLuminance(previousColor.rgb);","float unbiased_diff = abs(lum0 - lum1) / max(lum0, max(lum1, 0.2));","float unbiased_weight = 1.0 - unbiased_diff;","float unbiased_weight_sqr = unbiased_weight * unbiased_weight;","float k_feedback = mix(feedBack.x, feedBack.y, unbiased_weight_sqr);","return mix(currentColor, previousColor, k_feedback);","}","vec3 getWorldPositionFromViewZ(const in vec2 uv, const in float viewDepth) {","vec2 uv_ = 2. * uv - 1.;","float xe = -(uv_.x + ProjectionMatrix[2][0]) * viewDepth/ProjectionMatrix[0][0];","float ye = -(uv_.y + ProjectionMatrix[2][1]) * viewDepth/ProjectionMatrix[1][1];","return (InverseViewMatrix * vec4(xe, ye, viewDepth, 1.)).xyz;","}","void main() {","vec2 jitterOffset = jitterSample/textureSize;","#if QUALITY == 1","vec3 c_frag = find_closest_fragment_3x3(vUv);","#else","vec3 c_frag = find_closest_fragment_5tap(vUv);","#endif","if( c_frag.z >= 0.999 ) {","gl_FragColor = texture2D(currentRT, vUv - jitterOffset);","}","else {","#if LINEAR_DEPTH == 0","float sampleViewZ = getViewZ( c_frag.z );","#else","float sampleViewZ = mix(-cameraNearFar.x, -cameraNearFar.y, c_frag.z);","#endif","vec3 worldPosition = getWorldPositionFromViewZ(c_frag.xy, sampleViewZ);","vec2 screenSpaceVelocity = computeScreenSpaceVelocity(worldPosition);","gl_FragColor = firstFrame ? texture2D(currentRT, vUv) : computeTAA(vUv, screenSpaceVelocity);","//gl_FragColor = vec4(10. * length(screenSpaceVelocity));","}","}"].join("\n")}},function(e,t,i){i(29);const s=new THREE.Vector2;e.exports=PIXOTRON.BilateralFilterPass=class{constructor(){this.blurKernelSize=3,this.edgeSharpness=1,this.bilateralFilterMaterial=new THREE.ShaderMaterial(PIXOTRON.SAOBilateralFilterShader),this.bilateralFilterMaterial.uniforms=THREE.UniformsUtils.clone(this.bilateralFilterMaterial.uniforms),this.bilateralFilterMaterial.defines=Object.assign({},this.bilateralFilterMaterial.defines),this.bilateralFilterMaterial.defines.USE_NORMAL_WEIGHT=1}render(e,t,i,s){this.X(e),this.Ti(e,t,i,s)}setSize(e,t){this.xi&&this.xi.setSize(e,t),this.bilateralFilterMaterial.uniforms.size.value.set(e,t)}dispose(){this.xi&&(this.xi.dispose(),this.xi=null),this.bilateralFilterMaterial.dispose()}X(e){if(!this.xi){e.getDrawingBufferSize(s);const t=s.x,i=s.y,a={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.xi=new THREE.WebGLRenderTarget(t,i,a)}}Ti(e,t,i,a){e.getDrawingBufferSize(s);const r=s.x,o=s.y;this.bilateralFilterMaterial.uniforms.size.value.set(r,o);const n=a.Re?a.Re.texture:null;let l;a.we||(l=a.Ee?a.Ee.texture:null),l?(this.bilateralFilterMaterial.defines.DEPTH_NORMAL_TEXTURE=1,this.bilateralFilterMaterial.uniforms.tNormal.value=l):this.bilateralFilterMaterial.uniforms.tNormal.value=n,this.bilateralFilterMaterial.defines.KERNEL_SAMPLE_RADIUS=this.blurKernelSize,this.bilateralFilterMaterial.defines.LINEAR_DEPTH=a.fe?1:0,this.bilateralFilterMaterial.uniforms.tOcclusionDepth.value=t.texture,this.bilateralFilterMaterial.uniforms.kernelDirection.value=new THREE.Vector2(1,0),this.bilateralFilterMaterial.uniforms.edgeSharpness.value=this.edgeSharpness;const h=this.bilateralFilterMaterial.uniforms.cameraNearFar.value;h.x=i.near,h.y=i.far,PIXOTRON.renderPass(e,this.bilateralFilterMaterial,this.xi),this.bilateralFilterMaterial.uniforms.tOcclusionDepth.value=this.xi.texture,this.bilateralFilterMaterial.uniforms.kernelDirection.value=new THREE.Vector2(0,1),PIXOTRON.renderPass(e,this.bilateralFilterMaterial,t)}}},function(e,t){e.exports=PIXOTRON.SAOBilateralFilterShader={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SAMPLE_RADIUS:4,LINEAR_DEPTH:1,DEPTH_NORMAL_TEXTURE:0},uniforms:{tOcclusionDepth:{type:"t",value:null},tNormal:{type:"t",value:null},size:{type:"v2",value:new THREE.Vector2(256,256)},kernelDirection:{type:"v2",value:new THREE.Vector2(1,0)},cameraNearFar:{type:"v2",value:new THREE.Vector2(1,0)},edgeSharpness:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","uniform sampler2D tOcclusionDepth;","uniform sampler2D tNormal;","uniform vec2 size;","uniform vec2 cameraNearFar;","uniform float edgeSharpness;","uniform vec2 kernelDirection;","#include <packing>","float getViewZ( const in float depth ) {","#if PERSPECTIVE_CAMERA == 1","return perspectiveDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );","#else","return orthographicDepthToViewZ( depth, cameraNearFar.x, cameraNearFar.y );","#endif","}","vec3 unpackNormal(vec2 enc) {","vec2 fenc = enc*4.0-2.0;","float f = dot(fenc,fenc);","float g = sqrt(1.0-f/4.0);","return vec3(fenc*g, 1.0-f/2.0);","}","vec3 getViewNormal( const in vec2 uv ) {","#if DEPTH_NORMAL_TEXTURE == 1","return unpackNormal( texture2D( tNormal, uv ).zw );","#else","return unpackRGBToNormal( texture2D( tNormal, uv ).xyz );","#endif","}","float linearStep(float edge0, float edge1, float value){","return clamp((value-edge0)/(edge1-edge0), 0.0, 1.0);","}","float unpackRGBToFloat(const in vec3 x) {","const vec3 decode = 1.0 / vec3(1.0, 255.0, 65025.0);","return dot(x, decode);","}","void calculateBilateralWeight( const in vec2 uv, const in vec3 centreNormal, const in float centerDepth,","const in float kernelWeight, inout float totalOcclusion, inout float totalBilateralWeight ) {","vec4 aoDepth = texture2D( tOcclusionDepth, uv );","float occlusion = aoDepth.r;","float depth = unpackRGBToFloat( aoDepth.gba );","if( depth >= ( 1.0 - EPSILON ) ) {","return;","}","vec3 normal = getViewNormal(uv);","#if LINEAR_DEPTH == 0","depth = -getViewZ( depth );","depth = linearStep(cameraNearFar.x, cameraNearFar.y, depth);","#endif","float normalWeight = 1.;","#if USE_NORMAL_WEIGHT == 1","float normalCloseness = dot(normal, centreNormal);","normalCloseness *= normalCloseness;","float normalError = (1.0 - normalCloseness) * 8.;","normalWeight = max((1.0 - normalError * edgeSharpness), 0.00);","#endif","float depthWeight = max(0.0, 1.0 - edgeSharpness * 4000. * abs(depth - centerDepth)) * kernelWeight;","float bilateralWeight = depthWeight * normalWeight;","totalOcclusion += occlusion * bilateralWeight;","totalBilateralWeight += bilateralWeight;","}","void main() {","vec4 aoDepth = texture2D( tOcclusionDepth, vUv );","float occlusion = aoDepth.r;","float depth = unpackRGBToFloat( aoDepth.gba );","if( depth >= ( 1.0 - EPSILON ) ) {","discard;","}","vec3 centreNormal = getViewNormal(vUv);","#if LINEAR_DEPTH == 0","float centerViewZ = -getViewZ( depth );","centerViewZ = linearStep(cameraNearFar.x, cameraNearFar.y, centerViewZ);","#else","float centerViewZ = depth;","#endif","float gaussianWeights[4];","gaussianWeights[0] = 0.153170;","gaussianWeights[1] = 0.144893;","gaussianWeights[2] = 0.122649;","gaussianWeights[3] = 0.092902;","float totalBilateralWeight = gaussianWeights[0] + 0.03;","float totalOcclusion = occlusion * totalBilateralWeight;","vec2 uvDelta = 2.0 * kernelDirection / size;","float kernelWeight = gaussianWeights[1] + 0.03;","calculateBilateralWeight( vUv + uvDelta, centreNormal, centerViewZ, kernelWeight, totalOcclusion, totalBilateralWeight );","calculateBilateralWeight( vUv - uvDelta, centreNormal, centerViewZ, kernelWeight, totalOcclusion, totalBilateralWeight );","kernelWeight = gaussianWeights[2] + 0.03;","calculateBilateralWeight( vUv + 2. * uvDelta, centreNormal, centerViewZ, kernelWeight, totalOcclusion, totalBilateralWeight );","calculateBilateralWeight( vUv - 2. * uvDelta, centreNormal, centerViewZ, kernelWeight, totalOcclusion, totalBilateralWeight );","kernelWeight = gaussianWeights[3] + 0.03;","calculateBilateralWeight( vUv + 3. * uvDelta, centreNormal, centerViewZ, kernelWeight, totalOcclusion, totalBilateralWeight );","calculateBilateralWeight( vUv - 3. * uvDelta, centreNormal, centerViewZ, kernelWeight, totalOcclusion, totalBilateralWeight );","occlusion = totalOcclusion / totalBilateralWeight;","gl_FragColor = vec4( occlusion, aoDepth.gba );","}"].join("\n")}},function(e,t,i){i(31),e.exports=PIXOTRON.UnrealBloomPass=class extends THREE.Pass{constructor(e,t,i,s,a){super(),this.F=e,this.strength=void 0!==i?i:1,this.radius=s,this.threshold=a,this.resolution=void 0!==t?new THREE.Vector2(t.x,t.y):new THREE.Vector2(256,256);const r={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let o=Math.round(this.resolution.x/2),n=Math.round(this.resolution.y/2);this.renderTargetBright=new THREE.WebGLRenderTarget(o,n,r),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){let t=new THREE.WebGLRenderTarget(o,n,r);t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t),(t=new THREE.WebGLRenderTarget(o,n,r)).texture.name="UnrealBloomPass.v"+e,t.texture.generateMipmaps=!1,this.renderTargetsVertical.push(t),o=Math.round(o/2),n=Math.round(n/2)}const l=PIXOTRON.BloomExtractShader;this.bloomExtractUniforms=THREE.UniformsUtils.clone(l.uniforms),this.bloomExtractUniforms.bloomThreshold.value=a,this.materialBloomExtract=new THREE.ShaderMaterial({uniforms:this.bloomExtractUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,defines:{DEPTH_PACKING_MODE:0,LINEAR_DEPTH:1}}),this.separableBlurMaterials=[];const h=[3,5,7,9,11];o=Math.round(this.resolution.x/2),n=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(h[e])),this.separableBlurMaterials[e].uniforms.texSize.value=new THREE.Vector2(o,n),o=Math.round(o/2),n=Math.round(n/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=i,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const u=THREE.CopyShader;this.copyUniforms=THREE.UniformsUtils.clone(u.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:THREE.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new THREE.Color,this.oldClearAlpha=1,this.camera=new THREE.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new THREE.Scene,this.basic=new THREE.MeshBasicMaterial,this.quad=new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose()}setSize(e,t){let i=Math.round(e/2),s=Math.round(t/2);this.renderTargetBright.setSize(i,s);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(i,s),this.renderTargetsVertical[e].setSize(i,s),this.separableBlurMaterials[e].uniforms.texSize.value=new THREE.Vector2(i,s),i=Math.round(i/2),s=Math.round(s/2)}render(e,t,i,s,a){e.getClearColor(this.oldClearColor),this.oldClearAlpha=e.getClearAlpha();const r=e.autoClear;let o,n;e.autoClear=!1,e.setClearColor(new THREE.Color(0,0,0),0),a&&e.context.disable(e.context.STENCIL_TEST),this.renderToScreen&&(this.quad.material=this.basic,this.basic.map=i.texture,e.render(this.scene,this.camera,void 0,!0)),o=this.F.Nt?this.F.Nt:this.F.we?this.F.we.texture:null,this.F.we||(n=this.F.Ee?this.F.Ee.texture:null),this.materialBloomExtract.uniforms.tDepth.value=o||n;let l=this.F.Nt?0:1;this.F.forceDepthAndNormalPass&&this.F.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(l=2),this.materialBloomExtract.defines.DEPTH_PACKING_MODE=l,this.materialBloomExtract.defines.LINEAR_DEPTH=this.F.fe?1:0,this.bloomExtractUniforms.tColor.value=i.texture,this.bloomExtractUniforms.bloomThreshold.value=this.threshold,this.quad.material=this.materialBloomExtract,e.render(this.scene,this.camera,this.renderTargetBright,!0);let h=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.quad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=h.texture,this.separableBlurMaterials[t].uniforms.direction.value=PIXOTRON.UnrealBloomPass.BlurDirectionX,e.render(this.scene,this.camera,this.renderTargetsHorizontal[t],!0),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=PIXOTRON.UnrealBloomPass.BlurDirectionY,e.render(this.scene,this.camera,this.renderTargetsVertical[t],!0),h=this.renderTargetsVertical[t];this.quad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.render(this.scene,this.camera,this.renderTargetsHorizontal[0],!0),this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&e.context.enable(e.context.STENCIL_TEST),this.renderToScreen?e.render(this.scene,this.camera,void 0,!1):e.render(this.scene,this.camera,i,!1),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=r}getSeperableBlurMaterial(e){return new THREE.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new THREE.Vector2(.5,.5)},direction:{value:new THREE.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat fSigma = float(SIGMA);\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\t\t\t\t\t\tfloat x = float(i);\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\t\t\t\t\t\tweightSum += 2.0 * w;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum);\n\t\t\t\t}"})}getCompositeMaterial(e){return new THREE.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D blurTexture1;\t\t\t\tuniform sampler2D blurTexture2;\t\t\t\tuniform sampler2D blurTexture3;\t\t\t\tuniform sampler2D blurTexture4;\t\t\t\tuniform sampler2D blurTexture5;\t\t\t\tuniform sampler2D dirtTexture;\t\t\t\tuniform float bloomStrength;\t\t\t\tuniform float bloomRadius;\t\t\t\tuniform float bloomFactors[NUM_MIPS];\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\t\t\t\t\t\t\t\tfloat lerpBloomFactor(const in float factor) { \t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\t\t\t\t}\t\t\t\t\t\t\t\tvoid main() {\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\t\t\t\t}"})}},PIXOTRON.UnrealBloomPass.BlurDirectionX=new THREE.Vector2(1,0),PIXOTRON.UnrealBloomPass.BlurDirectionY=new THREE.Vector2(0,1)},function(e,t){e.exports=PIXOTRON.BloomExtractShader={uniforms:{tColor:{type:"t",value:null},tDepth:{type:"t",value:null},bloomThreshold:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <packing>","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float bloomThreshold;","varying vec2 vUv;","float unpack16(vec2 value){","return (","value.x*0.996108949416342426275150501169264316558837890625 +","value.y*0.00389105058365758760263730664519243873655796051025390625",");","}","float decodeDepth( const in vec2 uv ) {","vec4 uncodedDepth = texture2D( tDepth, uv );","#if DEPTH_PACKING_MODE == 0","return uncodedDepth.x;","#elif DEPTH_PACKING_MODE == 1","#if LINEAR_DEPTH == 1","return pow(unpackRGBAToDepth(uncodedDepth), 2.);","#else","return unpackRGBAToDepth(uncodedDepth );","#endif","#else","return pow(unpack16(uncodedDepth.xy), 2.);","#endif","}","void main() {","vec4 color = texture2D( tColor, vUv );","float depth = decodeDepth(vUv);","const vec3 c = vec3( 0.299, 0.587, 0.114 );","float luminance = dot( color.xyz, c );","float alpha = smoothstep( bloomThreshold, bloomThreshold + 0.01, luminance );","alpha = depth > 1. - 0.001 ? 0. : alpha;","gl_FragColor = color * alpha;","}"].join("\n")}},function(e,t){e.exports=PIXOTRON.VPLGenerationPass=class{constructor(e){this.maxVPL=e,this.Oi=0,this.Ni=PIXOTRON.generateQuasiRandomPoints(e,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle),this.Di=[];for(let e=0;e<this.Ni.length;e++){const t=this.Ni[e];this.Di.push(new THREE.Vector2(t.x,t.y))}this.gi=new THREE.Ray,this.Pi=new THREE.Raycaster,this.C=0,this.Si=!1,this.Mi=[],this.Hi=new THREE.SphereBufferGeometry(.05,5,5),this.Ci=[],this.st=!1,this.needsUpdate=!0}getVPLBuffer(){return this.Ci}getNumVPL(){return this.Ni.length}generateVPLs(e,t,i,s){if(!this.st)return;if(this.needsUpdate&&(this.rt(),this.needsUpdate=!1),this.Oi>=this.getNumVPL())return this.needsUpdate=!1,void(this.yi.visible=!0);this.yi||(this.yi=new THREE.Object3D,this.yi.visible=!1,e.add(this.yi)),performance.now();let a=0;for(let r=0;r<i;r++){const o=this.gi.origin,n=this.gi.direction;if(this.Pi.set(this.gi.origin,this.gi.direction),!this._i(t,o,n,this.C*i+r))break;const l=s?s.intersectRay(this.gi,e):this.Pi.intersectObject(e,!0);if(l.length>0){const e=l[0];if(e.object instanceof THREE.Mesh){const t=new THREE.Color,i=new THREE.Vector3,s=new THREE.Vector3;i.copy(e.point),s.copy(e.face.normal),s.transformDirection(e.object.matrixWorld);const r=this.Ii(e.object.material.map,e.uv,64);t.copy(e.object.material.color),t.multiply(r),this.Ci.push({position:i,normal:s,intensity:new THREE.Vector3(t.r,t.g,t.b)}),this.Si&&this.zi(i,t),a++}}}this.C++,this.Oi+=a,this.Si&&a>0&&(performance.now(),this.Oi)}zi(e,t){const i=new THREE.MeshBasicMaterial;i.color.copy(t);const s=new THREE.Mesh(this.Hi,i);s.position.copy(e),this.yi.add(s)}rt(){this.C=0,this.Oi=0,this.Ci=[]}Ii(e,t,i){if(!e||!e.image)return new THREE.Color(16777215);let s=this.Mi[e.uuid];s||(i=i||32,s=PIXOTRON.getDataFromImage(e.image,i),this.Mi[e.uuid]=s);let a=t.x,r=t.y;void 0!==e.repeat&&(a*=e.repeat.x,r*=e.repeat.y),a*=s.width,r*=s.height,e.wrapS===THREE.RepeatWrapping&&(a%=s.width),e.wrapS===THREE.ClampToEdgeWrapping&&(a=Math.min(a,s.width-1)),e.wrapT===THREE.RepeatWrapping&&(r%=s.height),e.wrapT===THREE.ClampToEdgeWrapping&&(r=Math.min(r,s.height-1));const o=Math.floor(a),n=Math.floor(r),l=PIXOTRON.getPixelFromImageData(s,o,n);return l.r=Math.pow(l.r/255,1),l.g=Math.pow(l.g/255,1),l.b=Math.pow(l.b/255,1),new THREE.Color(l.r,l.g,l.b)}_i(e,t,i,s){if(s<this.Ni.length){const a=this.Ni[s];t.x=(2*a.x-1)*e.width*.5,t.z=0,t.y=(2*a.y-1)*e.height*.5,t.applyMatrix4(e.matrixWorld);const r=this.Di[s],o=PIXOTRON.squareToCosineHemisphere(r);return i.copy(o),i.transformDirection(e.matrixWorld),!0}return!1}}},function(e,t,i){i(34),e.exports=PIXOTRON.InstantRadiosityPass=class{constructor(){this.Xi=10,this.Ai=0,this.C=0,this.Fi=!1,this.needsUpdate=!0,this.enabled=!0}convergenceMetric(){const e=this.bi.getNumVPL();return this.enabled?this.C*this.Xi/e:1}render(e,t,i,s,a){this.needsUpdate&&(this.rt(),this.C=0,this.needsUpdate=!1),this.bi=s;const r=s.getNumVPL(),o=s.getVPLBuffer();if(0===o.length)return;if(this.convergenceMetric()>=1)return;if(!this.bbox){this.bbox=new THREE.Box3,this.bbox.setFromObject(t);const e=new THREE.Vector3;this.bbox.getSize(e),this.minDistance=Math.max(Math.max(e.x,e.y),e.z)/9}this.Ui||this.X(e),this.C++,t.overrideMaterial=this.Vi;const n=this.C%2==0?this.Ui:this.Li,l=this.C%2==0?this.Li:this.Ui;this.Vi.uniforms.accumulationBuffer.value=n.texture,this.Vi.uniforms.currentFrameCount.value=this.C,this.Bi(o,r,a),e.render(t,i,l,!0),t.overrideMaterial=null,e.indirectDiffuseBuffer=l.texture}X(e){const t=new THREE.Vector2;e.getDrawingBufferSize(t);const i=t.x,s=t.y;let a=THREE.UnsignedByteType;if(!this.Fi){const t=e.extensions,i=t.get("OES_texture_half_float");a=i?THREE.HalfFloatType:a,i||(a=t.get("OES_texture_float")?THREE.FloatType:a)}const r={type:a,format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter};this.Ui=new THREE.WebGLRenderTarget(i,s,r),this.Ui.texture.generateMipmaps=!1,this.Li=new THREE.WebGLRenderTarget(i,s,r),this.Li.texture.generateMipmaps=!1,this.Vi=new THREE.ShaderMaterial(PIXOTRON.VPLAccumulationShader),this.Vi.defines.VPL_COUNT=this.Xi,this.Vi.uniforms.viewPort.value=new THREE.Vector2(i,s),this.Vi.uniforms.currentFrameCount.value=this.C,this.Vi.uniforms.minDistance.value=this.minDistance,(a===THREE.UnsignedByteType||this.Fi)&&(this.Vi.dithering=!0)}rt(){this.C=0,this.Ai=0}Bi(e,t,i){let s=e.length-this.Ai;s=Math.min(s,this.Xi);const a=new THREE.Vector3(0,0,0),r=[];for(let o=0;o<s;o++){const s=e[o+this.Ai];if(o>=e.length)r.push({position:a,direction:a,intensity:a});else{const e=new THREE.Vector3;e.copy(s.intensity),e.multiplyScalar(i.intensity/t),r.push({position:s.position,direction:s.normal,intensity:e})}}for(let e=0;e<this.Xi-s;e++)r.push({position:a,direction:a,intensity:a});this.Ai+=s,this.Vi.uniforms.vplLights.value=r}}},function(e,t){e.exports=PIXOTRON.VPLAccumulationShader={vertexShader:["varying vec3 worldPosition;","varying vec3 worldNormal;","void main() {"," worldPosition = (modelMatrix * vec4( position.xyz, 1.0)).xyz;"," worldNormal = (modelMatrix * vec4(normal, 0.0)).xyz;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <dithering_pars_fragment>","varying vec3 worldPosition;","varying vec3 worldNormal;","uniform vec2 viewPort;","uniform sampler2D accumulationBuffer;","uniform float currentFrameCount;","uniform float minDistance;","struct VPL {"," vec3 position;"," vec3 direction;"," vec3 intensity;","};","uniform VPL vplLights[VPL_COUNT];","float getLightIrradiance(const in vec3 lightPos, const in vec3 lightDir) {","vec3 lightVector = lightPos - worldPosition;","vec3 direction = normalize( lightVector );","float lightDistance = length( lightVector );","float distanceFalloff = 1.0 /max( lightDistance * lightDistance, minDistance * minDistance );","float csTheta_i = dot( direction, -lightDir );","float csTheta_o = dot( normalize(worldNormal), direction );","return max(csTheta_i, 0.) * max( csTheta_o, 0.0 ) * distanceFalloff / PI;","}","void main() {","vec3 colorSum = vec3(0.0);","for( int i = 0; i < VPL_COUNT; i++) {","VPL vpl = vplLights[i];","vec3 lightPosition = vpl.position;","vec3 lightDirection = vpl.direction;","vec3 lightIntensity = vpl.intensity;","vec3 lightColor = lightIntensity * getLightIrradiance( lightPosition, lightDirection );","colorSum += lightColor;","}","vec3 previousColor = texture2D( accumulationBuffer, gl_FragCoord.xy/viewPort ).rgb;","if( currentFrameCount == 1. ){","previousColor = vec3(0.);","}","vec3 newColor = previousColor + colorSum;","gl_FragColor = vec4( newColor , 1.0);","#include <dithering_fragment>","}"].join("\n"),uniforms:{vplLights:{value:null},viewPort:{value:null},accumulationBuffer:{value:null},currentFrameCount:{value:0},minDistance:{value:0}},defines:{VPL_COUNT:0}}},function(e,t,i){i(36),i(4);const s=new THREE.Vector2;e.exports=PIXOTRON.OutlinePass=class{constructor(e){e=e||{},this.highlightColor=void 0!==e.highlightColor?e.highlightColor:new THREE.Color(1,.25,0),this.edgeThickness=void 0!==e.edgeThickness?e.edgeThickness:1,this.edgeStrength=void 0!==e.edgeStrength?e.edgeStrength:1,this.transparency=void 0!==e.transparency?e.transparency:.1,this.enableAA=void 0===e.enableAA||e.enableAA,this.ki=new THREE.MeshBasicMaterial({color:this.highlightColor,side:THREE.DoubleSide}),this.C=0,this.Wi=new THREE.ShaderMaterial(PIXOTRON.EdgeDetectionShader),this.enabled=!0,this.needsUpdate=!0,this.oldClearColor=new THREE.Color}pt(e,t){if(!this.enableAA)return;e.getDrawingBufferSize(s);const i=s.x,a=s.y,r=this.B[this.C%this.B.length];PIXOTRON.jitterCamera(t,r,i,a)}dispose(){this.ji&&this.ji.dispose(),this.Rt&&this.Rt.dispose()}getRenderTarget(){return this.Rt}setSize(e,t){this.ji&&this.ji.setSize(e,t),this.Rt&&this.Rt.setSize(e,t)}isConverged(){return this.L?this.C/this.B.length>=1:1}render(e,t,i,s){if(this.enabled&&s&&s.length>0){this.needsUpdate&&(this.rt(),this.needsUpdate=!1),this.ji||this.X(e),this.enableAA&&!this.L&&(this.L=new PIXOTRON.SuperSampleAAPass,this.B=PIXOTRON.generateQuasiRandomPoints(30,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle));const a=e.getClearAlpha();e.getClearColor(this.oldClearColor);const r=e.autoClear;e.autoClear=!0,e.setClearColor(0,1);const o=t.background;t.background=null,this.pt(e,i),this.Zi(t,s,!1),t.overrideMaterial=this.ki,e.setRenderTarget(this.ji),e.clear(!0,!0,!1),e.render(t,i),e.setRenderTarget(null),t.overrideMaterial=null,this.Zi(t,s,!0),i.clearViewOffset(),t.background=o,0!==this.C&&this.enableAA&&(this.L.render(e,this.Rt,this.ji),PIXOTRON.blit(e,this.Rt,this.ji)),this.Wi.uniforms.maskTexture.value=this.ji.texture,this.Wi.uniforms.texSize.value.x=this.ji.width,this.Wi.uniforms.texSize.value.y=this.ji.height,this.Wi.uniforms.edgeThickness.value=this.edgeThickness,this.Wi.uniforms.highlightColor.value=this.highlightColor,this.Wi.uniforms.transparency.value=this.transparency,this.Wi.uniforms.edgeStrength.value=this.edgeStrength,PIXOTRON.renderPass(e,this.Wi,this.Rt),e.setClearColor(this.oldClearColor,a),e.autoClear=r,this.C++}}Zi(e,t,i){const s=[];function a(e){e.isMesh&&s.push(e)}for(let e=0;e<t.length;e++)t[e].traverse(a);e.traverse((function(e){if(e.isMesh||e.isLine||e.isSprite){let t=!1;for(let i=0;i<s.length;i++)if(s[i].id===e.id){t=!0;break}if(!t){const t=e.visible;i&&!e.bVisible||(e.visible=i),e.bVisible=t}}}))}X(e){const t={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};e.getDrawingBufferSize(s);const i=s.x,a=s.y;this.ji=new THREE.WebGLRenderTarget(i,a,t),this.ji.texture.generateMipmaps=!1,this.Rt=new THREE.WebGLRenderTarget(i,a,t),this.Rt.texture.generateMipmaps=!1}rt(){this.C=0,this.L&&(this.L.needsUpdate=!0)}}},function(e,t,i){const s=i(37).default,a=i(38).default;e.exports=PIXOTRON.EdgeDetectionShader={uniforms:{maskTexture:{value:null},texSize:{value:new THREE.Vector2(.5,.5)},highlightColor:{value:new THREE.Vector3(1,1,1)},edgeThickness:{value:1},edgeStrength:{value:1},transparency:{value:.5}},vertexShader:s,fragmentShader:a}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default="varying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default="varying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform vec2 texSize;\nuniform vec3 highlightColor;\nuniform float edgeThickness;\nuniform float edgeStrength;\nuniform float transparency;\n\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = edgeThickness * vec4(1.0, 0.0, -1.0, 1.0) * vec4(invSize, invSize);\n vec4 c = texture2D(maskTexture, vUv);\n vec4 c1 = texture2D(maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D(maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D(maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D(maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n gl_FragColor = vec4(c.rgb, 1. - transparency) + edgeStrength * vec4(highlightColor, 1.0) * vec4(d);\n}"}]);
|