@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.
Files changed (197) hide show
  1. package/lib/{banana-for-scale-5f9ad0e3.nomodule.js → banana-for-scale-b9868da9.nomodule.js} +2 -2
  2. package/lib/{banana-for-scale-5f9ad0e3.nomodule.js.map → banana-for-scale-b9868da9.nomodule.js.map} +1 -1
  3. package/lib/{banana-for-scale-a8541870.js → banana-for-scale-c464bcaf.js} +2 -2
  4. package/lib/{banana-for-scale-a8541870.js.map → banana-for-scale-c464bcaf.js.map} +1 -1
  5. package/lib/{budgeteer-measure-5fd28189.js → budgeteer-measure-a6f7fd55.js} +2 -2
  6. package/lib/{budgeteer-measure-5fd28189.js.map → budgeteer-measure-a6f7fd55.js.map} +1 -1
  7. package/lib/budgeteer-measure.nomodule.js +1 -1
  8. package/lib/{component-dimensioning-15849d03.js → component-dimensioning-0d089d5d.js} +2 -2
  9. package/lib/component-dimensioning-0d089d5d.js.map +1 -0
  10. package/lib/{component-dimensioning-3816fed6.nomodule.js → component-dimensioning-aac668c8.nomodule.js} +2 -2
  11. package/lib/component-dimensioning-aac668c8.nomodule.js.map +1 -0
  12. package/lib/configurator-7915999f.js +2 -0
  13. package/lib/{configurator-02c1a087.js.map → configurator-7915999f.js.map} +1 -1
  14. package/lib/configurator-d6e39b21.nomodule.js +2 -0
  15. package/lib/{configurator-b94915ee.nomodule.js.map → configurator-d6e39b21.nomodule.js.map} +1 -1
  16. package/lib/configurator-main-cf5bb9fe.js +2 -0
  17. package/lib/configurator-main-cf5bb9fe.js.map +1 -0
  18. package/lib/configurator-main.nomodule.js +1 -1
  19. package/lib/configurator-mesh-generator-bf1a5b3c.nomodule.js +2 -0
  20. package/lib/configurator-mesh-generator-bf1a5b3c.nomodule.js.map +1 -0
  21. package/lib/configurator-mesh-generator-ec0e9982.js +2 -0
  22. package/lib/configurator-mesh-generator-ec0e9982.js.map +1 -0
  23. package/lib/{default-light-setting-0d38ca56.nomodule.js → default-light-setting-76d539f8.nomodule.js} +2 -2
  24. package/lib/default-light-setting-76d539f8.nomodule.js.map +1 -0
  25. package/lib/{default-light-setting-740fe05f.js → default-light-setting-fe844872.js} +2 -2
  26. package/lib/default-light-setting-fe844872.js.map +1 -0
  27. package/lib/definitions/common-core/mock/mock-pixotron.d.ts +3 -0
  28. package/lib/definitions/common-core/src/cameracontrol/camera-control-3d.d.ts +2 -2
  29. package/lib/definitions/common-core/src/utils/common-utils.d.ts +1 -0
  30. package/lib/definitions/common-core/src/utils/init-data.d.ts +4 -0
  31. package/lib/definitions/common-core/src/utils/shims.d.ts +5 -0
  32. package/lib/definitions/common-core/src/view-model/configurator-view-model.d.ts +1 -1
  33. package/lib/definitions/common-core/src/webgl/mesh-generator.d.ts +1 -1
  34. package/lib/definitions/configurator-core/src/webgl/configurator-mesh-generator.d.ts +1 -1
  35. package/lib/definitions/configurator-core/src/webgl/scene-helper.d.ts +3 -1
  36. package/lib/definitions/typings/pixotron.d.ts +2 -0
  37. package/lib/{dimensioning-helper-df61f3e4.nomodule.js → dimensioning-helper-9a706cfd.nomodule.js} +2 -2
  38. package/lib/dimensioning-helper-9a706cfd.nomodule.js.map +1 -0
  39. package/lib/{dimensioning-helper-67518ab9.js → dimensioning-helper-f7e39056.js} +2 -2
  40. package/lib/dimensioning-helper-f7e39056.js.map +1 -0
  41. package/lib/glb-viewer-0d92b638.js +2 -0
  42. package/lib/{glb-viewer-0a44ad1e.js.map → glb-viewer-0d92b638.js.map} +1 -1
  43. package/lib/glb-viewer-d278030c.nomodule.js +2 -0
  44. package/lib/{glb-viewer-a7947024.nomodule.js.map → glb-viewer-d278030c.nomodule.js.map} +1 -1
  45. package/lib/glb-viewer-main-ae7df6ed.js +2 -0
  46. package/lib/glb-viewer-main-ae7df6ed.js.map +1 -0
  47. package/lib/glb-viewer-main.nomodule.js +1 -1
  48. package/lib/{image-renderer-32588b0f.js → image-renderer-a3e7c1a5.js} +2 -2
  49. package/lib/{image-renderer-32588b0f.js.map → image-renderer-a3e7c1a5.js.map} +1 -1
  50. package/lib/{image-renderer-58be56f9.nomodule.js → image-renderer-b1e31df3.nomodule.js} +2 -2
  51. package/lib/{image-renderer-58be56f9.nomodule.js.map → image-renderer-b1e31df3.nomodule.js.map} +1 -1
  52. package/lib/legacy/{banana-for-scale-7fe6982a.legacy.js → banana-for-scale-07c4ef73.legacy.js} +2 -2
  53. package/lib/legacy/{banana-for-scale-7fe6982a.legacy.js.map → banana-for-scale-07c4ef73.legacy.js.map} +1 -1
  54. package/lib/legacy/budgeteer-measure.legacy.js +1 -1
  55. package/lib/legacy/{component-dimensioning-474e71c0.legacy.js → component-dimensioning-d17748a9.legacy.js} +2 -2
  56. package/lib/legacy/component-dimensioning-d17748a9.legacy.js.map +1 -0
  57. package/lib/legacy/configurator-4672929e.legacy.js +2 -0
  58. package/lib/legacy/{configurator-e33d83c7.legacy.js.map → configurator-4672929e.legacy.js.map} +1 -1
  59. package/lib/legacy/configurator-main.legacy.js +1 -1
  60. package/lib/legacy/configurator-mesh-generator-b171f5d8.legacy.js +2 -0
  61. package/lib/legacy/configurator-mesh-generator-b171f5d8.legacy.js.map +1 -0
  62. package/lib/legacy/{default-light-setting-e5427dcc.legacy.js → default-light-setting-3fcc55d4.legacy.js} +2 -2
  63. package/lib/legacy/default-light-setting-3fcc55d4.legacy.js.map +1 -0
  64. package/lib/legacy/{dimensioning-helper-b6b2fae5.legacy.js → dimensioning-helper-25f07743.legacy.js} +2 -2
  65. package/lib/legacy/dimensioning-helper-25f07743.legacy.js.map +1 -0
  66. package/lib/legacy/glb-viewer-9b9d37a8.legacy.js +2 -0
  67. package/lib/legacy/{glb-viewer-8cd61b1e.legacy.js.map → glb-viewer-9b9d37a8.legacy.js.map} +1 -1
  68. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  69. package/lib/legacy/{image-renderer-06f566f5.legacy.js → image-renderer-04df50a7.legacy.js} +2 -2
  70. package/lib/legacy/{image-renderer-06f566f5.legacy.js.map → image-renderer-04df50a7.legacy.js.map} +1 -1
  71. package/lib/legacy/{main-thread-to-worker-45106055.legacy.js → main-thread-to-worker-46ba1413.legacy.js} +2 -2
  72. package/lib/legacy/main-thread-to-worker-46ba1413.legacy.js.map +1 -0
  73. package/lib/legacy/{material-viewer-c853ad32.legacy.js → material-viewer-6cddff1d.legacy.js} +2 -2
  74. package/lib/legacy/material-viewer-6cddff1d.legacy.js.map +1 -0
  75. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  76. package/lib/legacy/mesh-generator-572ad2f8.legacy.js +2 -0
  77. package/lib/legacy/mesh-generator-572ad2f8.legacy.js.map +1 -0
  78. package/lib/legacy/pixotron-66b4f690.legacy.js +2 -0
  79. package/lib/legacy/{pixotron-84b6fe67.legacy.js.map → pixotron-66b4f690.legacy.js.map} +1 -1
  80. package/lib/legacy/{planner-90ac969a.legacy.js → planner-2cc59b21.legacy.js} +2 -2
  81. package/lib/legacy/{planner-90ac969a.legacy.js.map → planner-2cc59b21.legacy.js.map} +1 -1
  82. package/lib/legacy/planner-main.legacy.js +1 -1
  83. package/lib/legacy/{rapi-access-21dc9ae2.legacy.js → rapi-access-a73fc03b.legacy.js} +3 -3
  84. package/lib/legacy/{rapi-access-21dc9ae2.legacy.js.map → rapi-access-a73fc03b.legacy.js.map} +1 -1
  85. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  86. package/lib/legacy/scene-manager-47b24f6e.legacy.js +2 -0
  87. package/lib/legacy/scene-manager-47b24f6e.legacy.js.map +1 -0
  88. package/lib/legacy/static/pi.min-0272f873b3a4380a.js +1 -0
  89. package/lib/legacy/static/{rthree-9a98e3318d68245d.js → rthree-508a6ceb9a1516ce.js} +1 -1
  90. package/lib/legacy/static/shaders-d304d03a461ead46.json +1 -0
  91. package/lib/legacy/{stats-helper-e04ccf23.legacy.js → stats-helper-ef9054e8.legacy.js} +2 -2
  92. package/lib/legacy/{stats-helper-e04ccf23.legacy.js.map → stats-helper-ef9054e8.legacy.js.map} +1 -1
  93. package/lib/main-thread-to-worker-4c9942ce.js +2 -0
  94. package/lib/main-thread-to-worker-4c9942ce.js.map +1 -0
  95. package/lib/{main-thread-to-worker-2526203d.nomodule.js → main-thread-to-worker-4f826ab0.nomodule.js} +2 -2
  96. package/lib/main-thread-to-worker-4f826ab0.nomodule.js.map +1 -0
  97. package/lib/{material-viewer-d3c453fc.js → material-viewer-590448c5.js} +2 -2
  98. package/lib/material-viewer-590448c5.js.map +1 -0
  99. package/lib/{material-viewer-7c63aa7f.nomodule.js → material-viewer-8b280e30.nomodule.js} +2 -2
  100. package/lib/material-viewer-8b280e30.nomodule.js.map +1 -0
  101. package/lib/material-viewer-main-e776f7e5.js +2 -0
  102. package/lib/material-viewer-main-e776f7e5.js.map +1 -0
  103. package/lib/material-viewer-main.nomodule.js +1 -1
  104. package/lib/mesh-generator-55c80a53.nomodule.js +2 -0
  105. package/lib/mesh-generator-55c80a53.nomodule.js.map +1 -0
  106. package/lib/mesh-generator-a718d07a.js +2 -0
  107. package/lib/mesh-generator-a718d07a.js.map +1 -0
  108. package/lib/pixotron-9df61cfe.js +2 -0
  109. package/lib/{pixotron-0b81eb7c.js.map → pixotron-9df61cfe.js.map} +1 -1
  110. package/lib/pixotron-e40b75d2.nomodule.js +2 -0
  111. package/lib/{pixotron-7a1f9ec8.nomodule.js.map → pixotron-e40b75d2.nomodule.js.map} +1 -1
  112. package/lib/{planner-fab4fbbe.js → planner-0bdfa18a.js} +2 -2
  113. package/lib/{planner-fab4fbbe.js.map → planner-0bdfa18a.js.map} +1 -1
  114. package/lib/{planner-77af0a69.nomodule.js → planner-fb33bbd5.nomodule.js} +2 -2
  115. package/lib/{planner-77af0a69.nomodule.js.map → planner-fb33bbd5.nomodule.js.map} +1 -1
  116. package/lib/planner-main-cd1ee6e0.js +2 -0
  117. package/lib/planner-main-cd1ee6e0.js.map +1 -0
  118. package/lib/planner-main.nomodule.js +1 -1
  119. package/lib/{rapi-access-d3bc3ce4.nomodule.js → rapi-access-c8981c13.nomodule.js} +3 -3
  120. package/lib/{rapi-access-d3bc3ce4.nomodule.js.map → rapi-access-c8981c13.nomodule.js.map} +1 -1
  121. package/lib/{rapi-access-ff57cd9e.js → rapi-access-d433b66a.js} +3 -3
  122. package/lib/{rapi-access-ff57cd9e.js.map → rapi-access-d433b66a.js.map} +1 -1
  123. package/lib/{roomle-sdk-6e4fd2d6.js → roomle-sdk-8fee3247.js} +2 -2
  124. package/lib/roomle-sdk-8fee3247.js.map +1 -0
  125. package/lib/roomle-sdk.nomodule.js +1 -1
  126. package/lib/scene-manager-b3bd3bed.js +2 -0
  127. package/lib/scene-manager-b3bd3bed.js.map +1 -0
  128. package/lib/scene-manager-cbf9f557.nomodule.js +2 -0
  129. package/lib/scene-manager-cbf9f557.nomodule.js.map +1 -0
  130. package/lib/static/pi.min-0272f873b3a4380a.js +1 -0
  131. package/lib/static/pi.min-0272f873b3a4380a.js.map +1 -0
  132. package/lib/static/{rthree-9a98e3318d68245d.js → rthree-508a6ceb9a1516ce.js} +1 -1
  133. package/lib/static/rthree-508a6ceb9a1516ce.js.map +1 -0
  134. package/lib/static/shaders-d304d03a461ead46.json +1 -0
  135. package/lib/{stats-helper-670aea9b.js → stats-helper-5fadbfc2.js} +2 -2
  136. package/lib/{stats-helper-670aea9b.js.map → stats-helper-5fadbfc2.js.map} +1 -1
  137. package/lib/{stats-helper-b294fd7a.nomodule.js → stats-helper-efa282ca.nomodule.js} +2 -2
  138. package/lib/{stats-helper-b294fd7a.nomodule.js.map → stats-helper-efa282ca.nomodule.js.map} +1 -1
  139. package/package.json +2 -2
  140. package/lib/component-dimensioning-15849d03.js.map +0 -1
  141. package/lib/component-dimensioning-3816fed6.nomodule.js.map +0 -1
  142. package/lib/configurator-02c1a087.js +0 -2
  143. package/lib/configurator-b94915ee.nomodule.js +0 -2
  144. package/lib/configurator-main-31ba572b.js +0 -2
  145. package/lib/configurator-main-31ba572b.js.map +0 -1
  146. package/lib/configurator-mesh-generator-2b2535f8.js +0 -2
  147. package/lib/configurator-mesh-generator-2b2535f8.js.map +0 -1
  148. package/lib/configurator-mesh-generator-470760e6.nomodule.js +0 -2
  149. package/lib/configurator-mesh-generator-470760e6.nomodule.js.map +0 -1
  150. package/lib/default-light-setting-0d38ca56.nomodule.js.map +0 -1
  151. package/lib/default-light-setting-740fe05f.js.map +0 -1
  152. package/lib/dimensioning-helper-67518ab9.js.map +0 -1
  153. package/lib/dimensioning-helper-df61f3e4.nomodule.js.map +0 -1
  154. package/lib/glb-viewer-0a44ad1e.js +0 -2
  155. package/lib/glb-viewer-a7947024.nomodule.js +0 -2
  156. package/lib/glb-viewer-main-c9ea66e6.js +0 -2
  157. package/lib/glb-viewer-main-c9ea66e6.js.map +0 -1
  158. package/lib/legacy/component-dimensioning-474e71c0.legacy.js.map +0 -1
  159. package/lib/legacy/configurator-e33d83c7.legacy.js +0 -2
  160. package/lib/legacy/configurator-mesh-generator-7c2a1b65.legacy.js +0 -2
  161. package/lib/legacy/configurator-mesh-generator-7c2a1b65.legacy.js.map +0 -1
  162. package/lib/legacy/default-light-setting-e5427dcc.legacy.js.map +0 -1
  163. package/lib/legacy/dimensioning-helper-b6b2fae5.legacy.js.map +0 -1
  164. package/lib/legacy/glb-viewer-8cd61b1e.legacy.js +0 -2
  165. package/lib/legacy/main-thread-to-worker-45106055.legacy.js.map +0 -1
  166. package/lib/legacy/material-viewer-c853ad32.legacy.js.map +0 -1
  167. package/lib/legacy/mesh-generator-c9c5cf92.legacy.js +0 -2
  168. package/lib/legacy/mesh-generator-c9c5cf92.legacy.js.map +0 -1
  169. package/lib/legacy/pixotron-84b6fe67.legacy.js +0 -2
  170. package/lib/legacy/scene-manager-c1df3327.legacy.js +0 -2
  171. package/lib/legacy/scene-manager-c1df3327.legacy.js.map +0 -1
  172. package/lib/legacy/static/pi.min-6875d25247d9711b.js +0 -1
  173. package/lib/legacy/static/shaders-695d00691ea12f08.json +0 -1
  174. package/lib/main-thread-to-worker-2526203d.nomodule.js.map +0 -1
  175. package/lib/main-thread-to-worker-815feb19.js +0 -2
  176. package/lib/main-thread-to-worker-815feb19.js.map +0 -1
  177. package/lib/material-viewer-7c63aa7f.nomodule.js.map +0 -1
  178. package/lib/material-viewer-d3c453fc.js.map +0 -1
  179. package/lib/material-viewer-main-43691932.js +0 -2
  180. package/lib/material-viewer-main-43691932.js.map +0 -1
  181. package/lib/mesh-generator-0b2ac98c.js +0 -2
  182. package/lib/mesh-generator-0b2ac98c.js.map +0 -1
  183. package/lib/mesh-generator-739f8058.nomodule.js +0 -2
  184. package/lib/mesh-generator-739f8058.nomodule.js.map +0 -1
  185. package/lib/pixotron-0b81eb7c.js +0 -2
  186. package/lib/pixotron-7a1f9ec8.nomodule.js +0 -2
  187. package/lib/planner-main-1426a336.js +0 -2
  188. package/lib/planner-main-1426a336.js.map +0 -1
  189. package/lib/roomle-sdk-6e4fd2d6.js.map +0 -1
  190. package/lib/scene-manager-1c0fa594.js +0 -2
  191. package/lib/scene-manager-1c0fa594.js.map +0 -1
  192. package/lib/scene-manager-e7cf547f.nomodule.js +0 -2
  193. package/lib/scene-manager-e7cf547f.nomodule.js.map +0 -1
  194. package/lib/static/pi.min-6875d25247d9711b.js +0 -1
  195. package/lib/static/pi.min-6875d25247d9711b.js.map +0 -1
  196. package/lib/static/rthree-9a98e3318d68245d.js.map +0 -1
  197. package/lib/static/shaders-695d00691ea12f08.json +0 -1
