@volter/cyclotron 0.5.212 → 0.5.213

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 (598) hide show
  1. package/BUNDLED_NOTICES +375 -2995
  2. package/README.md +9 -5
  3. package/dist/.vite/manifest.json +529 -1764
  4. package/dist/assets/AudioViewer-B5pkIGXS.js +1 -0
  5. package/dist/assets/ImageViewer-BPVLEEQ2.js +1 -0
  6. package/dist/assets/JsonAssetDocument-DuVW9del.js +2 -0
  7. package/dist/assets/ProjectAuthoringBootstrap-CZJz4Svb.js +2 -0
  8. package/dist/assets/SourceAssetViewer-LwHBW53R.js +1 -0
  9. package/dist/assets/VideoViewer-Bfjjp4zH.js +1 -0
  10. package/dist/assets/{client-Dj2xr2fw.js → client-BLXKEWrR.js} +1 -1
  11. package/dist/assets/{index-Bc73pJIv.js → index-BKjLHm6K.js} +131 -131
  12. package/dist/assets/index-CJcVFJ-l.css +1 -0
  13. package/dist/assets/product-CaIfLQVS.js +1 -0
  14. package/dist/assets/story-capture-C3xmgE62.js +1 -0
  15. package/dist/assets/volter-sdk-DT0xmh2J.js +1407 -0
  16. package/dist/assets/volter-sdk-activation-events-B-WERmWU.js +1 -0
  17. package/dist/assets/volter-sdk-active-project-DvEsy8Q6.js +1 -0
  18. package/dist/assets/volter-sdk-adapter-editor-config-CQ5V6W-o.js +1 -0
  19. package/dist/assets/volter-sdk-animation-animation-clock-Cy7j_2qF.js +1 -0
  20. package/dist/assets/volter-sdk-animation-stage-transport-DoUDq6Gb.js +1 -0
  21. package/dist/assets/volter-sdk-api-base-Dr1bx5e0.js +1 -0
  22. package/dist/assets/volter-sdk-api-project-open-D4nPvIPU.js +1 -0
  23. package/dist/assets/volter-sdk-api-project-source-DoO7WBwQ.js +1 -0
  24. package/dist/assets/volter-sdk-api-settings-BEHgO5wf.js +1 -0
  25. package/dist/assets/volter-sdk-asset-capabilities-CGkNwaAe.js +1 -0
  26. package/dist/assets/volter-sdk-asset-document-write-policy-CzWM1HhK.js +1 -0
  27. package/dist/assets/volter-sdk-asset-editor-context-BkSK1vL1.js +1 -0
  28. package/dist/assets/volter-sdk-asset-thumbnails-zSmJgI_x.js +1 -0
  29. package/dist/assets/volter-sdk-asset-viewers-B-ICvlkR.js +1 -0
  30. package/dist/assets/volter-sdk-asset-workflow-project-content-C6Ow0R-F.js +1 -0
  31. package/dist/assets/volter-sdk-authoring-active-adapter-CKuWwxgH.js +1 -0
  32. package/dist/assets/volter-sdk-authoring-boundary-authoring-adapter-DTwFKBkS.js +1 -0
  33. package/dist/assets/volter-sdk-authoring-composite-authoring-adapter-iRSbSHpV.js +1 -0
  34. package/dist/assets/volter-sdk-authoring-consumer-actions-DK9-B-wg.js +1 -0
  35. package/dist/assets/volter-sdk-authoring-design-time-mount-registry-BQnWcBVe.js +1 -0
  36. package/dist/assets/volter-sdk-authoring-design-time-roots-BKSmkD7_.js +1 -0
  37. package/dist/assets/volter-sdk-authoring-layered-pick-C-YvuxEG.js +1 -0
  38. package/dist/assets/volter-sdk-authoring-no-authoring-adapter-Cv9DD6G0.js +1 -0
  39. package/dist/assets/volter-sdk-authoring-panel-authoring-BLOrFs8L.js +1 -0
  40. package/dist/assets/volter-sdk-authoring-react-design-canvas-style-Dr9i31o5.js +1 -0
  41. package/dist/assets/{volter-sdk-authoring-react-story-board-aeiEUlbU.js → volter-sdk-authoring-react-story-board-BlCQQM-8.js} +1 -1
  42. package/dist/assets/volter-sdk-authoring-seam-evidence-CjetY_ZG.js +1 -0
  43. package/dist/assets/volter-sdk-authoring-selection-scope-BxmbC71H.js +1 -0
  44. package/dist/assets/volter-sdk-authoring-shell-document-ops-DDb8oGx9.js +1 -0
  45. package/dist/assets/volter-sdk-authoring-stage-root-B50LLhnJ.js +1 -0
  46. package/dist/assets/volter-sdk-authoring-story-board-chrome-fit-BVV9fbcw.js +1 -0
  47. package/dist/assets/{volter-sdk-authoring-viewport-tool-context-DzsD6JQH.js → volter-sdk-authoring-viewport-tool-context-cQafPSkT.js} +1 -1
  48. package/dist/assets/volter-sdk-authoring-viewport-tool-owner-BppqL4f_.js +1 -0
  49. package/dist/assets/volter-sdk-authoring-world-session-state-BlpdiKod.js +1 -0
  50. package/dist/assets/volter-sdk-bitmap-label-BbtGPWgP.js +1 -0
  51. package/dist/assets/{volter-sdk-breakpoint-state-BPnDN_XU.js → volter-sdk-breakpoint-state-DCFuSvgm.js} +1 -1
  52. package/dist/assets/volter-sdk-bytes-codec-CrNeVT4e.js +1 -0
  53. package/dist/assets/volter-sdk-cancellation-reason-ByOH3mlF.js +1 -0
  54. package/dist/assets/volter-sdk-canvas-frames-BU8Rqr4J.js +1 -0
  55. package/dist/assets/volter-sdk-capture-size-D4cNT2XC.js +1 -0
  56. package/dist/assets/volter-sdk-chrome-registry-qHUiDauw.js +1 -0
  57. package/dist/assets/volter-sdk-command-result-text-2wzEhQ5t.js +1 -0
  58. package/dist/assets/volter-sdk-commands-C4RgHEOa.js +1 -0
  59. package/dist/assets/volter-sdk-component-board-registry-6gFZBkTP.js +1 -0
  60. package/dist/assets/volter-sdk-components-AssetEditorShell-CQVLedvW.js +1 -0
  61. package/dist/assets/volter-sdk-components-InspectorCanvasPreview-CN5ROhNT.js +1 -0
  62. package/dist/assets/volter-sdk-components-SurfaceStateOverlay-Cc9Ov1Ol.js +1 -0
  63. package/dist/assets/{volter-sdk-components-AssetEditorShell-BJL1am3b.js → volter-sdk-components-Toolbar-ZoV9Yq_A.js} +1 -1
  64. package/dist/assets/volter-sdk-components-TransientHint-BML2V3uu.js +1 -0
  65. package/dist/assets/volter-sdk-components-inspector-preview-section-BhDjhUyz.js +1 -0
  66. package/dist/assets/volter-sdk-components-use-after-paint-BVSO4qjV.js +1 -0
  67. package/dist/assets/volter-sdk-components-workspace-history-CThvGfsY.js +1 -0
  68. package/dist/assets/volter-sdk-content-entry-source-registry-CJLVq3tC.js +1 -0
  69. package/dist/assets/volter-sdk-contribution-surfaces-CeEDmriM.js +1 -0
  70. package/dist/assets/volter-sdk-contributions-x6j41XZp.js +1 -0
  71. package/dist/assets/volter-sdk-coverage-design-time-surfaces-D-tNGazo.js +1 -0
  72. package/dist/assets/volter-sdk-creation-site-registry-64gyrZPD.js +1 -0
  73. package/dist/assets/volter-sdk-css-numeric-style-CXeWqAoG.js +1 -0
  74. package/dist/assets/volter-sdk-declared-tools-BAzHxyUW.js +1 -0
  75. package/dist/assets/{volter-sdk-document-areas-x47hqeuC.js → volter-sdk-document-areas-4DXjy0el.js} +1 -1
  76. package/dist/assets/volter-sdk-document-layer-B4VYMPZ9.js +1 -0
  77. package/dist/assets/volter-sdk-document-open-registry-BLDMaEoN.js +1 -0
  78. package/dist/assets/volter-sdk-document-play-extension-Dv3fyS6K.js +1 -0
  79. package/dist/assets/volter-sdk-document-probe-drBhAyza.js +1 -0
  80. package/dist/assets/volter-sdk-document-stage-sessions-CtI9anAf.js +1 -0
  81. package/dist/assets/volter-sdk-document-viewports-BO0N7VyN.js +1 -0
  82. package/dist/assets/volter-sdk-editor-commands-BJ9Otxzu.js +1 -0
  83. package/dist/assets/volter-sdk-editor-console-BaGgfWmH.js +1 -0
  84. package/dist/assets/volter-sdk-editor-document-probe-D0ZhaXHx.js +1 -0
  85. package/dist/assets/volter-sdk-editor-mode-B07FDozS.js +1 -0
  86. package/dist/assets/volter-sdk-editor-runtime-D00Du7hG.js +1 -0
  87. package/dist/assets/volter-sdk-editor-server-response-C6kOPAsW.js +1 -0
  88. package/dist/assets/volter-sdk-editor-session-attribution-CggpIFb4.js +1 -0
  89. package/dist/assets/volter-sdk-editor-view-DEMsxlaT.js +1 -0
  90. package/dist/assets/volter-sdk-environment-images-OQtFG1kA.js +1 -0
  91. package/dist/assets/volter-sdk-extension-script-DanTHcyo.js +1 -0
  92. package/dist/assets/volter-sdk-eyedropper-session-BfVXtjzc.js +1 -0
  93. package/dist/assets/volter-sdk-files-file-provider-CXL6oCMd.js +1 -0
  94. package/dist/assets/volter-sdk-files-project-files-SBAE37py.js +1 -0
  95. package/dist/assets/volter-sdk-framed-document-capture-7TnE8pn1.js +1 -0
  96. package/dist/assets/volter-sdk-framed-document-driver-C0K3-SRt.js +1 -0
  97. package/dist/assets/volter-sdk-hierarchy-component-marks-BmJEMvvO.js +1 -0
  98. package/dist/assets/volter-sdk-hierarchy-kind-icon-CrwdpecY.js +1 -0
  99. package/dist/assets/{volter-sdk-hierarchy-node-rows-CNCdvWZM.js → volter-sdk-hierarchy-node-rows-FcK7_ULi.js} +1 -1
  100. package/dist/assets/{volter-sdk-hierarchy-projection-BXet4MmW.js → volter-sdk-hierarchy-projection-CKzUOZUa.js} +1 -1
  101. package/dist/assets/volter-sdk-hierarchy-row-media-Czg40Ddi.js +1 -0
  102. package/dist/assets/volter-sdk-hierarchy-row-model-BGzmcywF.js +1 -0
  103. package/dist/assets/volter-sdk-hierarchy-rows-VAI0psTR.js +1 -0
  104. package/dist/assets/volter-sdk-hierarchy-walk-CaVqG7v2.js +1 -0
  105. package/dist/assets/volter-sdk-history-history-delegate-DH_xBvdh.js +1 -0
  106. package/dist/assets/volter-sdk-history-history-service-D0n0Gl5Z.js +1 -0
  107. package/dist/assets/volter-sdk-history-persistence-coordinator-CcywAFdm.js +1 -0
  108. package/dist/assets/volter-sdk-history-resource-registry-DMTlnwGv.js +1 -0
  109. package/dist/assets/volter-sdk-history-snapshot-store-BVh1DtBp.js +1 -0
  110. package/dist/assets/volter-sdk-history-source-history-backend-ulJ-65tX.js +1 -0
  111. package/dist/assets/volter-sdk-hmr-registration-group-DvMQVKyO.js +1 -0
  112. package/dist/assets/volter-sdk-hmr-stable-react-context-BMVr5YVk.js +1 -0
  113. package/dist/assets/volter-sdk-host-D765Py2w.js +1 -0
  114. package/dist/assets/{volter-sdk-hotkeys-D8xO5kx0.js → volter-sdk-hotkeys-TesTKdAZ.js} +1 -1
  115. package/dist/assets/{volter-sdk-index-CTFkHN4C.js → volter-sdk-index-BABXozHr.js} +1 -1
  116. package/dist/assets/volter-sdk-inference-diagnostics-CsDbQ0M5.js +1 -0
  117. package/dist/assets/volter-sdk-inspection-document-subject-BMRD77Va.js +1 -0
  118. package/dist/assets/volter-sdk-inspection-group-icons-Wpz-YhkE.js +1 -0
  119. package/dist/assets/volter-sdk-inspection-model-BVOyStdc.js +1 -0
  120. package/dist/assets/volter-sdk-inspection-node-media-B8AL8_3F.js +1 -0
  121. package/dist/assets/volter-sdk-inspection-null-subject-d5bQZCbS.js +1 -0
  122. package/dist/assets/volter-sdk-inspector-property-grouping-BqrZkwo4.js +1 -0
  123. package/dist/assets/volter-sdk-inspector-section-registry-C6U15zvC.js +1 -0
  124. package/dist/assets/volter-sdk-js-heap-CcOnY0kf.js +1 -0
  125. package/dist/assets/{volter-sdk-keymap-presets-Vq8J3DoG.js → volter-sdk-keymap-presets-CSM-jVcZ.js} +1 -1
  126. package/dist/assets/volter-sdk-layout-arrangements-DHA3uifx.js +1 -0
  127. package/dist/assets/volter-sdk-layouts-4v9ECCn9.js +1 -0
  128. package/dist/assets/volter-sdk-light-explorer-model-CPuZjpiR.js +1 -0
  129. package/dist/assets/volter-sdk-live-seam-evidence-B_RyDaOp.js +1 -0
  130. package/dist/assets/volter-sdk-live-session-registry-C6gHroaH.js +1 -0
  131. package/dist/assets/{volter-sdk-manifest-project-DIThdJ0z.js → volter-sdk-manifest-project-CVVUDDuL.js} +1 -1
  132. package/dist/assets/volter-sdk-mount-css-scope-DaJoEo3v.js +1 -0
  133. package/dist/assets/volter-sdk-mount-failure-report-Cm92oiGJ.js +1 -0
  134. package/dist/assets/volter-sdk-native-selection-style-Bp4IBnA4.js +1 -0
  135. package/dist/assets/volter-sdk-photograph-notice-C6_gZGpW.js +1 -0
  136. package/dist/assets/volter-sdk-play-camera-flight-SwlYhOxW.js +1 -0
  137. package/dist/assets/volter-sdk-product-command-G8kKVJ-i.js +1 -0
  138. package/dist/assets/volter-sdk-progress-4GGmPvZn.js +1 -0
  139. package/dist/assets/volter-sdk-project-module-changes-DIrDIHeD.js +1 -0
  140. package/dist/assets/volter-sdk-project-module-url-BuAUWpus.js +1 -0
  141. package/dist/assets/volter-sdk-project-output-roots-BON7FOwQ.js +1 -0
  142. package/dist/assets/{volter-sdk-project-tab-census-Cos8L4lu.js → volter-sdk-project-tab-census-CO06UOh-.js} +1 -1
  143. package/dist/assets/volter-sdk-renderer-resource-counts-2kLiD8_S.js +1 -0
  144. package/dist/assets/volter-sdk-scoped-project-css-DA63CYkM.js +1 -0
  145. package/dist/assets/volter-sdk-selection-CSUq7EiY.js +1 -0
  146. package/dist/assets/volter-sdk-served-url-B_MypeId.js +1 -0
  147. package/dist/assets/volter-sdk-settings-settings-provider-CJuWxTB5.js +1 -0
  148. package/dist/assets/volter-sdk-settings-store-CEFKDj0h.js +1 -0
  149. package/dist/assets/volter-sdk-shell-store-Cl4sX9p4.js +1 -0
  150. package/dist/assets/volter-sdk-shell-store-door-DGjybg0J.js +1 -0
  151. package/dist/assets/volter-sdk-source-conflict-CV8Gk053.js +1 -0
  152. package/dist/assets/volter-sdk-stage-context-Cb0SaYhi.js +1 -0
  153. package/dist/assets/volter-sdk-stage-invalidation-VlBciYA0.js +1 -0
  154. package/dist/assets/volter-sdk-stage-store-registry-BpIy_QKq.js +1 -0
  155. package/dist/assets/{volter-sdk-startup-failure-CtJyTS-2.js → volter-sdk-startup-failure-C_8H4xuP.js} +1 -1
  156. package/dist/assets/{volter-sdk-stories-StoryPreviewMount-DjhZUmf-.js → volter-sdk-stories-StoryPreviewMount-BUX42gIR.js} +1 -1
  157. package/dist/assets/volter-sdk-stories-compose-project-stories-CkSd4Si5.js +1 -0
  158. package/dist/assets/volter-sdk-stories-scope-Dndn7MD8.js +1 -0
  159. package/dist/assets/volter-sdk-stories-story-declared-medium-Byi4XWeJ.js +1 -0
  160. package/dist/assets/volter-sdk-stories-story-dom-runtime-BS1VPvJ6.js +1 -0
  161. package/dist/assets/volter-sdk-stories-story-grouping-CpNh4cUf.js +1 -0
  162. package/dist/assets/{volter-sdk-story-document-openers-Df7Tcu2n.js → volter-sdk-story-document-openers-Ba5jQqay.js} +1 -1
  163. package/dist/assets/volter-sdk-surface-state-BhQ45ars.js +1 -0
  164. package/dist/assets/volter-sdk-tab-census-D0r0s37y.js +1 -0
  165. package/dist/assets/volter-sdk-tool-contribution-convention-JCXL6f2w.js +1 -0
  166. package/dist/assets/volter-sdk-transform-mode-request-Cwk_Kyty.js +1 -0
  167. package/dist/assets/volter-sdk-transient-hint-BOfFzAV8.js +1 -0
  168. package/dist/assets/{volter-sdk-types-BOfYN_tN.js → volter-sdk-types-CkT8l5N_.js} +1 -1
  169. package/dist/assets/volter-sdk-ui-source-file-region-resolver-Cfza3eEl.js +1 -0
  170. package/dist/assets/{volter-sdk-ui-source-inspect-gofMOHNR.js → volter-sdk-ui-source-inspect-CEjmAN75.js} +1 -1
  171. package/dist/assets/{volter-sdk-ui-source-source-write-backend-BgVis1yZ.js → volter-sdk-ui-source-source-write-backend-0njgRdI6.js} +1 -1
  172. package/dist/assets/volter-sdk-ui-source-tier-source-write-backend-CpsxorYU.js +1 -0
  173. package/dist/assets/volter-sdk-viewport-activation-timings-B3hRTu3A.js +1 -0
  174. package/dist/assets/volter-sdk-viewport-editor-controls-DDBd-VqO.js +1 -0
  175. package/dist/assets/volter-sdk-viewport-presentation-DRhiAH1h.js +1 -0
  176. package/dist/assets/volter-sdk-volter-contributions-nlGXjgJZ.js +1 -0
  177. package/dist/assets/volter-sdk-wait-until-CMvYQmO8.js +1 -0
  178. package/dist/assets/volter-sdk-widgets-design-system-BJOyO8sO.js +1 -0
  179. package/dist/assets/volter-sdk-widgets-editor-appearance-eVtkxsIm.js +1 -0
  180. package/dist/assets/volter-sdk-widgets-editor-material-BoQP_5SK.js +1 -0
  181. package/dist/assets/volter-sdk-widgets-icon-set-registry-CP0D74kc.js +1 -0
  182. package/dist/assets/volter-sdk-widgets-index-De34FpYu.js +1 -0
  183. package/dist/assets/volter-sdk-widgets-inspector-widgets-AlignmentGrid-_GjMjIGb.js +1 -0
  184. package/dist/assets/volter-sdk-widgets-inspector-widgets-AssetSlotPicker-B7vN7BEd.js +1 -0
  185. package/dist/assets/volter-sdk-widgets-inspector-widgets-BorderEditor-E2J8cpyT.js +1 -0
  186. package/dist/assets/volter-sdk-widgets-inspector-widgets-ColorPicker-D6TERGKs.js +1 -0
  187. package/dist/assets/volter-sdk-widgets-inspector-widgets-CurveEditor-CXR8n-CA.js +1 -0
  188. package/dist/assets/{volter-sdk-widgets-inspector-widgets-FilterEditor-DKkdim3n.js → volter-sdk-widgets-inspector-widgets-FilterEditor-CDvfWY4Q.js} +1 -1
  189. package/dist/assets/volter-sdk-widgets-inspector-widgets-FontPicker-BgpW8FW8.js +1 -0
  190. package/dist/assets/volter-sdk-widgets-inspector-widgets-GradientEditor-DOOBkXjY.js +1 -0
  191. package/dist/assets/volter-sdk-widgets-inspector-widgets-ScrubbableInput-1NXWR_gB.js +1 -0
  192. package/dist/assets/volter-sdk-widgets-inspector-widgets-ShadowEditor-Cd2-HwFn.js +1 -0
  193. package/dist/assets/volter-sdk-widgets-inspector-widgets-color-utils-C4HuSjFu.js +1 -0
  194. package/dist/assets/volter-sdk-widgets-inspector-widgets-curve-utils-DUU2CCtc.js +1 -0
  195. package/dist/assets/volter-sdk-widgets-inspector-widgets-index-D5kwrOUQ.js +1 -0
  196. package/dist/assets/volter-sdk-widgets-inspector-widgets-shared-CkFN2SUn.js +1 -0
  197. package/dist/assets/volter-sdk-widgets-interactive-edit-scope-DynpKMMZ.js +1 -0
  198. package/dist/assets/{volter-sdk-widgets-palette-colors-Byzw9YHf.js → volter-sdk-widgets-palette-colors-DhL1I42R.js} +1 -1
  199. package/dist/assets/volter-sdk-widgets-patterns-Dialog-EUtcZi0Y.js +1 -0
  200. package/dist/assets/volter-sdk-widgets-patterns-Fields-Bl_eaBej.js +1 -0
  201. package/dist/assets/volter-sdk-widgets-patterns-List--NE_1N5-.js +1 -0
  202. package/dist/assets/volter-sdk-widgets-patterns-StateSurface-BHXpv7qi.js +1 -0
  203. package/dist/assets/volter-sdk-widgets-patterns-Surfaces-BdKa5HGV.js +1 -0
  204. package/dist/assets/volter-sdk-widgets-patterns-Tabs-sFV7f1UP.js +1 -0
  205. package/dist/assets/volter-sdk-widgets-patterns-Toolbar-CIr5Cs49.js +1 -0
  206. package/dist/assets/volter-sdk-widgets-patterns-Tree-C2YHfddf.js +1 -0
  207. package/dist/assets/volter-sdk-widgets-primitives-AnchoredMenu-DCclspnW.js +1 -0
  208. package/dist/assets/volter-sdk-widgets-primitives-Button-B0YxR4ea.js +1 -0
  209. package/dist/assets/volter-sdk-widgets-primitives-ColorInput-B1_SLTuc.js +1 -0
  210. package/dist/assets/volter-sdk-widgets-primitives-DraftTextInput-CpHzPdt8.js +1 -0
  211. package/dist/assets/volter-sdk-widgets-primitives-EditorIcon-Dw4knhya.js +1 -0
  212. package/dist/assets/volter-sdk-widgets-primitives-FormControls-BAbRanmE.js +1 -0
  213. package/dist/assets/volter-sdk-widgets-primitives-HoverPreview-Cj7jKNd4.js +1 -0
  214. package/dist/assets/volter-sdk-widgets-primitives-JsonInput-C0DCI5bE.js +1 -0
  215. package/dist/assets/volter-sdk-widgets-primitives-Layout-gT4Z6mtt.js +1 -0
  216. package/dist/assets/volter-sdk-widgets-primitives-Menu-9EESAp9m.js +1 -0
  217. package/dist/assets/volter-sdk-widgets-primitives-NumberInput-Dk-5zqJ8.js +1 -0
  218. package/dist/assets/volter-sdk-widgets-primitives-Panel-BQWJF-Pb.js +1 -0
  219. package/dist/assets/volter-sdk-widgets-primitives-SectionHeader-DXvmafCK.js +1 -0
  220. package/dist/assets/volter-sdk-widgets-primitives-Text-yBrdWK2w.js +1 -0
  221. package/dist/assets/volter-sdk-widgets-primitives-ThemeRootPortal-CRhefpUL.js +1 -0
  222. package/dist/assets/volter-sdk-widgets-primitives-Tooltip-D5Kcb-ZC.js +1 -0
  223. package/dist/assets/volter-sdk-widgets-primitives-Vec3Input-DiG6PEIe.js +1 -0
  224. package/dist/assets/volter-sdk-widgets-primitives-clamp-to-viewport-DhnSxXVK.js +1 -0
  225. package/dist/assets/volter-sdk-widgets-primitives-editor-icons-e65mgyAk.js +1 -0
  226. package/dist/assets/volter-sdk-widgets-primitives-panel-header-styles-BVL0mN8g.js +1 -0
  227. package/dist/assets/volter-sdk-widgets-theme-C-_RU9Ov.js +1 -0
  228. package/dist/assets/volter-sdk-widgets-z-index-CrJJXeKL.js +1 -0
  229. package/dist/assets/volter-sdk-worker-call-metrics-BTfmngck.js +1 -0
  230. package/dist/assets/{volter-sdk-workspace-core-utilities-BaAh2Ei8.js → volter-sdk-workspace-core-utilities-DtHGK9PF.js} +1 -1
  231. package/dist/assets/volter-sdk-workspace-document-ids-COULA7c6.js +1 -0
  232. package/dist/assets/volter-sdk-workspace-document-registry-6m5csVP7.js +1 -0
  233. package/dist/assets/volter-sdk-workspace-document-restore-M8ifJMou.js +1 -0
  234. package/dist/assets/{volter-sdk-workspace-host-commands-72RdJeW4.js → volter-sdk-workspace-host-commands-8Qzej--P.js} +1 -1
  235. package/dist/assets/volter-sdk-workspace-static-panels-Ckk7qUuS.js +1 -0
  236. package/dist/assets/volter-sdk-workspace-status-registry-BdU0dZAt.js +1 -0
  237. package/dist/assets/volter-sdk-workspace-utility-registry-BHxymD2l.js +1 -0
  238. package/dist/assets/volter-sdk-world-canvas-viewport-state-CHO8s9gE.js +1 -0
  239. package/dist/assets/volter-sdk-world-pan-state-C-9xgzAh.js +1 -0
  240. package/dist/assets/volter-sdk-write-pipe-CJHg7J4i.js +1 -0
  241. package/dist/assets/{volter-shared-fontawesome-B-OhfZs4.js → volter-shared-fontawesome-BEv9WEZj.js} +1 -1
  242. package/dist/assets/{volter-shared-jsx-dev-runtime-akPt_-OI.js → volter-shared-jsx-dev-runtime-domcKDU3.js} +1 -1
  243. package/dist/assets/{volter-shared-jsx-runtime-CKQtDN6l.js → volter-shared-jsx-runtime-Cu7pVW-1.js} +1 -1
  244. package/dist/assets/{volter-shared-react-STQK0zHl.js → volter-shared-react-BLHga76C.js} +1 -1
  245. package/dist/assets/volter-shared-react-dom-client-vi6WsWu2.js +1 -0
  246. package/dist/assets/{volter-shared-react-dom-2aA0eyQg.js → volter-shared-react-dom-kzJVGsQd.js} +1 -1
  247. package/dist/assets/volter-shared-three-BWbOWtM5.js +4220 -0
  248. package/dist/volter-shared-modules.json +225 -225
  249. package/dist/volter-shared-react.json +6 -6
  250. package/dist/volter-shared-three.json +1 -1
  251. package/dist-node/cli.js +182 -127
  252. package/dist-node/create.js +18 -21
  253. package/package.json +16 -16
  254. package/src/index.ts +1 -2
  255. package/src/product-id.d.ts +4 -0
  256. package/starter/AGENTS.md +132 -157
  257. package/starter/game/levels/MainLevel.tsx +24 -0
  258. package/starter/game/prefabs/ground/Ground.tsx +24 -0
  259. package/starter/game/{levels → prefabs/ground}/ground.blend +0 -0
  260. package/starter/game/prefabs/ground/ground.glb +0 -0
  261. package/starter/game/prefabs/ground/ground.py +106 -0
  262. package/dist/assets/AudioViewer-EMpvKC-X.js +0 -1
  263. package/dist/assets/BVHLoader-CpdLvOHd.js +0 -1
  264. package/dist/assets/ColladaLoader-D1GMlAA9.js +0 -3
  265. package/dist/assets/EntityModelDocument-rYF-p8Fo.js +0 -1
  266. package/dist/assets/EnvironmentAssetDocument-DfykWLLS.js +0 -1
  267. package/dist/assets/FBXLoader-DKZ0UD3F.js +0 -1
  268. package/dist/assets/ImageViewer-B0OqXrVU.js +0 -1
  269. package/dist/assets/InspectorObjectPreview-CwCqdv76.js +0 -1
  270. package/dist/assets/JsonAssetDocument-PzzxK-v9.js +0 -2
  271. package/dist/assets/LiveModuleDocument-Bq9J5nMx.js +0 -1
  272. package/dist/assets/LutAssetDocument-CyzgDCYJ.js +0 -1
  273. package/dist/assets/MTLLoader-BOaPmAvY.js +0 -2
  274. package/dist/assets/ModelAssetDocument-8he5iZqV.js +0 -1
  275. package/dist/assets/OBJLoader-BLg7dmPe.js +0 -5
  276. package/dist/assets/Object3DDocumentToolbar-CLfEn5i-.js +0 -1
  277. package/dist/assets/Object3DDocumentToolbar-WK1RY6Gg.css +0 -1
  278. package/dist/assets/OrbitControls-DxYDYiEc.js +0 -1
  279. package/dist/assets/PLYLoader-bAg6lYzP.js +0 -2
  280. package/dist/assets/ProjectAuthoringBootstrap-FVTj-Ag9.js +0 -2
  281. package/dist/assets/QuarksAssetDocument-DBJQXZ9u.js +0 -2
  282. package/dist/assets/RectAreaLightUniformsLib-CQLblkbI.js +0 -1
  283. package/dist/assets/STLLoader-C8jImL_t.js +0 -1
  284. package/dist/assets/ShaderAssetDocument-C3QolcYl.js +0 -12
  285. package/dist/assets/SourceAssetViewer-xB9kAyPa.js +0 -1
  286. package/dist/assets/StageHost-BZBLHaPe.css +0 -1
  287. package/dist/assets/StageHost-xYvmzMBo.js +0 -1231
  288. package/dist/assets/TDSLoader-DLNvOc6c.js +0 -1
  289. package/dist/assets/ToolObject3DPreview-4XgGyXTu.js +0 -2
  290. package/dist/assets/VideoViewer-BruuQyu3.js +0 -1
  291. package/dist/assets/ViewportShadingMenu-amXbnRtl.js +0 -1
  292. package/dist/assets/animation-mixers.service-Ce1JMqA2.js +0 -1
  293. package/dist/assets/animation-timeline.utility-CzsUvu3v.js +0 -1
  294. package/dist/assets/asset-preview-CtqauM13.js +0 -4
  295. package/dist/assets/basis_transcoder-VXdx5NbI.wasm +0 -0
  296. package/dist/assets/basis_transcoder-o4Hde_L7.js +0 -19
  297. package/dist/assets/blender-base64-Cxqc4R5f.js +0 -1
  298. package/dist/assets/blender-display-shaders-BPmHILFy.lut +0 -0
  299. package/dist/assets/blender-emscripten-engine-Bl_j9xEY.js +0 -26
  300. package/dist/assets/blender-motion-worker-CtT2cV3V.js +0 -1
  301. package/dist/assets/blender-node-editor.document-lj1qK5Vu.js +0 -1
  302. package/dist/assets/blender-outliner-model-BqLWEXta.js +0 -7359
  303. package/dist/assets/blender-properties-model-DD-2sMKx.js +0 -1
  304. package/dist/assets/blender-properties-tab-BmudfsC3.js +0 -3
  305. package/dist/assets/blender-runtime.document-IVSATTnk.js +0 -13
  306. package/dist/assets/blender-screenshot.service-BRgdtDQC.js +0 -1
  307. package/dist/assets/blender-timeline.document-8jLaNF31.js +0 -1
  308. package/dist/assets/blender-uv-editor.document-BVcA7mi2.js +0 -1
  309. package/dist/assets/blender-version.status-B43F7DzT.js +0 -2
  310. package/dist/assets/blender-wali-engine-xLHhm0KZ.js +0 -2
  311. package/dist/assets/blender.environment-CG-pC7sk.js +0 -1
  312. package/dist/assets/blender.keymap-pRN8nlCs.js +0 -1
  313. package/dist/assets/blender.page-BYbkmFDE.js +0 -3
  314. package/dist/assets/blender.status-CcKJxsZ1.js +0 -1
  315. package/dist/assets/blender.style-DuFonR-j.js +0 -1
  316. package/dist/assets/chat.page-DzuAKPGP.js +0 -1
  317. package/dist/assets/city-EkhAOo5s.exr +0 -0
  318. package/dist/assets/courtyard-DqlebbpC.exr +0 -0
  319. package/dist/assets/draco_decoder-C32yEggz.wasm +0 -0
  320. package/dist/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
  321. package/dist/assets/draco_decoder-fzg4nYZr.js +0 -34
  322. package/dist/assets/draco_wasm_wrapper-DxJM36Ib.js +0 -117
  323. package/dist/assets/draco_wasm_wrapper-fZCQGLGb.js +0 -116
  324. package/dist/assets/editor-presentation-activity-CqJH4G9t.js +0 -1
  325. package/dist/assets/forest-P_CQY3b_.exr +0 -0
  326. package/dist/assets/index-C4uuH2ZE.css +0 -1
  327. package/dist/assets/index-DlAJXb_f.js +0 -952
  328. package/dist/assets/interior-Bo_lba15.exr +0 -0
  329. package/dist/assets/linear-resolve-B-MA5O31.js +0 -400
  330. package/dist/assets/live-mixers-B-bwLZ7c.js +0 -1
  331. package/dist/assets/maya.style-C3zx8RC5.js +0 -1
  332. package/dist/assets/model-inspection-_SFE7cp7.js +0 -1
  333. package/dist/assets/model.layout-CX-vaeBh.js +0 -1
  334. package/dist/assets/models.finder-DcOx-jsM.js +0 -1
  335. package/dist/assets/mtoon0-BNRZGBf8.blend +0 -0
  336. package/dist/assets/mtoon1-EgrxQlCc.blend +0 -0
  337. package/dist/assets/mtoon1_outline-xuubMJ8J.blend +0 -0
  338. package/dist/assets/mtoon_auto_setup-BF1c8USg.blend +0 -0
  339. package/dist/assets/night-CvV4Gybt.exr +0 -0
  340. package/dist/assets/object3d-document-session-registry-DvgzaByQ.js +0 -2
  341. package/dist/assets/output-pass-Bw2FZb8e.js +0 -85
  342. package/dist/assets/play-mode-BGq1Hn-c.js +0 -1
  343. package/dist/assets/play.page-DB2UjY0o.js +0 -1
  344. package/dist/assets/product-OBHh_Udv.js +0 -1
  345. package/dist/assets/properties-bone-constraints.inspector-NWLfoFX1.js +0 -1
  346. package/dist/assets/properties-bone.inspector-DybmNdBB.js +0 -1
  347. package/dist/assets/properties-collection.inspector-Cg7Jq6yG.js +0 -1
  348. package/dist/assets/properties-constraints.inspector-DY--pvLo.js +0 -1
  349. package/dist/assets/properties-data.inspector-CP1lurLb.js +0 -1
  350. package/dist/assets/properties-material.inspector-K8Qx5wr9.js +0 -1
  351. package/dist/assets/properties-modifiers.inspector-DOfP-8mX.js +0 -1
  352. package/dist/assets/properties-object.inspector-sqx6qMyu.js +0 -1
  353. package/dist/assets/properties-output.inspector-CUYUEC6S.js +0 -1
  354. package/dist/assets/properties-particles.inspector-oAWorORY.js +0 -1
  355. package/dist/assets/properties-physics.inspector-CQIHdcOy.js +0 -1
  356. package/dist/assets/properties-render.inspector-XTzdYo4u.js +0 -1
  357. package/dist/assets/properties-scene.inspector-BytOBuw9.js +0 -1
  358. package/dist/assets/properties-texture.inspector-2WNelhHG.js +0 -1
  359. package/dist/assets/properties-view-layer.inspector-DVSdqosc.js +0 -1
  360. package/dist/assets/properties-world.inspector-CHHm7g3j.js +0 -1
  361. package/dist/assets/regions-BlV6hTFd.js +0 -1
  362. package/dist/assets/sculpt.layout-BkvEflSA.js +0 -1
  363. package/dist/assets/session-addons-KcG0o7Xc.js +0 -76898
  364. package/dist/assets/shading.layout-V9LTFaVk.js +0 -1
  365. package/dist/assets/sky-precompute-worker-CPGW9t_C.js +0 -1
  366. package/dist/assets/spark.module-Cc-ZVx5e.js +0 -12120
  367. package/dist/assets/stage-keyboard-Rgvt63qI.js +0 -1
  368. package/dist/assets/stage-overlay-set-juTRuk99.js +0 -1
  369. package/dist/assets/stage-presence-markers-XsGUs3S-.js +0 -1
  370. package/dist/assets/stage-transform-tools-BE7m4omf.js +0 -1
  371. package/dist/assets/standard-viewport-dressing-asIXnD-w.js +0 -24
  372. package/dist/assets/std-scene-level-DeiReu6Z.js +0 -13
  373. package/dist/assets/std-scene.document-DyWMJhxA.js +0 -1
  374. package/dist/assets/story-capture-Y8_YS5DC.js +0 -1
  375. package/dist/assets/studio-CysTBGIb.exr +0 -0
  376. package/dist/assets/substance.style-CoQdG-kF.js +0 -1
  377. package/dist/assets/sunrise-Dj0psFrf.exr +0 -0
  378. package/dist/assets/sunset-Bw3x2Bot.exr +0 -0
  379. package/dist/assets/texture.layout-DASpHVht.js +0 -1
  380. package/dist/assets/three.module-JoAAxMWl.js +0 -4220
  381. package/dist/assets/three.page-Dy2q5JEV.js +0 -2
  382. package/dist/assets/transparent_z_write-xIRcVb2w.blend +0 -0
  383. package/dist/assets/transport-strip-cKO8FHd1.js +0 -1
  384. package/dist/assets/uv-editing.layout-CF_54oSA.js +0 -1
  385. package/dist/assets/volter-sdk-D8o6TU4A.js +0 -1407
  386. package/dist/assets/volter-sdk-activation-events-DVerKSly.js +0 -1
  387. package/dist/assets/volter-sdk-active-project-f6toeBI4.js +0 -1
  388. package/dist/assets/volter-sdk-adapter-editor-config-DpARQ4TT.js +0 -1
  389. package/dist/assets/volter-sdk-animation-animation-clock-BGyYYQu-.js +0 -1
  390. package/dist/assets/volter-sdk-animation-stage-transport-DWmyow46.js +0 -1
  391. package/dist/assets/volter-sdk-api-base-jDs2XVgE.js +0 -1
  392. package/dist/assets/volter-sdk-api-project-open-BAXokZLA.js +0 -1
  393. package/dist/assets/volter-sdk-api-project-source-D6FB4SmO.js +0 -1
  394. package/dist/assets/volter-sdk-api-settings-DqgndoPA.js +0 -1
  395. package/dist/assets/volter-sdk-asset-capabilities-B5mXIYBM.js +0 -1
  396. package/dist/assets/volter-sdk-asset-document-write-policy-B5aaFAwu.js +0 -1
  397. package/dist/assets/volter-sdk-asset-editor-context-BjtZQVgF.js +0 -1
  398. package/dist/assets/volter-sdk-asset-thumbnails-CROlpqPM.js +0 -1
  399. package/dist/assets/volter-sdk-asset-viewers-BejvElAX.js +0 -1
  400. package/dist/assets/volter-sdk-asset-workflow-project-content-D8h-TsJc.js +0 -1
  401. package/dist/assets/volter-sdk-authoring-active-adapter-DhKlZbyW.js +0 -1
  402. package/dist/assets/volter-sdk-authoring-boundary-authoring-adapter-xlppcGid.js +0 -1
  403. package/dist/assets/volter-sdk-authoring-composite-authoring-adapter-BfalSuB8.js +0 -1
  404. package/dist/assets/volter-sdk-authoring-consumer-actions-Hl6xkGAq.js +0 -1
  405. package/dist/assets/volter-sdk-authoring-design-time-mount-registry-2ZssbtYd.js +0 -1
  406. package/dist/assets/volter-sdk-authoring-design-time-roots-BNNZdEog.js +0 -1
  407. package/dist/assets/volter-sdk-authoring-layered-pick-AsUoH85M.js +0 -1
  408. package/dist/assets/volter-sdk-authoring-no-authoring-adapter-BX6sVPQX.js +0 -1
  409. package/dist/assets/volter-sdk-authoring-panel-authoring-BRs7fYSJ.js +0 -1
  410. package/dist/assets/volter-sdk-authoring-react-design-canvas-style-CdjO9_22.js +0 -1
  411. package/dist/assets/volter-sdk-authoring-seam-evidence-D58d2whR.js +0 -1
  412. package/dist/assets/volter-sdk-authoring-selection-scope-tqpilIPR.js +0 -1
  413. package/dist/assets/volter-sdk-authoring-shell-document-ops-ryosWWqt.js +0 -1
  414. package/dist/assets/volter-sdk-authoring-stage-root-yn7zP1QC.js +0 -1
  415. package/dist/assets/volter-sdk-authoring-story-board-chrome-fit-DgAAtVo8.js +0 -1
  416. package/dist/assets/volter-sdk-authoring-viewport-tool-owner-zIgbNhiQ.js +0 -1
  417. package/dist/assets/volter-sdk-authoring-world-session-state-DriMgIzp.js +0 -1
  418. package/dist/assets/volter-sdk-bitmap-label-Cwzw278F.js +0 -1
  419. package/dist/assets/volter-sdk-bytes-codec-CF2kvi68.js +0 -1
  420. package/dist/assets/volter-sdk-cancellation-reason-BQvS02ja.js +0 -1
  421. package/dist/assets/volter-sdk-canvas-frames-BkjDC0or.js +0 -1
  422. package/dist/assets/volter-sdk-capture-size-B3uOMPdw.js +0 -1
  423. package/dist/assets/volter-sdk-chrome-registry-Be1q89aJ.js +0 -1
  424. package/dist/assets/volter-sdk-command-result-text-DdPWoVLu.js +0 -1
  425. package/dist/assets/volter-sdk-commands-DI54EGoY.js +0 -1
  426. package/dist/assets/volter-sdk-component-board-registry-DtTf1V5m.js +0 -1
  427. package/dist/assets/volter-sdk-components-InspectorCanvasPreview-DpOxql_B.js +0 -1
  428. package/dist/assets/volter-sdk-components-SurfaceStateOverlay-BQ9KTVV1.js +0 -1
  429. package/dist/assets/volter-sdk-components-Toolbar-C6bwDRIc.js +0 -1
  430. package/dist/assets/volter-sdk-components-TransientHint-D3wtJ4fg.js +0 -1
  431. package/dist/assets/volter-sdk-components-inspector-preview-section-D1DnmKLE.js +0 -1
  432. package/dist/assets/volter-sdk-components-use-after-paint-ZgZgfmSR.js +0 -1
  433. package/dist/assets/volter-sdk-components-workspace-history-IZTWOoYh.js +0 -1
  434. package/dist/assets/volter-sdk-content-entry-source-registry-DV4a0g9R.js +0 -1
  435. package/dist/assets/volter-sdk-contribution-surfaces-BAzaKN1S.js +0 -1
  436. package/dist/assets/volter-sdk-contributions-D2D_badr.js +0 -1
  437. package/dist/assets/volter-sdk-coverage-design-time-surfaces-WtyoVY81.js +0 -1
  438. package/dist/assets/volter-sdk-creation-site-registry-DEJua1VB.js +0 -1
  439. package/dist/assets/volter-sdk-css-numeric-style-D1aEQUuP.js +0 -1
  440. package/dist/assets/volter-sdk-declared-tools-bEg2ZQju.js +0 -1
  441. package/dist/assets/volter-sdk-document-open-registry-BUdLp-BZ.js +0 -1
  442. package/dist/assets/volter-sdk-document-play-extension-BdtD2FcX.js +0 -1
  443. package/dist/assets/volter-sdk-document-probe-CvSMoXNj.js +0 -1
  444. package/dist/assets/volter-sdk-document-stage-sessions-BHE1T4gT.js +0 -1
  445. package/dist/assets/volter-sdk-document-viewports-BJqFXfe4.js +0 -1
  446. package/dist/assets/volter-sdk-editor-commands-CsYQVabs.js +0 -1
  447. package/dist/assets/volter-sdk-editor-console-lUTMRzeI.js +0 -1
  448. package/dist/assets/volter-sdk-editor-document-probe-BHRNXR9L.js +0 -1
  449. package/dist/assets/volter-sdk-editor-mode-BgYsrjin.js +0 -1
  450. package/dist/assets/volter-sdk-editor-runtime-CTy0Dw7-.js +0 -1
  451. package/dist/assets/volter-sdk-editor-server-response-oN9Horql.js +0 -1
  452. package/dist/assets/volter-sdk-editor-session-attribution-Ddoo0-e6.js +0 -1
  453. package/dist/assets/volter-sdk-editor-view-DEdcNl3N.js +0 -1
  454. package/dist/assets/volter-sdk-environment-images-Cbyno2vh.js +0 -1
  455. package/dist/assets/volter-sdk-extension-script-eemVEaFY.js +0 -1
  456. package/dist/assets/volter-sdk-eyedropper-session-BL5ceME-.js +0 -1
  457. package/dist/assets/volter-sdk-files-file-provider-D1vbGyMw.js +0 -1
  458. package/dist/assets/volter-sdk-files-project-files-CP9k503M.js +0 -1
  459. package/dist/assets/volter-sdk-framed-document-capture-DmqG4gUx.js +0 -1
  460. package/dist/assets/volter-sdk-framed-document-driver-B1ZAcb9l.js +0 -1
  461. package/dist/assets/volter-sdk-hierarchy-component-marks-DjtdLv04.js +0 -1
  462. package/dist/assets/volter-sdk-hierarchy-kind-icon-Dwlq9_xw.js +0 -1
  463. package/dist/assets/volter-sdk-hierarchy-row-media-CnFXPw4O.js +0 -1
  464. package/dist/assets/volter-sdk-hierarchy-row-model-TWxtUUdN.js +0 -1
  465. package/dist/assets/volter-sdk-hierarchy-rows-3Hl6K3Br.js +0 -1
  466. package/dist/assets/volter-sdk-hierarchy-walk-DvIomDWH.js +0 -1
  467. package/dist/assets/volter-sdk-history-history-delegate-RfZBUw9Y.js +0 -1
  468. package/dist/assets/volter-sdk-history-history-service-BWYajIYW.js +0 -1
  469. package/dist/assets/volter-sdk-history-persistence-coordinator-CmebAufQ.js +0 -1
  470. package/dist/assets/volter-sdk-history-resource-registry-CgjY-ErS.js +0 -1
  471. package/dist/assets/volter-sdk-history-snapshot-store-6Cq4Qau6.js +0 -1
  472. package/dist/assets/volter-sdk-history-source-history-backend-CilZiNDq.js +0 -1
  473. package/dist/assets/volter-sdk-hmr-registration-group-idNaexWq.js +0 -1
  474. package/dist/assets/volter-sdk-hmr-stable-react-context-DhY9rjD6.js +0 -1
  475. package/dist/assets/volter-sdk-host-BcQCyyIe.js +0 -1
  476. package/dist/assets/volter-sdk-inference-diagnostics-c4Aju1Jg.js +0 -1
  477. package/dist/assets/volter-sdk-inspection-document-subject-i64BmR5X.js +0 -1
  478. package/dist/assets/volter-sdk-inspection-group-icons-CWwhjZWt.js +0 -1
  479. package/dist/assets/volter-sdk-inspection-model-BgZVa_7l.js +0 -1
  480. package/dist/assets/volter-sdk-inspection-node-media-DNYb7ZDG.js +0 -1
  481. package/dist/assets/volter-sdk-inspection-null-subject-hK6kZbB7.js +0 -1
  482. package/dist/assets/volter-sdk-inspector-property-grouping-B-4_nVMm.js +0 -1
  483. package/dist/assets/volter-sdk-inspector-section-registry-DIYAa_rQ.js +0 -1
  484. package/dist/assets/volter-sdk-js-heap-DDws540T.js +0 -1
  485. package/dist/assets/volter-sdk-layout-arrangements-DdjnA7ET.js +0 -1
  486. package/dist/assets/volter-sdk-layouts-DcV6NQNu.js +0 -1
  487. package/dist/assets/volter-sdk-light-explorer-model-BoB1GjBo.js +0 -1
  488. package/dist/assets/volter-sdk-live-seam-evidence-BOvNn-o8.js +0 -1
  489. package/dist/assets/volter-sdk-live-session-registry--ftGWuRg.js +0 -1
  490. package/dist/assets/volter-sdk-mount-css-scope-BTi-3JA9.js +0 -1
  491. package/dist/assets/volter-sdk-mount-failure-report-BeR90-6n.js +0 -1
  492. package/dist/assets/volter-sdk-native-selection-style-70aZpb0m.js +0 -1
  493. package/dist/assets/volter-sdk-photograph-notice-BwuWgyiq.js +0 -1
  494. package/dist/assets/volter-sdk-play-camera-flight-CaSiTxDt.js +0 -1
  495. package/dist/assets/volter-sdk-product-command-Cf1utO0M.js +0 -1
  496. package/dist/assets/volter-sdk-project-module-changes-CIKyvjy2.js +0 -1
  497. package/dist/assets/volter-sdk-project-module-url-XzZmS9zs.js +0 -1
  498. package/dist/assets/volter-sdk-project-output-roots-B4bC82T9.js +0 -1
  499. package/dist/assets/volter-sdk-renderer-resource-counts-S3R39qoy.js +0 -1
  500. package/dist/assets/volter-sdk-scoped-project-css-Ch7LkU2q.js +0 -1
  501. package/dist/assets/volter-sdk-selection-C2gFhPip.js +0 -1
  502. package/dist/assets/volter-sdk-served-url-DxzhEpXR.js +0 -1
  503. package/dist/assets/volter-sdk-serving-engine-BclAA7ZZ.js +0 -1
  504. package/dist/assets/volter-sdk-settings-settings-provider-DGc5Xf46.js +0 -1
  505. package/dist/assets/volter-sdk-settings-store-Bmx-a8f0.js +0 -1
  506. package/dist/assets/volter-sdk-shell-store-door-CQlHDF_i.js +0 -1
  507. package/dist/assets/volter-sdk-shell-store-e-X3-CSz.js +0 -1
  508. package/dist/assets/volter-sdk-source-conflict-DEn0Z5Vq.js +0 -1
  509. package/dist/assets/volter-sdk-stage-context-CwBngGWz.js +0 -1
  510. package/dist/assets/volter-sdk-stage-invalidation-Bt1Gs-b2.js +0 -1
  511. package/dist/assets/volter-sdk-stage-store-registry-DtSMhopZ.js +0 -1
  512. package/dist/assets/volter-sdk-stories-compose-project-stories-DfgTy2Bp.js +0 -1
  513. package/dist/assets/volter-sdk-stories-scope-4lTT6I0H.js +0 -1
  514. package/dist/assets/volter-sdk-stories-story-declared-medium-BFcKINTP.js +0 -1
  515. package/dist/assets/volter-sdk-stories-story-dom-runtime-wAz1MhyJ.js +0 -1
  516. package/dist/assets/volter-sdk-stories-story-grouping-bVoaiX0-.js +0 -1
  517. package/dist/assets/volter-sdk-surface-keyboard-5u3olsPL.js +0 -1
  518. package/dist/assets/volter-sdk-surface-state-F5vfsPyq.js +0 -1
  519. package/dist/assets/volter-sdk-tab-census-B95O0nem.js +0 -1
  520. package/dist/assets/volter-sdk-tool-contribution-convention-k_AVbxWl.js +0 -1
  521. package/dist/assets/volter-sdk-transform-mode-request-CKhq0gIu.js +0 -1
  522. package/dist/assets/volter-sdk-transient-hint-DQMQ2_Y5.js +0 -1
  523. package/dist/assets/volter-sdk-ui-source-file-region-resolver-2Gw755Lw.js +0 -1
  524. package/dist/assets/volter-sdk-ui-source-tier-source-write-backend-BsEnWjJv.js +0 -1
  525. package/dist/assets/volter-sdk-viewport-activation-timings--7x_AkVR.js +0 -1
  526. package/dist/assets/volter-sdk-viewport-editor-controls-CFuNGxo6.js +0 -1
  527. package/dist/assets/volter-sdk-viewport-presentation-CoiYwzFE.js +0 -1
  528. package/dist/assets/volter-sdk-volter-contributions-DjgbZdIJ.js +0 -1
  529. package/dist/assets/volter-sdk-wait-until-DRdtM37d.js +0 -1
  530. package/dist/assets/volter-sdk-widgets-design-system-CPmOMXke.js +0 -1
  531. package/dist/assets/volter-sdk-widgets-editor-appearance-B4Q93899.js +0 -1
  532. package/dist/assets/volter-sdk-widgets-editor-material-C6dqUruc.js +0 -1
  533. package/dist/assets/volter-sdk-widgets-icon-set-registry-BOtjeU-M.js +0 -1
  534. package/dist/assets/volter-sdk-widgets-index-C2FSk2KK.js +0 -1
  535. package/dist/assets/volter-sdk-widgets-inspector-widgets-AlignmentGrid-ClaWmFsj.js +0 -1
  536. package/dist/assets/volter-sdk-widgets-inspector-widgets-AssetSlotPicker-DIoRDT6D.js +0 -1
  537. package/dist/assets/volter-sdk-widgets-inspector-widgets-BorderEditor-BcsoJNaT.js +0 -1
  538. package/dist/assets/volter-sdk-widgets-inspector-widgets-ColorPicker-p_xfUT04.js +0 -1
  539. package/dist/assets/volter-sdk-widgets-inspector-widgets-CurveEditor-RbGdt95N.js +0 -1
  540. package/dist/assets/volter-sdk-widgets-inspector-widgets-FontPicker-DxdmydaC.js +0 -1
  541. package/dist/assets/volter-sdk-widgets-inspector-widgets-GradientEditor-DZ0Z3l2P.js +0 -1
  542. package/dist/assets/volter-sdk-widgets-inspector-widgets-ScrubbableInput-Byy_M7hB.js +0 -1
  543. package/dist/assets/volter-sdk-widgets-inspector-widgets-ShadowEditor-C9aPdbrZ.js +0 -1
  544. package/dist/assets/volter-sdk-widgets-inspector-widgets-color-utils-BJStispK.js +0 -1
  545. package/dist/assets/volter-sdk-widgets-inspector-widgets-curve-utils-C_5eRE_F.js +0 -1
  546. package/dist/assets/volter-sdk-widgets-inspector-widgets-index-BA3S0eIV.js +0 -1
  547. package/dist/assets/volter-sdk-widgets-inspector-widgets-shared-DHHUQexs.js +0 -1
  548. package/dist/assets/volter-sdk-widgets-interactive-edit-scope-CjuUPrEv.js +0 -1
  549. package/dist/assets/volter-sdk-widgets-patterns-Dialog-CQggdCbk.js +0 -1
  550. package/dist/assets/volter-sdk-widgets-patterns-Fields-D38At0E9.js +0 -1
  551. package/dist/assets/volter-sdk-widgets-patterns-List-ewRDByTO.js +0 -1
  552. package/dist/assets/volter-sdk-widgets-patterns-StateSurface-C8YqnN-5.js +0 -1
  553. package/dist/assets/volter-sdk-widgets-patterns-Surfaces-BjFrm6Mc.js +0 -1
  554. package/dist/assets/volter-sdk-widgets-patterns-Tabs-JZq1ce4h.js +0 -1
  555. package/dist/assets/volter-sdk-widgets-patterns-Toolbar-Bf61fc1T.js +0 -1
  556. package/dist/assets/volter-sdk-widgets-patterns-Tree-CwuVbaxj.js +0 -1
  557. package/dist/assets/volter-sdk-widgets-primitives-AnchoredMenu-Ch2ujeLH.js +0 -1
  558. package/dist/assets/volter-sdk-widgets-primitives-Button-d2WNMADR.js +0 -1
  559. package/dist/assets/volter-sdk-widgets-primitives-ColorInput-DP0WkwNs.js +0 -1
  560. package/dist/assets/volter-sdk-widgets-primitives-DraftTextInput-D1g1A89b.js +0 -1
  561. package/dist/assets/volter-sdk-widgets-primitives-EditorIcon-DAjALCvl.js +0 -1
  562. package/dist/assets/volter-sdk-widgets-primitives-FormControls-KBDCYHsT.js +0 -1
  563. package/dist/assets/volter-sdk-widgets-primitives-HoverPreview-D2qUt6_z.js +0 -1
  564. package/dist/assets/volter-sdk-widgets-primitives-JsonInput-DLs3kN1L.js +0 -1
  565. package/dist/assets/volter-sdk-widgets-primitives-Layout-DshSsm_4.js +0 -1
  566. package/dist/assets/volter-sdk-widgets-primitives-Menu-Ch-3iDys.js +0 -1
  567. package/dist/assets/volter-sdk-widgets-primitives-NumberInput-pdAN4aF3.js +0 -1
  568. package/dist/assets/volter-sdk-widgets-primitives-Panel-BNFSUDwP.js +0 -1
  569. package/dist/assets/volter-sdk-widgets-primitives-SectionHeader-5Hv-rso1.js +0 -1
  570. package/dist/assets/volter-sdk-widgets-primitives-Text-CtWC8t_L.js +0 -1
  571. package/dist/assets/volter-sdk-widgets-primitives-ThemeRootPortal-h0iinIvj.js +0 -1
  572. package/dist/assets/volter-sdk-widgets-primitives-Tooltip-Cllx19nM.js +0 -1
  573. package/dist/assets/volter-sdk-widgets-primitives-Vec3Input-CurGarFa.js +0 -1
  574. package/dist/assets/volter-sdk-widgets-primitives-clamp-to-viewport-0YxAdd5O.js +0 -1
  575. package/dist/assets/volter-sdk-widgets-primitives-editor-icons-ExQE8_SP.js +0 -1
  576. package/dist/assets/volter-sdk-widgets-primitives-panel-header-styles-DGmxyx4E.js +0 -1
  577. package/dist/assets/volter-sdk-widgets-theme-DOfZnIVM.js +0 -1
  578. package/dist/assets/volter-sdk-widgets-z-index-BpB2pf-w.js +0 -1
  579. package/dist/assets/volter-sdk-worker-call-metrics-Cdo-WjAp.js +0 -1
  580. package/dist/assets/volter-sdk-workspace-document-ids-CWVlaP7n.js +0 -1
  581. package/dist/assets/volter-sdk-workspace-document-registry-DoKaj8Fe.js +0 -1
  582. package/dist/assets/volter-sdk-workspace-document-restore-BOPAH61D.js +0 -1
  583. package/dist/assets/volter-sdk-workspace-static-panels-DZr1Q4n1.js +0 -1
  584. package/dist/assets/volter-sdk-workspace-status-registry-pIvpW3QR.js +0 -1
  585. package/dist/assets/volter-sdk-workspace-utility-registry-BRzyLcLs.js +0 -1
  586. package/dist/assets/volter-sdk-world-canvas-viewport-state-DeMws4Bu.js +0 -1
  587. package/dist/assets/volter-sdk-world-pan-state-Dpul1S4k.js +0 -1
  588. package/dist/assets/volter-sdk-write-pipe-vbjHAGKf.js +0 -1
  589. package/dist/assets/volter-shared-react-dom-client-B6uCXsbq.js +0 -1
  590. package/dist/assets/volter-shared-three-DSLGcAKx.js +0 -1
  591. package/dist/assets/worker-DeeaIXW_.js +0 -10
  592. package/src/contributions.d.ts +0 -9
  593. package/starter/game/client/index.tsx +0 -52
  594. package/starter/game/levels/GroundEnvironment.tsx +0 -15
  595. package/starter/game/levels/GroundLevel.tsx +0 -35
  596. package/starter/game/levels/ground.canvas.ts +0 -11
  597. package/starter/game/levels/ground.glb +0 -0
  598. package/starter/game/levels/ground.py +0 -142
@@ -1,4220 +0,0 @@
1
- import{ACESFilmicToneMapping as Bi,AddEquation as jt,AddOperation as Br,AdditiveAnimationBlendMode as go,AdditiveBlending as qn,AgXToneMapping as Gi,AlphaFormat as Gr,AlwaysCompare as Hr,AlwaysDepth as Vr,AlwaysStencilFunc as vo,AmbientLight as So,AnimationAction as Eo,AnimationClip as Mo,AnimationLoader as xo,AnimationMixer as To,AnimationObjectGroup as Ao,AnimationUtils as Ro,ArcCurve as bo,ArrayCamera as Wr,ArrowHelper as Co,AttachedBindMode as Po,Audio as Lo,AudioAnalyser as Uo,AudioContext as Do,AudioListener as wo,AudioLoader as Io,AxesHelper as No,BackSide as St,BasicDepthPacking as yo,BasicShadowMap as Fo,BatchedMesh as Oo,BezierInterpolant as Bo,Bone as Go,BooleanKeyframeTrack as Ho,Box2 as Vo,Box3 as Wo,Box3Helper as ko,BoxGeometry as yn,BoxHelper as zo,BufferAttribute as Dn,BufferGeometry as _n,BufferGeometryLoader as Xo,ByteType as kr,Cache as Ko,Camera as Yo,CameraHelper as qo,CanvasTexture as Zo,CapsuleGeometry as $o,CatmullRomCurve3 as Qo,CineonToneMapping as Hi,CircleGeometry as Jo,ClampToEdgeWrapping as wn,Clock as jo,Color as je,ColorKeyframeTrack as es,ColorManagement as tt,Compatibility as ts,CompressedArrayTexture as ns,CompressedCubeTexture as is,CompressedTexture as rs,CompressedTextureLoader as as,ConeGeometry as os,ConstantAlphaFactor as zr,ConstantColorFactor as Xr,Controls as ss,CubeCamera as Kr,CubeDepthTexture as Yr,CubeReflectionMapping as nn,CubeRefractionMapping as Kt,CubeTexture as Vi,CubeTextureLoader as ls,CubeUVReflectionMapping as gn,CubicBezierCurve as cs,CubicBezierCurve3 as fs,CubicInterpolant as ds,CullFaceBack as Zn,CullFaceFront as qr,CullFaceFrontBack as us,CullFaceNone as Zr,Curve as ps,CurvePath as hs,CustomBlending as $r,CustomToneMapping as Wi,CylinderGeometry as ms,Cylindrical as _s,Data3DTexture as Qr,DataArrayTexture as ki,DataTexture as Jr,DataTextureLoader as gs,DataUtils as vs,DecrementStencilOp as Ss,DecrementWrapStencilOp as Es,DefaultLoadingManager as Ms,DepthFormat as Yt,DepthStencilFormat as zt,DepthTexture as hn,DetachedBindMode as xs,DirectionalLight as Ts,DirectionalLightHelper as As,DiscreteInterpolant as Rs,DodecahedronGeometry as bs,DoubleSide as Lt,DstAlphaFactor as jr,DstColorFactor as ea,DynamicCopyUsage as Cs,DynamicDrawUsage as Ps,DynamicReadUsage as Ls,EdgesGeometry as Us,EllipseCurve as Ds,EqualCompare as ta,EqualDepth as na,EqualStencilFunc as ws,EquirectangularReflectionMapping as xn,EquirectangularRefractionMapping as Tn,Euler as Is,EventDispatcher as ia,ExternalTexture as zi,ExtrudeGeometry as Ns,FileLoader as ys,Float16BufferAttribute as Fs,Float32BufferAttribute as $n,FloatType as yt,Fog as Os,FogExp2 as Bs,FramebufferTexture as Gs,FrontSide as rn,Frustum as Xi,FrustumArray as Hs,GLBufferAttribute as Vs,GLSL1 as Ws,GLSL3 as Qn,GreaterCompare as ra,GreaterDepth as aa,GreaterEqualCompare as Fn,GreaterEqualDepth as oa,GreaterEqualStencilFunc as ks,GreaterStencilFunc as zs,GridHelper as Xs,Group as Ks,HTMLTexture as Ys,HalfFloatType as wt,HemisphereLight as qs,HemisphereLightHelper as Zs,IcosahedronGeometry as $s,ImageBitmapLoader as Qs,ImageLoader as Js,ImageUtils as js,IncrementStencilOp as el,IncrementWrapStencilOp as tl,InstancedBufferAttribute as nl,InstancedBufferGeometry as il,InstancedInterleavedBuffer as rl,InstancedMesh as al,Int16BufferAttribute as ol,Int32BufferAttribute as sl,Int8BufferAttribute as ll,IntType as Ki,InterleavedBuffer as cl,InterleavedBufferAttribute as fl,Interpolant as dl,InterpolateBezier as ul,InterpolateDiscrete as pl,InterpolateLinear as hl,InterpolateSmooth as ml,InterpolationSamplingMode as _l,InterpolationSamplingType as gl,InvertStencilOp as vl,KeepStencilOp as Sl,KeyframeTrack as El,LOD as Ml,LatheGeometry as xl,Layers as sa,LessCompare as la,LessDepth as ca,LessEqualCompare as On,LessEqualDepth as Jn,LessEqualStencilFunc as Tl,LessStencilFunc as Al,Light as Rl,LightProbe as bl,LightShadow as Cl,Line as Pl,Line3 as Ll,LineBasicMaterial as Ul,LineCurve as Dl,LineCurve3 as wl,LineDashedMaterial as Il,LineLoop as Nl,LineSegments as yl,LinearFilter as vt,LinearInterpolant as Fl,LinearMipMapLinearFilter as Ol,LinearMipMapNearestFilter as Bl,LinearMipmapLinearFilter as Xt,LinearMipmapNearestFilter as An,LinearSRGBColorSpace as Yi,LinearToneMapping as qi,LinearTransfer as Zi,Loader as Gl,LoaderUtils as Hl,LoadingManager as Vl,LoopOnce as Wl,LoopPingPong as kl,LoopRepeat as zl,MOUSE as Xl,Material as Kl,MaterialBlending as Yl,MaterialLoader as ql,MathUtils as Zl,Matrix2 as $l,Matrix3 as ye,Matrix4 as qt,MaxEquation as fa,Mesh as It,MeshBasicMaterial as da,MeshDepthMaterial as ua,MeshDistanceMaterial as pa,MeshLambertMaterial as Ql,MeshMatcapMaterial as Jl,MeshNormalMaterial as jl,MeshPhongMaterial as ec,MeshPhysicalMaterial as tc,MeshStandardMaterial as nc,MeshToonMaterial as ic,MinEquation as ha,MirroredRepeatWrapping as ma,MixOperation as _a,MultiplyBlending as jn,MultiplyOperation as ga,NearestFilter as Gt,NearestMipMapLinearFilter as rc,NearestMipMapNearestFilter as ac,NearestMipmapLinearFilter as cn,NearestMipmapNearestFilter as va,NeutralToneMapping as $i,NeverCompare as Sa,NeverDepth as Ea,NeverStencilFunc as oc,NoBlending as Dt,NoColorSpace as kt,NoNormalPacking as sc,NoToneMapping as Rt,NormalAnimationBlendMode as lc,NormalBlending as dn,NormalGAPacking as cc,NormalRGPacking as fc,NotEqualCompare as Ma,NotEqualDepth as xa,NotEqualStencilFunc as dc,NumberKeyframeTrack as uc,Object3D as pc,ObjectLoader as hc,ObjectSpaceNormalMap as Ta,OctahedronGeometry as mc,OneFactor as Aa,OneMinusConstantAlphaFactor as Ra,OneMinusConstantColorFactor as ba,OneMinusDstAlphaFactor as Ca,OneMinusDstColorFactor as Pa,OneMinusSrcAlphaFactor as La,OneMinusSrcColorFactor as Ua,OrthographicCamera as Qi,PCFShadowMap as un,PCFSoftShadowMap as Da,Path as _c,PerspectiveCamera as pn,Plane as wa,PlaneGeometry as Ji,PlaneHelper as gc,PointLight as vc,PointLightHelper as Sc,Points as Ec,PointsMaterial as Mc,PolarGridHelper as xc,PolyhedronGeometry as Tc,PositionalAudio as Ac,PropertyBinding as Rc,PropertyMixer as bc,QuadraticBezierCurve as Cc,QuadraticBezierCurve3 as Pc,Quaternion as Lc,QuaternionKeyframeTrack as Uc,QuaternionLinearInterpolant as Dc,R11_EAC_Format as ei,RED_GREEN_RGTC2_Format as In,RED_RGTC1_Format as ti,REVISION as Ia,RG11_EAC_Format as Nn,RGBADepthPacking as wc,RGBAFormat as Ut,RGBAIntegerFormat as ji,RGBA_ASTC_10x10_Format as ni,RGBA_ASTC_10x5_Format as ii,RGBA_ASTC_10x6_Format as ri,RGBA_ASTC_10x8_Format as ai,RGBA_ASTC_12x10_Format as oi,RGBA_ASTC_12x12_Format as si,RGBA_ASTC_4x4_Format as li,RGBA_ASTC_5x4_Format as ci,RGBA_ASTC_5x5_Format as fi,RGBA_ASTC_6x5_Format as di,RGBA_ASTC_6x6_Format as ui,RGBA_ASTC_8x5_Format as pi,RGBA_ASTC_8x6_Format as hi,RGBA_ASTC_8x8_Format as mi,RGBA_BPTC_Format as _i,RGBA_ETC2_EAC_Format as gi,RGBA_PVRTC_2BPPV1_Format as vi,RGBA_PVRTC_4BPPV1_Format as Si,RGBA_S3TC_DXT1_Format as Rn,RGBA_S3TC_DXT3_Format as bn,RGBA_S3TC_DXT5_Format as Cn,RGBDepthPacking as Ic,RGBFormat as Na,RGBIntegerFormat as Nc,RGB_BPTC_SIGNED_Format as Ei,RGB_BPTC_UNSIGNED_Format as Mi,RGB_ETC1_Format as xi,RGB_ETC2_Format as Ti,RGB_PVRTC_2BPPV1_Format as Ai,RGB_PVRTC_4BPPV1_Format as Ri,RGB_S3TC_DXT1_Format as Pn,RGDepthPacking as yc,RGFormat as Zt,RGIntegerFormat as er,RawShaderMaterial as ya,Ray as Fc,Raycaster as Oc,RectAreaLight as Bc,RedFormat as Fa,RedIntegerFormat as tr,ReinhardToneMapping as nr,RenderObjectRefreshType as Gc,RenderTarget as Hc,RenderTarget3D as Vc,RepeatWrapping as Oa,ReplaceStencilOp as Wc,ReverseSubtractEquation as Ba,RingGeometry as kc,SIGNED_R11_EAC_Format as bi,SIGNED_RED_GREEN_RGTC2_Format as Ci,SIGNED_RED_RGTC1_Format as Pi,SIGNED_RG11_EAC_Format as Li,SRGBColorSpace as Ga,SRGBTransfer as Ye,Scene as zc,ShaderMaterial as Nt,ShadowMaterial as Xc,Shape as Kc,ShapeGeometry as Yc,ShapePath as qc,ShapeUtils as Zc,ShortType as Ha,Skeleton as $c,SkeletonHelper as Qc,SkinnedMesh as Jc,Source as jc,Sphere as ef,SphereGeometry as tf,Spherical as nf,SphericalHarmonics3 as rf,SplineCurve as af,SpotLight as of,SpotLightHelper as sf,Sprite as lf,SpriteMaterial as cf,SrcAlphaFactor as Va,SrcAlphaSaturateFactor as Wa,SrcColorFactor as ka,StaticCopyUsage as ff,StaticDrawUsage as df,StaticReadUsage as uf,StereoCamera as pf,StreamCopyUsage as hf,StreamDrawUsage as mf,StreamReadUsage as _f,StringKeyframeTrack as gf,SubtractEquation as za,SubtractiveBlending as Ui,TOUCH as vf,TangentSpaceNormalMap as Di,TetrahedronGeometry as Sf,Texture as Xa,TextureLoader as Ef,TextureSource as Mf,TextureUtils as xf,Timer as Tf,TimestampQuery as Af,TorusGeometry as Rf,TorusKnotGeometry as bf,Triangle as Cf,TriangleFanDrawMode as Pf,TriangleStripDrawMode as Lf,TrianglesDrawMode as Uf,TubeGeometry as Df,UVMapping as wf,Uint16BufferAttribute as Ka,Uint32BufferAttribute as Ya,Uint8BufferAttribute as If,Uint8ClampedBufferAttribute as Nf,Uniform as yf,UniformsGroup as Ff,Vector2 as mt,Vector3 as Ne,UniformsUtils as qa,UnsignedByteType as At,UnsignedInt101111Type as Za,UnsignedInt248Type as an,UnsignedInt5999Type as $a,UnsignedIntType as Ht,UnsignedShort4444Type as ir,UnsignedShort5551Type as rr,UnsignedShortType as mn,VSMShadowMap as en,Vector4 as ht,VectorKeyframeTrack as Of,VideoFrameTexture as Bf,VideoTexture as Gf,WebGL3DRenderTarget as Hf,WebGLArrayRenderTarget as Vf,WebGLCoordinateSystem as wi,WebGLRenderTarget as Mt,WebGPUCoordinateSystem as Wf,WebXRController as Ln,WireframeGeometry as kf,WrapAroundEnding as zf,ZeroCurvatureEnding as Xf,ZeroFactor as Qa,ZeroSlopeEnding as Kf,ZeroStencilOp as Yf,createCanvasElement as Ja,mergeUniforms as gt,cloneUniforms as Ii,error as Qe,warn as Ve,log as Ni,probeAsync as qf,RAD2DEG as Zf,warnOnce as ja,ReversedDepthFuncs as $f,getUnlitUniformColorSpace as eo,getByteLength as _r,createElementNS as Qf,getConsoleFunction as Jf,setConsoleFunction as jf}from"./volter-shared-three-core-DEsIwtOu.js";/**
2
- * @license
3
- * Copyright 2010-2026 Three.js Authors
4
- * SPDX-License-Identifier: MIT
5
- */function to(){let e=null,n=!1,t=null,i=null;function l(o,d){i=e.requestAnimationFrame(l),t(o,d)}return{start:function(){n!==!0&&t!==null&&e!==null&&(i=e.requestAnimationFrame(l),n=!0)},stop:function(){e!==null&&e.cancelAnimationFrame(i),n=!1},setAnimationLoop:function(o){t=o},setContext:function(o){e=o}}}function ed(e){const n=new WeakMap;function t(g,R){const T=g.array,H=g.usage,I=T.byteLength,p=e.createBuffer();e.bindBuffer(R,p),e.bufferData(R,T,H),g.onUploadCallback();let x;if(T instanceof Float32Array)x=e.FLOAT;else if(typeof Float16Array<"u"&&T instanceof Float16Array)x=e.HALF_FLOAT;else if(T instanceof Uint16Array)g.isFloat16BufferAttribute?x=e.HALF_FLOAT:x=e.UNSIGNED_SHORT;else if(T instanceof Int16Array)x=e.SHORT;else if(T instanceof Uint32Array)x=e.UNSIGNED_INT;else if(T instanceof Int32Array)x=e.INT;else if(T instanceof Int8Array)x=e.BYTE;else if(T instanceof Uint8Array)x=e.UNSIGNED_BYTE;else if(T instanceof Uint8ClampedArray)x=e.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+T);return{buffer:p,type:x,bytesPerElement:T.BYTES_PER_ELEMENT,version:g.version,size:I}}function i(g,R,T){const H=R.array,I=R.updateRanges;if(e.bindBuffer(T,g),I.length===0)e.bufferSubData(T,0,H);else{I.sort((x,N)=>x.start-N.start);let p=0;for(let x=1;x<I.length;x++){const N=I[p],W=I[x];W.start<=N.start+N.count+1?N.count=Math.max(N.count,W.start+W.count-N.start):(++p,I[p]=W)}I.length=p+1;for(let x=0,N=I.length;x<N;x++){const W=I[x];e.bufferSubData(T,W.start*H.BYTES_PER_ELEMENT,H,W.start,W.count)}R.clearUpdateRanges()}R.onUploadCallback()}function l(g){return g.isInterleavedBufferAttribute&&(g=g.data),n.get(g)}function o(g){g.isInterleavedBufferAttribute&&(g=g.data);const R=n.get(g);R&&(e.deleteBuffer(R.buffer),n.delete(g))}function d(g,R){if(g.isInterleavedBufferAttribute&&(g=g.data),g.isGLBufferAttribute){const H=n.get(g);(!H||H.version<g.version)&&n.set(g,{buffer:g.buffer,type:g.type,bytesPerElement:g.elementSize,version:g.version});return}const T=n.get(g);if(T===void 0)n.set(g,t(g,R));else if(T.version<g.version){if(T.size!==g.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(T.buffer,g,R),T.version=g.version}}return{get:l,remove:o,update:d}}var td=`#ifdef USE_ALPHAHASH
6
- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
- #endif`,nd=`#ifdef USE_ALPHAHASH
8
- const float ALPHA_HASH_SCALE = 0.05;
9
- float hash2D( vec2 value ) {
10
- return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
11
- }
12
- float hash3D( vec3 value ) {
13
- return hash2D( vec2( hash2D( value.xy ), value.z ) );
14
- }
15
- float getAlphaHashThreshold( vec3 position ) {
16
- float maxDeriv = max(
17
- length( dFdx( position.xyz ) ),
18
- length( dFdy( position.xyz ) )
19
- );
20
- float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
21
- vec2 pixScales = vec2(
22
- exp2( floor( log2( pixScale ) ) ),
23
- exp2( ceil( log2( pixScale ) ) )
24
- );
25
- vec2 alpha = vec2(
26
- hash3D( floor( pixScales.x * position.xyz ) ),
27
- hash3D( floor( pixScales.y * position.xyz ) )
28
- );
29
- float lerpFactor = fract( log2( pixScale ) );
30
- float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
31
- float a = min( lerpFactor, 1.0 - lerpFactor );
32
- vec3 cases = vec3(
33
- x * x / ( 2.0 * a * ( 1.0 - a ) ),
34
- ( x - 0.5 * a ) / ( 1.0 - a ),
35
- 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
36
- );
37
- float threshold = ( x < ( 1.0 - a ) )
38
- ? ( ( x < a ) ? cases.x : cases.y )
39
- : cases.z;
40
- return clamp( threshold , 1.0e-6, 1.0 );
41
- }
42
- #endif`,id=`#ifdef USE_ALPHAMAP
43
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
- #endif`,rd=`#ifdef USE_ALPHAMAP
45
- uniform sampler2D alphaMap;
46
- #endif`,ad=`#ifdef USE_ALPHATEST
47
- #ifdef ALPHA_TO_COVERAGE
48
- diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49
- if ( diffuseColor.a == 0.0 ) discard;
50
- #else
51
- if ( diffuseColor.a < alphaTest ) discard;
52
- #endif
53
- #endif`,od=`#ifdef USE_ALPHATEST
54
- uniform float alphaTest;
55
- #endif`,sd=`#ifdef USE_AOMAP
56
- float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57
- reflectedLight.indirectDiffuse *= ambientOcclusion;
58
- #if defined( USE_CLEARCOAT )
59
- clearcoatSpecularIndirect *= ambientOcclusion;
60
- #endif
61
- #if defined( USE_SHEEN )
62
- sheenSpecularIndirect *= ambientOcclusion;
63
- #endif
64
- #if defined( USE_ENVMAP ) && defined( STANDARD )
65
- float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67
- #endif
68
- #endif`,ld=`#ifdef USE_AOMAP
69
- uniform sampler2D aoMap;
70
- uniform float aoMapIntensity;
71
- #endif`,cd=`#ifdef USE_BATCHING
72
- #if ! defined( GL_ANGLE_multi_draw )
73
- #define gl_DrawID _gl_DrawID
74
- uniform int _gl_DrawID;
75
- #endif
76
- uniform highp sampler2D batchingTexture;
77
- uniform highp usampler2D batchingIdTexture;
78
- mat4 getBatchingMatrix( const in float i ) {
79
- int size = textureSize( batchingTexture, 0 ).x;
80
- int j = int( i ) * 4;
81
- int x = j % size;
82
- int y = j / size;
83
- vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
84
- vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
85
- vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
86
- vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
87
- return mat4( v1, v2, v3, v4 );
88
- }
89
- float getIndirectIndex( const in int i ) {
90
- int size = textureSize( batchingIdTexture, 0 ).x;
91
- int x = i % size;
92
- int y = i / size;
93
- return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
94
- }
95
- #endif
96
- #ifdef USE_BATCHING_COLOR
97
- uniform sampler2D batchingColorTexture;
98
- vec4 getBatchingColor( const in float i ) {
99
- int size = textureSize( batchingColorTexture, 0 ).x;
100
- int j = int( i );
101
- int x = j % size;
102
- int y = j / size;
103
- return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104
- }
105
- #endif`,fd=`#ifdef USE_BATCHING
106
- mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107
- #endif`,dd=`vec3 transformed = vec3( position );
108
- #ifdef USE_ALPHAHASH
109
- vPosition = vec3( position );
110
- #endif`,ud=`vec3 objectNormal = vec3( normal );
111
- #ifdef USE_TANGENT
112
- vec3 objectTangent = vec3( tangent.xyz );
113
- #endif`,pd=`float G_BlinnPhong_Implicit( ) {
114
- return 0.25;
115
- }
116
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
117
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
118
- }
119
- vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
120
- vec3 halfDir = normalize( lightDir + viewDir );
121
- float dotNH = saturate( dot( normal, halfDir ) );
122
- float dotVH = saturate( dot( viewDir, halfDir ) );
123
- vec3 F = F_Schlick( specularColor, 1.0, dotVH );
124
- float G = G_BlinnPhong_Implicit( );
125
- float D = D_BlinnPhong( shininess, dotNH );
126
- return F * ( G * D );
127
- } // validated`,hd=`#ifdef USE_IRIDESCENCE
128
- const mat3 XYZ_TO_REC709 = mat3(
129
- 3.2404542, -0.9692660, 0.0556434,
130
- -1.5371385, 1.8760108, -0.2040259,
131
- -0.4985314, 0.0415560, 1.0572252
132
- );
133
- vec3 Fresnel0ToIor( vec3 fresnel0 ) {
134
- vec3 sqrtF0 = sqrt( fresnel0 );
135
- return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
136
- }
137
- vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
138
- return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
139
- }
140
- float IorToFresnel0( float transmittedIor, float incidentIor ) {
141
- return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
142
- }
143
- vec3 evalSensitivity( float OPD, vec3 shift ) {
144
- float phase = 2.0 * PI * OPD * 1.0e-9;
145
- vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
146
- vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
147
- vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
148
- vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
149
- xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
150
- xyz /= 1.0685e-7;
151
- vec3 rgb = XYZ_TO_REC709 * xyz;
152
- return rgb;
153
- }
154
- vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
155
- vec3 I;
156
- float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
157
- float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
158
- float cosTheta2Sq = 1.0 - sinTheta2Sq;
159
- if ( cosTheta2Sq < 0.0 ) {
160
- return vec3( 1.0 );
161
- }
162
- float cosTheta2 = sqrt( cosTheta2Sq );
163
- float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
164
- float R12 = F_Schlick( R0, 1.0, cosTheta1 );
165
- float T121 = 1.0 - R12;
166
- float phi12 = 0.0;
167
- if ( iridescenceIOR < outsideIOR ) phi12 = PI;
168
- float phi21 = PI - phi12;
169
- vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
170
- vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
171
- vec3 phi23 = vec3( 0.0 );
172
- if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
173
- if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
174
- if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
175
- float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
176
- vec3 phi = vec3( phi21 ) + phi23;
177
- vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
178
- vec3 r123 = sqrt( R123 );
179
- vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
180
- vec3 C0 = R12 + Rs;
181
- I = C0;
182
- vec3 Cm = Rs - T121;
183
- for ( int m = 1; m <= 2; ++ m ) {
184
- Cm *= r123;
185
- vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
186
- I += Cm * Sm;
187
- }
188
- return max( I, vec3( 0.0 ) );
189
- }
190
- #endif`,md=`#ifdef USE_BUMPMAP
191
- uniform sampler2D bumpMap;
192
- uniform float bumpScale;
193
- vec2 dHdxy_fwd() {
194
- vec2 dSTdx = dFdx( vBumpMapUv );
195
- vec2 dSTdy = dFdy( vBumpMapUv );
196
- float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
197
- float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
198
- float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
199
- return vec2( dBx, dBy );
200
- }
201
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
202
- vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
203
- vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
204
- vec3 vN = surf_norm;
205
- vec3 R1 = cross( vSigmaY, vN );
206
- vec3 R2 = cross( vN, vSigmaX );
207
- float fDet = dot( vSigmaX, R1 ) * faceDirection;
208
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209
- return normalize( abs( fDet ) * surf_norm - vGrad );
210
- }
211
- #endif`,_d=`#if NUM_CLIPPING_PLANES > 0
212
- vec4 plane;
213
- #ifdef ALPHA_TO_COVERAGE
214
- float distanceToPlane, distanceGradient;
215
- float clipOpacity = 1.0;
216
- #pragma unroll_loop_start
217
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
218
- plane = clippingPlanes[ i ];
219
- distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
220
- distanceGradient = fwidth( distanceToPlane ) / 2.0;
221
- clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
222
- if ( clipOpacity == 0.0 ) discard;
223
- }
224
- #pragma unroll_loop_end
225
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
226
- float unionClipOpacity = 1.0;
227
- #pragma unroll_loop_start
228
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
229
- plane = clippingPlanes[ i ];
230
- distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
231
- distanceGradient = fwidth( distanceToPlane ) / 2.0;
232
- unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
233
- }
234
- #pragma unroll_loop_end
235
- clipOpacity *= 1.0 - unionClipOpacity;
236
- #endif
237
- diffuseColor.a *= clipOpacity;
238
- if ( diffuseColor.a == 0.0 ) discard;
239
- #else
240
- #pragma unroll_loop_start
241
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
242
- plane = clippingPlanes[ i ];
243
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
244
- }
245
- #pragma unroll_loop_end
246
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
247
- bool clipped = true;
248
- #pragma unroll_loop_start
249
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
250
- plane = clippingPlanes[ i ];
251
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
252
- }
253
- #pragma unroll_loop_end
254
- if ( clipped ) discard;
255
- #endif
256
- #endif
257
- #endif`,gd=`#if NUM_CLIPPING_PLANES > 0
258
- varying vec3 vClipPosition;
259
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260
- #endif`,vd=`#if NUM_CLIPPING_PLANES > 0
261
- varying vec3 vClipPosition;
262
- #endif`,Sd=`#if NUM_CLIPPING_PLANES > 0
263
- vClipPosition = - mvPosition.xyz;
264
- #endif`,Ed=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265
- diffuseColor *= vColor;
266
- #endif`,Md=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267
- varying vec4 vColor;
268
- #endif`,xd=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269
- varying vec4 vColor;
270
- #endif`,Td=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271
- vColor = vec4( 1.0 );
272
- #endif
273
- #ifdef USE_COLOR_ALPHA
274
- vColor *= color;
275
- #elif defined( USE_COLOR )
276
- vColor.rgb *= color;
277
- #endif
278
- #ifdef USE_INSTANCING_COLOR
279
- vColor.rgb *= instanceColor.rgb;
280
- #endif
281
- #ifdef USE_BATCHING_COLOR
282
- vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283
- #endif`,Ad=`#define PI 3.141592653589793
284
- #define PI2 6.283185307179586
285
- #define PI_HALF 1.5707963267948966
286
- #define RECIPROCAL_PI 0.3183098861837907
287
- #define RECIPROCAL_PI2 0.15915494309189535
288
- #define EPSILON 1e-6
289
- #ifndef saturate
290
- #define saturate( a ) clamp( a, 0.0, 1.0 )
291
- #endif
292
- #define whiteComplement( a ) ( 1.0 - saturate( a ) )
293
- float pow2( const in float x ) { return x*x; }
294
- vec3 pow2( const in vec3 x ) { return x*x; }
295
- float pow3( const in float x ) { return x*x*x; }
296
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
297
- float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
298
- float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
299
- highp float rand( const in vec2 uv ) {
300
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
301
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
302
- return fract( sin( sn ) * c );
303
- }
304
- #ifdef HIGH_PRECISION
305
- float precisionSafeLength( vec3 v ) { return length( v ); }
306
- #else
307
- float precisionSafeLength( vec3 v ) {
308
- float maxComponent = max3( abs( v ) );
309
- return length( v / maxComponent ) * maxComponent;
310
- }
311
- #endif
312
- struct IncidentLight {
313
- vec3 color;
314
- vec3 direction;
315
- bool visible;
316
- };
317
- struct ReflectedLight {
318
- vec3 directDiffuse;
319
- vec3 directSpecular;
320
- vec3 indirectDiffuse;
321
- vec3 indirectSpecular;
322
- };
323
- #ifdef USE_ALPHAHASH
324
- varying vec3 vPosition;
325
- #endif
326
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
327
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
328
- }
329
- #define inverseTransformDirection transformDirectionByInverseViewMatrix
330
- vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
331
- return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
332
- }
333
- vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
334
- return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
335
- }
336
- bool isPerspectiveMatrix( mat4 m ) {
337
- return m[ 2 ][ 3 ] == - 1.0;
338
- }
339
- vec2 equirectUv( in vec3 dir ) {
340
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
341
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
342
- return vec2( u, v );
343
- }
344
- vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
345
- return RECIPROCAL_PI * diffuseColor;
346
- }
347
- vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
348
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350
- }
351
- float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
352
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
353
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
354
- } // validated`,Rd=`#ifdef ENVMAP_TYPE_CUBE_UV
355
- #define cubeUV_minMipLevel 4.0
356
- #define cubeUV_minTileSize 16.0
357
- float getFace( vec3 direction ) {
358
- vec3 absDirection = abs( direction );
359
- float face = - 1.0;
360
- if ( absDirection.x > absDirection.z ) {
361
- if ( absDirection.x > absDirection.y )
362
- face = direction.x > 0.0 ? 0.0 : 3.0;
363
- else
364
- face = direction.y > 0.0 ? 1.0 : 4.0;
365
- } else {
366
- if ( absDirection.z > absDirection.y )
367
- face = direction.z > 0.0 ? 2.0 : 5.0;
368
- else
369
- face = direction.y > 0.0 ? 1.0 : 4.0;
370
- }
371
- return face;
372
- }
373
- vec2 getUV( vec3 direction, float face ) {
374
- vec2 uv;
375
- if ( face == 0.0 ) {
376
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
377
- } else if ( face == 1.0 ) {
378
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
379
- } else if ( face == 2.0 ) {
380
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
381
- } else if ( face == 3.0 ) {
382
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
383
- } else if ( face == 4.0 ) {
384
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
385
- } else {
386
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
387
- }
388
- return 0.5 * ( uv + 1.0 );
389
- }
390
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
391
- float face = getFace( direction );
392
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
393
- mipInt = max( mipInt, cubeUV_minMipLevel );
394
- float faceSize = exp2( mipInt );
395
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
396
- if ( face > 2.0 ) {
397
- uv.y += faceSize;
398
- face -= 3.0;
399
- }
400
- uv.x += face * faceSize;
401
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
402
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
403
- uv.x *= CUBEUV_TEXEL_WIDTH;
404
- uv.y *= CUBEUV_TEXEL_HEIGHT;
405
- #ifdef texture2DGradEXT
406
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
407
- #else
408
- return texture2D( envMap, uv ).rgb;
409
- #endif
410
- }
411
- #define cubeUV_r0 1.0
412
- #define cubeUV_m0 - 2.0
413
- #define cubeUV_r1 0.8
414
- #define cubeUV_m1 - 1.0
415
- #define cubeUV_r4 0.4
416
- #define cubeUV_m4 2.0
417
- #define cubeUV_r5 0.305
418
- #define cubeUV_m5 3.0
419
- #define cubeUV_r6 0.21
420
- #define cubeUV_m6 4.0
421
- float roughnessToMip( float roughness ) {
422
- float mip = 0.0;
423
- if ( roughness >= cubeUV_r1 ) {
424
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
425
- } else if ( roughness >= cubeUV_r4 ) {
426
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
427
- } else if ( roughness >= cubeUV_r5 ) {
428
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
429
- } else if ( roughness >= cubeUV_r6 ) {
430
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
431
- } else {
432
- mip = - 2.0 * log2( 1.16 * roughness ); }
433
- return mip;
434
- }
435
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
436
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
437
- float mipF = fract( mip );
438
- float mipInt = floor( mip );
439
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
440
- if ( mipF == 0.0 ) {
441
- return vec4( color0, 1.0 );
442
- } else {
443
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
444
- return vec4( mix( color0, color1, mipF ), 1.0 );
445
- }
446
- }
447
- #endif`,bd=`vec3 transformedNormal = objectNormal;
448
- #ifdef USE_TANGENT
449
- vec3 transformedTangent = objectTangent;
450
- #endif
451
- #ifdef USE_BATCHING
452
- mat3 bm = mat3( batchingMatrix );
453
- transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
454
- transformedNormal = bm * transformedNormal;
455
- #ifdef USE_TANGENT
456
- transformedTangent = bm * transformedTangent;
457
- #endif
458
- #endif
459
- #ifdef USE_INSTANCING
460
- mat3 im = mat3( instanceMatrix );
461
- transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
462
- transformedNormal = im * transformedNormal;
463
- #ifdef USE_TANGENT
464
- transformedTangent = im * transformedTangent;
465
- #endif
466
- #endif
467
- transformedNormal = normalMatrix * transformedNormal;
468
- #ifdef FLIP_SIDED
469
- transformedNormal = - transformedNormal;
470
- #endif
471
- #ifdef USE_TANGENT
472
- transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
473
- #endif`,Cd=`#ifdef USE_DISPLACEMENTMAP
474
- uniform sampler2D displacementMap;
475
- uniform float displacementScale;
476
- uniform float displacementBias;
477
- #endif`,Pd=`#ifdef USE_DISPLACEMENTMAP
478
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
479
- #endif`,Ld=`#ifdef USE_EMISSIVEMAP
480
- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
481
- #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
482
- emissiveColor = sRGBTransferEOTF( emissiveColor );
483
- #endif
484
- totalEmissiveRadiance *= emissiveColor.rgb;
485
- #endif`,Ud=`#ifdef USE_EMISSIVEMAP
486
- uniform sampler2D emissiveMap;
487
- #endif`,Dd="gl_FragColor = linearToOutputTexel( gl_FragColor );",wd=`vec4 LinearTransferOETF( in vec4 value ) {
488
- return value;
489
- }
490
- vec4 sRGBTransferEOTF( in vec4 value ) {
491
- return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
492
- }
493
- vec4 sRGBTransferOETF( in vec4 value ) {
494
- return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
495
- }`,Id=`#ifdef USE_ENVMAP
496
- #ifdef ENV_WORLDPOS
497
- vec3 cameraToFrag;
498
- if ( isOrthographic ) {
499
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
500
- } else {
501
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
502
- }
503
- vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
504
- #ifdef ENVMAP_MODE_REFLECTION
505
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
506
- #else
507
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
508
- #endif
509
- #else
510
- vec3 reflectVec = vReflect;
511
- #endif
512
- #ifdef ENVMAP_TYPE_CUBE
513
- vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
514
- #ifdef ENVMAP_BLENDING_MULTIPLY
515
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
516
- #elif defined( ENVMAP_BLENDING_MIX )
517
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
518
- #elif defined( ENVMAP_BLENDING_ADD )
519
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
520
- #endif
521
- #endif
522
- #endif`,Nd=`#ifdef USE_ENVMAP
523
- uniform float envMapIntensity;
524
- uniform mat3 envMapRotation;
525
- #ifdef ENVMAP_TYPE_CUBE
526
- uniform samplerCube envMap;
527
- #else
528
- uniform sampler2D envMap;
529
- #endif
530
- #endif`,yd=`#ifdef USE_ENVMAP
531
- uniform float reflectivity;
532
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
533
- #define ENV_WORLDPOS
534
- #endif
535
- #ifdef ENV_WORLDPOS
536
- varying vec3 vWorldPosition;
537
- uniform float refractionRatio;
538
- #else
539
- varying vec3 vReflect;
540
- #endif
541
- #endif`,Fd=`#ifdef USE_ENVMAP
542
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
543
- #define ENV_WORLDPOS
544
- #endif
545
- #ifdef ENV_WORLDPOS
546
-
547
- varying vec3 vWorldPosition;
548
- #else
549
- varying vec3 vReflect;
550
- uniform float refractionRatio;
551
- #endif
552
- #endif`,Od=`#ifdef USE_ENVMAP
553
- #ifdef ENV_WORLDPOS
554
- vWorldPosition = worldPosition.xyz;
555
- #else
556
- vec3 cameraToVertex;
557
- if ( isOrthographic ) {
558
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
559
- } else {
560
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
561
- }
562
- vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
563
- #ifdef ENVMAP_MODE_REFLECTION
564
- vReflect = reflect( cameraToVertex, worldNormal );
565
- #else
566
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
567
- #endif
568
- #endif
569
- #endif`,Bd=`#ifdef USE_FOG
570
- vFogDepth = - mvPosition.z;
571
- #endif`,Gd=`#ifdef USE_FOG
572
- varying float vFogDepth;
573
- #endif`,Hd=`#ifdef USE_FOG
574
- #ifdef FOG_EXP2
575
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
576
- #else
577
- float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
578
- #endif
579
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
580
- #endif`,Vd=`#ifdef USE_FOG
581
- uniform vec3 fogColor;
582
- varying float vFogDepth;
583
- #ifdef FOG_EXP2
584
- uniform float fogDensity;
585
- #else
586
- uniform float fogNear;
587
- uniform float fogFar;
588
- #endif
589
- #endif`,Wd=`#ifdef USE_GRADIENTMAP
590
- uniform sampler2D gradientMap;
591
- #endif
592
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
593
- float dotNL = dot( normal, lightDirection );
594
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
595
- #ifdef USE_GRADIENTMAP
596
- return vec3( texture2D( gradientMap, coord ).r );
597
- #else
598
- vec2 fw = fwidth( coord ) * 0.5;
599
- return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
600
- #endif
601
- }`,kd=`#ifdef USE_LIGHTMAP
602
- uniform sampler2D lightMap;
603
- uniform float lightMapIntensity;
604
- #endif`,zd=`LambertMaterial material;
605
- material.diffuseColor = diffuseColor.rgb;
606
- material.specularStrength = specularStrength;`,Xd=`varying vec3 vViewPosition;
607
- struct LambertMaterial {
608
- vec3 diffuseColor;
609
- float specularStrength;
610
- };
611
- void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
612
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
613
- vec3 irradiance = dotNL * directLight.color;
614
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
615
- }
616
- void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
617
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
618
- }
619
- #define RE_Direct RE_Direct_Lambert
620
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Kd=`uniform bool receiveShadow;
621
- uniform vec3 ambientLightColor;
622
- #if defined( USE_LIGHT_PROBES )
623
- uniform vec3 lightProbe[ 9 ];
624
- #endif
625
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
626
- float x = normal.x, y = normal.y, z = normal.z;
627
- vec3 result = shCoefficients[ 0 ] * 0.886227;
628
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
629
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
630
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
631
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
632
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
633
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
634
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
635
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
636
- return result;
637
- }
638
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
639
- vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
640
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
641
- return irradiance;
642
- }
643
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
644
- vec3 irradiance = ambientLightColor;
645
- return irradiance;
646
- }
647
- float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
648
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
649
- if ( cutoffDistance > 0.0 ) {
650
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
651
- }
652
- return distanceFalloff;
653
- }
654
- float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
655
- return smoothstep( coneCosine, penumbraCosine, angleCosine );
656
- }
657
- #if NUM_SUN_LIGHTS > 0
658
- struct SunLight {
659
- vec3 direction;
660
- vec3 color;
661
- };
662
- uniform SunLight sunLights[ NUM_SUN_LIGHTS ];
663
- void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {
664
- light.color = sunLight.color;
665
- light.direction = sunLight.direction;
666
- light.visible = true;
667
- }
668
- #endif
669
- #if NUM_DIR_LIGHTS > 0
670
- struct DirectionalLight {
671
- vec3 direction;
672
- vec3 color;
673
- };
674
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
675
- void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
676
- light.color = directionalLight.color;
677
- light.direction = directionalLight.direction;
678
- light.visible = true;
679
- }
680
- #endif
681
- #if NUM_POINT_LIGHTS > 0
682
- struct PointLight {
683
- vec3 position;
684
- vec3 color;
685
- float distance;
686
- float decay;
687
- };
688
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
689
- void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
690
- vec3 lVector = pointLight.position - geometryPosition;
691
- light.direction = normalize( lVector );
692
- float lightDistance = length( lVector );
693
- light.color = pointLight.color;
694
- light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
695
- light.visible = ( light.color != vec3( 0.0 ) );
696
- }
697
- #endif
698
- #if NUM_SPOT_LIGHTS > 0
699
- struct SpotLight {
700
- vec3 position;
701
- vec3 direction;
702
- vec3 color;
703
- float distance;
704
- float decay;
705
- float coneCos;
706
- float penumbraCos;
707
- };
708
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
709
- void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
710
- vec3 lVector = spotLight.position - geometryPosition;
711
- light.direction = normalize( lVector );
712
- float angleCos = dot( light.direction, spotLight.direction );
713
- float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
714
- if ( spotAttenuation > 0.0 ) {
715
- float lightDistance = length( lVector );
716
- light.color = spotLight.color * spotAttenuation;
717
- light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
718
- light.visible = ( light.color != vec3( 0.0 ) );
719
- } else {
720
- light.color = vec3( 0.0 );
721
- light.visible = false;
722
- }
723
- }
724
- #endif
725
- #if NUM_RECT_AREA_LIGHTS > 0
726
- struct RectAreaLight {
727
- vec3 color;
728
- vec3 position;
729
- vec3 halfWidth;
730
- vec3 halfHeight;
731
- };
732
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
733
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
734
- #endif
735
- #if NUM_HEMI_LIGHTS > 0
736
- struct HemisphereLight {
737
- vec3 direction;
738
- vec3 skyColor;
739
- vec3 groundColor;
740
- };
741
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
742
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
743
- float dotNL = dot( normal, hemiLight.direction );
744
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
745
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
746
- return irradiance;
747
- }
748
- #endif
749
- #include <lightprobes_pars_fragment>`,Yd=`#ifdef USE_ENVMAP
750
- vec3 getIBLIrradiance( const in vec3 normal ) {
751
- #ifdef ENVMAP_TYPE_CUBE_UV
752
- vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
753
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
754
- return PI * envMapColor.rgb * envMapIntensity;
755
- #else
756
- return vec3( 0.0 );
757
- #endif
758
- }
759
- vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
760
- #ifdef ENVMAP_TYPE_CUBE_UV
761
- vec3 reflectVec = reflect( - viewDir, normal );
762
- reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
763
- reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
764
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
765
- return envMapColor.rgb * envMapIntensity;
766
- #else
767
- return vec3( 0.0 );
768
- #endif
769
- }
770
- #ifdef USE_RETROREFLECTION
771
- vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
772
- #ifdef ENVMAP_TYPE_CUBE_UV
773
- vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
774
- retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
775
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );
776
- return envMapColor.rgb * envMapIntensity;
777
- #else
778
- return vec3( 0.0 );
779
- #endif
780
- }
781
- #endif
782
- #ifdef USE_ANISOTROPY
783
- vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
784
- #ifdef ENVMAP_TYPE_CUBE_UV
785
- vec3 bentNormal = cross( bitangent, viewDir );
786
- bentNormal = normalize( cross( bentNormal, bitangent ) );
787
- bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
788
- return getIBLRadiance( viewDir, bentNormal, roughness );
789
- #else
790
- return vec3( 0.0 );
791
- #endif
792
- }
793
- #ifdef USE_RETROREFLECTION
794
- vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
795
- #ifdef ENVMAP_TYPE_CUBE_UV
796
- vec3 bentNormal = cross( bitangent, viewDir );
797
- bentNormal = normalize( cross( bentNormal, bitangent ) );
798
- bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
799
- return getIBLRetroRadiance( viewDir, bentNormal, roughness );
800
- #else
801
- return vec3( 0.0 );
802
- #endif
803
- }
804
- #endif
805
- #endif
806
- #endif`,qd=`ToonMaterial material;
807
- material.diffuseColor = diffuseColor.rgb;`,Zd=`varying vec3 vViewPosition;
808
- struct ToonMaterial {
809
- vec3 diffuseColor;
810
- };
811
- void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
812
- vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
813
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
814
- }
815
- void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
816
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
817
- }
818
- #define RE_Direct RE_Direct_Toon
819
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,$d=`BlinnPhongMaterial material;
820
- material.diffuseColor = diffuseColor.rgb;
821
- material.specularColor = specular;
822
- material.specularShininess = shininess;
823
- material.specularStrength = specularStrength;`,Qd=`varying vec3 vViewPosition;
824
- struct BlinnPhongMaterial {
825
- vec3 diffuseColor;
826
- vec3 specularColor;
827
- float specularShininess;
828
- float specularStrength;
829
- };
830
- void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
831
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
832
- vec3 irradiance = dotNL * directLight.color;
833
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
834
- reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
835
- }
836
- void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
837
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
838
- }
839
- #define RE_Direct RE_Direct_BlinnPhong
840
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Jd=`PhysicalMaterial material;
841
- material.diffuseColor = diffuseColor.rgb;
842
- material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
843
- material.metalness = metalnessFactor;
844
- vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
845
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
846
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
847
- material.roughness = min( material.roughness, 1.0 );
848
- #ifdef IOR
849
- material.ior = ior;
850
- #ifdef USE_SPECULAR
851
- float specularIntensityFactor = specularIntensity;
852
- vec3 specularColorFactor = specularColor;
853
- #ifdef USE_SPECULAR_COLORMAP
854
- specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
855
- #endif
856
- #ifdef USE_SPECULAR_INTENSITYMAP
857
- specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
858
- #endif
859
- material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
860
- #else
861
- float specularIntensityFactor = 1.0;
862
- vec3 specularColorFactor = vec3( 1.0 );
863
- material.specularF90 = 1.0;
864
- #endif
865
- material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
866
- material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
867
- #else
868
- material.specularColor = vec3( 0.04 );
869
- material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
870
- material.specularF90 = 1.0;
871
- #endif
872
- #ifdef USE_CLEARCOAT
873
- material.clearcoat = clearcoat;
874
- material.clearcoatRoughness = clearcoatRoughness;
875
- material.clearcoatF0 = vec3( 0.04 );
876
- material.clearcoatF90 = 1.0;
877
- #ifdef USE_CLEARCOATMAP
878
- material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
879
- #endif
880
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
881
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
882
- #endif
883
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
884
- material.clearcoatRoughness += geometryRoughness;
885
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
886
- #endif
887
- #ifdef USE_DISPERSION
888
- material.dispersion = dispersion;
889
- #endif
890
- #ifdef USE_RETROREFLECTION
891
- material.retroreflectivity = retroreflectivity;
892
- #endif
893
- #ifdef USE_IRIDESCENCE
894
- material.iridescence = iridescence;
895
- material.iridescenceIOR = iridescenceIOR;
896
- #ifdef USE_IRIDESCENCEMAP
897
- material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
898
- #endif
899
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
900
- material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
901
- #else
902
- material.iridescenceThickness = iridescenceThicknessMaximum;
903
- #endif
904
- #endif
905
- #ifdef USE_SHEEN
906
- material.sheenColor = sheenColor;
907
- #ifdef USE_SHEEN_COLORMAP
908
- material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
909
- #endif
910
- material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
911
- #ifdef USE_SHEEN_ROUGHNESSMAP
912
- material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
913
- #endif
914
- #endif
915
- #ifdef USE_ANISOTROPY
916
- #ifdef USE_ANISOTROPYMAP
917
- mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
918
- vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
919
- vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
920
- #else
921
- vec2 anisotropyV = anisotropyVector;
922
- #endif
923
- material.anisotropy = length( anisotropyV );
924
- if( material.anisotropy == 0.0 ) {
925
- anisotropyV = vec2( 1.0, 0.0 );
926
- } else {
927
- anisotropyV /= material.anisotropy;
928
- material.anisotropy = saturate( material.anisotropy );
929
- }
930
- material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
931
- material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
932
- material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
933
- #endif`,jd=`uniform sampler2D dfgLUT;
934
- struct PhysicalMaterial {
935
- vec3 diffuseColor;
936
- vec3 diffuseContribution;
937
- vec3 specularColor;
938
- vec3 specularColorBlended;
939
- float roughness;
940
- float metalness;
941
- float specularF90;
942
- float dispersion;
943
- vec2 dfg;
944
- vec3 multiScatteringCompensation;
945
- #ifdef USE_RETROREFLECTION
946
- float retroreflectivity;
947
- #endif
948
- #ifdef USE_CLEARCOAT
949
- float clearcoat;
950
- float clearcoatRoughness;
951
- vec3 clearcoatF0;
952
- float clearcoatF90;
953
- #endif
954
- #ifdef USE_IRIDESCENCE
955
- float iridescence;
956
- float iridescenceIOR;
957
- float iridescenceThickness;
958
- vec3 iridescenceFresnel;
959
- vec3 iridescenceF0Dielectric;
960
- vec3 iridescenceF0Metallic;
961
- #endif
962
- #ifdef USE_SHEEN
963
- vec3 sheenColor;
964
- float sheenRoughness;
965
- #endif
966
- #ifdef IOR
967
- float ior;
968
- #endif
969
- #ifdef USE_TRANSMISSION
970
- float transmission;
971
- float transmissionAlpha;
972
- float thickness;
973
- float attenuationDistance;
974
- vec3 attenuationColor;
975
- #endif
976
- #ifdef USE_ANISOTROPY
977
- float anisotropy;
978
- float alphaT;
979
- vec3 anisotropyT;
980
- vec3 anisotropyB;
981
- #endif
982
- };
983
- vec3 clearcoatSpecularDirect = vec3( 0.0 );
984
- vec3 clearcoatSpecularIndirect = vec3( 0.0 );
985
- vec3 sheenSpecularDirect = vec3( 0.0 );
986
- vec3 sheenSpecularIndirect = vec3(0.0 );
987
- vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
988
- float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
989
- float x2 = x * x;
990
- float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
991
- return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
992
- }
993
- float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
994
- float a2 = pow2( alpha );
995
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
996
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
997
- return 0.5 / max( gv + gl, EPSILON );
998
- }
999
- float D_GGX( const in float alpha, const in float dotNH ) {
1000
- float a2 = pow2( alpha );
1001
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1002
- return RECIPROCAL_PI * a2 / pow2( denom );
1003
- }
1004
- #ifdef USE_ANISOTROPY
1005
- float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1006
- float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1007
- float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1008
- return 0.5 / max( gv + gl, EPSILON );
1009
- }
1010
- float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1011
- float a2 = alphaT * alphaB;
1012
- highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1013
- highp float v2 = dot( v, v );
1014
- float w2 = a2 / v2;
1015
- return RECIPROCAL_PI * a2 * pow2 ( w2 );
1016
- }
1017
- #endif
1018
- #ifdef USE_CLEARCOAT
1019
- vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1020
- vec3 f0 = material.clearcoatF0;
1021
- float f90 = material.clearcoatF90;
1022
- float roughness = material.clearcoatRoughness;
1023
- float alpha = pow2( roughness );
1024
- vec3 halfDir = normalize( lightDir + viewDir );
1025
- float dotNL = saturate( dot( normal, lightDir ) );
1026
- float dotNV = saturate( dot( normal, viewDir ) );
1027
- float dotNH = saturate( dot( normal, halfDir ) );
1028
- float dotVH = saturate( dot( viewDir, halfDir ) );
1029
- vec3 F = F_Schlick( f0, f90, dotVH );
1030
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1031
- float D = D_GGX( alpha, dotNH );
1032
- return F * ( V * D );
1033
- }
1034
- #endif
1035
- vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1036
- vec3 f0 = material.specularColorBlended;
1037
- float f90 = material.specularF90;
1038
- float roughness = material.roughness;
1039
- float alpha = pow2( roughness );
1040
- vec3 halfDir = normalize( lightDir + viewDir );
1041
- float dotNL = saturate( dot( normal, lightDir ) );
1042
- float dotNV = saturate( dot( normal, viewDir ) );
1043
- float dotNH = saturate( dot( normal, halfDir ) );
1044
- float dotVH = saturate( dot( viewDir, halfDir ) );
1045
- vec3 F = F_Schlick( f0, f90, dotVH );
1046
- #ifdef USE_IRIDESCENCE
1047
- F = mix( F, material.iridescenceFresnel, material.iridescence );
1048
- #endif
1049
- #ifdef USE_ANISOTROPY
1050
- float dotTL = dot( material.anisotropyT, lightDir );
1051
- float dotTV = dot( material.anisotropyT, viewDir );
1052
- float dotTH = dot( material.anisotropyT, halfDir );
1053
- float dotBL = dot( material.anisotropyB, lightDir );
1054
- float dotBV = dot( material.anisotropyB, viewDir );
1055
- float dotBH = dot( material.anisotropyB, halfDir );
1056
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1057
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1058
- #else
1059
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1060
- float D = D_GGX( alpha, dotNH );
1061
- #endif
1062
- return F * ( V * D );
1063
- }
1064
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1065
- const float LUT_SIZE = 64.0;
1066
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1067
- const float LUT_BIAS = 0.5 / LUT_SIZE;
1068
- float dotNV = saturate( dot( N, V ) );
1069
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1070
- uv = uv * LUT_SCALE + LUT_BIAS;
1071
- return uv;
1072
- }
1073
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1074
- float l = length( f );
1075
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1076
- }
1077
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1078
- float x = dot( v1, v2 );
1079
- float y = abs( x );
1080
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1081
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
1082
- float v = a / b;
1083
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1084
- return cross( v1, v2 ) * theta_sintheta;
1085
- }
1086
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1087
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1088
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1089
- vec3 lightNormal = cross( v1, v2 );
1090
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1091
- vec3 T1, T2;
1092
- T1 = normalize( V - N * dot( V, N ) );
1093
- T2 = - cross( N, T1 );
1094
- mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1095
- vec3 coords[ 4 ];
1096
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1097
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1098
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1099
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1100
- coords[ 0 ] = normalize( coords[ 0 ] );
1101
- coords[ 1 ] = normalize( coords[ 1 ] );
1102
- coords[ 2 ] = normalize( coords[ 2 ] );
1103
- coords[ 3 ] = normalize( coords[ 3 ] );
1104
- vec3 vectorFormFactor = vec3( 0.0 );
1105
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1106
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1107
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1108
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1109
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1110
- return vec3( result );
1111
- }
1112
- #if defined( USE_SHEEN )
1113
- float D_Charlie( float roughness, float dotNH ) {
1114
- float alpha = pow2( roughness );
1115
- float invAlpha = 1.0 / alpha;
1116
- float cos2h = dotNH * dotNH;
1117
- float sin2h = max( 1.0 - cos2h, 0.0078125 );
1118
- return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1119
- }
1120
- float V_Neubelt( float dotNV, float dotNL ) {
1121
- return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1122
- }
1123
- vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1124
- vec3 halfDir = normalize( lightDir + viewDir );
1125
- float dotNL = saturate( dot( normal, lightDir ) );
1126
- float dotNV = saturate( dot( normal, viewDir ) );
1127
- float dotNH = saturate( dot( normal, halfDir ) );
1128
- float D = D_Charlie( sheenRoughness, dotNH );
1129
- float V = V_Neubelt( dotNV, dotNL );
1130
- return sheenColor * ( D * V );
1131
- }
1132
- #endif
1133
- float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1134
- float dotNV = saturate( dot( normal, viewDir ) );
1135
- float r2 = roughness * roughness;
1136
- float rInv = 1.0 / ( roughness + 0.1 );
1137
- float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1138
- float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1139
- float DG = exp( a * dotNV + b );
1140
- return saturate( DG );
1141
- }
1142
- vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1143
- float dotNV = saturate( dot( normal, viewDir ) );
1144
- vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1145
- return specularColor * fab.x + specularF90 * fab.y;
1146
- }
1147
- #ifdef USE_IRIDESCENCE
1148
- void computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {
1149
- #else
1150
- void computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {
1151
- #endif
1152
- #ifdef USE_IRIDESCENCE
1153
- vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1154
- #else
1155
- vec3 Fr = specularColor;
1156
- #endif
1157
- vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1158
- float Ess = fab.x + fab.y;
1159
- float Ems = 1.0 - Ess;
1160
- vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1161
- singleScatter += FssEss;
1162
- multiScatter += Fms * Ems;
1163
- }
1164
- #if NUM_RECT_AREA_LIGHTS > 0
1165
- void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1166
- vec3 normal = geometryNormal;
1167
- vec3 viewDir = geometryViewDir;
1168
- vec3 position = geometryPosition;
1169
- vec3 lightPos = rectAreaLight.position;
1170
- vec3 halfWidth = rectAreaLight.halfWidth;
1171
- vec3 halfHeight = rectAreaLight.halfHeight;
1172
- vec3 lightColor = rectAreaLight.color;
1173
- float roughness = material.roughness;
1174
- vec3 rectCoords[ 4 ];
1175
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1176
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1177
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1178
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
1179
- vec4 t1 = texture2D( ltc_1, uv );
1180
- vec4 t2 = texture2D( ltc_2, uv );
1181
- mat3 mInv = mat3(
1182
- vec3( t1.x, 0, t1.y ),
1183
- vec3( 0, 1, 0 ),
1184
- vec3( t1.z, 0, t1.w )
1185
- );
1186
- vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1187
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1188
- reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1189
- #ifdef USE_CLEARCOAT
1190
- vec3 Ncc = geometryClearcoatNormal;
1191
- vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1192
- vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1193
- vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1194
- mat3 mInvClearcoat = mat3(
1195
- vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1196
- vec3( 0, 1, 0 ),
1197
- vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1198
- );
1199
- vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1200
- clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1201
- #endif
1202
- }
1203
- #endif
1204
- void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1205
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1206
- vec3 irradiance = dotNL * directLight.color;
1207
- #ifdef USE_CLEARCOAT
1208
- float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1209
- vec3 ccIrradiance = dotNLcc * directLight.color;
1210
- clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1211
- #endif
1212
- #ifdef USE_SHEEN
1213
-
1214
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1215
-
1216
- float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1217
- float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1218
-
1219
- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1220
-
1221
- irradiance *= sheenEnergyComp;
1222
-
1223
- #endif
1224
- vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1225
- #ifdef USE_RETROREFLECTION
1226
- vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );
1227
- vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );
1228
- specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );
1229
- #endif
1230
- reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;
1231
- vec3 halfDir = normalize( directLight.direction + geometryViewDir );
1232
- float dotVH = saturate( dot( geometryViewDir, halfDir ) );
1233
- vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );
1234
- #ifdef USE_RETROREFLECTION
1235
- vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );
1236
- float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );
1237
- vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
1238
- F = mix( F, retroF, saturate( material.retroreflectivity ) );
1239
- #endif
1240
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );
1241
- }
1242
- void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1243
- vec3 singleScattering = vec3( 0.0 );
1244
- vec3 multiScattering = vec3( 0.0 );
1245
- #ifdef USE_IRIDESCENCE
1246
- computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );
1247
- #else
1248
- computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
1249
- #endif
1250
- vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
1251
- #ifdef USE_SHEEN
1252
- float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1253
- sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
1254
- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1255
- diffuse *= sheenEnergyComp;
1256
- #endif
1257
- reflectedLight.indirectDiffuse += diffuse;
1258
- }
1259
- void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1260
- #ifdef USE_CLEARCOAT
1261
- clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1262
- #endif
1263
- #ifdef USE_SHEEN
1264
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1265
- #endif
1266
- vec3 singleScatteringDielectric = vec3( 0.0 );
1267
- vec3 multiScatteringDielectric = vec3( 0.0 );
1268
- vec3 singleScatteringMetallic = vec3( 0.0 );
1269
- vec3 multiScatteringMetallic = vec3( 0.0 );
1270
- #ifdef USE_IRIDESCENCE
1271
- computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );
1272
- computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );
1273
- #else
1274
- computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );
1275
- computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );
1276
- #endif
1277
- vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1278
- vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1279
- vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1280
- vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1281
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1282
- vec3 indirectSpecular = radiance * singleScattering;
1283
- indirectSpecular += multiScattering * cosineWeightedIrradiance;
1284
- vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1285
- #ifdef USE_SHEEN
1286
- float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1287
- float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1288
- indirectSpecular *= sheenEnergyComp;
1289
- indirectDiffuse *= sheenEnergyComp;
1290
- #endif
1291
- reflectedLight.indirectSpecular += indirectSpecular;
1292
- reflectedLight.indirectDiffuse += indirectDiffuse;
1293
- }
1294
- #define RE_Direct RE_Direct_Physical
1295
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
1296
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
1297
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1298
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1299
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1300
- }`,eu=`
1301
- vec3 geometryPosition = - vViewPosition;
1302
- vec3 geometryNormal = normal;
1303
- vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1304
- vec3 geometryClearcoatNormal = vec3( 0.0 );
1305
- #ifdef USE_CLEARCOAT
1306
- geometryClearcoatNormal = clearcoatNormal;
1307
- #endif
1308
- #ifdef USE_IRIDESCENCE
1309
- float dotNVi = saturate( dot( normal, geometryViewDir ) );
1310
- if ( material.iridescenceThickness == 0.0 ) {
1311
- material.iridescence = 0.0;
1312
- } else {
1313
- material.iridescence = saturate( material.iridescence );
1314
- }
1315
- if ( material.iridescence > 0.0 ) {
1316
- vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1317
- vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1318
- material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );
1319
- material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );
1320
- material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );
1321
- }
1322
- #endif
1323
- #ifdef STANDARD
1324
- float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );
1325
- material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;
1326
- #if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )
1327
- float EssMs = material.dfg.x + material.dfg.y;
1328
- material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );
1329
- #endif
1330
- #endif
1331
- IncidentLight directLight;
1332
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1333
- PointLight pointLight;
1334
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1335
- PointLightShadow pointLightShadow;
1336
- #endif
1337
- #pragma unroll_loop_start
1338
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1339
- pointLight = pointLights[ i ];
1340
- getPointLightInfo( pointLight, geometryPosition, directLight );
1341
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1342
- pointLightShadow = pointLightShadows[ i ];
1343
- directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1344
- #endif
1345
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1346
- }
1347
- #pragma unroll_loop_end
1348
- #endif
1349
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1350
- SpotLight spotLight;
1351
- vec4 spotColor;
1352
- vec3 spotLightCoord;
1353
- bool inSpotLightMap;
1354
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1355
- SpotLightShadow spotLightShadow;
1356
- #endif
1357
- #pragma unroll_loop_start
1358
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1359
- spotLight = spotLights[ i ];
1360
- getSpotLightInfo( spotLight, geometryPosition, directLight );
1361
- #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1362
- #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1363
- #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1364
- #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1365
- #else
1366
- #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1367
- #endif
1368
- #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1369
- spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1370
- inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1371
- spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1372
- directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1373
- #endif
1374
- #undef SPOT_LIGHT_MAP_INDEX
1375
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1376
- spotLightShadow = spotLightShadows[ i ];
1377
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1378
- #endif
1379
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1380
- }
1381
- #pragma unroll_loop_end
1382
- #endif
1383
- #if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )
1384
- SunLight sunLight;
1385
- #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0
1386
- SunLightShadow sunLightShadow;
1387
- #endif
1388
- #pragma unroll_loop_start
1389
- for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {
1390
- sunLight = sunLights[ i ];
1391
- getSunLightInfo( sunLight, directLight );
1392
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )
1393
- sunLightShadow = sunLightShadows[ i ];
1394
- directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;
1395
- #endif
1396
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1397
- }
1398
- #pragma unroll_loop_end
1399
- #endif
1400
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1401
- DirectionalLight directionalLight;
1402
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1403
- DirectionalLightShadow directionalLightShadow;
1404
- #endif
1405
- #pragma unroll_loop_start
1406
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1407
- directionalLight = directionalLights[ i ];
1408
- getDirectionalLightInfo( directionalLight, directLight );
1409
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1410
- directionalLightShadow = directionalLightShadows[ i ];
1411
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1412
- #endif
1413
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1414
- }
1415
- #pragma unroll_loop_end
1416
- #endif
1417
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1418
- RectAreaLight rectAreaLight;
1419
- #pragma unroll_loop_start
1420
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1421
- rectAreaLight = rectAreaLights[ i ];
1422
- RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1423
- }
1424
- #pragma unroll_loop_end
1425
- #endif
1426
- #if defined( RE_IndirectDiffuse )
1427
- vec3 iblIrradiance = vec3( 0.0 );
1428
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1429
- #if defined( USE_LIGHT_PROBES )
1430
- irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1431
- #endif
1432
- #if ( NUM_HEMI_LIGHTS > 0 )
1433
- #pragma unroll_loop_start
1434
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1435
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1436
- }
1437
- #pragma unroll_loop_end
1438
- #endif
1439
- #ifdef USE_LIGHT_PROBES_GRID
1440
- vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1441
- vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1442
- irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1443
- #endif
1444
- #endif
1445
- #if defined( RE_IndirectSpecular )
1446
- vec3 radiance = vec3( 0.0 );
1447
- vec3 clearcoatRadiance = vec3( 0.0 );
1448
- #endif`,tu=`#if defined( RE_IndirectDiffuse )
1449
- #ifdef USE_LIGHTMAP
1450
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1451
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1452
- irradiance += lightMapIrradiance;
1453
- #endif
1454
- #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1455
- #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1456
- iblIrradiance += getIBLIrradiance( geometryNormal );
1457
- #endif
1458
- #endif
1459
- #endif
1460
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1461
- #ifdef USE_ANISOTROPY
1462
- vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1463
- #else
1464
- vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1465
- #endif
1466
- #ifdef USE_RETROREFLECTION
1467
- #ifdef USE_ANISOTROPY
1468
- vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1469
- #else
1470
- vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );
1471
- #endif
1472
- iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );
1473
- #endif
1474
- radiance += iblRadiance;
1475
- #ifdef USE_CLEARCOAT
1476
- clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1477
- #endif
1478
- #endif`,nu=`#if defined( RE_IndirectDiffuse )
1479
- #if defined( LAMBERT ) || defined( PHONG )
1480
- irradiance += iblIrradiance;
1481
- #endif
1482
- RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1483
- #endif
1484
- #if defined( RE_IndirectSpecular )
1485
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1486
- #endif`,iu=`#ifdef USE_LIGHT_PROBES_GRID
1487
- uniform highp sampler3D probesSH;
1488
- uniform vec3 probesMin;
1489
- uniform vec3 probesMax;
1490
- uniform vec3 probesResolution;
1491
- vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1492
- vec3 res = probesResolution;
1493
- vec3 gridRange = probesMax - probesMin;
1494
- vec3 resMinusOne = res - 1.0;
1495
- vec3 probeSpacing = gridRange / resMinusOne;
1496
- vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1497
- vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1498
- uvw = uvw * resMinusOne / res + 0.5 / res;
1499
- float nz = res.z;
1500
- float paddedSlices = nz + 2.0;
1501
- float atlasDepth = 7.0 * paddedSlices;
1502
- float uvZBase = uvw.z * nz + 1.0;
1503
- vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );
1504
- vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
1505
- vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
1506
- vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
1507
- vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
1508
- vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
1509
- vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
1510
- vec3 c0 = s0.xyz;
1511
- vec3 c1 = vec3( s0.w, s1.xy );
1512
- vec3 c2 = vec3( s1.zw, s2.x );
1513
- vec3 c3 = s2.yzw;
1514
- vec3 c4 = s3.xyz;
1515
- vec3 c5 = vec3( s3.w, s4.xy );
1516
- vec3 c6 = vec3( s4.zw, s5.x );
1517
- vec3 c7 = s5.yzw;
1518
- vec3 c8 = s6.xyz;
1519
- float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1520
- vec3 result = c0 * 0.886227;
1521
- result += c1 * 2.0 * 0.511664 * y;
1522
- result += c2 * 2.0 * 0.511664 * z;
1523
- result += c3 * 2.0 * 0.511664 * x;
1524
- result += c4 * 2.0 * 0.429043 * x * y;
1525
- result += c5 * 2.0 * 0.429043 * y * z;
1526
- result += c6 * ( 0.743125 * z * z - 0.247708 );
1527
- result += c7 * 2.0 * 0.429043 * x * z;
1528
- result += c8 * 0.429043 * ( x * x - y * y );
1529
- return max( result, vec3( 0.0 ) );
1530
- }
1531
- #endif`,ru=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1532
- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1533
- #endif`,au=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1534
- uniform float logDepthBufFC;
1535
- varying float vFragDepth;
1536
- varying float vIsPerspective;
1537
- #endif`,ou=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1538
- varying float vFragDepth;
1539
- varying float vIsPerspective;
1540
- #endif`,su=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1541
- vFragDepth = 1.0 + gl_Position.w;
1542
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1543
- #endif`,lu=`#ifdef USE_MAP
1544
- vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1545
- #ifdef DECODE_VIDEO_TEXTURE
1546
- sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1547
- #endif
1548
- diffuseColor *= sampledDiffuseColor;
1549
- #endif`,cu=`#ifdef USE_MAP
1550
- uniform sampler2D map;
1551
- #endif`,fu=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1552
- #if defined( USE_POINTS_UV )
1553
- vec2 uv = vUv;
1554
- #else
1555
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1556
- #endif
1557
- #endif
1558
- #ifdef USE_MAP
1559
- diffuseColor *= texture2D( map, uv );
1560
- #endif
1561
- #ifdef USE_ALPHAMAP
1562
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
1563
- #endif`,du=`#if defined( USE_POINTS_UV )
1564
- varying vec2 vUv;
1565
- #else
1566
- #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1567
- uniform mat3 uvTransform;
1568
- #endif
1569
- #endif
1570
- #ifdef USE_MAP
1571
- uniform sampler2D map;
1572
- #endif
1573
- #ifdef USE_ALPHAMAP
1574
- uniform sampler2D alphaMap;
1575
- #endif`,uu=`float metalnessFactor = metalness;
1576
- #ifdef USE_METALNESSMAP
1577
- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1578
- metalnessFactor *= texelMetalness.b;
1579
- #endif`,pu=`#ifdef USE_METALNESSMAP
1580
- uniform sampler2D metalnessMap;
1581
- #endif`,hu=`#ifdef USE_INSTANCING_MORPH
1582
- float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1583
- float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1584
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1585
- morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1586
- }
1587
- #endif`,mu=`#if defined( USE_MORPHCOLORS )
1588
- vColor *= morphTargetBaseInfluence;
1589
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1590
- #if defined( USE_COLOR_ALPHA )
1591
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1592
- #elif defined( USE_COLOR )
1593
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1594
- #endif
1595
- }
1596
- #endif`,_u=`#ifdef USE_MORPHNORMALS
1597
- objectNormal *= morphTargetBaseInfluence;
1598
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1599
- if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1600
- }
1601
- #endif`,gu=`#ifdef USE_MORPHTARGETS
1602
- #ifndef USE_INSTANCING_MORPH
1603
- uniform float morphTargetBaseInfluence;
1604
- uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1605
- #endif
1606
- uniform sampler2DArray morphTargetsTexture;
1607
- uniform ivec2 morphTargetsTextureSize;
1608
- vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1609
- int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1610
- int y = texelIndex / morphTargetsTextureSize.x;
1611
- int x = texelIndex - y * morphTargetsTextureSize.x;
1612
- ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1613
- return texelFetch( morphTargetsTexture, morphUV, 0 );
1614
- }
1615
- #endif`,vu=`#ifdef USE_MORPHTARGETS
1616
- transformed *= morphTargetBaseInfluence;
1617
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1618
- if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1619
- }
1620
- #endif`,Su=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1621
- #ifdef FLAT_SHADED
1622
- vec3 fdx = dFdx( vViewPosition );
1623
- vec3 fdy = dFdy( vViewPosition );
1624
- vec3 normal = normalize( cross( fdx, fdy ) );
1625
- #else
1626
- vec3 normal = normalize( vNormal );
1627
- #ifdef DOUBLE_SIDED
1628
- normal *= faceDirection;
1629
- #endif
1630
- #endif
1631
- #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1632
- #ifdef USE_TANGENT
1633
- mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1634
- #else
1635
- mat3 tbn = getTangentFrame( - vViewPosition, normal,
1636
- #if defined( USE_NORMALMAP )
1637
- vNormalMapUv
1638
- #elif defined( USE_CLEARCOAT_NORMALMAP )
1639
- vClearcoatNormalMapUv
1640
- #else
1641
- vUv
1642
- #endif
1643
- );
1644
- #endif
1645
- #ifdef DOUBLE_SIDED
1646
- tbn[0] *= faceDirection;
1647
- tbn[1] *= faceDirection;
1648
- #endif
1649
- #endif
1650
- #ifdef USE_CLEARCOAT_NORMALMAP
1651
- #ifdef USE_TANGENT
1652
- mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1653
- #else
1654
- mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1655
- #endif
1656
- #ifdef DOUBLE_SIDED
1657
- tbn2[0] *= faceDirection;
1658
- tbn2[1] *= faceDirection;
1659
- #endif
1660
- #endif
1661
- vec3 nonPerturbedNormal = normal;`,Eu=`#ifdef USE_NORMALMAP_OBJECTSPACE
1662
- normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1663
- #ifdef FLIP_SIDED
1664
- normal = - normal;
1665
- #endif
1666
- #ifdef DOUBLE_SIDED
1667
- normal = normal * faceDirection;
1668
- #endif
1669
- normal = normalize( normalMatrix * normal );
1670
- #elif defined( USE_NORMALMAP_TANGENTSPACE )
1671
- vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1672
- #if defined( USE_PACKED_NORMALMAP )
1673
- mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1674
- #endif
1675
- mapN.xy *= normalScale;
1676
- normal = normalize( tbn * mapN );
1677
- #elif defined( USE_BUMPMAP )
1678
- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1679
- #endif`,Mu=`#ifndef FLAT_SHADED
1680
- varying vec3 vNormal;
1681
- #ifdef USE_TANGENT
1682
- varying vec3 vTangent;
1683
- varying vec3 vBitangent;
1684
- #endif
1685
- #endif`,xu=`#ifndef FLAT_SHADED
1686
- varying vec3 vNormal;
1687
- #ifdef USE_TANGENT
1688
- varying vec3 vTangent;
1689
- varying vec3 vBitangent;
1690
- #endif
1691
- #endif`,Tu=`#ifndef FLAT_SHADED
1692
- vNormal = normalize( transformedNormal );
1693
- #ifdef USE_TANGENT
1694
- vTangent = normalize( transformedTangent );
1695
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1696
- #ifdef FLIP_SIDED
1697
- vBitangent = - vBitangent;
1698
- #endif
1699
- #endif
1700
- #endif`,Au=`#ifdef USE_NORMALMAP
1701
- uniform sampler2D normalMap;
1702
- uniform vec2 normalScale;
1703
- #endif
1704
- #ifdef USE_NORMALMAP_OBJECTSPACE
1705
- uniform mat3 normalMatrix;
1706
- #endif
1707
- #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1708
- mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1709
- vec3 q0 = dFdx( eye_pos.xyz );
1710
- vec3 q1 = dFdy( eye_pos.xyz );
1711
- vec2 st0 = dFdx( uv.st );
1712
- vec2 st1 = dFdy( uv.st );
1713
- vec3 N = surf_norm;
1714
- vec3 q1perp = cross( q1, N );
1715
- vec3 q0perp = cross( N, q0 );
1716
- vec3 T = q1perp * st0.x + q0perp * st1.x;
1717
- vec3 B = q1perp * st0.y + q0perp * st1.y;
1718
- float det = max( dot( T, T ), dot( B, B ) );
1719
- float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1720
- return mat3( T * scale, B * scale, N );
1721
- }
1722
- #endif`,Ru=`#ifdef USE_CLEARCOAT
1723
- vec3 clearcoatNormal = nonPerturbedNormal;
1724
- #endif`,bu=`#ifdef USE_CLEARCOAT_NORMALMAP
1725
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1726
- clearcoatMapN.xy *= clearcoatNormalScale;
1727
- clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1728
- #endif`,Cu=`#ifdef USE_CLEARCOATMAP
1729
- uniform sampler2D clearcoatMap;
1730
- #endif
1731
- #ifdef USE_CLEARCOAT_NORMALMAP
1732
- uniform sampler2D clearcoatNormalMap;
1733
- uniform vec2 clearcoatNormalScale;
1734
- #endif
1735
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1736
- uniform sampler2D clearcoatRoughnessMap;
1737
- #endif`,Pu=`#ifdef USE_IRIDESCENCEMAP
1738
- uniform sampler2D iridescenceMap;
1739
- #endif
1740
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
1741
- uniform sampler2D iridescenceThicknessMap;
1742
- #endif`,Lu=`#ifdef OPAQUE
1743
- diffuseColor.a = 1.0;
1744
- #endif
1745
- #ifdef USE_TRANSMISSION
1746
- diffuseColor.a *= material.transmissionAlpha;
1747
- #endif
1748
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Uu=`vec3 packNormalToRGB( const in vec3 normal ) {
1749
- return normalize( normal ) * 0.5 + 0.5;
1750
- }
1751
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
1752
- return 2.0 * rgb.xyz - 1.0;
1753
- }
1754
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1755
- const float Inv255 = 1. / 255.;
1756
- const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1757
- const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1758
- const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1759
- const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1760
- vec4 packDepthToRGBA( const in float v ) {
1761
- if( v <= 0.0 )
1762
- return vec4( 0., 0., 0., 0. );
1763
- if( v >= 1.0 )
1764
- return vec4( 1., 1., 1., 1. );
1765
- float vuf;
1766
- float af = modf( v * PackFactors.a, vuf );
1767
- float bf = modf( vuf * ShiftRight8, vuf );
1768
- float gf = modf( vuf * ShiftRight8, vuf );
1769
- return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1770
- }
1771
- vec3 packDepthToRGB( const in float v ) {
1772
- if( v <= 0.0 )
1773
- return vec3( 0., 0., 0. );
1774
- if( v >= 1.0 )
1775
- return vec3( 1., 1., 1. );
1776
- float vuf;
1777
- float bf = modf( v * PackFactors.b, vuf );
1778
- float gf = modf( vuf * ShiftRight8, vuf );
1779
- return vec3( vuf * Inv255, gf * PackUpscale, bf );
1780
- }
1781
- vec2 packDepthToRG( const in float v ) {
1782
- if( v <= 0.0 )
1783
- return vec2( 0., 0. );
1784
- if( v >= 1.0 )
1785
- return vec2( 1., 1. );
1786
- float vuf;
1787
- float gf = modf( v * 256., vuf );
1788
- return vec2( vuf * Inv255, gf );
1789
- }
1790
- float unpackRGBAToDepth( const in vec4 v ) {
1791
- return dot( v, UnpackFactors4 );
1792
- }
1793
- float unpackRGBToDepth( const in vec3 v ) {
1794
- return dot( v, UnpackFactors3 );
1795
- }
1796
- float unpackRGToDepth( const in vec2 v ) {
1797
- return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1798
- }
1799
- vec4 pack2HalfToRGBA( const in vec2 v ) {
1800
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1801
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1802
- }
1803
- vec2 unpackRGBATo2Half( const in vec4 v ) {
1804
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1805
- }
1806
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1807
- return ( viewZ + near ) / ( near - far );
1808
- }
1809
- float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1810
- #ifdef USE_REVERSED_DEPTH_BUFFER
1811
-
1812
- return depth * ( far - near ) - far;
1813
- #else
1814
- return depth * ( near - far ) - near;
1815
- #endif
1816
- }
1817
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1818
- return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1819
- }
1820
- float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1821
-
1822
- #ifdef USE_REVERSED_DEPTH_BUFFER
1823
- return ( near * far ) / ( ( near - far ) * depth - near );
1824
- #else
1825
- return ( near * far ) / ( ( far - near ) * depth - far );
1826
- #endif
1827
- }`,Du=`#ifdef PREMULTIPLIED_ALPHA
1828
- gl_FragColor.rgb *= gl_FragColor.a;
1829
- #endif`,wu=`vec4 mvPosition = vec4( transformed, 1.0 );
1830
- #ifdef USE_BATCHING
1831
- mvPosition = batchingMatrix * mvPosition;
1832
- #endif
1833
- #ifdef USE_INSTANCING
1834
- mvPosition = instanceMatrix * mvPosition;
1835
- #endif
1836
- mvPosition = modelViewMatrix * mvPosition;
1837
- gl_Position = projectionMatrix * mvPosition;`,Iu=`#ifdef DITHERING
1838
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1839
- #endif`,Nu=`#ifdef DITHERING
1840
- vec3 dithering( vec3 color ) {
1841
- float grid_position = rand( gl_FragCoord.xy );
1842
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1843
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1844
- return color + dither_shift_RGB;
1845
- }
1846
- #endif`,yu=`float roughnessFactor = roughness;
1847
- #ifdef USE_ROUGHNESSMAP
1848
- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1849
- roughnessFactor *= texelRoughness.g;
1850
- #endif`,Fu=`#ifdef USE_ROUGHNESSMAP
1851
- uniform sampler2D roughnessMap;
1852
- #endif`,Ou=`#if NUM_SPOT_LIGHT_COORDS > 0
1853
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1854
- #endif
1855
- #if NUM_SPOT_LIGHT_MAPS > 0
1856
- uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1857
- #endif
1858
- #ifdef USE_SHADOWMAP
1859
- #if NUM_SUN_LIGHT_SHADOWS > 0
1860
- #define SUN_LIGHT_CASCADES 2
1861
- #if defined( SHADOWMAP_TYPE_PCF )
1862
- uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
1863
- #else
1864
- uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
1865
- #endif
1866
- uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
1867
- uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
1868
- varying vec4 vSunShadowWorldPosition;
1869
- varying vec3 vSunShadowWorldNormal;
1870
- struct SunLightShadow {
1871
- float shadowIntensity;
1872
- float shadowBias;
1873
- float shadowNormalBias;
1874
- float shadowRadius;
1875
- vec2 shadowMapSize;
1876
- };
1877
- uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];
1878
- #endif
1879
- #if NUM_DIR_LIGHT_SHADOWS > 0
1880
- #if defined( SHADOWMAP_TYPE_PCF )
1881
- uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1882
- #else
1883
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1884
- #endif
1885
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1886
- struct DirectionalLightShadow {
1887
- float shadowIntensity;
1888
- float shadowBias;
1889
- float shadowNormalBias;
1890
- float shadowRadius;
1891
- vec2 shadowMapSize;
1892
- };
1893
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1894
- #endif
1895
- #if NUM_SPOT_LIGHT_SHADOWS > 0
1896
- #if defined( SHADOWMAP_TYPE_PCF )
1897
- uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1898
- #else
1899
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1900
- #endif
1901
- struct SpotLightShadow {
1902
- float shadowIntensity;
1903
- float shadowBias;
1904
- float shadowNormalBias;
1905
- float shadowRadius;
1906
- vec2 shadowMapSize;
1907
- };
1908
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1909
- #endif
1910
- #if NUM_POINT_LIGHT_SHADOWS > 0
1911
- #if defined( SHADOWMAP_TYPE_PCF )
1912
- uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1913
- #elif defined( SHADOWMAP_TYPE_BASIC )
1914
- uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1915
- #endif
1916
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1917
- struct PointLightShadow {
1918
- float shadowIntensity;
1919
- float shadowBias;
1920
- float shadowNormalBias;
1921
- float shadowRadius;
1922
- vec2 shadowMapSize;
1923
- float shadowCameraNear;
1924
- float shadowCameraFar;
1925
- };
1926
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1927
- #endif
1928
- #if defined( SHADOWMAP_TYPE_PCF )
1929
- float interleavedGradientNoise( vec2 position ) {
1930
- return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1931
- }
1932
- vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1933
- const float goldenAngle = 2.399963229728653;
1934
- float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1935
- float theta = float( sampleIndex ) * goldenAngle + phi;
1936
- return vec2( cos( theta ), sin( theta ) ) * r;
1937
- }
1938
- #endif
1939
- #if defined( SHADOWMAP_TYPE_PCF )
1940
- float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1941
- float shadow = 1.0;
1942
- shadowCoord.xyz /= shadowCoord.w;
1943
- shadowCoord.z += shadowBias;
1944
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1945
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1946
- if ( frustumTest ) {
1947
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1948
- float radius = shadowRadius * texelSize.x;
1949
- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1950
- shadow = (
1951
- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1952
- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1953
- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1954
- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1955
- texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1956
- ) * 0.2;
1957
- }
1958
- return mix( 1.0, shadow, shadowIntensity );
1959
- }
1960
- #elif defined( SHADOWMAP_TYPE_VSM )
1961
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1962
- float shadow = 1.0;
1963
- shadowCoord.xyz /= shadowCoord.w;
1964
- #ifdef USE_REVERSED_DEPTH_BUFFER
1965
- shadowCoord.z -= shadowBias;
1966
- #else
1967
- shadowCoord.z += shadowBias;
1968
- #endif
1969
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1970
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1971
- if ( frustumTest ) {
1972
- vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1973
- float mean = distribution.x;
1974
- float variance = distribution.y * distribution.y;
1975
- #ifdef USE_REVERSED_DEPTH_BUFFER
1976
- float hard_shadow = step( mean, shadowCoord.z );
1977
- #else
1978
- float hard_shadow = step( shadowCoord.z, mean );
1979
- #endif
1980
-
1981
- if ( hard_shadow == 1.0 ) {
1982
- shadow = 1.0;
1983
- } else {
1984
- variance = max( variance, 0.0000001 );
1985
- float d = shadowCoord.z - mean;
1986
- float p_max = variance / ( variance + d * d );
1987
- p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1988
- shadow = max( hard_shadow, p_max );
1989
- }
1990
- }
1991
- return mix( 1.0, shadow, shadowIntensity );
1992
- }
1993
- #else
1994
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1995
- float shadow = 1.0;
1996
- shadowCoord.xyz /= shadowCoord.w;
1997
- #ifdef USE_REVERSED_DEPTH_BUFFER
1998
- shadowCoord.z -= shadowBias;
1999
- #else
2000
- shadowCoord.z += shadowBias;
2001
- #endif
2002
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
2003
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
2004
- if ( frustumTest ) {
2005
- float depth = texture2D( shadowMap, shadowCoord.xy ).r;
2006
- #ifdef USE_REVERSED_DEPTH_BUFFER
2007
- shadow = step( depth, shadowCoord.z );
2008
- #else
2009
- shadow = step( shadowCoord.z, depth );
2010
- #endif
2011
- }
2012
- return mix( 1.0, shadow, shadowIntensity );
2013
- }
2014
- #endif
2015
- #if NUM_SUN_LIGHT_SHADOWS > 0
2016
- float getSunShadow(
2017
- #if defined( SHADOWMAP_TYPE_PCF )
2018
- sampler2DShadow shadowMap,
2019
- #else
2020
- sampler2D shadowMap,
2021
- #endif
2022
- SunLightShadow sunLightShadow,
2023
- int shadowIndex
2024
- ) {
2025
- vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );
2026
- float viewDepth = vSunShadowWorldPosition.w;
2027
- int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;
2028
- float shadow = 1.0;
2029
- for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {
2030
- vec4 cascade = sunShadowCascade[ cascadeOffset + i ];
2031
- if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {
2032
- float cascadeShadow = getShadow(
2033
- shadowMap,
2034
- sunLightShadow.shadowMapSize,
2035
- sunLightShadow.shadowIntensity,
2036
- sunLightShadow.shadowBias,
2037
- sunLightShadow.shadowRadius,
2038
- sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition
2039
- );
2040
- shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );
2041
- }
2042
- }
2043
- return shadow;
2044
- }
2045
- #endif
2046
- #if NUM_POINT_LIGHT_SHADOWS > 0
2047
- #if defined( SHADOWMAP_TYPE_PCF )
2048
- float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2049
- float shadow = 1.0;
2050
- vec3 lightToPosition = shadowCoord.xyz;
2051
- vec3 bd3D = normalize( lightToPosition );
2052
- vec3 absVec = abs( lightToPosition );
2053
- float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2054
- if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2055
- #ifdef USE_REVERSED_DEPTH_BUFFER
2056
- float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2057
- dp -= shadowBias;
2058
- #else
2059
- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2060
- dp += shadowBias;
2061
- #endif
2062
- float texelSize = shadowRadius / shadowMapSize.x;
2063
- vec3 absDir = abs( bd3D );
2064
- vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
2065
- tangent = normalize( cross( bd3D, tangent ) );
2066
- vec3 bitangent = cross( bd3D, tangent );
2067
- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
2068
- vec2 sample0 = vogelDiskSample( 0, 5, phi );
2069
- vec2 sample1 = vogelDiskSample( 1, 5, phi );
2070
- vec2 sample2 = vogelDiskSample( 2, 5, phi );
2071
- vec2 sample3 = vogelDiskSample( 3, 5, phi );
2072
- vec2 sample4 = vogelDiskSample( 4, 5, phi );
2073
- shadow = (
2074
- texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
2075
- texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
2076
- texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
2077
- texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
2078
- texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
2079
- ) * 0.2;
2080
- }
2081
- return mix( 1.0, shadow, shadowIntensity );
2082
- }
2083
- #elif defined( SHADOWMAP_TYPE_BASIC )
2084
- float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2085
- float shadow = 1.0;
2086
- vec3 lightToPosition = shadowCoord.xyz;
2087
- vec3 absVec = abs( lightToPosition );
2088
- float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
2089
- if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
2090
- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
2091
- dp += shadowBias;
2092
- vec3 bd3D = normalize( lightToPosition );
2093
- float depth = textureCube( shadowMap, bd3D ).r;
2094
- #ifdef USE_REVERSED_DEPTH_BUFFER
2095
- depth = 1.0 - depth;
2096
- #endif
2097
- shadow = step( dp, depth );
2098
- }
2099
- return mix( 1.0, shadow, shadowIntensity );
2100
- }
2101
- #endif
2102
- #endif
2103
- #endif`,Bu=`#if NUM_SPOT_LIGHT_COORDS > 0
2104
- uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2105
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2106
- #endif
2107
- #ifdef USE_SHADOWMAP
2108
- #if NUM_SUN_LIGHT_SHADOWS > 0
2109
- varying vec4 vSunShadowWorldPosition;
2110
- varying vec3 vSunShadowWorldNormal;
2111
- #endif
2112
- #if NUM_DIR_LIGHT_SHADOWS > 0
2113
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2114
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2115
- struct DirectionalLightShadow {
2116
- float shadowIntensity;
2117
- float shadowBias;
2118
- float shadowNormalBias;
2119
- float shadowRadius;
2120
- vec2 shadowMapSize;
2121
- };
2122
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2123
- #endif
2124
- #if NUM_SPOT_LIGHT_SHADOWS > 0
2125
- struct SpotLightShadow {
2126
- float shadowIntensity;
2127
- float shadowBias;
2128
- float shadowNormalBias;
2129
- float shadowRadius;
2130
- vec2 shadowMapSize;
2131
- };
2132
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2133
- #endif
2134
- #if NUM_POINT_LIGHT_SHADOWS > 0
2135
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2136
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2137
- struct PointLightShadow {
2138
- float shadowIntensity;
2139
- float shadowBias;
2140
- float shadowNormalBias;
2141
- float shadowRadius;
2142
- vec2 shadowMapSize;
2143
- float shadowCameraNear;
2144
- float shadowCameraFar;
2145
- };
2146
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2147
- #endif
2148
- #endif`,Gu=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2149
- #ifdef HAS_NORMAL
2150
- vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2151
- #else
2152
- vec3 shadowWorldNormal = vec3( 0.0 );
2153
- #endif
2154
- vec4 shadowWorldPosition;
2155
- #endif
2156
- #if defined( USE_SHADOWMAP )
2157
- #if NUM_SUN_LIGHT_SHADOWS > 0
2158
- vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );
2159
- vSunShadowWorldNormal = shadowWorldNormal;
2160
- #endif
2161
- #if NUM_DIR_LIGHT_SHADOWS > 0
2162
- #pragma unroll_loop_start
2163
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2164
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2165
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2166
- }
2167
- #pragma unroll_loop_end
2168
- #endif
2169
- #if NUM_POINT_LIGHT_SHADOWS > 0
2170
- #pragma unroll_loop_start
2171
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2172
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2173
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2174
- }
2175
- #pragma unroll_loop_end
2176
- #endif
2177
- #endif
2178
- #if NUM_SPOT_LIGHT_COORDS > 0
2179
- #pragma unroll_loop_start
2180
- for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2181
- shadowWorldPosition = worldPosition;
2182
- #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2183
- shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2184
- #endif
2185
- vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2186
- }
2187
- #pragma unroll_loop_end
2188
- #endif`,Hu=`float getShadowMask() {
2189
- float shadow = 1.0;
2190
- #ifdef USE_SHADOWMAP
2191
- #if NUM_SUN_LIGHT_SHADOWS > 0
2192
- SunLightShadow sunLight;
2193
- #pragma unroll_loop_start
2194
- for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {
2195
- sunLight = sunLightShadows[ i ];
2196
- shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;
2197
- }
2198
- #pragma unroll_loop_end
2199
- #endif
2200
- #if NUM_DIR_LIGHT_SHADOWS > 0
2201
- DirectionalLightShadow directionalLight;
2202
- #pragma unroll_loop_start
2203
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2204
- directionalLight = directionalLightShadows[ i ];
2205
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2206
- }
2207
- #pragma unroll_loop_end
2208
- #endif
2209
- #if NUM_SPOT_LIGHT_SHADOWS > 0
2210
- SpotLightShadow spotLight;
2211
- #pragma unroll_loop_start
2212
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2213
- spotLight = spotLightShadows[ i ];
2214
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2215
- }
2216
- #pragma unroll_loop_end
2217
- #endif
2218
- #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2219
- PointLightShadow pointLight;
2220
- #pragma unroll_loop_start
2221
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2222
- pointLight = pointLightShadows[ i ];
2223
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2224
- }
2225
- #pragma unroll_loop_end
2226
- #endif
2227
- #endif
2228
- return shadow;
2229
- }`,Vu=`#ifdef USE_SKINNING
2230
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
2231
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
2232
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2233
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
2234
- #endif`,Wu=`#ifdef USE_SKINNING
2235
- uniform mat4 bindMatrix;
2236
- uniform mat4 bindMatrixInverse;
2237
- uniform highp sampler2D boneTexture;
2238
- mat4 getBoneMatrix( const in float i ) {
2239
- int size = textureSize( boneTexture, 0 ).x;
2240
- int j = int( i ) * 4;
2241
- int x = j % size;
2242
- int y = j / size;
2243
- vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2244
- vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2245
- vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2246
- vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2247
- return mat4( v1, v2, v3, v4 );
2248
- }
2249
- #endif`,ku=`#ifdef USE_SKINNING
2250
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2251
- vec4 skinned = vec4( 0.0 );
2252
- skinned += boneMatX * skinVertex * skinWeight.x;
2253
- skinned += boneMatY * skinVertex * skinWeight.y;
2254
- skinned += boneMatZ * skinVertex * skinWeight.z;
2255
- skinned += boneMatW * skinVertex * skinWeight.w;
2256
- transformed = ( bindMatrixInverse * skinned ).xyz;
2257
- #endif`,zu=`#ifdef USE_SKINNING
2258
- mat4 skinMatrix = mat4( 0.0 );
2259
- skinMatrix += skinWeight.x * boneMatX;
2260
- skinMatrix += skinWeight.y * boneMatY;
2261
- skinMatrix += skinWeight.z * boneMatZ;
2262
- skinMatrix += skinWeight.w * boneMatW;
2263
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2264
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2265
- #ifdef USE_TANGENT
2266
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2267
- #endif
2268
- #endif`,Xu=`float specularStrength;
2269
- #ifdef USE_SPECULARMAP
2270
- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2271
- specularStrength = texelSpecular.r;
2272
- #else
2273
- specularStrength = 1.0;
2274
- #endif`,Ku=`#ifdef USE_SPECULARMAP
2275
- uniform sampler2D specularMap;
2276
- #endif`,Yu=`#if defined( TONE_MAPPING )
2277
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2278
- #endif`,qu=`#ifndef saturate
2279
- #define saturate( a ) clamp( a, 0.0, 1.0 )
2280
- #endif
2281
- uniform float toneMappingExposure;
2282
- vec3 LinearToneMapping( vec3 color ) {
2283
- return saturate( toneMappingExposure * color );
2284
- }
2285
- vec3 ReinhardToneMapping( vec3 color ) {
2286
- color *= toneMappingExposure;
2287
- return saturate( color / ( vec3( 1.0 ) + color ) );
2288
- }
2289
- vec3 CineonToneMapping( vec3 color ) {
2290
- color *= toneMappingExposure;
2291
- color = max( vec3( 0.0 ), color - 0.004 );
2292
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2293
- }
2294
- vec3 RRTAndODTFit( vec3 v ) {
2295
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2296
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2297
- return a / b;
2298
- }
2299
- vec3 ACESFilmicToneMapping( vec3 color ) {
2300
- const mat3 ACESInputMat = mat3(
2301
- vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
2302
- vec3( 0.04823, 0.01566, 0.83777 )
2303
- );
2304
- const mat3 ACESOutputMat = mat3(
2305
- vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
2306
- vec3( -0.07367, -0.00605, 1.07602 )
2307
- );
2308
- color *= toneMappingExposure / 0.6;
2309
- color = ACESInputMat * color;
2310
- color = RRTAndODTFit( color );
2311
- color = ACESOutputMat * color;
2312
- return saturate( color );
2313
- }
2314
- const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2315
- vec3( 1.6605, - 0.1246, - 0.0182 ),
2316
- vec3( - 0.5876, 1.1329, - 0.1006 ),
2317
- vec3( - 0.0728, - 0.0083, 1.1187 )
2318
- );
2319
- const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2320
- vec3( 0.6274, 0.0691, 0.0164 ),
2321
- vec3( 0.3293, 0.9195, 0.0880 ),
2322
- vec3( 0.0433, 0.0113, 0.8956 )
2323
- );
2324
- vec3 agxDefaultContrastApprox( vec3 x ) {
2325
- vec3 x2 = x * x;
2326
- vec3 x4 = x2 * x2;
2327
- return + 15.5 * x4 * x2
2328
- - 40.14 * x4 * x
2329
- + 31.96 * x4
2330
- - 6.868 * x2 * x
2331
- + 0.4298 * x2
2332
- + 0.1191 * x
2333
- - 0.00232;
2334
- }
2335
- vec3 AgXToneMapping( vec3 color ) {
2336
- const mat3 AgXInsetMatrix = mat3(
2337
- vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2338
- vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2339
- vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2340
- );
2341
- const mat3 AgXOutsetMatrix = mat3(
2342
- vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2343
- vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2344
- vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2345
- );
2346
- const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
2347
- color *= toneMappingExposure;
2348
- color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2349
- color = AgXInsetMatrix * color;
2350
- color = max( color, 1e-10 ); color = log2( color );
2351
- color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2352
- color = clamp( color, 0.0, 1.0 );
2353
- color = agxDefaultContrastApprox( color );
2354
- color = AgXOutsetMatrix * color;
2355
- color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2356
- color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2357
- color = clamp( color, 0.0, 1.0 );
2358
- return color;
2359
- }
2360
- vec3 NeutralToneMapping( vec3 color ) {
2361
- const float StartCompression = 0.8 - 0.04;
2362
- const float Desaturation = 0.15;
2363
- color *= toneMappingExposure;
2364
- float x = min( color.r, min( color.g, color.b ) );
2365
- float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2366
- color -= offset;
2367
- float peak = max( color.r, max( color.g, color.b ) );
2368
- if ( peak < StartCompression ) return color;
2369
- float d = 1. - StartCompression;
2370
- float newPeak = 1. - d * d / ( peak + d - StartCompression );
2371
- color *= newPeak / peak;
2372
- float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2373
- return mix( color, vec3( newPeak ), g );
2374
- }
2375
- vec3 CustomToneMapping( vec3 color ) { return color; }`,Zu=`#ifdef USE_TRANSMISSION
2376
- material.transmission = transmission;
2377
- material.transmissionAlpha = 1.0;
2378
- material.thickness = thickness;
2379
- material.attenuationDistance = attenuationDistance;
2380
- material.attenuationColor = attenuationColor;
2381
- #ifdef USE_TRANSMISSIONMAP
2382
- material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2383
- #endif
2384
- #ifdef USE_THICKNESSMAP
2385
- material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2386
- #endif
2387
- vec3 pos = vWorldPosition;
2388
- vec3 v = normalize( cameraPosition - pos );
2389
- vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
2390
- vec4 transmitted = getIBLVolumeRefraction(
2391
- n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2392
- pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2393
- material.attenuationColor, material.attenuationDistance );
2394
- material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2395
- totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2396
- #endif`,$u=`#ifdef USE_TRANSMISSION
2397
- uniform float transmission;
2398
- uniform float thickness;
2399
- uniform float attenuationDistance;
2400
- uniform vec3 attenuationColor;
2401
- #ifdef USE_TRANSMISSIONMAP
2402
- uniform sampler2D transmissionMap;
2403
- #endif
2404
- #ifdef USE_THICKNESSMAP
2405
- uniform sampler2D thicknessMap;
2406
- #endif
2407
- uniform vec2 transmissionSamplerSize;
2408
- uniform sampler2D transmissionSamplerMap;
2409
- uniform mat4 modelMatrix;
2410
- uniform mat4 projectionMatrix;
2411
- varying vec3 vWorldPosition;
2412
- float w0( float a ) {
2413
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2414
- }
2415
- float w1( float a ) {
2416
- return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
2417
- }
2418
- float w2( float a ){
2419
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2420
- }
2421
- float w3( float a ) {
2422
- return ( 1.0 / 6.0 ) * ( a * a * a );
2423
- }
2424
- float g0( float a ) {
2425
- return w0( a ) + w1( a );
2426
- }
2427
- float g1( float a ) {
2428
- return w2( a ) + w3( a );
2429
- }
2430
- float h0( float a ) {
2431
- return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2432
- }
2433
- float h1( float a ) {
2434
- return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2435
- }
2436
- vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2437
- uv = uv * texelSize.zw + 0.5;
2438
- vec2 iuv = floor( uv );
2439
- vec2 fuv = fract( uv );
2440
- float g0x = g0( fuv.x );
2441
- float g1x = g1( fuv.x );
2442
- float h0x = h0( fuv.x );
2443
- float h1x = h1( fuv.x );
2444
- float h0y = h0( fuv.y );
2445
- float h1y = h1( fuv.y );
2446
- vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2447
- vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2448
- vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2449
- vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2450
- return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2451
- g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2452
- }
2453
- vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2454
- vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2455
- vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2456
- vec2 fLodSizeInv = 1.0 / fLodSize;
2457
- vec2 cLodSizeInv = 1.0 / cLodSize;
2458
- vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2459
- vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2460
- return mix( fSample, cSample, fract( lod ) );
2461
- }
2462
- vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2463
- vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2464
- vec3 modelScale;
2465
- modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2466
- modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2467
- modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2468
- return normalize( refractionVector ) * thickness * modelScale;
2469
- }
2470
- float applyIorToRoughness( const in float roughness, const in float ior ) {
2471
- return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2472
- }
2473
- vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2474
- float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2475
- return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2476
- }
2477
- vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2478
- if ( isinf( attenuationDistance ) ) {
2479
- return vec3( 1.0 );
2480
- } else {
2481
- vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2482
- vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
2483
- }
2484
- }
2485
- vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2486
- const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2487
- const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2488
- const in vec3 attenuationColor, const in float attenuationDistance ) {
2489
- vec4 transmittedLight;
2490
- vec3 transmittance;
2491
- #ifdef USE_DISPERSION
2492
- float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2493
- vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2494
- for ( int i = 0; i < 3; i ++ ) {
2495
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2496
- vec3 refractedRayExit = position + transmissionRay;
2497
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2498
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2499
- refractionCoords += 1.0;
2500
- refractionCoords /= 2.0;
2501
- vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2502
- transmittedLight[ i ] = transmissionSample[ i ];
2503
- transmittedLight.a += transmissionSample.a;
2504
- transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2505
- }
2506
- transmittedLight.a /= 3.0;
2507
- #else
2508
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2509
- vec3 refractedRayExit = position + transmissionRay;
2510
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2511
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2512
- refractionCoords += 1.0;
2513
- refractionCoords /= 2.0;
2514
- transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2515
- transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2516
- #endif
2517
- vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2518
- vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2519
- float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2520
- return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2521
- }
2522
- #endif`,Qu=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2523
- varying vec2 vUv;
2524
- #endif
2525
- #ifdef USE_MAP
2526
- varying vec2 vMapUv;
2527
- #endif
2528
- #ifdef USE_ALPHAMAP
2529
- varying vec2 vAlphaMapUv;
2530
- #endif
2531
- #ifdef USE_LIGHTMAP
2532
- varying vec2 vLightMapUv;
2533
- #endif
2534
- #ifdef USE_AOMAP
2535
- varying vec2 vAoMapUv;
2536
- #endif
2537
- #ifdef USE_BUMPMAP
2538
- varying vec2 vBumpMapUv;
2539
- #endif
2540
- #ifdef USE_NORMALMAP
2541
- varying vec2 vNormalMapUv;
2542
- #endif
2543
- #ifdef USE_EMISSIVEMAP
2544
- varying vec2 vEmissiveMapUv;
2545
- #endif
2546
- #ifdef USE_METALNESSMAP
2547
- varying vec2 vMetalnessMapUv;
2548
- #endif
2549
- #ifdef USE_ROUGHNESSMAP
2550
- varying vec2 vRoughnessMapUv;
2551
- #endif
2552
- #ifdef USE_ANISOTROPYMAP
2553
- varying vec2 vAnisotropyMapUv;
2554
- #endif
2555
- #ifdef USE_CLEARCOATMAP
2556
- varying vec2 vClearcoatMapUv;
2557
- #endif
2558
- #ifdef USE_CLEARCOAT_NORMALMAP
2559
- varying vec2 vClearcoatNormalMapUv;
2560
- #endif
2561
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2562
- varying vec2 vClearcoatRoughnessMapUv;
2563
- #endif
2564
- #ifdef USE_IRIDESCENCEMAP
2565
- varying vec2 vIridescenceMapUv;
2566
- #endif
2567
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
2568
- varying vec2 vIridescenceThicknessMapUv;
2569
- #endif
2570
- #ifdef USE_SHEEN_COLORMAP
2571
- varying vec2 vSheenColorMapUv;
2572
- #endif
2573
- #ifdef USE_SHEEN_ROUGHNESSMAP
2574
- varying vec2 vSheenRoughnessMapUv;
2575
- #endif
2576
- #ifdef USE_SPECULARMAP
2577
- varying vec2 vSpecularMapUv;
2578
- #endif
2579
- #ifdef USE_SPECULAR_COLORMAP
2580
- varying vec2 vSpecularColorMapUv;
2581
- #endif
2582
- #ifdef USE_SPECULAR_INTENSITYMAP
2583
- varying vec2 vSpecularIntensityMapUv;
2584
- #endif
2585
- #ifdef USE_TRANSMISSIONMAP
2586
- uniform mat3 transmissionMapTransform;
2587
- varying vec2 vTransmissionMapUv;
2588
- #endif
2589
- #ifdef USE_THICKNESSMAP
2590
- uniform mat3 thicknessMapTransform;
2591
- varying vec2 vThicknessMapUv;
2592
- #endif`,Ju=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2593
- varying vec2 vUv;
2594
- #endif
2595
- #ifdef USE_MAP
2596
- uniform mat3 mapTransform;
2597
- varying vec2 vMapUv;
2598
- #endif
2599
- #ifdef USE_ALPHAMAP
2600
- uniform mat3 alphaMapTransform;
2601
- varying vec2 vAlphaMapUv;
2602
- #endif
2603
- #ifdef USE_LIGHTMAP
2604
- uniform mat3 lightMapTransform;
2605
- varying vec2 vLightMapUv;
2606
- #endif
2607
- #ifdef USE_AOMAP
2608
- uniform mat3 aoMapTransform;
2609
- varying vec2 vAoMapUv;
2610
- #endif
2611
- #ifdef USE_BUMPMAP
2612
- uniform mat3 bumpMapTransform;
2613
- varying vec2 vBumpMapUv;
2614
- #endif
2615
- #ifdef USE_NORMALMAP
2616
- uniform mat3 normalMapTransform;
2617
- varying vec2 vNormalMapUv;
2618
- #endif
2619
- #ifdef USE_DISPLACEMENTMAP
2620
- uniform mat3 displacementMapTransform;
2621
- varying vec2 vDisplacementMapUv;
2622
- #endif
2623
- #ifdef USE_EMISSIVEMAP
2624
- uniform mat3 emissiveMapTransform;
2625
- varying vec2 vEmissiveMapUv;
2626
- #endif
2627
- #ifdef USE_METALNESSMAP
2628
- uniform mat3 metalnessMapTransform;
2629
- varying vec2 vMetalnessMapUv;
2630
- #endif
2631
- #ifdef USE_ROUGHNESSMAP
2632
- uniform mat3 roughnessMapTransform;
2633
- varying vec2 vRoughnessMapUv;
2634
- #endif
2635
- #ifdef USE_ANISOTROPYMAP
2636
- uniform mat3 anisotropyMapTransform;
2637
- varying vec2 vAnisotropyMapUv;
2638
- #endif
2639
- #ifdef USE_CLEARCOATMAP
2640
- uniform mat3 clearcoatMapTransform;
2641
- varying vec2 vClearcoatMapUv;
2642
- #endif
2643
- #ifdef USE_CLEARCOAT_NORMALMAP
2644
- uniform mat3 clearcoatNormalMapTransform;
2645
- varying vec2 vClearcoatNormalMapUv;
2646
- #endif
2647
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2648
- uniform mat3 clearcoatRoughnessMapTransform;
2649
- varying vec2 vClearcoatRoughnessMapUv;
2650
- #endif
2651
- #ifdef USE_SHEEN_COLORMAP
2652
- uniform mat3 sheenColorMapTransform;
2653
- varying vec2 vSheenColorMapUv;
2654
- #endif
2655
- #ifdef USE_SHEEN_ROUGHNESSMAP
2656
- uniform mat3 sheenRoughnessMapTransform;
2657
- varying vec2 vSheenRoughnessMapUv;
2658
- #endif
2659
- #ifdef USE_IRIDESCENCEMAP
2660
- uniform mat3 iridescenceMapTransform;
2661
- varying vec2 vIridescenceMapUv;
2662
- #endif
2663
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
2664
- uniform mat3 iridescenceThicknessMapTransform;
2665
- varying vec2 vIridescenceThicknessMapUv;
2666
- #endif
2667
- #ifdef USE_SPECULARMAP
2668
- uniform mat3 specularMapTransform;
2669
- varying vec2 vSpecularMapUv;
2670
- #endif
2671
- #ifdef USE_SPECULAR_COLORMAP
2672
- uniform mat3 specularColorMapTransform;
2673
- varying vec2 vSpecularColorMapUv;
2674
- #endif
2675
- #ifdef USE_SPECULAR_INTENSITYMAP
2676
- uniform mat3 specularIntensityMapTransform;
2677
- varying vec2 vSpecularIntensityMapUv;
2678
- #endif
2679
- #ifdef USE_TRANSMISSIONMAP
2680
- uniform mat3 transmissionMapTransform;
2681
- varying vec2 vTransmissionMapUv;
2682
- #endif
2683
- #ifdef USE_THICKNESSMAP
2684
- uniform mat3 thicknessMapTransform;
2685
- varying vec2 vThicknessMapUv;
2686
- #endif`,ju=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2687
- vUv = vec3( uv, 1 ).xy;
2688
- #endif
2689
- #ifdef USE_MAP
2690
- vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2691
- #endif
2692
- #ifdef USE_ALPHAMAP
2693
- vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2694
- #endif
2695
- #ifdef USE_LIGHTMAP
2696
- vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2697
- #endif
2698
- #ifdef USE_AOMAP
2699
- vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2700
- #endif
2701
- #ifdef USE_BUMPMAP
2702
- vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2703
- #endif
2704
- #ifdef USE_NORMALMAP
2705
- vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2706
- #endif
2707
- #ifdef USE_DISPLACEMENTMAP
2708
- vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2709
- #endif
2710
- #ifdef USE_EMISSIVEMAP
2711
- vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2712
- #endif
2713
- #ifdef USE_METALNESSMAP
2714
- vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2715
- #endif
2716
- #ifdef USE_ROUGHNESSMAP
2717
- vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2718
- #endif
2719
- #ifdef USE_ANISOTROPYMAP
2720
- vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2721
- #endif
2722
- #ifdef USE_CLEARCOATMAP
2723
- vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2724
- #endif
2725
- #ifdef USE_CLEARCOAT_NORMALMAP
2726
- vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2727
- #endif
2728
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
2729
- vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2730
- #endif
2731
- #ifdef USE_IRIDESCENCEMAP
2732
- vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2733
- #endif
2734
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
2735
- vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2736
- #endif
2737
- #ifdef USE_SHEEN_COLORMAP
2738
- vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2739
- #endif
2740
- #ifdef USE_SHEEN_ROUGHNESSMAP
2741
- vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2742
- #endif
2743
- #ifdef USE_SPECULARMAP
2744
- vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2745
- #endif
2746
- #ifdef USE_SPECULAR_COLORMAP
2747
- vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2748
- #endif
2749
- #ifdef USE_SPECULAR_INTENSITYMAP
2750
- vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2751
- #endif
2752
- #ifdef USE_TRANSMISSIONMAP
2753
- vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2754
- #endif
2755
- #ifdef USE_THICKNESSMAP
2756
- vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2757
- #endif`,ep=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2758
- vec4 worldPosition = vec4( transformed, 1.0 );
2759
- #ifdef USE_BATCHING
2760
- worldPosition = batchingMatrix * worldPosition;
2761
- #endif
2762
- #ifdef USE_INSTANCING
2763
- worldPosition = instanceMatrix * worldPosition;
2764
- #endif
2765
- worldPosition = modelMatrix * worldPosition;
2766
- #endif`;const tp=`varying vec2 vUv;
2767
- uniform mat3 uvTransform;
2768
- void main() {
2769
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2770
- gl_Position = vec4( position.xy, 1.0, 1.0 );
2771
- }`,np=`uniform sampler2D t2D;
2772
- uniform float backgroundIntensity;
2773
- varying vec2 vUv;
2774
- void main() {
2775
- vec4 texColor = texture2D( t2D, vUv );
2776
- #ifdef DECODE_VIDEO_TEXTURE
2777
- texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2778
- #endif
2779
- texColor.rgb *= backgroundIntensity;
2780
- gl_FragColor = texColor;
2781
- #include <tonemapping_fragment>
2782
- #include <colorspace_fragment>
2783
- }`,ip=`varying vec3 vWorldDirection;
2784
- #include <common>
2785
- void main() {
2786
- vWorldDirection = transformDirection( position, modelMatrix );
2787
- #include <begin_vertex>
2788
- #include <project_vertex>
2789
- gl_Position.z = gl_Position.w;
2790
- }`,rp=`#ifdef ENVMAP_TYPE_CUBE
2791
- uniform samplerCube envMap;
2792
- #elif defined( ENVMAP_TYPE_CUBE_UV )
2793
- uniform sampler2D envMap;
2794
- #endif
2795
- uniform float backgroundBlurriness;
2796
- uniform float backgroundIntensity;
2797
- uniform mat3 backgroundRotation;
2798
- varying vec3 vWorldDirection;
2799
- #include <cube_uv_reflection_fragment>
2800
- void main() {
2801
- #ifdef ENVMAP_TYPE_CUBE
2802
- vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2803
- #elif defined( ENVMAP_TYPE_CUBE_UV )
2804
- vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2805
- #else
2806
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2807
- #endif
2808
- texColor.rgb *= backgroundIntensity;
2809
- gl_FragColor = texColor;
2810
- #include <tonemapping_fragment>
2811
- #include <colorspace_fragment>
2812
- }`,ap=`varying vec3 vWorldDirection;
2813
- #include <common>
2814
- void main() {
2815
- vWorldDirection = transformDirection( position, modelMatrix );
2816
- #include <begin_vertex>
2817
- #include <project_vertex>
2818
- gl_Position.z = gl_Position.w;
2819
- }`,op=`uniform samplerCube tCube;
2820
- uniform float tFlip;
2821
- uniform float opacity;
2822
- varying vec3 vWorldDirection;
2823
- void main() {
2824
- vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2825
- gl_FragColor = texColor;
2826
- gl_FragColor.a *= opacity;
2827
- #include <tonemapping_fragment>
2828
- #include <colorspace_fragment>
2829
- }`,sp=`#include <common>
2830
- #include <batching_pars_vertex>
2831
- #include <uv_pars_vertex>
2832
- #include <displacementmap_pars_vertex>
2833
- #include <morphtarget_pars_vertex>
2834
- #include <skinning_pars_vertex>
2835
- #include <logdepthbuf_pars_vertex>
2836
- #include <clipping_planes_pars_vertex>
2837
- varying vec2 vHighPrecisionZW;
2838
- void main() {
2839
- #include <uv_vertex>
2840
- #include <batching_vertex>
2841
- #include <skinbase_vertex>
2842
- #include <morphinstance_vertex>
2843
- #ifdef USE_DISPLACEMENTMAP
2844
- #include <beginnormal_vertex>
2845
- #include <morphnormal_vertex>
2846
- #include <skinnormal_vertex>
2847
- #endif
2848
- #include <begin_vertex>
2849
- #include <morphtarget_vertex>
2850
- #include <skinning_vertex>
2851
- #include <displacementmap_vertex>
2852
- #include <project_vertex>
2853
- #include <logdepthbuf_vertex>
2854
- #include <clipping_planes_vertex>
2855
- vHighPrecisionZW = gl_Position.zw;
2856
- }`,lp=`#if DEPTH_PACKING == 3200
2857
- uniform float opacity;
2858
- #endif
2859
- #include <common>
2860
- #include <packing>
2861
- #include <uv_pars_fragment>
2862
- #include <map_pars_fragment>
2863
- #include <alphamap_pars_fragment>
2864
- #include <alphatest_pars_fragment>
2865
- #include <alphahash_pars_fragment>
2866
- #include <logdepthbuf_pars_fragment>
2867
- #include <clipping_planes_pars_fragment>
2868
- varying vec2 vHighPrecisionZW;
2869
- void main() {
2870
- vec4 diffuseColor = vec4( 1.0 );
2871
- #include <clipping_planes_fragment>
2872
- #if DEPTH_PACKING == 3200
2873
- diffuseColor.a = opacity;
2874
- #endif
2875
- #include <map_fragment>
2876
- #include <alphamap_fragment>
2877
- #include <alphatest_fragment>
2878
- #include <alphahash_fragment>
2879
- #include <logdepthbuf_fragment>
2880
- #ifdef USE_REVERSED_DEPTH_BUFFER
2881
- float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2882
- #else
2883
- float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2884
- #endif
2885
- #if DEPTH_PACKING == 3200
2886
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2887
- #elif DEPTH_PACKING == 3201
2888
- gl_FragColor = packDepthToRGBA( fragCoordZ );
2889
- #elif DEPTH_PACKING == 3202
2890
- gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2891
- #elif DEPTH_PACKING == 3203
2892
- gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2893
- #endif
2894
- }`,cp=`#define DISTANCE
2895
- varying vec3 vWorldPosition;
2896
- #include <common>
2897
- #include <batching_pars_vertex>
2898
- #include <uv_pars_vertex>
2899
- #include <displacementmap_pars_vertex>
2900
- #include <morphtarget_pars_vertex>
2901
- #include <skinning_pars_vertex>
2902
- #include <clipping_planes_pars_vertex>
2903
- void main() {
2904
- #include <uv_vertex>
2905
- #include <batching_vertex>
2906
- #include <skinbase_vertex>
2907
- #include <morphinstance_vertex>
2908
- #ifdef USE_DISPLACEMENTMAP
2909
- #include <beginnormal_vertex>
2910
- #include <morphnormal_vertex>
2911
- #include <skinnormal_vertex>
2912
- #endif
2913
- #include <begin_vertex>
2914
- #include <morphtarget_vertex>
2915
- #include <skinning_vertex>
2916
- #include <displacementmap_vertex>
2917
- #include <project_vertex>
2918
- #include <worldpos_vertex>
2919
- #include <clipping_planes_vertex>
2920
- vWorldPosition = worldPosition.xyz;
2921
- }`,fp=`#define DISTANCE
2922
- uniform vec3 referencePosition;
2923
- uniform float nearDistance;
2924
- uniform float farDistance;
2925
- varying vec3 vWorldPosition;
2926
- #include <common>
2927
- #include <uv_pars_fragment>
2928
- #include <map_pars_fragment>
2929
- #include <alphamap_pars_fragment>
2930
- #include <alphatest_pars_fragment>
2931
- #include <alphahash_pars_fragment>
2932
- #include <clipping_planes_pars_fragment>
2933
- void main() {
2934
- vec4 diffuseColor = vec4( 1.0 );
2935
- #include <clipping_planes_fragment>
2936
- #include <map_fragment>
2937
- #include <alphamap_fragment>
2938
- #include <alphatest_fragment>
2939
- #include <alphahash_fragment>
2940
- float dist = length( vWorldPosition - referencePosition );
2941
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2942
- dist = saturate( dist );
2943
- gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2944
- }`,dp=`varying vec3 vWorldDirection;
2945
- #include <common>
2946
- void main() {
2947
- vWorldDirection = transformDirection( position, modelMatrix );
2948
- #include <begin_vertex>
2949
- #include <project_vertex>
2950
- }`,up=`uniform sampler2D tEquirect;
2951
- varying vec3 vWorldDirection;
2952
- #include <common>
2953
- void main() {
2954
- vec3 direction = normalize( vWorldDirection );
2955
- vec2 sampleUV = equirectUv( direction );
2956
- gl_FragColor = texture2D( tEquirect, sampleUV );
2957
- #include <tonemapping_fragment>
2958
- #include <colorspace_fragment>
2959
- }`,pp=`uniform float scale;
2960
- attribute float lineDistance;
2961
- varying float vLineDistance;
2962
- #include <common>
2963
- #include <uv_pars_vertex>
2964
- #include <color_pars_vertex>
2965
- #include <fog_pars_vertex>
2966
- #include <morphtarget_pars_vertex>
2967
- #include <logdepthbuf_pars_vertex>
2968
- #include <clipping_planes_pars_vertex>
2969
- void main() {
2970
- vLineDistance = scale * lineDistance;
2971
- #include <uv_vertex>
2972
- #include <color_vertex>
2973
- #include <morphinstance_vertex>
2974
- #include <morphcolor_vertex>
2975
- #include <begin_vertex>
2976
- #include <morphtarget_vertex>
2977
- #include <project_vertex>
2978
- #include <logdepthbuf_vertex>
2979
- #include <clipping_planes_vertex>
2980
- #include <fog_vertex>
2981
- }`,hp=`uniform vec3 diffuse;
2982
- uniform float opacity;
2983
- uniform float dashSize;
2984
- uniform float totalSize;
2985
- varying float vLineDistance;
2986
- #include <common>
2987
- #include <color_pars_fragment>
2988
- #include <uv_pars_fragment>
2989
- #include <map_pars_fragment>
2990
- #include <fog_pars_fragment>
2991
- #include <logdepthbuf_pars_fragment>
2992
- #include <clipping_planes_pars_fragment>
2993
- void main() {
2994
- vec4 diffuseColor = vec4( diffuse, opacity );
2995
- #include <clipping_planes_fragment>
2996
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
2997
- discard;
2998
- }
2999
- vec3 outgoingLight = vec3( 0.0 );
3000
- #include <logdepthbuf_fragment>
3001
- #include <map_fragment>
3002
- #include <color_fragment>
3003
- outgoingLight = diffuseColor.rgb;
3004
- #include <opaque_fragment>
3005
- #include <tonemapping_fragment>
3006
- #include <colorspace_fragment>
3007
- #include <fog_fragment>
3008
- #include <premultiplied_alpha_fragment>
3009
- }`,mp=`#include <common>
3010
- #include <batching_pars_vertex>
3011
- #include <uv_pars_vertex>
3012
- #include <envmap_pars_vertex>
3013
- #include <color_pars_vertex>
3014
- #include <fog_pars_vertex>
3015
- #include <morphtarget_pars_vertex>
3016
- #include <skinning_pars_vertex>
3017
- #include <logdepthbuf_pars_vertex>
3018
- #include <clipping_planes_pars_vertex>
3019
- void main() {
3020
- #include <uv_vertex>
3021
- #include <color_vertex>
3022
- #include <morphinstance_vertex>
3023
- #include <morphcolor_vertex>
3024
- #include <batching_vertex>
3025
- #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
3026
- #include <beginnormal_vertex>
3027
- #include <morphnormal_vertex>
3028
- #include <skinbase_vertex>
3029
- #include <skinnormal_vertex>
3030
- #include <defaultnormal_vertex>
3031
- #endif
3032
- #include <begin_vertex>
3033
- #include <morphtarget_vertex>
3034
- #include <skinning_vertex>
3035
- #include <project_vertex>
3036
- #include <logdepthbuf_vertex>
3037
- #include <clipping_planes_vertex>
3038
- #include <worldpos_vertex>
3039
- #include <envmap_vertex>
3040
- #include <fog_vertex>
3041
- }`,_p=`uniform vec3 diffuse;
3042
- uniform float opacity;
3043
- #ifndef FLAT_SHADED
3044
- varying vec3 vNormal;
3045
- #endif
3046
- #include <common>
3047
- #include <dithering_pars_fragment>
3048
- #include <color_pars_fragment>
3049
- #include <uv_pars_fragment>
3050
- #include <map_pars_fragment>
3051
- #include <alphamap_pars_fragment>
3052
- #include <alphatest_pars_fragment>
3053
- #include <alphahash_pars_fragment>
3054
- #include <aomap_pars_fragment>
3055
- #include <lightmap_pars_fragment>
3056
- #include <envmap_common_pars_fragment>
3057
- #include <envmap_pars_fragment>
3058
- #include <fog_pars_fragment>
3059
- #include <specularmap_pars_fragment>
3060
- #include <logdepthbuf_pars_fragment>
3061
- #include <clipping_planes_pars_fragment>
3062
- void main() {
3063
- vec4 diffuseColor = vec4( diffuse, opacity );
3064
- #include <clipping_planes_fragment>
3065
- #include <logdepthbuf_fragment>
3066
- #include <map_fragment>
3067
- #include <color_fragment>
3068
- #include <alphamap_fragment>
3069
- #include <alphatest_fragment>
3070
- #include <alphahash_fragment>
3071
- #include <specularmap_fragment>
3072
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3073
- #ifdef USE_LIGHTMAP
3074
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3075
- reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3076
- #else
3077
- reflectedLight.indirectDiffuse += vec3( 1.0 );
3078
- #endif
3079
- #include <aomap_fragment>
3080
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3081
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
3082
- #include <envmap_fragment>
3083
- #include <opaque_fragment>
3084
- #include <tonemapping_fragment>
3085
- #include <colorspace_fragment>
3086
- #include <fog_fragment>
3087
- #include <premultiplied_alpha_fragment>
3088
- #include <dithering_fragment>
3089
- }`,gp=`#define LAMBERT
3090
- varying vec3 vViewPosition;
3091
- #include <common>
3092
- #include <batching_pars_vertex>
3093
- #include <uv_pars_vertex>
3094
- #include <displacementmap_pars_vertex>
3095
- #include <envmap_pars_vertex>
3096
- #include <color_pars_vertex>
3097
- #include <fog_pars_vertex>
3098
- #include <normal_pars_vertex>
3099
- #include <morphtarget_pars_vertex>
3100
- #include <skinning_pars_vertex>
3101
- #include <shadowmap_pars_vertex>
3102
- #include <logdepthbuf_pars_vertex>
3103
- #include <clipping_planes_pars_vertex>
3104
- void main() {
3105
- #include <uv_vertex>
3106
- #include <color_vertex>
3107
- #include <morphinstance_vertex>
3108
- #include <morphcolor_vertex>
3109
- #include <batching_vertex>
3110
- #include <beginnormal_vertex>
3111
- #include <morphnormal_vertex>
3112
- #include <skinbase_vertex>
3113
- #include <skinnormal_vertex>
3114
- #include <defaultnormal_vertex>
3115
- #include <normal_vertex>
3116
- #include <begin_vertex>
3117
- #include <morphtarget_vertex>
3118
- #include <skinning_vertex>
3119
- #include <displacementmap_vertex>
3120
- #include <project_vertex>
3121
- #include <logdepthbuf_vertex>
3122
- #include <clipping_planes_vertex>
3123
- vViewPosition = - mvPosition.xyz;
3124
- #include <worldpos_vertex>
3125
- #include <envmap_vertex>
3126
- #include <shadowmap_vertex>
3127
- #include <fog_vertex>
3128
- }`,vp=`#define LAMBERT
3129
- uniform vec3 diffuse;
3130
- uniform vec3 emissive;
3131
- uniform float opacity;
3132
- #include <common>
3133
- #include <dithering_pars_fragment>
3134
- #include <color_pars_fragment>
3135
- #include <uv_pars_fragment>
3136
- #include <map_pars_fragment>
3137
- #include <alphamap_pars_fragment>
3138
- #include <alphatest_pars_fragment>
3139
- #include <alphahash_pars_fragment>
3140
- #include <aomap_pars_fragment>
3141
- #include <lightmap_pars_fragment>
3142
- #include <emissivemap_pars_fragment>
3143
- #include <cube_uv_reflection_fragment>
3144
- #include <envmap_common_pars_fragment>
3145
- #include <envmap_pars_fragment>
3146
- #include <envmap_physical_pars_fragment>
3147
- #include <fog_pars_fragment>
3148
- #include <bsdfs>
3149
- #include <lights_pars_begin>
3150
- #include <normal_pars_fragment>
3151
- #include <lights_lambert_pars_fragment>
3152
- #include <shadowmap_pars_fragment>
3153
- #include <bumpmap_pars_fragment>
3154
- #include <normalmap_pars_fragment>
3155
- #include <specularmap_pars_fragment>
3156
- #include <logdepthbuf_pars_fragment>
3157
- #include <clipping_planes_pars_fragment>
3158
- void main() {
3159
- vec4 diffuseColor = vec4( diffuse, opacity );
3160
- #include <clipping_planes_fragment>
3161
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3162
- vec3 totalEmissiveRadiance = emissive;
3163
- #include <logdepthbuf_fragment>
3164
- #include <map_fragment>
3165
- #include <color_fragment>
3166
- #include <alphamap_fragment>
3167
- #include <alphatest_fragment>
3168
- #include <alphahash_fragment>
3169
- #include <specularmap_fragment>
3170
- #include <normal_fragment_begin>
3171
- #include <normal_fragment_maps>
3172
- #include <emissivemap_fragment>
3173
- #include <lights_lambert_fragment>
3174
- #include <lights_fragment_begin>
3175
- #include <lights_fragment_maps>
3176
- #include <lights_fragment_end>
3177
- #include <aomap_fragment>
3178
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3179
- #include <envmap_fragment>
3180
- #include <opaque_fragment>
3181
- #include <tonemapping_fragment>
3182
- #include <colorspace_fragment>
3183
- #include <fog_fragment>
3184
- #include <premultiplied_alpha_fragment>
3185
- #include <dithering_fragment>
3186
- }`,Sp=`#define MATCAP
3187
- varying vec3 vViewPosition;
3188
- #include <common>
3189
- #include <batching_pars_vertex>
3190
- #include <uv_pars_vertex>
3191
- #include <color_pars_vertex>
3192
- #include <displacementmap_pars_vertex>
3193
- #include <fog_pars_vertex>
3194
- #include <normal_pars_vertex>
3195
- #include <morphtarget_pars_vertex>
3196
- #include <skinning_pars_vertex>
3197
- #include <logdepthbuf_pars_vertex>
3198
- #include <clipping_planes_pars_vertex>
3199
- void main() {
3200
- #include <uv_vertex>
3201
- #include <color_vertex>
3202
- #include <morphinstance_vertex>
3203
- #include <morphcolor_vertex>
3204
- #include <batching_vertex>
3205
- #include <beginnormal_vertex>
3206
- #include <morphnormal_vertex>
3207
- #include <skinbase_vertex>
3208
- #include <skinnormal_vertex>
3209
- #include <defaultnormal_vertex>
3210
- #include <normal_vertex>
3211
- #include <begin_vertex>
3212
- #include <morphtarget_vertex>
3213
- #include <skinning_vertex>
3214
- #include <displacementmap_vertex>
3215
- #include <project_vertex>
3216
- #include <logdepthbuf_vertex>
3217
- #include <clipping_planes_vertex>
3218
- #include <fog_vertex>
3219
- vViewPosition = - mvPosition.xyz;
3220
- }`,Ep=`#define MATCAP
3221
- uniform vec3 diffuse;
3222
- uniform float opacity;
3223
- uniform sampler2D matcap;
3224
- varying vec3 vViewPosition;
3225
- #include <common>
3226
- #include <dithering_pars_fragment>
3227
- #include <color_pars_fragment>
3228
- #include <uv_pars_fragment>
3229
- #include <map_pars_fragment>
3230
- #include <alphamap_pars_fragment>
3231
- #include <alphatest_pars_fragment>
3232
- #include <alphahash_pars_fragment>
3233
- #include <fog_pars_fragment>
3234
- #include <normal_pars_fragment>
3235
- #include <bumpmap_pars_fragment>
3236
- #include <normalmap_pars_fragment>
3237
- #include <logdepthbuf_pars_fragment>
3238
- #include <clipping_planes_pars_fragment>
3239
- void main() {
3240
- vec4 diffuseColor = vec4( diffuse, opacity );
3241
- #include <clipping_planes_fragment>
3242
- #include <logdepthbuf_fragment>
3243
- #include <map_fragment>
3244
- #include <color_fragment>
3245
- #include <alphamap_fragment>
3246
- #include <alphatest_fragment>
3247
- #include <alphahash_fragment>
3248
- #include <normal_fragment_begin>
3249
- #include <normal_fragment_maps>
3250
- vec3 viewDir = normalize( vViewPosition );
3251
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3252
- vec3 y = cross( viewDir, x );
3253
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3254
- #ifdef USE_MATCAP
3255
- vec4 matcapColor = texture2D( matcap, uv );
3256
- #else
3257
- vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3258
- #endif
3259
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3260
- #include <opaque_fragment>
3261
- #include <tonemapping_fragment>
3262
- #include <colorspace_fragment>
3263
- #include <fog_fragment>
3264
- #include <premultiplied_alpha_fragment>
3265
- #include <dithering_fragment>
3266
- }`,Mp=`#define NORMAL
3267
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3268
- varying vec3 vViewPosition;
3269
- #endif
3270
- #include <common>
3271
- #include <batching_pars_vertex>
3272
- #include <uv_pars_vertex>
3273
- #include <displacementmap_pars_vertex>
3274
- #include <normal_pars_vertex>
3275
- #include <morphtarget_pars_vertex>
3276
- #include <skinning_pars_vertex>
3277
- #include <logdepthbuf_pars_vertex>
3278
- #include <clipping_planes_pars_vertex>
3279
- void main() {
3280
- #include <uv_vertex>
3281
- #include <batching_vertex>
3282
- #include <beginnormal_vertex>
3283
- #include <morphinstance_vertex>
3284
- #include <morphnormal_vertex>
3285
- #include <skinbase_vertex>
3286
- #include <skinnormal_vertex>
3287
- #include <defaultnormal_vertex>
3288
- #include <normal_vertex>
3289
- #include <begin_vertex>
3290
- #include <morphtarget_vertex>
3291
- #include <skinning_vertex>
3292
- #include <displacementmap_vertex>
3293
- #include <project_vertex>
3294
- #include <logdepthbuf_vertex>
3295
- #include <clipping_planes_vertex>
3296
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3297
- vViewPosition = - mvPosition.xyz;
3298
- #endif
3299
- }`,xp=`#define NORMAL
3300
- uniform float opacity;
3301
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3302
- varying vec3 vViewPosition;
3303
- #endif
3304
- #include <uv_pars_fragment>
3305
- #include <normal_pars_fragment>
3306
- #include <bumpmap_pars_fragment>
3307
- #include <normalmap_pars_fragment>
3308
- #include <logdepthbuf_pars_fragment>
3309
- #include <clipping_planes_pars_fragment>
3310
- void main() {
3311
- vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3312
- #include <clipping_planes_fragment>
3313
- #include <logdepthbuf_fragment>
3314
- #include <normal_fragment_begin>
3315
- #include <normal_fragment_maps>
3316
- gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3317
- #ifdef OPAQUE
3318
- gl_FragColor.a = 1.0;
3319
- #endif
3320
- }`,Tp=`#define PHONG
3321
- varying vec3 vViewPosition;
3322
- #include <common>
3323
- #include <batching_pars_vertex>
3324
- #include <uv_pars_vertex>
3325
- #include <displacementmap_pars_vertex>
3326
- #include <envmap_pars_vertex>
3327
- #include <color_pars_vertex>
3328
- #include <fog_pars_vertex>
3329
- #include <normal_pars_vertex>
3330
- #include <morphtarget_pars_vertex>
3331
- #include <skinning_pars_vertex>
3332
- #include <shadowmap_pars_vertex>
3333
- #include <logdepthbuf_pars_vertex>
3334
- #include <clipping_planes_pars_vertex>
3335
- void main() {
3336
- #include <uv_vertex>
3337
- #include <color_vertex>
3338
- #include <morphcolor_vertex>
3339
- #include <batching_vertex>
3340
- #include <beginnormal_vertex>
3341
- #include <morphinstance_vertex>
3342
- #include <morphnormal_vertex>
3343
- #include <skinbase_vertex>
3344
- #include <skinnormal_vertex>
3345
- #include <defaultnormal_vertex>
3346
- #include <normal_vertex>
3347
- #include <begin_vertex>
3348
- #include <morphtarget_vertex>
3349
- #include <skinning_vertex>
3350
- #include <displacementmap_vertex>
3351
- #include <project_vertex>
3352
- #include <logdepthbuf_vertex>
3353
- #include <clipping_planes_vertex>
3354
- vViewPosition = - mvPosition.xyz;
3355
- #include <worldpos_vertex>
3356
- #include <envmap_vertex>
3357
- #include <shadowmap_vertex>
3358
- #include <fog_vertex>
3359
- }`,Ap=`#define PHONG
3360
- uniform vec3 diffuse;
3361
- uniform vec3 emissive;
3362
- uniform vec3 specular;
3363
- uniform float shininess;
3364
- uniform float opacity;
3365
- #include <common>
3366
- #include <dithering_pars_fragment>
3367
- #include <color_pars_fragment>
3368
- #include <uv_pars_fragment>
3369
- #include <map_pars_fragment>
3370
- #include <alphamap_pars_fragment>
3371
- #include <alphatest_pars_fragment>
3372
- #include <alphahash_pars_fragment>
3373
- #include <aomap_pars_fragment>
3374
- #include <lightmap_pars_fragment>
3375
- #include <emissivemap_pars_fragment>
3376
- #include <cube_uv_reflection_fragment>
3377
- #include <envmap_common_pars_fragment>
3378
- #include <envmap_pars_fragment>
3379
- #include <envmap_physical_pars_fragment>
3380
- #include <fog_pars_fragment>
3381
- #include <bsdfs>
3382
- #include <lights_pars_begin>
3383
- #include <normal_pars_fragment>
3384
- #include <lights_phong_pars_fragment>
3385
- #include <shadowmap_pars_fragment>
3386
- #include <bumpmap_pars_fragment>
3387
- #include <normalmap_pars_fragment>
3388
- #include <specularmap_pars_fragment>
3389
- #include <logdepthbuf_pars_fragment>
3390
- #include <clipping_planes_pars_fragment>
3391
- void main() {
3392
- vec4 diffuseColor = vec4( diffuse, opacity );
3393
- #include <clipping_planes_fragment>
3394
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3395
- vec3 totalEmissiveRadiance = emissive;
3396
- #include <logdepthbuf_fragment>
3397
- #include <map_fragment>
3398
- #include <color_fragment>
3399
- #include <alphamap_fragment>
3400
- #include <alphatest_fragment>
3401
- #include <alphahash_fragment>
3402
- #include <specularmap_fragment>
3403
- #include <normal_fragment_begin>
3404
- #include <normal_fragment_maps>
3405
- #include <emissivemap_fragment>
3406
- #include <lights_phong_fragment>
3407
- #include <lights_fragment_begin>
3408
- #include <lights_fragment_maps>
3409
- #include <lights_fragment_end>
3410
- #include <aomap_fragment>
3411
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3412
- #include <envmap_fragment>
3413
- #include <opaque_fragment>
3414
- #include <tonemapping_fragment>
3415
- #include <colorspace_fragment>
3416
- #include <fog_fragment>
3417
- #include <premultiplied_alpha_fragment>
3418
- #include <dithering_fragment>
3419
- }`,Rp=`#define STANDARD
3420
- varying vec3 vViewPosition;
3421
- #ifdef USE_TRANSMISSION
3422
- varying vec3 vWorldPosition;
3423
- #endif
3424
- #include <common>
3425
- #include <batching_pars_vertex>
3426
- #include <uv_pars_vertex>
3427
- #include <displacementmap_pars_vertex>
3428
- #include <color_pars_vertex>
3429
- #include <fog_pars_vertex>
3430
- #include <normal_pars_vertex>
3431
- #include <morphtarget_pars_vertex>
3432
- #include <skinning_pars_vertex>
3433
- #include <shadowmap_pars_vertex>
3434
- #include <logdepthbuf_pars_vertex>
3435
- #include <clipping_planes_pars_vertex>
3436
- void main() {
3437
- #include <uv_vertex>
3438
- #include <color_vertex>
3439
- #include <morphinstance_vertex>
3440
- #include <morphcolor_vertex>
3441
- #include <batching_vertex>
3442
- #include <beginnormal_vertex>
3443
- #include <morphnormal_vertex>
3444
- #include <skinbase_vertex>
3445
- #include <skinnormal_vertex>
3446
- #include <defaultnormal_vertex>
3447
- #include <normal_vertex>
3448
- #include <begin_vertex>
3449
- #include <morphtarget_vertex>
3450
- #include <skinning_vertex>
3451
- #include <displacementmap_vertex>
3452
- #include <project_vertex>
3453
- #include <logdepthbuf_vertex>
3454
- #include <clipping_planes_vertex>
3455
- vViewPosition = - mvPosition.xyz;
3456
- #include <worldpos_vertex>
3457
- #include <shadowmap_vertex>
3458
- #include <fog_vertex>
3459
- #ifdef USE_TRANSMISSION
3460
- vWorldPosition = worldPosition.xyz;
3461
- #endif
3462
- }`,bp=`#define STANDARD
3463
- #ifdef PHYSICAL
3464
- #define IOR
3465
- #define USE_SPECULAR
3466
- #endif
3467
- uniform vec3 diffuse;
3468
- uniform vec3 emissive;
3469
- uniform float roughness;
3470
- uniform float metalness;
3471
- uniform float opacity;
3472
- #ifdef IOR
3473
- uniform float ior;
3474
- #endif
3475
- #ifdef USE_SPECULAR
3476
- uniform float specularIntensity;
3477
- uniform vec3 specularColor;
3478
- #ifdef USE_SPECULAR_COLORMAP
3479
- uniform sampler2D specularColorMap;
3480
- #endif
3481
- #ifdef USE_SPECULAR_INTENSITYMAP
3482
- uniform sampler2D specularIntensityMap;
3483
- #endif
3484
- #endif
3485
- #ifdef USE_CLEARCOAT
3486
- uniform float clearcoat;
3487
- uniform float clearcoatRoughness;
3488
- #endif
3489
- #ifdef USE_DISPERSION
3490
- uniform float dispersion;
3491
- #endif
3492
- #ifdef USE_RETROREFLECTION
3493
- uniform float retroreflectivity;
3494
- #endif
3495
- #ifdef USE_IRIDESCENCE
3496
- uniform float iridescence;
3497
- uniform float iridescenceIOR;
3498
- uniform float iridescenceThicknessMinimum;
3499
- uniform float iridescenceThicknessMaximum;
3500
- #endif
3501
- #ifdef USE_SHEEN
3502
- uniform vec3 sheenColor;
3503
- uniform float sheenRoughness;
3504
- #ifdef USE_SHEEN_COLORMAP
3505
- uniform sampler2D sheenColorMap;
3506
- #endif
3507
- #ifdef USE_SHEEN_ROUGHNESSMAP
3508
- uniform sampler2D sheenRoughnessMap;
3509
- #endif
3510
- #endif
3511
- #ifdef USE_ANISOTROPY
3512
- uniform vec2 anisotropyVector;
3513
- #ifdef USE_ANISOTROPYMAP
3514
- uniform sampler2D anisotropyMap;
3515
- #endif
3516
- #endif
3517
- varying vec3 vViewPosition;
3518
- #include <common>
3519
- #include <dithering_pars_fragment>
3520
- #include <color_pars_fragment>
3521
- #include <uv_pars_fragment>
3522
- #include <map_pars_fragment>
3523
- #include <alphamap_pars_fragment>
3524
- #include <alphatest_pars_fragment>
3525
- #include <alphahash_pars_fragment>
3526
- #include <aomap_pars_fragment>
3527
- #include <lightmap_pars_fragment>
3528
- #include <emissivemap_pars_fragment>
3529
- #include <iridescence_fragment>
3530
- #include <cube_uv_reflection_fragment>
3531
- #include <envmap_common_pars_fragment>
3532
- #include <envmap_physical_pars_fragment>
3533
- #include <fog_pars_fragment>
3534
- #include <lights_pars_begin>
3535
- #include <normal_pars_fragment>
3536
- #include <lights_physical_pars_fragment>
3537
- #include <transmission_pars_fragment>
3538
- #include <shadowmap_pars_fragment>
3539
- #include <bumpmap_pars_fragment>
3540
- #include <normalmap_pars_fragment>
3541
- #include <clearcoat_pars_fragment>
3542
- #include <iridescence_pars_fragment>
3543
- #include <roughnessmap_pars_fragment>
3544
- #include <metalnessmap_pars_fragment>
3545
- #include <logdepthbuf_pars_fragment>
3546
- #include <clipping_planes_pars_fragment>
3547
- void main() {
3548
- vec4 diffuseColor = vec4( diffuse, opacity );
3549
- #include <clipping_planes_fragment>
3550
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3551
- vec3 totalEmissiveRadiance = emissive;
3552
- #include <logdepthbuf_fragment>
3553
- #include <map_fragment>
3554
- #include <color_fragment>
3555
- #include <alphamap_fragment>
3556
- #include <alphatest_fragment>
3557
- #include <alphahash_fragment>
3558
- #include <roughnessmap_fragment>
3559
- #include <metalnessmap_fragment>
3560
- #include <normal_fragment_begin>
3561
- #include <normal_fragment_maps>
3562
- #include <clearcoat_normal_fragment_begin>
3563
- #include <clearcoat_normal_fragment_maps>
3564
- #include <emissivemap_fragment>
3565
- #include <lights_physical_fragment>
3566
- #include <lights_fragment_begin>
3567
- #include <lights_fragment_maps>
3568
- #include <lights_fragment_end>
3569
- #include <aomap_fragment>
3570
- vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3571
- vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3572
- #include <transmission_fragment>
3573
- vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3574
- #ifdef USE_SHEEN
3575
-
3576
- outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3577
-
3578
- #endif
3579
- #ifdef USE_CLEARCOAT
3580
- float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3581
- vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3582
- outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3583
- #endif
3584
- #include <opaque_fragment>
3585
- #include <tonemapping_fragment>
3586
- #include <colorspace_fragment>
3587
- #include <fog_fragment>
3588
- #include <premultiplied_alpha_fragment>
3589
- #include <dithering_fragment>
3590
- }`,Cp=`#define TOON
3591
- varying vec3 vViewPosition;
3592
- #include <common>
3593
- #include <batching_pars_vertex>
3594
- #include <uv_pars_vertex>
3595
- #include <displacementmap_pars_vertex>
3596
- #include <color_pars_vertex>
3597
- #include <fog_pars_vertex>
3598
- #include <normal_pars_vertex>
3599
- #include <morphtarget_pars_vertex>
3600
- #include <skinning_pars_vertex>
3601
- #include <shadowmap_pars_vertex>
3602
- #include <logdepthbuf_pars_vertex>
3603
- #include <clipping_planes_pars_vertex>
3604
- void main() {
3605
- #include <uv_vertex>
3606
- #include <color_vertex>
3607
- #include <morphinstance_vertex>
3608
- #include <morphcolor_vertex>
3609
- #include <batching_vertex>
3610
- #include <beginnormal_vertex>
3611
- #include <morphnormal_vertex>
3612
- #include <skinbase_vertex>
3613
- #include <skinnormal_vertex>
3614
- #include <defaultnormal_vertex>
3615
- #include <normal_vertex>
3616
- #include <begin_vertex>
3617
- #include <morphtarget_vertex>
3618
- #include <skinning_vertex>
3619
- #include <displacementmap_vertex>
3620
- #include <project_vertex>
3621
- #include <logdepthbuf_vertex>
3622
- #include <clipping_planes_vertex>
3623
- vViewPosition = - mvPosition.xyz;
3624
- #include <worldpos_vertex>
3625
- #include <shadowmap_vertex>
3626
- #include <fog_vertex>
3627
- }`,Pp=`#define TOON
3628
- uniform vec3 diffuse;
3629
- uniform vec3 emissive;
3630
- uniform float opacity;
3631
- #include <common>
3632
- #include <dithering_pars_fragment>
3633
- #include <color_pars_fragment>
3634
- #include <uv_pars_fragment>
3635
- #include <map_pars_fragment>
3636
- #include <alphamap_pars_fragment>
3637
- #include <alphatest_pars_fragment>
3638
- #include <alphahash_pars_fragment>
3639
- #include <aomap_pars_fragment>
3640
- #include <lightmap_pars_fragment>
3641
- #include <emissivemap_pars_fragment>
3642
- #include <gradientmap_pars_fragment>
3643
- #include <fog_pars_fragment>
3644
- #include <bsdfs>
3645
- #include <lights_pars_begin>
3646
- #include <normal_pars_fragment>
3647
- #include <lights_toon_pars_fragment>
3648
- #include <shadowmap_pars_fragment>
3649
- #include <bumpmap_pars_fragment>
3650
- #include <normalmap_pars_fragment>
3651
- #include <logdepthbuf_pars_fragment>
3652
- #include <clipping_planes_pars_fragment>
3653
- void main() {
3654
- vec4 diffuseColor = vec4( diffuse, opacity );
3655
- #include <clipping_planes_fragment>
3656
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3657
- vec3 totalEmissiveRadiance = emissive;
3658
- #include <logdepthbuf_fragment>
3659
- #include <map_fragment>
3660
- #include <color_fragment>
3661
- #include <alphamap_fragment>
3662
- #include <alphatest_fragment>
3663
- #include <alphahash_fragment>
3664
- #include <normal_fragment_begin>
3665
- #include <normal_fragment_maps>
3666
- #include <emissivemap_fragment>
3667
- #include <lights_toon_fragment>
3668
- #include <lights_fragment_begin>
3669
- #include <lights_fragment_maps>
3670
- #include <lights_fragment_end>
3671
- #include <aomap_fragment>
3672
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3673
- #include <opaque_fragment>
3674
- #include <tonemapping_fragment>
3675
- #include <colorspace_fragment>
3676
- #include <fog_fragment>
3677
- #include <premultiplied_alpha_fragment>
3678
- #include <dithering_fragment>
3679
- }`,Lp=`uniform float size;
3680
- uniform float scale;
3681
- #include <common>
3682
- #include <color_pars_vertex>
3683
- #include <fog_pars_vertex>
3684
- #include <morphtarget_pars_vertex>
3685
- #include <logdepthbuf_pars_vertex>
3686
- #include <clipping_planes_pars_vertex>
3687
- #ifdef USE_POINTS_UV
3688
- varying vec2 vUv;
3689
- uniform mat3 uvTransform;
3690
- #endif
3691
- void main() {
3692
- #ifdef USE_POINTS_UV
3693
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3694
- #endif
3695
- #include <color_vertex>
3696
- #include <morphinstance_vertex>
3697
- #include <morphcolor_vertex>
3698
- #include <begin_vertex>
3699
- #include <morphtarget_vertex>
3700
- #include <project_vertex>
3701
- gl_PointSize = size;
3702
- #ifdef USE_SIZEATTENUATION
3703
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3704
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3705
- #endif
3706
- #include <logdepthbuf_vertex>
3707
- #include <clipping_planes_vertex>
3708
- #include <worldpos_vertex>
3709
- #include <fog_vertex>
3710
- }`,Up=`uniform vec3 diffuse;
3711
- uniform float opacity;
3712
- #include <common>
3713
- #include <color_pars_fragment>
3714
- #include <map_particle_pars_fragment>
3715
- #include <alphatest_pars_fragment>
3716
- #include <alphahash_pars_fragment>
3717
- #include <fog_pars_fragment>
3718
- #include <logdepthbuf_pars_fragment>
3719
- #include <clipping_planes_pars_fragment>
3720
- void main() {
3721
- vec4 diffuseColor = vec4( diffuse, opacity );
3722
- #include <clipping_planes_fragment>
3723
- vec3 outgoingLight = vec3( 0.0 );
3724
- #include <logdepthbuf_fragment>
3725
- #include <map_particle_fragment>
3726
- #include <color_fragment>
3727
- #include <alphatest_fragment>
3728
- #include <alphahash_fragment>
3729
- outgoingLight = diffuseColor.rgb;
3730
- #include <opaque_fragment>
3731
- #include <tonemapping_fragment>
3732
- #include <colorspace_fragment>
3733
- #include <fog_fragment>
3734
- #include <premultiplied_alpha_fragment>
3735
- }`,Dp=`#include <common>
3736
- #include <batching_pars_vertex>
3737
- #include <fog_pars_vertex>
3738
- #include <morphtarget_pars_vertex>
3739
- #include <skinning_pars_vertex>
3740
- #include <logdepthbuf_pars_vertex>
3741
- #include <shadowmap_pars_vertex>
3742
- void main() {
3743
- #include <batching_vertex>
3744
- #include <beginnormal_vertex>
3745
- #include <morphinstance_vertex>
3746
- #include <morphnormal_vertex>
3747
- #include <skinbase_vertex>
3748
- #include <skinnormal_vertex>
3749
- #include <defaultnormal_vertex>
3750
- #include <begin_vertex>
3751
- #include <morphtarget_vertex>
3752
- #include <skinning_vertex>
3753
- #include <project_vertex>
3754
- #include <logdepthbuf_vertex>
3755
- #include <worldpos_vertex>
3756
- #include <shadowmap_vertex>
3757
- #include <fog_vertex>
3758
- }`,wp=`uniform vec3 color;
3759
- uniform float opacity;
3760
- #include <common>
3761
- #include <fog_pars_fragment>
3762
- #include <bsdfs>
3763
- #include <lights_pars_begin>
3764
- #include <logdepthbuf_pars_fragment>
3765
- #include <shadowmap_pars_fragment>
3766
- #include <shadowmask_pars_fragment>
3767
- void main() {
3768
- #include <logdepthbuf_fragment>
3769
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3770
- #include <tonemapping_fragment>
3771
- #include <colorspace_fragment>
3772
- #include <fog_fragment>
3773
- #include <premultiplied_alpha_fragment>
3774
- }`,Ip=`uniform float rotation;
3775
- uniform vec2 center;
3776
- #include <common>
3777
- #include <uv_pars_vertex>
3778
- #include <fog_pars_vertex>
3779
- #include <logdepthbuf_pars_vertex>
3780
- #include <clipping_planes_pars_vertex>
3781
- void main() {
3782
- #include <uv_vertex>
3783
- vec4 mvPosition = modelViewMatrix[ 3 ];
3784
- vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3785
- #ifndef USE_SIZEATTENUATION
3786
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3787
- if ( isPerspective ) scale *= - mvPosition.z;
3788
- #endif
3789
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3790
- vec2 rotatedPosition;
3791
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3792
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3793
- mvPosition.xy += rotatedPosition;
3794
- gl_Position = projectionMatrix * mvPosition;
3795
- #include <logdepthbuf_vertex>
3796
- #include <clipping_planes_vertex>
3797
- #include <fog_vertex>
3798
- }`,Np=`uniform vec3 diffuse;
3799
- uniform float opacity;
3800
- #include <common>
3801
- #include <uv_pars_fragment>
3802
- #include <map_pars_fragment>
3803
- #include <alphamap_pars_fragment>
3804
- #include <alphatest_pars_fragment>
3805
- #include <alphahash_pars_fragment>
3806
- #include <fog_pars_fragment>
3807
- #include <logdepthbuf_pars_fragment>
3808
- #include <clipping_planes_pars_fragment>
3809
- void main() {
3810
- vec4 diffuseColor = vec4( diffuse, opacity );
3811
- #include <clipping_planes_fragment>
3812
- vec3 outgoingLight = vec3( 0.0 );
3813
- #include <logdepthbuf_fragment>
3814
- #include <map_fragment>
3815
- #include <alphamap_fragment>
3816
- #include <alphatest_fragment>
3817
- #include <alphahash_fragment>
3818
- outgoingLight = diffuseColor.rgb;
3819
- #include <opaque_fragment>
3820
- #include <tonemapping_fragment>
3821
- #include <colorspace_fragment>
3822
- #include <fog_fragment>
3823
- }`,Pe={alphahash_fragment:td,alphahash_pars_fragment:nd,alphamap_fragment:id,alphamap_pars_fragment:rd,alphatest_fragment:ad,alphatest_pars_fragment:od,aomap_fragment:sd,aomap_pars_fragment:ld,batching_pars_vertex:cd,batching_vertex:fd,begin_vertex:dd,beginnormal_vertex:ud,bsdfs:pd,iridescence_fragment:hd,bumpmap_pars_fragment:md,clipping_planes_fragment:_d,clipping_planes_pars_fragment:gd,clipping_planes_pars_vertex:vd,clipping_planes_vertex:Sd,color_fragment:Ed,color_pars_fragment:Md,color_pars_vertex:xd,color_vertex:Td,common:Ad,cube_uv_reflection_fragment:Rd,defaultnormal_vertex:bd,displacementmap_pars_vertex:Cd,displacementmap_vertex:Pd,emissivemap_fragment:Ld,emissivemap_pars_fragment:Ud,colorspace_fragment:Dd,colorspace_pars_fragment:wd,envmap_fragment:Id,envmap_common_pars_fragment:Nd,envmap_pars_fragment:yd,envmap_pars_vertex:Fd,envmap_physical_pars_fragment:Yd,envmap_vertex:Od,fog_vertex:Bd,fog_pars_vertex:Gd,fog_fragment:Hd,fog_pars_fragment:Vd,gradientmap_pars_fragment:Wd,lightmap_pars_fragment:kd,lights_lambert_fragment:zd,lights_lambert_pars_fragment:Xd,lights_pars_begin:Kd,lights_toon_fragment:qd,lights_toon_pars_fragment:Zd,lights_phong_fragment:$d,lights_phong_pars_fragment:Qd,lights_physical_fragment:Jd,lights_physical_pars_fragment:jd,lights_fragment_begin:eu,lights_fragment_maps:tu,lights_fragment_end:nu,lightprobes_pars_fragment:iu,logdepthbuf_fragment:ru,logdepthbuf_pars_fragment:au,logdepthbuf_pars_vertex:ou,logdepthbuf_vertex:su,map_fragment:lu,map_pars_fragment:cu,map_particle_fragment:fu,map_particle_pars_fragment:du,metalnessmap_fragment:uu,metalnessmap_pars_fragment:pu,morphinstance_vertex:hu,morphcolor_vertex:mu,morphnormal_vertex:_u,morphtarget_pars_vertex:gu,morphtarget_vertex:vu,normal_fragment_begin:Su,normal_fragment_maps:Eu,normal_pars_fragment:Mu,normal_pars_vertex:xu,normal_vertex:Tu,normalmap_pars_fragment:Au,clearcoat_normal_fragment_begin:Ru,clearcoat_normal_fragment_maps:bu,clearcoat_pars_fragment:Cu,iridescence_pars_fragment:Pu,opaque_fragment:Lu,packing:Uu,premultiplied_alpha_fragment:Du,project_vertex:wu,dithering_fragment:Iu,dithering_pars_fragment:Nu,roughnessmap_fragment:yu,roughnessmap_pars_fragment:Fu,shadowmap_pars_fragment:Ou,shadowmap_pars_vertex:Bu,shadowmap_vertex:Gu,shadowmask_pars_fragment:Hu,skinbase_vertex:Vu,skinning_pars_vertex:Wu,skinning_vertex:ku,skinnormal_vertex:zu,specularmap_fragment:Xu,specularmap_pars_fragment:Ku,tonemapping_fragment:Yu,tonemapping_pars_fragment:qu,transmission_fragment:Zu,transmission_pars_fragment:$u,uv_pars_fragment:Qu,uv_pars_vertex:Ju,uv_vertex:ju,worldpos_vertex:ep,background_vert:tp,background_frag:np,backgroundCube_vert:ip,backgroundCube_frag:rp,cube_vert:ap,cube_frag:op,depth_vert:sp,depth_frag:lp,distance_vert:cp,distance_frag:fp,equirect_vert:dp,equirect_frag:up,linedashed_vert:pp,linedashed_frag:hp,meshbasic_vert:mp,meshbasic_frag:_p,meshlambert_vert:gp,meshlambert_frag:vp,meshmatcap_vert:Sp,meshmatcap_frag:Ep,meshnormal_vert:Mp,meshnormal_frag:xp,meshphong_vert:Tp,meshphong_frag:Ap,meshphysical_vert:Rp,meshphysical_frag:bp,meshtoon_vert:Cp,meshtoon_frag:Pp,points_vert:Lp,points_frag:Up,shadow_vert:Dp,shadow_frag:wp,sprite_vert:Ip,sprite_frag:Np},le={common:{diffuse:{value:new je(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ye},alphaMap:{value:null},alphaMapTransform:{value:new ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ye}},envmap:{envMap:{value:null},envMapRotation:{value:new ye},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ye},normalScale:{value:new mt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ye}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new je(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new Ne},probesMax:{value:new Ne},probesResolution:{value:new Ne}},points:{diffuse:{value:new je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ye},alphaTest:{value:0},uvTransform:{value:new ye}},sprite:{diffuse:{value:new je(16777215)},opacity:{value:1},center:{value:new mt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ye},alphaMap:{value:null},alphaMapTransform:{value:new ye},alphaTest:{value:0}}},Tt={basic:{uniforms:gt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:Pe.meshbasic_vert,fragmentShader:Pe.meshbasic_frag},lambert:{uniforms:gt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new je(0)},envMapIntensity:{value:1}}]),vertexShader:Pe.meshlambert_vert,fragmentShader:Pe.meshlambert_frag},phong:{uniforms:gt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new je(0)},specular:{value:new je(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Pe.meshphong_vert,fragmentShader:Pe.meshphong_frag},standard:{uniforms:gt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pe.meshphysical_vert,fragmentShader:Pe.meshphysical_frag},toon:{uniforms:gt([le.common,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new je(0)}}]),vertexShader:Pe.meshtoon_vert,fragmentShader:Pe.meshtoon_frag},matcap:{uniforms:gt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:Pe.meshmatcap_vert,fragmentShader:Pe.meshmatcap_frag},points:{uniforms:gt([le.points,le.fog]),vertexShader:Pe.points_vert,fragmentShader:Pe.points_frag},dashed:{uniforms:gt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pe.linedashed_vert,fragmentShader:Pe.linedashed_frag},depth:{uniforms:gt([le.common,le.displacementmap]),vertexShader:Pe.depth_vert,fragmentShader:Pe.depth_frag},normal:{uniforms:gt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:Pe.meshnormal_vert,fragmentShader:Pe.meshnormal_frag},sprite:{uniforms:gt([le.sprite,le.fog]),vertexShader:Pe.sprite_vert,fragmentShader:Pe.sprite_frag},background:{uniforms:{uvTransform:{value:new ye},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Pe.background_vert,fragmentShader:Pe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ye}},vertexShader:Pe.backgroundCube_vert,fragmentShader:Pe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pe.cube_vert,fragmentShader:Pe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pe.equirect_vert,fragmentShader:Pe.equirect_frag},distance:{uniforms:gt([le.common,le.displacementmap,{referencePosition:{value:new Ne},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pe.distance_vert,fragmentShader:Pe.distance_frag},shadow:{uniforms:gt([le.lights,le.fog,{color:{value:new je(0)},opacity:{value:1}}]),vertexShader:Pe.shadow_vert,fragmentShader:Pe.shadow_frag}};Tt.physical={uniforms:gt([Tt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ye},clearcoatNormalScale:{value:new mt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ye},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ye},sheen:{value:0},sheenColor:{value:new je(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ye},transmissionSamplerSize:{value:new mt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ye},attenuationDistance:{value:0},attenuationColor:{value:new je(0)},specularColor:{value:new je(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ye},anisotropyVector:{value:new mt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ye}}]),vertexShader:Pe.meshphysical_vert,fragmentShader:Pe.meshphysical_frag};const En={r:0,b:0,g:0},yp=new qt,no=new ye;no.set(-1,0,0,0,1,0,0,0,1);function Fp(e,n,t,i,l,o){const d=new je(0);let g=l===!0?0:1,R,T,H=null,I=0,p=null;function x(L){let z=L.isScene===!0?L.background:null;if(z&&z.isTexture){const h=L.backgroundBlurriness>0;z=n.get(z,h)}return z}function N(L){let z=!1;const h=x(L);h===null?f(d,g):h&&h.isColor&&(f(h,1),z=!0);const S=e.xr.getEnvironmentBlendMode();S==="additive"?t.buffers.color.setClear(0,0,0,1,o):S==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(e.autoClear||z)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function W(L,z){const h=x(z);h&&(h.isCubeTexture||h.mapping===gn)?(T===void 0&&(T=new It(new yn(1,1,1),new Nt({name:"BackgroundCubeMaterial",uniforms:Ii(Tt.backgroundCube.uniforms),vertexShader:Tt.backgroundCube.vertexShader,fragmentShader:Tt.backgroundCube.fragmentShader,side:St,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),T.geometry.deleteAttribute("normal"),T.geometry.deleteAttribute("uv"),T.onBeforeRender=function(S,m,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(T.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(T)),T.material.uniforms.envMap.value=h,T.material.uniforms.backgroundBlurriness.value=z.backgroundBlurriness,T.material.uniforms.backgroundIntensity.value=z.backgroundIntensity,T.material.uniforms.backgroundRotation.value.setFromMatrix4(yp.makeRotationFromEuler(z.backgroundRotation)).transpose(),h.isCubeTexture&&h.isRenderTargetTexture===!1&&T.material.uniforms.backgroundRotation.value.premultiply(no),T.material.toneMapped=tt.getTransfer(h.colorSpace)!==Ye,(H!==h||I!==h.version||p!==e.toneMapping)&&(T.material.needsUpdate=!0,H=h,I=h.version,p=e.toneMapping),T.layers.enableAll(),L.unshift(T,T.geometry,T.material,0,0,null)):h&&h.isTexture&&(R===void 0&&(R=new It(new Ji(2,2),new Nt({name:"BackgroundMaterial",uniforms:Ii(Tt.background.uniforms),vertexShader:Tt.background.vertexShader,fragmentShader:Tt.background.fragmentShader,side:rn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),R.geometry.deleteAttribute("normal"),Object.defineProperty(R.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(R)),R.material.uniforms.t2D.value=h,R.material.uniforms.backgroundIntensity.value=z.backgroundIntensity,R.material.toneMapped=tt.getTransfer(h.colorSpace)!==Ye,h.matrixAutoUpdate===!0&&h.updateMatrix(),R.material.uniforms.uvTransform.value.copy(h.matrix),(H!==h||I!==h.version||p!==e.toneMapping)&&(R.material.needsUpdate=!0,H=h,I=h.version,p=e.toneMapping),R.layers.enableAll(),L.unshift(R,R.geometry,R.material,0,0,null))}function f(L,z){L.getRGB(En,eo(e)),t.buffers.color.setClear(En.r,En.g,En.b,z,o)}function s(){T!==void 0&&(T.geometry.dispose(),T.material.dispose(),T=void 0),R!==void 0&&(R.geometry.dispose(),R.material.dispose(),R=void 0)}return{getClearColor:function(){return d},setClearColor:function(L,z=1){d.set(L),g=z,f(d,g)},getClearAlpha:function(){return g},setClearAlpha:function(L){g=L,f(d,g)},render:N,addToRenderList:W,dispose:s}}function Op(e,n){const t=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},l=p(null);let o=l,d=!1;function g(F,G,q,P,K){let Q=!1;const Y=I(F,P,q,G);o!==Y&&(o=Y,T(o.object)),Q=x(F,P,q,K),Q&&N(F,P,q,K),K!==null&&n.update(K,e.ELEMENT_ARRAY_BUFFER),(Q||d)&&(d=!1,h(F,G,q,P),K!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(K).buffer))}function R(){return e.createVertexArray()}function T(F){return e.bindVertexArray(F)}function H(F){return e.deleteVertexArray(F)}function I(F,G,q,P){const K=P.wireframe===!0;let Q=i[G.id];Q===void 0&&(Q={},i[G.id]=Q);const Y=F.isInstancedMesh===!0?F.id:0;let ne=Q[Y];ne===void 0&&(ne={},Q[Y]=ne);let Z=ne[q.id];Z===void 0&&(Z={},ne[q.id]=Z);let j=Z[K];return j===void 0&&(j=p(R()),Z[K]=j),j}function p(F){const G=[],q=[],P=[];for(let K=0;K<t;K++)G[K]=0,q[K]=0,P[K]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:q,attributeDivisors:P,object:F,attributes:{},index:null}}function x(F,G,q,P){const K=o.attributes,Q=G.attributes;let Y=0;const ne=q.getAttributes();for(const Z in ne)if(ne[Z].location>=0){const ee=K[Z];let be=Q[Z];if(be===void 0&&(Z==="instanceMatrix"&&F.instanceMatrix&&(be=F.instanceMatrix),Z==="instanceColor"&&F.instanceColor&&(be=F.instanceColor)),ee===void 0||ee.attribute!==be||be&&ee.data!==be.data)return!0;Y++}return o.attributesNum!==Y||o.index!==P}function N(F,G,q,P){const K={},Q=G.attributes;let Y=0;const ne=q.getAttributes();for(const Z in ne)if(ne[Z].location>=0){let ee=Q[Z];ee===void 0&&(Z==="instanceMatrix"&&F.instanceMatrix&&(ee=F.instanceMatrix),Z==="instanceColor"&&F.instanceColor&&(ee=F.instanceColor));const be={};be.attribute=ee,ee&&ee.data&&(be.data=ee.data),K[Z]=be,Y++}o.attributes=K,o.attributesNum=Y,o.index=P}function W(){const F=o.newAttributes;for(let G=0,q=F.length;G<q;G++)F[G]=0}function f(F){s(F,0)}function s(F,G){const q=o.newAttributes,P=o.enabledAttributes,K=o.attributeDivisors;q[F]=1,P[F]===0&&(e.enableVertexAttribArray(F),P[F]=1),K[F]!==G&&(e.vertexAttribDivisor(F,G),K[F]=G)}function L(){const F=o.newAttributes,G=o.enabledAttributes;for(let q=0,P=G.length;q<P;q++)G[q]!==F[q]&&(e.disableVertexAttribArray(q),G[q]=0)}function z(F,G,q,P,K,Q,Y){Y===!0?e.vertexAttribIPointer(F,G,q,K,Q):e.vertexAttribPointer(F,G,q,P,K,Q)}function h(F,G,q,P){W();const K=P.attributes,Q=q.getAttributes(),Y=G.defaultAttributeValues;for(const ne in Q){const Z=Q[ne];if(Z.location>=0){let j=K[ne];if(j===void 0&&(ne==="instanceMatrix"&&F.instanceMatrix&&(j=F.instanceMatrix),ne==="instanceColor"&&F.instanceColor&&(j=F.instanceColor)),j!==void 0){const ee=j.normalized,be=j.itemSize,Re=n.get(j);if(Re===void 0)continue;const it=Re.buffer,ke=Re.type,ze=Re.bytesPerElement,V=ke===e.INT||ke===e.UNSIGNED_INT||j.gpuType===Ki;if(j.isInterleavedBufferAttribute){const $=j.data,Ee=$.stride,Ue=j.offset;if($.isInstancedInterleavedBuffer){for(let me=0;me<Z.locationSize;me++)s(Z.location+me,$.meshPerAttribute);F.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let me=0;me<Z.locationSize;me++)f(Z.location+me);e.bindBuffer(e.ARRAY_BUFFER,it);for(let me=0;me<Z.locationSize;me++)z(Z.location+me,be/Z.locationSize,ke,ee,Ee*ze,(Ue+be/Z.locationSize*me)*ze,V)}else{if(j.isInstancedBufferAttribute){for(let $=0;$<Z.locationSize;$++)s(Z.location+$,j.meshPerAttribute);F.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=j.meshPerAttribute*j.count)}else for(let $=0;$<Z.locationSize;$++)f(Z.location+$);e.bindBuffer(e.ARRAY_BUFFER,it);for(let $=0;$<Z.locationSize;$++)z(Z.location+$,be/Z.locationSize,ke,ee,be*ze,be/Z.locationSize*$*ze,V)}}else if(Y!==void 0){const ee=Y[ne];if(ee!==void 0)switch(ee.length){case 2:e.vertexAttrib2fv(Z.location,ee);break;case 3:e.vertexAttrib3fv(Z.location,ee);break;case 4:e.vertexAttrib4fv(Z.location,ee);break;default:e.vertexAttrib1fv(Z.location,ee)}}}}L()}function S(){_();for(const F in i){const G=i[F];for(const q in G){const P=G[q];for(const K in P){const Q=P[K];for(const Y in Q)H(Q[Y].object),delete Q[Y];delete P[K]}}delete i[F]}}function m(F){if(i[F.id]===void 0)return;const G=i[F.id];for(const q in G){const P=G[q];for(const K in P){const Q=P[K];for(const Y in Q)H(Q[Y].object),delete Q[Y];delete P[K]}}delete i[F.id]}function D(F){for(const G in i){const q=i[G];for(const P in q){const K=q[P];if(K[F.id]===void 0)continue;const Q=K[F.id];for(const Y in Q)H(Q[Y].object),delete Q[Y];delete K[F.id]}}}function c(F){for(const G in i){const q=i[G],P=F.isInstancedMesh===!0?F.id:0,K=q[P];if(K!==void 0){for(const Q in K){const Y=K[Q];for(const ne in Y)H(Y[ne].object),delete Y[ne];delete K[Q]}delete q[P],Object.keys(q).length===0&&delete i[G]}}}function _(){w(),d=!0,o!==l&&(o=l,T(o.object))}function w(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:g,reset:_,resetDefaultState:w,dispose:S,releaseStatesOfGeometry:m,releaseStatesOfObject:c,releaseStatesOfProgram:D,initAttributes:W,enableAttribute:f,disableUnusedAttributes:L}}function Bp(e,n,t){let i;function l(R){i=R}function o(R,T){e.drawArrays(i,R,T),t.update(T,i,1)}function d(R,T,H){H!==0&&(e.drawArraysInstanced(i,R,T,H),t.update(T,i,H))}function g(R,T,H){if(H===0)return;n.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,R,0,T,0,H);let p=0;for(let x=0;x<H;x++)p+=T[x];t.update(p,i,1)}this.setMode=l,this.render=o,this.renderInstances=d,this.renderMultiDraw=g}function Gp(e,n,t,i){let l;function o(){if(l!==void 0)return l;if(n.has("EXT_texture_filter_anisotropic")===!0){const D=n.get("EXT_texture_filter_anisotropic");l=e.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else l=0;return l}function d(D){return!(D!==Ut&&i.convert(D)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))}function g(D){const c=D===wt&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return!(D!==At&&D!==yt&&!c&&i.convert(D)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE))}function R(D){if(D==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let T=t.precision!==void 0?t.precision:"highp";const H=R(T);H!==T&&(Ve("WebGLRenderer:",T,"not supported, using",H,"instead."),T=H);const I=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&n.has("EXT_clip_control");t.reversedDepthBuffer===!0&&p===!1&&Ve("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const x=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),N=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),W=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),s=e.getParameter(e.MAX_VERTEX_ATTRIBS),L=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),z=e.getParameter(e.MAX_VARYING_VECTORS),h=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),S=e.getParameter(e.MAX_SAMPLES),m=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:R,textureFormatReadable:d,textureTypeReadable:g,precision:T,logarithmicDepthBuffer:I,reversedDepthBuffer:p,maxTextures:x,maxVertexTextures:N,maxTextureSize:W,maxCubemapSize:f,maxAttributes:s,maxVertexUniforms:L,maxVaryings:z,maxFragmentUniforms:h,maxSamples:S,samples:m}}function Hp(e){const n=this;let t=null,i=0,l=!1,o=!1;const d=new wa,g=new ye,R={value:null,needsUpdate:!1};this.uniform=R,this.numPlanes=0,this.numIntersection=0,this.init=function(I,p){const x=I.length!==0||p||i!==0||l;return l=p,i=I.length,x},this.beginShadows=function(){o=!0,H(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(I,p){t=H(I,p,0)},this.setState=function(I,p,x){const N=I.clippingPlanes,W=I.clipIntersection,f=I.clipShadows,s=e.get(I);if(!l||N===null||N.length===0||o&&!f)o?H(null):T();else{const L=o?0:i,z=L*4;let h=s.clippingState||null;R.value=h,h=H(N,p,z,x);for(let S=0;S!==z;++S)h[S]=t[S];s.clippingState=h,this.numIntersection=W?this.numPlanes:0,this.numPlanes+=L}};function T(){R.value!==t&&(R.value=t,R.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function H(I,p,x,N){const W=I!==null?I.length:0;let f=null;if(W!==0){if(f=R.value,N!==!0||f===null){const s=x+W*4,L=p.matrixWorldInverse;g.getNormalMatrix(L),(f===null||f.length<s)&&(f=new Float32Array(s));for(let z=0,h=x;z!==W;++z,h+=4)d.copy(I[z]).applyMatrix4(L,g),d.normal.toArray(f,h),f[h+3]=d.constant}R.value=f,R.needsUpdate=!0}return n.numPlanes=W,n.numIntersection=0,f}}const tn=4,Vp=6,Wp=20,kp=256,sn=new Qi,gr=new je;let Wn=null,kn=0,zn=0,Xn=!1;const zp=new Ne,Wt=new Ne;class yi{constructor(n){this._renderer=n,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(n,t=0,i=.1,l=100,o={}){const{size:d=256,position:g=zp}=o;Wn=this._renderer.getRenderTarget(),kn=this._renderer.getActiveCubeFace(),zn=this._renderer.getActiveMipmapLevel(),Xn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(d);const R=this._allocateTargets();return R.depthBuffer=!0,this._sceneToCubeUV(n,i,l,R,g),t>0&&this._blur(R,0,0,t),this._applyPMREM(R),this._cleanup(R),R}fromEquirectangular(n,t=null){return this._fromTexture(n,t)}fromCubemap(n,t=null){return this._fromTexture(n,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Er(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Sr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(n){this._lodMax=Math.floor(Math.log2(n)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let n=0;n<this._lodMeshes.length;n++)this._lodMeshes[n].geometry.dispose()}_cleanup(n){this._renderer.setRenderTarget(Wn,kn,zn),this._renderer.xr.enabled=Xn,n.scissorTest=!1,Jt(n,0,0,n.width,n.height)}_fromTexture(n,t){n.mapping===nn||n.mapping===Kt?this._setSize(n.image.length===0?16:n.image[0].width||n.image[0].image.width):this._setSize(n.image.width/4),Wn=this._renderer.getRenderTarget(),kn=this._renderer.getActiveCubeFace(),zn=this._renderer.getActiveMipmapLevel(),Xn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(n,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const n=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:vt,minFilter:vt,generateMipmaps:!1,type:wt,format:Ut,colorSpace:Yi,depthBuffer:!1},l=vr(n,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==n||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=vr(n,t,i);const{_lodMax:o}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=Xp(o)),this._blurMaterial=Yp(o,n,t),this._ggxMaterial=Kp(o,n,t)}return l}_compileMaterial(n){const t=new It(new _n,n);this._renderer.compile(t,sn)}_sceneToCubeUV(n,t,i,l,o){const R=new pn(90,1,t,i),T=[1,-1,1,1,1,1],H=[1,1,1,-1,-1,-1],I=this._renderer,p=I.autoClear,x=I.toneMapping;I.getClearColor(gr),I.toneMapping=Rt,I.autoClear=!1,I.state.buffers.depth.getReversed()&&(I.setRenderTarget(l),I.clearDepth(),I.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new It(new yn,new da({name:"PMREM.Background",side:St,depthWrite:!1,depthTest:!1})));const W=this._backgroundBox,f=W.material;let s=!1;const L=n.background;L?L.isColor&&(f.color.copy(L),n.background=null,s=!0):(f.color.copy(gr),s=!0);for(let z=0;z<6;z++){const h=z%3;h===0?(R.up.set(0,T[z],0),R.position.set(o.x,o.y,o.z),R.lookAt(o.x+H[z],o.y,o.z)):h===1?(R.up.set(0,0,T[z]),R.position.set(o.x,o.y,o.z),R.lookAt(o.x,o.y+H[z],o.z)):(R.up.set(0,T[z],0),R.position.set(o.x,o.y,o.z),R.lookAt(o.x,o.y,o.z+H[z]));const S=this._cubeSize;Jt(l,h*S,z>2?S:0,S,S),I.setRenderTarget(l),s&&I.render(W,R),I.render(n,R)}I.toneMapping=x,I.autoClear=p,n.background=L}_textureToCubeUV(n,t){const i=this._renderer,l=n.mapping===nn||n.mapping===Kt;l?(this._cubemapMaterial===null&&(this._cubemapMaterial=Er()),this._cubemapMaterial.uniforms.flipEnvMap.value=n.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Sr());const o=l?this._cubemapMaterial:this._equirectMaterial,d=this._lodMeshes[0];d.material=o;const g=o.uniforms;g.envMap.value=n;const R=this._cubeSize;Jt(t,0,0,3*R,2*R),i.setRenderTarget(t),i.render(d,sn)}_applyPMREM(n){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const l=this._lodMeshes.length;for(let o=1;o<l;o++)this._applyGGXFilter(n,o-1,o);t.autoClear=i}_applyGGXFilter(n,t,i){const l=this._renderer,o=this._pingPongRenderTarget,d=this._ggxMaterial,g=this._lodMeshes[i];g.material=d;const R=d.uniforms,T=i/(this._lodMeshes.length-1),H=t/(this._lodMeshes.length-1),I=Math.sqrt(T*T-H*H),p=T*1.25,x=I*p,{_lodMax:N}=this,W=this._sizeLods[i],f=3*W*(i>N-tn?i-N+tn:0),s=4*(this._cubeSize-W);R.envMap.value=n.texture,R.roughness.value=x,R.mipInt.value=N-t,Jt(o,f,s,3*W,2*W),l.setRenderTarget(o),l.render(g,sn),R.envMap.value=o.texture,R.roughness.value=0,R.mipInt.value=N-i,Jt(n,f,s,3*W,2*W),l.setRenderTarget(n),l.render(g,sn)}_blur(n,t,i,l){const o=this._pingPongRenderTarget,d=Math.min(l,Math.PI)/Math.SQRT2;this._blurPass(n,o,t,i,d),this._blurPass(o,n,i,i,d)}_blurPass(n,t,i,l,o){const d=this._renderer,g=this._blurMaterial,R=this._lodMeshes[l];R.material=g;const T=g.uniforms;T.envMap.value=n.texture,T.sigma.value=o,T.mipInt.value=this._lodMax-i;const H=this._sizeLods[l],I=3*H*(l>this._lodMax-tn?l-this._lodMax+tn:0),p=4*(this._cubeSize-H);Jt(t,I,p,3*H,2*H),d.setRenderTarget(t),d.render(R,sn)}}function Xp(e){const n=[],t=[];let i=e;const l=e-tn+1+Vp;for(let o=0;o<l;o++){const d=Math.pow(2,i);n.push(d);const g=1/(d-2),R=-g,T=1+g,H=[R,R,T,R,T,T,R,R,T,T,R,T],I=6,p=6,x=3,N=new Float32Array(x*p*I),W=new Float32Array(x*p*I);for(let s=0;s<I;s++){const L=s%3*2/3-1,z=s>2?0:-1,h=[L,z,0,L+2/3,z,0,L+2/3,z+1,0,L,z,0,L+2/3,z+1,0,L,z+1,0];N.set(h,x*p*s);for(let S=0;S<p;S++){const m=H[S*2]*2-1,D=H[S*2+1]*2-1;s===0?Wt.set(1,D,m):s===1?Wt.set(-m,1,-D):s===2?Wt.set(-m,D,1):s===3?Wt.set(-1,D,-m):s===4?Wt.set(-m,-1,D):Wt.set(m,D,-1),Wt.toArray(W,(s*p+S)*x)}}const f=new _n;f.setAttribute("position",new Dn(N,x)),f.setAttribute("outputDirection",new Dn(W,x)),t.push(new It(f,null)),i>tn&&i--}return{lodMeshes:t,sizeLods:n}}function vr(e,n,t){const i=new Mt(e,n,t);return i.texture.mapping=gn,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Jt(e,n,t,i,l){e.viewport.set(n,t,i,l),e.scissor.set(n,t,i,l)}function Kp(e,n,t){return new Nt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:kp,CUBEUV_TEXEL_WIDTH:1/n,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Bn(),fragmentShader:`
3824
-
3825
- precision highp float;
3826
- precision highp int;
3827
-
3828
- varying vec3 vOutputDirection;
3829
-
3830
- uniform sampler2D envMap;
3831
- uniform float roughness;
3832
- uniform float mipInt;
3833
-
3834
- #define ENVMAP_TYPE_CUBE_UV
3835
- #include <cube_uv_reflection_fragment>
3836
-
3837
- #define PI 3.14159265359
3838
-
3839
- // Van der Corput radical inverse
3840
- float radicalInverse_VdC(uint bits) {
3841
- bits = (bits << 16u) | (bits >> 16u);
3842
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3843
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3844
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3845
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3846
- return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3847
- }
3848
-
3849
- // Hammersley sequence
3850
- vec2 hammersley(uint i, uint N) {
3851
- return vec2(float(i) / float(N), radicalInverse_VdC(i));
3852
- }
3853
-
3854
- // GGX VNDF importance sampling (Eric Heitz 2018)
3855
- // "Sampling the GGX Distribution of Visible Normals"
3856
- // https://jcgt.org/published/0007/04/01/
3857
- vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3858
- float alpha = roughness * roughness;
3859
-
3860
- // Section 4.1: Orthonormal basis
3861
- vec3 T1 = vec3(1.0, 0.0, 0.0);
3862
- vec3 T2 = cross(V, T1);
3863
-
3864
- // Section 4.2: Parameterization of projected area
3865
- float r = sqrt(Xi.x);
3866
- float phi = 2.0 * PI * Xi.y;
3867
- float t1 = r * cos(phi);
3868
- float t2 = r * sin(phi);
3869
- float s = 0.5 * (1.0 + V.z);
3870
- t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3871
-
3872
- // Section 4.3: Reprojection onto hemisphere
3873
- vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3874
-
3875
- // Section 3.4: Transform back to ellipsoid configuration
3876
- return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3877
- }
3878
-
3879
- void main() {
3880
- vec3 N = normalize(vOutputDirection);
3881
- vec3 V = N; // Assume view direction equals normal for pre-filtering
3882
-
3883
- vec3 prefilteredColor = vec3(0.0);
3884
- float totalWeight = 0.0;
3885
-
3886
- // For very low roughness, just sample the environment directly
3887
- if (roughness < 0.001) {
3888
- gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3889
- return;
3890
- }
3891
-
3892
- // Tangent space basis for VNDF sampling
3893
- vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3894
- vec3 tangent = normalize(cross(up, N));
3895
- vec3 bitangent = cross(N, tangent);
3896
-
3897
- for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3898
- vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3899
-
3900
- // For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3901
- vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3902
-
3903
- // Transform H back to world space
3904
- vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3905
- vec3 L = normalize(2.0 * dot(V, H) * H - V);
3906
-
3907
- float NdotL = max(dot(N, L), 0.0);
3908
-
3909
- if(NdotL > 0.0) {
3910
- // Sample environment at fixed mip level
3911
- // VNDF importance sampling handles the distribution filtering
3912
- vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3913
-
3914
- // Weight by NdotL for the split-sum approximation
3915
- // VNDF PDF naturally accounts for the visible microfacet distribution
3916
- prefilteredColor += sampleColor * NdotL;
3917
- totalWeight += NdotL;
3918
- }
3919
- }
3920
-
3921
- if (totalWeight > 0.0) {
3922
- prefilteredColor = prefilteredColor / totalWeight;
3923
- }
3924
-
3925
- gl_FragColor = vec4(prefilteredColor, 1.0);
3926
- }
3927
- `,blending:Dt,depthTest:!1,depthWrite:!1})}function Yp(e,n,t){return new Nt({name:"SphericalGaussianBlur",defines:{SAMPLES:Wp,CUBEUV_TEXEL_WIDTH:1/n,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:Bn(),fragmentShader:`
3928
-
3929
- precision highp float;
3930
- precision highp int;
3931
-
3932
- varying vec3 vOutputDirection;
3933
-
3934
- uniform sampler2D envMap;
3935
- uniform float sigma;
3936
- uniform float mipInt;
3937
-
3938
- #define ENVMAP_TYPE_CUBE_UV
3939
- #include <cube_uv_reflection_fragment>
3940
-
3941
- #define PI 3.14159265359
3942
- #define GOLDEN_ANGLE 2.39996322973
3943
-
3944
- void main() {
3945
-
3946
- if ( sigma == 0.0 ) {
3947
-
3948
- gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 );
3949
- return;
3950
-
3951
- }
3952
-
3953
- vec3 outputDirection = normalize( vOutputDirection );
3954
-
3955
- vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
3956
- vec3 tangent = normalize( cross( up, outputDirection ) );
3957
- vec3 bitangent = cross( outputDirection, tangent );
3958
-
3959
- // Truncate the kernel at three standard deviations or at the antipode.
3960
- float thetaMax = min( 3.0 * sigma, PI );
3961
- float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );
3962
-
3963
- vec3 accumColor = vec3( 0.0 );
3964
- float accumWeight = 0.0;
3965
-
3966
- for ( int i = 0; i < SAMPLES; i ++ ) {
3967
-
3968
- // Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
3969
- float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
3970
- float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
3971
- float phi = float( i ) * GOLDEN_ANGLE;
3972
-
3973
- vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
3974
- vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;
3975
-
3976
- // Correct the planar sample density to solid angle.
3977
- float weight = sin( theta ) / theta;
3978
-
3979
- accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt );
3980
- accumWeight += weight;
3981
-
3982
- }
3983
-
3984
- gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
3985
-
3986
- }
3987
- `,blending:Dt,depthTest:!1,depthWrite:!1})}function Sr(){return new Nt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Bn(),fragmentShader:`
3988
-
3989
- precision mediump float;
3990
- precision mediump int;
3991
-
3992
- varying vec3 vOutputDirection;
3993
-
3994
- uniform sampler2D envMap;
3995
-
3996
- #include <common>
3997
-
3998
- void main() {
3999
-
4000
- vec3 outputDirection = normalize( vOutputDirection );
4001
- vec2 uv = equirectUv( outputDirection );
4002
-
4003
- gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
4004
-
4005
- }
4006
- `,blending:Dt,depthTest:!1,depthWrite:!1})}function Er(){return new Nt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Bn(),fragmentShader:`
4007
-
4008
- precision mediump float;
4009
- precision mediump int;
4010
-
4011
- uniform float flipEnvMap;
4012
-
4013
- varying vec3 vOutputDirection;
4014
-
4015
- uniform samplerCube envMap;
4016
-
4017
- void main() {
4018
-
4019
- gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
4020
-
4021
- }
4022
- `,blending:Dt,depthTest:!1,depthWrite:!1})}function Bn(){return`
4023
-
4024
- precision mediump float;
4025
- precision mediump int;
4026
-
4027
- attribute vec3 outputDirection;
4028
-
4029
- varying vec3 vOutputDirection;
4030
-
4031
- void main() {
4032
-
4033
- vOutputDirection = outputDirection;
4034
- gl_Position = vec4( position, 1.0 );
4035
-
4036
- }
4037
- `}class ar extends Mt{constructor(n=1,t={}){super(n,n,t),this.isWebGLCubeRenderTarget=!0;const i={width:n,height:n,depth:1},l=[i,i,i,i,i,i];this.texture=new Vi(l),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(n,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
4038
-
4039
- varying vec3 vWorldDirection;
4040
-
4041
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
4042
-
4043
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
4044
-
4045
- }
4046
-
4047
- void main() {
4048
-
4049
- vWorldDirection = transformDirection( position, modelMatrix );
4050
-
4051
- #include <begin_vertex>
4052
- #include <project_vertex>
4053
-
4054
- }
4055
- `,fragmentShader:`
4056
-
4057
- uniform sampler2D tEquirect;
4058
-
4059
- varying vec3 vWorldDirection;
4060
-
4061
- #include <common>
4062
-
4063
- void main() {
4064
-
4065
- vec3 direction = normalize( vWorldDirection );
4066
-
4067
- vec2 sampleUV = equirectUv( direction );
4068
-
4069
- gl_FragColor = texture2D( tEquirect, sampleUV );
4070
-
4071
- }
4072
- `},l=new yn(5,5,5),o=new Nt({name:"CubemapFromEquirect",uniforms:Ii(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:St,blending:Dt});o.uniforms.tEquirect.value=t;const d=new It(l,o),g=t.minFilter;return t.minFilter===Xt&&(t.minFilter=vt),new Kr(1,10,this).update(n,d),t.minFilter=g,d.geometry.dispose(),d.material.dispose(),this}clear(n,t=!0,i=!0,l=!0){const o=n.getRenderTarget();for(let d=0;d<6;d++)n.setRenderTarget(this,d),n.clear(t,i,l);n.setRenderTarget(o)}}function qp(e){let n=new WeakMap,t=new WeakMap,i=null;function l(p,x=!1){return p==null?null:x?d(p):o(p)}function o(p){if(p&&p.isTexture){const x=p.mapping;if(x===xn||x===Tn)if(n.has(p)){const N=n.get(p).texture;return g(N,p.mapping)}else{const N=p.image;if(N&&N.height>0){const W=new ar(N.height);return W.fromEquirectangularTexture(e,p),n.set(p,W),p.addEventListener("dispose",T),g(W.texture,p.mapping)}else return null}}return p}function d(p){if(p&&p.isTexture){const x=p.mapping,N=x===xn||x===Tn,W=x===nn||x===Kt;if(N||W){let f=t.get(p);const s=f!==void 0?f.texture.pmremVersion:0;if(p.isRenderTargetTexture&&p.pmremVersion!==s)return i===null&&(i=new yi(e)),f=N?i.fromEquirectangular(p,f):i.fromCubemap(p,f),f.texture.pmremVersion=p.pmremVersion,t.set(p,f),f.texture;if(f!==void 0)return f.texture;{const L=p.image;return N&&L&&L.height>0||W&&L&&R(L)?(i===null&&(i=new yi(e)),f=N?i.fromEquirectangular(p):i.fromCubemap(p),f.texture.pmremVersion=p.pmremVersion,t.set(p,f),p.addEventListener("dispose",H),f.texture):null}}}return p}function g(p,x){return x===xn?p.mapping=nn:x===Tn&&(p.mapping=Kt),p}function R(p){let x=0;const N=6;for(let W=0;W<N;W++)p[W]!==void 0&&x++;return x===N}function T(p){const x=p.target;x.removeEventListener("dispose",T);const N=n.get(x);N!==void 0&&(n.delete(x),N.dispose())}function H(p){const x=p.target;x.removeEventListener("dispose",H);const N=t.get(x);N!==void 0&&(t.delete(x),N.dispose())}function I(){n=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:l,dispose:I}}function Zp(e){const n={};function t(i){if(n[i]!==void 0)return n[i];const l=e.getExtension(i);return n[i]=l,l}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const l=t(i);return l===null&&ja("WebGLRenderer: "+i+" extension not supported."),l}}}function $p(e,n,t,i){const l={},o=new WeakMap;function d(I){const p=I.target;p.index!==null&&n.remove(p.index);for(const N in p.attributes)n.remove(p.attributes[N]);p.removeEventListener("dispose",d),delete l[p.id];const x=o.get(p);x&&(n.remove(x),o.delete(p)),i.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function g(I,p){return l[p.id]===!0||(p.addEventListener("dispose",d),l[p.id]=!0,t.memory.geometries++),p}function R(I){const p=I.attributes;for(const x in p)n.update(p[x],e.ARRAY_BUFFER)}function T(I){const p=[],x=I.index,N=I.attributes.position;let W=0;if(N===void 0)return;if(x!==null){const L=x.array;W=x.version;for(let z=0,h=L.length;z<h;z+=3){const S=L[z+0],m=L[z+1],D=L[z+2];p.push(S,m,m,D,D,S)}}else{const L=N.array;W=N.version;for(let z=0,h=L.length/3-1;z<h;z+=3){const S=z+0,m=z+1,D=z+2;p.push(S,m,m,D,D,S)}}const f=new(N.count>=65535?Ya:Ka)(p,1);f.version=W;const s=o.get(I);s&&n.remove(s),o.set(I,f)}function H(I){const p=o.get(I);if(p){const x=I.index;x!==null&&p.version<x.version&&T(I)}else T(I);return o.get(I)}return{get:g,update:R,getWireframeAttribute:H}}function Qp(e,n,t){let i;function l(I){i=I}let o,d;function g(I){o=I.type,d=I.bytesPerElement}function R(I,p){e.drawElements(i,p,o,I*d),t.update(p,i,1)}function T(I,p,x){x!==0&&(e.drawElementsInstanced(i,p,o,I*d,x),t.update(p,i,x))}function H(I,p,x){if(x===0)return;n.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,p,0,o,I,0,x);let W=0;for(let f=0;f<x;f++)W+=p[f];t.update(W,i,1)}this.setMode=l,this.setIndex=g,this.render=R,this.renderInstances=T,this.renderMultiDraw=H}function Jp(e){const n={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(o,d,g){switch(t.calls++,d){case e.TRIANGLES:t.triangles+=g*(o/3);break;case e.LINES:t.lines+=g*(o/2);break;case e.LINE_STRIP:t.lines+=g*(o-1);break;case e.LINE_LOOP:t.lines+=g*o;break;case e.POINTS:t.points+=g*o;break;default:Qe("WebGLInfo: Unknown draw mode:",d);break}}function l(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:n,render:t,programs:null,autoReset:!0,reset:l,update:i}}function jp(e,n,t){const i=new WeakMap,l=new ht;function o(d,g,R){const T=d.morphTargetInfluences,H=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,I=H!==void 0?H.length:0;let p=i.get(g);if(p===void 0||p.count!==I){let _=function(){D.dispose(),i.delete(g),g.removeEventListener("dispose",_)};p!==void 0&&p.texture.dispose();const x=g.morphAttributes.position!==void 0,N=g.morphAttributes.normal!==void 0,W=g.morphAttributes.color!==void 0,f=g.morphAttributes.position||[],s=g.morphAttributes.normal||[],L=g.morphAttributes.color||[];let z=0;x===!0&&(z=1),N===!0&&(z=2),W===!0&&(z=3);let h=g.attributes.position.count*z,S=1;h>n.maxTextureSize&&(S=Math.ceil(h/n.maxTextureSize),h=n.maxTextureSize);const m=new Float32Array(h*S*4*I),D=new ki(m,h,S,I);D.type=yt,D.needsUpdate=!0;const c=z*4;for(let w=0;w<I;w++){const F=f[w],G=s[w],q=L[w],P=h*S*4*w;for(let K=0;K<F.count;K++){const Q=K*c;x===!0&&(l.fromBufferAttribute(F,K),m[P+Q+0]=l.x,m[P+Q+1]=l.y,m[P+Q+2]=l.z,m[P+Q+3]=0),N===!0&&(l.fromBufferAttribute(G,K),m[P+Q+4]=l.x,m[P+Q+5]=l.y,m[P+Q+6]=l.z,m[P+Q+7]=0),W===!0&&(l.fromBufferAttribute(q,K),m[P+Q+8]=l.x,m[P+Q+9]=l.y,m[P+Q+10]=l.z,m[P+Q+11]=q.itemSize===4?l.w:1)}}p={count:I,texture:D,size:new mt(h,S)},i.set(g,p),g.addEventListener("dispose",_)}if(d.isInstancedMesh===!0&&d.morphTexture!==null)R.getUniforms().setValue(e,"morphTexture",d.morphTexture,t);else{let x=0;for(let W=0;W<T.length;W++)x+=T[W];const N=g.morphTargetsRelative?1:1-x;R.getUniforms().setValue(e,"morphTargetBaseInfluence",N),R.getUniforms().setValue(e,"morphTargetInfluences",T)}R.getUniforms().setValue(e,"morphTargetsTexture",p.texture,t),R.getUniforms().setValue(e,"morphTargetsTextureSize",p.size)}return{update:o}}function eh(e,n,t,i,l){let o=new WeakMap;function d(T){const H=l.render.frame,I=T.geometry,p=n.get(T,I);if(o.get(p)!==H&&(n.update(p),o.set(p,H)),T.isInstancedMesh&&(T.hasEventListener("dispose",R)===!1&&T.addEventListener("dispose",R),o.get(T)!==H&&(t.update(T.instanceMatrix,e.ARRAY_BUFFER),T.instanceColor!==null&&t.update(T.instanceColor,e.ARRAY_BUFFER),o.set(T,H))),T.isSkinnedMesh){const x=T.skeleton;o.get(x)!==H&&(x.update(),o.set(x,H))}return p}function g(){o=new WeakMap}function R(T){const H=T.target;H.removeEventListener("dispose",R),i.releaseStatesOfObject(H),t.remove(H.instanceMatrix),H.instanceColor!==null&&t.remove(H.instanceColor)}return{update:d,dispose:g}}const th={[qi]:"LINEAR_TONE_MAPPING",[nr]:"REINHARD_TONE_MAPPING",[Hi]:"CINEON_TONE_MAPPING",[Bi]:"ACES_FILMIC_TONE_MAPPING",[Gi]:"AGX_TONE_MAPPING",[$i]:"NEUTRAL_TONE_MAPPING",[Wi]:"CUSTOM_TONE_MAPPING"};function nh(e,n,t,i,l,o){const d=new Mt(n,t,{type:e,depthBuffer:l,stencilBuffer:o,samples:i?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1});let g=null,R=null;const T=new _n;T.setAttribute("position",new $n([-1,3,0,-1,-1,0,3,-1,0],3)),T.setAttribute("uv",new $n([0,2,0,0,2,0],2));const H=new ya({uniforms:{tDiffuse:{value:null}},vertexShader:`
4073
- precision highp float;
4074
-
4075
- uniform mat4 modelViewMatrix;
4076
- uniform mat4 projectionMatrix;
4077
-
4078
- attribute vec3 position;
4079
- attribute vec2 uv;
4080
-
4081
- varying vec2 vUv;
4082
-
4083
- void main() {
4084
- vUv = uv;
4085
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4086
- }`,fragmentShader:`
4087
- precision highp float;
4088
-
4089
- uniform sampler2D tDiffuse;
4090
-
4091
- varying vec2 vUv;
4092
-
4093
- #include <tonemapping_pars_fragment>
4094
- #include <colorspace_pars_fragment>
4095
-
4096
- void main() {
4097
- gl_FragColor = texture2D( tDiffuse, vUv );
4098
-
4099
- #ifdef LINEAR_TONE_MAPPING
4100
- gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
4101
- #elif defined( REINHARD_TONE_MAPPING )
4102
- gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
4103
- #elif defined( CINEON_TONE_MAPPING )
4104
- gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
4105
- #elif defined( ACES_FILMIC_TONE_MAPPING )
4106
- gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
4107
- #elif defined( AGX_TONE_MAPPING )
4108
- gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4109
- #elif defined( NEUTRAL_TONE_MAPPING )
4110
- gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4111
- #elif defined( CUSTOM_TONE_MAPPING )
4112
- gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4113
- #endif
4114
-
4115
- #ifdef SRGB_TRANSFER
4116
- gl_FragColor = sRGBTransferOETF( gl_FragColor );
4117
- #endif
4118
- }`,depthTest:!1,depthWrite:!1}),I=new It(T,H),p=new Qi(-1,1,1,-1,0,1);let x=null,N=null,W=!1,f,s=null,L=[],z=!1;this.setSize=function(h,S){d.setSize(h,S),g!==null&&g.setSize(h,S),R!==null&&R.setSize(h,S);for(let m=0;m<L.length;m++){const D=L[m];D.setSize&&D.setSize(h,S)}},this.setEffects=function(h){L=h,z=L.length>0&&L[0].isRenderPass===!0;const S=d.width,m=d.height;L.length>0&&g===null&&(g=new Mt(S,m,{type:wt,depthBuffer:!1,stencilBuffer:!1}),R=new Mt(S,m,{type:wt,depthBuffer:!1,stencilBuffer:!1}));for(let D=0;D<L.length;D++){const c=L[D];c.setSize&&c.setSize(S,m)}},this.begin=function(h,S){if(W||h.toneMapping===Rt&&L.length===0)return!1;if(s=S,S!==null){const m=S.width,D=S.height;(d.width!==m||d.height!==D)&&this.setSize(m,D)}return z===!1&&h.setRenderTarget(d),f=h.toneMapping,h.toneMapping=Rt,!0},this.hasRenderPass=function(){return z},this.end=function(h,S){h.toneMapping=f,W=!0;let m=d,D=g;for(let c=0;c<L.length;c++){const _=L[c];_.enabled!==!1&&(_.render(h,D,m,S),_.needsSwap!==!1&&(m=D,D=D===g?R:g))}if(x!==h.outputColorSpace||N!==h.toneMapping){x=h.outputColorSpace,N=h.toneMapping,H.defines={},tt.getTransfer(x)===Ye&&(H.defines.SRGB_TRANSFER="");const c=th[N];c&&(H.defines[c]=""),H.needsUpdate=!0}H.uniforms.tDiffuse.value=m.texture,h.setRenderTarget(s),h.render(I,p),s=null,W=!1},this.isCompositing=function(){return W},this.dispose=function(){d.dispose(),g!==null&&g.dispose(),R!==null&&R.dispose(),T.dispose(),H.dispose()}}const io=new Xa,Fi=new hn(1,1),ro=new ki,ao=new Qr,oo=new Vi,Mr=[],xr=[],Tr=new Float32Array(16),Ar=new Float32Array(9),Rr=new Float32Array(4);function on(e,n,t){const i=e[0];if(i<=0||i>0)return e;const l=n*t;let o=Mr[l];if(o===void 0&&(o=new Float32Array(l),Mr[l]=o),n!==0){i.toArray(o,0);for(let d=1,g=0;d!==n;++d)g+=t,e[d].toArray(o,g)}return o}function lt(e,n){if(e.length!==n.length)return!1;for(let t=0,i=e.length;t<i;t++)if(e[t]!==n[t])return!1;return!0}function ct(e,n){for(let t=0,i=n.length;t<i;t++)e[t]=n[t]}function Gn(e,n){let t=xr[n];t===void 0&&(t=new Int32Array(n),xr[n]=t);for(let i=0;i!==n;++i)t[i]=e.allocateTextureUnit();return t}function ih(e,n){const t=this.cache;t[0]!==n&&(e.uniform1f(this.addr,n),t[0]=n)}function rh(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y)&&(e.uniform2f(this.addr,n.x,n.y),t[0]=n.x,t[1]=n.y);else{if(lt(t,n))return;e.uniform2fv(this.addr,n),ct(t,n)}}function ah(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y||t[2]!==n.z)&&(e.uniform3f(this.addr,n.x,n.y,n.z),t[0]=n.x,t[1]=n.y,t[2]=n.z);else if(n.r!==void 0)(t[0]!==n.r||t[1]!==n.g||t[2]!==n.b)&&(e.uniform3f(this.addr,n.r,n.g,n.b),t[0]=n.r,t[1]=n.g,t[2]=n.b);else{if(lt(t,n))return;e.uniform3fv(this.addr,n),ct(t,n)}}function oh(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y||t[2]!==n.z||t[3]!==n.w)&&(e.uniform4f(this.addr,n.x,n.y,n.z,n.w),t[0]=n.x,t[1]=n.y,t[2]=n.z,t[3]=n.w);else{if(lt(t,n))return;e.uniform4fv(this.addr,n),ct(t,n)}}function sh(e,n){const t=this.cache,i=n.elements;if(i===void 0){if(lt(t,n))return;e.uniformMatrix2fv(this.addr,!1,n),ct(t,n)}else{if(lt(t,i))return;Rr.set(i),e.uniformMatrix2fv(this.addr,!1,Rr),ct(t,i)}}function lh(e,n){const t=this.cache,i=n.elements;if(i===void 0){if(lt(t,n))return;e.uniformMatrix3fv(this.addr,!1,n),ct(t,n)}else{if(lt(t,i))return;Ar.set(i),e.uniformMatrix3fv(this.addr,!1,Ar),ct(t,i)}}function ch(e,n){const t=this.cache,i=n.elements;if(i===void 0){if(lt(t,n))return;e.uniformMatrix4fv(this.addr,!1,n),ct(t,n)}else{if(lt(t,i))return;Tr.set(i),e.uniformMatrix4fv(this.addr,!1,Tr),ct(t,i)}}function fh(e,n){const t=this.cache;t[0]!==n&&(e.uniform1i(this.addr,n),t[0]=n)}function dh(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y)&&(e.uniform2i(this.addr,n.x,n.y),t[0]=n.x,t[1]=n.y);else{if(lt(t,n))return;e.uniform2iv(this.addr,n),ct(t,n)}}function uh(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y||t[2]!==n.z)&&(e.uniform3i(this.addr,n.x,n.y,n.z),t[0]=n.x,t[1]=n.y,t[2]=n.z);else{if(lt(t,n))return;e.uniform3iv(this.addr,n),ct(t,n)}}function ph(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y||t[2]!==n.z||t[3]!==n.w)&&(e.uniform4i(this.addr,n.x,n.y,n.z,n.w),t[0]=n.x,t[1]=n.y,t[2]=n.z,t[3]=n.w);else{if(lt(t,n))return;e.uniform4iv(this.addr,n),ct(t,n)}}function hh(e,n){const t=this.cache;t[0]!==n&&(e.uniform1ui(this.addr,n),t[0]=n)}function mh(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y)&&(e.uniform2ui(this.addr,n.x,n.y),t[0]=n.x,t[1]=n.y);else{if(lt(t,n))return;e.uniform2uiv(this.addr,n),ct(t,n)}}function _h(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y||t[2]!==n.z)&&(e.uniform3ui(this.addr,n.x,n.y,n.z),t[0]=n.x,t[1]=n.y,t[2]=n.z);else{if(lt(t,n))return;e.uniform3uiv(this.addr,n),ct(t,n)}}function gh(e,n){const t=this.cache;if(n.x!==void 0)(t[0]!==n.x||t[1]!==n.y||t[2]!==n.z||t[3]!==n.w)&&(e.uniform4ui(this.addr,n.x,n.y,n.z,n.w),t[0]=n.x,t[1]=n.y,t[2]=n.z,t[3]=n.w);else{if(lt(t,n))return;e.uniform4uiv(this.addr,n),ct(t,n)}}function vh(e,n,t){const i=this.cache,l=t.allocateTextureUnit();i[0]!==l&&(e.uniform1i(this.addr,l),i[0]=l);let o;this.type===e.SAMPLER_2D_SHADOW?(Fi.compareFunction=t.isReversedDepthBuffer()?Fn:On,o=Fi):o=io,t.setTexture2D(n||o,l)}function Sh(e,n,t){const i=this.cache,l=t.allocateTextureUnit();i[0]!==l&&(e.uniform1i(this.addr,l),i[0]=l),t.setTexture3D(n||ao,l)}function Eh(e,n,t){const i=this.cache,l=t.allocateTextureUnit();i[0]!==l&&(e.uniform1i(this.addr,l),i[0]=l),t.setTextureCube(n||oo,l)}function Mh(e,n,t){const i=this.cache,l=t.allocateTextureUnit();i[0]!==l&&(e.uniform1i(this.addr,l),i[0]=l),t.setTexture2DArray(n||ro,l)}function xh(e){switch(e){case 5126:return ih;case 35664:return rh;case 35665:return ah;case 35666:return oh;case 35674:return sh;case 35675:return lh;case 35676:return ch;case 5124:case 35670:return fh;case 35667:case 35671:return dh;case 35668:case 35672:return uh;case 35669:case 35673:return ph;case 5125:return hh;case 36294:return mh;case 36295:return _h;case 36296:return gh;case 35678:case 36198:case 36298:case 36306:case 35682:return vh;case 35679:case 36299:case 36307:return Sh;case 35680:case 36300:case 36308:case 36293:return Eh;case 36289:case 36303:case 36311:case 36292:return Mh}}function Th(e,n){e.uniform1fv(this.addr,n)}function Ah(e,n){const t=on(n,this.size,2);e.uniform2fv(this.addr,t)}function Rh(e,n){const t=on(n,this.size,3);e.uniform3fv(this.addr,t)}function bh(e,n){const t=on(n,this.size,4);e.uniform4fv(this.addr,t)}function Ch(e,n){const t=on(n,this.size,4);e.uniformMatrix2fv(this.addr,!1,t)}function Ph(e,n){const t=on(n,this.size,9);e.uniformMatrix3fv(this.addr,!1,t)}function Lh(e,n){const t=on(n,this.size,16);e.uniformMatrix4fv(this.addr,!1,t)}function Uh(e,n){e.uniform1iv(this.addr,n)}function Dh(e,n){e.uniform2iv(this.addr,n)}function wh(e,n){e.uniform3iv(this.addr,n)}function Ih(e,n){e.uniform4iv(this.addr,n)}function Nh(e,n){e.uniform1uiv(this.addr,n)}function yh(e,n){e.uniform2uiv(this.addr,n)}function Fh(e,n){e.uniform3uiv(this.addr,n)}function Oh(e,n){e.uniform4uiv(this.addr,n)}function Bh(e,n,t){const i=this.cache,l=n.length,o=Gn(t,l);lt(i,o)||(e.uniform1iv(this.addr,o),ct(i,o));let d;this.type===e.SAMPLER_2D_SHADOW?d=Fi:d=io;for(let g=0;g!==l;++g)t.setTexture2D(n[g]||d,o[g])}function Gh(e,n,t){const i=this.cache,l=n.length,o=Gn(t,l);lt(i,o)||(e.uniform1iv(this.addr,o),ct(i,o));for(let d=0;d!==l;++d)t.setTexture3D(n[d]||ao,o[d])}function Hh(e,n,t){const i=this.cache,l=n.length,o=Gn(t,l);lt(i,o)||(e.uniform1iv(this.addr,o),ct(i,o));for(let d=0;d!==l;++d)t.setTextureCube(n[d]||oo,o[d])}function Vh(e,n,t){const i=this.cache,l=n.length,o=Gn(t,l);lt(i,o)||(e.uniform1iv(this.addr,o),ct(i,o));for(let d=0;d!==l;++d)t.setTexture2DArray(n[d]||ro,o[d])}function Wh(e){switch(e){case 5126:return Th;case 35664:return Ah;case 35665:return Rh;case 35666:return bh;case 35674:return Ch;case 35675:return Ph;case 35676:return Lh;case 5124:case 35670:return Uh;case 35667:case 35671:return Dh;case 35668:case 35672:return wh;case 35669:case 35673:return Ih;case 5125:return Nh;case 36294:return yh;case 36295:return Fh;case 36296:return Oh;case 35678:case 36198:case 36298:case 36306:case 35682:return Bh;case 35679:case 36299:case 36307:return Gh;case 35680:case 36300:case 36308:case 36293:return Hh;case 36289:case 36303:case 36311:case 36292:return Vh}}class kh{constructor(n,t,i){this.id=n,this.addr=i,this.cache=[],this.type=t.type,this.setValue=xh(t.type)}}class zh{constructor(n,t,i){this.id=n,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Wh(t.type)}}class Xh{constructor(n){this.id=n,this.seq=[],this.map={}}setValue(n,t,i){const l=this.seq;for(let o=0,d=l.length;o!==d;++o){const g=l[o];g.setValue(n,t[g.id],i)}}}const Kn=/(\w+)(\])?(\[|\.)?/g;function br(e,n){e.seq.push(n),e.map[n.id]=n}function Kh(e,n,t){const i=e.name,l=i.length;for(Kn.lastIndex=0;;){const o=Kn.exec(i),d=Kn.lastIndex;let g=o[1];const R=o[2]==="]",T=o[3];if(R&&(g=g|0),T===void 0||T==="["&&d+2===l){br(t,T===void 0?new kh(g,e,n):new zh(g,e,n));break}else{let I=t.map[g];I===void 0&&(I=new Xh(g),br(t,I)),t=I}}}class Un{constructor(n,t){this.seq=[],this.map={};const i=n.getProgramParameter(t,n.ACTIVE_UNIFORMS);for(let d=0;d<i;++d){const g=n.getActiveUniform(t,d),R=n.getUniformLocation(t,g.name);Kh(g,R,this)}const l=[],o=[];for(const d of this.seq)d.type===n.SAMPLER_2D_SHADOW||d.type===n.SAMPLER_CUBE_SHADOW||d.type===n.SAMPLER_2D_ARRAY_SHADOW?l.push(d):o.push(d);l.length>0&&(this.seq=l.concat(o))}setValue(n,t,i,l){const o=this.map[t];o!==void 0&&o.setValue(n,i,l)}setOptional(n,t,i){const l=t[i];l!==void 0&&this.setValue(n,i,l)}static upload(n,t,i,l){for(let o=0,d=t.length;o!==d;++o){const g=t[o],R=i[g.id];R.needsUpdate!==!1&&g.setValue(n,R.value,l)}}static seqWithValue(n,t){const i=[];for(let l=0,o=n.length;l!==o;++l){const d=n[l];d.id in t&&i.push(d)}return i}}function Cr(e,n,t){const i=e.createShader(n);return e.shaderSource(i,t),e.compileShader(i),i}const Yh=37297;let qh=0;function Zh(e,n){const t=e.split(`
4119
- `),i=[],l=Math.max(n-6,0),o=Math.min(n+6,t.length);for(let d=l;d<o;d++){const g=d+1;i.push(`${g===n?">":" "} ${g}: ${t[d]}`)}return i.join(`
4120
- `)}const Pr=new ye;function $h(e){tt._getMatrix(Pr,tt.workingColorSpace,e);const n=`mat3( ${Pr.elements.map(t=>t.toFixed(4))} )`;switch(tt.getTransfer(e)){case Zi:return[n,"LinearTransferOETF"];case Ye:return[n,"sRGBTransferOETF"];default:return Ve("WebGLProgram: Unsupported color space: ",e),[n,"LinearTransferOETF"]}}function Lr(e,n,t){const i=e.getShaderParameter(n,e.COMPILE_STATUS),o=(e.getShaderInfoLog(n)||"").trim();if(i&&o==="")return"";const d=/ERROR: 0:(\d+)/.exec(o);if(d){const g=parseInt(d[1]);return t.toUpperCase()+`
4121
-
4122
- `+o+`
4123
-
4124
- `+Zh(e.getShaderSource(n),g)}else return o}function Qh(e,n){const t=$h(n);return[`vec4 ${e}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4125
- `)}const Jh={[qi]:"Linear",[nr]:"Reinhard",[Hi]:"Cineon",[Bi]:"ACESFilmic",[Gi]:"AgX",[$i]:"Neutral",[Wi]:"Custom"};function jh(e,n){const t=Jh[n];return t===void 0?(Ve("WebGLProgram: Unsupported toneMapping:",n),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+e+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Mn=new Ne;function em(){tt.getLuminanceCoefficients(Mn);const e=Mn.x.toFixed(4),n=Mn.y.toFixed(4),t=Mn.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${n}, ${t} );`," return dot( weights, rgb );","}"].join(`
4126
- `)}function tm(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(fn).join(`
4127
- `)}function nm(e){const n=[];for(const t in e){const i=e[t];i!==!1&&n.push("#define "+t+" "+i)}return n.join(`
4128
- `)}function im(e,n){const t={},i=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let l=0;l<i;l++){const o=e.getActiveAttrib(n,l),d=o.name;let g=1;o.type===e.FLOAT_MAT2&&(g=2),o.type===e.FLOAT_MAT3&&(g=3),o.type===e.FLOAT_MAT4&&(g=4),t[d]={type:o.type,location:e.getAttribLocation(n,d),locationSize:g}}return t}function fn(e){return e!==""}function Ur(e,n){const t=n.numSpotLightShadows+n.numSpotLightMaps-n.numSpotLightShadowsWithMaps;return e.replace(/NUM_SUN_LIGHTS/g,n.numSunLights).replace(/NUM_DIR_LIGHTS/g,n.numDirLights).replace(/NUM_SPOT_LIGHTS/g,n.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,n.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,n.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,n.numPointLights).replace(/NUM_HEMI_LIGHTS/g,n.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,n.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,n.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,n.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,n.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,n.numPointLightShadows)}function Dr(e,n){return e.replace(/NUM_CLIPPING_PLANES/g,n.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,n.numClippingPlanes-n.numClipIntersection)}const rm=/^[ \t]*#include +<([\w\d./]+)>/gm;function Oi(e){return e.replace(rm,om)}const am=new Map;function om(e,n){let t=Pe[n];if(t===void 0){const i=am.get(n);if(i!==void 0)t=Pe[i],Ve('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',n,i);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+n+">")}return Oi(t)}const sm=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function wr(e){return e.replace(sm,lm)}function lm(e,n,t,i){let l="";for(let o=parseInt(n);o<parseInt(t);o++)l+=i.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return l}function Ir(e){let n=`precision ${e.precision} float;
4129
- precision ${e.precision} int;
4130
- precision ${e.precision} sampler2D;
4131
- precision ${e.precision} samplerCube;
4132
- precision ${e.precision} sampler3D;
4133
- precision ${e.precision} sampler2DArray;
4134
- precision ${e.precision} sampler2DShadow;
4135
- precision ${e.precision} samplerCubeShadow;
4136
- precision ${e.precision} sampler2DArrayShadow;
4137
- precision ${e.precision} isampler2D;
4138
- precision ${e.precision} isampler3D;
4139
- precision ${e.precision} isamplerCube;
4140
- precision ${e.precision} isampler2DArray;
4141
- precision ${e.precision} usampler2D;
4142
- precision ${e.precision} usampler3D;
4143
- precision ${e.precision} usamplerCube;
4144
- precision ${e.precision} usampler2DArray;
4145
- `;return e.precision==="highp"?n+=`
4146
- #define HIGH_PRECISION`:e.precision==="mediump"?n+=`
4147
- #define MEDIUM_PRECISION`:e.precision==="lowp"&&(n+=`
4148
- #define LOW_PRECISION`),n}const cm={[un]:"SHADOWMAP_TYPE_PCF",[en]:"SHADOWMAP_TYPE_VSM"};function fm(e){return cm[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const dm={[nn]:"ENVMAP_TYPE_CUBE",[Kt]:"ENVMAP_TYPE_CUBE",[gn]:"ENVMAP_TYPE_CUBE_UV"};function um(e){return e.envMap===!1?"ENVMAP_TYPE_CUBE":dm[e.envMapMode]||"ENVMAP_TYPE_CUBE"}const pm={[Kt]:"ENVMAP_MODE_REFRACTION"};function hm(e){return e.envMap===!1?"ENVMAP_MODE_REFLECTION":pm[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}const mm={[ga]:"ENVMAP_BLENDING_MULTIPLY",[_a]:"ENVMAP_BLENDING_MIX",[Br]:"ENVMAP_BLENDING_ADD"};function _m(e){return e.envMap===!1?"ENVMAP_BLENDING_NONE":mm[e.combine]||"ENVMAP_BLENDING_NONE"}function gm(e){const n=e.envMapCubeUVHeight;if(n===null)return null;const t=Math.log2(n)-2,i=1/n;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function vm(e,n,t,i){const l=e.getContext(),o=t.defines;let d=t.vertexShader,g=t.fragmentShader;const R=fm(t),T=um(t),H=hm(t),I=_m(t),p=gm(t),x=tm(t),N=nm(o),W=l.createProgram();let f,s,L=t.glslVersion?"#version "+t.glslVersion+`
4149
- `:"";t.isRawShaderMaterial?(f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,N].filter(fn).join(`
4150
- `),f.length>0&&(f+=`
4151
- `),s=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,N].filter(fn).join(`
4152
- `),s.length>0&&(s+=`
4153
- `)):(f=[Ir(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,N,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+H:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+R:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
4154
- `].filter(fn).join(`
4155
- `),s=[Ir(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,N,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+T:"",t.envMap?"#define "+H:"",t.envMap?"#define "+I:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+R:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Rt?"#define TONE_MAPPING":"",t.toneMapping!==Rt?Pe.tonemapping_pars_fragment:"",t.toneMapping!==Rt?jh("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Pe.colorspace_pars_fragment,Qh("linearToOutputTexel",t.outputColorSpace),em(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4156
- `].filter(fn).join(`
4157
- `)),d=Oi(d),d=Ur(d,t),d=Dr(d,t),g=Oi(g),g=Ur(g,t),g=Dr(g,t),d=wr(d),g=wr(g),t.isRawShaderMaterial!==!0&&(L=`#version 300 es
4158
- `,f=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4159
- `)+`
4160
- `+f,s=["#define varying in",t.glslVersion===Qn?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Qn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4161
- `)+`
4162
- `+s);const z=L+f+d,h=L+s+g,S=Cr(l,l.VERTEX_SHADER,z),m=Cr(l,l.FRAGMENT_SHADER,h);l.attachShader(W,S),l.attachShader(W,m),t.index0AttributeName!==void 0?l.bindAttribLocation(W,0,t.index0AttributeName):t.hasPositionAttribute===!0&&l.bindAttribLocation(W,0,"position"),l.linkProgram(W);function D(F){if(e.debug.checkShaderErrors){const G=l.getProgramInfoLog(W)||"",q=l.getShaderInfoLog(S)||"",P=l.getShaderInfoLog(m)||"",K=G.trim(),Q=q.trim(),Y=P.trim();let ne=!0,Z=!0;if(l.getProgramParameter(W,l.LINK_STATUS)===!1)if(ne=!1,typeof e.debug.onShaderError=="function")e.debug.onShaderError(l,W,S,m);else{const j=Lr(l,S,"vertex"),ee=Lr(l,m,"fragment");Qe("WebGLProgram: Shader Error "+l.getError()+" - VALIDATE_STATUS "+l.getProgramParameter(W,l.VALIDATE_STATUS)+`
4163
-
4164
- Material Name: `+F.name+`
4165
- Material Type: `+F.type+`
4166
-
4167
- Program Info Log: `+K+`
4168
- `+j+`
4169
- `+ee)}else K!==""?Ve("WebGLProgram: Program Info Log:",K):(Q===""||Y==="")&&(Z=!1);Z&&(F.diagnostics={runnable:ne,programLog:K,vertexShader:{log:Q,prefix:f},fragmentShader:{log:Y,prefix:s}})}l.deleteShader(S),l.deleteShader(m),c=new Un(l,W),_=im(l,W)}let c;this.getUniforms=function(){return c===void 0&&D(this),c};let _;this.getAttributes=function(){return _===void 0&&D(this),_};let w=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=l.getProgramParameter(W,Yh)),w},this.destroy=function(){i.releaseStatesOfProgram(this),l.deleteProgram(W),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=qh++,this.cacheKey=n,this.usedTimes=1,this.program=W,this.vertexShader=S,this.fragmentShader=m,this}let Sm=0;class Em{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(n,t,i){const l=this._getShaderCacheForMaterial(n);return l.has(t)===!1&&(l.add(t),t.usedTimes++),l.has(i)===!1&&(l.add(i),i.usedTimes++),this}remove(n){const t=this.materialCache.get(n);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(n),this}getVertexShaderStage(n){return this._getShaderStage(n.vertexShader)}getFragmentShaderStage(n){return this._getShaderStage(n.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(n){const t=this.materialCache;let i=t.get(n);return i===void 0&&(i=new Set,t.set(n,i)),i}_getShaderStage(n){const t=this.shaderCache;let i=t.get(n);return i===void 0&&(i=new Mm(n),t.set(n,i)),i}}class Mm{constructor(n){this.id=Sm++,this.code=n,this.usedTimes=0}}function xm(e){return e===Zt||e===Nn||e===In}function Tm(e,n,t,i,l,o){const d=new sa,g=new Em,R=new Set,T=[],H=new Map,I=i.logarithmicDepthBuffer;let p=i.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function N(c){return R.add(c),c===0?"uv":`uv${c}`}function W(c,_,w,F,G,q){const P=F.fog,K=G.geometry,Q=c.isMeshStandardMaterial||c.isMeshLambertMaterial||c.isMeshPhongMaterial?F.environment:null,Y=c.isMeshStandardMaterial||c.isMeshLambertMaterial&&!c.envMap||c.isMeshPhongMaterial&&!c.envMap,ne=n.get(c.envMap||Q,Y),Z=ne&&ne.mapping===gn?ne.image.height:null,j=x[c.type];c.precision!==null&&(p=i.getMaxPrecision(c.precision),p!==c.precision&&Ve("WebGLProgram.getParameters:",c.precision,"not supported, using",p,"instead."));const ee=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,be=ee!==void 0?ee.length:0;let Re=0;K.morphAttributes.position!==void 0&&(Re=1),K.morphAttributes.normal!==void 0&&(Re=2),K.morphAttributes.color!==void 0&&(Re=3);let it,ke,ze,V;if(j){const Ze=Tt[j];it=Ze.vertexShader,ke=Ze.fragmentShader}else{it=c.vertexShader,ke=c.fragmentShader;const Ze=g.getVertexShaderStage(c),Ge=g.getFragmentShaderStage(c);g.update(c,Ze,Ge),ze=Ze.id,V=Ge.id}const $=e.getRenderTarget(),Ee=e.state.buffers.depth.getReversed(),Ue=G.isInstancedMesh===!0,me=G.isBatchedMesh===!0,Fe=!!c.map,st=!!c.matcap,De=!!ne,Be=!!c.aoMap,qe=!!c.lightMap,Ie=!!c.bumpMap&&c.wireframe===!1,et=!!c.normalMap,ft=!!c.displacementMap,_t=!!c.emissiveMap,nt=!!c.metalnessMap,at=!!c.roughnessMap,M=c.anisotropy>0,dt=c.clearcoat>0,We=c.dispersion>0,u=c.retroreflectivity>0,r=c.iridescence>0,A=c.sheen>0,U=c.transmission>0,O=M&&!!c.anisotropyMap,te=dt&&!!c.clearcoatMap,ie=dt&&!!c.clearcoatNormalMap,B=dt&&!!c.clearcoatRoughnessMap,X=r&&!!c.iridescenceMap,re=r&&!!c.iridescenceThicknessMap,Me=A&&!!c.sheenColorMap,ce=A&&!!c.sheenRoughnessMap,ae=!!c.specularMap,xe=!!c.specularColorMap,Ae=!!c.specularIntensityMap,Ce=U&&!!c.transmissionMap,E=U&&!!c.thicknessMap,oe=!!c.gradientMap,k=!!c.alphaMap,se=c.alphaTest>0,ue=!!c.alphaHash,J=!!c.extensions;let Te=Rt;c.toneMapped&&($===null||$.isXRRenderTarget===!0)&&(Te=e.toneMapping);const ve={shaderID:j,shaderType:c.type,shaderName:c.name,vertexShader:it,fragmentShader:ke,defines:c.defines,customVertexShaderID:ze,customFragmentShaderID:V,isRawShaderMaterial:c.isRawShaderMaterial===!0,glslVersion:c.glslVersion,precision:p,batching:me,batchingColor:me&&G._colorsTexture!==null,instancing:Ue,instancingColor:Ue&&G.instanceColor!==null,instancingMorph:Ue&&G.morphTexture!==null,outputColorSpace:$===null?e.outputColorSpace:$.isXRRenderTarget===!0?$.texture.colorSpace:tt.workingColorSpace,alphaToCoverage:!!c.alphaToCoverage,map:Fe,matcap:st,envMap:De,envMapMode:De&&ne.mapping,envMapCubeUVHeight:Z,aoMap:Be,lightMap:qe,bumpMap:Ie,normalMap:et,displacementMap:ft,emissiveMap:_t,normalMapObjectSpace:et&&c.normalMapType===Ta,normalMapTangentSpace:et&&c.normalMapType===Di,packedNormalMap:et&&c.normalMapType===Di&&xm(c.normalMap.format),metalnessMap:nt,roughnessMap:at,anisotropy:M,anisotropyMap:O,clearcoat:dt,clearcoatMap:te,clearcoatNormalMap:ie,clearcoatRoughnessMap:B,dispersion:We,retroreflection:u,iridescence:r,iridescenceMap:X,iridescenceThicknessMap:re,sheen:A,sheenColorMap:Me,sheenRoughnessMap:ce,specularMap:ae,specularColorMap:xe,specularIntensityMap:Ae,transmission:U,transmissionMap:Ce,thicknessMap:E,gradientMap:oe,opaque:c.transparent===!1&&c.blending===dn&&c.alphaToCoverage===!1,alphaMap:k,alphaTest:se,alphaHash:ue,combine:c.combine,mapUv:Fe&&N(c.map.channel),aoMapUv:Be&&N(c.aoMap.channel),lightMapUv:qe&&N(c.lightMap.channel),bumpMapUv:Ie&&N(c.bumpMap.channel),normalMapUv:et&&N(c.normalMap.channel),displacementMapUv:ft&&N(c.displacementMap.channel),emissiveMapUv:_t&&N(c.emissiveMap.channel),metalnessMapUv:nt&&N(c.metalnessMap.channel),roughnessMapUv:at&&N(c.roughnessMap.channel),anisotropyMapUv:O&&N(c.anisotropyMap.channel),clearcoatMapUv:te&&N(c.clearcoatMap.channel),clearcoatNormalMapUv:ie&&N(c.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:B&&N(c.clearcoatRoughnessMap.channel),iridescenceMapUv:X&&N(c.iridescenceMap.channel),iridescenceThicknessMapUv:re&&N(c.iridescenceThicknessMap.channel),sheenColorMapUv:Me&&N(c.sheenColorMap.channel),sheenRoughnessMapUv:ce&&N(c.sheenRoughnessMap.channel),specularMapUv:ae&&N(c.specularMap.channel),specularColorMapUv:xe&&N(c.specularColorMap.channel),specularIntensityMapUv:Ae&&N(c.specularIntensityMap.channel),transmissionMapUv:Ce&&N(c.transmissionMap.channel),thicknessMapUv:E&&N(c.thicknessMap.channel),alphaMapUv:k&&N(c.alphaMap.channel),vertexTangents:!!K.attributes.tangent&&(et||M),vertexNormals:!!K.attributes.normal,vertexColors:c.vertexColors,vertexAlphas:c.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!K.attributes.uv&&(Fe||k),fog:!!P,useFog:c.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:c.wireframe===!1&&(c.flatShading===!0||K.attributes.normal===void 0&&et===!1&&(c.isMeshLambertMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.isMeshPhysicalMaterial)),sizeAttenuation:c.sizeAttenuation===!0,logarithmicDepthBuffer:I,reversedDepthBuffer:Ee,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:K.attributes.position!==void 0,morphTargets:K.morphAttributes.position!==void 0,morphNormals:K.morphAttributes.normal!==void 0,morphColors:K.morphAttributes.color!==void 0,morphTargetsCount:be,morphTextureStride:Re,numSunLights:_.sun.length,numDirLights:_.directional.length,numPointLights:_.point.length,numSpotLights:_.spot.length,numSpotLightMaps:_.spotLightMap.length,numRectAreaLights:_.rectArea.length,numHemiLights:_.hemi.length,numSunLightShadows:_.sunShadowMap.length,numDirLightShadows:_.directionalShadowMap.length,numPointLightShadows:_.pointShadowMap.length,numSpotLightShadows:_.spotShadowMap.length,numSpotLightShadowsWithMaps:_.numSpotLightShadowsWithMaps,numLightProbes:_.numLightProbes,numLightProbeGrids:q.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:c.dithering,shadowMapEnabled:e.shadowMap.enabled&&w.length>0,shadowMapType:e.shadowMap.type,toneMapping:Te,decodeVideoTexture:Fe&&c.map.isVideoTexture===!0&&tt.getTransfer(c.map.colorSpace)===Ye,decodeVideoTextureEmissive:_t&&c.emissiveMap.isVideoTexture===!0&&tt.getTransfer(c.emissiveMap.colorSpace)===Ye,premultipliedAlpha:c.premultipliedAlpha,doubleSided:c.side===Lt,flipSided:c.side===St,useDepthPacking:c.depthPacking>=0,depthPacking:c.depthPacking||0,index0AttributeName:c.index0AttributeName,extensionClipCullDistance:J&&c.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(J&&c.extensions.multiDraw===!0||me)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:c.customProgramCacheKey()};return ve.vertexUv1s=R.has(1),ve.vertexUv2s=R.has(2),ve.vertexUv3s=R.has(3),R.clear(),ve}function f(c){const _=[];if(c.shaderID?_.push(c.shaderID):(_.push(c.customVertexShaderID),_.push(c.customFragmentShaderID)),c.defines!==void 0)for(const w in c.defines)_.push(w),_.push(c.defines[w]);return c.isRawShaderMaterial===!1&&(s(_,c),L(_,c),_.push(e.outputColorSpace)),_.push(c.customProgramCacheKey),_.join()}function s(c,_){c.push(_.precision),c.push(_.outputColorSpace),c.push(_.envMapMode),c.push(_.envMapCubeUVHeight),c.push(_.mapUv),c.push(_.alphaMapUv),c.push(_.lightMapUv),c.push(_.aoMapUv),c.push(_.bumpMapUv),c.push(_.normalMapUv),c.push(_.displacementMapUv),c.push(_.emissiveMapUv),c.push(_.metalnessMapUv),c.push(_.roughnessMapUv),c.push(_.anisotropyMapUv),c.push(_.clearcoatMapUv),c.push(_.clearcoatNormalMapUv),c.push(_.clearcoatRoughnessMapUv),c.push(_.iridescenceMapUv),c.push(_.iridescenceThicknessMapUv),c.push(_.sheenColorMapUv),c.push(_.sheenRoughnessMapUv),c.push(_.specularMapUv),c.push(_.specularColorMapUv),c.push(_.specularIntensityMapUv),c.push(_.transmissionMapUv),c.push(_.thicknessMapUv),c.push(_.combine),c.push(_.fogExp2),c.push(_.sizeAttenuation),c.push(_.morphTargetsCount),c.push(_.morphAttributeCount),c.push(_.numSunLights),c.push(_.numDirLights),c.push(_.numPointLights),c.push(_.numSpotLights),c.push(_.numSpotLightMaps),c.push(_.numHemiLights),c.push(_.numRectAreaLights),c.push(_.numSunLightShadows),c.push(_.numDirLightShadows),c.push(_.numPointLightShadows),c.push(_.numSpotLightShadows),c.push(_.numSpotLightShadowsWithMaps),c.push(_.numLightProbes),c.push(_.shadowMapType),c.push(_.toneMapping),c.push(_.numClippingPlanes),c.push(_.numClipIntersection),c.push(_.depthPacking)}function L(c,_){d.disableAll(),_.instancing&&d.enable(0),_.instancingColor&&d.enable(1),_.instancingMorph&&d.enable(2),_.matcap&&d.enable(3),_.envMap&&d.enable(4),_.normalMapObjectSpace&&d.enable(5),_.normalMapTangentSpace&&d.enable(6),_.clearcoat&&d.enable(7),_.iridescence&&d.enable(8),_.alphaTest&&d.enable(9),_.vertexColors&&d.enable(10),_.vertexAlphas&&d.enable(11),_.vertexUv1s&&d.enable(12),_.vertexUv2s&&d.enable(13),_.vertexUv3s&&d.enable(14),_.vertexTangents&&d.enable(15),_.anisotropy&&d.enable(16),_.alphaHash&&d.enable(17),_.batching&&d.enable(18),_.dispersion&&d.enable(19),_.retroreflection&&d.enable(24),_.batchingColor&&d.enable(20),_.gradientMap&&d.enable(21),_.packedNormalMap&&d.enable(22),_.vertexNormals&&d.enable(23),c.push(d.mask),d.disableAll(),_.fog&&d.enable(0),_.useFog&&d.enable(1),_.flatShading&&d.enable(2),_.logarithmicDepthBuffer&&d.enable(3),_.reversedDepthBuffer&&d.enable(4),_.skinning&&d.enable(5),_.morphTargets&&d.enable(6),_.morphNormals&&d.enable(7),_.morphColors&&d.enable(8),_.premultipliedAlpha&&d.enable(9),_.shadowMapEnabled&&d.enable(10),_.doubleSided&&d.enable(11),_.flipSided&&d.enable(12),_.useDepthPacking&&d.enable(13),_.dithering&&d.enable(14),_.transmission&&d.enable(15),_.sheen&&d.enable(16),_.opaque&&d.enable(17),_.pointsUvs&&d.enable(18),_.decodeVideoTexture&&d.enable(19),_.decodeVideoTextureEmissive&&d.enable(20),_.alphaToCoverage&&d.enable(21),_.numLightProbeGrids>0&&d.enable(22),_.hasPositionAttribute&&d.enable(23),c.push(d.mask)}function z(c){const _=x[c.type];let w;if(_){const F=Tt[_];w=qa.clone(F.uniforms)}else w=c.uniforms;return w}function h(c,_){let w=H.get(_);return w!==void 0?++w.usedTimes:(w=new vm(e,_,c,l),T.push(w),H.set(_,w)),w}function S(c){if(--c.usedTimes===0){const _=T.indexOf(c);T[_]=T[T.length-1],T.pop(),H.delete(c.cacheKey),c.destroy()}}function m(c){g.remove(c)}function D(){g.dispose()}return{getParameters:W,getProgramCacheKey:f,getUniforms:z,acquireProgram:h,releaseProgram:S,releaseShaderCache:m,programs:T,dispose:D}}function Am(){let e=new WeakMap;function n(d){return e.has(d)}function t(d){let g=e.get(d);return g===void 0&&(g={},e.set(d,g)),g}function i(d){e.delete(d)}function l(d,g,R){e.get(d)[g]=R}function o(){e=new WeakMap}return{has:n,get:t,remove:i,update:l,dispose:o}}function Rm(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.material.id!==n.material.id?e.material.id-n.material.id:e.materialVariant!==n.materialVariant?e.materialVariant-n.materialVariant:e.z!==n.z?e.z-n.z:e.id-n.id}function Nr(e,n){return e.groupOrder!==n.groupOrder?e.groupOrder-n.groupOrder:e.renderOrder!==n.renderOrder?e.renderOrder-n.renderOrder:e.z!==n.z?n.z-e.z:e.id-n.id}function yr(){const e=[];let n=0;const t=[],i=[],l=[];function o(){n=0,t.length=0,i.length=0,l.length=0}function d(p){let x=0;return p.isInstancedMesh&&(x+=2),p.isSkinnedMesh&&(x+=1),x}function g(p,x,N,W,f,s){let L=e[n];return L===void 0?(L={id:p.id,object:p,geometry:x,material:N,materialVariant:d(p),groupOrder:W,renderOrder:p.renderOrder,z:f,group:s},e[n]=L):(L.id=p.id,L.object=p,L.geometry=x,L.material=N,L.materialVariant=d(p),L.groupOrder=W,L.renderOrder=p.renderOrder,L.z=f,L.group=s),n++,L}function R(p,x,N,W,f,s,L){L.reversedDepth===!0&&(f=-f);const z=g(p,x,N,W,f,s);N.transmission>0?i.push(z):N.transparent===!0?l.push(z):t.push(z)}function T(p,x,N,W,f,s){const L=g(p,x,N,W,f,s);N.transmission>0?i.unshift(L):N.transparent===!0?l.unshift(L):t.unshift(L)}function H(p,x){t.length>1&&t.sort(p||Rm),i.length>1&&i.sort(x||Nr),l.length>1&&l.sort(x||Nr)}function I(){for(let p=n,x=e.length;p<x;p++){const N=e[p];if(N.id===null)break;N.id=null,N.object=null,N.geometry=null,N.material=null,N.group=null}}return{opaque:t,transmissive:i,transparent:l,init:o,push:R,unshift:T,finish:I,sort:H}}function bm(){let e=new WeakMap;function n(i,l){const o=e.get(i);let d;return o===void 0?(d=new yr,e.set(i,[d])):l>=o.length?(d=new yr,o.push(d)):d=o[l],d}function t(){e=new WeakMap}return{get:n,dispose:t}}function Cm(){const e={};return{get:function(n){if(e[n.id]!==void 0)return e[n.id];let t;switch(n.type){case"SunLight":case"DirectionalLight":t={direction:new Ne,color:new je};break;case"SpotLight":t={position:new Ne,direction:new Ne,color:new je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Ne,color:new je,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Ne,skyColor:new je,groundColor:new je};break;case"RectAreaLight":t={color:new je,position:new Ne,halfWidth:new Ne,halfHeight:new Ne};break}return e[n.id]=t,t}}}function Pm(){const e={};return{get:function(n){if(e[n.id]!==void 0)return e[n.id];let t;switch(n.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mt,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[n.id]=t,t}}}let Lm=0;function Um(e,n){return(n.castShadow?2:0)-(e.castShadow?2:0)+(n.map?1:0)-(e.map?1:0)}function Dm(e){const n=new Cm,t=Pm(),i={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let T=0;T<9;T++)i.probe.push(new Ne);const l=new Ne,o=new qt,d=new qt;function g(T){let H=0,I=0,p=0;for(let G=0;G<9;G++)i.probe[G].set(0,0,0);let x=0,N=0,W=0,f=0,s=0,L=0,z=0,h=0,S=0,m=0,D=0,c=0,_=0,w=0;T.sort(Um);for(let G=0,q=T.length;G<q;G++){const P=T[G],K=P.color,Q=P.intensity,Y=P.distance;let ne=null;if(P.shadow&&P.shadow.map&&(P.shadow.map.texture.format===Zt?ne=P.shadow.map.texture:ne=P.shadow.map.depthTexture||P.shadow.map.texture),P.isAmbientLight)H+=K.r*Q,I+=K.g*Q,p+=K.b*Q;else if(P.isLightProbe){for(let Z=0;Z<9;Z++)i.probe[Z].addScaledVector(P.sh.coefficients[Z],Q);w++}else if(P.isSunLight){const Z=n.get(P);if(Z.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){const j=P.shadow,ee=t.get(P);ee.shadowIntensity=j.intensity,ee.shadowBias=j.bias,ee.shadowNormalBias=j.normalBias,ee.shadowRadius=j.radius,ee.shadowMapSize.copy(j.mapSize).multiply(j.getFrameExtents()),i.sunShadow[N]=ee,i.sunShadowMap[N]=ne;const be=j.getViewportCount();for(let Re=0;Re<be;Re++)i.sunShadowMatrix[W+Re]=j.getMatrix(Re),i.sunShadowCascade[W+Re]=j._cascadeData[Re];W+=be,N++}i.sun[x]=Z,x++}else if(P.isDirectionalLight){const Z=n.get(P);if(Z.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){const j=P.shadow,ee=t.get(P);ee.shadowIntensity=j.intensity,ee.shadowBias=j.bias,ee.shadowNormalBias=j.normalBias,ee.shadowRadius=j.radius,ee.shadowMapSize=j.mapSize,i.directionalShadow[f]=ee,i.directionalShadowMap[f]=ne,i.directionalShadowMatrix[f]=P.shadow.matrix,S++}i.directional[f]=Z,f++}else if(P.isSpotLight){const Z=n.get(P);Z.position.setFromMatrixPosition(P.matrixWorld),Z.color.copy(K).multiplyScalar(Q),Z.distance=Y,Z.coneCos=Math.cos(P.angle),Z.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),Z.decay=P.decay,i.spot[L]=Z;const j=P.shadow;if(P.map&&(i.spotLightMap[c]=P.map,c++,j.updateMatrices(P),P.castShadow&&_++),i.spotLightMatrix[L]=j.matrix,P.castShadow){const ee=t.get(P);ee.shadowIntensity=j.intensity,ee.shadowBias=j.bias,ee.shadowNormalBias=j.normalBias,ee.shadowRadius=j.radius,ee.shadowMapSize=j.mapSize,i.spotShadow[L]=ee,i.spotShadowMap[L]=ne,D++}L++}else if(P.isRectAreaLight){const Z=n.get(P);Z.color.copy(K).multiplyScalar(Q),Z.halfWidth.set(P.width*.5,0,0),Z.halfHeight.set(0,P.height*.5,0),i.rectArea[z]=Z,z++}else if(P.isPointLight){const Z=n.get(P);if(Z.color.copy(P.color).multiplyScalar(P.intensity),Z.distance=P.distance,Z.decay=P.decay,P.castShadow){const j=P.shadow,ee=t.get(P);ee.shadowIntensity=j.intensity,ee.shadowBias=j.bias,ee.shadowNormalBias=j.normalBias,ee.shadowRadius=j.radius,ee.shadowMapSize=j.mapSize,ee.shadowCameraNear=j.camera.near,ee.shadowCameraFar=j.camera.far,i.pointShadow[s]=ee,i.pointShadowMap[s]=ne,i.pointShadowMatrix[s]=P.shadow.matrix,m++}i.point[s]=Z,s++}else if(P.isHemisphereLight){const Z=n.get(P);Z.skyColor.copy(P.color).multiplyScalar(Q),Z.groundColor.copy(P.groundColor).multiplyScalar(Q),i.hemi[h]=Z,h++}}z>0&&(e.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=le.LTC_FLOAT_1,i.rectAreaLTC2=le.LTC_FLOAT_2):(i.rectAreaLTC1=le.LTC_HALF_1,i.rectAreaLTC2=le.LTC_HALF_2)),i.ambient[0]=H,i.ambient[1]=I,i.ambient[2]=p;const F=i.hash;(F.sunLength!==x||F.directionalLength!==f||F.pointLength!==s||F.spotLength!==L||F.rectAreaLength!==z||F.hemiLength!==h||F.numSunShadows!==N||F.numDirectionalShadows!==S||F.numPointShadows!==m||F.numSpotShadows!==D||F.numSpotMaps!==c||F.numLightProbes!==w)&&(i.sun.length=x,i.directional.length=f,i.spot.length=L,i.rectArea.length=z,i.point.length=s,i.hemi.length=h,i.sunShadow.length=N,i.sunShadowMap.length=N,i.sunShadowMatrix.length=W,i.sunShadowCascade.length=W,i.directionalShadow.length=S,i.directionalShadowMap.length=S,i.directionalShadowMatrix.length=S,i.pointShadow.length=m,i.pointShadowMap.length=m,i.pointShadowMatrix.length=m,i.spotShadow.length=D,i.spotShadowMap.length=D,i.spotLightMatrix.length=D+c-_,i.spotLightMap.length=c,i.numSpotLightShadowsWithMaps=_,i.numLightProbes=w,F.sunLength=x,F.directionalLength=f,F.pointLength=s,F.spotLength=L,F.rectAreaLength=z,F.hemiLength=h,F.numSunShadows=N,F.numDirectionalShadows=S,F.numPointShadows=m,F.numSpotShadows=D,F.numSpotMaps=c,F.numLightProbes=w,i.version=Lm++)}function R(T,H){let I=0,p=0,x=0,N=0,W=0,f=0;const s=H.matrixWorldInverse;for(let L=0,z=T.length;L<z;L++){const h=T[L];if(h.isSunLight){const S=i.sun[I];S.direction.setFromMatrixPosition(h.matrixWorld),S.direction.transformDirection(s),I++}else if(h.isDirectionalLight){const S=i.directional[p];S.direction.setFromMatrixPosition(h.matrixWorld),l.setFromMatrixPosition(h.target.matrixWorld),S.direction.sub(l),S.direction.transformDirection(s),p++}else if(h.isSpotLight){const S=i.spot[N];S.position.setFromMatrixPosition(h.matrixWorld),S.position.applyMatrix4(s),S.direction.setFromMatrixPosition(h.matrixWorld),l.setFromMatrixPosition(h.target.matrixWorld),S.direction.sub(l),S.direction.transformDirection(s),N++}else if(h.isRectAreaLight){const S=i.rectArea[W];S.position.setFromMatrixPosition(h.matrixWorld),S.position.applyMatrix4(s),d.identity(),o.copy(h.matrixWorld),o.premultiply(s),d.extractRotation(o),S.halfWidth.set(h.width*.5,0,0),S.halfHeight.set(0,h.height*.5,0),S.halfWidth.applyMatrix4(d),S.halfHeight.applyMatrix4(d),W++}else if(h.isPointLight){const S=i.point[x];S.position.setFromMatrixPosition(h.matrixWorld),S.position.applyMatrix4(s),x++}else if(h.isHemisphereLight){const S=i.hemi[f];S.direction.setFromMatrixPosition(h.matrixWorld),S.direction.transformDirection(s),f++}}}return{setup:g,setupView:R,state:i}}function Fr(e){const n=new Dm(e),t=[],i=[],l=[];function o(p){I.camera=p,t.length=0,i.length=0,l.length=0}function d(p){t.push(p)}function g(p){i.push(p)}function R(p){l.push(p)}function T(){n.setup(t)}function H(p){n.setupView(t,p)}const I={lightsArray:t,shadowsArray:i,lightProbeGridArray:l,camera:null,lights:n,transmissionRenderTarget:{},textureUnits:0};return{init:o,state:I,setupLights:T,setupLightsView:H,pushLight:d,pushShadow:g,pushLightProbeGrid:R}}function wm(e){let n=new WeakMap;function t(l,o=0){const d=n.get(l);let g;return d===void 0?(g=new Fr(e),n.set(l,[g])):o>=d.length?(g=new Fr(e),d.push(g)):g=d[o],g}function i(){n=new WeakMap}return{get:t,dispose:i}}const Im=`void main() {
4170
- gl_Position = vec4( position, 1.0 );
4171
- }`,Nm=`uniform sampler2D shadow_pass;
4172
- uniform vec2 resolution;
4173
- uniform float radius;
4174
- void main() {
4175
- const float samples = float( VSM_SAMPLES );
4176
- float mean = 0.0;
4177
- float squared_mean = 0.0;
4178
- float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4179
- float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4180
- for ( float i = 0.0; i < samples; i ++ ) {
4181
- float uvOffset = uvStart + i * uvStride;
4182
- #ifdef HORIZONTAL_PASS
4183
- vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4184
- mean += distribution.x;
4185
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4186
- #else
4187
- float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4188
- mean += depth;
4189
- squared_mean += depth * depth;
4190
- #endif
4191
- }
4192
- mean = mean / samples;
4193
- squared_mean = squared_mean / samples;
4194
- float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4195
- gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4196
- }`,ym=[new Ne(1,0,0),new Ne(-1,0,0),new Ne(0,1,0),new Ne(0,-1,0),new Ne(0,0,1),new Ne(0,0,-1)],Fm=[new Ne(0,-1,0),new Ne(0,-1,0),new Ne(0,0,1),new Ne(0,0,-1),new Ne(0,-1,0),new Ne(0,-1,0)],Or=new qt,ln=new Ne,Yn=new Ne;function Om(e,n,t){let i=new Xi;const l=new mt,o=new mt,d=new ht,g=new ua,R=new pa,T={},H=t.maxTextureSize,I={[rn]:St,[St]:rn,[Lt]:Lt},p=new Nt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new mt},radius:{value:4}},vertexShader:Im,fragmentShader:Nm}),x=p.clone();x.defines.HORIZONTAL_PASS=1;const N=new _n;N.setAttribute("position",new Dn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const W=new It(N,p),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=un;let s=this.type;this.render=function(m,D,c){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||m.length===0)return;this.type===Da&&(Ve("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=un);const _=e.getRenderTarget(),w=e.getActiveCubeFace(),F=e.getActiveMipmapLevel(),G=e.state;G.setBlending(Dt),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const q=s!==this.type;q&&D.traverse(function(P){P.material&&(Array.isArray(P.material)?P.material.forEach(K=>K.needsUpdate=!0):P.material.needsUpdate=!0)});for(let P=0,K=m.length;P<K;P++){const Q=m[P],Y=Q.shadow;if(Y===void 0){Ve("WebGLShadowMap:",Q,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;l.copy(Y.mapSize);const ne=Y.getFrameExtents();l.multiply(ne),o.copy(Y.mapSize),(l.x>H||l.y>H)&&(l.x>H&&(o.x=Math.floor(H/ne.x),l.x=o.x*ne.x,Y.mapSize.x=o.x),l.y>H&&(o.y=Math.floor(H/ne.y),l.y=o.y*ne.y,Y.mapSize.y=o.y));const Z=e.state.buffers.depth.getReversed();if(Y.camera._reversedDepth=Z,Y.map===null||q===!0){if(Y.map!==null&&(Y.map.depthTexture!==null&&(Y.map.depthTexture.dispose(),Y.map.depthTexture=null),Y.map.dispose()),this.type===en){if(Q.isPointLight){Ve("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Y.map=new Mt(l.x,l.y,{format:Zt,type:wt,minFilter:vt,magFilter:vt,generateMipmaps:!1}),Y.map.texture.name=Q.name+".shadowMap",Y.map.depthTexture=new hn(l.x,l.y,yt),Y.map.depthTexture.name=Q.name+".shadowMapDepth",Y.map.depthTexture.format=Yt,Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=Gt,Y.map.depthTexture.magFilter=Gt}else Q.isPointLight?(Y.map=new ar(l.x),Y.map.depthTexture=new Yr(l.x,Ht)):(Y.map=new Mt(l.x,l.y),Y.map.depthTexture=new hn(l.x,l.y,Ht)),Y.map.depthTexture.name=Q.name+".shadowMap",Y.map.depthTexture.format=Yt,this.type===un?(Y.map.depthTexture.compareFunction=Z?Fn:On,Y.map.depthTexture.minFilter=vt,Y.map.depthTexture.magFilter=vt):(Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=Gt,Y.map.depthTexture.magFilter=Gt);Y.camera.updateProjectionMatrix()}Y.map.isWebGLCubeRenderTarget!==!0&&(Y.map.width!==l.x||Y.map.height!==l.y)&&Y.map.setSize(l.x,l.y);const j=Y.map.isWebGLCubeRenderTarget?6:Y.getViewportCount();Q.isPointLight!==!0&&Y.updateMatrices(Q,c);for(let ee=0;ee<j;ee++){const be=Y.getCamera(ee);if(Q.isPointLight){const Re=Y.camera,it=Y.matrix,ke=Q.distance||Re.far;ke!==Re.far&&(Re.far=ke,Re.updateProjectionMatrix()),ln.setFromMatrixPosition(Q.matrixWorld),Re.position.copy(ln),Yn.copy(Re.position),Yn.add(ym[ee]),Re.up.copy(Fm[ee]),Re.lookAt(Yn),Re.updateMatrixWorld(),it.makeTranslation(-ln.x,-ln.y,-ln.z),Or.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),Y._frustum.setFromProjectionMatrix(Or,Re.coordinateSystem,Re.reversedDepth)}if(Y.map.isWebGLCubeRenderTarget)e.setRenderTarget(Y.map,ee),e.clear();else{ee===0&&(e.setRenderTarget(Y.map),e.clear());const Re=Y.getViewport(ee);d.set(o.x*Re.x,o.y*Re.y,o.x*Re.z,o.y*Re.w),G.viewport(d)}i=Y.getFrustum(ee),h(D,c,be,Q,this.type)}Y.isPointLightShadow!==!0&&this.type===en&&L(Y,c),Y.needsUpdate=!1}s=this.type,f.needsUpdate=!1,e.setRenderTarget(_,w,F)};function L(m,D){const c=n.update(W);p.defines.VSM_SAMPLES!==m.blurSamples&&(p.defines.VSM_SAMPLES=m.blurSamples,x.defines.VSM_SAMPLES=m.blurSamples,p.needsUpdate=!0,x.needsUpdate=!0),m.mapPass===null?m.mapPass=new Mt(l.x,l.y,{format:Zt,type:wt}):(m.mapPass.width!==m.map.width||m.mapPass.height!==m.map.height)&&m.mapPass.setSize(m.map.width,m.map.height),p.uniforms.shadow_pass.value=m.map.depthTexture,p.uniforms.resolution.value.set(m.map.width,m.map.height),p.uniforms.radius.value=m.radius,e.setRenderTarget(m.mapPass),e.clear(),e.renderBufferDirect(D,null,c,p,W,null),x.uniforms.shadow_pass.value=m.mapPass.texture,x.uniforms.resolution.value.set(m.map.width,m.map.height),x.uniforms.radius.value=m.radius,e.setRenderTarget(m.map),e.clear(),e.renderBufferDirect(D,null,c,x,W,null)}function z(m,D,c,_){let w=null;const F=c.isPointLight===!0?m.customDistanceMaterial:m.customDepthMaterial;if(F!==void 0)w=F;else if(w=c.isPointLight===!0?R:g,e.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const G=w.uuid,q=D.uuid;let P=T[G];P===void 0&&(P={},T[G]=P);let K=P[q];K===void 0&&(K=w.clone(),P[q]=K,D.addEventListener("dispose",S)),w=K}if(w.visible=D.visible,w.wireframe=D.wireframe,_===en?w.side=D.shadowSide!==null?D.shadowSide:D.side:w.side=D.shadowSide!==null?D.shadowSide:I[D.side],w.alphaMap=D.alphaMap,w.alphaTest=D.alphaToCoverage===!0?.5:D.alphaTest,w.map=D.map,w.clipShadows=D.clipShadows,w.clippingPlanes=D.clippingPlanes,w.clipIntersection=D.clipIntersection,w.displacementMap=D.displacementMap,w.displacementScale=D.displacementScale,w.displacementBias=D.displacementBias,w.wireframeLinewidth=D.wireframeLinewidth,w.linewidth=D.linewidth,c.isPointLight===!0&&w.isMeshDistanceMaterial===!0){const G=e.properties.get(w);G.light=c}return w}function h(m,D,c,_,w){if(m.visible===!1)return;if(m.layers.test(D.layers)&&(m.isMesh||m.isLine||m.isPoints)&&(m.castShadow||m.receiveShadow&&w===en)&&(!m.frustumCulled||m.intersectsFrustum(i))){m.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,m.matrixWorld);const q=n.update(m),P=m.material;if(Array.isArray(P)){const K=q.groups;for(let Q=0,Y=K.length;Q<Y;Q++){const ne=K[Q],Z=P[ne.materialIndex];if(Z&&Z.visible){const j=z(m,Z,_,w);m.onBeforeShadow(e,m,D,c,q,j,ne),e.renderBufferDirect(c,null,q,j,m,ne),m.onAfterShadow(e,m,D,c,q,j,ne)}}}else if(P.visible){const K=z(m,P,_,w);m.onBeforeShadow(e,m,D,c,q,K,null),e.renderBufferDirect(c,null,q,K,m,null),m.onAfterShadow(e,m,D,c,q,K,null)}}const G=m.children;for(let q=0,P=G.length;q<P;q++)h(G[q],D,c,_,w)}function S(m){m.target.removeEventListener("dispose",S);for(const c in T){const _=T[c],w=m.target.uuid;w in _&&(_[w].dispose(),delete _[w])}}}function Bm(e,n){function t(){let E=!1;const oe=new ht;let k=null;const se=new ht(0,0,0,0);return{setMask:function(ue){k!==ue&&!E&&(e.colorMask(ue,ue,ue,ue),k=ue)},setLocked:function(ue){E=ue},setClear:function(ue,J,Te,ve,Ze){Ze===!0&&(ue*=ve,J*=ve,Te*=ve),oe.set(ue,J,Te,ve),se.equals(oe)===!1&&(e.clearColor(ue,J,Te,ve),se.copy(oe))},reset:function(){E=!1,k=null,se.set(-1,0,0,0)}}}function i(){let E=!1,oe=!1,k=null,se=null,ue=null;return{setReversed:function(J){if(oe!==J){const Te=n.get("EXT_clip_control");J?Te.clipControlEXT(Te.LOWER_LEFT_EXT,Te.ZERO_TO_ONE_EXT):Te.clipControlEXT(Te.LOWER_LEFT_EXT,Te.NEGATIVE_ONE_TO_ONE_EXT),oe=J;const ve=ue;ue=null,this.setClear(ve)}},getReversed:function(){return oe},setTest:function(J){J?$(e.DEPTH_TEST):Ee(e.DEPTH_TEST)},setMask:function(J){k!==J&&!E&&(e.depthMask(J),k=J)},setFunc:function(J){if(oe&&(J=$f[J]),se!==J){switch(J){case Ea:e.depthFunc(e.NEVER);break;case Vr:e.depthFunc(e.ALWAYS);break;case ca:e.depthFunc(e.LESS);break;case Jn:e.depthFunc(e.LEQUAL);break;case na:e.depthFunc(e.EQUAL);break;case oa:e.depthFunc(e.GEQUAL);break;case aa:e.depthFunc(e.GREATER);break;case xa:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}se=J}},setLocked:function(J){E=J},setClear:function(J){ue!==J&&(ue=J,oe&&(J=1-J),e.clearDepth(J))},reset:function(){E=!1,k=null,se=null,ue=null,oe=!1}}}function l(){let E=!1,oe=null,k=null,se=null,ue=null,J=null,Te=null,ve=null,Ze=null;return{setTest:function(Ge){E||(Ge?$(e.STENCIL_TEST):Ee(e.STENCIL_TEST))},setMask:function(Ge){oe!==Ge&&!E&&(e.stencilMask(Ge),oe=Ge)},setFunc:function(Ge,xt,bt){(k!==Ge||se!==xt||ue!==bt)&&(e.stencilFunc(Ge,xt,bt),k=Ge,se=xt,ue=bt)},setOp:function(Ge,xt,bt){(J!==Ge||Te!==xt||ve!==bt)&&(e.stencilOp(Ge,xt,bt),J=Ge,Te=xt,ve=bt)},setLocked:function(Ge){E=Ge},setClear:function(Ge){Ze!==Ge&&(e.clearStencil(Ge),Ze=Ge)},reset:function(){E=!1,oe=null,k=null,se=null,ue=null,J=null,Te=null,ve=null,Ze=null}}}const o=new t,d=new i,g=new l,R=new WeakMap,T=new WeakMap;let H={},I={},p={},x=new WeakMap,N=[],W=null,f=!1,s=null,L=null,z=null,h=null,S=null,m=null,D=null,c=new je(0,0,0),_=0,w=!1,F=null,G=null,q=null,P=null,K=null;const Q=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,ne=0;const Z=e.getParameter(e.VERSION);Z.indexOf("WebGL")!==-1?(ne=parseFloat(/^WebGL (\d)/.exec(Z)[1]),Y=ne>=1):Z.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),Y=ne>=2);let j=null,ee={};const be=e.getParameter(e.SCISSOR_BOX),Re=e.getParameter(e.VIEWPORT),it=new ht().fromArray(be),ke=new ht().fromArray(Re);function ze(E,oe,k,se){const ue=new Uint8Array(4),J=e.createTexture();e.bindTexture(E,J),e.texParameteri(E,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(E,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let Te=0;Te<k;Te++)E===e.TEXTURE_3D||E===e.TEXTURE_2D_ARRAY?e.texImage3D(oe,0,e.RGBA,1,1,se,0,e.RGBA,e.UNSIGNED_BYTE,ue):e.texImage2D(oe+Te,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,ue);return J}const V={};V[e.TEXTURE_2D]=ze(e.TEXTURE_2D,e.TEXTURE_2D,1),V[e.TEXTURE_CUBE_MAP]=ze(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),V[e.TEXTURE_2D_ARRAY]=ze(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),V[e.TEXTURE_3D]=ze(e.TEXTURE_3D,e.TEXTURE_3D,1,1),o.setClear(0,0,0,1),d.setClear(1),g.setClear(0),$(e.DEPTH_TEST),d.setFunc(Jn),Ie(!1),et(Zn),$(e.CULL_FACE),Be(Dt);function $(E){H[E]!==!0&&(e.enable(E),H[E]=!0)}function Ee(E){H[E]!==!1&&(e.disable(E),H[E]=!1)}function Ue(E,oe){return p[E]!==oe?(e.bindFramebuffer(E,oe),p[E]=oe,E===e.DRAW_FRAMEBUFFER&&(p[e.FRAMEBUFFER]=oe),E===e.FRAMEBUFFER&&(p[e.DRAW_FRAMEBUFFER]=oe),!0):!1}function me(E,oe){let k=N,se=!1;if(E){k=x.get(oe),k===void 0&&(k=[],x.set(oe,k));const ue=E.textures;if(k.length!==ue.length||k[0]!==e.COLOR_ATTACHMENT0){for(let J=0,Te=ue.length;J<Te;J++)k[J]=e.COLOR_ATTACHMENT0+J;k.length=ue.length,se=!0}}else k[0]!==e.BACK&&(k[0]=e.BACK,se=!0);se&&e.drawBuffers(k)}function Fe(E){return W!==E?(e.useProgram(E),W=E,!0):!1}const st={[jt]:e.FUNC_ADD,[za]:e.FUNC_SUBTRACT,[Ba]:e.FUNC_REVERSE_SUBTRACT};st[ha]=e.MIN,st[fa]=e.MAX;const De={[Qa]:e.ZERO,[Aa]:e.ONE,[ka]:e.SRC_COLOR,[Va]:e.SRC_ALPHA,[Wa]:e.SRC_ALPHA_SATURATE,[ea]:e.DST_COLOR,[jr]:e.DST_ALPHA,[Ua]:e.ONE_MINUS_SRC_COLOR,[La]:e.ONE_MINUS_SRC_ALPHA,[Pa]:e.ONE_MINUS_DST_COLOR,[Ca]:e.ONE_MINUS_DST_ALPHA,[Xr]:e.CONSTANT_COLOR,[ba]:e.ONE_MINUS_CONSTANT_COLOR,[zr]:e.CONSTANT_ALPHA,[Ra]:e.ONE_MINUS_CONSTANT_ALPHA};function Be(E,oe,k,se,ue,J,Te,ve,Ze,Ge){if(E===Dt){f===!0&&(Ee(e.BLEND),f=!1);return}if(f===!1&&($(e.BLEND),f=!0),E!==$r){if(E!==s||Ge!==w){if((L!==jt||S!==jt)&&(e.blendEquation(e.FUNC_ADD),L=jt,S=jt),Ge)switch(E){case dn:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case qn:e.blendFunc(e.ONE,e.ONE);break;case Ui:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case jn:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Qe("WebGLState: Invalid blending: ",E);break}else switch(E){case dn:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case qn:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Ui:Qe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case jn:Qe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Qe("WebGLState: Invalid blending: ",E);break}z=null,h=null,m=null,D=null,c.set(0,0,0),_=0,s=E,w=Ge}return}ue=ue||oe,J=J||k,Te=Te||se,(oe!==L||ue!==S)&&(e.blendEquationSeparate(st[oe],st[ue]),L=oe,S=ue),(k!==z||se!==h||J!==m||Te!==D)&&(e.blendFuncSeparate(De[k],De[se],De[J],De[Te]),z=k,h=se,m=J,D=Te),(ve.equals(c)===!1||Ze!==_)&&(e.blendColor(ve.r,ve.g,ve.b,Ze),c.copy(ve),_=Ze),s=E,w=!1}function qe(E,oe){E.side===Lt?Ee(e.CULL_FACE):$(e.CULL_FACE);let k=E.side===St;oe&&(k=!k),Ie(k),E.blending===dn&&E.transparent===!1?Be(Dt):Be(E.blending,E.blendEquation,E.blendSrc,E.blendDst,E.blendEquationAlpha,E.blendSrcAlpha,E.blendDstAlpha,E.blendColor,E.blendAlpha,E.premultipliedAlpha),d.setFunc(E.depthFunc),d.setTest(E.depthTest),d.setMask(E.depthWrite),o.setMask(E.colorWrite);const se=E.stencilWrite;g.setTest(se),se&&(g.setMask(E.stencilWriteMask),g.setFunc(E.stencilFunc,E.stencilRef,E.stencilFuncMask),g.setOp(E.stencilFail,E.stencilZFail,E.stencilZPass)),_t(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),E.alphaToCoverage===!0?$(e.SAMPLE_ALPHA_TO_COVERAGE):Ee(e.SAMPLE_ALPHA_TO_COVERAGE)}function Ie(E){F!==E&&(E?e.frontFace(e.CW):e.frontFace(e.CCW),F=E)}function et(E){E!==Zr?($(e.CULL_FACE),E!==G&&(E===Zn?e.cullFace(e.BACK):E===qr?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Ee(e.CULL_FACE),G=E}function ft(E){E!==q&&(Y&&e.lineWidth(E),q=E)}function _t(E,oe,k){E?($(e.POLYGON_OFFSET_FILL),(P!==oe||K!==k)&&(P=oe,K=k,d.getReversed()&&(oe=-oe),e.polygonOffset(oe,k))):Ee(e.POLYGON_OFFSET_FILL)}function nt(E){E?$(e.SCISSOR_TEST):Ee(e.SCISSOR_TEST)}function at(E){E===void 0&&(E=e.TEXTURE0+Q-1),j!==E&&(e.activeTexture(E),j=E)}function M(E,oe,k){k===void 0&&(j===null?k=e.TEXTURE0+Q-1:k=j);let se=ee[k];se===void 0&&(se={type:void 0,texture:void 0},ee[k]=se),(se.type!==E||se.texture!==oe)&&(j!==k&&(e.activeTexture(k),j=k),e.bindTexture(E,oe||V[E]),se.type=E,se.texture=oe)}function dt(){const E=ee[j];E!==void 0&&E.type!==void 0&&(e.bindTexture(E.type,null),E.type=void 0,E.texture=void 0)}function We(){try{e.compressedTexImage2D(...arguments)}catch(E){Qe("WebGLState:",E)}}function u(){try{e.compressedTexImage3D(...arguments)}catch(E){Qe("WebGLState:",E)}}function r(){try{e.texSubImage2D(...arguments)}catch(E){Qe("WebGLState:",E)}}function A(){try{e.texSubImage3D(...arguments)}catch(E){Qe("WebGLState:",E)}}function U(){try{e.compressedTexSubImage2D(...arguments)}catch(E){Qe("WebGLState:",E)}}function O(){try{e.compressedTexSubImage3D(...arguments)}catch(E){Qe("WebGLState:",E)}}function te(){try{e.texStorage2D(...arguments)}catch(E){Qe("WebGLState:",E)}}function ie(){try{e.texStorage3D(...arguments)}catch(E){Qe("WebGLState:",E)}}function B(){try{e.texImage2D(...arguments)}catch(E){Qe("WebGLState:",E)}}function X(){try{e.texImage3D(...arguments)}catch(E){Qe("WebGLState:",E)}}function re(E){return I[E]!==void 0?I[E]:e.getParameter(E)}function Me(E,oe){I[E]!==oe&&(e.pixelStorei(E,oe),I[E]=oe)}function ce(E){it.equals(E)===!1&&(e.scissor(E.x,E.y,E.z,E.w),it.copy(E))}function ae(E){ke.equals(E)===!1&&(e.viewport(E.x,E.y,E.z,E.w),ke.copy(E))}function xe(E,oe){let k=T.get(oe);k===void 0&&(k=new WeakMap,T.set(oe,k));let se=k.get(E);se===void 0&&(se=e.getUniformBlockIndex(oe,E.name),k.set(E,se))}function Ae(E,oe){const se=T.get(oe).get(E);R.get(oe)!==se&&(e.uniformBlockBinding(oe,se,E.__bindingPointIndex),R.set(oe,se))}function Ce(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),d.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),H={},I={},j=null,ee={},p={},x=new WeakMap,N=[],W=null,f=!1,s=null,L=null,z=null,h=null,S=null,m=null,D=null,c=new je(0,0,0),_=0,w=!1,F=null,G=null,q=null,P=null,K=null,it.set(0,0,e.canvas.width,e.canvas.height),ke.set(0,0,e.canvas.width,e.canvas.height),o.reset(),d.reset(),g.reset()}return{buffers:{color:o,depth:d,stencil:g},enable:$,disable:Ee,bindFramebuffer:Ue,drawBuffers:me,useProgram:Fe,setBlending:Be,setMaterial:qe,setFlipSided:Ie,setCullFace:et,setLineWidth:ft,setPolygonOffset:_t,setScissorTest:nt,activeTexture:at,bindTexture:M,unbindTexture:dt,compressedTexImage2D:We,compressedTexImage3D:u,texImage2D:B,texImage3D:X,pixelStorei:Me,getParameter:re,updateUBOMapping:xe,uniformBlockBinding:Ae,texStorage2D:te,texStorage3D:ie,texSubImage2D:r,texSubImage3D:A,compressedTexSubImage2D:U,compressedTexSubImage3D:O,scissor:ce,viewport:ae,reset:Ce}}function Gm(e,n,t,i,l,o,d){const g=n.has("WEBGL_multisampled_render_to_texture")?n.get("WEBGL_multisampled_render_to_texture"):null,R=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),T=new mt,H=new WeakMap,I=new Set;let p;const x=new WeakMap;let N=!1;try{N=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function W(u,r){return N?new OffscreenCanvas(u,r):Qf("canvas")}function f(u,r,A){let U=1;const O=We(u);if((O.width>A||O.height>A)&&(U=A/Math.max(O.width,O.height)),U<1)if(typeof HTMLImageElement<"u"&&u instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&u instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&u instanceof ImageBitmap||typeof VideoFrame<"u"&&u instanceof VideoFrame){const te=Math.floor(U*O.width),ie=Math.floor(U*O.height);p===void 0&&(p=W(te,ie));const B=r?W(te,ie):p;return B.width=te,B.height=ie,B.getContext("2d").drawImage(u,0,0,te,ie),Ve("WebGLRenderer: Texture has been resized from ("+O.width+"x"+O.height+") to ("+te+"x"+ie+")."),B}else return"data"in u&&Ve("WebGLRenderer: Image in DataTexture is too big ("+O.width+"x"+O.height+")."),u;return u}function s(u){return u.generateMipmaps}function L(u){e.generateMipmap(u)}function z(u){return u.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:u.isWebGL3DRenderTarget?e.TEXTURE_3D:u.isWebGLArrayRenderTarget||u.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function h(u,r,A,U,O,te=!1){if(u!==null){if(e[u]!==void 0)return e[u];Ve("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+u+"'")}let ie;U&&(ie=n.get("EXT_texture_norm16"),ie||Ve("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let B=r;if(r===e.RED&&(A===e.FLOAT&&(B=e.R32F),A===e.HALF_FLOAT&&(B=e.R16F),A===e.UNSIGNED_BYTE&&(B=e.R8),A===e.UNSIGNED_SHORT&&ie&&(B=ie.R16_EXT),A===e.SHORT&&ie&&(B=ie.R16_SNORM_EXT)),r===e.RED_INTEGER&&(A===e.UNSIGNED_BYTE&&(B=e.R8UI),A===e.UNSIGNED_SHORT&&(B=e.R16UI),A===e.UNSIGNED_INT&&(B=e.R32UI),A===e.BYTE&&(B=e.R8I),A===e.SHORT&&(B=e.R16I),A===e.INT&&(B=e.R32I)),r===e.RG&&(A===e.FLOAT&&(B=e.RG32F),A===e.HALF_FLOAT&&(B=e.RG16F),A===e.UNSIGNED_BYTE&&(B=e.RG8),A===e.UNSIGNED_SHORT&&ie&&(B=ie.RG16_EXT),A===e.SHORT&&ie&&(B=ie.RG16_SNORM_EXT)),r===e.RG_INTEGER&&(A===e.UNSIGNED_BYTE&&(B=e.RG8UI),A===e.UNSIGNED_SHORT&&(B=e.RG16UI),A===e.UNSIGNED_INT&&(B=e.RG32UI),A===e.BYTE&&(B=e.RG8I),A===e.SHORT&&(B=e.RG16I),A===e.INT&&(B=e.RG32I)),r===e.RGB_INTEGER&&(A===e.UNSIGNED_BYTE&&(B=e.RGB8UI),A===e.UNSIGNED_SHORT&&(B=e.RGB16UI),A===e.UNSIGNED_INT&&(B=e.RGB32UI),A===e.BYTE&&(B=e.RGB8I),A===e.SHORT&&(B=e.RGB16I),A===e.INT&&(B=e.RGB32I)),r===e.RGBA_INTEGER&&(A===e.UNSIGNED_BYTE&&(B=e.RGBA8UI),A===e.UNSIGNED_SHORT&&(B=e.RGBA16UI),A===e.UNSIGNED_INT&&(B=e.RGBA32UI),A===e.BYTE&&(B=e.RGBA8I),A===e.SHORT&&(B=e.RGBA16I),A===e.INT&&(B=e.RGBA32I)),r===e.RGB&&(A===e.UNSIGNED_SHORT&&ie&&(B=ie.RGB16_EXT),A===e.SHORT&&ie&&(B=ie.RGB16_SNORM_EXT),A===e.UNSIGNED_INT_5_9_9_9_REV&&(B=e.RGB9_E5),A===e.UNSIGNED_INT_10F_11F_11F_REV&&(B=e.R11F_G11F_B10F)),r===e.RGBA){const X=te?Zi:tt.getTransfer(O);A===e.FLOAT&&(B=e.RGBA32F),A===e.HALF_FLOAT&&(B=e.RGBA16F),A===e.UNSIGNED_BYTE&&(B=X===Ye?e.SRGB8_ALPHA8:e.RGBA8),A===e.UNSIGNED_SHORT&&ie&&(B=ie.RGBA16_EXT),A===e.SHORT&&ie&&(B=ie.RGBA16_SNORM_EXT),A===e.UNSIGNED_SHORT_4_4_4_4&&(B=e.RGBA4),A===e.UNSIGNED_SHORT_5_5_5_1&&(B=e.RGB5_A1)}return(B===e.R16F||B===e.R32F||B===e.RG16F||B===e.RG32F||B===e.RGBA16F||B===e.RGBA32F)&&n.get("EXT_color_buffer_float"),B}function S(u,r){let A;return u?r===null||r===Ht||r===an?A=e.DEPTH24_STENCIL8:r===yt?A=e.DEPTH32F_STENCIL8:r===mn&&(A=e.DEPTH24_STENCIL8,Ve("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):r===null||r===Ht||r===an?A=e.DEPTH_COMPONENT24:r===yt?A=e.DEPTH_COMPONENT32F:r===mn&&(A=e.DEPTH_COMPONENT16),A}function m(u,r){return s(u)===!0||u.isFramebufferTexture&&u.minFilter!==Gt&&u.minFilter!==vt?Math.log2(Math.max(r.width,r.height))+1:u.mipmaps!==void 0&&u.mipmaps.length>0?u.mipmaps.length:u.isCompressedTexture&&Array.isArray(u.image)?r.mipmaps.length:1}function D(u){const r=u.target;r.removeEventListener("dispose",D),_(r),r.isVideoTexture&&H.delete(r),r.isHTMLTexture&&I.delete(r)}function c(u){const r=u.target;r.removeEventListener("dispose",c),F(r)}function _(u){const r=i.get(u);if(r.__webglInit===void 0)return;const A=u.source,U=x.get(A);if(U){const O=U[r.__cacheKey];O.usedTimes--,O.usedTimes===0&&w(u),Object.keys(U).length===0&&x.delete(A)}i.remove(u)}function w(u){const r=i.get(u);e.deleteTexture(r.__webglTexture);const A=u.source,U=x.get(A);delete U[r.__cacheKey],d.memory.textures--}function F(u){const r=i.get(u);if(u.depthTexture&&(u.depthTexture.dispose(),i.remove(u.depthTexture)),u.isWebGLCubeRenderTarget)for(let U=0;U<6;U++){if(Array.isArray(r.__webglFramebuffer[U]))for(let O=0;O<r.__webglFramebuffer[U].length;O++)e.deleteFramebuffer(r.__webglFramebuffer[U][O]);else e.deleteFramebuffer(r.__webglFramebuffer[U]);r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[U])}else{if(Array.isArray(r.__webglFramebuffer))for(let U=0;U<r.__webglFramebuffer.length;U++)e.deleteFramebuffer(r.__webglFramebuffer[U]);else e.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let U=0;U<r.__webglColorRenderbuffer.length;U++)r.__webglColorRenderbuffer[U]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[U]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}const A=u.textures;for(let U=0,O=A.length;U<O;U++){const te=i.get(A[U]);te.__webglTexture&&(e.deleteTexture(te.__webglTexture),d.memory.textures--),i.remove(A[U])}i.remove(u)}let G=0;function q(){G=0}function P(){return G}function K(u){G=u}function Q(){const u=G;return u>=l.maxTextures&&Ve("WebGLTextures: Trying to use "+(u+1)+" texture units while this GPU supports only "+l.maxTextures),G+=1,u}function Y(u){const r=[];return r.push(u.wrapS),r.push(u.wrapT),r.push(u.wrapR||0),r.push(u.magFilter),r.push(u.minFilter),r.push(u.anisotropy),r.push(u.internalFormat),r.push(u.format),r.push(u.type),r.push(u.generateMipmaps),r.push(u.premultiplyAlpha),r.push(u.flipY),r.push(u.unpackAlignment),r.push(u.colorSpace),r.join()}function ne(u,r){const A=i.get(u);if(u.isVideoTexture&&M(u),u.isRenderTargetTexture===!1&&u.isExternalTexture!==!0&&u.version>0&&A.__version!==u.version){const U=u.image;if(U===null)Ve("WebGLRenderer: Texture marked for update but no image data found.");else if(U.complete===!1)Ve("WebGLRenderer: Texture marked for update but image is incomplete");else{Ee(A,u,r);return}}else u.isExternalTexture&&(A.__webglTexture=u.sourceTexture?u.sourceTexture:null);t.bindTexture(e.TEXTURE_2D,A.__webglTexture,e.TEXTURE0+r)}function Z(u,r){const A=i.get(u);if(u.isRenderTargetTexture===!1&&u.version>0&&A.__version!==u.version){Ee(A,u,r);return}else u.isExternalTexture&&(A.__webglTexture=u.sourceTexture?u.sourceTexture:null);t.bindTexture(e.TEXTURE_2D_ARRAY,A.__webglTexture,e.TEXTURE0+r)}function j(u,r){const A=i.get(u);if(u.isRenderTargetTexture===!1&&u.version>0&&A.__version!==u.version){Ee(A,u,r);return}t.bindTexture(e.TEXTURE_3D,A.__webglTexture,e.TEXTURE0+r)}function ee(u,r){const A=i.get(u);if(u.isCubeDepthTexture!==!0&&u.version>0&&A.__version!==u.version){Ue(A,u,r);return}t.bindTexture(e.TEXTURE_CUBE_MAP,A.__webglTexture,e.TEXTURE0+r)}const be={[Oa]:e.REPEAT,[wn]:e.CLAMP_TO_EDGE,[ma]:e.MIRRORED_REPEAT},Re={[Gt]:e.NEAREST,[va]:e.NEAREST_MIPMAP_NEAREST,[cn]:e.NEAREST_MIPMAP_LINEAR,[vt]:e.LINEAR,[An]:e.LINEAR_MIPMAP_NEAREST,[Xt]:e.LINEAR_MIPMAP_LINEAR},it={[Sa]:e.NEVER,[Hr]:e.ALWAYS,[la]:e.LESS,[On]:e.LEQUAL,[ta]:e.EQUAL,[Fn]:e.GEQUAL,[ra]:e.GREATER,[Ma]:e.NOTEQUAL};function ke(u,r){if(r.type===yt&&n.has("OES_texture_float_linear")===!1&&(r.magFilter===vt||r.magFilter===An||r.magFilter===cn||r.magFilter===Xt||r.minFilter===vt||r.minFilter===An||r.minFilter===cn||r.minFilter===Xt)&&Ve("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(u,e.TEXTURE_WRAP_S,be[r.wrapS]),e.texParameteri(u,e.TEXTURE_WRAP_T,be[r.wrapT]),(u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY)&&e.texParameteri(u,e.TEXTURE_WRAP_R,be[r.wrapR]),e.texParameteri(u,e.TEXTURE_MAG_FILTER,Re[r.magFilter]),e.texParameteri(u,e.TEXTURE_MIN_FILTER,Re[r.minFilter]),r.compareFunction&&(e.texParameteri(u,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(u,e.TEXTURE_COMPARE_FUNC,it[r.compareFunction])),n.has("EXT_texture_filter_anisotropic")===!0){if(r.magFilter===Gt||r.minFilter!==cn&&r.minFilter!==Xt||r.type===yt&&n.has("OES_texture_float_linear")===!1)return;if(r.anisotropy>1||i.get(r).__currentAnisotropy){const A=n.get("EXT_texture_filter_anisotropic");e.texParameterf(u,A.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,l.getMaxAnisotropy())),i.get(r).__currentAnisotropy=r.anisotropy}}}function ze(u,r){let A=!1;u.__webglInit===void 0&&(u.__webglInit=!0,r.addEventListener("dispose",D));const U=r.source;let O=x.get(U);O===void 0&&(O={},x.set(U,O));const te=Y(r);if(te!==u.__cacheKey){O[te]===void 0&&(O[te]={texture:e.createTexture(),usedTimes:0},d.memory.textures++,A=!0),O[te].usedTimes++;const ie=O[u.__cacheKey];ie!==void 0&&(O[u.__cacheKey].usedTimes--,ie.usedTimes===0&&w(r)),u.__cacheKey=te,u.__webglTexture=O[te].texture}return A}function V(u,r,A){return Math.floor(Math.floor(u/A)/r)}function $(u,r,A,U){const te=u.updateRanges;if(te.length===0)t.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,A,U,r.data);else{te.sort((Me,ce)=>Me.start-ce.start);let ie=0;for(let Me=1;Me<te.length;Me++){const ce=te[ie],ae=te[Me],xe=ce.start+ce.count,Ae=V(ae.start,r.width,4),Ce=V(ce.start,r.width,4);ae.start<=xe+1&&Ae===Ce&&V(ae.start+ae.count-1,r.width,4)===Ae?ce.count=Math.max(ce.count,ae.start+ae.count-ce.start):(++ie,te[ie]=ae)}te.length=ie+1;const B=t.getParameter(e.UNPACK_ROW_LENGTH),X=t.getParameter(e.UNPACK_SKIP_PIXELS),re=t.getParameter(e.UNPACK_SKIP_ROWS);t.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let Me=0,ce=te.length;Me<ce;Me++){const ae=te[Me],xe=Math.floor(ae.start/4),Ae=Math.ceil(ae.count/4),Ce=xe%r.width,E=Math.floor(xe/r.width),oe=Ae,k=1;t.pixelStorei(e.UNPACK_SKIP_PIXELS,Ce),t.pixelStorei(e.UNPACK_SKIP_ROWS,E),t.texSubImage2D(e.TEXTURE_2D,0,Ce,E,oe,k,A,U,r.data)}u.clearUpdateRanges(),t.pixelStorei(e.UNPACK_ROW_LENGTH,B),t.pixelStorei(e.UNPACK_SKIP_PIXELS,X),t.pixelStorei(e.UNPACK_SKIP_ROWS,re)}}function Ee(u,r,A){let U=e.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(U=e.TEXTURE_2D_ARRAY),r.isData3DTexture&&(U=e.TEXTURE_3D);const O=ze(u,r),te=r.source;t.bindTexture(U,u.__webglTexture,e.TEXTURE0+A);const ie=i.get(te);if(te.version!==ie.__version||O===!0){if(t.activeTexture(e.TEXTURE0+A),(typeof ImageBitmap<"u"&&r.image instanceof ImageBitmap)===!1){const k=tt.getPrimaries(tt.workingColorSpace),se=r.colorSpace===kt?null:tt.getPrimaries(r.colorSpace),ue=r.colorSpace===kt||k===se?e.NONE:e.BROWSER_DEFAULT_WEBGL;t.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,ue)}t.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment);let X=f(r.image,!1,l.maxTextureSize);X=dt(r,X);const re=o.convert(r.format,r.colorSpace),Me=o.convert(r.type);let ce=h(r.internalFormat,re,Me,r.normalized,r.colorSpace,r.isVideoTexture);ke(U,r);let ae;const xe=r.mipmaps,Ae=r.isVideoTexture!==!0,Ce=ie.__version===void 0||O===!0,E=te.dataReady,oe=m(r,X);if(r.isDepthTexture)ce=S(r.format===zt,r.type),Ce&&(Ae?t.texStorage2D(e.TEXTURE_2D,1,ce,X.width,X.height):t.texImage2D(e.TEXTURE_2D,0,ce,X.width,X.height,0,re,Me,null));else if(r.isDataTexture)if(xe.length>0){Ae&&Ce&&t.texStorage2D(e.TEXTURE_2D,oe,ce,xe[0].width,xe[0].height);for(let k=0,se=xe.length;k<se;k++)ae=xe[k],Ae?E&&t.texSubImage2D(e.TEXTURE_2D,k,0,0,ae.width,ae.height,re,Me,ae.data):t.texImage2D(e.TEXTURE_2D,k,ce,ae.width,ae.height,0,re,Me,ae.data);r.generateMipmaps=!1}else Ae?(Ce&&t.texStorage2D(e.TEXTURE_2D,oe,ce,X.width,X.height),E&&$(r,X,re,Me)):t.texImage2D(e.TEXTURE_2D,0,ce,X.width,X.height,0,re,Me,X.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){Ae&&Ce&&t.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ce,xe[0].width,xe[0].height,X.depth);for(let k=0,se=xe.length;k<se;k++)if(ae=xe[k],r.format!==Ut)if(re!==null)if(Ae){if(E)if(r.layerUpdates.size>0){const ue=_r(ae.width,ae.height,r.format,r.type);for(const J of r.layerUpdates){const Te=ae.data.subarray(J*ue/ae.data.BYTES_PER_ELEMENT,(J+1)*ue/ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,J,ae.width,ae.height,1,re,Te)}}else t.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,0,ae.width,ae.height,X.depth,re,ae.data)}else t.compressedTexImage3D(e.TEXTURE_2D_ARRAY,k,ce,ae.width,ae.height,X.depth,0,ae.data,0,0);else Ve("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ae?E&&t.texSubImage3D(e.TEXTURE_2D_ARRAY,k,0,0,0,ae.width,ae.height,X.depth,re,Me,ae.data):t.texImage3D(e.TEXTURE_2D_ARRAY,k,ce,ae.width,ae.height,X.depth,0,re,Me,ae.data);r.layerUpdates.size>0&&r.clearLayerUpdates()}else{Ae&&Ce&&t.texStorage2D(e.TEXTURE_2D,oe,ce,xe[0].width,xe[0].height);for(let k=0,se=xe.length;k<se;k++)ae=xe[k],r.format!==Ut?re!==null?Ae?E&&t.compressedTexSubImage2D(e.TEXTURE_2D,k,0,0,ae.width,ae.height,re,ae.data):t.compressedTexImage2D(e.TEXTURE_2D,k,ce,ae.width,ae.height,0,ae.data):Ve("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ae?E&&t.texSubImage2D(e.TEXTURE_2D,k,0,0,ae.width,ae.height,re,Me,ae.data):t.texImage2D(e.TEXTURE_2D,k,ce,ae.width,ae.height,0,re,Me,ae.data)}else if(r.isDataArrayTexture)if(Ae){if(Ce&&t.texStorage3D(e.TEXTURE_2D_ARRAY,oe,ce,X.width,X.height,X.depth),E)if(r.layerUpdates.size>0){const k=_r(X.width,X.height,r.format,r.type);for(const se of r.layerUpdates){const ue=X.data.subarray(se*k/X.data.BYTES_PER_ELEMENT,(se+1)*k/X.data.BYTES_PER_ELEMENT);t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,se,X.width,X.height,1,re,Me,ue)}r.clearLayerUpdates()}else t.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,X.width,X.height,X.depth,re,Me,X.data)}else t.texImage3D(e.TEXTURE_2D_ARRAY,0,ce,X.width,X.height,X.depth,0,re,Me,X.data);else if(r.isData3DTexture)Ae?(Ce&&t.texStorage3D(e.TEXTURE_3D,oe,ce,X.width,X.height,X.depth),E&&t.texSubImage3D(e.TEXTURE_3D,0,0,0,0,X.width,X.height,X.depth,re,Me,X.data)):t.texImage3D(e.TEXTURE_3D,0,ce,X.width,X.height,X.depth,0,re,Me,X.data);else if(r.isFramebufferTexture){if(Ce)if(Ae)t.texStorage2D(e.TEXTURE_2D,oe,ce,X.width,X.height);else{let k=X.width,se=X.height;for(let ue=0;ue<oe;ue++)t.texImage2D(e.TEXTURE_2D,ue,ce,k,se,0,re,Me,null),k>>=1,se>>=1}}else if(r.isHTMLTexture){if("texElementImage2D"in e){const k=e.canvas;if(k.hasAttribute("layoutsubtree")||k.setAttribute("layoutsubtree","true"),X.parentNode!==k){k.appendChild(X),I.add(r),k.onpaint=se=>{const ue=se.changedElements;for(const J of I)ue.includes(J.image)&&(J.needsUpdate=!0)},k.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,X);else{const ue=e.RGBA,J=e.RGBA,Te=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,ue,J,Te,X)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(xe.length>0){if(Ae&&Ce){const k=We(xe[0]);t.texStorage2D(e.TEXTURE_2D,oe,ce,k.width,k.height)}for(let k=0,se=xe.length;k<se;k++)ae=xe[k],Ae?E&&t.texSubImage2D(e.TEXTURE_2D,k,0,0,re,Me,ae):t.texImage2D(e.TEXTURE_2D,k,ce,re,Me,ae);r.generateMipmaps=!1}else if(Ae){if(Ce){const k=We(X);t.texStorage2D(e.TEXTURE_2D,oe,ce,k.width,k.height)}E&&t.texSubImage2D(e.TEXTURE_2D,0,0,0,re,Me,X)}else t.texImage2D(e.TEXTURE_2D,0,ce,re,Me,X);s(r)&&L(U),ie.__version=te.version,r.onUpdate&&r.onUpdate(r)}u.__version=r.version}function Ue(u,r,A){if(r.image.length!==6)return;const U=ze(u,r),O=r.source;t.bindTexture(e.TEXTURE_CUBE_MAP,u.__webglTexture,e.TEXTURE0+A);const te=i.get(O);if(O.version!==te.__version||U===!0){t.activeTexture(e.TEXTURE0+A);const ie=tt.getPrimaries(tt.workingColorSpace),B=r.colorSpace===kt?null:tt.getPrimaries(r.colorSpace),X=r.colorSpace===kt||ie===B?e.NONE:e.BROWSER_DEFAULT_WEBGL;t.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,X);const re=r.isCompressedTexture||r.image[0].isCompressedTexture,Me=r.image[0]&&r.image[0].isDataTexture,ce=[];for(let J=0;J<6;J++)!re&&!Me?ce[J]=f(r.image[J],!0,l.maxCubemapSize):ce[J]=Me?r.image[J].image:r.image[J],ce[J]=dt(r,ce[J]);const ae=ce[0],xe=o.convert(r.format,r.colorSpace),Ae=o.convert(r.type),Ce=h(r.internalFormat,xe,Ae,r.normalized,r.colorSpace),E=r.isVideoTexture!==!0,oe=te.__version===void 0||U===!0,k=O.dataReady;let se=m(r,ae);ke(e.TEXTURE_CUBE_MAP,r);let ue;if(re){E&&oe&&t.texStorage2D(e.TEXTURE_CUBE_MAP,se,Ce,ae.width,ae.height);for(let J=0;J<6;J++){ue=ce[J].mipmaps;for(let Te=0;Te<ue.length;Te++){const ve=ue[Te];r.format!==Ut?xe!==null?E?k&&t.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te,0,0,ve.width,ve.height,xe,ve.data):t.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te,Ce,ve.width,ve.height,0,ve.data):Ve("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):E?k&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te,0,0,ve.width,ve.height,xe,Ae,ve.data):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te,Ce,ve.width,ve.height,0,xe,Ae,ve.data)}}}else{if(ue=r.mipmaps,E&&oe){ue.length>0&&se++;const J=We(ce[0]);t.texStorage2D(e.TEXTURE_CUBE_MAP,se,Ce,J.width,J.height)}for(let J=0;J<6;J++)if(Me){E?k&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,ce[J].width,ce[J].height,xe,Ae,ce[J].data):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ce,ce[J].width,ce[J].height,0,xe,Ae,ce[J].data);for(let Te=0;Te<ue.length;Te++){const Ze=ue[Te].image[J].image;E?k&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te+1,0,0,Ze.width,Ze.height,xe,Ae,Ze.data):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te+1,Ce,Ze.width,Ze.height,0,xe,Ae,Ze.data)}}else{E?k&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,xe,Ae,ce[J]):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,Ce,xe,Ae,ce[J]);for(let Te=0;Te<ue.length;Te++){const ve=ue[Te];E?k&&t.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te+1,0,0,xe,Ae,ve.image[J]):t.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,Te+1,Ce,xe,Ae,ve.image[J])}}}s(r)&&L(e.TEXTURE_CUBE_MAP),te.__version=O.version,r.onUpdate&&r.onUpdate(r)}u.__version=r.version}function me(u,r,A,U,O,te){const ie=o.convert(A.format,A.colorSpace),B=o.convert(A.type),X=h(A.internalFormat,ie,B,A.normalized,A.colorSpace),re=i.get(r),Me=i.get(A);if(Me.__renderTarget=r,!re.__hasExternalTextures){const ce=Math.max(1,r.width>>te),ae=Math.max(1,r.height>>te);O===e.TEXTURE_3D||O===e.TEXTURE_2D_ARRAY?t.texImage3D(O,te,X,ce,ae,r.depth,0,ie,B,null):t.texImage2D(O,te,X,ce,ae,0,ie,B,null)}t.bindFramebuffer(e.FRAMEBUFFER,u),at(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,U,O,Me.__webglTexture,0,nt(r)):(O===e.TEXTURE_2D||O>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&O<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,U,O,Me.__webglTexture,te),t.bindFramebuffer(e.FRAMEBUFFER,null)}function Fe(u,r,A){if(e.bindRenderbuffer(e.RENDERBUFFER,u),r.depthBuffer){const U=r.depthTexture,O=U&&U.isDepthTexture?U.type:null,te=S(r.stencilBuffer,O),ie=r.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;at(r)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,nt(r),te,r.width,r.height):A?e.renderbufferStorageMultisample(e.RENDERBUFFER,nt(r),te,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,te,r.width,r.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,ie,e.RENDERBUFFER,u)}else{const U=r.textures;for(let O=0;O<U.length;O++){const te=U[O],ie=o.convert(te.format,te.colorSpace),B=o.convert(te.type),X=h(te.internalFormat,ie,B,te.normalized,te.colorSpace);at(r)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,nt(r),X,r.width,r.height):A?e.renderbufferStorageMultisample(e.RENDERBUFFER,nt(r),X,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,X,r.width,r.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function st(u,r,A){const U=r.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(e.FRAMEBUFFER,u),!(r.depthTexture&&r.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const O=i.get(r.depthTexture);if(O.__renderTarget=r,(!O.__webglTexture||r.depthTexture.image.width!==r.width||r.depthTexture.image.height!==r.height)&&(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),U){if(O.__webglInit===void 0&&(O.__webglInit=!0,r.depthTexture.addEventListener("dispose",D)),O.__webglTexture===void 0){O.__webglTexture=e.createTexture(),t.bindTexture(e.TEXTURE_CUBE_MAP,O.__webglTexture),ke(e.TEXTURE_CUBE_MAP,r.depthTexture);const re=o.convert(r.depthTexture.format),Me=o.convert(r.depthTexture.type);let ce;r.depthTexture.format===Yt?ce=e.DEPTH_COMPONENT24:r.depthTexture.format===zt&&(ce=e.DEPTH24_STENCIL8);for(let ae=0;ae<6;ae++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,ce,r.width,r.height,0,re,Me,null)}}else ne(r.depthTexture,0);const te=O.__webglTexture,ie=nt(r),B=U?e.TEXTURE_CUBE_MAP_POSITIVE_X+A:e.TEXTURE_2D,X=r.depthTexture.format===zt?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(r.depthTexture.format===Yt)at(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,X,B,te,0,ie):e.framebufferTexture2D(e.FRAMEBUFFER,X,B,te,0);else if(r.depthTexture.format===zt)at(r)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,X,B,te,0,ie):e.framebufferTexture2D(e.FRAMEBUFFER,X,B,te,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function De(u){const r=i.get(u),A=u.isWebGLCubeRenderTarget===!0;if(r.__boundDepthTexture!==u.depthTexture){const U=u.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),U){const O=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,U.removeEventListener("dispose",O)};U.addEventListener("dispose",O),r.__depthDisposeCallback=O}r.__boundDepthTexture=U}if(u.depthTexture&&!r.__autoAllocateDepthBuffer)if(A)for(let U=0;U<6;U++)st(r.__webglFramebuffer[U],u,U);else{const U=u.texture.mipmaps;U&&U.length>0?st(r.__webglFramebuffer[0],u,0):st(r.__webglFramebuffer,u,0)}else if(A){r.__webglDepthbuffer=[];for(let U=0;U<6;U++)if(t.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[U]),r.__webglDepthbuffer[U]===void 0)r.__webglDepthbuffer[U]=e.createRenderbuffer(),Fe(r.__webglDepthbuffer[U],u,!1);else{const O=u.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,te=r.__webglDepthbuffer[U];e.bindRenderbuffer(e.RENDERBUFFER,te),e.framebufferRenderbuffer(e.FRAMEBUFFER,O,e.RENDERBUFFER,te)}}else{const U=u.texture.mipmaps;if(U&&U.length>0?t.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[0]):t.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer===void 0)r.__webglDepthbuffer=e.createRenderbuffer(),Fe(r.__webglDepthbuffer,u,!1);else{const O=u.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,te=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,te),e.framebufferRenderbuffer(e.FRAMEBUFFER,O,e.RENDERBUFFER,te)}}t.bindFramebuffer(e.FRAMEBUFFER,null)}function Be(u,r,A){const U=i.get(u);r!==void 0&&me(U.__webglFramebuffer,u,u.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),A!==void 0&&De(u)}function qe(u){const r=u.texture,A=i.get(u),U=i.get(r);u.addEventListener("dispose",c);const O=u.textures,te=u.isWebGLCubeRenderTarget===!0,ie=O.length>1;if(ie||(U.__webglTexture===void 0&&(U.__webglTexture=e.createTexture()),U.__version=r.version,d.memory.textures++),te){A.__webglFramebuffer=[];for(let B=0;B<6;B++)if(r.mipmaps&&r.mipmaps.length>0){A.__webglFramebuffer[B]=[];for(let X=0;X<r.mipmaps.length;X++)A.__webglFramebuffer[B][X]=e.createFramebuffer()}else A.__webglFramebuffer[B]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){A.__webglFramebuffer=[];for(let B=0;B<r.mipmaps.length;B++)A.__webglFramebuffer[B]=e.createFramebuffer()}else A.__webglFramebuffer=e.createFramebuffer();if(ie)for(let B=0,X=O.length;B<X;B++){const re=i.get(O[B]);re.__webglTexture===void 0&&(re.__webglTexture=e.createTexture(),d.memory.textures++)}if(u.samples>0&&at(u)===!1){A.__webglMultisampledFramebuffer=e.createFramebuffer(),A.__webglColorRenderbuffer=[],t.bindFramebuffer(e.FRAMEBUFFER,A.__webglMultisampledFramebuffer);for(let B=0;B<O.length;B++){const X=O[B];A.__webglColorRenderbuffer[B]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,A.__webglColorRenderbuffer[B]);const re=o.convert(X.format,X.colorSpace),Me=o.convert(X.type),ce=h(X.internalFormat,re,Me,X.normalized,X.colorSpace,u.isXRRenderTarget===!0),ae=nt(u);e.renderbufferStorageMultisample(e.RENDERBUFFER,ae,ce,u.width,u.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+B,e.RENDERBUFFER,A.__webglColorRenderbuffer[B])}e.bindRenderbuffer(e.RENDERBUFFER,null),u.depthBuffer&&(A.__webglDepthRenderbuffer=e.createRenderbuffer(),Fe(A.__webglDepthRenderbuffer,u,!0)),t.bindFramebuffer(e.FRAMEBUFFER,null)}}if(te){t.bindTexture(e.TEXTURE_CUBE_MAP,U.__webglTexture),ke(e.TEXTURE_CUBE_MAP,r);for(let B=0;B<6;B++)if(r.mipmaps&&r.mipmaps.length>0)for(let X=0;X<r.mipmaps.length;X++)me(A.__webglFramebuffer[B][X],u,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+B,X);else me(A.__webglFramebuffer[B],u,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+B,0);s(r)&&L(e.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ie){for(let B=0,X=O.length;B<X;B++){const re=O[B],Me=i.get(re);let ce=e.TEXTURE_2D;(u.isWebGL3DRenderTarget||u.isWebGLArrayRenderTarget)&&(ce=u.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),t.bindTexture(ce,Me.__webglTexture),ke(ce,re),me(A.__webglFramebuffer,u,re,e.COLOR_ATTACHMENT0+B,ce,0),s(re)&&L(ce)}t.unbindTexture()}else{let B=e.TEXTURE_2D;if((u.isWebGL3DRenderTarget||u.isWebGLArrayRenderTarget)&&(B=u.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),t.bindTexture(B,U.__webglTexture),ke(B,r),r.mipmaps&&r.mipmaps.length>0)for(let X=0;X<r.mipmaps.length;X++)me(A.__webglFramebuffer[X],u,r,e.COLOR_ATTACHMENT0,B,X);else me(A.__webglFramebuffer,u,r,e.COLOR_ATTACHMENT0,B,0);s(r)&&L(B),t.unbindTexture()}u.depthBuffer&&De(u)}function Ie(u){const r=u.textures;for(let A=0,U=r.length;A<U;A++){const O=r[A];if(s(O)){const te=z(u),ie=i.get(O).__webglTexture;t.bindTexture(te,ie),L(te),t.unbindTexture()}}}const et=[],ft=[];function _t(u){if(u.samples>0){if(at(u)===!1){const r=u.textures,A=u.width,U=u.height;let O=e.COLOR_BUFFER_BIT;const te=u.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=i.get(u),B=r.length>1;if(B)for(let re=0;re<r.length;re++)t.bindFramebuffer(e.FRAMEBUFFER,ie.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+re,e.RENDERBUFFER,null),t.bindFramebuffer(e.FRAMEBUFFER,ie.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+re,e.TEXTURE_2D,null,0);t.bindFramebuffer(e.READ_FRAMEBUFFER,ie.__webglMultisampledFramebuffer);const X=u.texture.mipmaps;X&&X.length>0?t.bindFramebuffer(e.DRAW_FRAMEBUFFER,ie.__webglFramebuffer[0]):t.bindFramebuffer(e.DRAW_FRAMEBUFFER,ie.__webglFramebuffer);for(let re=0;re<r.length;re++){if(u.resolveDepthBuffer&&(u.depthBuffer&&(O|=e.DEPTH_BUFFER_BIT),u.stencilBuffer&&u.resolveStencilBuffer&&(O|=e.STENCIL_BUFFER_BIT)),B){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,ie.__webglColorRenderbuffer[re]);const Me=i.get(r[re]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,Me,0)}e.blitFramebuffer(0,0,A,U,0,0,A,U,O,e.NEAREST),R===!0&&(et.length=0,ft.length=0,et.push(e.COLOR_ATTACHMENT0+re),u.depthBuffer&&u.storeMultisampledDepthBuffer===!1&&(et.push(te),ft.push(te),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,ft)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,et))}if(t.bindFramebuffer(e.READ_FRAMEBUFFER,null),t.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),B)for(let re=0;re<r.length;re++){t.bindFramebuffer(e.FRAMEBUFFER,ie.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+re,e.RENDERBUFFER,ie.__webglColorRenderbuffer[re]);const Me=i.get(r[re]).__webglTexture;t.bindFramebuffer(e.FRAMEBUFFER,ie.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+re,e.TEXTURE_2D,Me,0)}t.bindFramebuffer(e.DRAW_FRAMEBUFFER,ie.__webglMultisampledFramebuffer)}else if(u.depthBuffer&&u.storeMultisampledDepthBuffer===!1&&R){const r=u.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[r])}}}function nt(u){return Math.min(l.maxSamples,u.samples)}function at(u){const r=i.get(u);return u.samples>0&&n.has("WEBGL_multisampled_render_to_texture")===!0&&r.__useRenderToTexture!==!1}function M(u){const r=d.render.frame;H.get(u)!==r&&(H.set(u,r),u.update())}function dt(u,r){const A=u.colorSpace,U=u.format,O=u.type;return u.isCompressedTexture===!0||u.isVideoTexture===!0||A!==Yi&&A!==kt&&(tt.getTransfer(A)===Ye?(U!==Ut||O!==At)&&Ve("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Qe("WebGLTextures: Unsupported texture color space:",A)),r}function We(u){return typeof HTMLImageElement<"u"&&u instanceof HTMLImageElement?(T.width=u.naturalWidth||u.width,T.height=u.naturalHeight||u.height):typeof VideoFrame<"u"&&u instanceof VideoFrame?(T.width=u.displayWidth,T.height=u.displayHeight):(T.width=u.width,T.height=u.height),T}this.allocateTextureUnit=Q,this.resetTextureUnits=q,this.getTextureUnits=P,this.setTextureUnits=K,this.setTexture2D=ne,this.setTexture2DArray=Z,this.setTexture3D=j,this.setTextureCube=ee,this.rebindTextures=Be,this.setupRenderTarget=qe,this.updateRenderTargetMipmap=Ie,this.updateMultisampleRenderTarget=_t,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=me,this.useMultisampledRTT=at,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function so(e,n){function t(i,l=kt){let o;const d=tt.getTransfer(l);if(i===At)return e.UNSIGNED_BYTE;if(i===ir)return e.UNSIGNED_SHORT_4_4_4_4;if(i===rr)return e.UNSIGNED_SHORT_5_5_5_1;if(i===$a)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===Za)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===kr)return e.BYTE;if(i===Ha)return e.SHORT;if(i===mn)return e.UNSIGNED_SHORT;if(i===Ki)return e.INT;if(i===Ht)return e.UNSIGNED_INT;if(i===yt)return e.FLOAT;if(i===wt)return e.HALF_FLOAT;if(i===Gr)return e.ALPHA;if(i===Na)return e.RGB;if(i===Ut)return e.RGBA;if(i===Yt)return e.DEPTH_COMPONENT;if(i===zt)return e.DEPTH_STENCIL;if(i===Fa)return e.RED;if(i===tr)return e.RED_INTEGER;if(i===Zt)return e.RG;if(i===er)return e.RG_INTEGER;if(i===ji)return e.RGBA_INTEGER;if(i===Pn||i===Rn||i===bn||i===Cn)if(d===Ye)if(o=n.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(i===Pn)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Rn)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===bn)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Cn)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=n.get("WEBGL_compressed_texture_s3tc"),o!==null){if(i===Pn)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Rn)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===bn)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Cn)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Ri||i===Ai||i===Si||i===vi)if(o=n.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(i===Ri)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Ai)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Si)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===vi)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===xi||i===Ti||i===gi||i===ei||i===bi||i===Nn||i===Li)if(o=n.get("WEBGL_compressed_texture_etc"),o!==null){if(i===xi||i===Ti)return d===Ye?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(i===gi)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(i===ei)return o.COMPRESSED_R11_EAC;if(i===bi)return o.COMPRESSED_SIGNED_R11_EAC;if(i===Nn)return o.COMPRESSED_RG11_EAC;if(i===Li)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===li||i===ci||i===fi||i===di||i===ui||i===pi||i===hi||i===mi||i===ii||i===ri||i===ai||i===ni||i===oi||i===si)if(o=n.get("WEBGL_compressed_texture_astc"),o!==null){if(i===li)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===ci)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===fi)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===di)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ui)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===pi)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===hi)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===mi)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ii)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ri)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===ai)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===ni)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===oi)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===si)return d===Ye?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===_i||i===Ei||i===Mi)if(o=n.get("EXT_texture_compression_bptc"),o!==null){if(i===_i)return d===Ye?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ei)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Mi)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===ti||i===Pi||i===In||i===Ci)if(o=n.get("EXT_texture_compression_rgtc"),o!==null){if(i===ti)return o.COMPRESSED_RED_RGTC1_EXT;if(i===Pi)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===In)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Ci)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===an?e.UNSIGNED_INT_24_8:e[i]!==void 0?e[i]:null}return{convert:t}}const Hm=`
4197
- void main() {
4198
-
4199
- gl_Position = vec4( position, 1.0 );
4200
-
4201
- }`,Vm=`
4202
- uniform sampler2DArray depthColor;
4203
- uniform float depthWidth;
4204
- uniform float depthHeight;
4205
-
4206
- void main() {
4207
-
4208
- vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4209
-
4210
- if ( coord.x >= 1.0 ) {
4211
-
4212
- gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4213
-
4214
- } else {
4215
-
4216
- gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4217
-
4218
- }
4219
-
4220
- }`;class Wm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(n,t){if(this.texture===null){const i=new zi(n.texture);(n.depthNear!==t.depthNear||n.depthFar!==t.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(n){if(this.texture!==null&&this.mesh===null){const t=n.cameras[0].viewport,i=new Nt({vertexShader:Hm,fragmentShader:Vm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new It(new Ji(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class km extends ia{constructor(n,t){super();const i=this;let l=null,o=1,d=null,g="local-floor",R=1,T=null,H=null,I=null,p=null,x=null,N=null;const W=typeof XRWebGLBinding<"u",f=new Wm,s={},L=t.getContextAttributes();let z=null,h=null;const S=[],m=[],D=new mt;let c=null,_=null;const w=new pn;w.viewport=new ht;const F=new pn;F.viewport=new ht;const G=[w,F],q=new Wr;let P=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let $=S[V];return $===void 0&&($=new Ln,S[V]=$),$.getTargetRaySpace()},this.getControllerGrip=function(V){let $=S[V];return $===void 0&&($=new Ln,S[V]=$),$.getGripSpace()},this.getHand=function(V){let $=S[V];return $===void 0&&($=new Ln,S[V]=$),$.getHandSpace()};function Q(V){const $=m.indexOf(V.inputSource);if($===-1)return;const Ee=S[$];Ee!==void 0&&(Ee.update(V.inputSource,V.frame,T||d),Ee.dispatchEvent({type:V.type,data:V.inputSource}))}function Y(){l.removeEventListener("select",Q),l.removeEventListener("selectstart",Q),l.removeEventListener("selectend",Q),l.removeEventListener("squeeze",Q),l.removeEventListener("squeezestart",Q),l.removeEventListener("squeezeend",Q),l.removeEventListener("end",Y),l.removeEventListener("inputsourceschange",ne);for(let V=0;V<S.length;V++){const $=m[V];$!==null&&(m[V]=null,S[V].disconnect($))}P=null,K=null,f.reset();for(const V in s)delete s[V];if(n.setRenderTarget(z),x=null,p=null,I=null,l=null,h=null,ze.stop(),i.isPresenting=!1,n.setPixelRatio(c),n.setSize(D.width,D.height,!1),_!==null){const V=_.camera;V.fov=_.fov,V.zoom=_.zoom,V.updateProjectionMatrix(),_=null}i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(V){o=V,i.isPresenting===!0&&Ve("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(V){g=V,i.isPresenting===!0&&Ve("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return T||d},this.setReferenceSpace=function(V){T=V},this.getBaseLayer=function(){return p!==null?p:x},this.getBinding=function(){return I===null&&W&&(I=new XRWebGLBinding(l,t)),I},this.getFrame=function(){return N},this.getSession=function(){return l},this.setSession=async function(V){if(l=V,l!==null){if(z=n.getRenderTarget(),l.addEventListener("select",Q),l.addEventListener("selectstart",Q),l.addEventListener("selectend",Q),l.addEventListener("squeeze",Q),l.addEventListener("squeezestart",Q),l.addEventListener("squeezeend",Q),l.addEventListener("end",Y),l.addEventListener("inputsourceschange",ne),L.xrCompatible!==!0&&await t.makeXRCompatible(),c=n.getPixelRatio(),n.getSize(D),W&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ee=null,Ue=null,me=null;L.depth&&(me=L.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ee=L.stencil?zt:Yt,Ue=L.stencil?an:Ht);const Fe={colorFormat:t.RGBA8,depthFormat:me,scaleFactor:o};I=this.getBinding(),p=I.createProjectionLayer(Fe),l.updateRenderState({layers:[p]}),n.setPixelRatio(1),n.setSize(p.textureWidth,p.textureHeight,!1),h=new Mt(p.textureWidth,p.textureHeight,{format:Ut,type:At,depthTexture:new hn(p.textureWidth,p.textureHeight,Ue,void 0,void 0,void 0,void 0,void 0,void 0,Ee),stencilBuffer:L.stencil,colorSpace:n.outputColorSpace,samples:L.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1,storeMultisampledDepthBuffer:p.ignoreDepthValues===!1,storeMultisampledStencilBuffer:p.ignoreDepthValues===!1})}else{const Ee={antialias:L.antialias,alpha:!0,depth:L.depth,stencil:L.stencil,framebufferScaleFactor:o};x=new XRWebGLLayer(l,t,Ee),l.updateRenderState({baseLayer:x}),n.setPixelRatio(1),n.setSize(x.framebufferWidth,x.framebufferHeight,!1),h=new Mt(x.framebufferWidth,x.framebufferHeight,{format:Ut,type:At,colorSpace:n.outputColorSpace,stencilBuffer:L.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1,storeMultisampledDepthBuffer:x.ignoreDepthValues===!1,storeMultisampledStencilBuffer:x.ignoreDepthValues===!1})}h.isXRRenderTarget=!0,this.setFoveation(R),T=null,d=await l.requestReferenceSpace(g),ze.setContext(l),ze.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(l!==null)return l.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};function ne(V){for(let $=0;$<V.removed.length;$++){const Ee=V.removed[$],Ue=m.indexOf(Ee);Ue>=0&&(m[Ue]=null,S[Ue].disconnect(Ee))}for(let $=0;$<V.added.length;$++){const Ee=V.added[$];let Ue=m.indexOf(Ee);if(Ue===-1){for(let Fe=0;Fe<S.length;Fe++)if(Fe>=m.length){m.push(Ee),Ue=Fe;break}else if(m[Fe]===null){m[Fe]=Ee,Ue=Fe;break}if(Ue===-1)break}const me=S[Ue];me&&me.connect(Ee)}}const Z=new Ne,j=new Ne;function ee(V,$,Ee){Z.setFromMatrixPosition($.matrixWorld),j.setFromMatrixPosition(Ee.matrixWorld);const Ue=Z.distanceTo(j),me=$.projectionMatrix.elements,Fe=Ee.projectionMatrix.elements,st=me[14]/(me[10]-1),De=me[14]/(me[10]+1),Be=(me[9]+1)/me[5],qe=(me[9]-1)/me[5],Ie=(me[8]-1)/me[0],et=(Fe[8]+1)/Fe[0],ft=st*Ie,_t=st*et,nt=Ue/(-Ie+et),at=nt*-Ie;if($.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(at),V.translateZ(nt),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert(),me[10]===-1)V.projectionMatrix.copy($.projectionMatrix),V.projectionMatrixInverse.copy($.projectionMatrixInverse);else{const M=st+nt,dt=De+nt,We=ft-at,u=_t+(Ue-at),r=Be*De/dt*M,A=qe*De/dt*M;V.projectionMatrix.makePerspective(We,u,r,A,M,dt),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}}function be(V,$){$===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices($.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(l===null)return;let $=V.near,Ee=V.far;f.texture!==null&&(f.depthNear>0&&($=f.depthNear),f.depthFar>0&&(Ee=f.depthFar)),q.near=F.near=w.near=$,q.far=F.far=w.far=Ee,(P!==q.near||K!==q.far)&&(l.updateRenderState({depthNear:q.near,depthFar:q.far}),P=q.near,K=q.far),q.layers.mask=V.layers.mask|6,w.layers.mask=q.layers.mask&-5,F.layers.mask=q.layers.mask&-3;const Ue=V.parent,me=q.cameras;be(q,Ue);for(let Fe=0;Fe<me.length;Fe++)be(me[Fe],Ue);me.length===2?ee(q,w,F):q.projectionMatrix.copy(w.projectionMatrix),_===null&&V.isPerspectiveCamera&&(_={camera:V,fov:V.fov,zoom:V.zoom}),Re(V,q,Ue)};function Re(V,$,Ee){Ee===null?V.matrix.copy($.matrixWorld):(V.matrix.copy(Ee.matrixWorld),V.matrix.invert(),V.matrix.multiply($.matrixWorld)),V.matrix.decompose(V.position,V.quaternion,V.scale),V.updateMatrixWorld(!0),V.projectionMatrix.copy($.projectionMatrix),V.projectionMatrixInverse.copy($.projectionMatrixInverse),V.isPerspectiveCamera&&(V.fov=Zf*2*Math.atan(1/V.projectionMatrix.elements[5]),V.zoom=1)}this.getCamera=function(){return q},this.getFoveation=function(){if(!(p===null&&x===null))return R},this.setFoveation=function(V){R=V,p!==null&&(p.fixedFoveation=V),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=V)},this.hasDepthSensing=function(){return f.texture!==null},this.getDepthSensingMesh=function(){return f.getMesh(q)},this.getCameraTexture=function(V){return s[V]};let it=null;function ke(V,$){if(H=$.getViewerPose(T||d),N=$,H!==null){const Ee=H.views;x!==null&&(n.setRenderTargetFramebuffer(h,x.framebuffer),n.setRenderTarget(h));let Ue=!1;Ee.length!==q.cameras.length&&(q.cameras.length=0,Ue=!0);for(let De=0;De<Ee.length;De++){const Be=Ee[De];let qe=null;if(x!==null)qe=x.getViewport(Be);else{const et=I.getViewSubImage(p,Be);qe=et.viewport,De===0&&(n.setRenderTargetTextures(h,et.colorTexture,et.depthStencilTexture),n.setRenderTarget(h))}let Ie=G[De];Ie===void 0&&(Ie=new pn,Ie.layers.enable(De),Ie.viewport=new ht,G[De]=Ie),Ie.matrix.fromArray(Be.transform.matrix),Ie.matrix.decompose(Ie.position,Ie.quaternion,Ie.scale),Ie.projectionMatrix.fromArray(Be.projectionMatrix),Ie.projectionMatrixInverse.copy(Ie.projectionMatrix).invert(),Ie.viewport.set(qe.x,qe.y,qe.width,qe.height),De===0&&(q.matrix.copy(Ie.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale)),Ue===!0&&q.cameras.push(Ie)}const me=l.enabledFeatures;if(me&&me.includes("depth-sensing")&&l.depthUsage=="gpu-optimized"&&W){I=i.getBinding();const De=I.getDepthInformation(Ee[0]);De&&De.isValid&&De.texture&&f.init(De,l.renderState)}if(me&&me.includes("camera-access")&&W){n.state.unbindTexture(),I=i.getBinding();for(let De=0;De<Ee.length;De++){const Be=Ee[De].camera;if(Be){let qe=s[Be];qe||(qe=new zi,s[Be]=qe);const Ie=I.getCameraImage(Be);qe.sourceTexture=Ie}}}}for(let Ee=0;Ee<S.length;Ee++){const Ue=m[Ee],me=S[Ee];Ue!==null&&me!==void 0&&me.update(Ue,$,T||d)}it&&it(V,$),$.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:$}),N=null}const ze=new to;ze.setAnimationLoop(ke),this.setAnimationLoop=function(V){it=V},this.dispose=function(){}}}const zm=new qt,lo=new ye;lo.set(-1,0,0,0,1,0,0,0,1);function Xm(e,n){function t(f,s){f.matrixAutoUpdate===!0&&f.updateMatrix(),s.value.copy(f.matrix)}function i(f,s){s.color.getRGB(f.fogColor.value,eo(e)),s.isFog?(f.fogNear.value=s.near,f.fogFar.value=s.far):s.isFogExp2&&(f.fogDensity.value=s.density)}function l(f,s,L,z,h){s.isNodeMaterial?s.uniformsNeedUpdate=!1:s.isMeshBasicMaterial?o(f,s):s.isMeshLambertMaterial?(o(f,s),s.envMap&&(f.envMapIntensity.value=s.envMapIntensity)):s.isMeshToonMaterial?(o(f,s),I(f,s)):s.isMeshPhongMaterial?(o(f,s),H(f,s),s.envMap&&(f.envMapIntensity.value=s.envMapIntensity)):s.isMeshStandardMaterial?(o(f,s),p(f,s),s.isMeshPhysicalMaterial&&x(f,s,h)):s.isMeshMatcapMaterial?(o(f,s),N(f,s)):s.isMeshDepthMaterial?o(f,s):s.isMeshDistanceMaterial?(o(f,s),W(f,s)):s.isMeshNormalMaterial?o(f,s):s.isLineBasicMaterial?(d(f,s),s.isLineDashedMaterial&&g(f,s)):s.isPointsMaterial?R(f,s,L,z):s.isSpriteMaterial?T(f,s):s.isShadowMaterial?(f.color.value.copy(s.color),f.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}function o(f,s){f.opacity.value=s.opacity,s.color&&f.diffuse.value.copy(s.color),s.emissive&&f.emissive.value.copy(s.emissive).multiplyScalar(s.emissiveIntensity),s.map&&(f.map.value=s.map,t(s.map,f.mapTransform)),s.alphaMap&&(f.alphaMap.value=s.alphaMap,t(s.alphaMap,f.alphaMapTransform)),s.bumpMap&&(f.bumpMap.value=s.bumpMap,t(s.bumpMap,f.bumpMapTransform),f.bumpScale.value=s.bumpScale,s.side===St&&(f.bumpScale.value*=-1)),s.normalMap&&(f.normalMap.value=s.normalMap,t(s.normalMap,f.normalMapTransform),f.normalScale.value.copy(s.normalScale),s.side===St&&f.normalScale.value.negate()),s.displacementMap&&(f.displacementMap.value=s.displacementMap,t(s.displacementMap,f.displacementMapTransform),f.displacementScale.value=s.displacementScale,f.displacementBias.value=s.displacementBias),s.emissiveMap&&(f.emissiveMap.value=s.emissiveMap,t(s.emissiveMap,f.emissiveMapTransform)),s.specularMap&&(f.specularMap.value=s.specularMap,t(s.specularMap,f.specularMapTransform)),s.alphaTest>0&&(f.alphaTest.value=s.alphaTest);const L=n.get(s),z=L.envMap,h=L.envMapRotation;z&&(f.envMap.value=z,f.envMapRotation.value.setFromMatrix4(zm.makeRotationFromEuler(h)).transpose(),z.isCubeTexture&&z.isRenderTargetTexture===!1&&f.envMapRotation.value.premultiply(lo),f.reflectivity.value=s.reflectivity,f.ior.value=s.ior,f.refractionRatio.value=s.refractionRatio),s.lightMap&&(f.lightMap.value=s.lightMap,f.lightMapIntensity.value=s.lightMapIntensity,t(s.lightMap,f.lightMapTransform)),s.aoMap&&(f.aoMap.value=s.aoMap,f.aoMapIntensity.value=s.aoMapIntensity,t(s.aoMap,f.aoMapTransform))}function d(f,s){f.diffuse.value.copy(s.color),f.opacity.value=s.opacity,s.map&&(f.map.value=s.map,t(s.map,f.mapTransform))}function g(f,s){f.dashSize.value=s.dashSize,f.totalSize.value=s.dashSize+s.gapSize,f.scale.value=s.scale}function R(f,s,L,z){f.diffuse.value.copy(s.color),f.opacity.value=s.opacity,f.size.value=s.size*L,f.scale.value=z*.5,s.map&&(f.map.value=s.map,t(s.map,f.uvTransform)),s.alphaMap&&(f.alphaMap.value=s.alphaMap,t(s.alphaMap,f.alphaMapTransform)),s.alphaTest>0&&(f.alphaTest.value=s.alphaTest)}function T(f,s){f.diffuse.value.copy(s.color),f.opacity.value=s.opacity,f.rotation.value=s.rotation,s.map&&(f.map.value=s.map,t(s.map,f.mapTransform)),s.alphaMap&&(f.alphaMap.value=s.alphaMap,t(s.alphaMap,f.alphaMapTransform)),s.alphaTest>0&&(f.alphaTest.value=s.alphaTest)}function H(f,s){f.specular.value.copy(s.specular),f.shininess.value=Math.max(s.shininess,1e-4)}function I(f,s){s.gradientMap&&(f.gradientMap.value=s.gradientMap)}function p(f,s){f.metalness.value=s.metalness,s.metalnessMap&&(f.metalnessMap.value=s.metalnessMap,t(s.metalnessMap,f.metalnessMapTransform)),f.roughness.value=s.roughness,s.roughnessMap&&(f.roughnessMap.value=s.roughnessMap,t(s.roughnessMap,f.roughnessMapTransform)),s.envMap&&(f.envMapIntensity.value=s.envMapIntensity)}function x(f,s,L){f.ior.value=s.ior,s.sheen>0&&(f.sheenColor.value.copy(s.sheenColor).multiplyScalar(s.sheen),f.sheenRoughness.value=s.sheenRoughness,s.sheenColorMap&&(f.sheenColorMap.value=s.sheenColorMap,t(s.sheenColorMap,f.sheenColorMapTransform)),s.sheenRoughnessMap&&(f.sheenRoughnessMap.value=s.sheenRoughnessMap,t(s.sheenRoughnessMap,f.sheenRoughnessMapTransform))),s.clearcoat>0&&(f.clearcoat.value=s.clearcoat,f.clearcoatRoughness.value=s.clearcoatRoughness,s.clearcoatMap&&(f.clearcoatMap.value=s.clearcoatMap,t(s.clearcoatMap,f.clearcoatMapTransform)),s.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=s.clearcoatRoughnessMap,t(s.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),s.clearcoatNormalMap&&(f.clearcoatNormalMap.value=s.clearcoatNormalMap,t(s.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(s.clearcoatNormalScale),s.side===St&&f.clearcoatNormalScale.value.negate())),s.dispersion>0&&(f.dispersion.value=s.dispersion),s.retroreflectivity>0&&(f.retroreflectivity.value=s.retroreflectivity),s.iridescence>0&&(f.iridescence.value=s.iridescence,f.iridescenceIOR.value=s.iridescenceIOR,f.iridescenceThicknessMinimum.value=s.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=s.iridescenceThicknessRange[1],s.iridescenceMap&&(f.iridescenceMap.value=s.iridescenceMap,t(s.iridescenceMap,f.iridescenceMapTransform)),s.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=s.iridescenceThicknessMap,t(s.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),s.transmission>0&&(f.transmission.value=s.transmission,f.transmissionSamplerMap.value=L.texture,f.transmissionSamplerSize.value.set(L.width,L.height),s.transmissionMap&&(f.transmissionMap.value=s.transmissionMap,t(s.transmissionMap,f.transmissionMapTransform)),f.thickness.value=s.thickness,s.thicknessMap&&(f.thicknessMap.value=s.thicknessMap,t(s.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=s.attenuationDistance,f.attenuationColor.value.copy(s.attenuationColor)),s.anisotropy>0&&(f.anisotropyVector.value.set(s.anisotropy*Math.cos(s.anisotropyRotation),s.anisotropy*Math.sin(s.anisotropyRotation)),s.anisotropyMap&&(f.anisotropyMap.value=s.anisotropyMap,t(s.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=s.specularIntensity,f.specularColor.value.copy(s.specularColor),s.specularColorMap&&(f.specularColorMap.value=s.specularColorMap,t(s.specularColorMap,f.specularColorMapTransform)),s.specularIntensityMap&&(f.specularIntensityMap.value=s.specularIntensityMap,t(s.specularIntensityMap,f.specularIntensityMapTransform))}function N(f,s){s.matcap&&(f.matcap.value=s.matcap)}function W(f,s){const L=n.get(s).light;f.referencePosition.value.setFromMatrixPosition(L.matrixWorld),f.nearDistance.value=L.shadow.camera.near,f.farDistance.value=L.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:l}}function Km(e,n,t,i){let l={},o={},d=[];const g=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function R(h,S){const m=S.program;i.uniformBlockBinding(h,m)}function T(h,S){let m=l[h.id];m===void 0&&(f(h),m=H(h),l[h.id]=m,h.addEventListener("dispose",L));const D=S.program;i.updateUBOMapping(h,D);const c=n.render.frame;o[h.id]!==c&&(p(h),o[h.id]=c)}function H(h){const S=I();h.__bindingPointIndex=S;const m=e.createBuffer(),D=h.__size,c=h.usage;return e.bindBuffer(e.UNIFORM_BUFFER,m),e.bufferData(e.UNIFORM_BUFFER,D,c),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,S,m),m}function I(){for(let h=0;h<g;h++)if(d.indexOf(h)===-1)return d.push(h),h;return Qe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(h){const S=l[h.id],m=h.uniforms,D=h.__cache;e.bindBuffer(e.UNIFORM_BUFFER,S);for(let c=0,_=m.length;c<_;c++){const w=m[c];if(Array.isArray(w))for(let F=0,G=w.length;F<G;F++)x(w[F],c,F,D);else x(w,c,0,D)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function x(h,S,m,D){if(W(h,S,m,D)===!0){const c=h.__offset,_=h.value;if(Array.isArray(_)){let w=0;for(let F=0;F<_.length;F++){const G=_[F],q=s(G);N(G,h.__data,w),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(w+=q.storage/Float32Array.BYTES_PER_ELEMENT)}}else N(_,h.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,c,h.__data)}}function N(h,S,m){typeof h=="number"||typeof h=="boolean"?S[0]=h:h.isMatrix3?(S[0]=h.elements[0],S[1]=h.elements[1],S[2]=h.elements[2],S[3]=0,S[4]=h.elements[3],S[5]=h.elements[4],S[6]=h.elements[5],S[7]=0,S[8]=h.elements[6],S[9]=h.elements[7],S[10]=h.elements[8],S[11]=0):ArrayBuffer.isView(h)?S.set(new h.constructor(h.buffer,h.byteOffset,S.length)):h.toArray(S,m)}function W(h,S,m,D){const c=h.value,_=S+"_"+m;if(D[_]===void 0)return typeof c=="number"||typeof c=="boolean"?D[_]=c:ArrayBuffer.isView(c)?D[_]=c.slice():D[_]=c.clone(),!0;{const w=D[_];if(typeof c=="number"||typeof c=="boolean"){if(w!==c)return D[_]=c,!0}else{if(ArrayBuffer.isView(c))return!0;if(w.equals(c)===!1)return w.copy(c),!0}}return!1}function f(h){const S=h.uniforms;let m=0;const D=16;for(let _=0,w=S.length;_<w;_++){const F=Array.isArray(S[_])?S[_]:[S[_]];for(let G=0,q=F.length;G<q;G++){const P=F[G],K=Array.isArray(P.value)?P.value:[P.value];for(let Q=0,Y=K.length;Q<Y;Q++){const ne=K[Q],Z=s(ne),j=m%D,ee=j%Z.boundary,be=j+ee;m+=ee,be!==0&&D-be<Z.storage&&(m+=D-be),P.__data=new Float32Array(Z.storage/Float32Array.BYTES_PER_ELEMENT),P.__offset=m,m+=Z.storage}}}const c=m%D;return c>0&&(m+=D-c),h.__size=m,h.__cache={},this}function s(h){const S={boundary:0,storage:0};return typeof h=="number"||typeof h=="boolean"?(S.boundary=4,S.storage=4):h.isVector2?(S.boundary=8,S.storage=8):h.isVector3||h.isColor?(S.boundary=16,S.storage=12):h.isVector4?(S.boundary=16,S.storage=16):h.isMatrix3?(S.boundary=48,S.storage=48):h.isMatrix4?(S.boundary=64,S.storage=64):h.isTexture?Ve("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(h)?(S.boundary=16,S.storage=h.byteLength):Ve("WebGLRenderer: Unsupported uniform value type.",h),S}function L(h){const S=h.target;S.removeEventListener("dispose",L);const m=d.indexOf(S.__bindingPointIndex);d.splice(m,1),e.deleteBuffer(l[S.id]),delete l[S.id],delete o[S.id]}function z(){for(const h in l)e.deleteBuffer(l[h]);d=[],l={},o={}}return{bind:R,update:T,dispose:z}}const Ym=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Pt=null;function qm(){return Pt===null&&(Pt=new Jr(Ym,16,16,Zt,wt),Pt.name="DFG_LUT",Pt.minFilter=vt,Pt.magFilter=vt,Pt.wrapS=wn,Pt.wrapT=wn,Pt.generateMipmaps=!1,Pt.needsUpdate=!0),Pt}class Zm{constructor(n={}){const{canvas:t=Ja(),context:i=null,depth:l=!0,stencil:o=!1,alpha:d=!1,antialias:g=!1,premultipliedAlpha:R=!0,preserveDrawingBuffer:T=!1,powerPreference:H="default",failIfMajorPerformanceCaveat:I=!1,reversedDepthBuffer:p=!1,outputBufferType:x=At}=n;this.isWebGLRenderer=!0;let N;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");N=i.getContextAttributes().alpha}else N=d;const W=x,f=new Set([ji,er,tr]),s=new Set([At,Ht,mn,an,ir,rr]),L=new Uint32Array(4),z=new Int32Array(4),h=new Ne;let S=null,m=null;const D=[],c=[];let _=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Rt,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const w=this;let F=!1,G=null,q=null,P=null,K=null;this._outputColorSpace=Ga;let Q=0,Y=0,ne=null,Z=-1,j=null;const ee=new ht,be=new ht;let Re=null;const it=new je(0);let ke=0,ze=t.width,V=t.height,$=1,Ee=null,Ue=null;const me=new ht(0,0,ze,V),Fe=new ht(0,0,ze,V);let st=!1;const De=new Xi;let Be=!1,qe=!1;const Ie=new qt,et=new Ne,ft=new ht,_t={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let nt=!1;function at(){return ne===null?$:1}let M=i;function dt(a,v){return t.getContext(a,v)}let We,u,r,A,U,O,te,ie,B,X,re,Me,ce,ae,xe,Ae,Ce,E,oe,k,se,ue,J;try{const a={alpha:!0,depth:l,stencil:o,antialias:g,premultipliedAlpha:R,preserveDrawingBuffer:T,powerPreference:H,failIfMajorPerformanceCaveat:I};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ia}`),t.addEventListener("webglcontextlost",Ze,!1),t.addEventListener("webglcontextrestored",Ge,!1),t.addEventListener("webglcontextcreationerror",xt,!1),M===null){const v="webgl2";if(M=dt(v,a),M===null)throw dt(v)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Te()}catch(a){throw t.removeEventListener("webglcontextlost",Ze,!1),t.removeEventListener("webglcontextrestored",Ge,!1),t.removeEventListener("webglcontextcreationerror",xt,!1),Qe("WebGLRenderer: "+a.message),a}function Te(){We=new Zp(M),We.init(),se=new so(M,We),u=new Gp(M,We,n,se),r=new Bm(M,We),u.reversedDepthBuffer&&p&&r.buffers.depth.setReversed(!0),q=M.createFramebuffer(),P=M.createFramebuffer(),K=M.createFramebuffer(),A=new Jp(M),U=new Am,O=new Gm(M,We,r,U,u,se,A),te=new qp(w),ie=new ed(M),ue=new Op(M,ie),B=new $p(M,ie,A,ue),X=new eh(M,B,ie,ue,A),E=new jp(M,u,O),xe=new Hp(U),re=new Tm(w,te,We,u,ue,xe),Me=new Xm(w,U),ce=new bm,ae=new wm(We),Ce=new Fp(w,te,r,X,N,R),Ae=new Om(w,X,u),J=new Km(M,A,u,r),oe=new Bp(M,We,A),k=new Qp(M,We,A),A.programs=re.programs,w.capabilities=u,w.extensions=We,w.properties=U,w.renderLists=ce,w.shadowMap=Ae,w.state=r,w.info=A}W!==At&&(_=new nh(W,t.width,t.height,g,l,o));const ve=new km(w,M);this.xr=ve,this.getContext=function(){return M},this.getContextAttributes=function(){return M.getContextAttributes()},this.forceContextLoss=function(){const a=We.get("WEBGL_lose_context");a&&a.loseContext()},this.forceContextRestore=function(){const a=We.get("WEBGL_lose_context");a&&a.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(a){a!==void 0&&($=a,this.setSize(ze,V,!1))},this.getSize=function(a){return a.set(ze,V)},this.setSize=function(a,v,y=!0){if(ve.isPresenting){Ve("WebGLRenderer: Can't change size while VR device is presenting.");return}ze=a,V=v,t.width=Math.floor(a*$),t.height=Math.floor(v*$),y===!0&&(t.style.width=a+"px",t.style.height=v+"px"),_!==null&&_.setSize(t.width,t.height),this.setViewport(0,0,a,v)},this.getDrawingBufferSize=function(a){return a.set(ze*$,V*$).floor()},this.setDrawingBufferSize=function(a,v,y){ze=a,V=v,$=y,t.width=Math.floor(a*y),t.height=Math.floor(v*y),this.setViewport(0,0,a,v)},this.setEffects=function(a){if(W===At){Qe("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(a){for(let v=0;v<a.length;v++)if(a[v].isOutputPass===!0){Ve("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(a||[])},this.getCurrentViewport=function(a){return a.copy(ee)},this.getViewport=function(a){return a.copy(me)},this.setViewport=function(a,v,y,b){a.isVector4?me.set(a.x,a.y,a.z,a.w):me.set(a,v,y,b),r.viewport(ee.copy(me).multiplyScalar($).round())},this.getScissor=function(a){return a.copy(Fe)},this.setScissor=function(a,v,y,b){a.isVector4?Fe.set(a.x,a.y,a.z,a.w):Fe.set(a,v,y,b),r.scissor(be.copy(Fe).multiplyScalar($).round())},this.getScissorTest=function(){return st},this.setScissorTest=function(a){r.setScissorTest(st=a)},this.setOpaqueSort=function(a){Ee=a},this.setTransparentSort=function(a){Ue=a},this.getClearColor=function(a){return a.copy(Ce.getClearColor())},this.setClearColor=function(){Ce.setClearColor(...arguments)},this.getClearAlpha=function(){return Ce.getClearAlpha()},this.setClearAlpha=function(){Ce.setClearAlpha(...arguments)},this.clear=function(a=!0,v=!0,y=!0){let b=0;if(a){let C=!1;if(ne!==null){const de=ne.texture.format;C=f.has(de)}if(C){const de=ne.texture.type,he=s.has(de),fe=Ce.getClearColor(),_e=Ce.getClearAlpha(),Se=fe.r,Le=fe.g,we=fe.b;he?(L[0]=Se,L[1]=Le,L[2]=we,L[3]=_e,M.clearBufferuiv(M.COLOR,0,L)):(z[0]=Se,z[1]=Le,z[2]=we,z[3]=_e,M.clearBufferiv(M.COLOR,0,z))}else b|=M.COLOR_BUFFER_BIT}v&&(b|=M.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),y&&(b|=M.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),b!==0&&M.clear(b)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(a){a.setRenderer(this),G=a},this.dispose=function(){t.removeEventListener("webglcontextlost",Ze,!1),t.removeEventListener("webglcontextrestored",Ge,!1),t.removeEventListener("webglcontextcreationerror",xt,!1),Ce.dispose(),ce.dispose(),ae.dispose(),U.dispose(),te.dispose(),X.dispose(),ue.dispose(),J.dispose(),re.dispose(),ve.dispose(),ve.removeEventListener("sessionstart",sr),ve.removeEventListener("sessionend",lr),Vt.stop()};function Ze(a){a.preventDefault(),Ni("WebGLRenderer: Context Lost."),F=!0}function Ge(){Ni("WebGLRenderer: Context Restored."),F=!1;const a=A.autoReset,v=Ae.enabled,y=Ae.autoUpdate,b=Ae.needsUpdate,C=Ae.type;Te(),A.autoReset=a,Ae.enabled=v,Ae.autoUpdate=y,Ae.needsUpdate=b,Ae.type=C}function xt(a){Qe("WebGLRenderer: A WebGL context could not be created. Reason: ",a.statusMessage)}function bt(a){const v=a.target;v.removeEventListener("dispose",bt),co(v)}function co(a){fo(a),U.remove(a)}function fo(a){const v=U.get(a).programs;v!==void 0&&(v.forEach(function(y){re.releaseProgram(y)}),a.isShaderMaterial&&re.releaseShaderCache(a))}this.renderBufferDirect=function(a,v,y,b,C,de){v===null&&(v=_t);const he=C.isMesh&&C.matrixWorld.determinantAffine()<0,fe=ho(a,v,y,b,C);r.setMaterial(b,he);let _e=y.index,Se=1;if(b.wireframe===!0){if(_e=B.getWireframeAttribute(y),_e===void 0)return;Se=2}const Le=y.drawRange,we=y.attributes.position;let ge=Le.start*Se,He=(Le.start+Le.count)*Se;de!==null&&(ge=Math.max(ge,de.start*Se),He=Math.min(He,(de.start+de.count)*Se)),_e!==null?(ge=Math.max(ge,0),He=Math.min(He,_e.count)):we!=null&&(ge=Math.max(ge,0),He=Math.min(He,we.count));const ot=He-ge;if(ot<0||ot===1/0)return;ue.setup(C,b,fe,y,_e);let Je,Ke=oe;if(_e!==null&&(Je=ie.get(_e),Ke=k,Ke.setIndex(Je)),C.isMesh)b.wireframe===!0?(r.setLineWidth(b.wireframeLinewidth*at()),Ke.setMode(M.LINES)):Ke.setMode(M.TRIANGLES);else if(C.isLine){let ut=b.linewidth;ut===void 0&&(ut=1),r.setLineWidth(ut*at()),C.isLineSegments?Ke.setMode(M.LINES):C.isLineLoop?Ke.setMode(M.LINE_LOOP):Ke.setMode(M.LINE_STRIP)}else C.isPoints?Ke.setMode(M.POINTS):C.isSprite&&Ke.setMode(M.TRIANGLES);if(C.isBatchedMesh)if(We.get("WEBGL_multi_draw"))Ke.renderMultiDraw(C._multiDrawStarts,C._multiDrawCounts,C._multiDrawCount);else{const ut=C._multiDrawStarts,pe=C._multiDrawCounts,pt=C._multiDrawCount,Oe=_e?ie.get(_e).bytesPerElement:1,Et=U.get(b).currentProgram.getUniforms();for(let Ct=0;Ct<pt;Ct++)Et.setValue(M,"_gl_DrawID",Ct),Ke.render(ut[Ct]/Oe,pe[Ct])}else if(C.isInstancedMesh)Ke.renderInstances(ge,ot,C.count);else if(y.isInstancedBufferGeometry){const ut=y._maxInstanceCount!==void 0?y._maxInstanceCount:1/0,pe=Math.min(y.instanceCount,ut);Ke.renderInstances(ge,ot,pe)}else Ke.render(ge,ot)};function or(a,v,y,b){G!==null&&a.isNodeMaterial&&G.setObject(b,a),Be===!0&&xe.setState(a,y,!1),a.transparent===!0&&a.side===Lt&&a.forceSinglePass===!1?(a.side=St,a.needsUpdate=!0,Sn(a,v,b),a.side=rn,a.needsUpdate=!0,Sn(a,v,b),a.side=Lt):Sn(a,v,b)}this.compile=function(a,v,y=null){y===null&&(y=a),G!==null&&G.renderStart(a,v,y),m=ae.get(y),m.init(v),c.push(m),y.traverseVisible(function(C){C.isLight&&C.layers.test(v.layers)&&(m.pushLight(C),C.castShadow&&m.pushShadow(C))}),a!==y&&a.traverseVisible(function(C){C.isLight&&C.layers.test(v.layers)&&(m.pushLight(C),C.castShadow&&m.pushShadow(C))}),m.setupLights(),G!==null&&G.updateLights(m.state.lightsArray),qe=this.localClippingEnabled,Be=xe.init(this.clippingPlanes,qe),Be===!0&&xe.setGlobalState(this.clippingPlanes,v),G!==null&&Ae.render(m.state.shadowsArray,y,v);const b=new Set;return a.traverse(function(C){if(!(C.isMesh||C.isPoints||C.isLine||C.isSprite))return;const de=C.material;if(de)if(Array.isArray(de))for(let he=0;he<de.length;he++){const fe=de[he];or(fe,y,v,C),b.add(fe)}else or(de,y,v,C),b.add(de)}),m=c.pop(),G!==null&&G.renderEnd(),b},this.compileAsync=function(a,v,y=null){const b=this.compile(a,v,y);return new Promise(C=>{function de(){if(b.forEach(function(he){const _e=U.get(he).currentProgram;(_e===void 0||_e.isReady())&&b.delete(he)}),b.size===0){C(a);return}setTimeout(de,10)}We.get("KHR_parallel_shader_compile")!==null?de():setTimeout(de,10)})};let Hn=null;function uo(a){Hn&&Hn(a)}function sr(){Vt.stop()}function lr(){Vt.start()}const Vt=new to;Vt.setAnimationLoop(uo),typeof self<"u"&&Vt.setContext(self),this.setAnimationLoop=function(a){Hn=a,ve.setAnimationLoop(a),a===null?Vt.stop():Vt.start()},ve.addEventListener("sessionstart",sr),ve.addEventListener("sessionend",lr),this.render=function(a,v){if(v!==void 0&&v.isCamera!==!0){Qe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;G!==null&&G.renderStart(a,v);const y=ve.enabled===!0&&ve.isPresenting===!0,b=_!==null&&(ne===null||y)&&_.begin(w,ne);if(a.matrixWorldAutoUpdate===!0&&a.updateMatrixWorld(),v.parent===null&&v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),ve.enabled===!0&&ve.isPresenting===!0&&(_===null||_.isCompositing()===!1)&&(ve.cameraAutoUpdate===!0&&ve.updateCamera(v),v=ve.getCamera()),a.isScene===!0&&a.onBeforeRender(w,a,v,ne),m=ae.get(a,c.length),m.init(v),m.state.textureUnits=O.getTextureUnits(),c.push(m),Ie.multiplyMatrices(v.projectionMatrix,v.matrixWorldInverse),De.setFromProjectionMatrix(Ie,wi,v.reversedDepth),qe=this.localClippingEnabled,Be=xe.init(this.clippingPlanes,qe),S=ce.get(a,D.length),S.init(),D.push(S),ve.enabled===!0&&ve.isPresenting===!0){const he=w.xr.getDepthSensingMesh();he!==null&&Vn(he,v,-1/0,w.sortObjects)}Vn(a,v,0,w.sortObjects),S.finish(),G!==null&&G.updateLights(m.state.lightsArray),w.sortObjects===!0&&S.sort(Ee,Ue),nt=ve.enabled===!1||ve.isPresenting===!1||ve.hasDepthSensing()===!1,nt&&Ce.addToRenderList(S,a),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Be===!0&&xe.beginShadows();const C=m.state.shadowsArray;if(Ae.render(C,a,v),Be===!0&&xe.endShadows(),(b&&_.hasRenderPass())===!1){const he=S.opaque,fe=S.transmissive;if(m.setupLights(),v.isArrayCamera){const _e=v.cameras;if(fe.length>0)for(let Se=0,Le=_e.length;Se<Le;Se++){const we=_e[Se];fr(he,fe,a,we)}nt&&Ce.render(a);for(let Se=0,Le=_e.length;Se<Le;Se++){const we=_e[Se];cr(S,a,we,we.viewport)}}else fe.length>0&&fr(he,fe,a,v),nt&&Ce.render(a),cr(S,a,v)}ne!==null&&Y===0&&(O.updateMultisampleRenderTarget(ne),O.updateRenderTargetMipmap(ne)),b&&_.end(w),a.isScene===!0&&a.onAfterRender(w,a,v),ue.resetDefaultState(),Z=-1,j=null,c.pop(),c.length>0?(m=c[c.length-1],O.setTextureUnits(m.state.textureUnits),Be===!0&&xe.setGlobalState(w.clippingPlanes,m.state.camera)):m=null,D.pop(),D.length>0?S=D[D.length-1]:S=null,G!==null&&G.renderEnd()};function Vn(a,v,y,b){if(a.visible===!1)return;if(a.layers.test(v.layers)){if(a.isGroup)y=a.renderOrder;else if(a.isLOD)a.autoUpdate===!0&&a.update(v);else if(a.isLightProbeGrid)m.pushLightProbeGrid(a);else if(a.isLight)m.pushLight(a),a.castShadow&&m.pushShadow(a);else if(a.isSprite){if(!a.frustumCulled||a.intersectsFrustum(De)){b&&ft.setFromMatrixPosition(a.matrixWorld).applyMatrix4(Ie);const he=X.update(a),fe=a.material;fe.visible&&S.push(a,he,fe,y,ft.z,null,v)}}else if((a.isMesh||a.isLine||a.isPoints)&&(!a.frustumCulled||a.intersectsFrustum(De))){const he=X.update(a),fe=a.material;if(b&&(a.boundingSphere!==void 0?(a.boundingSphere===null&&a.computeBoundingSphere(),ft.copy(a.boundingSphere.center)):(he.boundingSphere===null&&he.computeBoundingSphere(),ft.copy(he.boundingSphere.center)),ft.applyMatrix4(a.matrixWorld).applyMatrix4(Ie)),Array.isArray(fe)){const _e=he.groups;for(let Se=0,Le=_e.length;Se<Le;Se++){const we=_e[Se],ge=fe[we.materialIndex];ge&&ge.visible&&S.push(a,he,ge,y,ft.z,we,v)}}else fe.visible&&S.push(a,he,fe,y,ft.z,null,v)}}const de=a.children;for(let he=0,fe=de.length;he<fe;he++)Vn(de[he],v,y,b)}function cr(a,v,y,b){const{opaque:C,transmissive:de,transparent:he}=a;m.setupLightsView(y),Be===!0&&xe.setGlobalState(w.clippingPlanes,y),b&&r.viewport(ee.copy(b)),C.length>0&&vn(C,v,y),de.length>0&&vn(de,v,y),he.length>0&&vn(he,v,y),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function fr(a,v,y,b){if((y.isScene===!0?y.overrideMaterial:null)!==null)return;if(m.state.transmissionRenderTarget[b.id]===void 0){const ge=We.has("EXT_color_buffer_half_float")||We.has("EXT_color_buffer_float");m.state.transmissionRenderTarget[b.id]=new Mt(1,1,{generateMipmaps:!0,type:ge?wt:At,minFilter:Xt,samples:Math.max(4,u.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:tt.workingColorSpace})}const de=m.state.transmissionRenderTarget[b.id],he=b.viewport||ee;de.setSize(he.z*w.transmissionResolutionScale,he.w*w.transmissionResolutionScale);const fe=w.getRenderTarget(),_e=w.getActiveCubeFace(),Se=w.getActiveMipmapLevel();w.setRenderTarget(de),w.getClearColor(it),ke=w.getClearAlpha(),ke<1&&w.setClearColor(16777215,.5),w.clear(),nt&&Ce.render(y);const Le=w.toneMapping;w.toneMapping=Rt;const we=b.viewport;if(b.viewport!==void 0&&(b.viewport=void 0),m.setupLightsView(b),Be===!0&&xe.setGlobalState(w.clippingPlanes,b),vn(a,y,b),O.updateMultisampleRenderTarget(de),O.updateRenderTargetMipmap(de),We.has("WEBGL_multisampled_render_to_texture")===!1){let ge=!1;for(let He=0,ot=v.length;He<ot;He++){const Je=v[He],{object:Ke,geometry:ut,material:pe,group:pt}=Je;if(pe.side===Lt&&Ke.layers.test(b.layers)){const Oe=pe.side;pe.side=St,pe.needsUpdate=!0,dr(Ke,y,b,ut,pe,pt),pe.side=Oe,pe.needsUpdate=!0,ge=!0}}ge===!0&&(O.updateMultisampleRenderTarget(de),O.updateRenderTargetMipmap(de))}w.setRenderTarget(fe,_e,Se),w.setClearColor(it,ke),we!==void 0&&(b.viewport=we),w.toneMapping=Le}function vn(a,v,y){const b=v.isScene===!0?v.overrideMaterial:null;for(let C=0,de=a.length;C<de;C++){const he=a[C],{object:fe,geometry:_e,group:Se}=he;let Le=he.material;Le.allowOverride===!0&&b!==null&&(Le=b),fe.layers.test(y.layers)&&dr(fe,v,y,_e,Le,Se)}}function dr(a,v,y,b,C,de){G!==null&&C.isNodeMaterial&&G.setObject(a,C),a.onBeforeRender(w,v,y,b,C,de),a.modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),C.onBeforeRender(w,v,y,b,a,de),C.transparent===!0&&C.side===Lt&&C.forceSinglePass===!1?(C.side=St,C.needsUpdate=!0,w.renderBufferDirect(y,v,b,C,a,de),C.side=rn,C.needsUpdate=!0,w.renderBufferDirect(y,v,b,C,a,de),C.side=Lt):w.renderBufferDirect(y,v,b,C,a,de),a.onAfterRender(w,v,y,b,C,de)}function Sn(a,v,y){v.isScene!==!0&&(v=_t);const b=U.get(a),C=m.state.lights,de=m.state.shadowsArray,he=C.state.version,fe=re.getParameters(a,C.state,de,v,y,m.state.lightProbeGridArray),_e=re.getProgramCacheKey(fe);let Se=b.programs;b.environment=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?v.environment:null,b.fog=v.fog;const Le=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap;b.envMap=te.get(a.envMap||b.environment,Le),b.envMapRotation=b.environment!==null&&a.envMap===null?v.environmentRotation:a.envMapRotation,Se===void 0&&(a.addEventListener("dispose",bt),Se=new Map,b.programs=Se);let we=Se.get(_e);if(we!==void 0){if(b.currentProgram===we&&b.lightsStateVersion===he)return pr(a,fe),we}else fe.uniforms=re.getUniforms(a),G!==null&&a.isNodeMaterial&&G.build(a,y,fe),a.onBeforeCompile(fe,w),we=re.acquireProgram(fe,_e),Se.set(_e,we),b.uniforms=fe.uniforms;const ge=b.uniforms;return(!a.isShaderMaterial&&!a.isRawShaderMaterial||a.clipping===!0)&&(ge.clippingPlanes=xe.uniform),pr(a,fe),b.needsLights=_o(a),b.lightsStateVersion=he,b.needsLights&&(ge.ambientLightColor.value=C.state.ambient,ge.lightProbe.value=C.state.probe,ge.sunLights.value=C.state.sun,ge.sunLightShadows.value=C.state.sunShadow,ge.directionalLights.value=C.state.directional,ge.directionalLightShadows.value=C.state.directionalShadow,ge.spotLights.value=C.state.spot,ge.spotLightShadows.value=C.state.spotShadow,ge.rectAreaLights.value=C.state.rectArea,ge.ltc_1.value=C.state.rectAreaLTC1,ge.ltc_2.value=C.state.rectAreaLTC2,ge.pointLights.value=C.state.point,ge.pointLightShadows.value=C.state.pointShadow,ge.hemisphereLights.value=C.state.hemi,ge.sunShadowMatrix.value=C.state.sunShadowMatrix,ge.sunShadowCascade.value=C.state.sunShadowCascade,ge.directionalShadowMatrix.value=C.state.directionalShadowMatrix,ge.spotLightMatrix.value=C.state.spotLightMatrix,ge.spotLightMap.value=C.state.spotLightMap,ge.pointShadowMatrix.value=C.state.pointShadowMatrix),b.lightProbeGrid=m.state.lightProbeGridArray.length>0,b.currentProgram=we,b.uniformsList=null,we}function ur(a){if(a.uniformsList===null){const v=a.currentProgram.getUniforms();a.uniformsList=Un.seqWithValue(v.seq,a.uniforms)}return a.uniformsList}function pr(a,v){const y=U.get(a);y.outputColorSpace=v.outputColorSpace,y.batching=v.batching,y.batchingColor=v.batchingColor,y.instancing=v.instancing,y.instancingColor=v.instancingColor,y.instancingMorph=v.instancingMorph,y.skinning=v.skinning,y.morphTargets=v.morphTargets,y.morphNormals=v.morphNormals,y.morphColors=v.morphColors,y.morphTargetsCount=v.morphTargetsCount,y.numClippingPlanes=v.numClippingPlanes,y.numIntersection=v.numClipIntersection,y.vertexAlphas=v.vertexAlphas,y.vertexTangents=v.vertexTangents,y.toneMapping=v.toneMapping}function po(a,v){if(a.length===0)return null;if(a.length===1)return a[0].texture!==null?a[0]:null;h.setFromMatrixPosition(v.matrixWorld);for(let y=0,b=a.length;y<b;y++){const C=a[y];if(C.texture!==null&&C.boundingBox.containsPoint(h))return C}return null}function ho(a,v,y,b,C){v.isScene!==!0&&(v=_t),O.resetTextureUnits();const de=v.fog,he=b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial?v.environment:null,fe=ne===null?w.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:tt.workingColorSpace,_e=b.isMeshStandardMaterial||b.isMeshLambertMaterial&&!b.envMap||b.isMeshPhongMaterial&&!b.envMap,Se=te.get(b.envMap||he,_e),Le=b.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,we=!!y.attributes.tangent&&(!!b.normalMap||b.anisotropy>0),ge=!!y.morphAttributes.position,He=!!y.morphAttributes.normal,ot=!!y.morphAttributes.color;let Je=Rt;b.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(Je=w.toneMapping);const Ke=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,ut=Ke!==void 0?Ke.length:0,pe=U.get(b),pt=m.state.lights;if(Be===!0&&(qe===!0||a!==j)){const $e=a===j&&b.id===Z;xe.setState(b,a,$e)}let Oe=!1;b.version===pe.__version?(pe.needsLights&&pe.lightsStateVersion!==pt.state.version||pe.outputColorSpace!==fe||C.isBatchedMesh&&pe.batching===!1||!C.isBatchedMesh&&pe.batching===!0||C.isBatchedMesh&&pe.batchingColor===!0&&C._colorsTexture===null||C.isBatchedMesh&&pe.batchingColor===!1&&C._colorsTexture!==null||C.isInstancedMesh&&pe.instancing===!1||!C.isInstancedMesh&&pe.instancing===!0||C.isSkinnedMesh&&pe.skinning===!1||!C.isSkinnedMesh&&pe.skinning===!0||C.isInstancedMesh&&pe.instancingColor===!0&&C.instanceColor===null||C.isInstancedMesh&&pe.instancingColor===!1&&C.instanceColor!==null||C.isInstancedMesh&&pe.instancingMorph===!0&&C.morphTexture===null||C.isInstancedMesh&&pe.instancingMorph===!1&&C.morphTexture!==null||pe.envMap!==Se||b.fog===!0&&pe.fog!==de||pe.numClippingPlanes!==void 0&&(pe.numClippingPlanes!==xe.numPlanes||pe.numIntersection!==xe.numIntersection)||pe.vertexAlphas!==Le||pe.vertexTangents!==we||pe.morphTargets!==ge||pe.morphNormals!==He||pe.morphColors!==ot||pe.toneMapping!==Je||pe.morphTargetsCount!==ut||!!pe.lightProbeGrid!=m.state.lightProbeGridArray.length>0)&&(Oe=!0):(Oe=!0,pe.__version=b.version);let Et=pe.currentProgram;Oe===!0&&(Et=Sn(b,v,C),G&&b.isNodeMaterial&&G.onUpdateProgram(b,Et,pe));let Ct=!1,Ft=!1,$t=!1;const Xe=Et.getUniforms(),rt=pe.uniforms;if(r.useProgram(Et.program)&&(Ct=!0,Ft=!0,$t=!0),b.id!==Z&&(Z=b.id,Ft=!0),pe.needsLights){const $e=po(m.state.lightProbeGridArray,C);pe.lightProbeGrid!==$e&&(pe.lightProbeGrid=$e,Ft=!0)}if(Ct||j!==a){r.buffers.depth.getReversed()&&a.reversedDepth!==!0&&(a._reversedDepth=!0,a.updateProjectionMatrix()),Xe.setValue(M,"projectionMatrix",a.projectionMatrix),Xe.setValue(M,"viewMatrix",a.matrixWorldInverse);const Bt=Xe.map.cameraPosition;Bt!==void 0&&Bt.setValue(M,et.setFromMatrixPosition(a.matrixWorld)),u.logarithmicDepthBuffer&&Xe.setValue(M,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2)),(b.isMeshPhongMaterial||b.isMeshToonMaterial||b.isMeshLambertMaterial||b.isMeshBasicMaterial||b.isMeshStandardMaterial||b.isShaderMaterial)&&Xe.setValue(M,"isOrthographic",a.isOrthographicCamera===!0),j!==a&&(j=a,Ft=!0,$t=!0)}if(pe.needsLights&&(pt.state.sunShadowMap.length>0&&Xe.setValue(M,"sunShadowMap",pt.state.sunShadowMap,O),pt.state.directionalShadowMap.length>0&&Xe.setValue(M,"directionalShadowMap",pt.state.directionalShadowMap,O),pt.state.spotShadowMap.length>0&&Xe.setValue(M,"spotShadowMap",pt.state.spotShadowMap,O),pt.state.pointShadowMap.length>0&&Xe.setValue(M,"pointShadowMap",pt.state.pointShadowMap,O)),C.isSkinnedMesh){Xe.setOptional(M,C,"bindMatrix"),Xe.setOptional(M,C,"bindMatrixInverse");const $e=C.skeleton;$e&&($e.boneTexture===null&&$e.computeBoneTexture(),Xe.setValue(M,"boneTexture",$e.boneTexture,O))}C.isBatchedMesh&&(Xe.setOptional(M,C,"batchingTexture"),Xe.setValue(M,"batchingTexture",C._matricesTexture,O),Xe.setOptional(M,C,"batchingIdTexture"),Xe.setValue(M,"batchingIdTexture",C._indirectTexture,O),Xe.setOptional(M,C,"batchingColorTexture"),C._colorsTexture!==null&&Xe.setValue(M,"batchingColorTexture",C._colorsTexture,O));const Ot=y.morphAttributes;if((Ot.position!==void 0||Ot.normal!==void 0||Ot.color!==void 0)&&E.update(C,y,Et),(Ft||pe.receiveShadow!==C.receiveShadow)&&(pe.receiveShadow=C.receiveShadow,Xe.setValue(M,"receiveShadow",C.receiveShadow)),(b.isMeshStandardMaterial||b.isMeshLambertMaterial||b.isMeshPhongMaterial)&&b.envMap===null&&v.environment!==null&&(rt.envMapIntensity.value=v.environmentIntensity),rt.dfgLUT!==void 0&&(rt.dfgLUT.value=qm()),Ft){if(Xe.setValue(M,"toneMappingExposure",w.toneMappingExposure),pe.needsLights&&mo(rt,$t),de&&b.fog===!0&&Me.refreshFogUniforms(rt,de),Me.refreshMaterialUniforms(rt,b,$,V,m.state.transmissionRenderTarget[a.id]),pe.needsLights&&pe.lightProbeGrid){const $e=pe.lightProbeGrid;rt.probesSH.value=$e.texture,rt.probesMin.value.copy($e.boundingBox.min),rt.probesMax.value.copy($e.boundingBox.max),rt.probesResolution.value.copy($e.resolution)}Un.upload(M,ur(pe),rt,O)}if(b.isShaderMaterial&&b.uniformsNeedUpdate===!0&&(Un.upload(M,ur(pe),rt,O),b.uniformsNeedUpdate=!1),b.isSpriteMaterial&&Xe.setValue(M,"center",C.center),Xe.setValue(M,"modelViewMatrix",C.modelViewMatrix),Xe.setValue(M,"normalMatrix",C.normalMatrix),Xe.setValue(M,"modelMatrix",C.matrixWorld),b.uniformsGroups!==void 0){const $e=b.uniformsGroups;for(let Bt=0,Qt=$e.length;Bt<Qt;Bt++){const mr=$e[Bt];J.update(mr,Et),J.bind(mr,Et)}}return Et}function mo(a,v){a.ambientLightColor.needsUpdate=v,a.lightProbe.needsUpdate=v,a.sunLights.needsUpdate=v,a.sunLightShadows.needsUpdate=v,a.directionalLights.needsUpdate=v,a.directionalLightShadows.needsUpdate=v,a.pointLights.needsUpdate=v,a.pointLightShadows.needsUpdate=v,a.spotLights.needsUpdate=v,a.spotLightShadows.needsUpdate=v,a.rectAreaLights.needsUpdate=v,a.hemisphereLights.needsUpdate=v}function _o(a){return a.isMeshLambertMaterial||a.isMeshToonMaterial||a.isMeshPhongMaterial||a.isMeshStandardMaterial||a.isShadowMaterial||a.isShaderMaterial&&a.lights===!0}this.getActiveCubeFace=function(){return Q},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return ne},this.setRenderTargetTextures=function(a,v,y){const b=U.get(a);b.__autoAllocateDepthBuffer=a.resolveDepthBuffer===!1,b.__autoAllocateDepthBuffer===!1&&(b.__useRenderToTexture=!1),U.get(a.texture).__webglTexture=v,U.get(a.depthTexture).__webglTexture=b.__autoAllocateDepthBuffer?void 0:y,b.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(a,v){const y=U.get(a);y.__webglFramebuffer=v,y.__useDefaultFramebuffer=v===void 0},this.setRenderTarget=function(a,v=0,y=0){ne=a,Q=v,Y=y;let b=null,C=!1,de=!1;if(a){const fe=U.get(a);if(fe.__useDefaultFramebuffer!==void 0){r.bindFramebuffer(M.FRAMEBUFFER,fe.__webglFramebuffer),ee.copy(a.viewport),be.copy(a.scissor),Re=a.scissorTest,r.viewport(ee),r.scissor(be),r.setScissorTest(Re),Z=-1;return}else if(fe.__webglFramebuffer===void 0)O.setupRenderTarget(a);else if(fe.__hasExternalTextures)O.rebindTextures(a,U.get(a.texture).__webglTexture,U.get(a.depthTexture).__webglTexture);else if(a.depthBuffer){const Le=a.depthTexture;if(fe.__boundDepthTexture!==Le){if(Le!==null&&U.has(Le)&&(a.width!==Le.image.width||a.height!==Le.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");O.setupDepthRenderbuffer(a)}}const _e=a.texture;(_e.isData3DTexture||_e.isDataArrayTexture||_e.isCompressedArrayTexture)&&(de=!0);const Se=U.get(a).__webglFramebuffer;a.isWebGLCubeRenderTarget?(Array.isArray(Se[v])?b=Se[v][y]:b=Se[v],C=!0):a.samples>0&&O.useMultisampledRTT(a)===!1?b=U.get(a).__webglMultisampledFramebuffer:Array.isArray(Se)?b=Se[y]:b=Se,ee.copy(a.viewport),be.copy(a.scissor),Re=a.scissorTest}else ee.copy(me).multiplyScalar($).floor(),be.copy(Fe).multiplyScalar($).floor(),Re=st;if(y!==0&&(b=q),r.bindFramebuffer(M.FRAMEBUFFER,b)&&r.drawBuffers(a,b),r.viewport(ee),r.scissor(be),r.setScissorTest(Re),C){const fe=U.get(a.texture);M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_CUBE_MAP_POSITIVE_X+v,fe.__webglTexture,y)}else if(de){const fe=v;for(let _e=0;_e<a.textures.length;_e++){const Se=U.get(a.textures[_e]);M.framebufferTextureLayer(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0+_e,Se.__webglTexture,y,fe)}}else if(a!==null&&y!==0){const fe=U.get(a.texture);M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_2D,fe.__webglTexture,y)}Z=-1};function hr(a){const v=U.get(a);return(v.__readFormat!==a.format||v.__readType!==a.type)&&(v.__readFormat=a.format,v.__readType=a.type,v.__formatReadable=u.textureFormatReadable(a.format),v.__typeReadable=u.textureTypeReadable(a.type)),v}this.readRenderTargetPixels=function(a,v,y,b,C,de,he,fe=0){if(!(a&&a.isWebGLRenderTarget)){Qe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _e=U.get(a).__webglFramebuffer;if(a.isWebGLCubeRenderTarget&&he!==void 0&&(_e=_e[he]),_e){r.bindFramebuffer(M.FRAMEBUFFER,_e);try{const Se=a.textures[fe],Le=Se.format,we=Se.type;a.textures.length>1&&M.readBuffer(M.COLOR_ATTACHMENT0+fe);const ge=hr(Se);if(ge.__formatReadable===!1){Qe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(ge.__typeReadable===!1){Qe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}v>=0&&v<=a.width-b&&y>=0&&y<=a.height-C&&M.readPixels(v,y,b,C,se.convert(Le),se.convert(we),de)}finally{const Se=ne!==null?U.get(ne).__webglFramebuffer:null;r.bindFramebuffer(M.FRAMEBUFFER,Se)}}},this.readRenderTargetPixelsAsync=async function(a,v,y,b,C,de,he,fe=0){if(!(a&&a.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let _e=U.get(a).__webglFramebuffer;if(a.isWebGLCubeRenderTarget&&he!==void 0&&(_e=_e[he]),_e)if(v>=0&&v<=a.width-b&&y>=0&&y<=a.height-C){r.bindFramebuffer(M.FRAMEBUFFER,_e);const Se=a.textures[fe],Le=Se.format,we=Se.type;a.textures.length>1&&M.readBuffer(M.COLOR_ATTACHMENT0+fe);const ge=hr(Se);if(ge.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(ge.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const He=M.createBuffer();M.bindBuffer(M.PIXEL_PACK_BUFFER,He),M.bufferData(M.PIXEL_PACK_BUFFER,de.byteLength,M.STREAM_READ),M.readPixels(v,y,b,C,se.convert(Le),se.convert(we),0),M.bindBuffer(M.PIXEL_PACK_BUFFER,null);const ot=ne!==null?U.get(ne).__webglFramebuffer:null;r.bindFramebuffer(M.FRAMEBUFFER,ot);const Je=M.fenceSync(M.SYNC_GPU_COMMANDS_COMPLETE,0);return M.flush(),await qf(M,Je,4),M.bindBuffer(M.PIXEL_PACK_BUFFER,He),M.getBufferSubData(M.PIXEL_PACK_BUFFER,0,de),M.bindBuffer(M.PIXEL_PACK_BUFFER,null),M.deleteBuffer(He),M.deleteSync(Je),de}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(a,v=null,y=0){const b=Math.pow(2,-y),C=Math.floor(a.image.width*b),de=Math.floor(a.image.height*b),he=v!==null?v.x:0,fe=v!==null?v.y:0;O.setTexture2D(a,0),M.copyTexSubImage2D(M.TEXTURE_2D,y,0,0,he,fe,C,de),r.unbindTexture()},this.copyTextureToTexture=function(a,v,y=null,b=null,C=0,de=0){let he,fe,_e,Se,Le,we,ge,He,ot;const Je=a.isCompressedTexture?a.mipmaps[de]:a.image;if(y!==null)he=y.max.x-y.min.x,fe=y.max.y-y.min.y,_e=y.isBox3?y.max.z-y.min.z:1,Se=y.min.x,Le=y.min.y,we=y.isBox3?y.min.z:0;else{const rt=Math.pow(2,-C);he=Math.floor(Je.width*rt),fe=Math.floor(Je.height*rt),a.isDataArrayTexture?_e=Je.depth:a.isData3DTexture?_e=Math.floor(Je.depth*rt):_e=1,Se=0,Le=0,we=0}b!==null?(ge=b.x,He=b.y,ot=b.z):(ge=0,He=0,ot=0);const Ke=se.convert(v.format),ut=se.convert(v.type);let pe;v.isData3DTexture?(O.setTexture3D(v,0),pe=M.TEXTURE_3D):v.isDataArrayTexture||v.isCompressedArrayTexture?(O.setTexture2DArray(v,0),pe=M.TEXTURE_2D_ARRAY):(O.setTexture2D(v,0),pe=M.TEXTURE_2D),r.activeTexture(M.TEXTURE0),r.pixelStorei(M.UNPACK_FLIP_Y_WEBGL,v.flipY),r.pixelStorei(M.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),r.pixelStorei(M.UNPACK_ALIGNMENT,v.unpackAlignment);const pt=r.getParameter(M.UNPACK_ROW_LENGTH),Oe=r.getParameter(M.UNPACK_IMAGE_HEIGHT),Et=r.getParameter(M.UNPACK_SKIP_PIXELS),Ct=r.getParameter(M.UNPACK_SKIP_ROWS),Ft=r.getParameter(M.UNPACK_SKIP_IMAGES);r.pixelStorei(M.UNPACK_ROW_LENGTH,Je.width),r.pixelStorei(M.UNPACK_IMAGE_HEIGHT,Je.height),r.pixelStorei(M.UNPACK_SKIP_PIXELS,Se),r.pixelStorei(M.UNPACK_SKIP_ROWS,Le),r.pixelStorei(M.UNPACK_SKIP_IMAGES,we);const $t=a.isDataArrayTexture||a.isData3DTexture,Xe=v.isDataArrayTexture||v.isData3DTexture;if(a.isDepthTexture){const rt=U.get(a),Ot=U.get(v),$e=U.get(rt.__renderTarget),Bt=U.get(Ot.__renderTarget);r.bindFramebuffer(M.READ_FRAMEBUFFER,$e.__webglFramebuffer),r.bindFramebuffer(M.DRAW_FRAMEBUFFER,Bt.__webglFramebuffer);for(let Qt=0;Qt<_e;Qt++)$t&&(M.framebufferTextureLayer(M.READ_FRAMEBUFFER,M.COLOR_ATTACHMENT0,U.get(a).__webglTexture,C,we+Qt),M.framebufferTextureLayer(M.DRAW_FRAMEBUFFER,M.COLOR_ATTACHMENT0,U.get(v).__webglTexture,de,ot+Qt)),M.blitFramebuffer(Se,Le,he,fe,ge,He,he,fe,M.DEPTH_BUFFER_BIT,M.NEAREST);r.bindFramebuffer(M.READ_FRAMEBUFFER,null),r.bindFramebuffer(M.DRAW_FRAMEBUFFER,null)}else if(C!==0||a.isRenderTargetTexture||U.has(a)){const rt=U.get(a),Ot=U.get(v);r.bindFramebuffer(M.READ_FRAMEBUFFER,P),r.bindFramebuffer(M.DRAW_FRAMEBUFFER,K);for(let $e=0;$e<_e;$e++)$t?M.framebufferTextureLayer(M.READ_FRAMEBUFFER,M.COLOR_ATTACHMENT0,rt.__webglTexture,C,we+$e):M.framebufferTexture2D(M.READ_FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_2D,rt.__webglTexture,C),Xe?M.framebufferTextureLayer(M.DRAW_FRAMEBUFFER,M.COLOR_ATTACHMENT0,Ot.__webglTexture,de,ot+$e):M.framebufferTexture2D(M.DRAW_FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_2D,Ot.__webglTexture,de),C!==0?M.blitFramebuffer(Se,Le,he,fe,ge,He,he,fe,M.COLOR_BUFFER_BIT,M.NEAREST):Xe?M.copyTexSubImage3D(pe,de,ge,He,ot+$e,Se,Le,he,fe):M.copyTexSubImage2D(pe,de,ge,He,Se,Le,he,fe);r.bindFramebuffer(M.READ_FRAMEBUFFER,null),r.bindFramebuffer(M.DRAW_FRAMEBUFFER,null)}else Xe?a.isDataTexture||a.isData3DTexture?M.texSubImage3D(pe,de,ge,He,ot,he,fe,_e,Ke,ut,Je.data):v.isCompressedArrayTexture?M.compressedTexSubImage3D(pe,de,ge,He,ot,he,fe,_e,Ke,Je.data):M.texSubImage3D(pe,de,ge,He,ot,he,fe,_e,Ke,ut,Je):a.isDataTexture?M.texSubImage2D(M.TEXTURE_2D,de,ge,He,he,fe,Ke,ut,Je.data):a.isCompressedTexture?M.compressedTexSubImage2D(M.TEXTURE_2D,de,ge,He,Je.width,Je.height,Ke,Je.data):M.texSubImage2D(M.TEXTURE_2D,de,ge,He,he,fe,Ke,ut,Je);r.pixelStorei(M.UNPACK_ROW_LENGTH,pt),r.pixelStorei(M.UNPACK_IMAGE_HEIGHT,Oe),r.pixelStorei(M.UNPACK_SKIP_PIXELS,Et),r.pixelStorei(M.UNPACK_SKIP_ROWS,Ct),r.pixelStorei(M.UNPACK_SKIP_IMAGES,Ft),de===0&&v.generateMipmaps&&M.generateMipmap(pe),r.unbindTexture()},this.initRenderTarget=function(a){U.get(a).__webglFramebuffer===void 0&&O.setupRenderTarget(a)},this.initTexture=function(a){a.isCubeTexture?O.setTextureCube(a,0):a.isData3DTexture?O.setTexture3D(a,0):a.isDataArrayTexture||a.isCompressedArrayTexture?O.setTexture2DArray(a,0):O.setTexture2D(a,0),r.unbindTexture()},this.resetState=function(){Q=0,Y=0,ne=null,r.reset(),ue.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return wi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(n){this._outputColorSpace=n;const t=this.getContext();t.drawingBufferColorSpace=tt._getDrawingBufferColorSpace(n),t.unpackColorSpace=tt._getUnpackColorSpace()}}const Qm=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Bi,AddEquation:jt,AddOperation:Br,AdditiveAnimationBlendMode:go,AdditiveBlending:qn,AgXToneMapping:Gi,AlphaFormat:Gr,AlwaysCompare:Hr,AlwaysDepth:Vr,AlwaysStencilFunc:vo,AmbientLight:So,AnimationAction:Eo,AnimationClip:Mo,AnimationLoader:xo,AnimationMixer:To,AnimationObjectGroup:Ao,AnimationUtils:Ro,ArcCurve:bo,ArrayCamera:Wr,ArrowHelper:Co,AttachedBindMode:Po,Audio:Lo,AudioAnalyser:Uo,AudioContext:Do,AudioListener:wo,AudioLoader:Io,AxesHelper:No,BackSide:St,BasicDepthPacking:yo,BasicShadowMap:Fo,BatchedMesh:Oo,BezierInterpolant:Bo,Bone:Go,BooleanKeyframeTrack:Ho,Box2:Vo,Box3:Wo,Box3Helper:ko,BoxGeometry:yn,BoxHelper:zo,BufferAttribute:Dn,BufferGeometry:_n,BufferGeometryLoader:Xo,ByteType:kr,Cache:Ko,Camera:Yo,CameraHelper:qo,CanvasTexture:Zo,CapsuleGeometry:$o,CatmullRomCurve3:Qo,CineonToneMapping:Hi,CircleGeometry:Jo,ClampToEdgeWrapping:wn,Clock:jo,Color:je,ColorKeyframeTrack:es,ColorManagement:tt,Compatibility:ts,CompressedArrayTexture:ns,CompressedCubeTexture:is,CompressedTexture:rs,CompressedTextureLoader:as,ConeGeometry:os,ConstantAlphaFactor:zr,ConstantColorFactor:Xr,Controls:ss,CubeCamera:Kr,CubeDepthTexture:Yr,CubeReflectionMapping:nn,CubeRefractionMapping:Kt,CubeTexture:Vi,CubeTextureLoader:ls,CubeUVReflectionMapping:gn,CubicBezierCurve:cs,CubicBezierCurve3:fs,CubicInterpolant:ds,CullFaceBack:Zn,CullFaceFront:qr,CullFaceFrontBack:us,CullFaceNone:Zr,Curve:ps,CurvePath:hs,CustomBlending:$r,CustomToneMapping:Wi,CylinderGeometry:ms,Cylindrical:_s,Data3DTexture:Qr,DataArrayTexture:ki,DataTexture:Jr,DataTextureLoader:gs,DataUtils:vs,DecrementStencilOp:Ss,DecrementWrapStencilOp:Es,DefaultLoadingManager:Ms,DepthFormat:Yt,DepthStencilFormat:zt,DepthTexture:hn,DetachedBindMode:xs,DirectionalLight:Ts,DirectionalLightHelper:As,DiscreteInterpolant:Rs,DodecahedronGeometry:bs,DoubleSide:Lt,DstAlphaFactor:jr,DstColorFactor:ea,DynamicCopyUsage:Cs,DynamicDrawUsage:Ps,DynamicReadUsage:Ls,EdgesGeometry:Us,EllipseCurve:Ds,EqualCompare:ta,EqualDepth:na,EqualStencilFunc:ws,EquirectangularReflectionMapping:xn,EquirectangularRefractionMapping:Tn,Euler:Is,EventDispatcher:ia,ExternalTexture:zi,ExtrudeGeometry:Ns,FileLoader:ys,Float16BufferAttribute:Fs,Float32BufferAttribute:$n,FloatType:yt,Fog:Os,FogExp2:Bs,FramebufferTexture:Gs,FrontSide:rn,Frustum:Xi,FrustumArray:Hs,GLBufferAttribute:Vs,GLSL1:Ws,GLSL3:Qn,GreaterCompare:ra,GreaterDepth:aa,GreaterEqualCompare:Fn,GreaterEqualDepth:oa,GreaterEqualStencilFunc:ks,GreaterStencilFunc:zs,GridHelper:Xs,Group:Ks,HTMLTexture:Ys,HalfFloatType:wt,HemisphereLight:qs,HemisphereLightHelper:Zs,IcosahedronGeometry:$s,ImageBitmapLoader:Qs,ImageLoader:Js,ImageUtils:js,IncrementStencilOp:el,IncrementWrapStencilOp:tl,InstancedBufferAttribute:nl,InstancedBufferGeometry:il,InstancedInterleavedBuffer:rl,InstancedMesh:al,Int16BufferAttribute:ol,Int32BufferAttribute:sl,Int8BufferAttribute:ll,IntType:Ki,InterleavedBuffer:cl,InterleavedBufferAttribute:fl,Interpolant:dl,InterpolateBezier:ul,InterpolateDiscrete:pl,InterpolateLinear:hl,InterpolateSmooth:ml,InterpolationSamplingMode:_l,InterpolationSamplingType:gl,InvertStencilOp:vl,KeepStencilOp:Sl,KeyframeTrack:El,LOD:Ml,LatheGeometry:xl,Layers:sa,LessCompare:la,LessDepth:ca,LessEqualCompare:On,LessEqualDepth:Jn,LessEqualStencilFunc:Tl,LessStencilFunc:Al,Light:Rl,LightProbe:bl,LightShadow:Cl,Line:Pl,Line3:Ll,LineBasicMaterial:Ul,LineCurve:Dl,LineCurve3:wl,LineDashedMaterial:Il,LineLoop:Nl,LineSegments:yl,LinearFilter:vt,LinearInterpolant:Fl,LinearMipMapLinearFilter:Ol,LinearMipMapNearestFilter:Bl,LinearMipmapLinearFilter:Xt,LinearMipmapNearestFilter:An,LinearSRGBColorSpace:Yi,LinearToneMapping:qi,LinearTransfer:Zi,Loader:Gl,LoaderUtils:Hl,LoadingManager:Vl,LoopOnce:Wl,LoopPingPong:kl,LoopRepeat:zl,MOUSE:Xl,Material:Kl,MaterialBlending:Yl,MaterialLoader:ql,MathUtils:Zl,Matrix2:$l,Matrix3:ye,Matrix4:qt,MaxEquation:fa,Mesh:It,MeshBasicMaterial:da,MeshDepthMaterial:ua,MeshDistanceMaterial:pa,MeshLambertMaterial:Ql,MeshMatcapMaterial:Jl,MeshNormalMaterial:jl,MeshPhongMaterial:ec,MeshPhysicalMaterial:tc,MeshStandardMaterial:nc,MeshToonMaterial:ic,MinEquation:ha,MirroredRepeatWrapping:ma,MixOperation:_a,MultiplyBlending:jn,MultiplyOperation:ga,NearestFilter:Gt,NearestMipMapLinearFilter:rc,NearestMipMapNearestFilter:ac,NearestMipmapLinearFilter:cn,NearestMipmapNearestFilter:va,NeutralToneMapping:$i,NeverCompare:Sa,NeverDepth:Ea,NeverStencilFunc:oc,NoBlending:Dt,NoColorSpace:kt,NoNormalPacking:sc,NoToneMapping:Rt,NormalAnimationBlendMode:lc,NormalBlending:dn,NormalGAPacking:cc,NormalRGPacking:fc,NotEqualCompare:Ma,NotEqualDepth:xa,NotEqualStencilFunc:dc,NumberKeyframeTrack:uc,Object3D:pc,ObjectLoader:hc,ObjectSpaceNormalMap:Ta,OctahedronGeometry:mc,OneFactor:Aa,OneMinusConstantAlphaFactor:Ra,OneMinusConstantColorFactor:ba,OneMinusDstAlphaFactor:Ca,OneMinusDstColorFactor:Pa,OneMinusSrcAlphaFactor:La,OneMinusSrcColorFactor:Ua,OrthographicCamera:Qi,PCFShadowMap:un,PCFSoftShadowMap:Da,PMREMGenerator:yi,Path:_c,PerspectiveCamera:pn,Plane:wa,PlaneGeometry:Ji,PlaneHelper:gc,PointLight:vc,PointLightHelper:Sc,Points:Ec,PointsMaterial:Mc,PolarGridHelper:xc,PolyhedronGeometry:Tc,PositionalAudio:Ac,PropertyBinding:Rc,PropertyMixer:bc,QuadraticBezierCurve:Cc,QuadraticBezierCurve3:Pc,Quaternion:Lc,QuaternionKeyframeTrack:Uc,QuaternionLinearInterpolant:Dc,R11_EAC_Format:ei,RED_GREEN_RGTC2_Format:In,RED_RGTC1_Format:ti,REVISION:Ia,RG11_EAC_Format:Nn,RGBADepthPacking:wc,RGBAFormat:Ut,RGBAIntegerFormat:ji,RGBA_ASTC_10x10_Format:ni,RGBA_ASTC_10x5_Format:ii,RGBA_ASTC_10x6_Format:ri,RGBA_ASTC_10x8_Format:ai,RGBA_ASTC_12x10_Format:oi,RGBA_ASTC_12x12_Format:si,RGBA_ASTC_4x4_Format:li,RGBA_ASTC_5x4_Format:ci,RGBA_ASTC_5x5_Format:fi,RGBA_ASTC_6x5_Format:di,RGBA_ASTC_6x6_Format:ui,RGBA_ASTC_8x5_Format:pi,RGBA_ASTC_8x6_Format:hi,RGBA_ASTC_8x8_Format:mi,RGBA_BPTC_Format:_i,RGBA_ETC2_EAC_Format:gi,RGBA_PVRTC_2BPPV1_Format:vi,RGBA_PVRTC_4BPPV1_Format:Si,RGBA_S3TC_DXT1_Format:Rn,RGBA_S3TC_DXT3_Format:bn,RGBA_S3TC_DXT5_Format:Cn,RGBDepthPacking:Ic,RGBFormat:Na,RGBIntegerFormat:Nc,RGB_BPTC_SIGNED_Format:Ei,RGB_BPTC_UNSIGNED_Format:Mi,RGB_ETC1_Format:xi,RGB_ETC2_Format:Ti,RGB_PVRTC_2BPPV1_Format:Ai,RGB_PVRTC_4BPPV1_Format:Ri,RGB_S3TC_DXT1_Format:Pn,RGDepthPacking:yc,RGFormat:Zt,RGIntegerFormat:er,RawShaderMaterial:ya,Ray:Fc,Raycaster:Oc,RectAreaLight:Bc,RedFormat:Fa,RedIntegerFormat:tr,ReinhardToneMapping:nr,RenderObjectRefreshType:Gc,RenderTarget:Hc,RenderTarget3D:Vc,RepeatWrapping:Oa,ReplaceStencilOp:Wc,ReverseSubtractEquation:Ba,RingGeometry:kc,SIGNED_R11_EAC_Format:bi,SIGNED_RED_GREEN_RGTC2_Format:Ci,SIGNED_RED_RGTC1_Format:Pi,SIGNED_RG11_EAC_Format:Li,SRGBColorSpace:Ga,SRGBTransfer:Ye,Scene:zc,ShaderChunk:Pe,ShaderLib:Tt,ShaderMaterial:Nt,ShadowMaterial:Xc,Shape:Kc,ShapeGeometry:Yc,ShapePath:qc,ShapeUtils:Zc,ShortType:Ha,Skeleton:$c,SkeletonHelper:Qc,SkinnedMesh:Jc,Source:jc,Sphere:ef,SphereGeometry:tf,Spherical:nf,SphericalHarmonics3:rf,SplineCurve:af,SpotLight:of,SpotLightHelper:sf,Sprite:lf,SpriteMaterial:cf,SrcAlphaFactor:Va,SrcAlphaSaturateFactor:Wa,SrcColorFactor:ka,StaticCopyUsage:ff,StaticDrawUsage:df,StaticReadUsage:uf,StereoCamera:pf,StreamCopyUsage:hf,StreamDrawUsage:mf,StreamReadUsage:_f,StringKeyframeTrack:gf,SubtractEquation:za,SubtractiveBlending:Ui,TOUCH:vf,TangentSpaceNormalMap:Di,TetrahedronGeometry:Sf,Texture:Xa,TextureLoader:Ef,TextureSource:Mf,TextureUtils:xf,Timer:Tf,TimestampQuery:Af,TorusGeometry:Rf,TorusKnotGeometry:bf,Triangle:Cf,TriangleFanDrawMode:Pf,TriangleStripDrawMode:Lf,TrianglesDrawMode:Uf,TubeGeometry:Df,UVMapping:wf,Uint16BufferAttribute:Ka,Uint32BufferAttribute:Ya,Uint8BufferAttribute:If,Uint8ClampedBufferAttribute:Nf,Uniform:yf,UniformsGroup:Ff,UniformsLib:le,UniformsUtils:qa,UnsignedByteType:At,UnsignedInt101111Type:Za,UnsignedInt248Type:an,UnsignedInt5999Type:$a,UnsignedIntType:Ht,UnsignedShort4444Type:ir,UnsignedShort5551Type:rr,UnsignedShortType:mn,VSMShadowMap:en,Vector2:mt,Vector3:Ne,Vector4:ht,VectorKeyframeTrack:Of,VideoFrameTexture:Bf,VideoTexture:Gf,WebGL3DRenderTarget:Hf,WebGLArrayRenderTarget:Vf,WebGLCoordinateSystem:wi,WebGLCubeRenderTarget:ar,WebGLRenderTarget:Mt,WebGLRenderer:Zm,WebGLUtils:so,WebGPUCoordinateSystem:Wf,WebXRController:Ln,WireframeGeometry:kf,WrapAroundEnding:zf,ZeroCurvatureEnding:Xf,ZeroFactor:Qa,ZeroSlopeEnding:Kf,ZeroStencilOp:Yf,createCanvasElement:Ja,error:Qe,getConsoleFunction:Jf,log:Ni,setConsoleFunction:jf,warn:Ve,warnOnce:ja},Symbol.toStringTag,{value:"Module"}));export{yi as P,Pe as S,le as U,Zm as W,Qm as _,Tt as a,ar as b};