@needle-tools/three 0.146.10 → 0.153.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 (865) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.cjs +40124 -20919
  3. package/build/three.js +40120 -20914
  4. package/build/three.min.js +8 -6
  5. package/build/three.module.js +7298 -6003
  6. package/build/three.module.min.js +7 -0
  7. package/examples/jsm/animation/AnimationClipCreator.js +5 -3
  8. package/examples/jsm/cameras/CinematicCamera.js +1 -2
  9. package/examples/jsm/capabilities/WebGPU.js +17 -5
  10. package/examples/jsm/controls/ArcballControls.js +1828 -1821
  11. package/examples/jsm/controls/MapControls.js +28 -0
  12. package/examples/jsm/controls/OrbitControls.js +26 -53
  13. package/examples/jsm/controls/PointerLockControls.js +70 -65
  14. package/examples/jsm/controls/TrackballControls.js +18 -4
  15. package/examples/jsm/controls/TransformControls.js +0 -1
  16. package/examples/jsm/csm/CSM.js +11 -5
  17. package/examples/jsm/csm/CSMShader.js +7 -6
  18. package/examples/jsm/effects/AnaglyphEffect.js +6 -20
  19. package/examples/jsm/effects/AsciiEffect.js +3 -6
  20. package/examples/jsm/effects/OutlineEffect.js +1 -15
  21. package/examples/jsm/effects/ParallaxBarrierEffect.js +3 -0
  22. package/examples/jsm/exporters/DRACOExporter.js +53 -11
  23. package/examples/jsm/exporters/EXRExporter.js +3 -9
  24. package/examples/jsm/exporters/GLTFExporter.js +561 -154
  25. package/examples/jsm/exporters/KTX2Exporter.js +34 -23
  26. package/examples/jsm/exporters/MMDExporter.js +1 -1
  27. package/examples/jsm/exporters/PLYExporter.js +8 -1
  28. package/examples/jsm/exporters/STLExporter.js +8 -4
  29. package/examples/jsm/exporters/USDZExporter.js +305 -792
  30. package/examples/jsm/geometries/ConvexGeometry.js +0 -6
  31. package/examples/jsm/geometries/ParametricGeometry.js +10 -0
  32. package/examples/jsm/helpers/OctreeHelper.js +1 -0
  33. package/examples/jsm/helpers/ViewHelper.js +71 -57
  34. package/examples/jsm/interactive/HTMLMesh.js +16 -3
  35. package/examples/jsm/interactive/InteractiveGroup.js +1 -1
  36. package/examples/{js → jsm}/libs/basis/README.md +4 -4
  37. package/examples/jsm/libs/draco/draco_decoder.js +34 -0
  38. package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
  39. package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
  40. package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
  41. package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
  42. package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
  43. package/examples/jsm/libs/lil-gui.module.min.js +2 -2
  44. package/examples/jsm/libs/tween.module.js +803 -0
  45. package/examples/jsm/lights/IESSpotLight.js +25 -0
  46. package/examples/jsm/lights/LightProbeGenerator.js +11 -9
  47. package/examples/jsm/lines/LineSegments2.js +16 -10
  48. package/examples/jsm/loaders/3DMLoader.js +8 -5
  49. package/examples/jsm/loaders/3MFLoader.js +12 -11
  50. package/examples/jsm/loaders/AMFLoader.js +2 -3
  51. package/examples/jsm/loaders/BVHLoader.js +2 -2
  52. package/examples/jsm/loaders/ColladaLoader.js +15 -16
  53. package/examples/jsm/loaders/DRACOLoader.js +69 -18
  54. package/examples/jsm/loaders/EXRLoader.js +23 -24
  55. package/examples/jsm/loaders/FBXLoader.js +34 -50
  56. package/examples/jsm/loaders/GCodeLoader.js +1 -2
  57. package/examples/jsm/loaders/GLTFLoader.js +417 -895
  58. package/examples/jsm/loaders/GLTFLoaderAnimationPointer.js +684 -0
  59. package/examples/jsm/loaders/HDRCubeTextureLoader.js +4 -4
  60. package/examples/jsm/loaders/IESLoader.js +337 -0
  61. package/examples/jsm/loaders/KMZLoader.js +4 -4
  62. package/examples/jsm/loaders/KTX2Loader.js +145 -69
  63. package/examples/jsm/loaders/LDrawLoader.js +20 -18
  64. package/examples/jsm/loaders/LWOLoader.js +12 -29
  65. package/examples/jsm/loaders/LottieLoader.js +3 -1
  66. package/examples/jsm/loaders/MMDLoader.js +49 -18
  67. package/examples/jsm/loaders/MTLLoader.js +2 -2
  68. package/examples/jsm/loaders/MaterialXLoader.js +9 -3
  69. package/examples/jsm/loaders/NRRDLoader.js +33 -5
  70. package/examples/jsm/loaders/OBJLoader.js +1 -1
  71. package/examples/jsm/loaders/PCDLoader.js +26 -12
  72. package/examples/jsm/loaders/PDBLoader.js +7 -2
  73. package/examples/jsm/loaders/PLYLoader.js +254 -109
  74. package/examples/jsm/loaders/RGBELoader.js +3 -3
  75. package/examples/jsm/loaders/STLLoader.js +9 -5
  76. package/examples/jsm/loaders/SVGLoader.js +36 -27
  77. package/examples/jsm/loaders/TTFLoader.js +1 -8
  78. package/examples/jsm/loaders/TiltLoader.js +13 -7
  79. package/examples/jsm/loaders/USDZLoader.js +6 -6
  80. package/examples/jsm/loaders/VOXLoader.js +8 -2
  81. package/examples/jsm/loaders/VRMLLoader.js +44 -16
  82. package/examples/jsm/loaders/VTKLoader.js +19 -10
  83. package/examples/jsm/loaders/XYZLoader.js +9 -3
  84. package/examples/jsm/loaders/lwo/IFFParser.js +19 -19
  85. package/examples/jsm/materials/MeshGouraudMaterial.js +0 -3
  86. package/examples/jsm/math/ConvexHull.js +3 -3
  87. package/examples/jsm/math/Lut.js +5 -4
  88. package/examples/jsm/math/MeshSurfaceSampler.js +7 -9
  89. package/examples/jsm/math/Octree.js +1 -1
  90. package/examples/jsm/misc/ConvexObjectBreaker.js +2 -8
  91. package/examples/jsm/misc/GPUComputationRenderer.js +6 -5
  92. package/examples/jsm/misc/MD2Character.js +2 -2
  93. package/examples/jsm/misc/MD2CharacterComplex.js +2 -2
  94. package/examples/jsm/misc/ProgressiveLightMap.js +12 -10
  95. package/examples/jsm/misc/RollerCoaster.js +7 -1
  96. package/examples/jsm/misc/Volume.js +20 -5
  97. package/examples/jsm/misc/VolumeSlice.js +3 -1
  98. package/examples/jsm/modifiers/CurveModifier.js +1 -0
  99. package/examples/jsm/modifiers/TessellateModifier.js +19 -19
  100. package/examples/jsm/nodes/Nodes.js +144 -335
  101. package/examples/jsm/nodes/accessors/BitangentNode.js +43 -16
  102. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +86 -0
  103. package/examples/jsm/nodes/accessors/BufferNode.js +6 -0
  104. package/examples/jsm/nodes/accessors/CameraNode.js +12 -2
  105. package/examples/jsm/nodes/accessors/CubeTextureNode.js +27 -33
  106. package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +58 -0
  107. package/examples/jsm/nodes/accessors/InstanceNode.js +41 -26
  108. package/examples/jsm/nodes/accessors/MaterialNode.js +155 -38
  109. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +16 -0
  110. package/examples/jsm/nodes/accessors/ModelNode.js +11 -0
  111. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +13 -14
  112. package/examples/jsm/nodes/accessors/NormalNode.js +35 -19
  113. package/examples/jsm/nodes/accessors/Object3DNode.js +32 -12
  114. package/examples/jsm/nodes/accessors/PointUVNode.js +6 -1
  115. package/examples/jsm/nodes/accessors/PositionNode.js +38 -23
  116. package/examples/jsm/nodes/accessors/ReferenceNode.js +21 -14
  117. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +11 -7
  118. package/examples/jsm/nodes/accessors/SkinningNode.js +43 -40
  119. package/examples/jsm/nodes/accessors/StorageBufferNode.js +6 -0
  120. package/examples/jsm/nodes/accessors/TangentNode.js +28 -20
  121. package/examples/jsm/nodes/accessors/TextureNode.js +80 -12
  122. package/examples/jsm/nodes/accessors/UVNode.js +6 -0
  123. package/examples/jsm/nodes/accessors/UserDataNode.js +6 -0
  124. package/examples/jsm/nodes/code/CodeNode.js +75 -0
  125. package/examples/jsm/nodes/code/ExpressionNode.js +37 -0
  126. package/examples/jsm/nodes/{core → code}/FunctionCallNode.js +15 -1
  127. package/examples/jsm/nodes/{core → code}/FunctionNode.js +8 -7
  128. package/examples/jsm/nodes/code/ScriptableNode.js +488 -0
  129. package/examples/jsm/nodes/code/ScriptableValueNode.js +167 -0
  130. package/examples/jsm/nodes/core/ArrayUniformNode.js +3 -0
  131. package/examples/jsm/nodes/core/AttributeNode.js +17 -9
  132. package/examples/jsm/nodes/core/BypassNode.js +9 -2
  133. package/examples/jsm/nodes/core/CacheNode.js +46 -0
  134. package/examples/jsm/nodes/core/ConstNode.js +3 -0
  135. package/examples/jsm/nodes/core/ContextNode.js +8 -1
  136. package/examples/jsm/nodes/core/InputNode.js +26 -5
  137. package/examples/jsm/nodes/core/InstanceIndexNode.js +26 -2
  138. package/examples/jsm/nodes/core/LightingModel.js +16 -0
  139. package/examples/jsm/nodes/core/Node.js +129 -35
  140. package/examples/jsm/nodes/core/NodeAttribute.js +2 -1
  141. package/examples/jsm/nodes/core/NodeBuilder.js +271 -121
  142. package/examples/jsm/nodes/core/NodeCache.js +26 -0
  143. package/examples/jsm/nodes/core/NodeFrame.js +56 -5
  144. package/examples/jsm/nodes/core/NodeUtils.js +115 -28
  145. package/examples/jsm/nodes/core/PropertyNode.js +19 -2
  146. package/examples/jsm/nodes/core/StackNode.js +99 -0
  147. package/examples/jsm/nodes/core/TempNode.js +11 -3
  148. package/examples/jsm/nodes/core/UniformNode.js +16 -1
  149. package/examples/jsm/nodes/core/VarNode.js +21 -29
  150. package/examples/jsm/nodes/core/VaryingNode.js +15 -2
  151. package/examples/jsm/nodes/core/constants.js +6 -0
  152. package/examples/jsm/nodes/display/BlendModeNode.js +25 -11
  153. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +30 -14
  154. package/examples/jsm/nodes/display/ColorSpaceNode.js +39 -27
  155. package/examples/jsm/nodes/display/FrontFacingNode.js +7 -1
  156. package/examples/jsm/nodes/display/NormalMapNode.js +31 -18
  157. package/examples/jsm/nodes/display/PosterizeNode.js +10 -3
  158. package/examples/jsm/nodes/display/ToneMappingNode.js +101 -11
  159. package/examples/jsm/nodes/display/ViewportNode.js +27 -18
  160. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +30 -0
  161. package/examples/jsm/nodes/display/ViewportTextureNode.js +67 -0
  162. package/examples/jsm/nodes/fog/FogExp2Node.js +35 -0
  163. package/examples/jsm/nodes/fog/FogNode.js +12 -6
  164. package/examples/jsm/nodes/fog/FogRangeNode.js +12 -5
  165. package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +30 -0
  166. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -13
  167. package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  168. package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +8 -6
  169. package/examples/jsm/nodes/functions/BSDF/D_GGX.js +4 -4
  170. package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +3 -3
  171. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +7 -5
  172. package/examples/jsm/nodes/functions/PhongLightingModel.js +28 -0
  173. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +35 -36
  174. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +4 -3
  175. package/examples/jsm/nodes/functions/material/getRoughness.js +4 -4
  176. package/examples/jsm/nodes/geometry/RangeNode.js +50 -55
  177. package/examples/jsm/nodes/gpgpu/ComputeNode.js +9 -2
  178. package/examples/jsm/nodes/lighting/AONode.js +5 -3
  179. package/examples/jsm/nodes/lighting/AmbientLightNode.js +27 -0
  180. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +114 -5
  181. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +43 -0
  182. package/examples/jsm/nodes/lighting/EnvironmentNode.js +121 -35
  183. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +15 -10
  184. package/examples/jsm/nodes/lighting/IESSpotLightNode.js +39 -0
  185. package/examples/jsm/nodes/lighting/LightNode.js +57 -0
  186. package/examples/jsm/nodes/lighting/LightUtils.js +17 -0
  187. package/examples/jsm/nodes/lighting/LightingContextNode.js +30 -8
  188. package/examples/jsm/nodes/lighting/LightingNode.js +3 -1
  189. package/examples/jsm/nodes/lighting/LightsNode.js +18 -10
  190. package/examples/jsm/nodes/lighting/PointLightNode.js +71 -0
  191. package/examples/jsm/nodes/lighting/SpotLightNode.js +92 -0
  192. package/examples/jsm/nodes/loaders/NodeLoader.js +5 -4
  193. package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +4 -20
  194. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +6 -9
  195. package/examples/jsm/nodes/materials/Materials.js +11 -55
  196. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +5 -11
  197. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +48 -0
  198. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +74 -0
  199. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
  200. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +21 -96
  201. package/examples/jsm/nodes/materials/NodeMaterial.js +284 -62
  202. package/examples/jsm/nodes/materials/PointsNodeMaterial.js +7 -1
  203. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +29 -25
  204. package/examples/jsm/nodes/materialx/MaterialXNodes.js +31 -22
  205. package/examples/jsm/nodes/materialx/lib/mx_hsv.js +1 -1
  206. package/examples/jsm/nodes/materialx/lib/mx_noise.js +2 -1
  207. package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +2 -1
  208. package/examples/jsm/nodes/math/CondNode.js +43 -17
  209. package/examples/jsm/nodes/math/MathNode.js +178 -73
  210. package/examples/jsm/nodes/math/OperatorNode.js +52 -2
  211. package/examples/jsm/nodes/procedural/CheckerNode.js +14 -6
  212. package/examples/jsm/nodes/shadernode/ShaderNode.js +186 -63
  213. package/examples/jsm/nodes/utils/ArrayElementNode.js +4 -2
  214. package/examples/jsm/nodes/utils/ConvertNode.js +19 -1
  215. package/examples/jsm/nodes/utils/DiscardNode.js +26 -0
  216. package/examples/jsm/nodes/utils/EquirectUVNode.js +10 -4
  217. package/examples/jsm/nodes/utils/JoinNode.js +4 -1
  218. package/examples/jsm/nodes/utils/LoopNode.js +186 -0
  219. package/examples/jsm/nodes/utils/MatcapUVNode.js +11 -4
  220. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +18 -5
  221. package/examples/jsm/nodes/utils/OscNode.js +21 -14
  222. package/examples/jsm/nodes/utils/PackingNode.js +55 -0
  223. package/examples/jsm/nodes/utils/RemapNode.js +13 -5
  224. package/examples/jsm/nodes/utils/RotateUVNode.js +18 -7
  225. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +37 -0
  226. package/examples/jsm/nodes/utils/SplitNode.js +7 -5
  227. package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +15 -30
  228. package/examples/jsm/nodes/utils/TimerNode.js +16 -6
  229. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +21 -10
  230. package/examples/jsm/objects/GroundProjectedSkybox.js +172 -0
  231. package/examples/jsm/objects/Lensflare.js +3 -4
  232. package/examples/jsm/objects/MarchingCubes.js +5 -1
  233. package/examples/jsm/objects/Reflector.js +7 -4
  234. package/examples/jsm/objects/Refractor.js +4 -4
  235. package/examples/jsm/objects/ShadowMesh.js +3 -3
  236. package/examples/jsm/objects/Water.js +2 -1
  237. package/examples/jsm/physics/AmmoPhysics.js +27 -28
  238. package/examples/jsm/physics/RapierPhysics.js +199 -0
  239. package/examples/jsm/postprocessing/AfterimagePass.js +3 -2
  240. package/examples/jsm/postprocessing/BloomPass.js +7 -4
  241. package/examples/jsm/postprocessing/BokehPass.js +3 -8
  242. package/examples/jsm/postprocessing/DotScreenPass.js +1 -2
  243. package/examples/jsm/postprocessing/EffectComposer.js +5 -95
  244. package/examples/jsm/postprocessing/FilmPass.js +1 -2
  245. package/examples/jsm/postprocessing/GlitchPass.js +0 -2
  246. package/examples/jsm/postprocessing/HalftonePass.js +0 -6
  247. package/examples/jsm/postprocessing/OutlinePass.js +7 -7
  248. package/examples/jsm/postprocessing/OutputPass.js +72 -0
  249. package/examples/jsm/postprocessing/Pass.js +2 -0
  250. package/examples/jsm/postprocessing/RenderPixelatedPass.js +4 -3
  251. package/examples/jsm/postprocessing/SAOPass.js +4 -26
  252. package/examples/jsm/postprocessing/SMAAPass.js +5 -8
  253. package/examples/jsm/postprocessing/SSAARenderPass.js +15 -6
  254. package/examples/jsm/postprocessing/SSAOPass.js +4 -14
  255. package/examples/jsm/postprocessing/SSRPass.js +3 -7
  256. package/examples/jsm/postprocessing/SavePass.js +2 -3
  257. package/examples/jsm/postprocessing/ShaderPass.js +1 -0
  258. package/examples/jsm/postprocessing/TAARenderPass.js +3 -2
  259. package/examples/jsm/postprocessing/TexturePass.js +0 -2
  260. package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -11
  261. package/examples/jsm/renderers/CSS2DRenderer.js +6 -1
  262. package/examples/jsm/renderers/CSS3DRenderer.js +27 -5
  263. package/examples/jsm/renderers/{webgpu/WebGPUAnimation.js → common/Animation.js} +4 -4
  264. package/examples/jsm/renderers/common/Attributes.js +75 -0
  265. package/examples/jsm/renderers/common/Backend.js +160 -0
  266. package/examples/jsm/renderers/common/Background.js +133 -0
  267. package/examples/jsm/renderers/common/Binding.js +11 -0
  268. package/examples/jsm/renderers/common/Bindings.js +169 -0
  269. package/examples/jsm/renderers/common/Buffer.js +38 -0
  270. package/examples/jsm/renderers/{webgpu/WebGPUBufferUtils.js → common/BufferUtils.js} +2 -2
  271. package/examples/jsm/renderers/common/ChainMap.js +89 -0
  272. package/examples/jsm/renderers/common/ComputePipeline.js +17 -0
  273. package/examples/jsm/renderers/common/Constants.js +14 -0
  274. package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -0
  275. package/examples/jsm/renderers/common/DataMap.js +54 -0
  276. package/examples/jsm/renderers/common/Geometries.js +215 -0
  277. package/examples/jsm/renderers/{webgpu/WebGPUInfo.js → common/Info.js} +2 -3
  278. package/examples/jsm/renderers/common/Pipeline.js +13 -0
  279. package/examples/jsm/renderers/common/Pipelines.js +309 -0
  280. package/examples/jsm/renderers/common/ProgrammableStage.js +18 -0
  281. package/examples/jsm/renderers/common/RenderContext.js +37 -0
  282. package/examples/jsm/renderers/common/RenderContexts.js +38 -0
  283. package/examples/jsm/renderers/{webgpu/WebGPURenderLists.js → common/RenderList.js} +26 -47
  284. package/examples/jsm/renderers/common/RenderLists.js +38 -0
  285. package/examples/jsm/renderers/common/RenderObject.js +95 -0
  286. package/examples/jsm/renderers/common/RenderObjects.js +92 -0
  287. package/examples/jsm/renderers/common/RenderPipeline.js +16 -0
  288. package/examples/jsm/renderers/common/RenderTarget.js +15 -0
  289. package/examples/jsm/renderers/common/Renderer.js +822 -0
  290. package/examples/jsm/renderers/common/SampledTexture.js +80 -0
  291. package/examples/jsm/renderers/common/Sampler.js +18 -0
  292. package/examples/jsm/renderers/common/StorageBuffer.js +17 -0
  293. package/examples/jsm/renderers/common/Textures.js +206 -0
  294. package/examples/jsm/renderers/{webgpu/WebGPUUniform.js → common/Uniform.js} +13 -9
  295. package/examples/jsm/renderers/common/UniformBuffer.js +15 -0
  296. package/examples/jsm/renderers/{webgpu/WebGPUUniformsGroup.js → common/UniformsGroup.js} +13 -13
  297. package/examples/jsm/renderers/common/nodes/NodeRender.js +302 -0
  298. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampledTexture.js → common/nodes/NodeSampledTexture.js} +4 -4
  299. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampler.js → common/nodes/NodeSampler.js} +3 -3
  300. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeUniform.js → common/nodes/NodeUniform.js} +1 -1
  301. package/examples/jsm/renderers/common/nodes/Nodes.js +319 -0
  302. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +35 -31
  303. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +765 -0
  304. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +15 -987
  305. package/examples/jsm/renderers/webgpu/nodes/{WebGPUNodeBuilder.js → WGSLNodeBuilder.js} +117 -90
  306. package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeFunction.js +2 -2
  307. package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeParser.js +1 -1
  308. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +251 -0
  309. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +145 -0
  310. package/examples/jsm/renderers/webgpu/{constants.js → utils/WebGPUConstants.js} +73 -12
  311. package/examples/jsm/renderers/webgpu/{WebGPURenderPipeline.js → utils/WebGPUPipelineUtils.js} +135 -285
  312. package/examples/jsm/renderers/webgpu/{WebGPUTextureUtils.js → utils/WebGPUTextureMipmapUtils.js} +5 -25
  313. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +855 -0
  314. package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +88 -0
  315. package/examples/jsm/shaders/BleachBypassShader.js +2 -0
  316. package/examples/jsm/shaders/BokehShader2.js +3 -0
  317. package/examples/jsm/shaders/ColorifyShader.js +2 -0
  318. package/examples/jsm/shaders/ConvolutionShader.js +2 -0
  319. package/examples/jsm/shaders/CopyShader.js +2 -0
  320. package/examples/jsm/shaders/DotScreenShader.js +2 -0
  321. package/examples/jsm/shaders/ExposureShader.js +44 -0
  322. package/examples/jsm/shaders/FilmShader.js +2 -0
  323. package/examples/jsm/shaders/GammaCorrectionShader.js +2 -0
  324. package/examples/jsm/shaders/HorizontalBlurShader.js +2 -0
  325. package/examples/jsm/shaders/MMDToonShader.js +15 -4
  326. package/examples/jsm/shaders/OutputShader.js +61 -0
  327. package/examples/jsm/shaders/RGBShiftShader.js +4 -2
  328. package/examples/jsm/shaders/SepiaShader.js +2 -0
  329. package/examples/jsm/shaders/ToonShader.js +13 -5
  330. package/examples/jsm/shaders/VelocityShader.js +1 -1
  331. package/examples/jsm/shaders/VerticalBlurShader.js +2 -0
  332. package/examples/jsm/shaders/VignetteShader.js +2 -0
  333. package/examples/jsm/shaders/WaterRefractionShader.js +5 -2
  334. package/examples/jsm/utils/BufferGeometryUtils.js +54 -36
  335. package/examples/jsm/utils/LDrawUtils.js +4 -4
  336. package/examples/jsm/utils/PackedPhongMaterial.js +5 -78
  337. package/examples/jsm/utils/SceneUtils.js +8 -4
  338. package/examples/jsm/utils/SkeletonUtils.js +27 -210
  339. package/examples/jsm/utils/TextureUtils.js +41 -40
  340. package/examples/jsm/webxr/VRButton.js +1 -2
  341. package/examples/jsm/webxr/XRButton.js +198 -0
  342. package/examples/jsm/webxr/XRHandPrimitiveModel.js +1 -0
  343. package/examples/jsm/webxr/XRPlanes.js +100 -0
  344. package/package.json +34 -87
  345. package/src/Three.Legacy.js +19 -110
  346. package/src/Three.js +4 -3
  347. package/src/animation/AnimationUtils.js +13 -1
  348. package/src/audio/Audio.js +7 -2
  349. package/src/audio/PositionalAudio.js +8 -0
  350. package/src/cameras/Camera.js +5 -0
  351. package/src/cameras/CubeCamera.js +76 -13
  352. package/src/cameras/OrthographicCamera.js +1 -1
  353. package/src/cameras/PerspectiveCamera.js +1 -1
  354. package/src/constants.js +22 -2
  355. package/src/core/BufferAttribute.js +150 -9
  356. package/src/core/BufferGeometry.js +4 -10
  357. package/src/core/GLBufferAttribute.js +2 -0
  358. package/src/core/InterleavedBufferAttribute.js +5 -5
  359. package/src/core/Object3D.js +37 -8
  360. package/src/extras/DataUtils.js +7 -1
  361. package/src/extras/ImageUtils.js +2 -2
  362. package/src/extras/PMREMGenerator.js +5 -5
  363. package/src/extras/core/Curve.js +1 -1
  364. package/src/extras/curves/LineCurve.js +6 -4
  365. package/src/extras/curves/LineCurve3.js +13 -0
  366. package/src/geometries/BoxGeometry.js +10 -0
  367. package/src/geometries/CircleGeometry.js +11 -1
  368. package/src/geometries/ConeGeometry.js +1 -1
  369. package/src/geometries/CylinderGeometry.js +11 -1
  370. package/src/geometries/EdgesGeometry.js +10 -0
  371. package/src/geometries/ExtrudeGeometry.js +11 -1
  372. package/src/geometries/LatheGeometry.js +10 -0
  373. package/src/geometries/PlaneGeometry.js +10 -0
  374. package/src/geometries/PolyhedronGeometry.js +11 -1
  375. package/src/geometries/RingGeometry.js +11 -1
  376. package/src/geometries/ShapeGeometry.js +11 -1
  377. package/src/geometries/SphereGeometry.js +12 -2
  378. package/src/geometries/TorusGeometry.js +11 -1
  379. package/src/geometries/TorusKnotGeometry.js +10 -0
  380. package/src/geometries/TubeGeometry.js +10 -0
  381. package/src/geometries/WireframeGeometry.js +10 -0
  382. package/src/helpers/Box3Helper.js +1 -2
  383. package/src/lights/DirectionalLight.js +1 -1
  384. package/src/lights/HemisphereLight.js +1 -1
  385. package/src/lights/SpotLight.js +1 -1
  386. package/src/loaders/AudioLoader.js +14 -8
  387. package/src/loaders/CubeTextureLoader.js +2 -0
  388. package/src/loaders/DataTextureLoader.js +5 -1
  389. package/src/loaders/MaterialLoader.js +8 -0
  390. package/src/loaders/ObjectLoader.js +10 -2
  391. package/src/materials/LineBasicMaterial.js +4 -0
  392. package/src/materials/Material.js +16 -4
  393. package/src/materials/MeshDistanceMaterial.js +0 -9
  394. package/src/materials/MeshPhysicalMaterial.js +32 -6
  395. package/src/materials/ShaderMaterial.js +6 -1
  396. package/src/math/Box2.js +3 -2
  397. package/src/math/Box3.js +49 -64
  398. package/src/math/Color.js +88 -66
  399. package/src/math/ColorManagement.js +75 -16
  400. package/src/math/Euler.js +2 -11
  401. package/src/math/Frustum.js +29 -5
  402. package/src/math/MathUtils.js +43 -1
  403. package/src/math/Matrix3.js +26 -6
  404. package/src/math/Matrix4.js +74 -19
  405. package/src/math/Plane.js +2 -2
  406. package/src/math/Quaternion.js +6 -0
  407. package/src/math/Ray.js +7 -7
  408. package/src/math/Triangle.js +37 -7
  409. package/src/math/Vector2.js +16 -0
  410. package/src/math/Vector3.js +10 -0
  411. package/src/math/interpolants/CubicInterpolant.js +1 -2
  412. package/src/objects/InstancedMesh.js +82 -1
  413. package/src/objects/Mesh.js +108 -76
  414. package/src/objects/Skeleton.js +1 -1
  415. package/src/objects/SkinnedMesh.js +123 -8
  416. package/src/objects/Sprite.js +1 -1
  417. package/src/renderers/WebGLCubeRenderTarget.js +12 -3
  418. package/src/renderers/WebGLMultipleRenderTargets.js +4 -2
  419. package/src/renderers/WebGLRenderTarget.js +14 -2
  420. package/src/renderers/WebGLRenderer.js +1433 -1236
  421. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +1 -1
  422. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
  423. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +0 -271
  424. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +5 -5
  425. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +2 -10
  426. package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +5 -5
  427. package/src/renderers/shaders/ShaderChunk/common.glsl.js +32 -0
  428. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +1 -1
  429. package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +1 -1
  430. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +1 -1
  431. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +26 -3
  432. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +1 -1
  433. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
  434. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +10 -2
  435. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -11
  436. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +39 -13
  437. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +306 -10
  438. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -10
  439. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +9 -1
  440. package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +10 -2
  441. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +1 -1
  442. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +32 -10
  443. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +5 -13
  444. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +7 -7
  445. package/src/renderers/shaders/ShaderChunk/output_fragment.glsl.js +1 -2
  446. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +11 -5
  447. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +1 -1
  448. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +4 -11
  449. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +2 -2
  450. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +39 -34
  451. package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +1 -1
  452. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
  453. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +5 -5
  454. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +101 -16
  455. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +113 -1
  456. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +134 -6
  457. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +116 -1
  458. package/src/renderers/shaders/ShaderChunk.js +0 -6
  459. package/src/renderers/shaders/ShaderLib/background.glsl.js +0 -8
  460. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +5 -0
  461. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -4
  462. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -3
  463. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +3 -3
  464. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -3
  465. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +16 -12
  466. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -3
  467. package/src/renderers/shaders/ShaderLib/points.glsl.js +13 -0
  468. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +5 -0
  469. package/src/renderers/shaders/ShaderLib.js +18 -4
  470. package/src/renderers/shaders/UniformsLib.js +27 -15
  471. package/src/renderers/shaders/UniformsUtils.js +12 -3
  472. package/src/renderers/webgl/WebGLBackground.js +23 -12
  473. package/src/renderers/webgl/WebGLBindingStates.js +13 -5
  474. package/src/renderers/webgl/WebGLCapabilities.js +1 -2
  475. package/src/renderers/webgl/WebGLClipping.js +7 -3
  476. package/src/renderers/webgl/WebGLGeometries.js +12 -0
  477. package/src/renderers/webgl/WebGLInfo.js +0 -1
  478. package/src/renderers/webgl/WebGLLights.js +2 -2
  479. package/src/renderers/webgl/WebGLMaterials.js +123 -234
  480. package/src/renderers/webgl/WebGLMorphtargets.js +1 -1
  481. package/src/renderers/webgl/WebGLProgram.js +130 -48
  482. package/src/renderers/webgl/WebGLPrograms.js +210 -130
  483. package/src/renderers/webgl/WebGLRenderStates.js +2 -2
  484. package/src/renderers/webgl/WebGLShadowMap.js +40 -27
  485. package/src/renderers/webgl/WebGLState.js +23 -9
  486. package/src/renderers/webgl/WebGLTextures.js +39 -19
  487. package/src/renderers/webgl/WebGLUniformsGroups.js +74 -33
  488. package/src/renderers/webgl/WebGLUtils.js +41 -29
  489. package/src/renderers/webxr/WebXRController.js +3 -0
  490. package/src/renderers/webxr/WebXRManager.js +89 -141
  491. package/src/scenes/Scene.js +4 -6
  492. package/src/textures/CompressedTexture.js +2 -2
  493. package/src/textures/CubeTexture.js +2 -2
  494. package/src/textures/DataTexture.js +2 -2
  495. package/src/textures/DepthTexture.js +22 -0
  496. package/src/textures/FramebufferTexture.js +1 -3
  497. package/src/textures/Source.js +4 -0
  498. package/src/textures/Texture.js +43 -13
  499. package/src/utils.js +13 -1
  500. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
  501. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
  502. package/examples/fonts/open-sans/open-sans.css +0 -9
  503. package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
  504. package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +0 -3966
  505. package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
  506. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
  507. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
  508. package/examples/fonts/tabler-icons/tabler-icons.min.css +0 -4
  509. package/examples/js/animation/AnimationClipCreator.js +0 -89
  510. package/examples/js/animation/CCDIKSolver.js +0 -416
  511. package/examples/js/animation/MMDAnimationHelper.js +0 -1046
  512. package/examples/js/animation/MMDPhysics.js +0 -1174
  513. package/examples/js/cameras/CinematicCamera.js +0 -168
  514. package/examples/js/controls/ArcballControls.js +0 -2770
  515. package/examples/js/controls/DragControls.js +0 -205
  516. package/examples/js/controls/FirstPersonControls.js +0 -312
  517. package/examples/js/controls/FlyControls.js +0 -321
  518. package/examples/js/controls/OrbitControls.js +0 -1065
  519. package/examples/js/controls/PointerLockControls.js +0 -144
  520. package/examples/js/controls/TrackballControls.js +0 -729
  521. package/examples/js/controls/TransformControls.js +0 -1301
  522. package/examples/js/csm/CSM.js +0 -347
  523. package/examples/js/csm/CSMFrustum.js +0 -127
  524. package/examples/js/csm/CSMHelper.js +0 -165
  525. package/examples/js/csm/CSMShader.js +0 -253
  526. package/examples/js/curves/CurveExtras.js +0 -348
  527. package/examples/js/curves/NURBSCurve.js +0 -63
  528. package/examples/js/curves/NURBSSurface.js +0 -48
  529. package/examples/js/curves/NURBSUtils.js +0 -439
  530. package/examples/js/effects/AnaglyphEffect.js +0 -86
  531. package/examples/js/effects/AsciiEffect.js +0 -260
  532. package/examples/js/effects/OutlineEffect.js +0 -450
  533. package/examples/js/effects/ParallaxBarrierEffect.js +0 -62
  534. package/examples/js/effects/PeppersGhostEffect.js +0 -139
  535. package/examples/js/effects/StereoEffect.js +0 -46
  536. package/examples/js/environments/DebugEnvironment.js +0 -53
  537. package/examples/js/environments/RoomEnvironment.js +0 -124
  538. package/examples/js/exporters/ColladaExporter.js +0 -487
  539. package/examples/js/exporters/DRACOExporter.js +0 -212
  540. package/examples/js/exporters/EXRExporter.js +0 -455
  541. package/examples/js/exporters/GLTFExporter.js +0 -2425
  542. package/examples/js/exporters/MMDExporter.js +0 -187
  543. package/examples/js/exporters/OBJExporter.js +0 -260
  544. package/examples/js/exporters/PLYExporter.js +0 -427
  545. package/examples/js/exporters/STLExporter.js +0 -188
  546. package/examples/js/exporters/USDZExporter.js +0 -608
  547. package/examples/js/geometries/BoxLineGeometry.js +0 -59
  548. package/examples/js/geometries/ConvexGeometry.js +0 -53
  549. package/examples/js/geometries/DecalGeometry.js +0 -324
  550. package/examples/js/geometries/LightningStrike.js +0 -861
  551. package/examples/js/geometries/ParametricGeometries.js +0 -216
  552. package/examples/js/geometries/ParametricGeometry.js +0 -121
  553. package/examples/js/geometries/RoundedBoxGeometry.js +0 -142
  554. package/examples/js/geometries/TeapotGeometry.js +0 -335
  555. package/examples/js/geometries/TextGeometry.js +0 -53
  556. package/examples/js/helpers/LightProbeHelper.js +0 -48
  557. package/examples/js/helpers/OctreeHelper.js +0 -76
  558. package/examples/js/helpers/PositionalAudioHelper.js +0 -91
  559. package/examples/js/helpers/RectAreaLightHelper.js +0 -73
  560. package/examples/js/helpers/VertexNormalsHelper.js +0 -74
  561. package/examples/js/helpers/VertexTangentsHelper.js +0 -68
  562. package/examples/js/helpers/ViewHelper.js +0 -281
  563. package/examples/js/interactive/HTMLMesh.js +0 -497
  564. package/examples/js/interactive/InteractiveGroup.js +0 -95
  565. package/examples/js/interactive/SelectionBox.js +0 -195
  566. package/examples/js/interactive/SelectionHelper.js +0 -83
  567. package/examples/js/libs/chevrotain.min.js +0 -3
  568. package/examples/js/libs/draco/draco_decoder.js +0 -52
  569. package/examples/js/libs/draco/draco_decoder.wasm +0 -0
  570. package/examples/js/libs/draco/draco_wasm_wrapper.js +0 -104
  571. package/examples/js/libs/draco/gltf/draco_decoder.js +0 -48
  572. package/examples/js/libs/draco/gltf/draco_decoder.wasm +0 -0
  573. package/examples/js/libs/draco/gltf/draco_wasm_wrapper.js +0 -104
  574. package/examples/js/libs/fflate.min.js +0 -7
  575. package/examples/js/libs/ktx-parse.umd.js +0 -1
  576. package/examples/js/libs/meshopt_decoder.js +0 -188
  577. package/examples/js/libs/opentype.min.js +0 -1
  578. package/examples/js/libs/stats.min.js +0 -5
  579. package/examples/js/lights/LightProbeGenerator.js +0 -221
  580. package/examples/js/lights/RectAreaLightUniformsLib.js +0 -60
  581. package/examples/js/lines/Line2.js +0 -19
  582. package/examples/js/lines/LineGeometry.js +0 -69
  583. package/examples/js/lines/LineMaterial.js +0 -635
  584. package/examples/js/lines/LineSegments2.js +0 -311
  585. package/examples/js/lines/LineSegmentsGeometry.js +0 -198
  586. package/examples/js/lines/Wireframe.js +0 -47
  587. package/examples/js/lines/WireframeGeometry2.js +0 -20
  588. package/examples/js/loaders/3DMLoader.js +0 -1273
  589. package/examples/js/loaders/3MFLoader.js +0 -1306
  590. package/examples/js/loaders/AMFLoader.js +0 -504
  591. package/examples/js/loaders/BVHLoader.js +0 -395
  592. package/examples/js/loaders/BasisTextureLoader.js +0 -706
  593. package/examples/js/loaders/ColladaLoader.js +0 -3663
  594. package/examples/js/loaders/DDSLoader.js +0 -244
  595. package/examples/js/loaders/DRACOLoader.js +0 -511
  596. package/examples/js/loaders/EXRLoader.js +0 -2039
  597. package/examples/js/loaders/FBXLoader.js +0 -3680
  598. package/examples/js/loaders/FontLoader.js +0 -160
  599. package/examples/js/loaders/GCodeLoader.js +0 -255
  600. package/examples/js/loaders/GLTFLoader.js +0 -4108
  601. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -87
  602. package/examples/js/loaders/KMZLoader.js +0 -121
  603. package/examples/js/loaders/KTXLoader.js +0 -159
  604. package/examples/js/loaders/LDrawLoader.js +0 -2263
  605. package/examples/js/loaders/LUT3dlLoader.js +0 -135
  606. package/examples/js/loaders/LUTCubeLoader.js +0 -132
  607. package/examples/js/loaders/LWOLoader.js +0 -901
  608. package/examples/js/loaders/LogLuvLoader.js +0 -715
  609. package/examples/js/loaders/LottieLoader.js +0 -62
  610. package/examples/js/loaders/MD2Loader.js +0 -248
  611. package/examples/js/loaders/MDDLoader.js +0 -91
  612. package/examples/js/loaders/MMDLoader.js +0 -1915
  613. package/examples/js/loaders/MTLLoader.js +0 -472
  614. package/examples/js/loaders/MaterialXLoader.js +0 -392
  615. package/examples/js/loaders/NRRDLoader.js +0 -609
  616. package/examples/js/loaders/OBJLoader.js +0 -789
  617. package/examples/js/loaders/PCDLoader.js +0 -413
  618. package/examples/js/loaders/PDBLoader.js +0 -317
  619. package/examples/js/loaders/PLYLoader.js +0 -532
  620. package/examples/js/loaders/PRWMLoader.js +0 -249
  621. package/examples/js/loaders/PVRLoader.js +0 -218
  622. package/examples/js/loaders/RGBELoader.js +0 -442
  623. package/examples/js/loaders/RGBMLoader.js +0 -1354
  624. package/examples/js/loaders/STLLoader.js +0 -364
  625. package/examples/js/loaders/SVGLoader.js +0 -2783
  626. package/examples/js/loaders/TDSLoader.js +0 -992
  627. package/examples/js/loaders/TGALoader.js +0 -484
  628. package/examples/js/loaders/TIFFLoader.js +0 -30
  629. package/examples/js/loaders/TTFLoader.js +0 -203
  630. package/examples/js/loaders/TiltLoader.js +0 -459
  631. package/examples/js/loaders/VOXLoader.js +0 -240
  632. package/examples/js/loaders/VRMLLoader.js +0 -3140
  633. package/examples/js/loaders/VTKLoader.js +0 -1078
  634. package/examples/js/loaders/XYZLoader.js +0 -89
  635. package/examples/js/loaders/lwo/IFFParser.js +0 -1067
  636. package/examples/js/loaders/lwo/LWO2Parser.js +0 -397
  637. package/examples/js/loaders/lwo/LWO3Parser.js +0 -360
  638. package/examples/js/materials/MeshGouraudMaterial.js +0 -387
  639. package/examples/js/math/Capsule.js +0 -103
  640. package/examples/js/math/ColorConverter.js +0 -33
  641. package/examples/js/math/ConvexHull.js +0 -1154
  642. package/examples/js/math/ImprovedNoise.js +0 -66
  643. package/examples/js/math/Lut.js +0 -164
  644. package/examples/js/math/MeshSurfaceSampler.js +0 -171
  645. package/examples/js/math/OBB.js +0 -382
  646. package/examples/js/math/Octree.js +0 -410
  647. package/examples/js/math/SimplexNoise.js +0 -445
  648. package/examples/js/misc/ConvexObjectBreaker.js +0 -474
  649. package/examples/js/misc/GPUComputationRenderer.js +0 -393
  650. package/examples/js/misc/Gyroscope.js +0 -56
  651. package/examples/js/misc/MD2Character.js +0 -235
  652. package/examples/js/misc/MD2CharacterComplex.js +0 -513
  653. package/examples/js/misc/MorphAnimMesh.js +0 -63
  654. package/examples/js/misc/MorphBlendMesh.js +0 -265
  655. package/examples/js/misc/ProgressiveLightMap.js +0 -335
  656. package/examples/js/misc/RollerCoaster.js +0 -430
  657. package/examples/js/misc/TubePainter.js +0 -167
  658. package/examples/js/misc/Volume.js +0 -437
  659. package/examples/js/misc/VolumeSlice.js +0 -214
  660. package/examples/js/modifiers/CurveModifier.js +0 -309
  661. package/examples/js/modifiers/EdgeSplitModifier.js +0 -228
  662. package/examples/js/modifiers/SimplifyModifier.js +0 -465
  663. package/examples/js/modifiers/TessellateModifier.js +0 -276
  664. package/examples/js/objects/GroundProjectedEnv.js +0 -181
  665. package/examples/js/objects/Lensflare.js +0 -356
  666. package/examples/js/objects/LightningStorm.js +0 -206
  667. package/examples/js/objects/MarchingCubes.js +0 -759
  668. package/examples/js/objects/Reflector.js +0 -216
  669. package/examples/js/objects/ReflectorForSSRPass.js +0 -315
  670. package/examples/js/objects/Refractor.js +0 -283
  671. package/examples/js/objects/ShadowMesh.js +0 -59
  672. package/examples/js/objects/Sky.js +0 -218
  673. package/examples/js/objects/Water.js +0 -292
  674. package/examples/js/objects/Water2.js +0 -307
  675. package/examples/js/physics/AmmoPhysics.js +0 -259
  676. package/examples/js/physics/OimoPhysics.js +0 -217
  677. package/examples/js/postprocessing/AdaptiveToneMappingPass.js +0 -335
  678. package/examples/js/postprocessing/AfterimagePass.js +0 -77
  679. package/examples/js/postprocessing/BloomPass.js +0 -135
  680. package/examples/js/postprocessing/BokehPass.js +0 -120
  681. package/examples/js/postprocessing/ClearPass.js +0 -39
  682. package/examples/js/postprocessing/CubeTexturePass.js +0 -60
  683. package/examples/js/postprocessing/DotScreenPass.js +0 -51
  684. package/examples/js/postprocessing/EffectComposer.js +0 -272
  685. package/examples/js/postprocessing/FilmPass.js +0 -52
  686. package/examples/js/postprocessing/GlitchPass.js +0 -104
  687. package/examples/js/postprocessing/HalftonePass.js +0 -75
  688. package/examples/js/postprocessing/LUTPass.js +0 -171
  689. package/examples/js/postprocessing/MaskPass.js +0 -95
  690. package/examples/js/postprocessing/OutlinePass.js +0 -598
  691. package/examples/js/postprocessing/Pass.js +0 -72
  692. package/examples/js/postprocessing/RenderPass.js +0 -70
  693. package/examples/js/postprocessing/SAOPass.js +0 -374
  694. package/examples/js/postprocessing/SMAAPass.js +0 -170
  695. package/examples/js/postprocessing/SSAARenderPass.js +0 -156
  696. package/examples/js/postprocessing/SSAOPass.js +0 -365
  697. package/examples/js/postprocessing/SSRPass.js +0 -567
  698. package/examples/js/postprocessing/SavePass.js +0 -59
  699. package/examples/js/postprocessing/ShaderPass.js +0 -64
  700. package/examples/js/postprocessing/TAARenderPass.js +0 -130
  701. package/examples/js/postprocessing/TexturePass.js +0 -49
  702. package/examples/js/postprocessing/UnrealBloomPass.js +0 -375
  703. package/examples/js/renderers/CSS2DRenderer.js +0 -178
  704. package/examples/js/renderers/CSS3DRenderer.js +0 -237
  705. package/examples/js/renderers/Projector.js +0 -818
  706. package/examples/js/renderers/SVGRenderer.js +0 -491
  707. package/examples/js/shaders/ACESFilmicToneMappingShader.js +0 -89
  708. package/examples/js/shaders/AfterimageShader.js +0 -60
  709. package/examples/js/shaders/BasicShader.js +0 -27
  710. package/examples/js/shaders/BleachBypassShader.js +0 -62
  711. package/examples/js/shaders/BlendShader.js +0 -54
  712. package/examples/js/shaders/BokehShader.js +0 -156
  713. package/examples/js/shaders/BokehShader2.js +0 -419
  714. package/examples/js/shaders/BrightnessContrastShader.js +0 -58
  715. package/examples/js/shaders/ColorCorrectionShader.js +0 -52
  716. package/examples/js/shaders/ColorifyShader.js +0 -47
  717. package/examples/js/shaders/ConvolutionShader.js +0 -92
  718. package/examples/js/shaders/CopyShader.js +0 -45
  719. package/examples/js/shaders/DOFMipMapShader.js +0 -60
  720. package/examples/js/shaders/DepthLimitedBlurShader.js +0 -173
  721. package/examples/js/shaders/DigitalGlitch.js +0 -127
  722. package/examples/js/shaders/DotScreenShader.js +0 -72
  723. package/examples/js/shaders/FXAAShader.js +0 -284
  724. package/examples/js/shaders/FilmShader.js +0 -110
  725. package/examples/js/shaders/FocusShader.js +0 -95
  726. package/examples/js/shaders/FreiChenShader.js +0 -93
  727. package/examples/js/shaders/GammaCorrectionShader.js +0 -41
  728. package/examples/js/shaders/GodRaysShader.js +0 -284
  729. package/examples/js/shaders/HalftoneShader.js +0 -336
  730. package/examples/js/shaders/HorizontalBlurShader.js +0 -59
  731. package/examples/js/shaders/HorizontalTiltShiftShader.js +0 -65
  732. package/examples/js/shaders/HueSaturationShader.js +0 -69
  733. package/examples/js/shaders/KaleidoShader.js +0 -60
  734. package/examples/js/shaders/LuminosityHighPassShader.js +0 -67
  735. package/examples/js/shaders/LuminosityShader.js +0 -46
  736. package/examples/js/shaders/MMDToonShader.js +0 -96
  737. package/examples/js/shaders/MirrorShader.js +0 -56
  738. package/examples/js/shaders/NormalMapShader.js +0 -55
  739. package/examples/js/shaders/RGBShiftShader.js +0 -56
  740. package/examples/js/shaders/SAOShader.js +0 -209
  741. package/examples/js/shaders/SMAAShader.js +0 -454
  742. package/examples/js/shaders/SSAOShader.js +0 -295
  743. package/examples/js/shaders/SSRShader.js +0 -381
  744. package/examples/js/shaders/SepiaShader.js +0 -52
  745. package/examples/js/shaders/SobelOperatorShader.js +0 -88
  746. package/examples/js/shaders/SubsurfaceScatteringShader.js +0 -49
  747. package/examples/js/shaders/TechnicolorShader.js +0 -43
  748. package/examples/js/shaders/ToneMapShader.js +0 -84
  749. package/examples/js/shaders/ToonShader.js +0 -335
  750. package/examples/js/shaders/TriangleBlurShader.js +0 -70
  751. package/examples/js/shaders/UnpackDepthRGBAShader.js +0 -47
  752. package/examples/js/shaders/VelocityShader.js +0 -126
  753. package/examples/js/shaders/VerticalBlurShader.js +0 -59
  754. package/examples/js/shaders/VerticalTiltShiftShader.js +0 -65
  755. package/examples/js/shaders/VignetteShader.js +0 -53
  756. package/examples/js/shaders/VolumeShader.js +0 -296
  757. package/examples/js/shaders/WaterRefractionShader.js +0 -84
  758. package/examples/js/textures/FlakesTexture.js +0 -40
  759. package/examples/js/utils/BufferGeometryUtils.js +0 -1160
  760. package/examples/js/utils/CameraUtils.js +0 -71
  761. package/examples/js/utils/GPUStatsPanel.js +0 -125
  762. package/examples/js/utils/GeometryCompressionUtils.js +0 -549
  763. package/examples/js/utils/GeometryUtils.js +0 -168
  764. package/examples/js/utils/LDrawUtils.js +0 -179
  765. package/examples/js/utils/PackedPhongMaterial.js +0 -109
  766. package/examples/js/utils/SceneUtils.js +0 -214
  767. package/examples/js/utils/ShadowMapViewer.js +0 -183
  768. package/examples/js/utils/SkeletonUtils.js +0 -493
  769. package/examples/js/utils/UVsDebug.js +0 -143
  770. package/examples/js/utils/WorkerPool.js +0 -105
  771. package/examples/jsm/exporters/ColladaExporter.js +0 -713
  772. package/examples/jsm/geometries/LightningStrike.js +0 -1017
  773. package/examples/jsm/libs/OimoPhysics/OimoPhysics.js +0 -37071
  774. package/examples/jsm/libs/OimoPhysics/index.js +0 -43
  775. package/examples/jsm/libs/flow.module.js +0 -4552
  776. package/examples/jsm/libs/tween.module.min.js +0 -3
  777. package/examples/jsm/loaders/BasisTextureLoader.js +0 -790
  778. package/examples/jsm/loaders/IFCLoader.js +0 -2431
  779. package/examples/jsm/loaders/PRWMLoader.js +0 -299
  780. package/examples/jsm/loaders/ifc/web-ifc-api.js +0 -47504
  781. package/examples/jsm/loaders/ifc/web-ifc.wasm +0 -0
  782. package/examples/jsm/node-editor/NodeEditor.js +0 -857
  783. package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +0 -14
  784. package/examples/jsm/node-editor/accessors/NormalEditor.js +0 -30
  785. package/examples/jsm/node-editor/accessors/PositionEditor.js +0 -30
  786. package/examples/jsm/node-editor/accessors/UVEditor.js +0 -25
  787. package/examples/jsm/node-editor/core/BaseNode.js +0 -96
  788. package/examples/jsm/node-editor/core/DataFile.js +0 -59
  789. package/examples/jsm/node-editor/core/FileEditor.js +0 -20
  790. package/examples/jsm/node-editor/core/FileURLEditor.js +0 -29
  791. package/examples/jsm/node-editor/display/BlendEditor.js +0 -44
  792. package/examples/jsm/node-editor/display/NormalMapEditor.js +0 -49
  793. package/examples/jsm/node-editor/examples/animate-uv.json +0 -1
  794. package/examples/jsm/node-editor/examples/fake-top-light.json +0 -1
  795. package/examples/jsm/node-editor/examples/matcap.json +0 -1
  796. package/examples/jsm/node-editor/examples/oscillator-color.json +0 -1
  797. package/examples/jsm/node-editor/examples/rim.json +0 -1
  798. package/examples/jsm/node-editor/inputs/ColorEditor.js +0 -96
  799. package/examples/jsm/node-editor/inputs/FloatEditor.js +0 -23
  800. package/examples/jsm/node-editor/inputs/SliderEditor.js +0 -67
  801. package/examples/jsm/node-editor/inputs/TextureEditor.js +0 -155
  802. package/examples/jsm/node-editor/inputs/Vector2Editor.js +0 -28
  803. package/examples/jsm/node-editor/inputs/Vector3Editor.js +0 -30
  804. package/examples/jsm/node-editor/inputs/Vector4Editor.js +0 -37
  805. package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +0 -84
  806. package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +0 -102
  807. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +0 -118
  808. package/examples/jsm/node-editor/math/AngleEditor.js +0 -40
  809. package/examples/jsm/node-editor/math/DotEditor.js +0 -35
  810. package/examples/jsm/node-editor/math/InvertEditor.js +0 -39
  811. package/examples/jsm/node-editor/math/LimiterEditor.js +0 -62
  812. package/examples/jsm/node-editor/math/NormalizeEditor.js +0 -28
  813. package/examples/jsm/node-editor/math/OperatorEditor.js +0 -63
  814. package/examples/jsm/node-editor/math/PowerEditor.js +0 -44
  815. package/examples/jsm/node-editor/math/TrigonometryEditor.js +0 -45
  816. package/examples/jsm/node-editor/procedural/CheckerEditor.js +0 -27
  817. package/examples/jsm/node-editor/scene/MeshEditor.js +0 -102
  818. package/examples/jsm/node-editor/scene/Object3DEditor.js +0 -160
  819. package/examples/jsm/node-editor/scene/PointsEditor.js +0 -99
  820. package/examples/jsm/node-editor/utils/JoinEditor.js +0 -58
  821. package/examples/jsm/node-editor/utils/OscillatorEditor.js +0 -43
  822. package/examples/jsm/node-editor/utils/PreviewEditor.js +0 -170
  823. package/examples/jsm/node-editor/utils/SplitEditor.js +0 -39
  824. package/examples/jsm/node-editor/utils/TimerEditor.js +0 -58
  825. package/examples/jsm/nodes/core/CodeNode.js +0 -50
  826. package/examples/jsm/nodes/core/ExpressionNode.js +0 -32
  827. package/examples/jsm/nodes/functions/light/getDistanceAttenuation.js +0 -22
  828. package/examples/jsm/nodes/lighting/PunctualLightNode.js +0 -68
  829. package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +0 -301
  830. package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +0 -149
  831. package/examples/jsm/objects/GroundProjectedEnv.js +0 -186
  832. package/examples/jsm/objects/LightningStorm.js +0 -245
  833. package/examples/jsm/physics/OimoPhysics.js +0 -231
  834. package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +0 -369
  835. package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +0 -187
  836. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +0 -173
  837. package/examples/jsm/renderers/webgpu/WebGPUBinding.js +0 -22
  838. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +0 -255
  839. package/examples/jsm/renderers/webgpu/WebGPUBuffer.js +0 -43
  840. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +0 -78
  841. package/examples/jsm/renderers/webgpu/WebGPUGeometries.js +0 -82
  842. package/examples/jsm/renderers/webgpu/WebGPUObjects.js +0 -36
  843. package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +0 -22
  844. package/examples/jsm/renderers/webgpu/WebGPUProperties.js +0 -38
  845. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +0 -296
  846. package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +0 -66
  847. package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +0 -73
  848. package/examples/jsm/renderers/webgpu/WebGPUSampler.js +0 -29
  849. package/examples/jsm/renderers/webgpu/WebGPUStorageBuffer.js +0 -20
  850. package/examples/jsm/renderers/webgpu/WebGPUTextureRenderer.js +0 -40
  851. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +0 -794
  852. package/examples/jsm/renderers/webgpu/WebGPUUniformBuffer.js +0 -18
  853. package/examples/jsm/renderers/webgpu/WebGPUUtils.js +0 -81
  854. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +0 -83
  855. package/examples/jsm/shaders/ToneMapShader.js +0 -73
  856. package/src/renderers/shaders/ShaderChunk/uv2_pars_fragment.glsl.js +0 -7
  857. package/src/renderers/shaders/ShaderChunk/uv2_pars_vertex.glsl.js +0 -10
  858. package/src/renderers/shaders/ShaderChunk/uv2_vertex.glsl.js +0 -7
  859. /package/examples/{js → jsm}/libs/ammo.wasm.js +0 -0
  860. /package/examples/{js → jsm}/libs/ammo.wasm.wasm +0 -0
  861. /package/examples/{js → jsm}/libs/basis/basis_transcoder.js +0 -0
  862. /package/examples/{js → jsm}/libs/basis/basis_transcoder.wasm +0 -0
  863. /package/examples/{js → jsm}/libs/draco/README.md +0 -0
  864. /package/examples/{js → jsm}/libs/draco/draco_encoder.js +0 -0
  865. /package/examples/{js → jsm}/libs/draco/gltf/draco_encoder.js +0 -0