@@ -1 +0,0 @@
1
- !function(t){var e={};function i(s){if(e[s])return e[s].exports;var o=e[s]={i:s,l:!1,exports:{}};return t[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=5)}([function(t,e,i){function s(t){const e=Math.floor(Math.random()*t.length),i=t[e];return t.splice(e,1),i}function o(t,e,i){this.width=t,this.height=e,this.cellSize=i,this.array=new Array(t);for(let i=0;i<t;i++)this.array[i]=new Array(e)}function a(t,e){const i=e*(Math.random()+1),s=6.283185307178*Math.random(),o=t.x+i*Math.cos(s),a=t.y+i*Math.sin(s);return new THREE.Vector2(o,a)}i(3),o.prototype={constructor:o,t:function(t){const e=Math.floor(t.x/this.cellSize),i=Math.floor(t.y/this.cellSize);this.array[e][i]=t},h:function(t,e){const i=Math.floor(t.x/this.cellSize),s=Math.floor(t.y/this.cellSize);for(let o=i-5;o<i+5;o++)for(let i=s-5;i<s+5;i++)if(o>=0&&o<this.width&&i>=0&&i<this.height){const s=this.array[o][i];let a=1e10;if(void 0!==s&&(a=s.distanceTo(t)),a<e)return!0}return!1}},t.exports=(PIXOTRON.lerpDistribution=function(t,e,i){return(e=e||.47)*(1-t)+(i=i||7)*t},PIXOTRON.uniformDistribution=function(){return 1},PIXOTRON.cosineDistribution=function(t){const e=t*Math.PI/2,i=Math.cos(e);return.47*(1-i)+7*i},PIXOTRON.generateQuasiRandomPoints=function(t,e,i,n){i=i||PIXOTRON.uniformDistribution,n=n||PIXOTRON.insideCircle,e<0&&(e=Math.sqrt(t)/t);const h=[],r=[],l=e/Math.sqrt(2),c=new o(Math.ceil(1/l),Math.ceil(1/l),l),u=new THREE.Vector2(.5,.5);let d=!1;do{u.x=Math.random(),u.y=Math.random(),d=n(u.x,u.y)}while(!d);for(r.push(u),h.push(u),c.t(u);0!==r.length&&h.length<t;){const t=s(r);for(let s=0;s<30;s++){const s=t.x-.5,o=t.y-.5,l=i(Math.sqrt(s*s+o*o)),u=a(t,l*e);!n(u.x,u.y)||c.h(u,l*e)||(r.push(u),h.push(u),c.t(u))}}return h})},function(t,e,i){i(11),t.exports=PIXOTRON.QualityAdapter=class{constructor(t){this.u=t,this.currentQualitySetting=null,this.previousQualitySetting=null,this.v=!1,this.R=!1,this.T=!1}enable(){}disable(){}getCurrentQualitySetting(){return this.currentQualitySetting}update(){}onQualityChange(t){this.qualityChangedCallBack!==t&&(this.qualityChangedCallBack=t)}O(t){this.N(t,this.currentQualitySetting)?this.T&&console.log("No change in quality setting"):(this.previousQualitySetting=this.currentQualitySetting,this.currentQualitySetting=t,this.previousQualitySetting&&this.previousQualitySetting.exit(),this.currentQualitySetting.enter(),this.currentQualitySetting.change(this.u),this.qualityChangedCallBack&&this.qualityChangedCallBack(this.currentQualitySetting,this.previousQualitySetting))}N(t,e){return!(!t||!e)&&t.getQuality()===e.getQuality()}}},function(t,e){t.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")},t.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")},t.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(t,e){function i(t){return 0==(t&t-1)&&0!==t}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 t=THREE.CopyShader;PIXOTRON.D=THREE.UniformsUtils.clone(t.uniforms),PIXOTRON.P=new THREE.ShaderMaterial({uniforms:PIXOTRON.D,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,depthWrite:!1,depthTest:!1}),PIXOTRON.S=new THREE.ShaderMaterial({uniforms:PIXOTRON.D,vertexShader:t.vertexShader,fragmentShader:t.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)}(),t.exports=PIXOTRON.randomizeArray=function(t){let e,i,s=t.length;for(;0!==s;)i=Math.floor(Math.random()*s),e=t[s-=1],t[s]=t[i],t[i]=e;return t},t.exports=PIXOTRON.createTextureFromRawData=function(t,e){(e=e||{}).type=e.type||THREE.FloatType,e.format=e.format||THREE.LuminanceAlphaFormat,e.minFilter=e.minFilter||THREE.NearestFilter,e.magFilter=e.magFilter||THREE.NearestFilter;const i=new Float32Array(2*t.length);for(let e=0;e<2*t.length;e+=2)i[e]=t[e/2].x-.5,i[e+1]=t[e/2].y-.5;const s=new THREE.DataTexture(i,t.length,1);return s.format=e.format,s.type=e.type,s.minFilter=e.minFilter,s.magFilter=e.magFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s},t.exports=PIXOTRON.jitterCamera=function(t,e,i,s,o){o=void 0!==o?o:.5;const a=(2*e.x-1)*o,n=(2*e.y-1)*o;t.setViewOffset(i,s,a,n,i,s)},t.exports=PIXOTRON.insideCircle=function(t,e,i){const s=t-.5,o=e-.5;return s*s+o*o<=(i=void 0!==i?i:.5)*i},t.exports=PIXOTRON.insideRectangle=function(t,e,i,s){return i=void 0!==i?i:1,s=void 0!==s?s:1,t>=0&&e>=0&&t<=i&&e<=s},t.exports=PIXOTRON.blit=function(t,e,i,s){s=void 0!==s&&s,PIXOTRON.D.tDiffuse.value=e,PIXOTRON.quad.material=PIXOTRON.P,t.setRenderTarget(i),t.render(PIXOTRON.M,PIXOTRON.H),t.setRenderTarget(null)},t.exports=PIXOTRON.blitTransparent=function(t,e,i,s){s=void 0!==s&&s,PIXOTRON.D.tDiffuse.value=e,PIXOTRON.quad.material=PIXOTRON.S,t.setRenderTarget(i),t.render(PIXOTRON.M,PIXOTRON.H),t.setRenderTarget(null)},t.exports=PIXOTRON.renderPass=function(t,e,i,s){s=void 0!==s&&s,PIXOTRON.quad.material=e,t.setRenderTarget(i),t.render(PIXOTRON.M,PIXOTRON.H),t.setRenderTarget(null)},t.exports=PIXOTRON.calculateFOV=function(t,e,i){let s;t.isBox3?s=t:(s=new THREE.Box3).setFromObject(t);const o=new THREE.Vector3;s.getCenter(o);const a=new THREE.Vector3;s.getSize(a);const n=new THREE.Vector3;n.set(a.x/2,a.y/2,a.z/2),n.add(o),n.sub(e),n.normalize();let h=i.dot(n);return n.set(-a.x/2,a.y/2,a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),n.set(a.x/2,-a.y/2,a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),n.set(a.x/2,a.y/2,-a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),n.set(-a.x/2,-a.y/2,-a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),n.set(-a.x/2,a.y/2,-a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),n.set(a.x/2,-a.y/2,-a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),n.set(-a.x/2,-a.y/2,a.z/2),n.add(o),n.sub(e),n.normalize(),h=Math.min(i.dot(n),h),2*(180*Math.acos(h)/Math.PI)},t.exports=PIXOTRON.isPowerOfTwo=function(t){return i(t.width)&&i(t.height)},t.exports=PIXOTRON.makePowerOfTwo=function(t){function e(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap){const i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=e(t.width),i.height=e(t.height),i.getContext("2d").drawImage(t,0,0,i.width,i.height),i}return t},t.exports=PIXOTRON.getDataFromImage=function(t,e){const i=document.createElement("canvas"),s=e,o=e/(t.width/t.height);i.width=s,i.height=o;const a=i.getContext("2d");return a.drawImage(t,0,0,s,o),a.getImageData(0,0,s,o)},t.exports=PIXOTRON.getPixelFromImageData=function(t,e,i){const s=4*(e+t.width*i),o=t.data;return{r:o[s],g:o[s+1],b:o[s+2],a:o[s+3]}},t.exports=PIXOTRON.squareToUniformDiskConcentric=function(){const t=new THREE.Vector2;return function(e){const i=2*e.x-1,s=2*e.y-1;let o,a;0===i&&0===s?a=o=0:i*i>s*s?(a=i,o=Math.PI/4*(s/i)):(a=s,o=Math.PI/2-i/s*(Math.PI/4));const n=Math.sin(o),h=Math.cos(o);return t.x=a*h,t.y=a*n,t}}(),t.exports=PIXOTRON.squareToCosineHemisphere=function(){const t=new THREE.Vector3;return function(e){const i=PIXOTRON.squareToUniformDiskConcentric(e),s=Math.sqrt(1-i.x*i.x-i.y*i.y);return t.set(i.x,i.y,s),t}}(),t.exports=PIXOTRON.startPerformanceTest=function(t){return PIXOTRON.gpuProfiler&&PIXOTRON.gpuProfiler.start(t)},t.exports=PIXOTRON.endPerformanceTest=function(t,e){const i=PIXOTRON.gpuProfiler&&PIXOTRON.gpuProfiler.result(t);return i&&e.callback&&e.callback({time:i,name:e.name}),i}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});i(25);e.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(t,e,i){t.getClearColor(this.oldClearColor);const s=t.getClearAlpha(),o=t.autoClear;t.autoClear=!1,t.setClearColor(new THREE.Color(0,0,0),0),this.needsUpdate&&(this.C=0,this.needsUpdate=!1),this.I||this.X(t),this.C++,this._.uniforms.tCurrent.value=i.texture,this._.uniforms.tSumPrevious.value=this.I.texture,this._.uniforms.accIndex.value=this.C,PIXOTRON.renderPass(t,this._,e),PIXOTRON.blit(t,e,this.I),t.autoClear=o,t.setClearColor(this.oldClearColor,s)}setSize(t,e){this.I&&this.I.setSize(t,e)}X(t){const e={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat},i=new THREE.Vector2;t.getDrawingBufferSize(i);const s=i.x,o=i.y;this.I=new THREE.WebGLRenderTarget(s,o,e)}}},function(t,e,i){t.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;t.exports=PIXOTRON.Pixotron=class extends THREE.EventDispatcher{constructor(t){super(),(t=t||{}).saoparams=t.saoparams||{},t.shadowparams=t.shadowparams||{},t.gbufferparams=t.gbufferparams||{},t.outlineparams=t.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(t.gbufferparams);const e=void 0===t.saoparams.accumulative||t.saoparams.accumulative;this.U=e?new PIXOTRON.AccumulativeSAOPass(t.saoparams):new PIXOTRON.SAOPass(t.saoparams),this.V=new PIXOTRON.ShadowPass(t.shadowparams),this.L=new PIXOTRON.SuperSampleAAPass,this.B=PIXOTRON.generateQuasiRandomPoints(30,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle),this.k=new PIXOTRON.OutlinePass(t.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=t.giParams||{};this.enableGI=!!s.enable,this.enableGI&&this.initializeGI(s),this.$=new PIXOTRON.BVHManager}addNodeToAccelerationStructure(t,e){e?this.$.add(t):t.traverse(t=>{t.isMesh&&t.castShadow&&(t.updateMatrixWorld(),this.$.add(t))})}addRenderCompleteCallback(t){this.renderCompleteCallback=t,this.addEventListener("onRenderConverged",t)}removeRenderCompleteCallback(){this.removeEventListener("onRenderConverged",this.renderCompleteCallback),this.renderCompleteCallback=null}blit(t){if(this.tt){const e=t||null;PIXOTRON.blit(this.renderer,this.tt,e,!1)}this.blitHighlights()}dispose(){this.q.forEach(t=>{t.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(t){this.nt=t}initializeGI(t){this.it=new PIXOTRON.VPLGenerationPass(500),this.ht=new PIXOTRON.InstantRadiosityPass,this.q.push(this.it),this.q.push(this.ht)}insertPass(t,e){this.et.insertPass(t,e)}isAccumulationConverged(){const t=this.V.enableAccumulation,e=this.U.convergenceMetric()>=1,i=!t||this.V.convergenceMetric()>=1,s=!this.enableGI||this.ht.convergenceMetric()>=1;return i&&e&&s}isSuperSamplingConverged(){return this.C/this.B.length>=1}renderFrame(t,e,i,s){for(this.needsUpdate=!0;!this.isSuperSamplingConverged();)this.render(t,e,i,s)}render(t,e,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===e.uuid||(this.Z=i,this.G=e,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(t,e,i,s),this.ut(e),this.enableGI&&this.it.generateVPLs(e,this.areaLights[0],10,this.$),this.isSuperSamplingConverged()&&this.dt(),!this.isSuperSamplingConverged()){this.vt(t,e,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(t){if(this.Y&&this.Y.disable(),t&&this.Y){const e=this.Y.getCurrentQualitySetting(),i=t.getCurrentQualitySetting();if(e&&i){e.getQuality()!==i.getQuality()&&t.setQualitySetting(e)}}this.Y=t,this.Y.enable()}setSize(t,e){let i=t,s=e;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(t,e){this.lt&&(this.lt.feedBack.x=t,this.lt.feedBack.y=e)}pt(t){if(this.enableAA||this.isAccumulationConverged()){this.renderer.getDrawingBufferSize(s);const e=s.x,i=s.y,o=this.B[this.jitterIndex%this.B.length];PIXOTRON.jitterCamera(t,o,e,i)}if(this.isAccumulationConverged()){const t=this.B[this.jitterIndex%this.B.length];this.wt(t)}}ft(){this.U.enabled||(this.renderer.saoBuffer=this.j.texture);const t=this;const e=!this.V.enabled,i=!function(){let e=!0;return t.areaLights.forEach(t=>{t.castShadow||(e=!1)}),e}(),s=0===this.areaLights.length;(e||i||s)&&this.V.lights.forEach(t=>{t.shadow.map=this.W})}blitHighlights(){if(!this.getHighLightPass()||!this.nt)return;if(!this.nt[0])return;const t=this.renderer.autoClear;this.renderer.autoClear=!1,PIXOTRON.blitTransparent(this.renderer,this.getHighLightPass().Rt,null),this.renderer.autoClear=t}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(t){const e=this;this.punctualLights=[],this.areaLights=[],t.traverseVisible(function(t){(t instanceof THREE.DirectionalLight||t instanceof THREE.SpotLight)&&t.castShadow&&e.punctualLights.push(t),t instanceof THREE.RectAreaLight&&t.castShadow&&(t.shadow=t.shadow?t.shadow:{},t.C=t.C?t.C:0,e.areaLights.push(t))}),this.V.lights=this.areaLights}wt(t){this.punctualLights.forEach(e=>{PIXOTRON.jitterCamera(e.shadow.camera,t,e.shadow.mapSize.x,e.shadow.mapSize.y)})}X(t,e,i,s){this.renderer=t,this.Z=i,this.G=e,this.tt=s,this.at=new THREE.RenderPass(e,i),this.et=new THREE.EffectComposer(this.renderer,s);const o=new THREE.Vector2;t.getDrawingBufferSize(o),this.L.setSize(o.x,o.y),this.renderer.screenBufferSize=new THREE.Vector2(o.x,o.y),this.lt=new PIXOTRON.TemporalAAPass(i,this.F),this.et.addPass(this.at),this.ot=new PIXOTRON.UnrealBloomPass(this.F,new THREE.Vector2(o.width,o.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 a=s?new THREE.ShaderPass(THREE.CopyShader):new THREE.ShaderPass(THREE.GammaCorrectionShader);a.needsSwap=!1,this.et.addPass(a),this.et.renderToScreen=!s,this.bInitialized=!0;const n=new THREE.MeshBasicMaterial({color:16777215}),h=new THREE.MeshBasicMaterial({color:0});PIXOTRON.renderPass(t,n,this.W),PIXOTRON.renderPass(t,h,this.j),this.xt=t.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(t,e,i){t.getDrawingBufferSize(s);const o=s.x,a=s.y,n=this.B[this.jitterIndex%this.B.length];PIXOTRON.jitterCamera(i,n,o,a),this.F.render(t,e,i),this.U.render(t,i,this.F,this.A),this.V.render(t,e,i),this.enableGI&&this.ht.render(t,e,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(t,e){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,t,e,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 t=0;t<this.nt.length;++t)if(this.gt[t]&&this.nt[t].id!==this.gt[t].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(t,e){t.exports=PIXOTRON.Performance=class{constructor(t){this.u=t,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 t=this.Pt-this.St;this.Ht=1e3*this.Mt/t,this.Mt=0,this.St=this.Pt,this.u.dispatchEvent({type:"onFPSUpdate",fps:this.Ht,delta:t})}}yt(){this.Mt=0,this.Pt=performance.now(),this.St=performance.now()}converged(){this.rt=!0}}},function(t,e,i){i(8),t.exports=PIXOTRON.TextureAreaLightFilter=class{constructor(t){this._t=t,PIXOTRON.isPowerOfTwo(this._t.image)||(this._t.image=PIXOTRON.makePowerOfTwo(this._t.image));const e={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:t.image.width,y:t.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 t=0;t<this.It;t++){let s=new THREE.WebGLRenderTarget(i.x,i.y,e);this.zt.push(s),s=new THREE.WebGLRenderTarget(i.x,i.y,e),this.Xt.push(s),i.x=Math.ceil(i.x/2),i.y=Math.ceil(i.y/2),t<2&&this.At.push(1),t<5&&this.At.push(2),t>5&&this.At.push(3)}const o=PIXOTRON.AreaLightTextureFilterShader;this.Ft=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,defines:{NUM_SAMPLES:16}})}update(t){let e=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=e,PIXOTRON.renderPass(t,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(t,this.Ft,this.Xt[s],!0),e=this.Xt[s];const o=new Uint8Array(4*e.width*e.height);t.setRenderTarget(e),t.readRenderTargetPixels(e,0,0,e.width,e.height,o),i.mipmaps[s]={data:o,width:e.width,height:e.height}}return i.generateMipmaps=!1,i.needsUpdate=!0,this.bt(),i}bt(){for(let t=0;t<this.It;t++)this.zt[t].dispose(),this.zt[t]=null,this.Xt[t].dispose(),this.Xt[t]=null}}},function(t,e){t.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(t,e){t.exports=PIXOTRON.BVHManager=class{constructor(){this.meshes=[]}buildBVHTree(t){let e=null;t.geometry.index&&(e=t.geometry.index.array);let s=t.geometry.attributes.position.array,u=t.geometry.attributes.uv?t.geometry.attributes.uv.array:void 0;if(e){const t=new Float32Array(3*e.length);for(let i=0;i<e.length;i++){const o=3*e[i];t[3*i]=s[o],t[3*i+1]=s[o+1],t[3*i+2]=s[o+2]}if(s=t,u){const t=new Float32Array(2*e.length);for(let i=0;i<e.length;i++){const s=2*e[i];t[2*i]=u[s],t[2*i+1]=u[s+1]}u=t}}return new class{constructor(t,e,s){this.positions=t,this.uvs=e,this._maxTrianglesPerNode=s||10,this._bboxArray=function(t){let e,i,s,o,a,n,h,r,c,u,d,v,m,f,p;const E=t.length/9,w=new Float32Array(7*E);for(let R=0;R<E;R++)e=t[9*R],i=t[9*R+1],s=t[9*R+2],o=t[9*R+3],a=t[9*R+4],n=t[9*R+5],h=t[9*R+6],r=t[9*R+7],c=t[9*R+8],u=Math.min(Math.min(e,o),h),d=Math.min(Math.min(i,a),r),v=Math.min(Math.min(s,n),c),m=Math.max(Math.max(e,o),h),f=Math.max(Math.max(i,a),r),p=Math.max(Math.max(s,n),c),l(w,R,R,u,d,v,m,f,p);return w}(t),this._bboxHelper=new Float32Array(this._bboxArray.length),this._bboxHelper.set(this._bboxArray);const o=t.length/9,a=this.calcExtents(0,o,i);for(this._rootNode=new c(a[0],a[1],0,o,0),this._nodesToSplit=[this._rootNode];this._nodesToSplit.length>0;){const t=this._nodesToSplit.pop();this.splitNode(t)}}calcExtents(t,e,i){if(i=i||0,t>=e)return[{x:0,y:0,z:0},{x:0,y:0,z:0}];let s=Number.MAX_VALUE,o=Number.MAX_VALUE,a=Number.MAX_VALUE,n=-Number.MAX_VALUE,h=-Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let i=t;i<e;i++)s=Math.min(this._bboxArray[7*i+1],s),o=Math.min(this._bboxArray[7*i+2],o),a=Math.min(this._bboxArray[7*i+3],a),n=Math.max(this._bboxArray[7*i+4],n),h=Math.max(this._bboxArray[7*i+5],h),r=Math.max(this._bboxArray[7*i+6],r);return[{x:s-i,y:o-i,z:a-i},{x:n+i,y:h+i,z:r+i}]}splitNode(t){if(t.elementCount()<=this._maxTrianglesPerNode||0===t.elementCount())return;const e=t._startIndex,s=t._endIndex,o=[[],[],[]],a=[[],[],[]],n=[t.centerX(),t.centerY(),t.centerZ()],h=[t._extentsMax.x-t._extentsMin.x,t._extentsMax.y-t._extentsMin.y,t._extentsMax.z-t._extentsMin.z],l=[];l.length=3;for(let t=e;t<s;t++){l[0]=.5*(this._bboxArray[7*t+1]+this._bboxArray[7*t+4]),l[1]=.5*(this._bboxArray[7*t+2]+this._bboxArray[7*t+5]),l[2]=.5*(this._bboxArray[7*t+3]+this._bboxArray[7*t+6]);for(let e=0;e<3;e++)l[e]<n[e]?o[e].push(t):a[e].push(t)}const u=[];if(u.length=3,u[0]=0===o[0].length||0===a[0].length,u[1]=0===o[1].length||0===a[1].length,u[2]=0===o[2].length||0===a[2].length,u[0]&&u[1]&&u[2])return;const d=[0,1,2];let v,m;d.sort(function(t,e){return h[e]-h[t]});for(let t=0;t<3;t++){const e=d[t];if(!u[e]){v=o[e],m=a[e];break}}const f=e,p=f+v.length,E=p,w=s;let R,T=t._startIndex;const x=v.concat(m);for(let t=0;t<x.length;t++)R=x[t],r(this._bboxArray,R,this._bboxHelper,T),T++;const O=this._bboxHelper.subarray(7*t._startIndex,7*t._endIndex);this._bboxArray.set(O,7*t._startIndex);const N=this.calcExtents(f,p,i),D=this.calcExtents(E,w,i),g=new c(N[0],N[1],f,p,t._level+1),P=new c(D[0],D[1],E,w,t._level+1);t._node0=g,t._node1=P,t.clearShapes(),this._nodesToSplit.push(g),this._nodesToSplit.push(P)}intersectRay(t,e,i){const s=[this._rootNode],r=[],l=[];let c;const u=new THREE.Vector3(1/e.x,1/e.y,1/e.z);for(;s.length>0;){const e=s.pop();if(a(t,u,e))for(e._node0&&s.push(e._node0),e._node1&&s.push(e._node1),c=e._startIndex;c<e._endIndex;c++)r.push(this._bboxArray[7*c])}const d=new THREE.Vector3,v=new THREE.Vector3,m=new THREE.Vector3,f=new THREE.Vector2,p=new THREE.Vector2,E=new THREE.Vector2,w=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector2,x=new THREE.Vector3(t.x,t.y,t.z),O=new THREE.Vector3(e.x,e.y,e.z);for(c=0;c<r.length;c++){const t=r[c];d.fromArray(this.positions,9*t),v.fromArray(this.positions,9*t+3),m.fromArray(this.positions,9*t+6);const e=o(d,v,m,x,O,i);e&&(this.uvs&&(f.fromArray(this.uvs,6*t),p.fromArray(this.uvs,6*t+2),E.fromArray(this.uvs,6*t+4),n(e,d,v,m,f,p,E,w,T)),h(d,v,m,R),l.push({point:e,uv:T,face:{index:t,a:d.clone(),b:v.clone(),c:m.clone(),normal:R}}))}return l}}(s,u,7)}add(t){this.meshes[t.uuid]||(this.meshes.push({id:t.uuid,val:t}),t.bvh=this.buildBVHTree(t))}intersectRay(t){const e=new THREE.Ray,i=new THREE.Matrix4;let s=[];for(let o=0;o<this.meshes.length;o++){const a=this.meshes[o].val;e.origin.copy(t.origin),e.direction.copy(t.direction),i.getInverse(a.matrixWorld),e.origin.applyMatrix4(i),e.direction.transformDirection(i);const n=a.bvh.intersectRay(e.origin,e.direction,!0);n.length>0&&n.forEach(function(e){e.object=a,e.point.applyMatrix4(a.matrixWorld),e.distance=t.origin.distanceToSquared(e.point)}),s=s.concat(n)}return s.sort(function(t,e){return t.distance>e.distance}),s}};const i=1e-6;function s(t,e,i,s){const o={min:0,max:0};return s>=0?(o.min=(t-i)*s,o.max=(e-i)*s):(o.min=(e-i)*s,o.max=(t-i)*s),o}const o=function(){const t=new THREE.Vector3,e=new THREE.Vector3,i=new THREE.Vector3,s=new THREE.Vector3;return function(o,a,n,h,r,l){e.subVectors(a,o),i.subVectors(n,o),s.crossVectors(e,i);let c,u=r.dot(s);if(u>0){if(l)return null;c=1}else{if(!(u<0))return null;c=-1,u=-u}t.subVectors(h,o);const d=c*r.dot(i.crossVectors(t,i));if(d<0)return null;const v=c*r.dot(e.cross(t));if(v<0)return null;if(d+v>u)return null;const m=-c*t.dot(s);if(m<0)return null;const f=m/u;return(new THREE.Vector3).copy(r).multiplyScalar(f).add(h)}}();function a(t,e,i){const o=s(i._extentsMin.x,i._extentsMax.x,t.x,e.x),a=s(i._extentsMin.y,i._extentsMax.y,t.y,e.y);if(o.min>a.max||a.min>o.max)return!1;(a.min>o.min||o.min!=o.min)&&(o.min=a.min),(a.max<o.max||o.max!=o.max)&&(o.max=a.max);const n=s(i._extentsMin.z,i._extentsMax.z,t.z,e.z);return!(o.min>n.max||n.min>o.max)&&((n.min>o.min||o.min!=o.min)&&(o.min=n.min),(n.max<o.max||o.max!=o.max)&&(o.max=n.max),!(o.max<0))}function n(t,e,i,s,o,a,n,h,r){return THREE.Triangle.getBarycoord(t,e,i,s,h),o.multiplyScalar(h.x),a.multiplyScalar(h.y),n.multiplyScalar(h.z),o.add(a).add(n),r.copy(o),r}function h(t,e,i,s){const o=s||new THREE.Vector3,a=new THREE.Vector3;o.subVectors(i,e),a.subVectors(t,e),o.cross(a);const n=o.lengthSq();return n>0?o.multiplyScalar(1/Math.sqrt(n)):o.set(0,0,0)}function r(t,e,i,s){i[7*s]=t[7*e],i[7*s+1]=t[7*e+1],i[7*s+2]=t[7*e+2],i[7*s+3]=t[7*e+3],i[7*s+4]=t[7*e+4],i[7*s+5]=t[7*e+5],i[7*s+6]=t[7*e+6]}function l(t,e,i,s,o,a,n,h,r){t[7*e]=i,t[7*e+1]=s,t[7*e+2]=o,t[7*e+3]=a,t[7*e+4]=n,t[7*e+5]=h,t[7*e+6]=r}class c{constructor(t,e,i,s,o){this._extentsMin=t,this._extentsMax=e,this._startIndex=i,this._endIndex=s,this._level=o,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(t,e){PIXOTRON.queryId=-1;t.exports=PIXOTRON.GPUProfiler=class{constructor(t){this.xt=t,this.Ot=this.xt.getExtension("EXT_disjoint_timer_query"),this.queryPool={},this.Ot||console.warn("GPUProfiler::EXT_disjoint_timer_query not supported!")}start(t){const e=this.popAvailableQuery(t);return this.Ot&&e&&e.start(this.Ot),e.id}result(t){let e;const i=this.queryPool[t];if(i)return this.end(i),this.available(i)&&(e=this.value(i)),e}end(t){this.Ot&&t&&t.end(this.Ot)}available(t){if(this.Ot){return this.Ot.getQueryObjectEXT(t.Ut,this.Ot.QUERY_RESULT_AVAILABLE_EXT)}}value(t){if(this.Ot){let e;return this.xt.getParameter(this.Ot.GPU_DISJOINT_EXT)||(e=1e-6*this.Ot.getQueryObjectEXT(t.Ut,this.Ot.QUERY_RESULT_EXT),t.dirty=!1),e}}Vt(t){let e=this.queryPool[t];return e||(e=new class{constructor(t){this.dirty=!1,this.id=++PIXOTRON.queryId,this.Ut=t.createQueryEXT()}start(t){this.dirty||t.beginQueryEXT(t.TIME_ELAPSED_EXT,this.Ut)}end(t){this.dirty||t.endQueryEXT(t.TIME_ELAPSED_EXT),this.dirty=!0}}(this.Ot),this.queryPool[e.id]=e),e}}},function(t,e){t.exports=PIXOTRON.QualitySettings=class{constructor(t){this.Lt=void 0!==t?t:-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(t){const e=t.getSAOPass();e.enabled=this.saoQualitySettings.enabled,e.setDownscaleLevel(this.saoQualitySettings.downscale),e.blurEnabled=this.saoQualitySettings.enableBlur;const i=t.getShadowPass();i.enabled=this.shadowQualitySettings.enabled,i.setDownscaleLevel(this.shadowQualitySettings.downscale),t.enableAA=this.enableAA,t.needsUpdate=!0}setQuality(t){this.Lt=t}getQuality(){return this.Lt}lock(){this.Bt=!0}unLock(){this.Bt=!1}isLocked(){return this.Bt}onEnter(t){this.Wt=t}onExit(t){this.jt=t}onUpdate(t){this.Zt=t}enter(){this.Wt&&this.Wt()}update(){this.Zt&&this.Zt()}exit(){this.jt&&this.jt()}},t.exports=PIXOTRON.TestQualitySettings=class extends PIXOTRON.QualitySettings{constructor(t){super(t),this.Gt=0}setTestFps(t){this.Gt=t}getTestFps(){return this.Gt}},t.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}}},t.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}}},t.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}}},t.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}}},t.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(t,e,i){i(1),t.exports=PIXOTRON.AutoQualityAdapter=class extends PIXOTRON.QualityAdapter{constructor(t){super(t),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(t){this.Kt.push(t),this.Kt.sort((t,e)=>t.getQuality()>e.getQuality()?-1:1);const e=this.Kt[0];this.O(e)}needsChange(){this.se=!0}tryUpgrade(){this.R=!0}setQualitySetting(t){if(this.rt(),!this.oe(t))throw new Error("AutoQualityAdapter:: quality not added");this.tryUpgrade(),this.O(t)}setDesiredFps(t){this.ie=t}setMaxWaitTime(t){this.te=t}setNumWaitCycles(t){this.$t=t}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(t){for(let e=0;e<this.Kt.length;++e)if(t.getQuality()===this.Kt[e].getQuality())return!0;return!1}rt(){this.timeElapsed=0,this.Jt=0}Qt(t){this.timeElapsed+=t.delta,this.he(t.fps),this.T&&console.log(this.Yt)}ae(){const t=this.ee>=this.$t,e=this.timeElapsed>this.te,i=this.se||t||e;return this.se=!1,i}qt(){this.ee++}he(t){this.Jt++,this.Yt=this.Yt*(this.Jt-1)+t,this.Yt/=this.Jt}re(t){return this.Yt>=t}le(){let t;for(let e=0;e<this.Kt.length;++e)this.Kt[e].getQuality()===this.currentQualitySetting.getQuality()&&(t=e);return t}ce(){let t=this.le()-1;return t=Math.max(t,0),this.Kt[t]}ue(){let t=this.le()+1;return t=Math.min(t,this.Kt.length-1),this.Kt[t]}de(){return!this.previousQualitySetting||(!!this.R||this.previousQualitySetting.getQuality()<=this.currentQualitySetting.getQuality())}ne(){if(this.rt(),this.currentQualitySetting.isLocked())return void(this.T&&console.log("Current Setting is locked :: Keep current Setting"));if(this.re(this.ie)){if(!this.de())return void(this.T&&console.log("Every thing is fine :: Keep current Setting"));{const t=this.ce();this.O(t)}}else{const t=this.ue();this.O(t)}this.R=!1}},t.exports=PIXOTRON.AutoTestQualityAdapter=class extends PIXOTRON.AutoQualityAdapter{constructor(t){super(t)}getAverageFps(){return this.currentQualitySetting.getTestFps()}Qt(t){this.timeElapsed+=t.delta,t.fps=this.currentQualitySetting.getTestFps(),this.he(t.fps),this.T&&console.log("Average Fps ",this.Yt)}}},function(t,e,i){i(1),t.exports=PIXOTRON.ManualQualityAdapter=class extends PIXOTRON.QualityAdapter{constructor(t){super(t),this.update=this.update.bind(this),this.qualitySettings=0}setQualitySetting(t){this.O(t)}}},function(t,e,i){i(15),t.exports=PIXOTRON.GBufferPass=class{constructor(t){t=t||{},this.forceDepthAndNormalPass=void 0===t.forceDepthAndNormalPass||t.forceDepthAndNormalPass,this.packingMode=void 0!==t.packingMode?t.packingMode:PIXOTRON.GBufferPass.DEPTH_NORMAL_16,this.ve=new THREE.MeshNormalMaterial,this.me=new THREE.ShaderMaterial(PIXOTRON.PackingShader_DepthNormal16),this.fe=void 0===t.linearDepth||t.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(t,e){this.Ee&&this.Ee.setSize(t,e),this.we&&this.we.setSize(t,e),this.Re&&this.Re.setSize(t,e)}render(t,e,i){this.Te||this.X(t),t.getClearColor(this.oldClearColor);const s=t.getClearAlpha(),o=t.autoClear,a=t.shadowMap.enabled;t.shadowMap.enabled=!1,t.autoClear=!1,t.setClearColor(new THREE.Color(0,0,0),0),this.xe(t,e,i),t.autoClear=o,t.shadowMap.enabled=a,t.setClearColor(this.oldClearColor,s)}X(t){const e=t.extensions,i=t.capabilities.isWebGL2||e.get("WEBGL_depth_texture"),s=new THREE.Vector2;t.getDrawingBufferSize(s);const o=s.x,a=s.y;if(!this.forceDepthAndNormalPass&&i&&!this.Re){const t={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.Re=new THREE.WebGLRenderTarget(o,a,t),this.Nt||(this.Nt=new THREE.DepthTexture,this.Nt.type=THREE.UnsignedShortType),this.Re.depthTexture=this.Nt}if(!i||this.forceDepthAndNormalPass){const t={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.packingMode===PIXOTRON.GBufferPass.NONE&&(this.we||(this.we=new THREE.WebGLRenderTarget(o,a,t),this.we.depthTexture=this.Nt),this.Re||(this.Re=new THREE.WebGLRenderTarget(o,a,t),this.Re.depthTexture=this.Nt)),this.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(this.Ee||(this.Ee=new THREE.WebGLRenderTarget(o,a,t),this.Ee.depthTexture=this.Nt))}this.Te=!0}xe(t,e,i){!function(t){t.traverse(function(t){if(t.isMesh||t.isLineSegments||t.isLine||t.isLineLoop||t.isPoints){let e=t.material&&t.material.transparent||t.castAO;(e=(e=t.material&&t.material.transparent&&!t.material.isShadowMaterial||!!t.castAO)||t.material.alphaTest>0)&&(t.aoVisibility=t.visible,t.visible=!1)}})}(e),this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),this.K=0;const s=t.extensions,o=t.capabilities.isWebGL2||s.get("WEBGL_depth_texture");o&&!this.forceDepthAndNormalPass&&(e.overrideMaterial=this.ve,t.setRenderTarget(this.Re),t.clear(!0,!0,!1),t.render(e,i),t.setRenderTarget(null),e.overrideMaterial=null),o&&!this.forceDepthAndNormalPass||(this.packingMode===PIXOTRON.GBufferPass.NONE&&(e.overrideMaterial=this.ve,t.setRenderTarget(this.Re),t.clear(!0,!0,!1),t.render(e,i),t.setRenderTarget(null),e.overrideMaterial=null,e.overrideMaterial=this.pe,this.pe.isMeshDepthMaterial||(this.pe.uniforms.cameraNearFar.value.x=i.near,this.pe.uniforms.cameraNearFar.value.y=i.far),t.setRenderTarget(this.we),t.clear(!0,!0,!1),t.render(e,i,this.we),t.setRenderTarget(null),e.overrideMaterial=null),this.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(e.overrideMaterial=this.me,this.me.uniforms.cameraNearFar.value.x=i.near,this.me.uniforms.cameraNearFar.value.y=i.far,t.setRenderTarget(this.Ee),t.clear(!0,!0,!1),t.render(e,i),t.setRenderTarget(null),e.overrideMaterial=null));const a=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"GBuffer Pass"});a&&(this.K+=a),function(t){t.traverse(function(t){t.aoVisibility&&(t.visible=t.aoVisibility,t.aoVisibility=void 0)})}(e)}},PIXOTRON.GBufferPass.NONE=0,PIXOTRON.GBufferPass.DEPTH_NORMAL_16=1},function(t,e){t.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); }"},t.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(t,e,i){i(0),i(17),i(2);const s=new THREE.Vector2;t.exports=PIXOTRON.AccumulativeSAOPass=class{constructor(t){t=t||{},this.intensity=void 0!==t.intensity?t.intensity:.25,this.occlusionWorldRadius=void 0!==t.occlusionWorldRadius?t.occlusionWorldRadius:.8,this.smoothTransition=void 0===t.smoothTransition||t.smoothTransition,this.bias=void 0!==t.bias?t.bias:.001,this.numSamples=void 0!==t.numSamples?t.numSamples:600,this.Oe=void 0!==t.samplesPerFrame?t.samplesPerFrame:4,this.Ne=void 0!==t.downscaleLevel?t.downscaleLevel:1,this.Ne=this.Ne<1?1:this.Ne,this.falloff=void 0!==t.falloff?t.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(t,e,i,o){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(t),this.ge(this.numSamples),this._e(this.C-1),t.getClearColor(this.oldClearColor);const a=t.getClearAlpha(),n=t.autoClear;t.autoClear=!1,t.getDrawingBufferSize(s);const h=s.x/this.Ne,r=s.y/this.Ne;this.Pe.uniforms.size.value.set(h,r),this.Ie(h,r),this.ze(e,i);const l=this.C%2==0?this.ye:this.Ce,c=this.C%2==0?this.Ce:this.ye;this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),this.K=0,this.Xe(t,l,c);const u=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"Acc SAO Render"});if(u&&(this.K+=u),this.blurEnabled&&this.convergenceMetric()>.9){this.blurQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.blurQueryId),o.edgeSharpness=this.edgeSharpness,o.render(t,c,e,i);const s=this.debug&&PIXOTRON.endPerformanceTest(this.blurQueryId,{callback:this.debugCallback,name:"Acc SAO Blur"});s&&(this.K+=s)}this.Ae(t,l,c),t.autoClear=n,t.setClearColor(this.oldClearColor),t.setClearAlpha(a),t.saoBuffer=this.smoothTransition?l:c}setDownscaleLevel(t){this.Ne=t||1,this.Ne=this.Ne<1?1:this.Ne,this.needsUpdate=!0}setSize(t,e){this.ye&&this.ye.setSize(t,e),this.Ce&&this.Ce.setSize(t,e),this.Pe.uniforms.size.value.set(t,e)}X(t){t.getDrawingBufferSize(s);const e=s.x/this.Ne,i=s.y/this.Ne;if(!this.Ce){const t={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.Ce=new THREE.WebGLRenderTarget(e,i,t),this.ye=new THREE.WebGLRenderTarget(e,i,t)}}Xe(t,e,i){this.Pe.uniforms.tAOSumPrevious.value=e.texture,PIXOTRON.renderPass(t,this.Pe,i)}Ae(t,e,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(t,this.Se,e);const s=this.debug&&PIXOTRON.endPerformanceTest(this.transitionQueryId,{callback:this.debugCallback,name:"Acc SAO Transition"});s&&(this.K+=s)}}Ie(t,e){(this.Ce.width!==t||this.Ce.height!==e)&&this.Ce.setSize(t,e)}ze(t,e){const i=1/(2*Math.tan(THREE.MathUtils.DEG2RAD*t.fov/2)),s=this.Pe.uniforms.saoData.value;s.x=i,s.y=this.intensity,s.z=this.occlusionWorldRadius,s.w=this.C;const o=this.Pe.uniforms.saoBiasEpsilon.value;o.x=this.bias,o.y=.001,o.z=this.falloff;const a=this.Pe.uniforms.cameraNearFar.value;let n;a.x=t.near,a.y=t.far,this.Pe.uniforms.ProjectionMatrix.value=t.projectionMatrix,n=e.Nt?e.Nt:e.we?e.we.texture:null;const h=e.Re?e.Re.texture:null;let r;e.we||(r=e.Ee?e.Ee.texture:null);let l=e.Nt?0:1;e.forceDepthAndNormalPass&&e.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(l=2),this.Pe.defines.DEPTH_PACKING_MODE=l,this.Pe.defines.DEPTH_NORMAL_TEXTURE=r?1:0,this.Pe.defines.LINEAR_DEPTH=e.fe?1:0,this.Pe.uniforms.quasiRandomSamples.value=this.Me,r?this.Pe.uniforms.tNormalDepth.value=r:(this.Pe.uniforms.tNormal.value=h,this.Pe.uniforms.tDepth.value=n)}_e(t){let e=this.Oe*t,i=0;for(i=0;i<this.Oe;i++)this.Me[i]=this.Fe[e++],void 0===this.Me[i]&&(this.Me[i]=this.Fe[e%this.Oe])}ge(t){t!==this.De&&(this.De=t,this.Fe=PIXOTRON.generateQuasiRandomPoints(t,-1,PIXOTRON.lerpDistribution,PIXOTRON.insideCircle),this.Fe=PIXOTRON.randomizeArray(this.Fe),this.He=this.Fe.length)}}},function(t,e){t.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(t,e,i){i(0),i(19);const s=new THREE.Vector2;t.exports=PIXOTRON.SAOPass=class{constructor(t){t=t||{},this.intensity=void 0!==t.intensity?t.intensity:.25,this.occlusionWorldRadius=void 0!==t.occlusionWorldRadius?t.occlusionWorldRadius:.8,this.bias=void 0!==t.bias?t.bias:.001,this.Ne=void 0!==t.downscaleLevel?t.downscaleLevel:1,this.Ne=this.Ne<1?1:this.Ne,this.falloff=void 0!==t.falloff?t.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(t){this.Ne=t||1,this.Ne=this.Ne<1?1:this.Ne,this.needsUpdate=!0}setSize(t,e){this.Ce&&this.Ce.setSize(t,e),this.be.uniforms.size.value.set(t,e)}convergenceMetric(){return this.enabled?this.C>1?1:0:1}render(t,e,i,o){if(!this.enabled)return;this.needsUpdate&&(this.C=0,this.needsUpdate=!1),this.Ce||this.X(t),t.getDrawingBufferSize(s);const a=s.x/this.Ne,n=s.y/this.Ne;this.be.uniforms.size.value.set(a,n),this.Ie(a,n),this.ze(e,i),t.getClearColor(this.oldClearColor);const h=t.getClearAlpha(),r=t.autoClear;t.autoClear=!1,this.K=0,this.queryId=this.debug&&PIXOTRON.startPerformanceTest(this.queryId),PIXOTRON.renderPass(t,this.be,this.Ce);const l=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"SAO Render"});if(l&&(this.K+=l),this.blurEnabled){this.blurQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.blurQueryId),o.edgeSharpness=this.edgeSharpness,o.render(t,this.Ce,e,i);const s=this.debug&&PIXOTRON.endPerformanceTest(this.blurQueryId,{callback:this.debugCallback,name:"SAO Blur"});s&&(this.K+=s)}t.autoClear=r,t.setClearColor(this.oldClearColor),t.setClearAlpha(h),t.saoBuffer=this.Ce}X(t){t.getDrawingBufferSize(s);const e=s.x/this.Ne,i=s.y/this.Ne;if(!this.Ce){const t={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.Ce=new THREE.WebGLRenderTarget(e,i,t)}}Ie(t,e){(this.Ce.width!==t||this.Ce.height!==e)&&this.Ce.setSize(t,e)}ze(t,e){const i=1/(2*Math.tan(THREE.MathUtils.DEG2RAD*t.fov/2)),s=this.be.uniforms.saoData.value;s.x=i,s.y=this.intensity,s.z=this.occlusionWorldRadius,s.w=this.C++;const o=this.be.uniforms.saoBiasEpsilon.value;o.x=this.bias,o.y=.001,o.z=this.falloff;const a=this.be.uniforms.cameraNearFar.value;let n;a.x=t.near,a.y=t.far,this.be.uniforms.ProjectionMatrix.value=t.projectionMatrix,n=e.Nt?e.Nt:e.we?e.we.texture:null;const h=e.Re?e.Re.texture:null;let r;e.we||(r=e.Ee?e.Ee.texture:null);let l=e.Nt?0:1;e.forceDepthAndNormalPass&&e.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(l=2),this.be.defines.DEPTH_PACKING_MODE=l,this.be.defines.DEPTH_NORMAL_TEXTURE=r?1:0,this.be.defines.LINEAR_DEPTH=e.fe?1:0,r?this.be.uniforms.tNormalDepth.value=r:(this.be.uniforms.tNormal.value=h,this.be.uniforms.tDepth.value=n)}}},function(t,e){t.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(t,e,i){i(0),i(2),i(21);const s=new THREE.Vector2;function o(t,e){t.traverse(function(t){if(t.isMesh||t.isLineSegments||t.isLine||t.isLineLoop||t.isPoints){(e?t.castShadow:t.receiveShadow)||(t.oldVisibility=t.visible,t.visible=!1)}})}function a(t){t.traverse(function(t){t.oldVisibility&&(t.visible=t.oldVisibility,t.oldVisibility=void 0)})}t.exports=PIXOTRON.ShadowPass=class{constructor(t){t=t||{},this.linearDepth=void 0!==t.linearDepth?t.linearDepth:1,this.shadowMapResolution=void 0!==t.shadowMapResolution?t.shadowMapResolution:1024,this.shadowRadius=void 0!==t.shadowRadius?t.shadowRadius:1,this.shadowQuality=void 0!==t.shadowQuality?t.shadowQuality:1,this.smoothTransition=void 0===t.smoothTransition||t.smoothTransition,this.shadowBiasMultiplier=void 0!==t.shadowBiasMultiplier?t.shadowBiasMultiplier:1,this.numSamples=void 0!==t.numSamples?t.numSamples:100,this.side=void 0!==t.side?t.side:THREE.FrontSide,this.Ne=void 0!==t.downscaleLevel?t.downscaleLevel:1,this.Ne=this.Ne<1?1:this.Ne;const e=void 0!==t.nearPlane?t.nearPlane:.1,i=void 0!==t.farPlane?t.farPlane:10,s=void 0!==t.fov?t.fov:110;this.Ue=new THREE.PerspectiveCamera(s,1,e,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 t=0;return this.lights.forEach(e=>{e.castShadow&&t++}),0!==t?this.C/(t*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(t,e,i){if(this.needsUpdate&&(this.C=0,this.Le=0,this.needsUpdate=!1,this.lights.forEach(t=>{t.C=0})),!this.enableAccumulation&&this.C>0)return;if(this.convergenceMetric()>=1)return;t.getDrawingBufferSize(s);const o=s.x/this.Ne,a=s.y/this.Ne;this.Ge||(this.Ue.layers.mask=i.layers.mask,this.Ye(o,a)),this.$e(o,a),this.Ve(this.numSamples),t.getClearColor(this.oldClearColor);const n=t.getClearAlpha(),h=t.autoClear;let r,l;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(t,e,this.Be,this.Ge),r=this.C%2==0?this.Qe:this.qe,l=this.C%2==0?this.qe:this.Qe,this.ii(t,e,i,r,l,s),this.smoothTransition&&this.C===this.lights.length&&PIXOTRON.blit(t,l.texture,this.Ke);const o=this.debug&&PIXOTRON.endPerformanceTest(this.queryId,{callback:this.debugCallback,name:"Shadow Pass"});o&&(this.K+=o)}),this.smoothTransition){this.smoothTransitionQueryId=this.debug&&PIXOTRON.startPerformanceTest(this.smoothTransitionQueryId),this.Se.uniforms.shadowAccumulationBuffer.value=l.texture,this.Se.uniforms.firstFrameShadowBuffer.value=this.Ke.texture,this.Se.uniforms.transition.value=this.convergenceMetric(),PIXOTRON.renderPass(t,this.Se,r);const e=this.debug&&PIXOTRON.endPerformanceTest(this.smoothTransitionQueryId,{callback:this.debugCallback,name:"Shadow Transition"});e&&(this.K+=e)}t.autoClear=h,t.setClearColor(this.oldClearColor),t.setClearAlpha(n),this.lights.forEach(t=>{t.shadow.map=this.smoothTransition?r:l})}setDownscaleLevel(t){this.Ne=t||1,this.Ne=this.Ne<1?1:this.Ne,this.needsUpdate=!0}setSize(t,e){this.Qe&&this.Qe.setSize(t,e),this.qe&&this.qe.setSize(t,e),this.Ge&&this.Ge.setSize(t,e),this.Ke&&this.Ke.setSize(t,e),this.Je&&this.Je.uniforms.shadowBufferSize.value.set(t,e)}$e(t,e){(this.Qe.width!==t||this.Qe.height!==e)&&(this.Qe.setSize(t,e),this.qe.setSize(t,e),this.Ke.setSize(t,e),this.Je.uniforms.shadowBufferSize.value=new THREE.Vector2(t,e))}Ye(t,e){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(t,e,i),this.qe=new THREE.WebGLRenderTarget(t,e,i),this.Ke=new THREE.WebGLRenderTarget(t,e,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(t,e),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(t,e,i,s,n,h){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=h.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,t.setClearColor(0),o(e,!1);const r=t.shadowMap.enabled;t.shadowMap.enabled=!1,e.overrideMaterial=this.Je,t.setRenderTarget(n),t.clear(!0,!0,!1),t.render(e,i),t.setRenderTarget(null),e.overrideMaterial=null,a(e),t.shadowMap.enabled=r}ei(t,e,i,s){o(e,!0),this.Ue.position.copy(i),this.We.copy(i),this.We.addScaledVector(this.ke,10),this.Ue.lookAt(this.We),this.Ue.updateMatrixWorld(),e.overrideMaterial=this.pe,this.linearDepth&&(this.pe.uniforms.cameraNearFar.value.x=this.Ue.near,this.pe.uniforms.cameraNearFar.value.y=this.Ue.far),t.setClearColor(0),t.setRenderTarget(s),t.clear(!0,!0,!1),t.render(e,this.Ue),t.setRenderTarget(null),e.overrideMaterial=null,a(e)}ti(t){let e=t.C-1;const i=t.matrixWorld;e%=this.Ze.length-1;const s=this.Ze[e];if(this.Be.x=(s.x-.5)*t.width,this.Be.z=0,this.Be.y=(s.y-.5)*t.height,this.Be.applyMatrix4(i),this.ke.set(0,0,-1),this.ke.transformDirection(i),this.shadowRecieverBBox){const t=PIXOTRON.calculateFOV(this.shadowRecieverBBox,this.Be,this.ke);this.setFOV(t)}}setShadowRecieverBBox(t){this.shadowRecieverBBox=t}setFOV(t){this.Ue.fov=t,this.Ue.updateProjectionMatrix()}Ve(t){t!==this.De&&(this.De=t,this.Ze=PIXOTRON.generateQuasiRandomPoints(t,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle),this.Ze=PIXOTRON.randomizeArray(this.Ze),this.Ze.splice(0,0,new THREE.Vector2(.5,.5)))}}},function(t,e){t.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(t,e,i){i(0),i(2),i(23),i(24),t.exports=PIXOTRON.PlaneShadowBakePass=class{constructor(t){t=t||{},this.linearDepth=void 0!==t.linearDepth?t.linearDepth:1,this.shadowMapResolution=void 0!==t.shadowMapResolution?t.shadowMapResolution:1024,this.shadowRadius=void 0!==t.shadowRadius?t.shadowRadius:1,this.shadowQuality=void 0!==t.shadowQuality?t.shadowQuality:1,this.smoothTransition=void 0===t.smoothTransition||t.smoothTransition,this.shadowBiasMultiplier=void 0!==t.shadowBiasMultiplier?t.shadowBiasMultiplier:1,this.numSamples=void 0!==t.numSamples?t.numSamples:2e3,this.numSamplesPerFrame=void 0!==t.numSamplesPerFrame?t.numSamplesPerFrame:2,this.darkness=void 0!==t.darkness?t.darkness:1,this.falloff=void 0!==t.falloff?t.falloff:2,this.size=void 0!==t.size?t.size:1,this.lightDirection=t.lightDirection?t.lightDirection:new THREE.Vector3(0,1,0),this.lightSolidAngle=t.lightSolidAngle?t.lightSolidAngle:45,this.onComplete=t.onComplete,this.onProgress=t.onProgress,this.enable=void 0===t.enable||t.enable,this.si=void 0===t.enableBlur||t.enableBlur;const e=void 0===t.bShadowMaterial||t.bShadowMaterial,i=void 0!==t.nearPlane?t.nearPlane:.1,s=void 0!==t.farPlane?t.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 o=e?new THREE.MeshBasicMaterial({color:16777215,transparent:!0}):new THREE.MeshStandardMaterial({roughness:1,metalness:0});this.ni=new THREE.Mesh(new THREE.PlaneBufferGeometry(1,1),o);const a=this.ni.geometry.attributes.uv.array;this.ni.geometry.setAttribute("uv2",new THREE.BufferAttribute(a,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(t){t.updateMatrixWorld(),this.ri=new THREE.Box3,t.traverse(t=>{t.isMesh&&t.castShadow&&this.ri.expandByObject(t)});const e=new THREE.Sphere;this.ri.getBoundingSphere(e);const i=2.5*e.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*e.radius,this.Ue.left=-e.radius,this.Ue.right=e.radius,this.Ue.bottom=-e.radius,this.Ue.top=e.radius,this.Ue.far=this.boundingRadius+10,this.Ue.updateProjectionMatrix(),this.needsUpdate=!0}startBake(t,e,i){this.li&&cancelAnimationFrame(this.li),this.needsUpdate=!0;const s=()=>{this.ci(t,e,i),this.li=requestAnimationFrame(s),this.convergenceMetric()>=1&&(this.onComplete&&this.onComplete(this.ni),cancelAnimationFrame(this.li))};this.li=requestAnimationFrame(s)}ci(t,e,i){if(!this.enable)return;if(this.needsUpdate&&(this.hi(e),this.C=0,this.needsUpdate=!1),this.onProgress){const t=this.convergenceMetric();this.onProgress(t)}this.Ge||(this.Ue.layers.mask=i.layers.mask,this.Ye()),this.Ve(this.numSamples),t.getClearColor(this.oldClearColor);const s=t.getClearAlpha(),o=t.autoClear;let a,n;for(let s=0;s<this.numSamplesPerFrame;s++)this.C=Math.min(this.C,this.Ze.length-1),this.C++,this.ui(),this.ei(t,e,this.Be,this.Ge),a=this.C%2==0?this.Qe:this.qe,n=this.C%2==0?this.qe:this.Qe,this.ii(t,e,i,a,n);this.si&&this.di(t,n,a),this.Se.uniforms.shadowAccumulationBuffer.value=n,this.Se.uniforms.transition.value=this.smoothTransition?this.convergenceMetric():1;const h=this.Se.uniforms.shadowData.value;h.x=this.ni.material.isMeshBasicMaterial?1-this.darkness:this.darkness,h.y=this.falloff,PIXOTRON.renderPass(t,this.Se,a),t.autoClear=o,t.setClearColor(this.oldClearColor),t.setClearAlpha(s),this.ni.material.isMeshBasicMaterial?this.ni.material.map=a.texture:this.ni.material.aoMap=a.texture}setSize(t,e){this.Qe&&this.Qe.setSize(t,e),this.qe&&this.qe.setSize(t,e),this.Ge&&this.Ge.setSize(t,e),this.Je.uniforms.shadowBufferSize.value.set(t,e)}di(t,e,i){this.vi||(this.vi=new THREE.ShaderMaterial(PIXOTRON.BlurShader)),this.vi.uniforms.tDiffuse.value=e,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(t,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(t,this.vi,e)}Ye(){const t={format:THREE.RGBAFormat,minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter};this.Ge=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,t),this.Qe=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,t),this.qe=new THREE.WebGLRenderTarget(this.shadowMapResolution,this.shadowMapResolution,t),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(t,e,i,s,o){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,t.setClearColor(0);const a=t.shadowMap.enabled;t.shadowMap.enabled=!1,this.ai.overrideMaterial=this.Je,t.setRenderTarget(o),t.clear(!0,!0,!1),t.render(this.ai,i),t.setRenderTarget(null),this.ai.overrideMaterial=null,t.shadowMap.enabled=a}ei(t,e,i,s){!function(t,e){t.traverse(function(t){(t.isMesh||t.isLineSegments||t.isLine||t.isLineLoop||t.isPoints)&&((e?t.castShadow:t.receiveShadow)||(t.oldVisibility=t.visible,t.visible=!1))})}(e,!0),this.Ue.position.copy(i),this.We.copy(i),this.We.addScaledVector(this.ke,10),this.Ue.lookAt(this.We),this.Ue.updateMatrixWorld(),e.overrideMaterial=this.pe,this.linearDepth&&(this.pe.uniforms.cameraNearFar.value.x=this.Ue.near,this.pe.uniforms.cameraNearFar.value.y=this.Ue.far),t.setClearColor(0),t.setRenderTarget(s),t.clear(!0,!0,!1),t.render(e,this.Ue),t.setRenderTarget(null),e.overrideMaterial=null,function(t){t.traverse(function(t){t.oldVisibility&&(t.visible=t.oldVisibility,t.oldVisibility=void 0)})}(e)}sampleUniformCone(t,e,i){const s=1-t.x+t.x*e,o=Math.sqrt(1-s*s),a=2*t.y*Math.PI;i.x=Math.cos(a)*o,i.y=Math.sin(a)*o,i.z=s}ui(){const t=this.boundingRadius,e=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(e,s,this.ke),this.ke.multiplyScalar(-1),this.ke.normalize();const o=new THREE.Matrix4;this.lightDirection.normalize(),o.lookAt(this.lightDirection,new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0)),this.ke.transformDirection(o),this.ke.normalize();const a=new THREE.Vector3(-t*this.ke.x,-t*this.ke.y,-t*this.ke.z);this.Be.copy(a),this.Be.add(this.oi.position)}Ve(t){t!==this.De&&(this.De=t,this.Ze=PIXOTRON.generateQuasiRandomPoints(t,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectngle),this.Ze=PIXOTRON.randomizeArray(this.Ze))}}},function(t,e){t.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(t,e){t.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(t,e,i){"use strict";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(t,e,i){i(27);const s=new THREE.Vector2;t.exports=PIXOTRON.TemporalAAPass=class extends THREE.Pass{constructor(t,e){super(),this.feedBack=new THREE.Vector2(.8,.9),this.mi=!0,this.Z=t,this.F=e,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(t,e){this.wi&&this.wi.setSize(t,e),this.ct.copy(this.Z.projectionMatrix)}render(t,e,i){this.X(t),t.getClearColor(this.oldClearColor);const s=t.getClearAlpha(),o=t.autoClear;t.autoClear=!1,t.setClearColor(new THREE.Color(0,0,0),0),this.Ei.multiplyMatrices(this.ct,this.Z.matrixWorldInverse),this.Ri(t,i),PIXOTRON.renderPass(t,this.fi,e),PIXOTRON.blit(t,e.texture,this.wi),t.setClearColor(this.oldClearColor,s),t.autoClear=o,this.pi.copy(this.Ei),this.mi=!1}X(t){t.getDrawingBufferSize(s);const e=s.x,i=s.y;if(!this.wi){const t={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};this.wi=new THREE.WebGLRenderTarget(e,i,t)}}Ri(t,e){let i,o;i=this.F.Nt?this.F.Nt:this.F.we?this.F.we.texture:null,this.F.we||(o=this.F.Ee?this.F.Ee.texture:null),this.fi.uniforms.currentRT.value=e.texture,this.fi.uniforms.previousRT.value=this.wi.texture,this.fi.uniforms.tDepth.value=i||o;let a=this.F.Nt?0:1;this.F.forceDepthAndNormalPass&&this.F.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(a=2),this.fi.defines.DEPTH_PACKING_MODE=a,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 n=this.fi.uniforms.cameraNearFar.value;n.x=this.Z.near,n.y=this.Z.far,t.getDrawingBufferSize(s);const h=s.x,r=s.y,l=this.fi.uniforms.textureSize.value;l.x=h,l.y=r,this.fi.defines.LINEAR_DEPTH=this.F.fe?1:0}}},function(t,e){t.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(t,e,i){i(29);const s=new THREE.Vector2;t.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(t,e,i,s){this.X(t),this.Ti(t,e,i,s)}setSize(t,e){this.xi&&this.xi.setSize(t,e),this.bilateralFilterMaterial.uniforms.size.value.set(t,e)}dispose(){this.xi&&(this.xi.dispose(),this.xi=null),this.bilateralFilterMaterial.dispose()}X(t){if(!this.xi){t.getDrawingBufferSize(s);const e=s.x,i=s.y,o={minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat};this.xi=new THREE.WebGLRenderTarget(e,i,o)}}Ti(t,e,i,o){t.getDrawingBufferSize(s);const a=s.x,n=s.y;this.bilateralFilterMaterial.uniforms.size.value.set(a,n);const h=o.Re?o.Re.texture:null;let r;o.we||(r=o.Ee?o.Ee.texture:null),r?(this.bilateralFilterMaterial.defines.DEPTH_NORMAL_TEXTURE=1,this.bilateralFilterMaterial.uniforms.tNormal.value=r):this.bilateralFilterMaterial.uniforms.tNormal.value=h,this.bilateralFilterMaterial.defines.KERNEL_SAMPLE_RADIUS=this.blurKernelSize,this.bilateralFilterMaterial.defines.LINEAR_DEPTH=o.fe?1:0,this.bilateralFilterMaterial.uniforms.tOcclusionDepth.value=e.texture,this.bilateralFilterMaterial.uniforms.kernelDirection.value=new THREE.Vector2(1,0),this.bilateralFilterMaterial.uniforms.edgeSharpness.value=this.edgeSharpness;const l=this.bilateralFilterMaterial.uniforms.cameraNearFar.value;l.x=i.near,l.y=i.far,PIXOTRON.renderPass(t,this.bilateralFilterMaterial,this.xi),this.bilateralFilterMaterial.uniforms.tOcclusionDepth.value=this.xi.texture,this.bilateralFilterMaterial.uniforms.kernelDirection.value=new THREE.Vector2(0,1),PIXOTRON.renderPass(t,this.bilateralFilterMaterial,e)}}},function(t,e){t.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(t,e,i){i(31),t.exports=PIXOTRON.UnrealBloomPass=class extends THREE.Pass{constructor(t,e,i,s,o){super(),this.F=t,this.strength=void 0!==i?i:1,this.radius=s,this.threshold=o,this.resolution=void 0!==e?new THREE.Vector2(e.x,e.y):new THREE.Vector2(256,256);const a={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let n=Math.round(this.resolution.x/2),h=Math.round(this.resolution.y/2);this.renderTargetBright=new THREE.WebGLRenderTarget(n,h,a),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let t=0;t<this.nMips;t++){let e=new THREE.WebGLRenderTarget(n,h,a);e.texture.name="UnrealBloomPass.h"+t,e.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(e),(e=new THREE.WebGLRenderTarget(n,h,a)).texture.name="UnrealBloomPass.v"+t,e.texture.generateMipmaps=!1,this.renderTargetsVertical.push(e),n=Math.round(n/2),h=Math.round(h/2)}const r=PIXOTRON.BloomExtractShader;this.bloomExtractUniforms=THREE.UniformsUtils.clone(r.uniforms),this.bloomExtractUniforms.bloomThreshold.value=o,this.materialBloomExtract=new THREE.ShaderMaterial({uniforms:this.bloomExtractUniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,defines:{DEPTH_PACKING_MODE:0,LINEAR_DEPTH:1}}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];n=Math.round(this.resolution.x/2),h=Math.round(this.resolution.y/2);for(let t=0;t<this.nMips;t++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[t])),this.separableBlurMaterials[t].uniforms.texSize.value=new THREE.Vector2(n,h),n=Math.round(n/2),h=Math.round(h/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 c=THREE.CopyShader;this.copyUniforms=THREE.UniformsUtils.clone(c.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:c.vertexShader,fragmentShader:c.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 t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}setSize(t,e){let i=Math.round(t/2),s=Math.round(e/2);this.renderTargetBright.setSize(i,s);for(let t=0;t<this.nMips;t++)this.renderTargetsHorizontal[t].setSize(i,s),this.renderTargetsVertical[t].setSize(i,s),this.separableBlurMaterials[t].uniforms.texSize.value=new THREE.Vector2(i,s),i=Math.round(i/2),s=Math.round(s/2)}render(t,e,i,s,o){t.getClearColor(this.oldClearColor),this.oldClearAlpha=t.getClearAlpha();const a=t.autoClear;let n,h;t.autoClear=!1,t.setClearColor(new THREE.Color(0,0,0),0),o&&t.context.disable(t.context.STENCIL_TEST),this.renderToScreen&&(this.quad.material=this.basic,this.basic.map=i.texture,t.render(this.scene,this.camera,void 0,!0)),n=this.F.Nt?this.F.Nt:this.F.we?this.F.we.texture:null,this.F.we||(h=this.F.Ee?this.F.Ee.texture:null),this.materialBloomExtract.uniforms.tDepth.value=n||h;let r=this.F.Nt?0:1;this.F.forceDepthAndNormalPass&&this.F.packingMode===PIXOTRON.GBufferPass.DEPTH_NORMAL_16&&(r=2),this.materialBloomExtract.defines.DEPTH_PACKING_MODE=r,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,t.render(this.scene,this.camera,this.renderTargetBright,!0);let l=this.renderTargetBright;for(let e=0;e<this.nMips;e++)this.quad.material=this.separableBlurMaterials[e],this.separableBlurMaterials[e].uniforms.colorTexture.value=l.texture,this.separableBlurMaterials[e].uniforms.direction.value=PIXOTRON.UnrealBloomPass.BlurDirectionX,t.render(this.scene,this.camera,this.renderTargetsHorizontal[e],!0),this.separableBlurMaterials[e].uniforms.colorTexture.value=this.renderTargetsHorizontal[e].texture,this.separableBlurMaterials[e].uniforms.direction.value=PIXOTRON.UnrealBloomPass.BlurDirectionY,t.render(this.scene,this.camera,this.renderTargetsVertical[e],!0),l=this.renderTargetsVertical[e];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,t.render(this.scene,this.camera,this.renderTargetsHorizontal[0],!0),this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,o&&t.context.enable(t.context.STENCIL_TEST),this.renderToScreen?t.render(this.scene,this.camera,void 0,!1):t.render(this.scene,this.camera,i,!1),t.setClearColor(this.oldClearColor,this.oldClearAlpha),t.autoClear=a}getSeperableBlurMaterial(t){return new THREE.ShaderMaterial({defines:{KERNEL_RADIUS:t,SIGMA:t},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(t){return new THREE.ShaderMaterial({defines:{NUM_MIPS:t},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(t,e){t.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(t,e){t.exports=PIXOTRON.VPLGenerationPass=class{constructor(t){this.maxVPL=t,this.Oi=0,this.Ni=PIXOTRON.generateQuasiRandomPoints(t,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle),this.Di=[];for(let t=0;t<this.Ni.length;t++){const e=this.Ni[t];this.Di.push(new THREE.Vector2(e.x,e.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(t,e,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,t.add(this.yi));const o=performance.now();let a=0;for(let o=0;o<i;o++){const n=this.gi.origin,h=this.gi.direction;if(this.Pi.set(this.gi.origin,this.gi.direction),!this._i(e,n,h,this.C*i+o))break;const r=s?s.intersectRay(this.gi,t):this.Pi.intersectObject(t,!0);if(r.length>0){const t=r[0];if(t.object instanceof THREE.Mesh){const e=new THREE.Color,i=new THREE.Vector3,s=new THREE.Vector3;i.copy(t.point),s.copy(t.face.normal),s.transformDirection(t.object.matrixWorld);const o=this.Ii(t.object.material.map,t.uv,64);e.copy(t.object.material.color),e.multiply(o),this.Ci.push({position:i,normal:s,intensity:new THREE.Vector3(e.r,e.g,e.b)}),this.Si&&this.zi(i,e),a++}}}if(this.C++,this.Oi+=a,this.Si&&a>0){const t=performance.now();console.log("Processed VPL "+a+", took "+(t-o)+" ms. Total VPLs Generated = "+this.Oi)}}zi(t,e){const i=new THREE.MeshBasicMaterial;i.color.copy(e);const s=new THREE.Mesh(this.Hi,i);s.position.copy(t),this.yi.add(s)}rt(){this.C=0,this.Oi=0,this.Ci=[]}Ii(t,e,i){if(!t||!t.image)return new THREE.Color(16777215);let s=this.Mi[t.uuid];s||(i=i||32,s=PIXOTRON.getDataFromImage(t.image,i),this.Mi[t.uuid]=s);let o=e.x,a=e.y;void 0!==t.repeat&&(o*=t.repeat.x,a*=t.repeat.y),o*=s.width,a*=s.height,t.wrapS===THREE.RepeatWrapping&&(o%=s.width),t.wrapS===THREE.ClampToEdgeWrapping&&(o=Math.min(o,s.width-1)),t.wrapT===THREE.RepeatWrapping&&(a%=s.height),t.wrapT===THREE.ClampToEdgeWrapping&&(a=Math.min(a,s.height-1));const n=Math.floor(o),h=Math.floor(a),r=PIXOTRON.getPixelFromImageData(s,n,h);return r.r=Math.pow(r.r/255,1),r.g=Math.pow(r.g/255,1),r.b=Math.pow(r.b/255,1),new THREE.Color(r.r,r.g,r.b)}_i(t,e,i,s){if(s<this.Ni.length){const o=this.Ni[s];e.x=(2*o.x-1)*t.width*.5,e.z=0,e.y=(2*o.y-1)*t.height*.5,e.applyMatrix4(t.matrixWorld);const a=this.Di[s],n=PIXOTRON.squareToCosineHemisphere(a);return i.copy(n),i.transformDirection(t.matrixWorld),!0}return!1}}},function(t,e,i){i(34),t.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 t=this.bi.getNumVPL();return this.enabled?this.C*this.Xi/t:1}render(t,e,i,s,o){this.needsUpdate&&(this.rt(),this.C=0,this.needsUpdate=!1),this.bi=s;const a=s.getNumVPL(),n=s.getVPLBuffer();if(0===n.length)return;if(this.convergenceMetric()>=1)return;if(!this.bbox){this.bbox=new THREE.Box3,this.bbox.setFromObject(e);const t=new THREE.Vector3;this.bbox.getSize(t),this.minDistance=Math.max(Math.max(t.x,t.y),t.z)/9}this.Ui||this.X(t),this.C++,e.overrideMaterial=this.Vi;const h=this.C%2==0?this.Ui:this.Li,r=this.C%2==0?this.Li:this.Ui;this.Vi.uniforms.accumulationBuffer.value=h.texture,this.Vi.uniforms.currentFrameCount.value=this.C,this.Bi(n,a,o),t.render(e,i,r,!0),e.overrideMaterial=null,t.indirectDiffuseBuffer=r.texture}X(t){const e=new THREE.Vector2;t.getDrawingBufferSize(e);const i=e.x,s=e.y;let o=THREE.UnsignedByteType;if(!this.Fi){const e=t.extensions,i=e.get("OES_texture_half_float");o=i?THREE.HalfFloatType:o,i||(o=e.get("OES_texture_float")?THREE.FloatType:o)}const a={type:o,format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter};this.Ui=new THREE.WebGLRenderTarget(i,s,a),this.Ui.texture.generateMipmaps=!1,this.Li=new THREE.WebGLRenderTarget(i,s,a),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,(o===THREE.UnsignedByteType||this.Fi)&&(this.Vi.dithering=!0)}rt(){this.C=0,this.Ai=0}Bi(t,e,i){let s=t.length-this.Ai;s=Math.min(s,this.Xi);const o=new THREE.Vector3(0,0,0),a=[];for(let n=0;n<s;n++){const s=t[n+this.Ai];if(n>=t.length)a.push({position:o,direction:o,intensity:o});else{const t=new THREE.Vector3;t.copy(s.intensity),t.multiplyScalar(i.intensity/e),a.push({position:s.position,direction:s.normal,intensity:t})}}for(let t=0;t<this.Xi-s;t++)a.push({position:o,direction:o,intensity:o});this.Ai+=s,this.Vi.uniforms.vplLights.value=a}}},function(t,e){t.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(t,e,i){i(36),i(4);const s=new THREE.Vector2;t.exports=PIXOTRON.OutlinePass=class{constructor(t){t=t||{},this.highlightColor=void 0!==t.highlightColor?t.highlightColor:new THREE.Color(1,.25,0),this.edgeThickness=void 0!==t.edgeThickness?t.edgeThickness:1,this.edgeStrength=void 0!==t.edgeStrength?t.edgeStrength:1,this.transparency=void 0!==t.transparency?t.transparency:.1,this.enableAA=void 0===t.enableAA||t.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(t,e){if(!this.enableAA)return;t.getDrawingBufferSize(s);const i=s.x,o=s.y,a=this.B[this.C%this.B.length];PIXOTRON.jitterCamera(e,a,i,o)}dispose(){this.ji&&this.ji.dispose(),this.Rt&&this.Rt.dispose()}getRenderTarget(){return this.Rt}setSize(t,e){this.ji&&this.ji.setSize(t,e),this.Rt&&this.Rt.setSize(t,e)}isConverged(){return this.L?this.C/this.B.length>=1:1}render(t,e,i,s){if(this.enabled&&s&&s.length>0){this.needsUpdate&&(this.rt(),this.needsUpdate=!1),this.ji||this.X(t),this.enableAA&&!this.L&&(this.L=new PIXOTRON.SuperSampleAAPass,this.B=PIXOTRON.generateQuasiRandomPoints(30,-1,PIXOTRON.uniformDistribution,PIXOTRON.insideRectangle));const o=t.getClearAlpha();t.getClearColor(this.oldClearColor);const a=t.autoClear;t.autoClear=!0,t.setClearColor(0,1);const n=e.background;e.background=null,this.pt(t,i),this.Zi(e,s,!1),e.overrideMaterial=this.ki,t.setRenderTarget(this.ji),t.clear(!0,!0,!1),t.render(e,i),t.setRenderTarget(null),e.overrideMaterial=null,this.Zi(e,s,!0),i.clearViewOffset(),e.background=n,0!==this.C&&this.enableAA&&(this.L.render(t,this.Rt,this.ji),PIXOTRON.blit(t,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(t,this.Wi,this.Rt),t.setClearColor(this.oldClearColor,o),t.autoClear=a,this.C++}}Zi(t,e,i){const s=[];function o(t){t.isMesh&&s.push(t)}for(let t=0;t<e.length;t++){e[t].traverse(o)}t.traverse(function(t){if(t.isMesh||t.isLine||t.isSprite){let e=!1;for(let i=0;i<s.length;i++)if(s[i].id===t.id){e=!0;break}if(!e){const e=t.visible;i&&!t.bVisible||(t.visible=i),t.bVisible=e}}})}X(t){const e={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};t.getDrawingBufferSize(s);const i=s.x,o=s.y;this.ji=new THREE.WebGLRenderTarget(i,o,e),this.ji.texture.generateMipmaps=!1,this.Rt=new THREE.WebGLRenderTarget(i,o,e),this.Rt.texture.generateMipmaps=!1}rt(){this.C=0,this.L&&(this.L.needsUpdate=!0)}}},function(t,e,i){const s=i(37).default,o=i(38).default;t.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:o}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default="varying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.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}"}]);