super-three 0.133.4 → 0.136.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.js +2285 -1983
  3. package/build/three.min.js +1 -1
  4. package/build/three.module.js +5983 -5358
  5. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
  6. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
  7. package/examples/fonts/open-sans/open-sans.css +9 -0
  8. package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
  9. package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +3966 -0
  10. package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
  11. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
  12. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
  13. package/examples/fonts/tabler-icons/tabler-icons.min.css +4 -0
  14. package/examples/js/animation/CCDIKSolver.js +0 -1
  15. package/examples/js/animation/MMDPhysics.js +2 -4
  16. package/examples/js/cameras/CinematicCamera.js +2 -7
  17. package/examples/js/controls/ArcballControls.js +99 -72
  18. package/examples/js/controls/DragControls.js +7 -0
  19. package/examples/js/controls/OrbitControls.js +5 -36
  20. package/examples/js/controls/TrackballControls.js +3 -2
  21. package/examples/js/controls/TransformControls.js +24 -1
  22. package/examples/js/csm/CSM.js +2 -2
  23. package/examples/js/csm/CSMFrustum.js +133 -0
  24. package/examples/js/curves/CurveExtras.js +0 -2
  25. package/examples/js/effects/AsciiEffect.js +2 -9
  26. package/examples/js/exporters/GLTFExporter.js +148 -64
  27. package/examples/js/exporters/MMDExporter.js +1 -1
  28. package/examples/js/exporters/USDZExporter.js +45 -26
  29. package/examples/js/geometries/ConvexGeometry.js +1 -1
  30. package/examples/js/geometries/TeapotGeometry.js +0 -1
  31. package/examples/js/interactive/SelectionBox.js +2 -0
  32. package/examples/js/interactive/SelectionHelper.js +22 -7
  33. package/examples/js/lights/RectAreaLightUniformsLib.js +4 -0
  34. package/examples/js/lines/LineMaterial.js +58 -20
  35. package/examples/js/lines/LineSegments2.js +29 -24
  36. package/examples/js/loaders/3DMLoader.js +24 -11
  37. package/examples/js/loaders/3MFLoader.js +2 -2
  38. package/examples/js/loaders/AMFLoader.js +0 -2
  39. package/examples/js/loaders/BasisTextureLoader.js +1 -0
  40. package/examples/js/loaders/ColladaLoader.js +61 -4
  41. package/examples/js/loaders/EXRLoader.js +201 -272
  42. package/examples/js/loaders/FBXLoader.js +4 -5
  43. package/examples/js/loaders/GLTFLoader.js +98 -35
  44. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -10
  45. package/examples/js/loaders/KTX2Loader.js +23 -2
  46. package/examples/js/loaders/KTXLoader.js +1 -1
  47. package/examples/js/loaders/LDrawLoader.js +1169 -901
  48. package/examples/js/loaders/LUT3dlLoader.js +19 -10
  49. package/examples/js/loaders/LUTCubeLoader.js +5 -4
  50. package/examples/js/loaders/LWOLoader.js +8 -6
  51. package/examples/js/loaders/LogLuvLoader.js +766 -0
  52. package/examples/js/loaders/MMDLoader.js +0 -1
  53. package/examples/js/loaders/NRRDLoader.js +9 -2
  54. package/examples/js/loaders/OBJLoader.js +0 -2
  55. package/examples/js/loaders/PLYLoader.js +33 -8
  56. package/examples/js/loaders/RGBELoader.js +8 -22
  57. package/examples/js/loaders/RGBMLoader.js +56 -6
  58. package/examples/js/loaders/SVGLoader.js +12 -6
  59. package/examples/js/loaders/TDSLoader.js +237 -271
  60. package/examples/js/loaders/VOXLoader.js +1 -0
  61. package/examples/js/loaders/VRMLLoader.js +11 -22
  62. package/examples/js/loaders/lwo/LWO2Parser.js +1 -0
  63. package/examples/js/loaders/lwo/LWO3Parser.js +4 -2
  64. package/examples/js/math/ConvexHull.js +7 -13
  65. package/examples/js/math/ImprovedNoise.js +1 -1
  66. package/examples/js/misc/GPUComputationRenderer.js +3 -1
  67. package/examples/js/misc/Volume.js +2 -2
  68. package/examples/js/modifiers/CurveModifier.js +8 -7
  69. package/examples/js/modifiers/EdgeSplitModifier.js +1 -1
  70. package/examples/js/modifiers/SimplifyModifier.js +1 -1
  71. package/examples/js/objects/Lensflare.js +2 -10
  72. package/examples/js/objects/MarchingCubes.js +42 -128
  73. package/examples/js/objects/Reflector.js +8 -13
  74. package/examples/js/objects/ReflectorForSSRPass.js +0 -10
  75. package/examples/js/objects/Refractor.js +8 -13
  76. package/examples/js/objects/Sky.js +1 -1
  77. package/examples/js/objects/Water.js +3 -15
  78. package/examples/js/objects/Water2.js +4 -7
  79. package/examples/js/postprocessing/GlitchPass.js +6 -5
  80. package/examples/js/postprocessing/SMAAPass.js +2 -9
  81. package/examples/js/postprocessing/SSAOPass.js +10 -21
  82. package/examples/js/postprocessing/SavePass.js +1 -5
  83. package/examples/js/renderers/CSS2DRenderer.js +4 -4
  84. package/examples/js/renderers/CSS3DRenderer.js +4 -4
  85. package/examples/js/shaders/ConvolutionShader.js +0 -1
  86. package/examples/js/shaders/DigitalGlitch.js +3 -3
  87. package/examples/js/shaders/FXAAShader.js +1 -1
  88. package/examples/js/shaders/FilmShader.js +1 -1
  89. package/examples/js/shaders/GammaCorrectionShader.js +1 -1
  90. package/examples/js/shaders/HorizontalBlurShader.js +1 -2
  91. package/examples/js/shaders/MMDToonShader.js +0 -1
  92. package/examples/js/shaders/SSAOShader.js +1 -1
  93. package/examples/js/shaders/SSRShader.js +1 -1
  94. package/examples/js/shaders/SSRrShader.js +1 -1
  95. package/examples/js/shaders/VerticalBlurShader.js +1 -2
  96. package/examples/js/utils/GeometryUtils.js +1 -1
  97. package/examples/jsm/animation/CCDIKSolver.js +0 -1
  98. package/examples/jsm/animation/MMDPhysics.js +1 -3
  99. package/examples/jsm/cameras/CinematicCamera.js +2 -5
  100. package/examples/jsm/{WebGL.js → capabilities/WebGL.js} +2 -2
  101. package/examples/jsm/{renderers/webgpu → capabilities}/WebGPU.js +1 -1
  102. package/examples/jsm/controls/ArcballControls.js +80 -77
  103. package/examples/jsm/controls/DragControls.js +7 -0
  104. package/examples/jsm/controls/OrbitControls.js +9 -51
  105. package/examples/jsm/controls/TrackballControls.js +1 -1
  106. package/examples/jsm/controls/TransformControls.js +24 -1
  107. package/examples/jsm/csm/CSM.js +3 -3
  108. package/examples/jsm/csm/{Frustum.js → CSMFrustum.js} +3 -3
  109. package/examples/jsm/curves/CurveExtras.js +0 -2
  110. package/examples/jsm/effects/AsciiEffect.js +2 -9
  111. package/examples/jsm/exporters/GLTFExporter.js +169 -99
  112. package/examples/jsm/exporters/MMDExporter.js +1 -1
  113. package/examples/jsm/exporters/USDZExporter.js +47 -26
  114. package/examples/jsm/geometries/ConvexGeometry.js +1 -1
  115. package/examples/jsm/geometries/TeapotGeometry.js +0 -1
  116. package/examples/jsm/interactive/SelectionBox.js +1 -0
  117. package/examples/jsm/interactive/SelectionHelper.js +19 -7
  118. package/examples/jsm/libs/flow.module.js +3338 -0
  119. package/examples/jsm/libs/lil-gui.module.min.js +8 -0
  120. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  121. package/examples/jsm/lights/RectAreaLightUniformsLib.js +7 -0
  122. package/examples/jsm/lines/LineMaterial.js +59 -23
  123. package/examples/jsm/lines/LineSegments2.js +22 -18
  124. package/examples/jsm/loaders/3DMLoader.js +18 -12
  125. package/examples/jsm/loaders/3MFLoader.js +2 -2
  126. package/examples/jsm/loaders/AMFLoader.js +0 -2
  127. package/examples/jsm/loaders/BasisTextureLoader.js +7 -0
  128. package/examples/jsm/loaders/ColladaLoader.js +61 -4
  129. package/examples/jsm/loaders/EXRLoader.js +200 -306
  130. package/examples/jsm/loaders/FBXLoader.js +4 -5
  131. package/examples/jsm/loaders/GLTFLoader.js +102 -40
  132. package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -17
  133. package/examples/jsm/loaders/KTX2Loader.js +30 -2
  134. package/examples/jsm/loaders/KTXLoader.js +1 -1
  135. package/examples/jsm/loaders/LDrawLoader.js +1159 -898
  136. package/examples/jsm/loaders/LUT3dlLoader.js +19 -12
  137. package/examples/jsm/loaders/LUTCubeLoader.js +5 -5
  138. package/examples/jsm/loaders/LWOLoader.js +8 -6
  139. package/examples/jsm/loaders/LogLuvLoader.js +606 -0
  140. package/examples/jsm/loaders/MMDLoader.js +0 -1
  141. package/examples/jsm/loaders/NRRDLoader.js +10 -2
  142. package/examples/jsm/loaders/OBJLoader.js +0 -2
  143. package/examples/jsm/loaders/PLYLoader.js +34 -8
  144. package/examples/jsm/loaders/RGBELoader.js +7 -28
  145. package/examples/jsm/loaders/RGBMLoader.js +62 -8
  146. package/examples/jsm/loaders/SVGLoader.js +15 -7
  147. package/examples/jsm/loaders/TDSLoader.js +236 -275
  148. package/examples/jsm/loaders/VOXLoader.js +1 -0
  149. package/examples/jsm/loaders/VRMLLoader.js +11 -23
  150. package/examples/jsm/loaders/lwo/LWO2Parser.js +1 -0
  151. package/examples/jsm/loaders/lwo/LWO3Parser.js +2 -2
  152. package/examples/jsm/math/ConvexHull.js +7 -13
  153. package/examples/jsm/math/ImprovedNoise.js +1 -1
  154. package/examples/jsm/misc/GPUComputationRenderer.js +3 -1
  155. package/examples/jsm/misc/Volume.js +2 -2
  156. package/examples/jsm/modifiers/CurveModifier.js +9 -8
  157. package/examples/jsm/modifiers/EdgeSplitModifier.js +1 -1
  158. package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
  159. package/examples/jsm/node-editor/NodeEditor.js +455 -0
  160. package/examples/jsm/node-editor/accessors/NormalEditor.js +30 -0
  161. package/examples/jsm/node-editor/accessors/PositionEditor.js +30 -0
  162. package/examples/jsm/node-editor/accessors/UVEditor.js +26 -0
  163. package/examples/jsm/node-editor/display/BlendEditor.js +43 -0
  164. package/examples/jsm/node-editor/examples/animate-uv.json +1 -0
  165. package/examples/jsm/node-editor/examples/fake-top-light.json +1 -0
  166. package/examples/jsm/node-editor/examples/oscillator-color.json +1 -0
  167. package/examples/jsm/node-editor/examples/rim.json +1 -0
  168. package/examples/jsm/node-editor/inputs/ColorEditor.js +91 -0
  169. package/examples/jsm/node-editor/inputs/FloatEditor.js +24 -0
  170. package/examples/jsm/node-editor/inputs/SliderEditor.js +68 -0
  171. package/examples/jsm/node-editor/inputs/Vector2Editor.js +28 -0
  172. package/examples/jsm/node-editor/inputs/Vector3Editor.js +30 -0
  173. package/examples/jsm/node-editor/inputs/Vector4Editor.js +37 -0
  174. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +108 -0
  175. package/examples/jsm/node-editor/math/DotEditor.js +36 -0
  176. package/examples/jsm/node-editor/math/InvertEditor.js +38 -0
  177. package/examples/jsm/node-editor/math/LimiterEditor.js +48 -0
  178. package/examples/jsm/node-editor/math/NormalizeEditor.js +26 -0
  179. package/examples/jsm/node-editor/math/OperatorEditor.js +50 -0
  180. package/examples/jsm/node-editor/math/PowerEditor.js +34 -0
  181. package/examples/jsm/node-editor/math/TrigonometryEditor.js +39 -0
  182. package/examples/jsm/node-editor/procedural/CheckerEditor.js +26 -0
  183. package/examples/jsm/node-editor/utils/OscillatorEditor.js +42 -0
  184. package/examples/jsm/node-editor/utils/TimerEditor.js +57 -0
  185. package/examples/jsm/nodes/core/NodeBuilder.js +2 -2
  186. package/examples/jsm/nodes/materials/StandardNodeMaterial.js +1 -1
  187. package/examples/jsm/nodes/materials/nodes/StandardNode.js +7 -6
  188. package/examples/jsm/nodes/math/MathNode.js +12 -0
  189. package/examples/jsm/nodes/misc/BumpMapNode.js +1 -1
  190. package/examples/jsm/nodes/misc/TextureCubeUVNode.js +1 -4
  191. package/examples/jsm/nodes/utils/ColorSpaceNode.js +5 -177
  192. package/examples/jsm/objects/Lensflare.js +5 -16
  193. package/examples/jsm/objects/MarchingCubes.js +46 -152
  194. package/examples/jsm/objects/Reflector.js +8 -16
  195. package/examples/jsm/objects/ReflectorForSSRPass.js +0 -12
  196. package/examples/jsm/objects/Refractor.js +8 -16
  197. package/examples/jsm/objects/Sky.js +1 -1
  198. package/examples/jsm/objects/Water.js +3 -18
  199. package/examples/jsm/objects/Water2.js +4 -8
  200. package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +1 -1
  201. package/examples/jsm/postprocessing/AfterimagePass.js +1 -1
  202. package/examples/jsm/postprocessing/BloomPass.js +1 -1
  203. package/examples/jsm/postprocessing/BokehPass.js +1 -1
  204. package/examples/jsm/postprocessing/ClearPass.js +1 -1
  205. package/examples/jsm/postprocessing/CubeTexturePass.js +1 -1
  206. package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
  207. package/examples/jsm/postprocessing/EffectComposer.js +3 -3
  208. package/examples/jsm/postprocessing/FilmPass.js +1 -1
  209. package/examples/jsm/postprocessing/GlitchPass.js +10 -7
  210. package/examples/jsm/postprocessing/HalftonePass.js +1 -1
  211. package/examples/jsm/postprocessing/MaskPass.js +1 -1
  212. package/examples/jsm/postprocessing/OutlinePass.js +1 -1
  213. package/examples/jsm/postprocessing/RenderPass.js +1 -1
  214. package/examples/jsm/postprocessing/SAOPass.js +2 -2
  215. package/examples/jsm/postprocessing/SMAAPass.js +3 -12
  216. package/examples/jsm/postprocessing/SSAARenderPass.js +1 -1
  217. package/examples/jsm/postprocessing/SSAOPass.js +15 -26
  218. package/examples/jsm/postprocessing/SSRPass.js +1 -1
  219. package/examples/jsm/postprocessing/SSRrPass.js +1 -1
  220. package/examples/jsm/postprocessing/SavePass.js +2 -4
  221. package/examples/jsm/postprocessing/ShaderPass.js +1 -1
  222. package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
  223. package/examples/jsm/postprocessing/TexturePass.js +1 -1
  224. package/examples/jsm/postprocessing/UnrealBloomPass.js +1 -1
  225. package/examples/jsm/renderers/CSS2DRenderer.js +5 -4
  226. package/examples/jsm/renderers/CSS3DRenderer.js +5 -4
  227. package/examples/jsm/renderers/nodes/Nodes.js +17 -13
  228. package/examples/jsm/renderers/nodes/ShaderNode.js +229 -49
  229. package/examples/jsm/renderers/nodes/accessors/MaterialNode.js +6 -6
  230. package/examples/jsm/renderers/nodes/accessors/ModelViewProjectionNode.js +5 -5
  231. package/examples/jsm/renderers/nodes/accessors/NormalNode.js +14 -3
  232. package/examples/jsm/renderers/nodes/accessors/PointUVNode.js +3 -3
  233. package/examples/jsm/renderers/nodes/accessors/PositionNode.js +15 -5
  234. package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +107 -0
  235. package/examples/jsm/renderers/nodes/accessors/UVNode.js +7 -5
  236. package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +3 -3
  237. package/examples/jsm/renderers/nodes/core/AttributeNode.js +6 -0
  238. package/examples/jsm/renderers/nodes/core/BypassNode.js +38 -0
  239. package/examples/jsm/renderers/nodes/core/CodeNode.js +3 -3
  240. package/examples/jsm/renderers/nodes/core/ContextNode.js +4 -19
  241. package/examples/jsm/renderers/nodes/core/ExpressionNode.js +13 -2
  242. package/examples/jsm/renderers/nodes/core/FunctionNode.js +19 -132
  243. package/examples/jsm/renderers/nodes/core/InputNode.js +13 -3
  244. package/examples/jsm/renderers/nodes/core/Node.js +32 -10
  245. package/examples/jsm/renderers/nodes/core/NodeBuilder.js +146 -128
  246. package/examples/jsm/renderers/nodes/core/NodeFunction.js +22 -0
  247. package/examples/jsm/renderers/nodes/core/NodeFunctionInput.js +4 -4
  248. package/examples/jsm/renderers/nodes/core/NodeKeywords.js +18 -179
  249. package/examples/jsm/renderers/nodes/core/NodeParser.js +11 -0
  250. package/examples/jsm/renderers/nodes/core/NodeVar.js +2 -2
  251. package/examples/jsm/renderers/nodes/core/PropertyNode.js +14 -2
  252. package/examples/jsm/renderers/nodes/core/TempNode.js +10 -13
  253. package/examples/jsm/renderers/nodes/core/VarNode.js +12 -7
  254. package/examples/jsm/renderers/nodes/core/VaryNode.js +23 -8
  255. package/examples/jsm/renderers/nodes/core/constants.js +2 -0
  256. package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +43 -63
  257. package/examples/jsm/renderers/nodes/display/NormalMapNode.js +21 -22
  258. package/examples/jsm/renderers/nodes/functions/BSDFs.js +64 -101
  259. package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +27 -0
  260. package/examples/jsm/renderers/nodes/inputs/BufferNode.js +25 -0
  261. package/examples/jsm/renderers/nodes/inputs/IntNode.js +17 -0
  262. package/examples/jsm/renderers/nodes/inputs/TextureNode.js +13 -10
  263. package/examples/jsm/renderers/nodes/lights/LightContextNode.js +20 -14
  264. package/examples/jsm/renderers/nodes/lights/LightNode.js +32 -36
  265. package/examples/jsm/renderers/nodes/math/CondNode.js +60 -0
  266. package/examples/jsm/renderers/nodes/math/MathNode.js +91 -37
  267. package/examples/jsm/renderers/nodes/math/OperatorNode.js +124 -31
  268. package/examples/jsm/renderers/nodes/parsers/GLSLNodeFunction.js +137 -0
  269. package/examples/jsm/renderers/nodes/parsers/GLSLNodeParser.js +14 -0
  270. package/examples/jsm/renderers/nodes/parsers/WGSLNodeFunction.js +89 -0
  271. package/examples/jsm/renderers/nodes/parsers/WGSLNodeParser.js +14 -0
  272. package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +7 -9
  273. package/examples/jsm/renderers/nodes/utils/ArrayElementNode.js +31 -0
  274. package/examples/jsm/renderers/nodes/utils/ConvertNode.js +33 -0
  275. package/examples/jsm/renderers/nodes/utils/JoinNode.js +7 -7
  276. package/examples/jsm/renderers/nodes/utils/OscNode.js +58 -0
  277. package/examples/jsm/renderers/nodes/utils/SplitNode.js +18 -8
  278. package/examples/jsm/renderers/nodes/utils/SpriteSheetUVNode.js +7 -7
  279. package/examples/jsm/renderers/nodes/utils/TimerNode.js +1 -1
  280. package/examples/jsm/renderers/webgl/nodes/SlotNode.js +22 -0
  281. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +192 -95
  282. package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +2 -2
  283. package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +2 -2
  284. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +1 -1
  285. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +10 -9
  286. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +2 -4
  287. package/examples/jsm/renderers/webgpu/WebGPUObjects.js +1 -1
  288. package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +2 -4
  289. package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +15 -23
  290. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +44 -65
  291. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +13 -31
  292. package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +61 -28
  293. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +35 -29
  294. package/examples/jsm/renderers/webgpu/constants.js +2 -2
  295. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +459 -95
  296. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
  297. package/examples/jsm/shaders/ConvolutionShader.js +0 -1
  298. package/examples/jsm/shaders/DigitalGlitch.js +3 -3
  299. package/examples/jsm/shaders/FXAAShader.js +1 -1
  300. package/examples/jsm/shaders/FilmShader.js +1 -1
  301. package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
  302. package/examples/jsm/shaders/HorizontalBlurShader.js +1 -2
  303. package/examples/jsm/shaders/MMDToonShader.js +0 -1
  304. package/examples/jsm/shaders/SSAOShader.js +1 -1
  305. package/examples/jsm/shaders/SSRShader.js +1 -1
  306. package/examples/jsm/shaders/SSRrShader.js +1 -1
  307. package/examples/jsm/shaders/VerticalBlurShader.js +1 -2
  308. package/examples/jsm/utils/GeometryUtils.js +1 -1
  309. package/examples/jsm/utils/LDrawUtils.js +195 -0
  310. package/examples/jsm/utils/WorkerPool.js +11 -11
  311. package/examples/jsm/webxr/OculusHandPointerModel.js +6 -6
  312. package/examples/jsm/webxr/VRButton.js +24 -0
  313. package/examples/jsm/webxr/XREstimatedLight.js +2 -0
  314. package/package.json +27 -18
  315. package/src/Three.Legacy.js +18 -0
  316. package/src/Three.js +1 -3
  317. package/src/animation/AnimationMixer.js +1 -0
  318. package/src/cameras/CubeCamera.js +2 -0
  319. package/src/cameras/StereoCamera.js +8 -7
  320. package/src/constants.js +3 -23
  321. package/src/core/Layers.js +7 -1
  322. package/src/core/Object3D.js +3 -1
  323. package/src/extras/ImageUtils.js +63 -0
  324. package/src/extras/PMREMGenerator.js +49 -185
  325. package/src/extras/core/Interpolations.js +1 -1
  326. package/src/geometries/LatheGeometry.js +70 -47
  327. package/src/helpers/CameraHelper.js +1 -1
  328. package/src/loaders/FileLoader.js +98 -144
  329. package/src/loaders/ImageLoader.js +9 -4
  330. package/src/loaders/LoaderUtils.js +26 -0
  331. package/src/loaders/MaterialLoader.js +8 -5
  332. package/src/loaders/ObjectLoader.js +2 -0
  333. package/src/materials/Material.js +8 -8
  334. package/src/materials/MeshPhysicalMaterial.js +20 -14
  335. package/src/math/Color.js +1 -39
  336. package/src/math/MathUtils.js +5 -16
  337. package/src/math/Quaternion.js +1 -1
  338. package/src/math/Ray.js +2 -2
  339. package/src/math/Sphere.js +10 -1
  340. package/src/objects/Skeleton.js +1 -0
  341. package/src/renderers/WebGLCubeRenderTarget.js +0 -2
  342. package/src/renderers/WebGLMultisampleRenderTarget.js +7 -1
  343. package/src/renderers/WebGLRenderer.js +106 -199
  344. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +2 -2
  345. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +1 -1
  346. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +2 -24
  347. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +0 -2
  348. package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -78
  349. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
  350. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +0 -2
  351. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +1 -1
  352. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +1 -1
  353. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +1 -1
  354. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +19 -6
  355. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +28 -2
  356. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +10 -3
  357. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +1 -2
  358. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
  359. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  360. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +9 -8
  361. package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -3
  362. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -3
  363. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -1
  364. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -2
  365. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +23 -5
  366. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +2 -1
  367. package/src/renderers/shaders/ShaderLib.js +8 -6
  368. package/src/renderers/shaders/UniformsLib.js +1 -2
  369. package/src/renderers/webgl/WebGLCapabilities.js +0 -2
  370. package/src/renderers/webgl/WebGLCubeMaps.js +0 -4
  371. package/src/renderers/webgl/WebGLCubeUVMaps.js +29 -16
  372. package/src/renderers/webgl/WebGLExtensions.js +1 -0
  373. package/src/renderers/webgl/WebGLMaterials.js +27 -15
  374. package/src/renderers/webgl/WebGLMorphtargets.js +13 -0
  375. package/src/renderers/webgl/WebGLProgram.js +12 -37
  376. package/src/renderers/webgl/WebGLPrograms.js +192 -70
  377. package/src/renderers/webgl/WebGLRenderLists.js +4 -14
  378. package/src/renderers/webgl/WebGLShaderCache.js +120 -0
  379. package/src/renderers/webgl/WebGLShadowMap.js +14 -5
  380. package/src/renderers/webgl/WebGLState.js +157 -17
  381. package/src/renderers/webgl/WebGLTextures.js +442 -83
  382. package/src/renderers/webgl/WebGLUniforms.js +45 -1
  383. package/src/renderers/webgl/WebGLUtils.js +86 -28
  384. package/src/renderers/webxr/WebXRManager.js +77 -109
  385. package/src/scenes/Scene.js +1 -1
  386. package/src/textures/DataTexture.js +0 -2
  387. package/src/textures/DataTexture2DArray.js +0 -2
  388. package/src/textures/DataTexture3D.js +0 -2
  389. package/src/textures/FramebufferTexture.js +25 -0
  390. package/src/textures/Texture.js +8 -1
  391. package/src/textures/VideoTexture.js +1 -3
  392. package/examples/js/WebGL.js +0 -90
  393. package/examples/js/controls/DeviceOrientationControls.js +0 -147
  394. package/examples/js/libs/dat.gui.min.js +0 -14
  395. package/examples/js/utils/RoughnessMipmapper.js +0 -278
  396. package/examples/jsm/controls/DeviceOrientationControls.js +0 -153
  397. package/examples/jsm/libs/dat.gui.module.js +0 -3575
  398. package/examples/jsm/libs/glslang.js +0 -78
  399. package/examples/jsm/libs/glslang.wasm +0 -0
  400. package/examples/jsm/renderers/nodes/consts/MathConsts.js +0 -7
  401. package/examples/jsm/renderers/nodes/core/ConstNode.js +0 -39
  402. package/examples/jsm/renderers/nodes/core/NodeSlot.js +0 -13
  403. package/examples/jsm/renderers/nodes/core/StructNode.js +0 -80
  404. package/examples/jsm/renderers/nodes/core/StructVarNode.js +0 -75
  405. package/examples/jsm/renderers/nodes/functions/EncodingFunctions.js +0 -99
  406. package/examples/jsm/renderers/nodes/functions/MathFunctions.js +0 -47
  407. package/examples/jsm/renderers/webgpu/nodes/ShaderLib.js +0 -152
  408. package/examples/jsm/utils/RoughnessMipmapper.js +0 -300
  409. package/src/extras/objects/ImmediateRenderObject.js +0 -31