@@ -1,2039 +0,0 @@
1
- ( function () {
2
-
3
- /**
4
- * OpenEXR loader currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression.
5
- * Supports reading as UnsignedByte, HalfFloat and Float type data texture.
6
- *
7
- * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
8
- * implementation, so I have preserved their copyright notices.
9
- */
10
-
11
- // /*
12
- // Copyright (c) 2014 - 2017, Syoyo Fujita
13
- // All rights reserved.
14
-
15
- // Redistribution and use in source and binary forms, with or without
16
- // modification, are permitted provided that the following conditions are met:
17
- // * Redistributions of source code must retain the above copyright
18
- // notice, this list of conditions and the following disclaimer.
19
- // * Redistributions in binary form must reproduce the above copyright
20
- // notice, this list of conditions and the following disclaimer in the
21
- // documentation and/or other materials provided with the distribution.
22
- // * Neither the name of the Syoyo Fujita nor the
23
- // names of its contributors may be used to endorse or promote products
24
- // derived from this software without specific prior written permission.
25
-
26
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27
- // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
- // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29
- // DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
30
- // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
- // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
- // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33
- // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
- // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
- // */
37
-
38
- // // TinyEXR contains some OpenEXR code, which is licensed under ------------
39
-
40
- // ///////////////////////////////////////////////////////////////////////////
41
- // //
42
- // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
43
- // // Digital Ltd. LLC
44
- // //
45
- // // All rights reserved.
46
- // //
47
- // // Redistribution and use in source and binary forms, with or without
48
- // // modification, are permitted provided that the following conditions are
49
- // // met:
50
- // // * Redistributions of source code must retain the above copyright
51
- // // notice, this list of conditions and the following disclaimer.
52
- // // * Redistributions in binary form must reproduce the above
53
- // // copyright notice, this list of conditions and the following disclaimer
54
- // // in the documentation and/or other materials provided with the
55
- // // distribution.
56
- // // * Neither the name of Industrial Light & Magic nor the names of
57
- // // its contributors may be used to endorse or promote products derived
58
- // // from this software without specific prior written permission.
59
- // //
60
- // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
61
- // // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
62
- // // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
63
- // // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
64
- // // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
65
- // // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
66
- // // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
67
- // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
68
- // // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
69
- // // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
70
- // // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71
- // //
72
- // ///////////////////////////////////////////////////////////////////////////
73
-
74
- // // End of OpenEXR license -------------------------------------------------
75
-
76
- class EXRLoader extends THREE.DataTextureLoader {
77
-
78
- constructor( manager ) {
79
-
80
- super( manager );
81
- this.type = THREE.HalfFloatType;
82
-
83
- }
84
- parse( buffer ) {
85
-
86
- const USHORT_RANGE = 1 << 16;
87
- const BITMAP_SIZE = USHORT_RANGE >> 3;
88
- const HUF_ENCBITS = 16; // literal (value) bit length
89
- const HUF_DECBITS = 14; // decoding bit size (>= 8)
90
-
91
- const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size
92
- const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
93
- const HUF_DECMASK = HUF_DECSIZE - 1;
94
- const NBITS = 16;
95
- const A_OFFSET = 1 << NBITS - 1;
96
- const MOD_MASK = ( 1 << NBITS ) - 1;
97
- const SHORT_ZEROCODE_RUN = 59;
98
- const LONG_ZEROCODE_RUN = 63;
99
- const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
100
- const ULONG_SIZE = 8;
101
- const FLOAT32_SIZE = 4;
102
- const INT32_SIZE = 4;
103
- const INT16_SIZE = 2;
104
- const INT8_SIZE = 1;
105
- const STATIC_HUFFMAN = 0;
106
- const DEFLATE = 1;
107
- const UNKNOWN = 0;
108
- const LOSSY_DCT = 1;
109
- const RLE = 2;
110
- const logBase = Math.pow( 2.7182818, 2.2 );
111
- function reverseLutFromBitmap( bitmap, lut ) {
112
-
113
- let k = 0;
114
- for ( let i = 0; i < USHORT_RANGE; ++ i ) {
115
-
116
- if ( i == 0 || bitmap[ i >> 3 ] & 1 << ( i & 7 ) ) {
117
-
118
- lut[ k ++ ] = i;
119
-
120
- }
121
-
122
- }
123
-
124
- const n = k - 1;
125
- while ( k < USHORT_RANGE ) lut[ k ++ ] = 0;
126
- return n;
127
-
128
- }
129
-
130
- function hufClearDecTable( hdec ) {
131
-
132
- for ( let i = 0; i < HUF_DECSIZE; i ++ ) {
133
-
134
- hdec[ i ] = {};
135
- hdec[ i ].len = 0;
136
- hdec[ i ].lit = 0;
137
- hdec[ i ].p = null;
138
-
139
- }
140
-
141
- }
142
-
143
- const getBitsReturn = {
144
- l: 0,
145
- c: 0,
146
- lc: 0
147
- };
148
- function getBits( nBits, c, lc, uInt8Array, inOffset ) {
149
-
150
- while ( lc < nBits ) {
151
-
152
- c = c << 8 | parseUint8Array( uInt8Array, inOffset );
153
- lc += 8;
154
-
155
- }
156
-
157
- lc -= nBits;
158
- getBitsReturn.l = c >> lc & ( 1 << nBits ) - 1;
159
- getBitsReturn.c = c;
160
- getBitsReturn.lc = lc;
161
-
162
- }
163
-
164
- const hufTableBuffer = new Array( 59 );
165
- function hufCanonicalCodeTable( hcode ) {
166
-
167
- for ( let i = 0; i <= 58; ++ i ) hufTableBuffer[ i ] = 0;
168
- for ( let i = 0; i < HUF_ENCSIZE; ++ i ) hufTableBuffer[ hcode[ i ] ] += 1;
169
- let c = 0;
170
- for ( let i = 58; i > 0; -- i ) {
171
-
172
- const nc = c + hufTableBuffer[ i ] >> 1;
173
- hufTableBuffer[ i ] = c;
174
- c = nc;
175
-
176
- }
177
-
178
- for ( let i = 0; i < HUF_ENCSIZE; ++ i ) {
179
-
180
- const l = hcode[ i ];
181
- if ( l > 0 ) hcode[ i ] = l | hufTableBuffer[ l ] ++ << 6;
182
-
183
- }
184
-
185
- }
186
-
187
- function hufUnpackEncTable( uInt8Array, inOffset, ni, im, iM, hcode ) {
188
-
189
- const p = inOffset;
190
- let c = 0;
191
- let lc = 0;
192
- for ( ; im <= iM; im ++ ) {
193
-
194
- if ( p.value - inOffset.value > ni ) return false;
195
- getBits( 6, c, lc, uInt8Array, p );
196
- const l = getBitsReturn.l;
197
- c = getBitsReturn.c;
198
- lc = getBitsReturn.lc;
199
- hcode[ im ] = l;
200
- if ( l == LONG_ZEROCODE_RUN ) {
201
-
202
- if ( p.value - inOffset.value > ni ) {
203
-
204
- throw new Error( 'Something wrong with hufUnpackEncTable' );
205
-
206
- }
207
-
208
- getBits( 8, c, lc, uInt8Array, p );
209
- let zerun = getBitsReturn.l + SHORTEST_LONG_RUN;
210
- c = getBitsReturn.c;
211
- lc = getBitsReturn.lc;
212
- if ( im + zerun > iM + 1 ) {
213
-
214
- throw new Error( 'Something wrong with hufUnpackEncTable' );
215
-
216
- }
217
-
218
- while ( zerun -- ) hcode[ im ++ ] = 0;
219
- im --;
220
-
221
- } else if ( l >= SHORT_ZEROCODE_RUN ) {
222
-
223
- let zerun = l - SHORT_ZEROCODE_RUN + 2;
224
- if ( im + zerun > iM + 1 ) {
225
-
226
- throw new Error( 'Something wrong with hufUnpackEncTable' );
227
-
228
- }
229
-
230
- while ( zerun -- ) hcode[ im ++ ] = 0;
231
- im --;
232
-
233
- }
234
-
235
- }
236
-
237
- hufCanonicalCodeTable( hcode );
238
-
239
- }
240
-
241
- function hufLength( code ) {
242
-
243
- return code & 63;
244
-
245
- }
246
-
247
- function hufCode( code ) {
248
-
249
- return code >> 6;
250
-
251
- }
252
-
253
- function hufBuildDecTable( hcode, im, iM, hdecod ) {
254
-
255
- for ( ; im <= iM; im ++ ) {
256
-
257
- const c = hufCode( hcode[ im ] );
258
- const l = hufLength( hcode[ im ] );
259
- if ( c >> l ) {
260
-
261
- throw new Error( 'Invalid table entry' );
262
-
263
- }
264
-
265
- if ( l > HUF_DECBITS ) {
266
-
267
- const pl = hdecod[ c >> l - HUF_DECBITS ];
268
- if ( pl.len ) {
269
-
270
- throw new Error( 'Invalid table entry' );
271
-
272
- }
273
-
274
- pl.lit ++;
275
- if ( pl.p ) {
276
-
277
- const p = pl.p;
278
- pl.p = new Array( pl.lit );
279
- for ( let i = 0; i < pl.lit - 1; ++ i ) {
280
-
281
- pl.p[ i ] = p[ i ];
282
-
283
- }
284
-
285
- } else {
286
-
287
- pl.p = new Array( 1 );
288
-
289
- }
290
-
291
- pl.p[ pl.lit - 1 ] = im;
292
-
293
- } else if ( l ) {
294
-
295
- let plOffset = 0;
296
- for ( let i = 1 << HUF_DECBITS - l; i > 0; i -- ) {
297
-
298
- const pl = hdecod[ ( c << HUF_DECBITS - l ) + plOffset ];
299
- if ( pl.len || pl.p ) {
300
-
301
- throw new Error( 'Invalid table entry' );
302
-
303
- }
304
-
305
- pl.len = l;
306
- pl.lit = im;
307
- plOffset ++;
308
-
309
- }
310
-
311
- }
312
-
313
- }
314
-
315
- return true;
316
-
317
- }
318
-
319
- const getCharReturn = {
320
- c: 0,
321
- lc: 0
322
- };
323
- function getChar( c, lc, uInt8Array, inOffset ) {
324
-
325
- c = c << 8 | parseUint8Array( uInt8Array, inOffset );
326
- lc += 8;
327
- getCharReturn.c = c;
328
- getCharReturn.lc = lc;
329
-
330
- }
331
-
332
- const getCodeReturn = {
333
- c: 0,
334
- lc: 0
335
- };
336
- function getCode( po, rlc, c, lc, uInt8Array, inOffset, outBuffer, outBufferOffset, outBufferEndOffset ) {
337
-
338
- if ( po == rlc ) {
339
-
340
- if ( lc < 8 ) {
341
-
342
- getChar( c, lc, uInt8Array, inOffset );
343
- c = getCharReturn.c;
344
- lc = getCharReturn.lc;
345
-
346
- }
347
-
348
- lc -= 8;
349
- let cs = c >> lc;
350
- cs = new Uint8Array( [ cs ] )[ 0 ];
351
- if ( outBufferOffset.value + cs > outBufferEndOffset ) {
352
-
353
- return false;
354
-
355
- }
356
-
357
- const s = outBuffer[ outBufferOffset.value - 1 ];
358
- while ( cs -- > 0 ) {
359
-
360
- outBuffer[ outBufferOffset.value ++ ] = s;
361
-
362
- }
363
-
364
- } else if ( outBufferOffset.value < outBufferEndOffset ) {
365
-
366
- outBuffer[ outBufferOffset.value ++ ] = po;
367
-
368
- } else {
369
-
370
- return false;
371
-
372
- }
373
-
374
- getCodeReturn.c = c;
375
- getCodeReturn.lc = lc;
376
-
377
- }
378
-
379
- function UInt16( value ) {
380
-
381
- return value & 0xFFFF;
382
-
383
- }
384
-
385
- function Int16( value ) {
386
-
387
- const ref = UInt16( value );
388
- return ref > 0x7FFF ? ref - 0x10000 : ref;
389
-
390
- }
391
-
392
- const wdec14Return = {
393
- a: 0,
394
- b: 0
395
- };
396
- function wdec14( l, h ) {
397
-
398
- const ls = Int16( l );
399
- const hs = Int16( h );
400
- const hi = hs;
401
- const ai = ls + ( hi & 1 ) + ( hi >> 1 );
402
- const as = ai;
403
- const bs = ai - hi;
404
- wdec14Return.a = as;
405
- wdec14Return.b = bs;
406
-
407
- }
408
-
409
- function wdec16( l, h ) {
410
-
411
- const m = UInt16( l );
412
- const d = UInt16( h );
413
- const bb = m - ( d >> 1 ) & MOD_MASK;
414
- const aa = d + bb - A_OFFSET & MOD_MASK;
415
- wdec14Return.a = aa;
416
- wdec14Return.b = bb;
417
-
418
- }
419
-
420
- function wav2Decode( buffer, j, nx, ox, ny, oy, mx ) {
421
-
422
- const w14 = mx < 1 << 14;
423
- const n = nx > ny ? ny : nx;
424
- let p = 1;
425
- let p2;
426
- let py;
427
- while ( p <= n ) p <<= 1;
428
- p >>= 1;
429
- p2 = p;
430
- p >>= 1;
431
- while ( p >= 1 ) {
432
-
433
- py = 0;
434
- const ey = py + oy * ( ny - p2 );
435
- const oy1 = oy * p;
436
- const oy2 = oy * p2;
437
- const ox1 = ox * p;
438
- const ox2 = ox * p2;
439
- let i00, i01, i10, i11;
440
- for ( ; py <= ey; py += oy2 ) {
441
-
442
- let px = py;
443
- const ex = py + ox * ( nx - p2 );
444
- for ( ; px <= ex; px += ox2 ) {
445
-
446
- const p01 = px + ox1;
447
- const p10 = px + oy1;
448
- const p11 = p10 + ox1;
449
- if ( w14 ) {
450
-
451
- wdec14( buffer[ px + j ], buffer[ p10 + j ] );
452
- i00 = wdec14Return.a;
453
- i10 = wdec14Return.b;
454
- wdec14( buffer[ p01 + j ], buffer[ p11 + j ] );
455
- i01 = wdec14Return.a;
456
- i11 = wdec14Return.b;
457
- wdec14( i00, i01 );
458
- buffer[ px + j ] = wdec14Return.a;
459
- buffer[ p01 + j ] = wdec14Return.b;
460
- wdec14( i10, i11 );
461
- buffer[ p10 + j ] = wdec14Return.a;
462
- buffer[ p11 + j ] = wdec14Return.b;
463
-
464
- } else {
465
-
466
- wdec16( buffer[ px + j ], buffer[ p10 + j ] );
467
- i00 = wdec14Return.a;
468
- i10 = wdec14Return.b;
469
- wdec16( buffer[ p01 + j ], buffer[ p11 + j ] );
470
- i01 = wdec14Return.a;
471
- i11 = wdec14Return.b;
472
- wdec16( i00, i01 );
473
- buffer[ px + j ] = wdec14Return.a;
474
- buffer[ p01 + j ] = wdec14Return.b;
475
- wdec16( i10, i11 );
476
- buffer[ p10 + j ] = wdec14Return.a;
477
- buffer[ p11 + j ] = wdec14Return.b;
478
-
479
- }
480
-
481
- }
482
-
483
- if ( nx & p ) {
484
-
485
- const p10 = px + oy1;
486
- if ( w14 ) wdec14( buffer[ px + j ], buffer[ p10 + j ] ); else wdec16( buffer[ px + j ], buffer[ p10 + j ] );
487
- i00 = wdec14Return.a;
488
- buffer[ p10 + j ] = wdec14Return.b;
489
- buffer[ px + j ] = i00;
490
-
491
- }
492
-
493
- }
494
-
495
- if ( ny & p ) {
496
-
497
- let px = py;
498
- const ex = py + ox * ( nx - p2 );
499
- for ( ; px <= ex; px += ox2 ) {
500
-
501
- const p01 = px + ox1;
502
- if ( w14 ) wdec14( buffer[ px + j ], buffer[ p01 + j ] ); else wdec16( buffer[ px + j ], buffer[ p01 + j ] );
503
- i00 = wdec14Return.a;
504
- buffer[ p01 + j ] = wdec14Return.b;
505
- buffer[ px + j ] = i00;
506
-
507
- }
508
-
509
- }
510
-
511
- p2 = p;
512
- p >>= 1;
513
-
514
- }
515
-
516
- return py;
517
-
518
- }
519
-
520
- function hufDecode( encodingTable, decodingTable, uInt8Array, inOffset, ni, rlc, no, outBuffer, outOffset ) {
521
-
522
- let c = 0;
523
- let lc = 0;
524
- const outBufferEndOffset = no;
525
- const inOffsetEnd = Math.trunc( inOffset.value + ( ni + 7 ) / 8 );
526
- while ( inOffset.value < inOffsetEnd ) {
527
-
528
- getChar( c, lc, uInt8Array, inOffset );
529
- c = getCharReturn.c;
530
- lc = getCharReturn.lc;
531
- while ( lc >= HUF_DECBITS ) {
532
-
533
- const index = c >> lc - HUF_DECBITS & HUF_DECMASK;
534
- const pl = decodingTable[ index ];
535
- if ( pl.len ) {
536
-
537
- lc -= pl.len;
538
- getCode( pl.lit, rlc, c, lc, uInt8Array, inOffset, outBuffer, outOffset, outBufferEndOffset );
539
- c = getCodeReturn.c;
540
- lc = getCodeReturn.lc;
541
-
542
- } else {
543
-
544
- if ( ! pl.p ) {
545
-
546
- throw new Error( 'hufDecode issues' );
547
-
548
- }
549
-
550
- let j;
551
- for ( j = 0; j < pl.lit; j ++ ) {
552
-
553
- const l = hufLength( encodingTable[ pl.p[ j ] ] );
554
- while ( lc < l && inOffset.value < inOffsetEnd ) {
555
-
556
- getChar( c, lc, uInt8Array, inOffset );
557
- c = getCharReturn.c;
558
- lc = getCharReturn.lc;
559
-
560
- }
561
-
562
- if ( lc >= l ) {
563
-
564
- if ( hufCode( encodingTable[ pl.p[ j ] ] ) == ( c >> lc - l & ( 1 << l ) - 1 ) ) {
565
-
566
- lc -= l;
567
- getCode( pl.p[ j ], rlc, c, lc, uInt8Array, inOffset, outBuffer, outOffset, outBufferEndOffset );
568
- c = getCodeReturn.c;
569
- lc = getCodeReturn.lc;
570
- break;
571
-
572
- }
573
-
574
- }
575
-
576
- }
577
-
578
- if ( j == pl.lit ) {
579
-
580
- throw new Error( 'hufDecode issues' );
581
-
582
- }
583
-
584
- }
585
-
586
- }
587
-
588
- }
589
-
590
- const i = 8 - ni & 7;
591
- c >>= i;
592
- lc -= i;
593
- while ( lc > 0 ) {
594
-
595
- const pl = decodingTable[ c << HUF_DECBITS - lc & HUF_DECMASK ];
596
- if ( pl.len ) {
597
-
598
- lc -= pl.len;
599
- getCode( pl.lit, rlc, c, lc, uInt8Array, inOffset, outBuffer, outOffset, outBufferEndOffset );
600
- c = getCodeReturn.c;
601
- lc = getCodeReturn.lc;
602
-
603
- } else {
604
-
605
- throw new Error( 'hufDecode issues' );
606
-
607
- }
608
-
609
- }
610
-
611
- return true;
612
-
613
- }
614
-
615
- function hufUncompress( uInt8Array, inDataView, inOffset, nCompressed, outBuffer, nRaw ) {
616
-
617
- const outOffset = {
618
- value: 0
619
- };
620
- const initialInOffset = inOffset.value;
621
- const im = parseUint32( inDataView, inOffset );
622
- const iM = parseUint32( inDataView, inOffset );
623
- inOffset.value += 4;
624
- const nBits = parseUint32( inDataView, inOffset );
625
- inOffset.value += 4;
626
- if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) {
627
-
628
- throw new Error( 'Something wrong with HUF_ENCSIZE' );
629
-
630
- }
631
-
632
- const freq = new Array( HUF_ENCSIZE );
633
- const hdec = new Array( HUF_DECSIZE );
634
- hufClearDecTable( hdec );
635
- const ni = nCompressed - ( inOffset.value - initialInOffset );
636
- hufUnpackEncTable( uInt8Array, inOffset, ni, im, iM, freq );
637
- if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) {
638
-
639
- throw new Error( 'Something wrong with hufUncompress' );
640
-
641
- }
642
-
643
- hufBuildDecTable( freq, im, iM, hdec );
644
- hufDecode( freq, hdec, uInt8Array, inOffset, nBits, iM, nRaw, outBuffer, outOffset );
645
-
646
- }
647
-
648
- function applyLut( lut, data, nData ) {
649
-
650
- for ( let i = 0; i < nData; ++ i ) {
651
-
652
- data[ i ] = lut[ data[ i ] ];
653
-
654
- }
655
-
656
- }
657
-
658
- function predictor( source ) {
659
-
660
- for ( let t = 1; t < source.length; t ++ ) {
661
-
662
- const d = source[ t - 1 ] + source[ t ] - 128;
663
- source[ t ] = d;
664
-
665
- }
666
-
667
- }
668
-
669
- function interleaveScalar( source, out ) {
670
-
671
- let t1 = 0;
672
- let t2 = Math.floor( ( source.length + 1 ) / 2 );
673
- let s = 0;
674
- const stop = source.length - 1;
675
- while ( true ) {
676
-
677
- if ( s > stop ) break;
678
- out[ s ++ ] = source[ t1 ++ ];
679
- if ( s > stop ) break;
680
- out[ s ++ ] = source[ t2 ++ ];
681
-
682
- }
683
-
684
- }
685
-
686
- function decodeRunLength( source ) {
687
-
688
- let size = source.byteLength;
689
- const out = new Array();
690
- let p = 0;
691
- const reader = new DataView( source );
692
- while ( size > 0 ) {
693
-
694
- const l = reader.getInt8( p ++ );
695
- if ( l < 0 ) {
696
-
697
- const count = - l;
698
- size -= count + 1;
699
- for ( let i = 0; i < count; i ++ ) {
700
-
701
- out.push( reader.getUint8( p ++ ) );
702
-
703
- }
704
-
705
- } else {
706
-
707
- const count = l;
708
- size -= 2;
709
- const value = reader.getUint8( p ++ );
710
- for ( let i = 0; i < count + 1; i ++ ) {
711
-
712
- out.push( value );
713
-
714
- }
715
-
716
- }
717
-
718
- }
719
-
720
- return out;
721
-
722
- }
723
-
724
- function lossyDctDecode( cscSet, rowPtrs, channelData, acBuffer, dcBuffer, outBuffer ) {
725
-
726
- let dataView = new DataView( outBuffer.buffer );
727
- const width = channelData[ cscSet.idx[ 0 ] ].width;
728
- const height = channelData[ cscSet.idx[ 0 ] ].height;
729
- const numComp = 3;
730
- const numFullBlocksX = Math.floor( width / 8.0 );
731
- const numBlocksX = Math.ceil( width / 8.0 );
732
- const numBlocksY = Math.ceil( height / 8.0 );
733
- const leftoverX = width - ( numBlocksX - 1 ) * 8;
734
- const leftoverY = height - ( numBlocksY - 1 ) * 8;
735
- const currAcComp = {
736
- value: 0
737
- };
738
- const currDcComp = new Array( numComp );
739
- const dctData = new Array( numComp );
740
- const halfZigBlock = new Array( numComp );
741
- const rowBlock = new Array( numComp );
742
- const rowOffsets = new Array( numComp );
743
- for ( let comp = 0; comp < numComp; ++ comp ) {
744
-
745
- rowOffsets[ comp ] = rowPtrs[ cscSet.idx[ comp ] ];
746
- currDcComp[ comp ] = comp < 1 ? 0 : currDcComp[ comp - 1 ] + numBlocksX * numBlocksY;
747
- dctData[ comp ] = new Float32Array( 64 );
748
- halfZigBlock[ comp ] = new Uint16Array( 64 );
749
- rowBlock[ comp ] = new Uint16Array( numBlocksX * 64 );
750
-
751
- }
752
-
753
- for ( let blocky = 0; blocky < numBlocksY; ++ blocky ) {
754
-
755
- let maxY = 8;
756
- if ( blocky == numBlocksY - 1 ) maxY = leftoverY;
757
- let maxX = 8;
758
- for ( let blockx = 0; blockx < numBlocksX; ++ blockx ) {
759
-
760
- if ( blockx == numBlocksX - 1 ) maxX = leftoverX;
761
- for ( let comp = 0; comp < numComp; ++ comp ) {
762
-
763
- halfZigBlock[ comp ].fill( 0 );
764
-
765
- // set block DC component
766
- halfZigBlock[ comp ][ 0 ] = dcBuffer[ currDcComp[ comp ] ++ ];
767
- // set block AC components
768
- unRleAC( currAcComp, acBuffer, halfZigBlock[ comp ] );
769
-
770
- // UnZigZag block to float
771
- unZigZag( halfZigBlock[ comp ], dctData[ comp ] );
772
- // decode float dct
773
- dctInverse( dctData[ comp ] );
774
-
775
- }
776
-
777
- if ( numComp == 3 ) {
778
-
779
- csc709Inverse( dctData );
780
-
781
- }
782
-
783
- for ( let comp = 0; comp < numComp; ++ comp ) {
784
-
785
- convertToHalf( dctData[ comp ], rowBlock[ comp ], blockx * 64 );
786
-
787
- }
788
-
789
- } // blockx
790
-
791
- let offset = 0;
792
- for ( let comp = 0; comp < numComp; ++ comp ) {
793
-
794
- const type = channelData[ cscSet.idx[ comp ] ].type;
795
- for ( let y = 8 * blocky; y < 8 * blocky + maxY; ++ y ) {
796
-
797
- offset = rowOffsets[ comp ][ y ];
798
- for ( let blockx = 0; blockx < numFullBlocksX; ++ blockx ) {
799
-
800
- const src = blockx * 64 + ( y & 0x7 ) * 8;
801
- dataView.setUint16( offset + 0 * INT16_SIZE * type, rowBlock[ comp ][ src + 0 ], true );
802
- dataView.setUint16( offset + 1 * INT16_SIZE * type, rowBlock[ comp ][ src + 1 ], true );
803
- dataView.setUint16( offset + 2 * INT16_SIZE * type, rowBlock[ comp ][ src + 2 ], true );
804
- dataView.setUint16( offset + 3 * INT16_SIZE * type, rowBlock[ comp ][ src + 3 ], true );
805
- dataView.setUint16( offset + 4 * INT16_SIZE * type, rowBlock[ comp ][ src + 4 ], true );
806
- dataView.setUint16( offset + 5 * INT16_SIZE * type, rowBlock[ comp ][ src + 5 ], true );
807
- dataView.setUint16( offset + 6 * INT16_SIZE * type, rowBlock[ comp ][ src + 6 ], true );
808
- dataView.setUint16( offset + 7 * INT16_SIZE * type, rowBlock[ comp ][ src + 7 ], true );
809
- offset += 8 * INT16_SIZE * type;
810
-
811
- }
812
-
813
- }
814
-
815
- // handle partial X blocks
816
- if ( numFullBlocksX != numBlocksX ) {
817
-
818
- for ( let y = 8 * blocky; y < 8 * blocky + maxY; ++ y ) {
819
-
820
- const offset = rowOffsets[ comp ][ y ] + 8 * numFullBlocksX * INT16_SIZE * type;
821
- const src = numFullBlocksX * 64 + ( y & 0x7 ) * 8;
822
- for ( let x = 0; x < maxX; ++ x ) {
823
-
824
- dataView.setUint16( offset + x * INT16_SIZE * type, rowBlock[ comp ][ src + x ], true );
825
-
826
- }
827
-
828
- }
829
-
830
- }
831
-
832
- } // comp
833
-
834
- } // blocky
835
-
836
- const halfRow = new Uint16Array( width );
837
- dataView = new DataView( outBuffer.buffer );
838
-
839
- // convert channels back to float, if needed
840
- for ( let comp = 0; comp < numComp; ++ comp ) {
841
-
842
- channelData[ cscSet.idx[ comp ] ].decoded = true;
843
- const type = channelData[ cscSet.idx[ comp ] ].type;
844
- if ( channelData[ comp ].type != 2 ) continue;
845
- for ( let y = 0; y < height; ++ y ) {
846
-
847
- const offset = rowOffsets[ comp ][ y ];
848
- for ( let x = 0; x < width; ++ x ) {
849
-
850
- halfRow[ x ] = dataView.getUint16( offset + x * INT16_SIZE * type, true );
851
-
852
- }
853
-
854
- for ( let x = 0; x < width; ++ x ) {
855
-
856
- dataView.setFloat32( offset + x * INT16_SIZE * type, decodeFloat16( halfRow[ x ] ), true );
857
-
858
- }
859
-
860
- }
861
-
862
- }
863
-
864
- }
865
-
866
- function unRleAC( currAcComp, acBuffer, halfZigBlock ) {
867
-
868
- let acValue;
869
- let dctComp = 1;
870
- while ( dctComp < 64 ) {
871
-
872
- acValue = acBuffer[ currAcComp.value ];
873
- if ( acValue == 0xff00 ) {
874
-
875
- dctComp = 64;
876
-
877
- } else if ( acValue >> 8 == 0xff ) {
878
-
879
- dctComp += acValue & 0xff;
880
-
881
- } else {
882
-
883
- halfZigBlock[ dctComp ] = acValue;
884
- dctComp ++;
885
-
886
- }
887
-
888
- currAcComp.value ++;
889
-
890
- }
891
-
892
- }
893
-
894
- function unZigZag( src, dst ) {
895
-
896
- dst[ 0 ] = decodeFloat16( src[ 0 ] );
897
- dst[ 1 ] = decodeFloat16( src[ 1 ] );
898
- dst[ 2 ] = decodeFloat16( src[ 5 ] );
899
- dst[ 3 ] = decodeFloat16( src[ 6 ] );
900
- dst[ 4 ] = decodeFloat16( src[ 14 ] );
901
- dst[ 5 ] = decodeFloat16( src[ 15 ] );
902
- dst[ 6 ] = decodeFloat16( src[ 27 ] );
903
- dst[ 7 ] = decodeFloat16( src[ 28 ] );
904
- dst[ 8 ] = decodeFloat16( src[ 2 ] );
905
- dst[ 9 ] = decodeFloat16( src[ 4 ] );
906
- dst[ 10 ] = decodeFloat16( src[ 7 ] );
907
- dst[ 11 ] = decodeFloat16( src[ 13 ] );
908
- dst[ 12 ] = decodeFloat16( src[ 16 ] );
909
- dst[ 13 ] = decodeFloat16( src[ 26 ] );
910
- dst[ 14 ] = decodeFloat16( src[ 29 ] );
911
- dst[ 15 ] = decodeFloat16( src[ 42 ] );
912
- dst[ 16 ] = decodeFloat16( src[ 3 ] );
913
- dst[ 17 ] = decodeFloat16( src[ 8 ] );
914
- dst[ 18 ] = decodeFloat16( src[ 12 ] );
915
- dst[ 19 ] = decodeFloat16( src[ 17 ] );
916
- dst[ 20 ] = decodeFloat16( src[ 25 ] );
917
- dst[ 21 ] = decodeFloat16( src[ 30 ] );
918
- dst[ 22 ] = decodeFloat16( src[ 41 ] );
919
- dst[ 23 ] = decodeFloat16( src[ 43 ] );
920
- dst[ 24 ] = decodeFloat16( src[ 9 ] );
921
- dst[ 25 ] = decodeFloat16( src[ 11 ] );
922
- dst[ 26 ] = decodeFloat16( src[ 18 ] );
923
- dst[ 27 ] = decodeFloat16( src[ 24 ] );
924
- dst[ 28 ] = decodeFloat16( src[ 31 ] );
925
- dst[ 29 ] = decodeFloat16( src[ 40 ] );
926
- dst[ 30 ] = decodeFloat16( src[ 44 ] );
927
- dst[ 31 ] = decodeFloat16( src[ 53 ] );
928
- dst[ 32 ] = decodeFloat16( src[ 10 ] );
929
- dst[ 33 ] = decodeFloat16( src[ 19 ] );
930
- dst[ 34 ] = decodeFloat16( src[ 23 ] );
931
- dst[ 35 ] = decodeFloat16( src[ 32 ] );
932
- dst[ 36 ] = decodeFloat16( src[ 39 ] );
933
- dst[ 37 ] = decodeFloat16( src[ 45 ] );
934
- dst[ 38 ] = decodeFloat16( src[ 52 ] );
935
- dst[ 39 ] = decodeFloat16( src[ 54 ] );
936
- dst[ 40 ] = decodeFloat16( src[ 20 ] );
937
- dst[ 41 ] = decodeFloat16( src[ 22 ] );
938
- dst[ 42 ] = decodeFloat16( src[ 33 ] );
939
- dst[ 43 ] = decodeFloat16( src[ 38 ] );
940
- dst[ 44 ] = decodeFloat16( src[ 46 ] );
941
- dst[ 45 ] = decodeFloat16( src[ 51 ] );
942
- dst[ 46 ] = decodeFloat16( src[ 55 ] );
943
- dst[ 47 ] = decodeFloat16( src[ 60 ] );
944
- dst[ 48 ] = decodeFloat16( src[ 21 ] );
945
- dst[ 49 ] = decodeFloat16( src[ 34 ] );
946
- dst[ 50 ] = decodeFloat16( src[ 37 ] );
947
- dst[ 51 ] = decodeFloat16( src[ 47 ] );
948
- dst[ 52 ] = decodeFloat16( src[ 50 ] );
949
- dst[ 53 ] = decodeFloat16( src[ 56 ] );
950
- dst[ 54 ] = decodeFloat16( src[ 59 ] );
951
- dst[ 55 ] = decodeFloat16( src[ 61 ] );
952
- dst[ 56 ] = decodeFloat16( src[ 35 ] );
953
- dst[ 57 ] = decodeFloat16( src[ 36 ] );
954
- dst[ 58 ] = decodeFloat16( src[ 48 ] );
955
- dst[ 59 ] = decodeFloat16( src[ 49 ] );
956
- dst[ 60 ] = decodeFloat16( src[ 57 ] );
957
- dst[ 61 ] = decodeFloat16( src[ 58 ] );
958
- dst[ 62 ] = decodeFloat16( src[ 62 ] );
959
- dst[ 63 ] = decodeFloat16( src[ 63 ] );
960
-
961
- }
962
-
963
- function dctInverse( data ) {
964
-
965
- const a = 0.5 * Math.cos( 3.14159 / 4.0 );
966
- const b = 0.5 * Math.cos( 3.14159 / 16.0 );
967
- const c = 0.5 * Math.cos( 3.14159 / 8.0 );
968
- const d = 0.5 * Math.cos( 3.0 * 3.14159 / 16.0 );
969
- const e = 0.5 * Math.cos( 5.0 * 3.14159 / 16.0 );
970
- const f = 0.5 * Math.cos( 3.0 * 3.14159 / 8.0 );
971
- const g = 0.5 * Math.cos( 7.0 * 3.14159 / 16.0 );
972
- const alpha = new Array( 4 );
973
- const beta = new Array( 4 );
974
- const theta = new Array( 4 );
975
- const gamma = new Array( 4 );
976
- for ( let row = 0; row < 8; ++ row ) {
977
-
978
- const rowPtr = row * 8;
979
- alpha[ 0 ] = c * data[ rowPtr + 2 ];
980
- alpha[ 1 ] = f * data[ rowPtr + 2 ];
981
- alpha[ 2 ] = c * data[ rowPtr + 6 ];
982
- alpha[ 3 ] = f * data[ rowPtr + 6 ];
983
- beta[ 0 ] = b * data[ rowPtr + 1 ] + d * data[ rowPtr + 3 ] + e * data[ rowPtr + 5 ] + g * data[ rowPtr + 7 ];
984
- beta[ 1 ] = d * data[ rowPtr + 1 ] - g * data[ rowPtr + 3 ] - b * data[ rowPtr + 5 ] - e * data[ rowPtr + 7 ];
985
- beta[ 2 ] = e * data[ rowPtr + 1 ] - b * data[ rowPtr + 3 ] + g * data[ rowPtr + 5 ] + d * data[ rowPtr + 7 ];
986
- beta[ 3 ] = g * data[ rowPtr + 1 ] - e * data[ rowPtr + 3 ] + d * data[ rowPtr + 5 ] - b * data[ rowPtr + 7 ];
987
- theta[ 0 ] = a * ( data[ rowPtr + 0 ] + data[ rowPtr + 4 ] );
988
- theta[ 3 ] = a * ( data[ rowPtr + 0 ] - data[ rowPtr + 4 ] );
989
- theta[ 1 ] = alpha[ 0 ] + alpha[ 3 ];
990
- theta[ 2 ] = alpha[ 1 ] - alpha[ 2 ];
991
- gamma[ 0 ] = theta[ 0 ] + theta[ 1 ];
992
- gamma[ 1 ] = theta[ 3 ] + theta[ 2 ];
993
- gamma[ 2 ] = theta[ 3 ] - theta[ 2 ];
994
- gamma[ 3 ] = theta[ 0 ] - theta[ 1 ];
995
- data[ rowPtr + 0 ] = gamma[ 0 ] + beta[ 0 ];
996
- data[ rowPtr + 1 ] = gamma[ 1 ] + beta[ 1 ];
997
- data[ rowPtr + 2 ] = gamma[ 2 ] + beta[ 2 ];
998
- data[ rowPtr + 3 ] = gamma[ 3 ] + beta[ 3 ];
999
- data[ rowPtr + 4 ] = gamma[ 3 ] - beta[ 3 ];
1000
- data[ rowPtr + 5 ] = gamma[ 2 ] - beta[ 2 ];
1001
- data[ rowPtr + 6 ] = gamma[ 1 ] - beta[ 1 ];
1002
- data[ rowPtr + 7 ] = gamma[ 0 ] - beta[ 0 ];
1003
-
1004
- }
1005
-
1006
- for ( let column = 0; column < 8; ++ column ) {
1007
-
1008
- alpha[ 0 ] = c * data[ 16 + column ];
1009
- alpha[ 1 ] = f * data[ 16 + column ];
1010
- alpha[ 2 ] = c * data[ 48 + column ];
1011
- alpha[ 3 ] = f * data[ 48 + column ];
1012
- beta[ 0 ] = b * data[ 8 + column ] + d * data[ 24 + column ] + e * data[ 40 + column ] + g * data[ 56 + column ];
1013
- beta[ 1 ] = d * data[ 8 + column ] - g * data[ 24 + column ] - b * data[ 40 + column ] - e * data[ 56 + column ];
1014
- beta[ 2 ] = e * data[ 8 + column ] - b * data[ 24 + column ] + g * data[ 40 + column ] + d * data[ 56 + column ];
1015
- beta[ 3 ] = g * data[ 8 + column ] - e * data[ 24 + column ] + d * data[ 40 + column ] - b * data[ 56 + column ];
1016
- theta[ 0 ] = a * ( data[ column ] + data[ 32 + column ] );
1017
- theta[ 3 ] = a * ( data[ column ] - data[ 32 + column ] );
1018
- theta[ 1 ] = alpha[ 0 ] + alpha[ 3 ];
1019
- theta[ 2 ] = alpha[ 1 ] - alpha[ 2 ];
1020
- gamma[ 0 ] = theta[ 0 ] + theta[ 1 ];
1021
- gamma[ 1 ] = theta[ 3 ] + theta[ 2 ];
1022
- gamma[ 2 ] = theta[ 3 ] - theta[ 2 ];
1023
- gamma[ 3 ] = theta[ 0 ] - theta[ 1 ];
1024
- data[ 0 + column ] = gamma[ 0 ] + beta[ 0 ];
1025
- data[ 8 + column ] = gamma[ 1 ] + beta[ 1 ];
1026
- data[ 16 + column ] = gamma[ 2 ] + beta[ 2 ];
1027
- data[ 24 + column ] = gamma[ 3 ] + beta[ 3 ];
1028
- data[ 32 + column ] = gamma[ 3 ] - beta[ 3 ];
1029
- data[ 40 + column ] = gamma[ 2 ] - beta[ 2 ];
1030
- data[ 48 + column ] = gamma[ 1 ] - beta[ 1 ];
1031
- data[ 56 + column ] = gamma[ 0 ] - beta[ 0 ];
1032
-
1033
- }
1034
-
1035
- }
1036
-
1037
- function csc709Inverse( data ) {
1038
-
1039
- for ( let i = 0; i < 64; ++ i ) {
1040
-
1041
- const y = data[ 0 ][ i ];
1042
- const cb = data[ 1 ][ i ];
1043
- const cr = data[ 2 ][ i ];
1044
- data[ 0 ][ i ] = y + 1.5747 * cr;
1045
- data[ 1 ][ i ] = y - 0.1873 * cb - 0.4682 * cr;
1046
- data[ 2 ][ i ] = y + 1.8556 * cb;
1047
-
1048
- }
1049
-
1050
- }
1051
-
1052
- function convertToHalf( src, dst, idx ) {
1053
-
1054
- for ( let i = 0; i < 64; ++ i ) {
1055
-
1056
- dst[ idx + i ] = THREE.DataUtils.toHalfFloat( toLinear( src[ i ] ) );
1057
-
1058
- }
1059
-
1060
- }
1061
-
1062
- function toLinear( float ) {
1063
-
1064
- if ( float <= 1 ) {
1065
-
1066
- return Math.sign( float ) * Math.pow( Math.abs( float ), 2.2 );
1067
-
1068
- } else {
1069
-
1070
- return Math.sign( float ) * Math.pow( logBase, Math.abs( float ) - 1.0 );
1071
-
1072
- }
1073
-
1074
- }
1075
-
1076
- function uncompressRAW( info ) {
1077
-
1078
- return new DataView( info.array.buffer, info.offset.value, info.size );
1079
-
1080
- }
1081
-
1082
- function uncompressRLE( info ) {
1083
-
1084
- const compressed = info.viewer.buffer.slice( info.offset.value, info.offset.value + info.size );
1085
- const rawBuffer = new Uint8Array( decodeRunLength( compressed ) );
1086
- const tmpBuffer = new Uint8Array( rawBuffer.length );
1087
- predictor( rawBuffer ); // revert predictor
1088
-
1089
- interleaveScalar( rawBuffer, tmpBuffer ); // interleave pixels
1090
-
1091
- return new DataView( tmpBuffer.buffer );
1092
-
1093
- }
1094
-
1095
- function uncompressZIP( info ) {
1096
-
1097
- const compressed = info.array.slice( info.offset.value, info.offset.value + info.size );
1098
- if ( typeof fflate === 'undefined' ) {
1099
-
1100
- console.error( 'THREE.EXRLoader: External library fflate.min.js required.' );
1101
-
1102
- }
1103
-
1104
- const rawBuffer = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
1105
- const tmpBuffer = new Uint8Array( rawBuffer.length );
1106
- predictor( rawBuffer ); // revert predictor
1107
-
1108
- interleaveScalar( rawBuffer, tmpBuffer ); // interleave pixels
1109
-
1110
- return new DataView( tmpBuffer.buffer );
1111
-
1112
- }
1113
-
1114
- function uncompressPIZ( info ) {
1115
-
1116
- const inDataView = info.viewer;
1117
- const inOffset = {
1118
- value: info.offset.value
1119
- };
1120
- const outBuffer = new Uint16Array( info.width * info.scanlineBlockSize * ( info.channels * info.type ) );
1121
- const bitmap = new Uint8Array( BITMAP_SIZE );
1122
-
1123
- // Setup channel info
1124
- let outBufferEnd = 0;
1125
- const pizChannelData = new Array( info.channels );
1126
- for ( let i = 0; i < info.channels; i ++ ) {
1127
-
1128
- pizChannelData[ i ] = {};
1129
- pizChannelData[ i ][ 'start' ] = outBufferEnd;
1130
- pizChannelData[ i ][ 'end' ] = pizChannelData[ i ][ 'start' ];
1131
- pizChannelData[ i ][ 'nx' ] = info.width;
1132
- pizChannelData[ i ][ 'ny' ] = info.lines;
1133
- pizChannelData[ i ][ 'size' ] = info.type;
1134
- outBufferEnd += pizChannelData[ i ].nx * pizChannelData[ i ].ny * pizChannelData[ i ].size;
1135
-
1136
- }
1137
-
1138
- // Read range compression data
1139
-
1140
- const minNonZero = parseUint16( inDataView, inOffset );
1141
- const maxNonZero = parseUint16( inDataView, inOffset );
1142
- if ( maxNonZero >= BITMAP_SIZE ) {
1143
-
1144
- throw new Error( 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE' );
1145
-
1146
- }
1147
-
1148
- if ( minNonZero <= maxNonZero ) {
1149
-
1150
- for ( let i = 0; i < maxNonZero - minNonZero + 1; i ++ ) {
1151
-
1152
- bitmap[ i + minNonZero ] = parseUint8( inDataView, inOffset );
1153
-
1154
- }
1155
-
1156
- }
1157
-
1158
- // Reverse LUT
1159
- const lut = new Uint16Array( USHORT_RANGE );
1160
- const maxValue = reverseLutFromBitmap( bitmap, lut );
1161
- const length = parseUint32( inDataView, inOffset );
1162
-
1163
- // Huffman decoding
1164
- hufUncompress( info.array, inDataView, inOffset, length, outBuffer, outBufferEnd );
1165
-
1166
- // Wavelet decoding
1167
- for ( let i = 0; i < info.channels; ++ i ) {
1168
-
1169
- const cd = pizChannelData[ i ];
1170
- for ( let j = 0; j < pizChannelData[ i ].size; ++ j ) {
1171
-
1172
- wav2Decode( outBuffer, cd.start + j, cd.nx, cd.size, cd.ny, cd.nx * cd.size, maxValue );
1173
-
1174
- }
1175
-
1176
- }
1177
-
1178
- // Expand the pixel data to their original range
1179
- applyLut( lut, outBuffer, outBufferEnd );
1180
-
1181
- // Rearrange the pixel data into the format expected by the caller.
1182
- let tmpOffset = 0;
1183
- const tmpBuffer = new Uint8Array( outBuffer.buffer.byteLength );
1184
- for ( let y = 0; y < info.lines; y ++ ) {
1185
-
1186
- for ( let c = 0; c < info.channels; c ++ ) {
1187
-
1188
- const cd = pizChannelData[ c ];
1189
- const n = cd.nx * cd.size;
1190
- const cp = new Uint8Array( outBuffer.buffer, cd.end * INT16_SIZE, n * INT16_SIZE );
1191
- tmpBuffer.set( cp, tmpOffset );
1192
- tmpOffset += n * INT16_SIZE;
1193
- cd.end += n;
1194
-
1195
- }
1196
-
1197
- }
1198
-
1199
- return new DataView( tmpBuffer.buffer );
1200
-
1201
- }
1202
-
1203
- function uncompressPXR( info ) {
1204
-
1205
- const compressed = info.array.slice( info.offset.value, info.offset.value + info.size );
1206
- if ( typeof fflate === 'undefined' ) {
1207
-
1208
- console.error( 'THREE.EXRLoader: External library fflate.min.js required.' );
1209
-
1210
- }
1211
-
1212
- const rawBuffer = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
1213
-
1214
- const sz = info.lines * info.channels * info.width;
1215
- const tmpBuffer = info.type == 1 ? new Uint16Array( sz ) : new Uint32Array( sz );
1216
- let tmpBufferEnd = 0;
1217
- let writePtr = 0;
1218
- const ptr = new Array( 4 );
1219
- for ( let y = 0; y < info.lines; y ++ ) {
1220
-
1221
- for ( let c = 0; c < info.channels; c ++ ) {
1222
-
1223
- let pixel = 0;
1224
- switch ( info.type ) {
1225
-
1226
- case 1:
1227
- ptr[ 0 ] = tmpBufferEnd;
1228
- ptr[ 1 ] = ptr[ 0 ] + info.width;
1229
- tmpBufferEnd = ptr[ 1 ] + info.width;
1230
- for ( let j = 0; j < info.width; ++ j ) {
1231
-
1232
- const diff = rawBuffer[ ptr[ 0 ] ++ ] << 8 | rawBuffer[ ptr[ 1 ] ++ ];
1233
- pixel += diff;
1234
- tmpBuffer[ writePtr ] = pixel;
1235
- writePtr ++;
1236
-
1237
- }
1238
-
1239
- break;
1240
- case 2:
1241
- ptr[ 0 ] = tmpBufferEnd;
1242
- ptr[ 1 ] = ptr[ 0 ] + info.width;
1243
- ptr[ 2 ] = ptr[ 1 ] + info.width;
1244
- tmpBufferEnd = ptr[ 2 ] + info.width;
1245
- for ( let j = 0; j < info.width; ++ j ) {
1246
-
1247
- const diff = rawBuffer[ ptr[ 0 ] ++ ] << 24 | rawBuffer[ ptr[ 1 ] ++ ] << 16 | rawBuffer[ ptr[ 2 ] ++ ] << 8;
1248
- pixel += diff;
1249
- tmpBuffer[ writePtr ] = pixel;
1250
- writePtr ++;
1251
-
1252
- }
1253
-
1254
- break;
1255
-
1256
- }
1257
-
1258
- }
1259
-
1260
- }
1261
-
1262
- return new DataView( tmpBuffer.buffer );
1263
-
1264
- }
1265
-
1266
- function uncompressDWA( info ) {
1267
-
1268
- const inDataView = info.viewer;
1269
- const inOffset = {
1270
- value: info.offset.value
1271
- };
1272
- const outBuffer = new Uint8Array( info.width * info.lines * ( info.channels * info.type * INT16_SIZE ) );
1273
-
1274
- // Read compression header information
1275
- const dwaHeader = {
1276
- version: parseInt64( inDataView, inOffset ),
1277
- unknownUncompressedSize: parseInt64( inDataView, inOffset ),
1278
- unknownCompressedSize: parseInt64( inDataView, inOffset ),
1279
- acCompressedSize: parseInt64( inDataView, inOffset ),
1280
- dcCompressedSize: parseInt64( inDataView, inOffset ),
1281
- rleCompressedSize: parseInt64( inDataView, inOffset ),
1282
- rleUncompressedSize: parseInt64( inDataView, inOffset ),
1283
- rleRawSize: parseInt64( inDataView, inOffset ),
1284
- totalAcUncompressedCount: parseInt64( inDataView, inOffset ),
1285
- totalDcUncompressedCount: parseInt64( inDataView, inOffset ),
1286
- acCompression: parseInt64( inDataView, inOffset )
1287
- };
1288
- if ( dwaHeader.version < 2 ) throw new Error( 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported' );
1289
-
1290
- // Read channel ruleset information
1291
- const channelRules = new Array();
1292
- let ruleSize = parseUint16( inDataView, inOffset ) - INT16_SIZE;
1293
- while ( ruleSize > 0 ) {
1294
-
1295
- const name = parseNullTerminatedString( inDataView.buffer, inOffset );
1296
- const value = parseUint8( inDataView, inOffset );
1297
- const compression = value >> 2 & 3;
1298
- const csc = ( value >> 4 ) - 1;
1299
- const index = new Int8Array( [ csc ] )[ 0 ];
1300
- const type = parseUint8( inDataView, inOffset );
1301
- channelRules.push( {
1302
- name: name,
1303
- index: index,
1304
- type: type,
1305
- compression: compression
1306
- } );
1307
- ruleSize -= name.length + 3;
1308
-
1309
- }
1310
-
1311
- // Classify channels
1312
- const channels = EXRHeader.channels;
1313
- const channelData = new Array( info.channels );
1314
- for ( let i = 0; i < info.channels; ++ i ) {
1315
-
1316
- const cd = channelData[ i ] = {};
1317
- const channel = channels[ i ];
1318
- cd.name = channel.name;
1319
- cd.compression = UNKNOWN;
1320
- cd.decoded = false;
1321
- cd.type = channel.pixelType;
1322
- cd.pLinear = channel.pLinear;
1323
- cd.width = info.width;
1324
- cd.height = info.lines;
1325
-
1326
- }
1327
-
1328
- const cscSet = {
1329
- idx: new Array( 3 )
1330
- };
1331
- for ( let offset = 0; offset < info.channels; ++ offset ) {
1332
-
1333
- const cd = channelData[ offset ];
1334
- for ( let i = 0; i < channelRules.length; ++ i ) {
1335
-
1336
- const rule = channelRules[ i ];
1337
- if ( cd.name == rule.name ) {
1338
-
1339
- cd.compression = rule.compression;
1340
- if ( rule.index >= 0 ) {
1341
-
1342
- cscSet.idx[ rule.index ] = offset;
1343
-
1344
- }
1345
-
1346
- cd.offset = offset;
1347
-
1348
- }
1349
-
1350
- }
1351
-
1352
- }
1353
-
1354
- let acBuffer, dcBuffer, rleBuffer;
1355
-
1356
- // Read DCT - AC component data
1357
- if ( dwaHeader.acCompressedSize > 0 ) {
1358
-
1359
- switch ( dwaHeader.acCompression ) {
1360
-
1361
- case STATIC_HUFFMAN:
1362
- acBuffer = new Uint16Array( dwaHeader.totalAcUncompressedCount );
1363
- hufUncompress( info.array, inDataView, inOffset, dwaHeader.acCompressedSize, acBuffer, dwaHeader.totalAcUncompressedCount );
1364
- break;
1365
- case DEFLATE:
1366
- const compressed = info.array.slice( inOffset.value, inOffset.value + dwaHeader.totalAcUncompressedCount );
1367
- const data = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
1368
- acBuffer = new Uint16Array( data.buffer );
1369
- inOffset.value += dwaHeader.totalAcUncompressedCount;
1370
- break;
1371
-
1372
- }
1373
-
1374
- }
1375
-
1376
- // Read DCT - DC component data
1377
- if ( dwaHeader.dcCompressedSize > 0 ) {
1378
-
1379
- const zlibInfo = {
1380
- array: info.array,
1381
- offset: inOffset,
1382
- size: dwaHeader.dcCompressedSize
1383
- };
1384
- dcBuffer = new Uint16Array( uncompressZIP( zlibInfo ).buffer );
1385
- inOffset.value += dwaHeader.dcCompressedSize;
1386
-
1387
- }
1388
-
1389
- // Read RLE compressed data
1390
- if ( dwaHeader.rleRawSize > 0 ) {
1391
-
1392
- const compressed = info.array.slice( inOffset.value, inOffset.value + dwaHeader.rleCompressedSize );
1393
- const data = fflate.unzlibSync( compressed ); // eslint-disable-line no-undef
1394
- rleBuffer = decodeRunLength( data.buffer );
1395
- inOffset.value += dwaHeader.rleCompressedSize;
1396
-
1397
- }
1398
-
1399
- // Prepare outbuffer data offset
1400
- let outBufferEnd = 0;
1401
- const rowOffsets = new Array( channelData.length );
1402
- for ( let i = 0; i < rowOffsets.length; ++ i ) {
1403
-
1404
- rowOffsets[ i ] = new Array();
1405
-
1406
- }
1407
-
1408
- for ( let y = 0; y < info.lines; ++ y ) {
1409
-
1410
- for ( let chan = 0; chan < channelData.length; ++ chan ) {
1411
-
1412
- rowOffsets[ chan ].push( outBufferEnd );
1413
- outBufferEnd += channelData[ chan ].width * info.type * INT16_SIZE;
1414
-
1415
- }
1416
-
1417
- }
1418
-
1419
- // Lossy DCT decode RGB channels
1420
- lossyDctDecode( cscSet, rowOffsets, channelData, acBuffer, dcBuffer, outBuffer );
1421
-
1422
- // Decode other channels
1423
- for ( let i = 0; i < channelData.length; ++ i ) {
1424
-
1425
- const cd = channelData[ i ];
1426
- if ( cd.decoded ) continue;
1427
- switch ( cd.compression ) {
1428
-
1429
- case RLE:
1430
- let row = 0;
1431
- let rleOffset = 0;
1432
- for ( let y = 0; y < info.lines; ++ y ) {
1433
-
1434
- let rowOffsetBytes = rowOffsets[ i ][ row ];
1435
- for ( let x = 0; x < cd.width; ++ x ) {
1436
-
1437
- for ( let byte = 0; byte < INT16_SIZE * cd.type; ++ byte ) {
1438
-
1439
- outBuffer[ rowOffsetBytes ++ ] = rleBuffer[ rleOffset + byte * cd.width * cd.height ];
1440
-
1441
- }
1442
-
1443
- rleOffset ++;
1444
-
1445
- }
1446
-
1447
- row ++;
1448
-
1449
- }
1450
-
1451
- break;
1452
- case LOSSY_DCT: // skip
1453
-
1454
- default:
1455
- throw new Error( 'EXRLoader.parse: unsupported channel compression' );
1456
-
1457
- }
1458
-
1459
- }
1460
-
1461
- return new DataView( outBuffer.buffer );
1462
-
1463
- }
1464
-
1465
- function parseNullTerminatedString( buffer, offset ) {
1466
-
1467
- const uintBuffer = new Uint8Array( buffer );
1468
- let endOffset = 0;
1469
- while ( uintBuffer[ offset.value + endOffset ] != 0 ) {
1470
-
1471
- endOffset += 1;
1472
-
1473
- }
1474
-
1475
- const stringValue = new TextDecoder().decode( uintBuffer.slice( offset.value, offset.value + endOffset ) );
1476
- offset.value = offset.value + endOffset + 1;
1477
- return stringValue;
1478
-
1479
- }
1480
-
1481
- function parseFixedLengthString( buffer, offset, size ) {
1482
-
1483
- const stringValue = new TextDecoder().decode( new Uint8Array( buffer ).slice( offset.value, offset.value + size ) );
1484
- offset.value = offset.value + size;
1485
- return stringValue;
1486
-
1487
- }
1488
-
1489
- function parseRational( dataView, offset ) {
1490
-
1491
- const x = parseInt32( dataView, offset );
1492
- const y = parseUint32( dataView, offset );
1493
- return [ x, y ];
1494
-
1495
- }
1496
-
1497
- function parseTimecode( dataView, offset ) {
1498
-
1499
- const x = parseUint32( dataView, offset );
1500
- const y = parseUint32( dataView, offset );
1501
- return [ x, y ];
1502
-
1503
- }
1504
-
1505
- function parseInt32( dataView, offset ) {
1506
-
1507
- const Int32 = dataView.getInt32( offset.value, true );
1508
- offset.value = offset.value + INT32_SIZE;
1509
- return Int32;
1510
-
1511
- }
1512
-
1513
- function parseUint32( dataView, offset ) {
1514
-
1515
- const Uint32 = dataView.getUint32( offset.value, true );
1516
- offset.value = offset.value + INT32_SIZE;
1517
- return Uint32;
1518
-
1519
- }
1520
-
1521
- function parseUint8Array( uInt8Array, offset ) {
1522
-
1523
- const Uint8 = uInt8Array[ offset.value ];
1524
- offset.value = offset.value + INT8_SIZE;
1525
- return Uint8;
1526
-
1527
- }
1528
-
1529
- function parseUint8( dataView, offset ) {
1530
-
1531
- const Uint8 = dataView.getUint8( offset.value );
1532
- offset.value = offset.value + INT8_SIZE;
1533
- return Uint8;
1534
-
1535
- }
1536
-
1537
- const parseInt64 = function ( dataView, offset ) {
1538
-
1539
- const Int64 = Number( dataView.getBigInt64( offset.value, true ) );
1540
- offset.value += ULONG_SIZE;
1541
- return Int64;
1542
-
1543
- };
1544
-
1545
- function parseFloat32( dataView, offset ) {
1546
-
1547
- const float = dataView.getFloat32( offset.value, true );
1548
- offset.value += FLOAT32_SIZE;
1549
- return float;
1550
-
1551
- }
1552
-
1553
- function decodeFloat32( dataView, offset ) {
1554
-
1555
- return THREE.DataUtils.toHalfFloat( parseFloat32( dataView, offset ) );
1556
-
1557
- }
1558
-
1559
- // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript
1560
- function decodeFloat16( binary ) {
1561
-
1562
- const exponent = ( binary & 0x7C00 ) >> 10,
1563
- fraction = binary & 0x03FF;
1564
- return ( binary >> 15 ? - 1 : 1 ) * ( exponent ? exponent === 0x1F ? fraction ? NaN : Infinity : Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) : 6.103515625e-5 * ( fraction / 0x400 ) );
1565
-
1566
- }
1567
-
1568
- function parseUint16( dataView, offset ) {
1569
-
1570
- const Uint16 = dataView.getUint16( offset.value, true );
1571
- offset.value += INT16_SIZE;
1572
- return Uint16;
1573
-
1574
- }
1575
-
1576
- function parseFloat16( buffer, offset ) {
1577
-
1578
- return decodeFloat16( parseUint16( buffer, offset ) );
1579
-
1580
- }
1581
-
1582
- function parseChlist( dataView, buffer, offset, size ) {
1583
-
1584
- const startOffset = offset.value;
1585
- const channels = [];
1586
- while ( offset.value < startOffset + size - 1 ) {
1587
-
1588
- const name = parseNullTerminatedString( buffer, offset );
1589
- const pixelType = parseInt32( dataView, offset );
1590
- const pLinear = parseUint8( dataView, offset );
1591
- offset.value += 3; // reserved, three chars
1592
- const xSampling = parseInt32( dataView, offset );
1593
- const ySampling = parseInt32( dataView, offset );
1594
- channels.push( {
1595
- name: name,
1596
- pixelType: pixelType,
1597
- pLinear: pLinear,
1598
- xSampling: xSampling,
1599
- ySampling: ySampling
1600
- } );
1601
-
1602
- }
1603
-
1604
- offset.value += 1;
1605
- return channels;
1606
-
1607
- }
1608
-
1609
- function parseChromaticities( dataView, offset ) {
1610
-
1611
- const redX = parseFloat32( dataView, offset );
1612
- const redY = parseFloat32( dataView, offset );
1613
- const greenX = parseFloat32( dataView, offset );
1614
- const greenY = parseFloat32( dataView, offset );
1615
- const blueX = parseFloat32( dataView, offset );
1616
- const blueY = parseFloat32( dataView, offset );
1617
- const whiteX = parseFloat32( dataView, offset );
1618
- const whiteY = parseFloat32( dataView, offset );
1619
- return {
1620
- redX: redX,
1621
- redY: redY,
1622
- greenX: greenX,
1623
- greenY: greenY,
1624
- blueX: blueX,
1625
- blueY: blueY,
1626
- whiteX: whiteX,
1627
- whiteY: whiteY
1628
- };
1629
-
1630
- }
1631
-
1632
- function parseCompression( dataView, offset ) {
1633
-
1634
- const compressionCodes = [ 'NO_COMPRESSION', 'RLE_COMPRESSION', 'ZIPS_COMPRESSION', 'ZIP_COMPRESSION', 'PIZ_COMPRESSION', 'PXR24_COMPRESSION', 'B44_COMPRESSION', 'B44A_COMPRESSION', 'DWAA_COMPRESSION', 'DWAB_COMPRESSION' ];
1635
- const compression = parseUint8( dataView, offset );
1636
- return compressionCodes[ compression ];
1637
-
1638
- }
1639
-
1640
- function parseBox2i( dataView, offset ) {
1641
-
1642
- const xMin = parseUint32( dataView, offset );
1643
- const yMin = parseUint32( dataView, offset );
1644
- const xMax = parseUint32( dataView, offset );
1645
- const yMax = parseUint32( dataView, offset );
1646
- return {
1647
- xMin: xMin,
1648
- yMin: yMin,
1649
- xMax: xMax,
1650
- yMax: yMax
1651
- };
1652
-
1653
- }
1654
-
1655
- function parseLineOrder( dataView, offset ) {
1656
-
1657
- const lineOrders = [ 'INCREASING_Y' ];
1658
- const lineOrder = parseUint8( dataView, offset );
1659
- return lineOrders[ lineOrder ];
1660
-
1661
- }
1662
-
1663
- function parseV2f( dataView, offset ) {
1664
-
1665
- const x = parseFloat32( dataView, offset );
1666
- const y = parseFloat32( dataView, offset );
1667
- return [ x, y ];
1668
-
1669
- }
1670
-
1671
- function parseV3f( dataView, offset ) {
1672
-
1673
- const x = parseFloat32( dataView, offset );
1674
- const y = parseFloat32( dataView, offset );
1675
- const z = parseFloat32( dataView, offset );
1676
- return [ x, y, z ];
1677
-
1678
- }
1679
-
1680
- function parseValue( dataView, buffer, offset, type, size ) {
1681
-
1682
- if ( type === 'string' || type === 'stringvector' || type === 'iccProfile' ) {
1683
-
1684
- return parseFixedLengthString( buffer, offset, size );
1685
-
1686
- } else if ( type === 'chlist' ) {
1687
-
1688
- return parseChlist( dataView, buffer, offset, size );
1689
-
1690
- } else if ( type === 'chromaticities' ) {
1691
-
1692
- return parseChromaticities( dataView, offset );
1693
-
1694
- } else if ( type === 'compression' ) {
1695
-
1696
- return parseCompression( dataView, offset );
1697
-
1698
- } else if ( type === 'box2i' ) {
1699
-
1700
- return parseBox2i( dataView, offset );
1701
-
1702
- } else if ( type === 'lineOrder' ) {
1703
-
1704
- return parseLineOrder( dataView, offset );
1705
-
1706
- } else if ( type === 'float' ) {
1707
-
1708
- return parseFloat32( dataView, offset );
1709
-
1710
- } else if ( type === 'v2f' ) {
1711
-
1712
- return parseV2f( dataView, offset );
1713
-
1714
- } else if ( type === 'v3f' ) {
1715
-
1716
- return parseV3f( dataView, offset );
1717
-
1718
- } else if ( type === 'int' ) {
1719
-
1720
- return parseInt32( dataView, offset );
1721
-
1722
- } else if ( type === 'rational' ) {
1723
-
1724
- return parseRational( dataView, offset );
1725
-
1726
- } else if ( type === 'timecode' ) {
1727
-
1728
- return parseTimecode( dataView, offset );
1729
-
1730
- } else if ( type === 'preview' ) {
1731
-
1732
- offset.value += size;
1733
- return 'skipped';
1734
-
1735
- } else {
1736
-
1737
- offset.value += size;
1738
- return undefined;
1739
-
1740
- }
1741
-
1742
- }
1743
-
1744
- function parseHeader( dataView, buffer, offset ) {
1745
-
1746
- const EXRHeader = {};
1747
- if ( dataView.getUint32( 0, true ) != 20000630 ) {
1748
-
1749
- // magic
1750
-
1751
- throw new Error( 'THREE.EXRLoader: provided file doesn\'t appear to be in OpenEXR format.' );
1752
-
1753
- }
1754
-
1755
- EXRHeader.version = dataView.getUint8( 4 );
1756
- const spec = dataView.getUint8( 5 ); // fullMask
1757
-
1758
- EXRHeader.spec = {
1759
- singleTile: !! ( spec & 2 ),
1760
- longName: !! ( spec & 4 ),
1761
- deepFormat: !! ( spec & 8 ),
1762
- multiPart: !! ( spec & 16 )
1763
- };
1764
-
1765
- // start of header
1766
-
1767
- offset.value = 8; // start at 8 - after pre-amble
1768
-
1769
- let keepReading = true;
1770
- while ( keepReading ) {
1771
-
1772
- const attributeName = parseNullTerminatedString( buffer, offset );
1773
- if ( attributeName == 0 ) {
1774
-
1775
- keepReading = false;
1776
-
1777
- } else {
1778
-
1779
- const attributeType = parseNullTerminatedString( buffer, offset );
1780
- const attributeSize = parseUint32( dataView, offset );
1781
- const attributeValue = parseValue( dataView, buffer, offset, attributeType, attributeSize );
1782
- if ( attributeValue === undefined ) {
1783
-
1784
- console.warn( `EXRLoader.parse: skipped unknown header attribute type \'${attributeType}\'.` );
1785
-
1786
- } else {
1787
-
1788
- EXRHeader[ attributeName ] = attributeValue;
1789
-
1790
- }
1791
-
1792
- }
1793
-
1794
- }
1795
-
1796
- if ( ( spec & ~ 0x04 ) != 0 ) {
1797
-
1798
- // unsupported tiled, deep-image, multi-part
1799
-
1800
- console.error( 'EXRHeader:', EXRHeader );
1801
- throw new Error( 'THREE.EXRLoader: provided file is currently unsupported.' );
1802
-
1803
- }
1804
-
1805
- return EXRHeader;
1806
-
1807
- }
1808
-
1809
- function setupDecoder( EXRHeader, dataView, uInt8Array, offset, outputType ) {
1810
-
1811
- const EXRDecoder = {
1812
- size: 0,
1813
- viewer: dataView,
1814
- array: uInt8Array,
1815
- offset: offset,
1816
- width: EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1,
1817
- height: EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1,
1818
- channels: EXRHeader.channels.length,
1819
- bytesPerLine: null,
1820
- lines: null,
1821
- inputSize: null,
1822
- type: EXRHeader.channels[ 0 ].pixelType,
1823
- uncompress: null,
1824
- getter: null,
1825
- format: null,
1826
- encoding: null
1827
- };
1828
- switch ( EXRHeader.compression ) {
1829
-
1830
- case 'NO_COMPRESSION':
1831
- EXRDecoder.lines = 1;
1832
- EXRDecoder.uncompress = uncompressRAW;
1833
- break;
1834
- case 'RLE_COMPRESSION':
1835
- EXRDecoder.lines = 1;
1836
- EXRDecoder.uncompress = uncompressRLE;
1837
- break;
1838
- case 'ZIPS_COMPRESSION':
1839
- EXRDecoder.lines = 1;
1840
- EXRDecoder.uncompress = uncompressZIP;
1841
- break;
1842
- case 'ZIP_COMPRESSION':
1843
- EXRDecoder.lines = 16;
1844
- EXRDecoder.uncompress = uncompressZIP;
1845
- break;
1846
- case 'PIZ_COMPRESSION':
1847
- EXRDecoder.lines = 32;
1848
- EXRDecoder.uncompress = uncompressPIZ;
1849
- break;
1850
- case 'PXR24_COMPRESSION':
1851
- EXRDecoder.lines = 16;
1852
- EXRDecoder.uncompress = uncompressPXR;
1853
- break;
1854
- case 'DWAA_COMPRESSION':
1855
- EXRDecoder.lines = 32;
1856
- EXRDecoder.uncompress = uncompressDWA;
1857
- break;
1858
- case 'DWAB_COMPRESSION':
1859
- EXRDecoder.lines = 256;
1860
- EXRDecoder.uncompress = uncompressDWA;
1861
- break;
1862
- default:
1863
- throw new Error( 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported' );
1864
-
1865
- }
1866
-
1867
- EXRDecoder.scanlineBlockSize = EXRDecoder.lines;
1868
- if ( EXRDecoder.type == 1 ) {
1869
-
1870
- // half
1871
- switch ( outputType ) {
1872
-
1873
- case THREE.FloatType:
1874
- EXRDecoder.getter = parseFloat16;
1875
- EXRDecoder.inputSize = INT16_SIZE;
1876
- break;
1877
- case THREE.HalfFloatType:
1878
- EXRDecoder.getter = parseUint16;
1879
- EXRDecoder.inputSize = INT16_SIZE;
1880
- break;
1881
-
1882
- }
1883
-
1884
- } else if ( EXRDecoder.type == 2 ) {
1885
-
1886
- // float
1887
- switch ( outputType ) {
1888
-
1889
- case THREE.FloatType:
1890
- EXRDecoder.getter = parseFloat32;
1891
- EXRDecoder.inputSize = FLOAT32_SIZE;
1892
- break;
1893
- case THREE.HalfFloatType:
1894
- EXRDecoder.getter = decodeFloat32;
1895
- EXRDecoder.inputSize = FLOAT32_SIZE;
1896
-
1897
- }
1898
-
1899
- } else {
1900
-
1901
- throw new Error( 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.' );
1902
-
1903
- }
1904
-
1905
- EXRDecoder.blockCount = ( EXRHeader.dataWindow.yMax + 1 ) / EXRDecoder.scanlineBlockSize;
1906
- for ( let i = 0; i < EXRDecoder.blockCount; i ++ ) parseInt64( dataView, offset ); // scanlineOffset
1907
-
1908
- // we should be passed the scanline offset table, ready to start reading pixel data.
1909
-
1910
- // RGB images will be converted to RGBA format, preventing software emulation in select devices.
1911
- EXRDecoder.outputChannels = EXRDecoder.channels == 3 ? 4 : EXRDecoder.channels;
1912
- const size = EXRDecoder.width * EXRDecoder.height * EXRDecoder.outputChannels;
1913
- switch ( outputType ) {
1914
-
1915
- case THREE.FloatType:
1916
- EXRDecoder.byteArray = new Float32Array( size );
1917
-
1918
- // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten
1919
- if ( EXRDecoder.channels < EXRDecoder.outputChannels ) EXRDecoder.byteArray.fill( 1, 0, size );
1920
- break;
1921
- case THREE.HalfFloatType:
1922
- EXRDecoder.byteArray = new Uint16Array( size );
1923
- if ( EXRDecoder.channels < EXRDecoder.outputChannels ) EXRDecoder.byteArray.fill( 0x3C00, 0, size ); // Uint16Array holds half float data, 0x3C00 is 1
1924
-
1925
- break;
1926
- default:
1927
- console.error( 'THREE.EXRLoader: unsupported type: ', outputType );
1928
- break;
1929
-
1930
- }
1931
-
1932
- EXRDecoder.bytesPerLine = EXRDecoder.width * EXRDecoder.inputSize * EXRDecoder.channels;
1933
- if ( EXRDecoder.outputChannels == 4 ) {
1934
-
1935
- EXRDecoder.format = THREE.RGBAFormat;
1936
- EXRDecoder.encoding = THREE.LinearEncoding;
1937
-
1938
- } else {
1939
-
1940
- EXRDecoder.format = THREE.RedFormat;
1941
- EXRDecoder.encoding = THREE.LinearEncoding;
1942
-
1943
- }
1944
-
1945
- return EXRDecoder;
1946
-
1947
- }
1948
-
1949
- // start parsing file [START]
1950
-
1951
- const bufferDataView = new DataView( buffer );
1952
- const uInt8Array = new Uint8Array( buffer );
1953
- const offset = {
1954
- value: 0
1955
- };
1956
-
1957
- // get header information and validate format.
1958
- const EXRHeader = parseHeader( bufferDataView, buffer, offset );
1959
-
1960
- // get input compression information and prepare decoding.
1961
- const EXRDecoder = setupDecoder( EXRHeader, bufferDataView, uInt8Array, offset, this.type );
1962
- const tmpOffset = {
1963
- value: 0
1964
- };
1965
- const channelOffsets = {
1966
- R: 0,
1967
- G: 1,
1968
- B: 2,
1969
- A: 3,
1970
- Y: 0
1971
- };
1972
- for ( let scanlineBlockIdx = 0; scanlineBlockIdx < EXRDecoder.height / EXRDecoder.scanlineBlockSize; scanlineBlockIdx ++ ) {
1973
-
1974
- const line = parseUint32( bufferDataView, offset ); // line_no
1975
- EXRDecoder.size = parseUint32( bufferDataView, offset ); // data_len
1976
- EXRDecoder.lines = line + EXRDecoder.scanlineBlockSize > EXRDecoder.height ? EXRDecoder.height - line : EXRDecoder.scanlineBlockSize;
1977
- const isCompressed = EXRDecoder.size < EXRDecoder.lines * EXRDecoder.bytesPerLine;
1978
- const viewer = isCompressed ? EXRDecoder.uncompress( EXRDecoder ) : uncompressRAW( EXRDecoder );
1979
- offset.value += EXRDecoder.size;
1980
- for ( let line_y = 0; line_y < EXRDecoder.scanlineBlockSize; line_y ++ ) {
1981
-
1982
- const true_y = line_y + scanlineBlockIdx * EXRDecoder.scanlineBlockSize;
1983
- if ( true_y >= EXRDecoder.height ) break;
1984
- for ( let channelID = 0; channelID < EXRDecoder.channels; channelID ++ ) {
1985
-
1986
- const cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ];
1987
- for ( let x = 0; x < EXRDecoder.width; x ++ ) {
1988
-
1989
- tmpOffset.value = ( line_y * ( EXRDecoder.channels * EXRDecoder.width ) + channelID * EXRDecoder.width + x ) * EXRDecoder.inputSize;
1990
- const outIndex = ( EXRDecoder.height - 1 - true_y ) * ( EXRDecoder.width * EXRDecoder.outputChannels ) + x * EXRDecoder.outputChannels + cOff;
1991
- EXRDecoder.byteArray[ outIndex ] = EXRDecoder.getter( viewer, tmpOffset );
1992
-
1993
- }
1994
-
1995
- }
1996
-
1997
- }
1998
-
1999
- }
2000
-
2001
- return {
2002
- header: EXRHeader,
2003
- width: EXRDecoder.width,
2004
- height: EXRDecoder.height,
2005
- data: EXRDecoder.byteArray,
2006
- format: EXRDecoder.format,
2007
- encoding: EXRDecoder.encoding,
2008
- type: this.type
2009
- };
2010
-
2011
- }
2012
- setDataType( value ) {
2013
-
2014
- this.type = value;
2015
- return this;
2016
-
2017
- }
2018
- load( url, onLoad, onProgress, onError ) {
2019
-
2020
- function onLoadCallback( texture, texData ) {
2021
-
2022
- texture.encoding = texData.encoding;
2023
- texture.minFilter = THREE.LinearFilter;
2024
- texture.magFilter = THREE.LinearFilter;
2025
- texture.generateMipmaps = false;
2026
- texture.flipY = false;
2027
- if ( onLoad ) onLoad( texture, texData );
2028
-
2029
- }
2030
-
2031
- return super.load( url, onLoadCallback, onProgress, onError );
2032
-
2033
- }
2034
-
2035
- }
2036
-
2037
- THREE.EXRLoader = EXRLoader;
2038
-
2039
- } )();