@@ -0,0 +1,766 @@
1
+ ( function () {
2
+
3
+ class LogLuvLoader extends THREE.DataTextureLoader {
4
+
5
+ constructor( manager ) {
6
+
7
+ super( manager );
8
+ this.type = THREE.HalfFloatType;
9
+
10
+ }
11
+
12
+ parse( buffer ) {
13
+
14
+ const ifds = UTIF.decode( buffer );
15
+ UTIF.decodeImage( buffer, ifds[ 0 ] );
16
+ const rgba = UTIF.toRGBA( ifds[ 0 ], this.type );
17
+ return {
18
+ width: ifds[ 0 ].width,
19
+ height: ifds[ 0 ].height,
20
+ data: rgba,
21
+ format: THREE.RGBAFormat,
22
+ type: this.type,
23
+ flipY: true
24
+ };
25
+
26
+ }
27
+
28
+ setDataType( value ) {
29
+
30
+ this.type = value;
31
+ return this;
32
+
33
+ }
34
+
35
+ } // from https://github.com/photopea/UTIF.js (MIT License)
36
+
37
+
38
+ const UTIF = {};
39
+
40
+ UTIF.decode = function ( buff, prm ) {
41
+
42
+ if ( prm == null ) prm = {
43
+ parseMN: true,
44
+ debug: false
45
+ }; // read MakerNote, debug
46
+
47
+ var data = new Uint8Array( buff ),
48
+ offset = 0;
49
+
50
+ var id = UTIF._binBE.readASCII( data, offset, 2 );
51
+
52
+ offset += 2;
53
+ var bin = id == 'II' ? UTIF._binLE : UTIF._binBE;
54
+ bin.readUshort( data, offset );
55
+ offset += 2;
56
+ var ifdo = bin.readUint( data, offset );
57
+ offset += 4;
58
+ var ifds = [];
59
+
60
+ while ( true ) {
61
+
62
+ var cnt = bin.readUshort( data, ifdo ),
63
+ typ = bin.readUshort( data, ifdo + 4 );
64
+ if ( cnt != 0 ) if ( typ < 1 || 13 < typ ) {
65
+
66
+ console.log( 'error in TIFF' );
67
+ break;
68
+
69
+ }
70
+
71
+ UTIF._readIFD( bin, data, ifdo, ifds, 0, prm );
72
+
73
+ ifdo = bin.readUint( data, ifdo + 2 + cnt * 12 );
74
+ if ( ifdo == 0 ) break;
75
+
76
+ }
77
+
78
+ return ifds;
79
+
80
+ };
81
+
82
+ UTIF.decodeImage = function ( buff, img, ifds ) {
83
+
84
+ if ( img.data ) return;
85
+ var data = new Uint8Array( buff );
86
+
87
+ var id = UTIF._binBE.readASCII( data, 0, 2 );
88
+
89
+ if ( img[ 't256' ] == null ) return; // No width => probably not an image
90
+
91
+ img.isLE = id == 'II';
92
+ img.width = img[ 't256' ][ 0 ]; //delete img["t256"];
93
+
94
+ img.height = img[ 't257' ][ 0 ]; //delete img["t257"];
95
+
96
+ var cmpr = img[ 't259' ] ? img[ 't259' ][ 0 ] : 1; //delete img["t259"];
97
+
98
+ var fo = img[ 't266' ] ? img[ 't266' ][ 0 ] : 1; //delete img["t266"];
99
+
100
+ if ( img[ 't284' ] && img[ 't284' ][ 0 ] == 2 ) console.log( 'PlanarConfiguration 2 should not be used!' );
101
+ if ( cmpr == 7 && img[ 't258' ] && img[ 't258' ].length > 3 ) img[ 't258' ] = img[ 't258' ].slice( 0, 3 );
102
+ var bipp; // bits per pixel
103
+
104
+ if ( img[ 't258' ] ) bipp = Math.min( 32, img[ 't258' ][ 0 ] ) * img[ 't258' ].length; else bipp = img[ 't277' ] ? img[ 't277' ][ 0 ] : 1; // Some .NEF files have t258==14, even though they use 16 bits per pixel
105
+
106
+ if ( cmpr == 1 && img[ 't279' ] != null && img[ 't278' ] && img[ 't262' ][ 0 ] == 32803 ) {
107
+
108
+ bipp = Math.round( img[ 't279' ][ 0 ] * 8 / ( img.width * img[ 't278' ][ 0 ] ) );
109
+
110
+ }
111
+
112
+ var bipl = Math.ceil( img.width * bipp / 8 ) * 8;
113
+ var soff = img[ 't273' ];
114
+ if ( soff == null ) soff = img[ 't324' ];
115
+ var bcnt = img[ 't279' ];
116
+ if ( cmpr == 1 && soff.length == 1 ) bcnt = [ img.height * ( bipl >>> 3 ) ];
117
+ if ( bcnt == null ) bcnt = img[ 't325' ]; //bcnt[0] = Math.min(bcnt[0], data.length); // Hasselblad, "RAW_HASSELBLAD_H3D39II.3FR"
118
+
119
+ var bytes = new Uint8Array( img.height * ( bipl >>> 3 ) ),
120
+ bilen = 0;
121
+
122
+ if ( img[ 't322' ] != null ) {
123
+
124
+ var tw = img[ 't322' ][ 0 ],
125
+ th = img[ 't323' ][ 0 ];
126
+ var tx = Math.floor( ( img.width + tw - 1 ) / tw );
127
+ var ty = Math.floor( ( img.height + th - 1 ) / th );
128
+ var tbuff = new Uint8Array( Math.ceil( tw * th * bipp / 8 ) | 0 );
129
+
130
+ for ( var y = 0; y < ty; y ++ ) for ( var x = 0; x < tx; x ++ ) {
131
+
132
+ var i = y * tx + x;
133
+
134
+ for ( var j = 0; j < tbuff.length; j ++ ) tbuff[ j ] = 0;
135
+
136
+ UTIF.decode._decompress( img, ifds, data, soff[ i ], bcnt[ i ], cmpr, tbuff, 0, fo ); // Might be required for 7 too. Need to check
137
+
138
+
139
+ if ( cmpr == 6 ) bytes = tbuff; else UTIF._copyTile( tbuff, Math.ceil( tw * bipp / 8 ) | 0, th, bytes, Math.ceil( img.width * bipp / 8 ) | 0, img.height, Math.ceil( x * tw * bipp / 8 ) | 0, y * th );
140
+
141
+ }
142
+
143
+ bilen = bytes.length * 8;
144
+
145
+ } else {
146
+
147
+ var rps = img[ 't278' ] ? img[ 't278' ][ 0 ] : img.height;
148
+ rps = Math.min( rps, img.height );
149
+
150
+ for ( var i = 0; i < soff.length; i ++ ) {
151
+
152
+ UTIF.decode._decompress( img, ifds, data, soff[ i ], bcnt[ i ], cmpr, bytes, Math.ceil( bilen / 8 ) | 0, fo );
153
+
154
+ bilen += bipl * rps;
155
+
156
+ }
157
+
158
+ bilen = Math.min( bilen, bytes.length * 8 );
159
+
160
+ }
161
+
162
+ img.data = new Uint8Array( bytes.buffer, 0, Math.ceil( bilen / 8 ) | 0 );
163
+
164
+ };
165
+
166
+ UTIF.decode._decompress = function ( img, ifds, data, off, len, cmpr, tgt, toff ) {
167
+
168
+ //console.log("compression", cmpr);
169
+ //var time = Date.now();
170
+ if ( cmpr == 34676 ) UTIF.decode._decodeLogLuv32( img, data, off, len, tgt, toff ); else console.log( 'Unsupported compression', cmpr ); //console.log(Date.now()-time);
171
+
172
+ var bps = img[ 't258' ] ? Math.min( 32, img[ 't258' ][ 0 ] ) : 1;
173
+ var noc = img[ 't277' ] ? img[ 't277' ][ 0 ] : 1,
174
+ bpp = bps * noc >>> 3,
175
+ h = img[ 't278' ] ? img[ 't278' ][ 0 ] : img.height,
176
+ bpl = Math.ceil( bps * noc * img.width / 8 ); // convert to Little Endian /*
177
+
178
+ if ( bps == 16 && ! img.isLE && img[ 't33422' ] == null ) // not DNG
179
+ for ( var y = 0; y < h; y ++ ) {
180
+
181
+ //console.log("fixing endianity");
182
+ var roff = toff + y * bpl;
183
+
184
+ for ( var x = 1; x < bpl; x += 2 ) {
185
+
186
+ var t = tgt[ roff + x ];
187
+ tgt[ roff + x ] = tgt[ roff + x - 1 ];
188
+ tgt[ roff + x - 1 ] = t;
189
+
190
+ }
191
+
192
+ } //*/
193
+
194
+ if ( img[ 't317' ] && img[ 't317' ][ 0 ] == 2 ) {
195
+
196
+ for ( var y = 0; y < h; y ++ ) {
197
+
198
+ var ntoff = toff + y * bpl;
199
+ if ( bps == 16 ) for ( var j = bpp; j < bpl; j += 2 ) {
200
+
201
+ var nv = ( tgt[ ntoff + j + 1 ] << 8 | tgt[ ntoff + j ] ) + ( tgt[ ntoff + j - bpp + 1 ] << 8 | tgt[ ntoff + j - bpp ] );
202
+ tgt[ ntoff + j ] = nv & 255;
203
+ tgt[ ntoff + j + 1 ] = nv >>> 8 & 255;
204
+
205
+ } else if ( noc == 3 ) for ( var j = 3; j < bpl; j += 3 ) {
206
+
207
+ tgt[ ntoff + j ] = tgt[ ntoff + j ] + tgt[ ntoff + j - 3 ] & 255;
208
+ tgt[ ntoff + j + 1 ] = tgt[ ntoff + j + 1 ] + tgt[ ntoff + j - 2 ] & 255;
209
+ tgt[ ntoff + j + 2 ] = tgt[ ntoff + j + 2 ] + tgt[ ntoff + j - 1 ] & 255;
210
+
211
+ } else for ( var j = bpp; j < bpl; j ++ ) tgt[ ntoff + j ] = tgt[ ntoff + j ] + tgt[ ntoff + j - bpp ] & 255;
212
+
213
+ }
214
+
215
+ }
216
+
217
+ };
218
+
219
+ UTIF.decode._decodeLogLuv32 = function ( img, data, off, len, tgt, toff ) {
220
+
221
+ var w = img.width,
222
+ qw = w * 4;
223
+ var io = 0,
224
+ out = new Uint8Array( qw );
225
+
226
+ while ( io < len ) {
227
+
228
+ var oo = 0;
229
+
230
+ while ( oo < qw ) {
231
+
232
+ var c = data[ off + io ];
233
+ io ++;
234
+
235
+ if ( c < 128 ) {
236
+
237
+ for ( var j = 0; j < c; j ++ ) out[ oo + j ] = data[ off + io + j ];
238
+
239
+ oo += c;
240
+ io += c;
241
+
242
+ } else {
243
+
244
+ c = c - 126;
245
+
246
+ for ( var j = 0; j < c; j ++ ) out[ oo + j ] = data[ off + io ];
247
+
248
+ oo += c;
249
+ io ++;
250
+
251
+ }
252
+
253
+ }
254
+
255
+ for ( var x = 0; x < w; x ++ ) {
256
+
257
+ tgt[ toff + 0 ] = out[ x ];
258
+ tgt[ toff + 1 ] = out[ x + w ];
259
+ tgt[ toff + 2 ] = out[ x + w * 2 ];
260
+ tgt[ toff + 4 ] = out[ x + w * 3 ];
261
+ toff += 6;
262
+
263
+ }
264
+
265
+ }
266
+
267
+ };
268
+
269
+ UTIF.tags = {}; //UTIF.ttypes = { 256:3,257:3,258:3, 259:3, 262:3, 273:4, 274:3, 277:3,278:4,279:4, 282:5, 283:5, 284:3, 286:5,287:5, 296:3, 305:2, 306:2, 338:3, 513:4, 514:4, 34665:4 };
270
+ // start at tag 250
271
+
272
+ UTIF._types = function () {
273
+
274
+ var main = new Array( 250 );
275
+ main.fill( 0 );
276
+ main = main.concat( [ 0, 0, 0, 0, 4, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 2, 2, 2, 2, 4, 3, 0, 0, 3, 4, 4, 3, 3, 5, 5, 3, 2, 5, 5, 0, 0, 0, 0, 4, 4, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 5, 5, 3, 0, 3, 3, 4, 4, 4, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] );
277
+ var rest = {
278
+ 33432: 2,
279
+ 33434: 5,
280
+ 33437: 5,
281
+ 34665: 4,
282
+ 34850: 3,
283
+ 34853: 4,
284
+ 34855: 3,
285
+ 34864: 3,
286
+ 34866: 4,
287
+ 36864: 7,
288
+ 36867: 2,
289
+ 36868: 2,
290
+ 37121: 7,
291
+ 37377: 10,
292
+ 37378: 5,
293
+ 37380: 10,
294
+ 37381: 5,
295
+ 37383: 3,
296
+ 37384: 3,
297
+ 37385: 3,
298
+ 37386: 5,
299
+ 37510: 7,
300
+ 37520: 2,
301
+ 37521: 2,
302
+ 37522: 2,
303
+ 40960: 7,
304
+ 40961: 3,
305
+ 40962: 4,
306
+ 40963: 4,
307
+ 40965: 4,
308
+ 41486: 5,
309
+ 41487: 5,
310
+ 41488: 3,
311
+ 41985: 3,
312
+ 41986: 3,
313
+ 41987: 3,
314
+ 41988: 5,
315
+ 41989: 3,
316
+ 41990: 3,
317
+ 41993: 3,
318
+ 41994: 3,
319
+ 41995: 7,
320
+ 41996: 3,
321
+ 42032: 2,
322
+ 42033: 2,
323
+ 42034: 5,
324
+ 42036: 2,
325
+ 42037: 2,
326
+ 59932: 7
327
+ };
328
+ return {
329
+ basic: {
330
+ main: main,
331
+ rest: rest
332
+ },
333
+ gps: {
334
+ main: [ 1, 2, 5, 2, 5, 1, 5, 5, 0, 9 ],
335
+ rest: {
336
+ 18: 2,
337
+ 29: 2
338
+ }
339
+ }
340
+ };
341
+
342
+ }();
343
+
344
+ UTIF._readIFD = function ( bin, data, offset, ifds, depth, prm ) {
345
+
346
+ var cnt = bin.readUshort( data, offset );
347
+ offset += 2;
348
+ var ifd = {};
349
+ if ( prm.debug ) console.log( ' '.repeat( depth ), ifds.length - 1, '>>>----------------' );
350
+
351
+ for ( var i = 0; i < cnt; i ++ ) {
352
+
353
+ var tag = bin.readUshort( data, offset );
354
+ offset += 2;
355
+ var type = bin.readUshort( data, offset );
356
+ offset += 2;
357
+ var num = bin.readUint( data, offset );
358
+ offset += 4;
359
+ var voff = bin.readUint( data, offset );
360
+ offset += 4;
361
+ var arr = []; //ifd["t"+tag+"-"+UTIF.tags[tag]] = arr;
362
+
363
+ if ( type == 1 || type == 7 ) {
364
+
365
+ arr = new Uint8Array( data.buffer, num < 5 ? offset - 4 : voff, num );
366
+
367
+ }
368
+
369
+ if ( type == 2 ) {
370
+
371
+ var o0 = num < 5 ? offset - 4 : voff,
372
+ c = data[ o0 ],
373
+ len = Math.max( 0, Math.min( num - 1, data.length - o0 ) );
374
+ if ( c < 128 || len == 0 ) arr.push( bin.readASCII( data, o0, len ) ); else arr = new Uint8Array( data.buffer, o0, len );
375
+
376
+ }
377
+
378
+ if ( type == 3 ) {
379
+
380
+ for ( var j = 0; j < num; j ++ ) arr.push( bin.readUshort( data, ( num < 3 ? offset - 4 : voff ) + 2 * j ) );
381
+
382
+ }
383
+
384
+ if ( type == 4 || type == 13 ) {
385
+
386
+ for ( var j = 0; j < num; j ++ ) arr.push( bin.readUint( data, ( num < 2 ? offset - 4 : voff ) + 4 * j ) );
387
+
388
+ }
389
+
390
+ if ( type == 5 || type == 10 ) {
391
+
392
+ var ri = type == 5 ? bin.readUint : bin.readInt;
393
+
394
+ for ( var j = 0; j < num; j ++ ) arr.push( [ ri( data, voff + j * 8 ), ri( data, voff + j * 8 + 4 ) ] );
395
+
396
+ }
397
+
398
+ if ( type == 8 ) {
399
+
400
+ for ( var j = 0; j < num; j ++ ) arr.push( bin.readShort( data, ( num < 3 ? offset - 4 : voff ) + 2 * j ) );
401
+
402
+ }
403
+
404
+ if ( type == 9 ) {
405
+
406
+ for ( var j = 0; j < num; j ++ ) arr.push( bin.readInt( data, ( num < 2 ? offset - 4 : voff ) + 4 * j ) );
407
+
408
+ }
409
+
410
+ if ( type == 11 ) {
411
+
412
+ for ( var j = 0; j < num; j ++ ) arr.push( bin.readFloat( data, voff + j * 4 ) );
413
+
414
+ }
415
+
416
+ if ( type == 12 ) {
417
+
418
+ for ( var j = 0; j < num; j ++ ) arr.push( bin.readDouble( data, voff + j * 8 ) );
419
+
420
+ }
421
+
422
+ if ( num != 0 && arr.length == 0 ) {
423
+
424
+ console.log( tag, 'unknown TIFF tag type: ', type, 'num:', num );
425
+ if ( i == 0 ) return;
426
+ continue;
427
+
428
+ }
429
+
430
+ if ( prm.debug ) console.log( ' '.repeat( depth ), tag, type, UTIF.tags[ tag ], arr );
431
+ ifd[ 't' + tag ] = arr;
432
+
433
+ if ( tag == 330 && ifd[ 't272' ] && ifd[ 't272' ][ 0 ] == 'DSLR-A100' ) {} else if ( tag == 330 || tag == 34665 || tag == 34853 || tag == 50740 && bin.readUshort( data, bin.readUint( arr, 0 ) ) < 300 || tag == 61440 ) {
434
+
435
+ var oarr = tag == 50740 ? [ bin.readUint( arr, 0 ) ] : arr;
436
+ var subfd = [];
437
+
438
+ for ( var j = 0; j < oarr.length; j ++ ) UTIF._readIFD( bin, data, oarr[ j ], subfd, depth + 1, prm );
439
+
440
+ if ( tag == 330 ) ifd.subIFD = subfd;
441
+ if ( tag == 34665 ) ifd.exifIFD = subfd[ 0 ];
442
+ if ( tag == 34853 ) ifd.gpsiIFD = subfd[ 0 ]; //console.log("gps", subfd[0]); }
443
+
444
+ if ( tag == 50740 ) ifd.dngPrvt = subfd[ 0 ];
445
+ if ( tag == 61440 ) ifd.fujiIFD = subfd[ 0 ];
446
+
447
+ }
448
+
449
+ if ( tag == 37500 && prm.parseMN ) {
450
+
451
+ var mn = arr; //console.log(bin.readASCII(mn,0,mn.length), mn);
452
+
453
+ if ( bin.readASCII( mn, 0, 5 ) == 'Nikon' ) ifd.makerNote = UTIF[ 'decode' ]( mn.slice( 10 ).buffer )[ 0 ]; else if ( bin.readUshort( data, voff ) < 300 && bin.readUshort( data, voff + 4 ) <= 12 ) {
454
+
455
+ var subsub = [];
456
+
457
+ UTIF._readIFD( bin, data, voff, subsub, depth + 1, prm );
458
+
459
+ ifd.makerNote = subsub[ 0 ];
460
+
461
+ }
462
+
463
+ }
464
+
465
+ }
466
+
467
+ ifds.push( ifd );
468
+ if ( prm.debug ) console.log( ' '.repeat( depth ), '<<<---------------' );
469
+ return offset;
470
+
471
+ };
472
+
473
+ UTIF.toRGBA = function ( out, type ) {
474
+
475
+ const w = out.width,
476
+ h = out.height,
477
+ area = w * h,
478
+ data = out.data;
479
+ let img;
480
+
481
+ switch ( type ) {
482
+
483
+ case THREE.HalfFloatType:
484
+ img = new Uint16Array( area * 4 );
485
+ break;
486
+
487
+ case THREE.FloatType:
488
+ img = new Float32Array( area * 4 );
489
+ break;
490
+
491
+ default:
492
+ console.error( 'THREE.LogLuvLoader: Unsupported texture data type:', type );
493
+
494
+ }
495
+
496
+ let intp = out[ 't262' ] ? out[ 't262' ][ 0 ] : 2;
497
+ const bps = out[ 't258' ] ? Math.min( 32, out[ 't258' ][ 0 ] ) : 1;
498
+ if ( out[ 't262' ] == null && bps == 1 ) intp = 0;
499
+
500
+ if ( intp == 32845 ) {
501
+
502
+ for ( let y = 0; y < h; y ++ ) {
503
+
504
+ for ( let x = 0; x < w; x ++ ) {
505
+
506
+ const si = ( y * w + x ) * 6,
507
+ qi = ( y * w + x ) * 4;
508
+ let L = data[ si + 1 ] << 8 | data[ si ];
509
+ L = Math.pow( 2, ( L + 0.5 ) / 256 - 64 );
510
+ const u = ( data[ si + 3 ] + 0.5 ) / 410;
511
+ const v = ( data[ si + 5 ] + 0.5 ) / 410; // Luv to xyY
512
+
513
+ const sX = 9 * u / ( 6 * u - 16 * v + 12 );
514
+ const sY = 4 * v / ( 6 * u - 16 * v + 12 );
515
+ const bY = L; // xyY to XYZ
516
+
517
+ const X = sX * bY / sY,
518
+ Y = bY,
519
+ Z = ( 1 - sX - sY ) * bY / sY; // XYZ to linear RGB
520
+
521
+ const r = 2.690 * X - 1.276 * Y - 0.414 * Z;
522
+ const g = - 1.022 * X + 1.978 * Y + 0.044 * Z;
523
+ const b = 0.061 * X - 0.224 * Y + 1.163 * Z;
524
+
525
+ if ( type === THREE.HalfFloatType ) {
526
+
527
+ img[ qi ] = THREE.DataUtils.toHalfFloat( Math.min( r, 65504 ) );
528
+ img[ qi + 1 ] = THREE.DataUtils.toHalfFloat( Math.min( g, 65504 ) );
529
+ img[ qi + 2 ] = THREE.DataUtils.toHalfFloat( Math.min( b, 65504 ) );
530
+ img[ qi + 3 ] = THREE.DataUtils.toHalfFloat( 1 );
531
+
532
+ } else {
533
+
534
+ img[ qi ] = r;
535
+ img[ qi + 1 ] = g;
536
+ img[ qi + 2 ] = b;
537
+ img[ qi + 3 ] = 1;
538
+
539
+ }
540
+
541
+ }
542
+
543
+ }
544
+
545
+ } else {
546
+
547
+ console.log( 'Unsupported Photometric interpretation: ' + intp );
548
+
549
+ }
550
+
551
+ return img;
552
+
553
+ };
554
+
555
+ UTIF._binBE = {
556
+ nextZero: function ( data, o ) {
557
+
558
+ while ( data[ o ] != 0 ) o ++;
559
+
560
+ return o;
561
+
562
+ },
563
+ readUshort: function ( buff, p ) {
564
+
565
+ return buff[ p ] << 8 | buff[ p + 1 ];
566
+
567
+ },
568
+ readShort: function ( buff, p ) {
569
+
570
+ var a = UTIF._binBE.ui8;
571
+ a[ 0 ] = buff[ p + 1 ];
572
+ a[ 1 ] = buff[ p + 0 ];
573
+ return UTIF._binBE.i16[ 0 ];
574
+
575
+ },
576
+ readInt: function ( buff, p ) {
577
+
578
+ var a = UTIF._binBE.ui8;
579
+ a[ 0 ] = buff[ p + 3 ];
580
+ a[ 1 ] = buff[ p + 2 ];
581
+ a[ 2 ] = buff[ p + 1 ];
582
+ a[ 3 ] = buff[ p + 0 ];
583
+ return UTIF._binBE.i32[ 0 ];
584
+
585
+ },
586
+ readUint: function ( buff, p ) {
587
+
588
+ var a = UTIF._binBE.ui8;
589
+ a[ 0 ] = buff[ p + 3 ];
590
+ a[ 1 ] = buff[ p + 2 ];
591
+ a[ 2 ] = buff[ p + 1 ];
592
+ a[ 3 ] = buff[ p + 0 ];
593
+ return UTIF._binBE.ui32[ 0 ];
594
+
595
+ },
596
+ readASCII: function ( buff, p, l ) {
597
+
598
+ var s = '';
599
+
600
+ for ( var i = 0; i < l; i ++ ) s += String.fromCharCode( buff[ p + i ] );
601
+
602
+ return s;
603
+
604
+ },
605
+ readFloat: function ( buff, p ) {
606
+
607
+ var a = UTIF._binBE.ui8;
608
+
609
+ for ( var i = 0; i < 4; i ++ ) a[ i ] = buff[ p + 3 - i ];
610
+
611
+ return UTIF._binBE.fl32[ 0 ];
612
+
613
+ },
614
+ readDouble: function ( buff, p ) {
615
+
616
+ var a = UTIF._binBE.ui8;
617
+
618
+ for ( var i = 0; i < 8; i ++ ) a[ i ] = buff[ p + 7 - i ];
619
+
620
+ return UTIF._binBE.fl64[ 0 ];
621
+
622
+ },
623
+ writeUshort: function ( buff, p, n ) {
624
+
625
+ buff[ p ] = n >> 8 & 255;
626
+ buff[ p + 1 ] = n & 255;
627
+
628
+ },
629
+ writeInt: function ( buff, p, n ) {
630
+
631
+ var a = UTIF._binBE.ui8;
632
+ UTIF._binBE.i32[ 0 ] = n;
633
+ buff[ p + 3 ] = a[ 0 ];
634
+ buff[ p + 2 ] = a[ 1 ];
635
+ buff[ p + 1 ] = a[ 2 ];
636
+ buff[ p + 0 ] = a[ 3 ];
637
+
638
+ },
639
+ writeUint: function ( buff, p, n ) {
640
+
641
+ buff[ p ] = n >> 24 & 255;
642
+ buff[ p + 1 ] = n >> 16 & 255;
643
+ buff[ p + 2 ] = n >> 8 & 255;
644
+ buff[ p + 3 ] = n >> 0 & 255;
645
+
646
+ },
647
+ writeASCII: function ( buff, p, s ) {
648
+
649
+ for ( var i = 0; i < s.length; i ++ ) buff[ p + i ] = s.charCodeAt( i );
650
+
651
+ },
652
+ writeDouble: function ( buff, p, n ) {
653
+
654
+ UTIF._binBE.fl64[ 0 ] = n;
655
+
656
+ for ( var i = 0; i < 8; i ++ ) buff[ p + i ] = UTIF._binBE.ui8[ 7 - i ];
657
+
658
+ }
659
+ };
660
+ UTIF._binBE.ui8 = new Uint8Array( 8 );
661
+ UTIF._binBE.i16 = new Int16Array( UTIF._binBE.ui8.buffer );
662
+ UTIF._binBE.i32 = new Int32Array( UTIF._binBE.ui8.buffer );
663
+ UTIF._binBE.ui32 = new Uint32Array( UTIF._binBE.ui8.buffer );
664
+ UTIF._binBE.fl32 = new Float32Array( UTIF._binBE.ui8.buffer );
665
+ UTIF._binBE.fl64 = new Float64Array( UTIF._binBE.ui8.buffer );
666
+ UTIF._binLE = {
667
+ nextZero: UTIF._binBE.nextZero,
668
+ readUshort: function ( buff, p ) {
669
+
670
+ return buff[ p + 1 ] << 8 | buff[ p ];
671
+
672
+ },
673
+ readShort: function ( buff, p ) {
674
+
675
+ var a = UTIF._binBE.ui8;
676
+ a[ 0 ] = buff[ p + 0 ];
677
+ a[ 1 ] = buff[ p + 1 ];
678
+ return UTIF._binBE.i16[ 0 ];
679
+
680
+ },
681
+ readInt: function ( buff, p ) {
682
+
683
+ var a = UTIF._binBE.ui8;
684
+ a[ 0 ] = buff[ p + 0 ];
685
+ a[ 1 ] = buff[ p + 1 ];
686
+ a[ 2 ] = buff[ p + 2 ];
687
+ a[ 3 ] = buff[ p + 3 ];
688
+ return UTIF._binBE.i32[ 0 ];
689
+
690
+ },
691
+ readUint: function ( buff, p ) {
692
+
693
+ var a = UTIF._binBE.ui8;
694
+ a[ 0 ] = buff[ p + 0 ];
695
+ a[ 1 ] = buff[ p + 1 ];
696
+ a[ 2 ] = buff[ p + 2 ];
697
+ a[ 3 ] = buff[ p + 3 ];
698
+ return UTIF._binBE.ui32[ 0 ];
699
+
700
+ },
701
+ readASCII: UTIF._binBE.readASCII,
702
+ readFloat: function ( buff, p ) {
703
+
704
+ var a = UTIF._binBE.ui8;
705
+
706
+ for ( var i = 0; i < 4; i ++ ) a[ i ] = buff[ p + i ];
707
+
708
+ return UTIF._binBE.fl32[ 0 ];
709
+
710
+ },
711
+ readDouble: function ( buff, p ) {
712
+
713
+ var a = UTIF._binBE.ui8;
714
+
715
+ for ( var i = 0; i < 8; i ++ ) a[ i ] = buff[ p + i ];
716
+
717
+ return UTIF._binBE.fl64[ 0 ];
718
+
719
+ },
720
+ writeUshort: function ( buff, p, n ) {
721
+
722
+ buff[ p ] = n & 255;
723
+ buff[ p + 1 ] = n >> 8 & 255;
724
+
725
+ },
726
+ writeInt: function ( buff, p, n ) {
727
+
728
+ var a = UTIF._binBE.ui8;
729
+ UTIF._binBE.i32[ 0 ] = n;
730
+ buff[ p + 0 ] = a[ 0 ];
731
+ buff[ p + 1 ] = a[ 1 ];
732
+ buff[ p + 2 ] = a[ 2 ];
733
+ buff[ p + 3 ] = a[ 3 ];
734
+
735
+ },
736
+ writeUint: function ( buff, p, n ) {
737
+
738
+ buff[ p ] = n >>> 0 & 255;
739
+ buff[ p + 1 ] = n >>> 8 & 255;
740
+ buff[ p + 2 ] = n >>> 16 & 255;
741
+ buff[ p + 3 ] = n >>> 24 & 255;
742
+
743
+ },
744
+ writeASCII: UTIF._binBE.writeASCII
745
+ };
746
+
747
+ UTIF._copyTile = function ( tb, tw, th, b, w, h, xoff, yoff ) {
748
+
749
+ //log("copyTile", tw, th, w, h, xoff, yoff);
750
+ var xlim = Math.min( tw, w - xoff );
751
+ var ylim = Math.min( th, h - yoff );
752
+
753
+ for ( var y = 0; y < ylim; y ++ ) {
754
+
755
+ var tof = ( yoff + y ) * w + xoff;
756
+ var sof = y * tw;
757
+
758
+ for ( var x = 0; x < xlim; x ++ ) b[ tof + x ] = tb[ sof + x ];
759
+
760
+ }
761
+
762
+ };
763
+
764
+ THREE.LogLuvLoader = LogLuvLoader;
765
+
766
+ } )();