opal-js_wrap-three 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +4 -4
  4. data/lib/opal/js_wrap/three/version.rb +1 -1
  5. data/lib-opal/js_wrap/three/WebGL.js +102 -0
  6. data/lib-opal/js_wrap/three/animation/AnimationClipCreator.js +116 -0
  7. data/lib-opal/js_wrap/three/animation/CCDIKSolver.js +436 -0
  8. data/lib-opal/js_wrap/three/animation/MMDAnimationHelper.js +941 -0
  9. data/lib-opal/js_wrap/three/animation/MMDPhysics.js +1183 -0
  10. data/lib-opal/js_wrap/three/cameras/CinematicCamera.js +204 -0
  11. data/lib-opal/js_wrap/three/controls/ArcballControls.js +2649 -0
  12. data/lib-opal/js_wrap/three/controls/DragControls.js +234 -0
  13. data/lib-opal/js_wrap/three/controls/FirstPersonControls.js +301 -0
  14. data/lib-opal/js_wrap/three/controls/FlyControls.js +357 -0
  15. data/lib-opal/js_wrap/three/controls/OrbitControls.js +908 -0
  16. data/lib-opal/js_wrap/three/controls/PointerLockControls.js +173 -0
  17. data/lib-opal/js_wrap/three/controls/TrackballControls.js +666 -0
  18. data/lib-opal/js_wrap/three/controls/TransformControls.js +1210 -0
  19. data/lib-opal/js_wrap/three/controls/experimental/CameraControls.js +860 -0
  20. data/lib-opal/js_wrap/three/csm/CSM.js +346 -0
  21. data/lib-opal/js_wrap/three/csm/CSMFrustum.js +123 -0
  22. data/lib-opal/js_wrap/three/csm/CSMHelper.js +197 -0
  23. data/lib-opal/js_wrap/three/csm/CSMShader.js +29 -0
  24. data/lib-opal/js_wrap/three/curves/CurveExtras.js +544 -0
  25. data/lib-opal/js_wrap/three/curves/NURBSCurve.js +122 -0
  26. data/lib-opal/js_wrap/three/curves/NURBSSurface.js +78 -0
  27. data/lib-opal/js_wrap/three/curves/NURBSUtils.js +413 -0
  28. data/lib-opal/js_wrap/three/deprecated/Geometry.js +1373 -0
  29. data/lib-opal/js_wrap/three/effects/AnaglyphEffect.js +113 -0
  30. data/lib-opal/js_wrap/three/effects/AsciiEffect.js +267 -0
  31. data/lib-opal/js_wrap/three/effects/OutlineEffect.js +400 -0
  32. data/lib-opal/js_wrap/three/effects/ParallaxBarrierEffect.js +90 -0
  33. data/lib-opal/js_wrap/three/effects/PeppersGhostEffect.js +160 -0
  34. data/lib-opal/js_wrap/three/effects/StereoEffect.js +63 -0
  35. data/lib-opal/js_wrap/three/environments/DebugEnvironment.js +107 -0
  36. data/lib-opal/js_wrap/three/environments/RoomEnvironment.js +166 -0
  37. data/lib-opal/js_wrap/three/exporters/ColladaExporter.js +442 -0
  38. data/lib-opal/js_wrap/three/exporters/DRACOExporter.js +205 -0
  39. data/lib-opal/js_wrap/three/exporters/GLTFExporter.js +2042 -0
  40. data/lib-opal/js_wrap/three/exporters/MMDExporter.js +189 -0
  41. data/lib-opal/js_wrap/three/exporters/OBJExporter.js +241 -0
  42. data/lib-opal/js_wrap/three/exporters/PLYExporter.js +370 -0
  43. data/lib-opal/js_wrap/three/exporters/STLExporter.js +186 -0
  44. data/lib-opal/js_wrap/three/exporters/USDZExporter.js +402 -0
  45. data/lib-opal/js_wrap/three/geometries/BoxLineGeometry.js +106 -0
  46. data/lib-opal/js_wrap/three/geometries/ConvexGeometry.js +88 -0
  47. data/lib-opal/js_wrap/three/geometries/DecalGeometry.js +302 -0
  48. data/lib-opal/js_wrap/three/geometries/LightningStrike.js +817 -0
  49. data/lib-opal/js_wrap/three/geometries/ParametricGeometries.js +280 -0
  50. data/lib-opal/js_wrap/three/geometries/ParametricGeometry.js +146 -0
  51. data/lib-opal/js_wrap/three/geometries/RoundedBoxGeometry.js +183 -0
  52. data/lib-opal/js_wrap/three/geometries/TeapotGeometry.js +352 -0
  53. data/lib-opal/js_wrap/three/geometries/TextGeometry.js +76 -0
  54. data/lib-opal/js_wrap/three/helpers/LightProbeHelper.js +95 -0
  55. data/lib-opal/js_wrap/three/helpers/PositionalAudioHelper.js +138 -0
  56. data/lib-opal/js_wrap/three/helpers/RectAreaLightHelper.js +115 -0
  57. data/lib-opal/js_wrap/three/helpers/VertexNormalsHelper.js +131 -0
  58. data/lib-opal/js_wrap/three/helpers/VertexTangentsHelper.js +118 -0
  59. data/lib-opal/js_wrap/three/interactive/HTMLMesh.js +307 -0
  60. data/lib-opal/js_wrap/three/interactive/InteractiveGroup.js +138 -0
  61. data/lib-opal/js_wrap/three/interactive/SelectionBox.js +264 -0
  62. data/lib-opal/js_wrap/three/interactive/SelectionHelper.js +88 -0
  63. data/lib-opal/js_wrap/three/libs/OimoPhysics/OimoPhysics.js +46059 -0
  64. data/lib-opal/js_wrap/three/libs/OimoPhysics/index.js +92 -0
  65. data/lib-opal/js_wrap/three/libs/chevrotain.module.min.js +6947 -0
  66. data/lib-opal/js_wrap/three/libs/ecsy.module.js +1999 -0
  67. data/lib-opal/js_wrap/three/libs/fflate.module.js +3002 -0
  68. data/lib-opal/js_wrap/three/libs/flow.module.js +3033 -0
  69. data/lib-opal/js_wrap/three/libs/ktx-parse.module.js +392 -0
  70. data/lib-opal/js_wrap/three/libs/lil-gui.module.min.js +821 -0
  71. data/lib-opal/js_wrap/three/libs/meshopt_decoder.module.js +136 -0
  72. data/lib-opal/js_wrap/three/libs/mmdparser.module.js +11022 -0
  73. data/lib-opal/js_wrap/three/libs/motion-controllers.module.js +589 -0
  74. data/lib-opal/js_wrap/three/libs/opentype.module.min.js +6132 -0
  75. data/lib-opal/js_wrap/three/libs/potpack.module.js +171 -0
  76. data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.js +6781 -0
  77. data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.module.js +6783 -0
  78. data/lib-opal/js_wrap/three/libs/stats.module.js +139 -0
  79. data/lib-opal/js_wrap/three/libs/tween.module.min.js +349 -0
  80. data/lib-opal/js_wrap/three/lights/LightProbeGenerator.js +233 -0
  81. data/lib-opal/js_wrap/three/lights/RectAreaLightUniformsLib.js +75 -0
  82. data/lib-opal/js_wrap/three/lines/Line2.js +66 -0
  83. data/lib-opal/js_wrap/three/lines/LineGeometry.js +122 -0
  84. data/lib-opal/js_wrap/three/lines/LineMaterial.js +227 -0
  85. data/lib-opal/js_wrap/three/lines/LineSegments2.js +312 -0
  86. data/lib-opal/js_wrap/three/lines/LineSegmentsGeometry.js +238 -0
  87. data/lib-opal/js_wrap/three/lines/Wireframe.js +98 -0
  88. data/lib-opal/js_wrap/three/lines/WireframeGeometry2.js +65 -0
  89. data/lib-opal/js_wrap/three/loaders/3DMLoader.js +1230 -0
  90. data/lib-opal/js_wrap/three/loaders/3MFLoader.js +1123 -0
  91. data/lib-opal/js_wrap/three/loaders/AMFLoader.js +445 -0
  92. data/lib-opal/js_wrap/three/loaders/BVHLoader.js +365 -0
  93. data/lib-opal/js_wrap/three/loaders/BasisTextureLoader.js +692 -0
  94. data/lib-opal/js_wrap/three/loaders/ColladaLoader.js +3046 -0
  95. data/lib-opal/js_wrap/three/loaders/DDSLoader.js +264 -0
  96. data/lib-opal/js_wrap/three/loaders/DRACOLoader.js +531 -0
  97. data/lib-opal/js_wrap/three/loaders/EXRLoader.js +1834 -0
  98. data/lib-opal/js_wrap/three/loaders/FBXLoader.js +3125 -0
  99. data/lib-opal/js_wrap/three/loaders/FontLoader.js +201 -0
  100. data/lib-opal/js_wrap/three/loaders/GCodeLoader.js +248 -0
  101. data/lib-opal/js_wrap/three/loaders/GLTFLoader.js +3334 -0
  102. data/lib-opal/js_wrap/three/loaders/HDRCubeTextureLoader.js +144 -0
  103. data/lib-opal/js_wrap/three/loaders/IFCLoader.js +2395 -0
  104. data/lib-opal/js_wrap/three/loaders/KMZLoader.js +142 -0
  105. data/lib-opal/js_wrap/three/loaders/KTX2Loader.js +535 -0
  106. data/lib-opal/js_wrap/three/loaders/KTXLoader.js +202 -0
  107. data/lib-opal/js_wrap/three/loaders/LDrawLoader.js +1737 -0
  108. data/lib-opal/js_wrap/three/loaders/LUT3dlLoader.js +163 -0
  109. data/lib-opal/js_wrap/three/loaders/LUTCubeLoader.js +171 -0
  110. data/lib-opal/js_wrap/three/loaders/LWOLoader.js +831 -0
  111. data/lib-opal/js_wrap/three/loaders/LogLuvLoader.js +713 -0
  112. data/lib-opal/js_wrap/three/loaders/LottieLoader.js +103 -0
  113. data/lib-opal/js_wrap/three/loaders/MD2Loader.js +258 -0
  114. data/lib-opal/js_wrap/three/loaders/MDDLoader.js +116 -0
  115. data/lib-opal/js_wrap/three/loaders/MMDLoader.js +1687 -0
  116. data/lib-opal/js_wrap/three/loaders/MTLLoader.js +465 -0
  117. data/lib-opal/js_wrap/three/loaders/NRRDLoader.js +554 -0
  118. data/lib-opal/js_wrap/three/loaders/NodeMaterialLoader.js +248 -0
  119. data/lib-opal/js_wrap/three/loaders/OBJLoader.js +673 -0
  120. data/lib-opal/js_wrap/three/loaders/PCDLoader.js +322 -0
  121. data/lib-opal/js_wrap/three/loaders/PDBLoader.js +318 -0
  122. data/lib-opal/js_wrap/three/loaders/PLYLoader.js +489 -0
  123. data/lib-opal/js_wrap/three/loaders/PRWMLoader.js +247 -0
  124. data/lib-opal/js_wrap/three/loaders/PVRLoader.js +240 -0
  125. data/lib-opal/js_wrap/three/loaders/RGBELoader.js +462 -0
  126. data/lib-opal/js_wrap/three/loaders/RGBMLoader.js +1169 -0
  127. data/lib-opal/js_wrap/three/loaders/STLLoader.js +345 -0
  128. data/lib-opal/js_wrap/three/loaders/SVGLoader.js +2162 -0
  129. data/lib-opal/js_wrap/three/loaders/TDSLoader.js +982 -0
  130. data/lib-opal/js_wrap/three/loaders/TGALoader.js +444 -0
  131. data/lib-opal/js_wrap/three/loaders/TTFLoader.js +210 -0
  132. data/lib-opal/js_wrap/three/loaders/TiltLoader.js +391 -0
  133. data/lib-opal/js_wrap/three/loaders/VOXLoader.js +272 -0
  134. data/lib-opal/js_wrap/three/loaders/VRMLLoader.js +2685 -0
  135. data/lib-opal/js_wrap/three/loaders/VRMLoader.js +103 -0
  136. data/lib-opal/js_wrap/three/loaders/VTKLoader.js +894 -0
  137. data/lib-opal/js_wrap/three/loaders/XYZLoader.js +136 -0
  138. data/lib-opal/js_wrap/three/loaders/ifc/web-ifc-api.js +60504 -0
  139. data/lib-opal/js_wrap/three/loaders/lwo/IFFParser.js +931 -0
  140. data/lib-opal/js_wrap/three/loaders/lwo/LWO2Parser.js +450 -0
  141. data/lib-opal/js_wrap/three/loaders/lwo/LWO3Parser.js +406 -0
  142. data/lib-opal/js_wrap/three/math/Capsule.js +133 -0
  143. data/lib-opal/js_wrap/three/math/ColorConverter.js +104 -0
  144. data/lib-opal/js_wrap/three/math/ConvexHull.js +924 -0
  145. data/lib-opal/js_wrap/three/math/ImprovedNoise.js +86 -0
  146. data/lib-opal/js_wrap/three/math/Lut.js +170 -0
  147. data/lib-opal/js_wrap/three/math/MeshSurfaceSampler.js +187 -0
  148. data/lib-opal/js_wrap/three/math/OBB.js +345 -0
  149. data/lib-opal/js_wrap/three/math/Octree.js +409 -0
  150. data/lib-opal/js_wrap/three/math/SimplexNoise.js +425 -0
  151. data/lib-opal/js_wrap/three/misc/ConvexObjectBreaker.js +447 -0
  152. data/lib-opal/js_wrap/three/misc/GPUComputationRenderer.js +322 -0
  153. data/lib-opal/js_wrap/three/misc/Gyroscope.js +94 -0
  154. data/lib-opal/js_wrap/three/misc/MD2Character.js +225 -0
  155. data/lib-opal/js_wrap/three/misc/MD2CharacterComplex.js +424 -0
  156. data/lib-opal/js_wrap/three/misc/MorphAnimMesh.js +109 -0
  157. data/lib-opal/js_wrap/three/misc/MorphBlendMesh.js +283 -0
  158. data/lib-opal/js_wrap/three/misc/ProgressiveLightMap.js +324 -0
  159. data/lib-opal/js_wrap/three/misc/RollerCoaster.js +489 -0
  160. data/lib-opal/js_wrap/three/misc/TubePainter.js +158 -0
  161. data/lib-opal/js_wrap/three/misc/Volume.js +427 -0
  162. data/lib-opal/js_wrap/three/misc/VolumeSlice.js +210 -0
  163. data/lib-opal/js_wrap/three/modifiers/CurveModifier.js +291 -0
  164. data/lib-opal/js_wrap/three/modifiers/EdgeSplitModifier.js +308 -0
  165. data/lib-opal/js_wrap/three/modifiers/SimplifyModifier.js +435 -0
  166. data/lib-opal/js_wrap/three/modifiers/TessellateModifier.js +264 -0
  167. data/lib-opal/js_wrap/three/node-editor/NodeEditor.js +402 -0
  168. data/lib-opal/js_wrap/three/node-editor/accessors/NormalEditor.js +80 -0
  169. data/lib-opal/js_wrap/three/node-editor/accessors/PositionEditor.js +80 -0
  170. data/lib-opal/js_wrap/three/node-editor/accessors/UVEditor.js +71 -0
  171. data/lib-opal/js_wrap/three/node-editor/display/BlendEditor.js +78 -0
  172. data/lib-opal/js_wrap/three/node-editor/inputs/ColorEditor.js +111 -0
  173. data/lib-opal/js_wrap/three/node-editor/inputs/FloatEditor.js +69 -0
  174. data/lib-opal/js_wrap/three/node-editor/inputs/SliderEditor.js +97 -0
  175. data/lib-opal/js_wrap/three/node-editor/inputs/Vector2Editor.js +73 -0
  176. data/lib-opal/js_wrap/three/node-editor/inputs/Vector3Editor.js +75 -0
  177. data/lib-opal/js_wrap/three/node-editor/inputs/Vector4Editor.js +77 -0
  178. data/lib-opal/js_wrap/three/node-editor/materials/StandardMaterialEditor.js +121 -0
  179. data/lib-opal/js_wrap/three/node-editor/math/DotEditor.js +76 -0
  180. data/lib-opal/js_wrap/three/node-editor/math/InvertEditor.js +80 -0
  181. data/lib-opal/js_wrap/three/node-editor/math/LimiterEditor.js +85 -0
  182. data/lib-opal/js_wrap/three/node-editor/math/NormalizeEditor.js +69 -0
  183. data/lib-opal/js_wrap/three/node-editor/math/OperatorEditor.js +91 -0
  184. data/lib-opal/js_wrap/three/node-editor/math/PowerEditor.js +73 -0
  185. data/lib-opal/js_wrap/three/node-editor/math/TrigonometryEditor.js +83 -0
  186. data/lib-opal/js_wrap/three/node-editor/procedural/CheckerEditor.js +69 -0
  187. data/lib-opal/js_wrap/three/node-editor/utils/OscillatorEditor.js +87 -0
  188. data/lib-opal/js_wrap/three/node-editor/utils/TimerEditor.js +89 -0
  189. data/lib-opal/js_wrap/three/nodes/Nodes.js +481 -0
  190. data/lib-opal/js_wrap/three/nodes/accessors/CameraNode.js +222 -0
  191. data/lib-opal/js_wrap/three/nodes/accessors/ColorsNode.js +99 -0
  192. data/lib-opal/js_wrap/three/nodes/accessors/LightNode.js +100 -0
  193. data/lib-opal/js_wrap/three/nodes/accessors/NormalNode.js +152 -0
  194. data/lib-opal/js_wrap/three/nodes/accessors/PositionNode.js +163 -0
  195. data/lib-opal/js_wrap/three/nodes/accessors/ReflectNode.js +161 -0
  196. data/lib-opal/js_wrap/three/nodes/accessors/ResolutionNode.js +99 -0
  197. data/lib-opal/js_wrap/three/nodes/accessors/ScreenUVNode.js +101 -0
  198. data/lib-opal/js_wrap/three/nodes/accessors/UVNode.js +105 -0
  199. data/lib-opal/js_wrap/three/nodes/core/AttributeNode.js +106 -0
  200. data/lib-opal/js_wrap/three/nodes/core/ConstNode.js +149 -0
  201. data/lib-opal/js_wrap/three/nodes/core/ExpressionNode.js +57 -0
  202. data/lib-opal/js_wrap/three/nodes/core/FunctionCallNode.js +138 -0
  203. data/lib-opal/js_wrap/three/nodes/core/FunctionNode.js +259 -0
  204. data/lib-opal/js_wrap/three/nodes/core/InputNode.js +124 -0
  205. data/lib-opal/js_wrap/three/nodes/core/Node.js +193 -0
  206. data/lib-opal/js_wrap/three/nodes/core/NodeBuilder.js +782 -0
  207. data/lib-opal/js_wrap/three/nodes/core/NodeFrame.js +69 -0
  208. data/lib-opal/js_wrap/three/nodes/core/NodeLib.js +56 -0
  209. data/lib-opal/js_wrap/three/nodes/core/NodeUniform.js +53 -0
  210. data/lib-opal/js_wrap/three/nodes/core/NodeUtils.js +60 -0
  211. data/lib-opal/js_wrap/three/nodes/core/StructNode.js +131 -0
  212. data/lib-opal/js_wrap/three/nodes/core/TempNode.js +160 -0
  213. data/lib-opal/js_wrap/three/nodes/core/VarNode.js +105 -0
  214. data/lib-opal/js_wrap/three/nodes/effects/BlurNode.js +160 -0
  215. data/lib-opal/js_wrap/three/nodes/effects/ColorAdjustmentNode.js +139 -0
  216. data/lib-opal/js_wrap/three/nodes/effects/LuminanceNode.js +106 -0
  217. data/lib-opal/js_wrap/three/nodes/inputs/BoolNode.js +95 -0
  218. data/lib-opal/js_wrap/three/nodes/inputs/ColorNode.js +99 -0
  219. data/lib-opal/js_wrap/three/nodes/inputs/CubeTextureNode.js +136 -0
  220. data/lib-opal/js_wrap/three/nodes/inputs/FloatNode.js +95 -0
  221. data/lib-opal/js_wrap/three/nodes/inputs/IntNode.js +95 -0
  222. data/lib-opal/js_wrap/three/nodes/inputs/Matrix3Node.js +102 -0
  223. data/lib-opal/js_wrap/three/nodes/inputs/Matrix4Node.js +102 -0
  224. data/lib-opal/js_wrap/three/nodes/inputs/PropertyNode.js +85 -0
  225. data/lib-opal/js_wrap/three/nodes/inputs/RTTNode.js +164 -0
  226. data/lib-opal/js_wrap/three/nodes/inputs/ReflectorNode.js +111 -0
  227. data/lib-opal/js_wrap/three/nodes/inputs/ScreenNode.js +69 -0
  228. data/lib-opal/js_wrap/three/nodes/inputs/TextureNode.js +140 -0
  229. data/lib-opal/js_wrap/three/nodes/inputs/Vector2Node.js +98 -0
  230. data/lib-opal/js_wrap/three/nodes/inputs/Vector3Node.js +99 -0
  231. data/lib-opal/js_wrap/three/nodes/inputs/Vector4Node.js +100 -0
  232. data/lib-opal/js_wrap/three/nodes/materials/BasicNodeMaterial.js +63 -0
  233. data/lib-opal/js_wrap/three/nodes/materials/MeshStandardNodeMaterial.js +63 -0
  234. data/lib-opal/js_wrap/three/nodes/materials/NodeMaterial.js +202 -0
  235. data/lib-opal/js_wrap/three/nodes/materials/PhongNodeMaterial.js +63 -0
  236. data/lib-opal/js_wrap/three/nodes/materials/SpriteNodeMaterial.js +63 -0
  237. data/lib-opal/js_wrap/three/nodes/materials/StandardNodeMaterial.js +63 -0
  238. data/lib-opal/js_wrap/three/nodes/materials/nodes/BasicNode.js +146 -0
  239. data/lib-opal/js_wrap/three/nodes/materials/nodes/MeshStandardNode.js +133 -0
  240. data/lib-opal/js_wrap/three/nodes/materials/nodes/PhongNode.js +273 -0
  241. data/lib-opal/js_wrap/three/nodes/materials/nodes/RawNode.js +101 -0
  242. data/lib-opal/js_wrap/three/nodes/materials/nodes/SpriteNode.js +176 -0
  243. data/lib-opal/js_wrap/three/nodes/materials/nodes/StandardNode.js +397 -0
  244. data/lib-opal/js_wrap/three/nodes/math/CondNode.js +151 -0
  245. data/lib-opal/js_wrap/three/nodes/math/MathNode.js +266 -0
  246. data/lib-opal/js_wrap/three/nodes/math/OperatorNode.js +120 -0
  247. data/lib-opal/js_wrap/three/nodes/misc/BumpMapNode.js +139 -0
  248. data/lib-opal/js_wrap/three/nodes/misc/NormalMapNode.js +122 -0
  249. data/lib-opal/js_wrap/three/nodes/misc/TextureCubeNode.js +107 -0
  250. data/lib-opal/js_wrap/three/nodes/misc/TextureCubeUVNode.js +191 -0
  251. data/lib-opal/js_wrap/three/nodes/postprocessing/NodePass.js +117 -0
  252. data/lib-opal/js_wrap/three/nodes/postprocessing/NodePostProcessing.js +128 -0
  253. data/lib-opal/js_wrap/three/nodes/procedural/CheckerNode.js +104 -0
  254. data/lib-opal/js_wrap/three/nodes/procedural/Fractal3DNode.js +121 -0
  255. data/lib-opal/js_wrap/three/nodes/procedural/Noise2DNode.js +115 -0
  256. data/lib-opal/js_wrap/three/nodes/procedural/Noise3DNode.js +112 -0
  257. data/lib-opal/js_wrap/three/nodes/utils/BypassNode.js +115 -0
  258. data/lib-opal/js_wrap/three/nodes/utils/ColorSpaceNode.js +214 -0
  259. data/lib-opal/js_wrap/three/nodes/utils/JoinNode.js +138 -0
  260. data/lib-opal/js_wrap/three/nodes/utils/MaxMIPLevelNode.js +88 -0
  261. data/lib-opal/js_wrap/three/nodes/utils/RemapNode.js +117 -0
  262. data/lib-opal/js_wrap/three/nodes/utils/SpecularMIPLevelNode.js +121 -0
  263. data/lib-opal/js_wrap/three/nodes/utils/SubSlotNode.js +112 -0
  264. data/lib-opal/js_wrap/three/nodes/utils/SwitchNode.js +129 -0
  265. data/lib-opal/js_wrap/three/nodes/utils/TimerNode.js +126 -0
  266. data/lib-opal/js_wrap/three/nodes/utils/UVTransformNode.js +104 -0
  267. data/lib-opal/js_wrap/three/nodes/utils/VelocityNode.js +181 -0
  268. data/lib-opal/js_wrap/three/objects/Lensflare.js +285 -0
  269. data/lib-opal/js_wrap/three/objects/LightningStorm.js +238 -0
  270. data/lib-opal/js_wrap/three/objects/MarchingCubes.js +667 -0
  271. data/lib-opal/js_wrap/three/objects/Reflector.js +205 -0
  272. data/lib-opal/js_wrap/three/objects/ReflectorForSSRPass.js +288 -0
  273. data/lib-opal/js_wrap/three/objects/ReflectorRTT.js +63 -0
  274. data/lib-opal/js_wrap/three/objects/Refractor.js +243 -0
  275. data/lib-opal/js_wrap/three/objects/ShadowMesh.js +100 -0
  276. data/lib-opal/js_wrap/three/objects/Sky.js +107 -0
  277. data/lib-opal/js_wrap/three/objects/Water.js +246 -0
  278. data/lib-opal/js_wrap/three/objects/Water2.js +238 -0
  279. data/lib-opal/js_wrap/three/offscreen/jank.js +51 -0
  280. data/lib-opal/js_wrap/three/offscreen/offscreen.js +24 -0
  281. data/lib-opal/js_wrap/three/offscreen/scene.js +99 -0
  282. data/lib-opal/js_wrap/three/physics/AmmoPhysics.js +266 -0
  283. data/lib-opal/js_wrap/three/physics/OimoPhysics.js +214 -0
  284. data/lib-opal/js_wrap/three/postprocessing/AdaptiveToneMappingPass.js +307 -0
  285. data/lib-opal/js_wrap/three/postprocessing/AfterimagePass.js +116 -0
  286. data/lib-opal/js_wrap/three/postprocessing/BloomPass.js +132 -0
  287. data/lib-opal/js_wrap/three/postprocessing/BokehPass.js +143 -0
  288. data/lib-opal/js_wrap/three/postprocessing/ClearPass.js +85 -0
  289. data/lib-opal/js_wrap/three/postprocessing/CubeTexturePass.js +104 -0
  290. data/lib-opal/js_wrap/three/postprocessing/DotScreenPass.js +90 -0
  291. data/lib-opal/js_wrap/three/postprocessing/EffectComposer.js +272 -0
  292. data/lib-opal/js_wrap/three/postprocessing/FilmPass.js +91 -0
  293. data/lib-opal/js_wrap/three/postprocessing/GlitchPass.js +140 -0
  294. data/lib-opal/js_wrap/three/postprocessing/HalftonePass.js +108 -0
  295. data/lib-opal/js_wrap/three/postprocessing/LUTPass.js +132 -0
  296. data/lib-opal/js_wrap/three/postprocessing/MaskPass.js +142 -0
  297. data/lib-opal/js_wrap/three/postprocessing/OutlinePass.js +480 -0
  298. data/lib-opal/js_wrap/three/postprocessing/Pass.js +101 -0
  299. data/lib-opal/js_wrap/three/postprocessing/RenderPass.js +109 -0
  300. data/lib-opal/js_wrap/three/postprocessing/SAOPass.js +384 -0
  301. data/lib-opal/js_wrap/three/postprocessing/SMAAPass.js +199 -0
  302. data/lib-opal/js_wrap/three/postprocessing/SSAARenderPass.js +186 -0
  303. data/lib-opal/js_wrap/three/postprocessing/SSAOPass.js +388 -0
  304. data/lib-opal/js_wrap/three/postprocessing/SSRPass.js +537 -0
  305. data/lib-opal/js_wrap/three/postprocessing/SSRrPass.js +481 -0
  306. data/lib-opal/js_wrap/three/postprocessing/SavePass.js +96 -0
  307. data/lib-opal/js_wrap/three/postprocessing/ShaderPass.js +98 -0
  308. data/lib-opal/js_wrap/three/postprocessing/TAARenderPass.js +159 -0
  309. data/lib-opal/js_wrap/three/postprocessing/TexturePass.js +91 -0
  310. data/lib-opal/js_wrap/three/postprocessing/UnrealBloomPass.js +335 -0
  311. data/lib-opal/js_wrap/three/renderers/CSS2DRenderer.js +213 -0
  312. data/lib-opal/js_wrap/three/renderers/CSS3DRenderer.js +277 -0
  313. data/lib-opal/js_wrap/three/renderers/Projector.js +733 -0
  314. data/lib-opal/js_wrap/three/renderers/SVGRenderer.js +470 -0
  315. data/lib-opal/js_wrap/three/renderers/nodes/Nodes.js +531 -0
  316. data/lib-opal/js_wrap/three/renderers/nodes/ShaderNode.js +386 -0
  317. data/lib-opal/js_wrap/three/renderers/nodes/accessors/CameraNode.js +114 -0
  318. data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialNode.js +140 -0
  319. data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialReferenceNode.js +79 -0
  320. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelNode.js +62 -0
  321. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelViewProjectionNode.js +80 -0
  322. data/lib-opal/js_wrap/three/renderers/nodes/accessors/NormalNode.js +113 -0
  323. data/lib-opal/js_wrap/three/renderers/nodes/accessors/Object3DNode.js +136 -0
  324. data/lib-opal/js_wrap/three/renderers/nodes/accessors/PointUVNode.js +70 -0
  325. data/lib-opal/js_wrap/three/renderers/nodes/accessors/PositionNode.js +117 -0
  326. data/lib-opal/js_wrap/three/renderers/nodes/accessors/ReferenceNode.js +124 -0
  327. data/lib-opal/js_wrap/three/renderers/nodes/accessors/SkinningNode.js +129 -0
  328. data/lib-opal/js_wrap/three/renderers/nodes/accessors/UVNode.js +77 -0
  329. data/lib-opal/js_wrap/three/renderers/nodes/core/ArrayInputNode.js +74 -0
  330. data/lib-opal/js_wrap/three/renderers/nodes/core/AttributeNode.js +97 -0
  331. data/lib-opal/js_wrap/three/renderers/nodes/core/BypassNode.js +84 -0
  332. data/lib-opal/js_wrap/three/renderers/nodes/core/CodeNode.js +131 -0
  333. data/lib-opal/js_wrap/three/renderers/nodes/core/ContextNode.js +84 -0
  334. data/lib-opal/js_wrap/three/renderers/nodes/core/ExpressionNode.js +81 -0
  335. data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionCallNode.js +123 -0
  336. data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionNode.js +126 -0
  337. data/lib-opal/js_wrap/three/renderers/nodes/core/InputNode.js +103 -0
  338. data/lib-opal/js_wrap/three/renderers/nodes/core/Node.js +120 -0
  339. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeAttribute.js +37 -0
  340. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeBuilder.js +650 -0
  341. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeCode.js +42 -0
  342. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFrame.js +70 -0
  343. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunction.js +55 -0
  344. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunctionInput.js +44 -0
  345. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeKeywords.js +117 -0
  346. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeParser.js +46 -0
  347. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeUniform.js +55 -0
  348. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVar.js +37 -0
  349. data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVary.js +37 -0
  350. data/lib-opal/js_wrap/three/renderers/nodes/core/PropertyNode.js +90 -0
  351. data/lib-opal/js_wrap/three/renderers/nodes/core/TempNode.js +89 -0
  352. data/lib-opal/js_wrap/three/renderers/nodes/core/VarNode.js +101 -0
  353. data/lib-opal/js_wrap/three/renderers/nodes/core/VaryNode.js +101 -0
  354. data/lib-opal/js_wrap/three/renderers/nodes/core/constants.js +42 -0
  355. data/lib-opal/js_wrap/three/renderers/nodes/display/ColorSpaceNode.js +165 -0
  356. data/lib-opal/js_wrap/three/renderers/nodes/display/NormalMapNode.js +120 -0
  357. data/lib-opal/js_wrap/three/renderers/nodes/functions/BSDFs.js +133 -0
  358. data/lib-opal/js_wrap/three/renderers/nodes/inputs/BufferNode.js +78 -0
  359. data/lib-opal/js_wrap/three/renderers/nodes/inputs/ColorNode.js +67 -0
  360. data/lib-opal/js_wrap/three/renderers/nodes/inputs/FloatNode.js +67 -0
  361. data/lib-opal/js_wrap/three/renderers/nodes/inputs/IntNode.js +67 -0
  362. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix3Node.js +67 -0
  363. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix4Node.js +67 -0
  364. data/lib-opal/js_wrap/three/renderers/nodes/inputs/TextureNode.js +120 -0
  365. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector2Node.js +67 -0
  366. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector3Node.js +67 -0
  367. data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector4Node.js +67 -0
  368. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightContextNode.js +103 -0
  369. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightNode.js +115 -0
  370. data/lib-opal/js_wrap/three/renderers/nodes/lights/LightsNode.js +117 -0
  371. data/lib-opal/js_wrap/three/renderers/nodes/materials/LineBasicNodeMaterial.js +82 -0
  372. data/lib-opal/js_wrap/three/renderers/nodes/materials/Materials.js +49 -0
  373. data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshBasicNodeMaterial.js +82 -0
  374. data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshStandardNodeMaterial.js +96 -0
  375. data/lib-opal/js_wrap/three/renderers/nodes/materials/PointsNodeMaterial.js +84 -0
  376. data/lib-opal/js_wrap/three/renderers/nodes/math/CondNode.js +98 -0
  377. data/lib-opal/js_wrap/three/renderers/nodes/math/MathNode.js +255 -0
  378. data/lib-opal/js_wrap/three/renderers/nodes/math/OperatorNode.js +163 -0
  379. data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeFunction.js +158 -0
  380. data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeParser.js +68 -0
  381. data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeFunction.js +126 -0
  382. data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeParser.js +68 -0
  383. data/lib-opal/js_wrap/three/renderers/nodes/procedural/CheckerNode.js +84 -0
  384. data/lib-opal/js_wrap/three/renderers/nodes/utils/ArrayElementNode.js +79 -0
  385. data/lib-opal/js_wrap/three/renderers/nodes/utils/ConvertNode.js +82 -0
  386. data/lib-opal/js_wrap/three/renderers/nodes/utils/JoinNode.js +88 -0
  387. data/lib-opal/js_wrap/three/renderers/nodes/utils/OscNode.js +105 -0
  388. data/lib-opal/js_wrap/three/renderers/nodes/utils/SplitNode.js +96 -0
  389. data/lib-opal/js_wrap/three/renderers/nodes/utils/SpriteSheetUVNode.js +98 -0
  390. data/lib-opal/js_wrap/three/renderers/nodes/utils/TimerNode.js +93 -0
  391. data/lib-opal/js_wrap/three/renderers/webgl/nodes/SlotNode.js +72 -0
  392. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodeBuilder.js +463 -0
  393. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodes.js +62 -0
  394. data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLPhysicalContextNode.js +95 -0
  395. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPU.js +62 -0
  396. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUAttributes.js +118 -0
  397. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBackground.js +109 -0
  398. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBinding.js +52 -0
  399. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBindings.js +254 -0
  400. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBufferUtils.js +39 -0
  401. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUComputePipelines.js +82 -0
  402. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUGeometries.js +84 -0
  403. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUInfo.js +86 -0
  404. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUObjects.js +64 -0
  405. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProgrammableStage.js +46 -0
  406. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProperties.js +63 -0
  407. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderLists.js +180 -0
  408. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipeline.js +662 -0
  409. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipelines.js +275 -0
  410. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderer.js +883 -0
  411. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampledTexture.js +139 -0
  412. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampler.js +76 -0
  413. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUStorageBuffer.js +69 -0
  414. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureRenderer.js +64 -0
  415. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureUtils.js +125 -0
  416. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextures.js +681 -0
  417. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniform.js +237 -0
  418. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformBuffer.js +90 -0
  419. data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformsGroup.js +294 -0
  420. data/lib-opal/js_wrap/three/renderers/webgpu/constants.js +263 -0
  421. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeBuilder.js +619 -0
  422. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +67 -0
  423. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampler.js +71 -0
  424. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniform.js +229 -0
  425. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +68 -0
  426. data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodes.js +106 -0
  427. data/lib-opal/js_wrap/three/shaders/ACESFilmicToneMappingShader.js +45 -0
  428. data/lib-opal/js_wrap/three/shaders/AfterimageShader.js +46 -0
  429. data/lib-opal/js_wrap/three/shaders/BasicShader.js +34 -0
  430. data/lib-opal/js_wrap/three/shaders/BleachBypassShader.js +43 -0
  431. data/lib-opal/js_wrap/three/shaders/BlendShader.js +47 -0
  432. data/lib-opal/js_wrap/three/shaders/BokehShader.js +65 -0
  433. data/lib-opal/js_wrap/three/shaders/BokehShader2.js +125 -0
  434. data/lib-opal/js_wrap/three/shaders/BrightnessContrastShader.js +47 -0
  435. data/lib-opal/js_wrap/three/shaders/ColorCorrectionShader.js +47 -0
  436. data/lib-opal/js_wrap/three/shaders/ColorifyShader.js +41 -0
  437. data/lib-opal/js_wrap/three/shaders/ConvolutionShader.js +75 -0
  438. data/lib-opal/js_wrap/three/shaders/CopyShader.js +41 -0
  439. data/lib-opal/js_wrap/three/shaders/DOFMipMapShader.js +49 -0
  440. data/lib-opal/js_wrap/three/shaders/DepthLimitedBlurShader.js +95 -0
  441. data/lib-opal/js_wrap/three/shaders/DigitalGlitch.js +79 -0
  442. data/lib-opal/js_wrap/three/shaders/DotScreenShader.js +52 -0
  443. data/lib-opal/js_wrap/three/shaders/FXAAShader.js +78 -0
  444. data/lib-opal/js_wrap/three/shaders/FilmShader.js +69 -0
  445. data/lib-opal/js_wrap/three/shaders/FocusShader.js +52 -0
  446. data/lib-opal/js_wrap/three/shaders/FreiChenShader.js +44 -0
  447. data/lib-opal/js_wrap/three/shaders/GammaCorrectionShader.js +39 -0
  448. data/lib-opal/js_wrap/three/shaders/GodRaysShader.js +140 -0
  449. data/lib-opal/js_wrap/three/shaders/HalftoneShader.js +77 -0
  450. data/lib-opal/js_wrap/three/shaders/HorizontalBlurShader.js +47 -0
  451. data/lib-opal/js_wrap/three/shaders/HorizontalTiltShiftShader.js +49 -0
  452. data/lib-opal/js_wrap/three/shaders/HueSaturationShader.js +47 -0
  453. data/lib-opal/js_wrap/three/shaders/KaleidoShader.js +50 -0
  454. data/lib-opal/js_wrap/three/shaders/LuminosityHighPassShader.js +52 -0
  455. data/lib-opal/js_wrap/three/shaders/LuminosityShader.js +39 -0
  456. data/lib-opal/js_wrap/three/shaders/MMDToonShader.js +48 -0
  457. data/lib-opal/js_wrap/three/shaders/MirrorShader.js +44 -0
  458. data/lib-opal/js_wrap/three/shaders/NormalMapShader.js +48 -0
  459. data/lib-opal/js_wrap/three/shaders/PixelShader.js +44 -0
  460. data/lib-opal/js_wrap/three/shaders/RGBShiftShader.js +50 -0
  461. data/lib-opal/js_wrap/three/shaders/SAOShader.js +85 -0
  462. data/lib-opal/js_wrap/three/shaders/SMAAShader.js +95 -0
  463. data/lib-opal/js_wrap/three/shaders/SSAOShader.js +113 -0
  464. data/lib-opal/js_wrap/three/shaders/SSRShader.js +126 -0
  465. data/lib-opal/js_wrap/three/shaders/SSRrShader.js +106 -0
  466. data/lib-opal/js_wrap/three/shaders/SepiaShader.js +43 -0
  467. data/lib-opal/js_wrap/three/shaders/SobelOperatorShader.js +44 -0
  468. data/lib-opal/js_wrap/three/shaders/SubsurfaceScatteringShader.js +64 -0
  469. data/lib-opal/js_wrap/three/shaders/TechnicolorShader.js +41 -0
  470. data/lib-opal/js_wrap/three/shaders/ToneMapShader.js +53 -0
  471. data/lib-opal/js_wrap/three/shaders/ToonShader.js +148 -0
  472. data/lib-opal/js_wrap/three/shaders/TriangleBlurShader.js +47 -0
  473. data/lib-opal/js_wrap/three/shaders/UnpackDepthRGBAShader.js +42 -0
  474. data/lib-opal/js_wrap/three/shaders/VerticalBlurShader.js +47 -0
  475. data/lib-opal/js_wrap/three/shaders/VerticalTiltShiftShader.js +49 -0
  476. data/lib-opal/js_wrap/three/shaders/VignetteShader.js +46 -0
  477. data/lib-opal/js_wrap/three/shaders/VolumeShader.js +55 -0
  478. data/lib-opal/js_wrap/three/shaders/WaterRefractionShader.js +46 -0
  479. data/lib-opal/js_wrap/three/textures/FlakesTexture.js +61 -0
  480. data/lib-opal/js_wrap/three/utils/BufferGeometryUtils.js +683 -0
  481. data/lib-opal/js_wrap/three/utils/CameraUtils.js +97 -0
  482. data/lib-opal/js_wrap/three/utils/GPUStatsPanel.js +154 -0
  483. data/lib-opal/js_wrap/three/utils/GeometryCompressionUtils.js +468 -0
  484. data/lib-opal/js_wrap/three/utils/GeometryUtils.js +192 -0
  485. data/lib-opal/js_wrap/three/utils/PackedPhongMaterial.js +77 -0
  486. data/lib-opal/js_wrap/three/utils/RoughnessMipmapper.js +169 -0
  487. data/lib-opal/js_wrap/three/utils/SceneUtils.js +62 -0
  488. data/lib-opal/js_wrap/three/utils/ShadowMapViewer.js +182 -0
  489. data/lib-opal/js_wrap/three/utils/SkeletonUtils.js +400 -0
  490. data/lib-opal/js_wrap/three/utils/UVsDebug.js +132 -0
  491. data/lib-opal/js_wrap/three/utils/WorkerPool.js +130 -0
  492. data/lib-opal/js_wrap/three/webxr/ARButton.js +203 -0
  493. data/lib-opal/js_wrap/three/webxr/OculusHandModel.js +131 -0
  494. data/lib-opal/js_wrap/three/webxr/OculusHandPointerModel.js +328 -0
  495. data/lib-opal/js_wrap/three/webxr/Text2D.js +54 -0
  496. data/lib-opal/js_wrap/three/webxr/VRButton.js +181 -0
  497. data/lib-opal/js_wrap/three/webxr/XRControllerModelFactory.js +266 -0
  498. data/lib-opal/js_wrap/three/webxr/XREstimatedLight.js +221 -0
  499. data/lib-opal/js_wrap/three/webxr/XRHandMeshModel.js +93 -0
  500. data/lib-opal/js_wrap/three/webxr/XRHandModelFactory.js +127 -0
  501. data/lib-opal/js_wrap/three/webxr/XRHandPrimitiveModel.js +85 -0
  502. data/opal-js_wrap-three.gemspec +4 -4
  503. metadata +502 -5
@@ -0,0 +1,1834 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "three", "../libs/fflate.module.js"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("three"), require("../libs/fflate.module.js"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.three, global.fflateModule);
11
+ global.EXRLoader = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three, fflate) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.EXRLoader = void 0;
20
+ fflate = _interopRequireWildcard(fflate);
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
+
28
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
+
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
+
32
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
33
+
34
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
35
+
36
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
+
38
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
+
40
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
41
+
42
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
43
+
44
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
+
46
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
+
48
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
49
+
50
+ /**
51
+ * OpenEXR loader currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression.
52
+ * Supports reading as UnsignedByte, HalfFloat and Float type data texture.
53
+ *
54
+ * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
55
+ * implementation, so I have preserved their copyright notices.
56
+ */
57
+ // /*
58
+ // Copyright (c) 2014 - 2017, Syoyo Fujita
59
+ // All rights reserved.
60
+ // Redistribution and use in source and binary forms, with or without
61
+ // modification, are permitted provided that the following conditions are met:
62
+ // * Redistributions of source code must retain the above copyright
63
+ // notice, this list of conditions and the following disclaimer.
64
+ // * Redistributions in binary form must reproduce the above copyright
65
+ // notice, this list of conditions and the following disclaimer in the
66
+ // documentation and/or other materials provided with the distribution.
67
+ // * Neither the name of the Syoyo Fujita nor the
68
+ // names of its contributors may be used to endorse or promote products
69
+ // derived from this software without specific prior written permission.
70
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
71
+ // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
72
+ // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
73
+ // DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
74
+ // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
75
+ // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
76
+ // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
77
+ // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
78
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
79
+ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80
+ // */
81
+ // // TinyEXR contains some OpenEXR code, which is licensed under ------------
82
+ // ///////////////////////////////////////////////////////////////////////////
83
+ // //
84
+ // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
85
+ // // Digital Ltd. LLC
86
+ // //
87
+ // // All rights reserved.
88
+ // //
89
+ // // Redistribution and use in source and binary forms, with or without
90
+ // // modification, are permitted provided that the following conditions are
91
+ // // met:
92
+ // // * Redistributions of source code must retain the above copyright
93
+ // // notice, this list of conditions and the following disclaimer.
94
+ // // * Redistributions in binary form must reproduce the above
95
+ // // copyright notice, this list of conditions and the following disclaimer
96
+ // // in the documentation and/or other materials provided with the
97
+ // // distribution.
98
+ // // * Neither the name of Industrial Light & Magic nor the names of
99
+ // // its contributors may be used to endorse or promote products derived
100
+ // // from this software without specific prior written permission.
101
+ // //
102
+ // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
103
+ // // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
104
+ // // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
105
+ // // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
106
+ // // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
107
+ // // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
108
+ // // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
109
+ // // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
110
+ // // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
111
+ // // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
112
+ // // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113
+ // //
114
+ // ///////////////////////////////////////////////////////////////////////////
115
+ // // End of OpenEXR license -------------------------------------------------
116
+ var EXRLoader = /*#__PURE__*/function (_DataTextureLoader) {
117
+ _inherits(EXRLoader, _DataTextureLoader);
118
+
119
+ var _super = _createSuper(EXRLoader);
120
+
121
+ function EXRLoader(manager) {
122
+ var _this;
123
+
124
+ _classCallCheck(this, EXRLoader);
125
+
126
+ _this = _super.call(this, manager);
127
+ _this.type = _three.HalfFloatType;
128
+ return _this;
129
+ }
130
+
131
+ _createClass(EXRLoader, [{
132
+ key: "parse",
133
+ value: function parse(buffer) {
134
+ var USHORT_RANGE = 1 << 16;
135
+ var BITMAP_SIZE = USHORT_RANGE >> 3;
136
+ var HUF_ENCBITS = 16; // literal (value) bit length
137
+
138
+ var HUF_DECBITS = 14; // decoding bit size (>= 8)
139
+
140
+ var HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1; // encoding table size
141
+
142
+ var HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
143
+
144
+ var HUF_DECMASK = HUF_DECSIZE - 1;
145
+ var NBITS = 16;
146
+ var A_OFFSET = 1 << NBITS - 1;
147
+ var MOD_MASK = (1 << NBITS) - 1;
148
+ var SHORT_ZEROCODE_RUN = 59;
149
+ var LONG_ZEROCODE_RUN = 63;
150
+ var SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
151
+ var ULONG_SIZE = 8;
152
+ var FLOAT32_SIZE = 4;
153
+ var INT32_SIZE = 4;
154
+ var INT16_SIZE = 2;
155
+ var INT8_SIZE = 1;
156
+ var STATIC_HUFFMAN = 0;
157
+ var DEFLATE = 1;
158
+ var UNKNOWN = 0;
159
+ var LOSSY_DCT = 1;
160
+ var RLE = 2;
161
+ var logBase = Math.pow(2.7182818, 2.2);
162
+ var tmpDataView = new DataView(new ArrayBuffer(8));
163
+
164
+ function frexp(value) {
165
+ if (value === 0) return [value, 0];
166
+ tmpDataView.setFloat64(0, value);
167
+ var bits = tmpDataView.getUint32(0) >>> 20 & 0x7FF;
168
+
169
+ if (bits === 0) {
170
+ // denormal
171
+ tmpDataView.setFloat64(0, value * Math.pow(2, 64)); // exp + 64
172
+
173
+ bits = (tmpDataView.getUint32(0) >>> 20 & 0x7FF) - 64;
174
+ }
175
+
176
+ var exponent = bits - 1022;
177
+ var mantissa = ldexp(value, -exponent);
178
+ return [mantissa, exponent];
179
+ }
180
+
181
+ function ldexp(mantissa, exponent) {
182
+ var steps = Math.min(3, Math.ceil(Math.abs(exponent) / 1023));
183
+ var result = mantissa;
184
+
185
+ for (var i = 0; i < steps; i++) {
186
+ result *= Math.pow(2, Math.floor((exponent + i) / steps));
187
+ }
188
+
189
+ return result;
190
+ }
191
+
192
+ function reverseLutFromBitmap(bitmap, lut) {
193
+ var k = 0;
194
+
195
+ for (var i = 0; i < USHORT_RANGE; ++i) {
196
+ if (i == 0 || bitmap[i >> 3] & 1 << (i & 7)) {
197
+ lut[k++] = i;
198
+ }
199
+ }
200
+
201
+ var n = k - 1;
202
+
203
+ while (k < USHORT_RANGE) {
204
+ lut[k++] = 0;
205
+ }
206
+
207
+ return n;
208
+ }
209
+
210
+ function hufClearDecTable(hdec) {
211
+ for (var i = 0; i < HUF_DECSIZE; i++) {
212
+ hdec[i] = {};
213
+ hdec[i].len = 0;
214
+ hdec[i].lit = 0;
215
+ hdec[i].p = null;
216
+ }
217
+ }
218
+
219
+ var getBitsReturn = {
220
+ l: 0,
221
+ c: 0,
222
+ lc: 0
223
+ };
224
+
225
+ function getBits(nBits, c, lc, uInt8Array, inOffset) {
226
+ while (lc < nBits) {
227
+ c = c << 8 | parseUint8Array(uInt8Array, inOffset);
228
+ lc += 8;
229
+ }
230
+
231
+ lc -= nBits;
232
+ getBitsReturn.l = c >> lc & (1 << nBits) - 1;
233
+ getBitsReturn.c = c;
234
+ getBitsReturn.lc = lc;
235
+ }
236
+
237
+ var hufTableBuffer = new Array(59);
238
+
239
+ function hufCanonicalCodeTable(hcode) {
240
+ for (var i = 0; i <= 58; ++i) {
241
+ hufTableBuffer[i] = 0;
242
+ }
243
+
244
+ for (var i = 0; i < HUF_ENCSIZE; ++i) {
245
+ hufTableBuffer[hcode[i]] += 1;
246
+ }
247
+
248
+ var c = 0;
249
+
250
+ for (var i = 58; i > 0; --i) {
251
+ var nc = c + hufTableBuffer[i] >> 1;
252
+ hufTableBuffer[i] = c;
253
+ c = nc;
254
+ }
255
+
256
+ for (var i = 0; i < HUF_ENCSIZE; ++i) {
257
+ var l = hcode[i];
258
+ if (l > 0) hcode[i] = l | hufTableBuffer[l]++ << 6;
259
+ }
260
+ }
261
+
262
+ function hufUnpackEncTable(uInt8Array, inDataView, inOffset, ni, im, iM, hcode) {
263
+ var p = inOffset;
264
+ var c = 0;
265
+ var lc = 0;
266
+
267
+ for (; im <= iM; im++) {
268
+ if (p.value - inOffset.value > ni) return false;
269
+ getBits(6, c, lc, uInt8Array, p);
270
+ var l = getBitsReturn.l;
271
+ c = getBitsReturn.c;
272
+ lc = getBitsReturn.lc;
273
+ hcode[im] = l;
274
+
275
+ if (l == LONG_ZEROCODE_RUN) {
276
+ if (p.value - inOffset.value > ni) {
277
+ throw 'Something wrong with hufUnpackEncTable';
278
+ }
279
+
280
+ getBits(8, c, lc, uInt8Array, p);
281
+ var zerun = getBitsReturn.l + SHORTEST_LONG_RUN;
282
+ c = getBitsReturn.c;
283
+ lc = getBitsReturn.lc;
284
+
285
+ if (im + zerun > iM + 1) {
286
+ throw 'Something wrong with hufUnpackEncTable';
287
+ }
288
+
289
+ while (zerun--) {
290
+ hcode[im++] = 0;
291
+ }
292
+
293
+ im--;
294
+ } else if (l >= SHORT_ZEROCODE_RUN) {
295
+ var zerun = l - SHORT_ZEROCODE_RUN + 2;
296
+
297
+ if (im + zerun > iM + 1) {
298
+ throw 'Something wrong with hufUnpackEncTable';
299
+ }
300
+
301
+ while (zerun--) {
302
+ hcode[im++] = 0;
303
+ }
304
+
305
+ im--;
306
+ }
307
+ }
308
+
309
+ hufCanonicalCodeTable(hcode);
310
+ }
311
+
312
+ function hufLength(code) {
313
+ return code & 63;
314
+ }
315
+
316
+ function hufCode(code) {
317
+ return code >> 6;
318
+ }
319
+
320
+ function hufBuildDecTable(hcode, im, iM, hdecod) {
321
+ for (; im <= iM; im++) {
322
+ var c = hufCode(hcode[im]);
323
+ var l = hufLength(hcode[im]);
324
+
325
+ if (c >> l) {
326
+ throw 'Invalid table entry';
327
+ }
328
+
329
+ if (l > HUF_DECBITS) {
330
+ var pl = hdecod[c >> l - HUF_DECBITS];
331
+
332
+ if (pl.len) {
333
+ throw 'Invalid table entry';
334
+ }
335
+
336
+ pl.lit++;
337
+
338
+ if (pl.p) {
339
+ var p = pl.p;
340
+ pl.p = new Array(pl.lit);
341
+
342
+ for (var i = 0; i < pl.lit - 1; ++i) {
343
+ pl.p[i] = p[i];
344
+ }
345
+ } else {
346
+ pl.p = new Array(1);
347
+ }
348
+
349
+ pl.p[pl.lit - 1] = im;
350
+ } else if (l) {
351
+ var plOffset = 0;
352
+
353
+ for (var i = 1 << HUF_DECBITS - l; i > 0; i--) {
354
+ var pl = hdecod[(c << HUF_DECBITS - l) + plOffset];
355
+
356
+ if (pl.len || pl.p) {
357
+ throw 'Invalid table entry';
358
+ }
359
+
360
+ pl.len = l;
361
+ pl.lit = im;
362
+ plOffset++;
363
+ }
364
+ }
365
+ }
366
+
367
+ return true;
368
+ }
369
+
370
+ var getCharReturn = {
371
+ c: 0,
372
+ lc: 0
373
+ };
374
+
375
+ function getChar(c, lc, uInt8Array, inOffset) {
376
+ c = c << 8 | parseUint8Array(uInt8Array, inOffset);
377
+ lc += 8;
378
+ getCharReturn.c = c;
379
+ getCharReturn.lc = lc;
380
+ }
381
+
382
+ var getCodeReturn = {
383
+ c: 0,
384
+ lc: 0
385
+ };
386
+
387
+ function getCode(po, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outBufferOffset, outBufferEndOffset) {
388
+ if (po == rlc) {
389
+ if (lc < 8) {
390
+ getChar(c, lc, uInt8Array, inOffset);
391
+ c = getCharReturn.c;
392
+ lc = getCharReturn.lc;
393
+ }
394
+
395
+ lc -= 8;
396
+ var cs = c >> lc;
397
+ var cs = new Uint8Array([cs])[0];
398
+
399
+ if (outBufferOffset.value + cs > outBufferEndOffset) {
400
+ return false;
401
+ }
402
+
403
+ var s = outBuffer[outBufferOffset.value - 1];
404
+
405
+ while (cs-- > 0) {
406
+ outBuffer[outBufferOffset.value++] = s;
407
+ }
408
+ } else if (outBufferOffset.value < outBufferEndOffset) {
409
+ outBuffer[outBufferOffset.value++] = po;
410
+ } else {
411
+ return false;
412
+ }
413
+
414
+ getCodeReturn.c = c;
415
+ getCodeReturn.lc = lc;
416
+ }
417
+
418
+ function UInt16(value) {
419
+ return value & 0xFFFF;
420
+ }
421
+
422
+ function Int16(value) {
423
+ var ref = UInt16(value);
424
+ return ref > 0x7FFF ? ref - 0x10000 : ref;
425
+ }
426
+
427
+ var wdec14Return = {
428
+ a: 0,
429
+ b: 0
430
+ };
431
+
432
+ function wdec14(l, h) {
433
+ var ls = Int16(l);
434
+ var hs = Int16(h);
435
+ var hi = hs;
436
+ var ai = ls + (hi & 1) + (hi >> 1);
437
+ var as = ai;
438
+ var bs = ai - hi;
439
+ wdec14Return.a = as;
440
+ wdec14Return.b = bs;
441
+ }
442
+
443
+ function wdec16(l, h) {
444
+ var m = UInt16(l);
445
+ var d = UInt16(h);
446
+ var bb = m - (d >> 1) & MOD_MASK;
447
+ var aa = d + bb - A_OFFSET & MOD_MASK;
448
+ wdec14Return.a = aa;
449
+ wdec14Return.b = bb;
450
+ }
451
+
452
+ function wav2Decode(buffer, j, nx, ox, ny, oy, mx) {
453
+ var w14 = mx < 1 << 14;
454
+ var n = nx > ny ? ny : nx;
455
+ var p = 1;
456
+ var p2;
457
+
458
+ while (p <= n) {
459
+ p <<= 1;
460
+ }
461
+
462
+ p >>= 1;
463
+ p2 = p;
464
+ p >>= 1;
465
+
466
+ while (p >= 1) {
467
+ var py = 0;
468
+ var ey = py + oy * (ny - p2);
469
+ var oy1 = oy * p;
470
+ var oy2 = oy * p2;
471
+ var ox1 = ox * p;
472
+ var ox2 = ox * p2;
473
+ var i00, i01, i10, i11;
474
+
475
+ for (; py <= ey; py += oy2) {
476
+ var px = py;
477
+ var ex = py + ox * (nx - p2);
478
+
479
+ for (; px <= ex; px += ox2) {
480
+ var p01 = px + ox1;
481
+ var p10 = px + oy1;
482
+ var p11 = p10 + ox1;
483
+
484
+ if (w14) {
485
+ wdec14(buffer[px + j], buffer[p10 + j]);
486
+ i00 = wdec14Return.a;
487
+ i10 = wdec14Return.b;
488
+ wdec14(buffer[p01 + j], buffer[p11 + j]);
489
+ i01 = wdec14Return.a;
490
+ i11 = wdec14Return.b;
491
+ wdec14(i00, i01);
492
+ buffer[px + j] = wdec14Return.a;
493
+ buffer[p01 + j] = wdec14Return.b;
494
+ wdec14(i10, i11);
495
+ buffer[p10 + j] = wdec14Return.a;
496
+ buffer[p11 + j] = wdec14Return.b;
497
+ } else {
498
+ wdec16(buffer[px + j], buffer[p10 + j]);
499
+ i00 = wdec14Return.a;
500
+ i10 = wdec14Return.b;
501
+ wdec16(buffer[p01 + j], buffer[p11 + j]);
502
+ i01 = wdec14Return.a;
503
+ i11 = wdec14Return.b;
504
+ wdec16(i00, i01);
505
+ buffer[px + j] = wdec14Return.a;
506
+ buffer[p01 + j] = wdec14Return.b;
507
+ wdec16(i10, i11);
508
+ buffer[p10 + j] = wdec14Return.a;
509
+ buffer[p11 + j] = wdec14Return.b;
510
+ }
511
+ }
512
+
513
+ if (nx & p) {
514
+ var p10 = px + oy1;
515
+ if (w14) wdec14(buffer[px + j], buffer[p10 + j]);else wdec16(buffer[px + j], buffer[p10 + j]);
516
+ i00 = wdec14Return.a;
517
+ buffer[p10 + j] = wdec14Return.b;
518
+ buffer[px + j] = i00;
519
+ }
520
+ }
521
+
522
+ if (ny & p) {
523
+ var px = py;
524
+ var ex = py + ox * (nx - p2);
525
+
526
+ for (; px <= ex; px += ox2) {
527
+ var p01 = px + ox1;
528
+ if (w14) wdec14(buffer[px + j], buffer[p01 + j]);else wdec16(buffer[px + j], buffer[p01 + j]);
529
+ i00 = wdec14Return.a;
530
+ buffer[p01 + j] = wdec14Return.b;
531
+ buffer[px + j] = i00;
532
+ }
533
+ }
534
+
535
+ p2 = p;
536
+ p >>= 1;
537
+ }
538
+
539
+ return py;
540
+ }
541
+
542
+ function hufDecode(encodingTable, decodingTable, uInt8Array, inDataView, inOffset, ni, rlc, no, outBuffer, outOffset) {
543
+ var c = 0;
544
+ var lc = 0;
545
+ var outBufferEndOffset = no;
546
+ var inOffsetEnd = Math.trunc(inOffset.value + (ni + 7) / 8);
547
+
548
+ while (inOffset.value < inOffsetEnd) {
549
+ getChar(c, lc, uInt8Array, inOffset);
550
+ c = getCharReturn.c;
551
+ lc = getCharReturn.lc;
552
+
553
+ while (lc >= HUF_DECBITS) {
554
+ var index = c >> lc - HUF_DECBITS & HUF_DECMASK;
555
+ var pl = decodingTable[index];
556
+
557
+ if (pl.len) {
558
+ lc -= pl.len;
559
+ getCode(pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset);
560
+ c = getCodeReturn.c;
561
+ lc = getCodeReturn.lc;
562
+ } else {
563
+ if (!pl.p) {
564
+ throw 'hufDecode issues';
565
+ }
566
+
567
+ var j;
568
+
569
+ for (j = 0; j < pl.lit; j++) {
570
+ var l = hufLength(encodingTable[pl.p[j]]);
571
+
572
+ while (lc < l && inOffset.value < inOffsetEnd) {
573
+ getChar(c, lc, uInt8Array, inOffset);
574
+ c = getCharReturn.c;
575
+ lc = getCharReturn.lc;
576
+ }
577
+
578
+ if (lc >= l) {
579
+ if (hufCode(encodingTable[pl.p[j]]) == (c >> lc - l & (1 << l) - 1)) {
580
+ lc -= l;
581
+ getCode(pl.p[j], rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset);
582
+ c = getCodeReturn.c;
583
+ lc = getCodeReturn.lc;
584
+ break;
585
+ }
586
+ }
587
+ }
588
+
589
+ if (j == pl.lit) {
590
+ throw 'hufDecode issues';
591
+ }
592
+ }
593
+ }
594
+ }
595
+
596
+ var i = 8 - ni & 7;
597
+ c >>= i;
598
+ lc -= i;
599
+
600
+ while (lc > 0) {
601
+ var pl = decodingTable[c << HUF_DECBITS - lc & HUF_DECMASK];
602
+
603
+ if (pl.len) {
604
+ lc -= pl.len;
605
+ getCode(pl.lit, rlc, c, lc, uInt8Array, inDataView, inOffset, outBuffer, outOffset, outBufferEndOffset);
606
+ c = getCodeReturn.c;
607
+ lc = getCodeReturn.lc;
608
+ } else {
609
+ throw 'hufDecode issues';
610
+ }
611
+ }
612
+
613
+ return true;
614
+ }
615
+
616
+ function hufUncompress(uInt8Array, inDataView, inOffset, nCompressed, outBuffer, nRaw) {
617
+ var outOffset = {
618
+ value: 0
619
+ };
620
+ var initialInOffset = inOffset.value;
621
+ var im = parseUint32(inDataView, inOffset);
622
+ var iM = parseUint32(inDataView, inOffset);
623
+ inOffset.value += 4;
624
+ var nBits = parseUint32(inDataView, inOffset);
625
+ inOffset.value += 4;
626
+
627
+ if (im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE) {
628
+ throw 'Something wrong with HUF_ENCSIZE';
629
+ }
630
+
631
+ var freq = new Array(HUF_ENCSIZE);
632
+ var hdec = new Array(HUF_DECSIZE);
633
+ hufClearDecTable(hdec);
634
+ var ni = nCompressed - (inOffset.value - initialInOffset);
635
+ hufUnpackEncTable(uInt8Array, inDataView, inOffset, ni, im, iM, freq);
636
+
637
+ if (nBits > 8 * (nCompressed - (inOffset.value - initialInOffset))) {
638
+ throw 'Something wrong with hufUncompress';
639
+ }
640
+
641
+ hufBuildDecTable(freq, im, iM, hdec);
642
+ hufDecode(freq, hdec, uInt8Array, inDataView, inOffset, nBits, iM, nRaw, outBuffer, outOffset);
643
+ }
644
+
645
+ function applyLut(lut, data, nData) {
646
+ for (var i = 0; i < nData; ++i) {
647
+ data[i] = lut[data[i]];
648
+ }
649
+ }
650
+
651
+ function predictor(source) {
652
+ for (var t = 1; t < source.length; t++) {
653
+ var d = source[t - 1] + source[t] - 128;
654
+ source[t] = d;
655
+ }
656
+ }
657
+
658
+ function interleaveScalar(source, out) {
659
+ var t1 = 0;
660
+ var t2 = Math.floor((source.length + 1) / 2);
661
+ var s = 0;
662
+ var stop = source.length - 1;
663
+
664
+ while (true) {
665
+ if (s > stop) break;
666
+ out[s++] = source[t1++];
667
+ if (s > stop) break;
668
+ out[s++] = source[t2++];
669
+ }
670
+ }
671
+
672
+ function decodeRunLength(source) {
673
+ var size = source.byteLength;
674
+ var out = new Array();
675
+ var p = 0;
676
+ var reader = new DataView(source);
677
+
678
+ while (size > 0) {
679
+ var l = reader.getInt8(p++);
680
+
681
+ if (l < 0) {
682
+ var count = -l;
683
+ size -= count + 1;
684
+
685
+ for (var i = 0; i < count; i++) {
686
+ out.push(reader.getUint8(p++));
687
+ }
688
+ } else {
689
+ var count = l;
690
+ size -= 2;
691
+ var value = reader.getUint8(p++);
692
+
693
+ for (var i = 0; i < count + 1; i++) {
694
+ out.push(value);
695
+ }
696
+ }
697
+ }
698
+
699
+ return out;
700
+ }
701
+
702
+ function lossyDctDecode(cscSet, rowPtrs, channelData, acBuffer, dcBuffer, outBuffer) {
703
+ var dataView = new DataView(outBuffer.buffer);
704
+ var width = channelData[cscSet.idx[0]].width;
705
+ var height = channelData[cscSet.idx[0]].height;
706
+ var numComp = 3;
707
+ var numFullBlocksX = Math.floor(width / 8.0);
708
+ var numBlocksX = Math.ceil(width / 8.0);
709
+ var numBlocksY = Math.ceil(height / 8.0);
710
+ var leftoverX = width - (numBlocksX - 1) * 8;
711
+ var leftoverY = height - (numBlocksY - 1) * 8;
712
+ var currAcComp = {
713
+ value: 0
714
+ };
715
+ var currDcComp = new Array(numComp);
716
+ var dctData = new Array(numComp);
717
+ var halfZigBlock = new Array(numComp);
718
+ var rowBlock = new Array(numComp);
719
+ var rowOffsets = new Array(numComp);
720
+
721
+ for (var _comp = 0; _comp < numComp; ++_comp) {
722
+ rowOffsets[_comp] = rowPtrs[cscSet.idx[_comp]];
723
+ currDcComp[_comp] = _comp < 1 ? 0 : currDcComp[_comp - 1] + numBlocksX * numBlocksY;
724
+ dctData[_comp] = new Float32Array(64);
725
+ halfZigBlock[_comp] = new Uint16Array(64);
726
+ rowBlock[_comp] = new Uint16Array(numBlocksX * 64);
727
+ }
728
+
729
+ for (var blocky = 0; blocky < numBlocksY; ++blocky) {
730
+ var maxY = 8;
731
+ if (blocky == numBlocksY - 1) maxY = leftoverY;
732
+ var maxX = 8;
733
+
734
+ for (var blockx = 0; blockx < numBlocksX; ++blockx) {
735
+ if (blockx == numBlocksX - 1) maxX = leftoverX;
736
+
737
+ for (var _comp2 = 0; _comp2 < numComp; ++_comp2) {
738
+ halfZigBlock[_comp2].fill(0); // set block DC component
739
+
740
+
741
+ halfZigBlock[_comp2][0] = dcBuffer[currDcComp[_comp2]++]; // set block AC components
742
+
743
+ unRleAC(currAcComp, acBuffer, halfZigBlock[_comp2]); // UnZigZag block to float
744
+
745
+ unZigZag(halfZigBlock[_comp2], dctData[_comp2]); // decode float dct
746
+
747
+ dctInverse(dctData[_comp2]);
748
+ }
749
+
750
+ if (numComp == 3) {
751
+ csc709Inverse(dctData);
752
+ }
753
+
754
+ for (var _comp3 = 0; _comp3 < numComp; ++_comp3) {
755
+ convertToHalf(dctData[_comp3], rowBlock[_comp3], blockx * 64);
756
+ }
757
+ } // blockx
758
+
759
+
760
+ var _offset = 0;
761
+
762
+ for (var _comp4 = 0; _comp4 < numComp; ++_comp4) {
763
+ var _type = channelData[cscSet.idx[_comp4]].type;
764
+
765
+ for (var _y = 8 * blocky; _y < 8 * blocky + maxY; ++_y) {
766
+ _offset = rowOffsets[_comp4][_y];
767
+
768
+ for (var _blockx = 0; _blockx < numFullBlocksX; ++_blockx) {
769
+ var src = _blockx * 64 + (_y & 0x7) * 8;
770
+ dataView.setUint16(_offset + 0 * INT16_SIZE * _type, rowBlock[_comp4][src + 0], true);
771
+ dataView.setUint16(_offset + 1 * INT16_SIZE * _type, rowBlock[_comp4][src + 1], true);
772
+ dataView.setUint16(_offset + 2 * INT16_SIZE * _type, rowBlock[_comp4][src + 2], true);
773
+ dataView.setUint16(_offset + 3 * INT16_SIZE * _type, rowBlock[_comp4][src + 3], true);
774
+ dataView.setUint16(_offset + 4 * INT16_SIZE * _type, rowBlock[_comp4][src + 4], true);
775
+ dataView.setUint16(_offset + 5 * INT16_SIZE * _type, rowBlock[_comp4][src + 5], true);
776
+ dataView.setUint16(_offset + 6 * INT16_SIZE * _type, rowBlock[_comp4][src + 6], true);
777
+ dataView.setUint16(_offset + 7 * INT16_SIZE * _type, rowBlock[_comp4][src + 7], true);
778
+ _offset += 8 * INT16_SIZE * _type;
779
+ }
780
+ } // handle partial X blocks
781
+
782
+
783
+ if (numFullBlocksX != numBlocksX) {
784
+ for (var _y2 = 8 * blocky; _y2 < 8 * blocky + maxY; ++_y2) {
785
+ var _offset2 = rowOffsets[_comp4][_y2] + 8 * numFullBlocksX * INT16_SIZE * _type;
786
+
787
+ var _src = numFullBlocksX * 64 + (_y2 & 0x7) * 8;
788
+
789
+ for (var _x = 0; _x < maxX; ++_x) {
790
+ dataView.setUint16(_offset2 + _x * INT16_SIZE * _type, rowBlock[_comp4][_src + _x], true);
791
+ }
792
+ }
793
+ }
794
+ } // comp
795
+
796
+ } // blocky
797
+
798
+
799
+ var halfRow = new Uint16Array(width);
800
+ var dataView = new DataView(outBuffer.buffer); // convert channels back to float, if needed
801
+
802
+ for (var comp = 0; comp < numComp; ++comp) {
803
+ channelData[cscSet.idx[comp]].decoded = true;
804
+ var type = channelData[cscSet.idx[comp]].type;
805
+ if (channelData[comp].type != 2) continue;
806
+
807
+ for (var y = 0; y < height; ++y) {
808
+ var _offset3 = rowOffsets[comp][y];
809
+
810
+ for (var x = 0; x < width; ++x) {
811
+ halfRow[x] = dataView.getUint16(_offset3 + x * INT16_SIZE * type, true);
812
+ }
813
+
814
+ for (var x = 0; x < width; ++x) {
815
+ dataView.setFloat32(_offset3 + x * INT16_SIZE * type, decodeFloat16(halfRow[x]), true);
816
+ }
817
+ }
818
+ }
819
+ }
820
+
821
+ function unRleAC(currAcComp, acBuffer, halfZigBlock) {
822
+ var acValue;
823
+ var dctComp = 1;
824
+
825
+ while (dctComp < 64) {
826
+ acValue = acBuffer[currAcComp.value];
827
+
828
+ if (acValue == 0xff00) {
829
+ dctComp = 64;
830
+ } else if (acValue >> 8 == 0xff) {
831
+ dctComp += acValue & 0xff;
832
+ } else {
833
+ halfZigBlock[dctComp] = acValue;
834
+ dctComp++;
835
+ }
836
+
837
+ currAcComp.value++;
838
+ }
839
+ }
840
+
841
+ function unZigZag(src, dst) {
842
+ dst[0] = decodeFloat16(src[0]);
843
+ dst[1] = decodeFloat16(src[1]);
844
+ dst[2] = decodeFloat16(src[5]);
845
+ dst[3] = decodeFloat16(src[6]);
846
+ dst[4] = decodeFloat16(src[14]);
847
+ dst[5] = decodeFloat16(src[15]);
848
+ dst[6] = decodeFloat16(src[27]);
849
+ dst[7] = decodeFloat16(src[28]);
850
+ dst[8] = decodeFloat16(src[2]);
851
+ dst[9] = decodeFloat16(src[4]);
852
+ dst[10] = decodeFloat16(src[7]);
853
+ dst[11] = decodeFloat16(src[13]);
854
+ dst[12] = decodeFloat16(src[16]);
855
+ dst[13] = decodeFloat16(src[26]);
856
+ dst[14] = decodeFloat16(src[29]);
857
+ dst[15] = decodeFloat16(src[42]);
858
+ dst[16] = decodeFloat16(src[3]);
859
+ dst[17] = decodeFloat16(src[8]);
860
+ dst[18] = decodeFloat16(src[12]);
861
+ dst[19] = decodeFloat16(src[17]);
862
+ dst[20] = decodeFloat16(src[25]);
863
+ dst[21] = decodeFloat16(src[30]);
864
+ dst[22] = decodeFloat16(src[41]);
865
+ dst[23] = decodeFloat16(src[43]);
866
+ dst[24] = decodeFloat16(src[9]);
867
+ dst[25] = decodeFloat16(src[11]);
868
+ dst[26] = decodeFloat16(src[18]);
869
+ dst[27] = decodeFloat16(src[24]);
870
+ dst[28] = decodeFloat16(src[31]);
871
+ dst[29] = decodeFloat16(src[40]);
872
+ dst[30] = decodeFloat16(src[44]);
873
+ dst[31] = decodeFloat16(src[53]);
874
+ dst[32] = decodeFloat16(src[10]);
875
+ dst[33] = decodeFloat16(src[19]);
876
+ dst[34] = decodeFloat16(src[23]);
877
+ dst[35] = decodeFloat16(src[32]);
878
+ dst[36] = decodeFloat16(src[39]);
879
+ dst[37] = decodeFloat16(src[45]);
880
+ dst[38] = decodeFloat16(src[52]);
881
+ dst[39] = decodeFloat16(src[54]);
882
+ dst[40] = decodeFloat16(src[20]);
883
+ dst[41] = decodeFloat16(src[22]);
884
+ dst[42] = decodeFloat16(src[33]);
885
+ dst[43] = decodeFloat16(src[38]);
886
+ dst[44] = decodeFloat16(src[46]);
887
+ dst[45] = decodeFloat16(src[51]);
888
+ dst[46] = decodeFloat16(src[55]);
889
+ dst[47] = decodeFloat16(src[60]);
890
+ dst[48] = decodeFloat16(src[21]);
891
+ dst[49] = decodeFloat16(src[34]);
892
+ dst[50] = decodeFloat16(src[37]);
893
+ dst[51] = decodeFloat16(src[47]);
894
+ dst[52] = decodeFloat16(src[50]);
895
+ dst[53] = decodeFloat16(src[56]);
896
+ dst[54] = decodeFloat16(src[59]);
897
+ dst[55] = decodeFloat16(src[61]);
898
+ dst[56] = decodeFloat16(src[35]);
899
+ dst[57] = decodeFloat16(src[36]);
900
+ dst[58] = decodeFloat16(src[48]);
901
+ dst[59] = decodeFloat16(src[49]);
902
+ dst[60] = decodeFloat16(src[57]);
903
+ dst[61] = decodeFloat16(src[58]);
904
+ dst[62] = decodeFloat16(src[62]);
905
+ dst[63] = decodeFloat16(src[63]);
906
+ }
907
+
908
+ function dctInverse(data) {
909
+ var a = 0.5 * Math.cos(3.14159 / 4.0);
910
+ var b = 0.5 * Math.cos(3.14159 / 16.0);
911
+ var c = 0.5 * Math.cos(3.14159 / 8.0);
912
+ var d = 0.5 * Math.cos(3.0 * 3.14159 / 16.0);
913
+ var e = 0.5 * Math.cos(5.0 * 3.14159 / 16.0);
914
+ var f = 0.5 * Math.cos(3.0 * 3.14159 / 8.0);
915
+ var g = 0.5 * Math.cos(7.0 * 3.14159 / 16.0);
916
+ var alpha = new Array(4);
917
+ var beta = new Array(4);
918
+ var theta = new Array(4);
919
+ var gamma = new Array(4);
920
+
921
+ for (var row = 0; row < 8; ++row) {
922
+ var rowPtr = row * 8;
923
+ alpha[0] = c * data[rowPtr + 2];
924
+ alpha[1] = f * data[rowPtr + 2];
925
+ alpha[2] = c * data[rowPtr + 6];
926
+ alpha[3] = f * data[rowPtr + 6];
927
+ beta[0] = b * data[rowPtr + 1] + d * data[rowPtr + 3] + e * data[rowPtr + 5] + g * data[rowPtr + 7];
928
+ beta[1] = d * data[rowPtr + 1] - g * data[rowPtr + 3] - b * data[rowPtr + 5] - e * data[rowPtr + 7];
929
+ beta[2] = e * data[rowPtr + 1] - b * data[rowPtr + 3] + g * data[rowPtr + 5] + d * data[rowPtr + 7];
930
+ beta[3] = g * data[rowPtr + 1] - e * data[rowPtr + 3] + d * data[rowPtr + 5] - b * data[rowPtr + 7];
931
+ theta[0] = a * (data[rowPtr + 0] + data[rowPtr + 4]);
932
+ theta[3] = a * (data[rowPtr + 0] - data[rowPtr + 4]);
933
+ theta[1] = alpha[0] + alpha[3];
934
+ theta[2] = alpha[1] - alpha[2];
935
+ gamma[0] = theta[0] + theta[1];
936
+ gamma[1] = theta[3] + theta[2];
937
+ gamma[2] = theta[3] - theta[2];
938
+ gamma[3] = theta[0] - theta[1];
939
+ data[rowPtr + 0] = gamma[0] + beta[0];
940
+ data[rowPtr + 1] = gamma[1] + beta[1];
941
+ data[rowPtr + 2] = gamma[2] + beta[2];
942
+ data[rowPtr + 3] = gamma[3] + beta[3];
943
+ data[rowPtr + 4] = gamma[3] - beta[3];
944
+ data[rowPtr + 5] = gamma[2] - beta[2];
945
+ data[rowPtr + 6] = gamma[1] - beta[1];
946
+ data[rowPtr + 7] = gamma[0] - beta[0];
947
+ }
948
+
949
+ for (var column = 0; column < 8; ++column) {
950
+ alpha[0] = c * data[16 + column];
951
+ alpha[1] = f * data[16 + column];
952
+ alpha[2] = c * data[48 + column];
953
+ alpha[3] = f * data[48 + column];
954
+ beta[0] = b * data[8 + column] + d * data[24 + column] + e * data[40 + column] + g * data[56 + column];
955
+ beta[1] = d * data[8 + column] - g * data[24 + column] - b * data[40 + column] - e * data[56 + column];
956
+ beta[2] = e * data[8 + column] - b * data[24 + column] + g * data[40 + column] + d * data[56 + column];
957
+ beta[3] = g * data[8 + column] - e * data[24 + column] + d * data[40 + column] - b * data[56 + column];
958
+ theta[0] = a * (data[column] + data[32 + column]);
959
+ theta[3] = a * (data[column] - data[32 + column]);
960
+ theta[1] = alpha[0] + alpha[3];
961
+ theta[2] = alpha[1] - alpha[2];
962
+ gamma[0] = theta[0] + theta[1];
963
+ gamma[1] = theta[3] + theta[2];
964
+ gamma[2] = theta[3] - theta[2];
965
+ gamma[3] = theta[0] - theta[1];
966
+ data[0 + column] = gamma[0] + beta[0];
967
+ data[8 + column] = gamma[1] + beta[1];
968
+ data[16 + column] = gamma[2] + beta[2];
969
+ data[24 + column] = gamma[3] + beta[3];
970
+ data[32 + column] = gamma[3] - beta[3];
971
+ data[40 + column] = gamma[2] - beta[2];
972
+ data[48 + column] = gamma[1] - beta[1];
973
+ data[56 + column] = gamma[0] - beta[0];
974
+ }
975
+ }
976
+
977
+ function csc709Inverse(data) {
978
+ for (var i = 0; i < 64; ++i) {
979
+ var y = data[0][i];
980
+ var cb = data[1][i];
981
+ var cr = data[2][i];
982
+ data[0][i] = y + 1.5747 * cr;
983
+ data[1][i] = y - 0.1873 * cb - 0.4682 * cr;
984
+ data[2][i] = y + 1.8556 * cb;
985
+ }
986
+ }
987
+
988
+ function convertToHalf(src, dst, idx) {
989
+ for (var i = 0; i < 64; ++i) {
990
+ dst[idx + i] = _three.DataUtils.toHalfFloat(toLinear(src[i]));
991
+ }
992
+ }
993
+
994
+ function toLinear(float) {
995
+ if (float <= 1) {
996
+ return Math.sign(float) * Math.pow(Math.abs(float), 2.2);
997
+ } else {
998
+ return Math.sign(float) * Math.pow(logBase, Math.abs(float) - 1.0);
999
+ }
1000
+ }
1001
+
1002
+ function uncompressRAW(info) {
1003
+ return new DataView(info.array.buffer, info.offset.value, info.size);
1004
+ }
1005
+
1006
+ function uncompressRLE(info) {
1007
+ var compressed = info.viewer.buffer.slice(info.offset.value, info.offset.value + info.size);
1008
+ var rawBuffer = new Uint8Array(decodeRunLength(compressed));
1009
+ var tmpBuffer = new Uint8Array(rawBuffer.length);
1010
+ predictor(rawBuffer); // revert predictor
1011
+
1012
+ interleaveScalar(rawBuffer, tmpBuffer); // interleave pixels
1013
+
1014
+ return new DataView(tmpBuffer.buffer);
1015
+ }
1016
+
1017
+ function uncompressZIP(info) {
1018
+ var compressed = info.array.slice(info.offset.value, info.offset.value + info.size);
1019
+
1020
+ if (typeof fflate === 'undefined') {
1021
+ console.error('THREE.EXRLoader: External library fflate.min.js required.');
1022
+ }
1023
+
1024
+ var rawBuffer = fflate.unzlibSync(compressed); // eslint-disable-line no-undef
1025
+
1026
+ var tmpBuffer = new Uint8Array(rawBuffer.length);
1027
+ predictor(rawBuffer); // revert predictor
1028
+
1029
+ interleaveScalar(rawBuffer, tmpBuffer); // interleave pixels
1030
+
1031
+ return new DataView(tmpBuffer.buffer);
1032
+ }
1033
+
1034
+ function uncompressPIZ(info) {
1035
+ var inDataView = info.viewer;
1036
+ var inOffset = {
1037
+ value: info.offset.value
1038
+ };
1039
+ var tmpBufSize = info.width * scanlineBlockSize * (EXRHeader.channels.length * info.type);
1040
+ var outBuffer = new Uint16Array(tmpBufSize);
1041
+ var bitmap = new Uint8Array(BITMAP_SIZE); // Setup channel info
1042
+
1043
+ var outBufferEnd = 0;
1044
+ var pizChannelData = new Array(info.channels);
1045
+
1046
+ for (var i = 0; i < info.channels; i++) {
1047
+ pizChannelData[i] = {};
1048
+ pizChannelData[i]['start'] = outBufferEnd;
1049
+ pizChannelData[i]['end'] = pizChannelData[i]['start'];
1050
+ pizChannelData[i]['nx'] = info.width;
1051
+ pizChannelData[i]['ny'] = info.lines;
1052
+ pizChannelData[i]['size'] = info.type;
1053
+ outBufferEnd += pizChannelData[i].nx * pizChannelData[i].ny * pizChannelData[i].size;
1054
+ } // Read range compression data
1055
+
1056
+
1057
+ var minNonZero = parseUint16(inDataView, inOffset);
1058
+ var maxNonZero = parseUint16(inDataView, inOffset);
1059
+
1060
+ if (maxNonZero >= BITMAP_SIZE) {
1061
+ throw 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE';
1062
+ }
1063
+
1064
+ if (minNonZero <= maxNonZero) {
1065
+ for (var i = 0; i < maxNonZero - minNonZero + 1; i++) {
1066
+ bitmap[i + minNonZero] = parseUint8(inDataView, inOffset);
1067
+ }
1068
+ } // Reverse LUT
1069
+
1070
+
1071
+ var lut = new Uint16Array(USHORT_RANGE);
1072
+ var maxValue = reverseLutFromBitmap(bitmap, lut);
1073
+ var length = parseUint32(inDataView, inOffset); // Huffman decoding
1074
+
1075
+ hufUncompress(info.array, inDataView, inOffset, length, outBuffer, outBufferEnd); // Wavelet decoding
1076
+
1077
+ for (var i = 0; i < info.channels; ++i) {
1078
+ var cd = pizChannelData[i];
1079
+
1080
+ for (var j = 0; j < pizChannelData[i].size; ++j) {
1081
+ wav2Decode(outBuffer, cd.start + j, cd.nx, cd.size, cd.ny, cd.nx * cd.size, maxValue);
1082
+ }
1083
+ } // Expand the pixel data to their original range
1084
+
1085
+
1086
+ applyLut(lut, outBuffer, outBufferEnd); // Rearrange the pixel data into the format expected by the caller.
1087
+
1088
+ var tmpOffset = 0;
1089
+ var tmpBuffer = new Uint8Array(outBuffer.buffer.byteLength);
1090
+
1091
+ for (var y = 0; y < info.lines; y++) {
1092
+ for (var c = 0; c < info.channels; c++) {
1093
+ var cd = pizChannelData[c];
1094
+ var n = cd.nx * cd.size;
1095
+ var cp = new Uint8Array(outBuffer.buffer, cd.end * INT16_SIZE, n * INT16_SIZE);
1096
+ tmpBuffer.set(cp, tmpOffset);
1097
+ tmpOffset += n * INT16_SIZE;
1098
+ cd.end += n;
1099
+ }
1100
+ }
1101
+
1102
+ return new DataView(tmpBuffer.buffer);
1103
+ }
1104
+
1105
+ function uncompressPXR(info) {
1106
+ var compressed = info.array.slice(info.offset.value, info.offset.value + info.size);
1107
+
1108
+ if (typeof fflate === 'undefined') {
1109
+ console.error('THREE.EXRLoader: External library fflate.min.js required.');
1110
+ }
1111
+
1112
+ var rawBuffer = fflate.unzlibSync(compressed); // eslint-disable-line no-undef
1113
+
1114
+ var sz = info.lines * info.channels * info.width;
1115
+ var tmpBuffer = info.type == 1 ? new Uint16Array(sz) : new Uint32Array(sz);
1116
+ var tmpBufferEnd = 0;
1117
+ var writePtr = 0;
1118
+ var ptr = new Array(4);
1119
+
1120
+ for (var y = 0; y < info.lines; y++) {
1121
+ for (var c = 0; c < info.channels; c++) {
1122
+ var pixel = 0;
1123
+
1124
+ switch (info.type) {
1125
+ case 1:
1126
+ ptr[0] = tmpBufferEnd;
1127
+ ptr[1] = ptr[0] + info.width;
1128
+ tmpBufferEnd = ptr[1] + info.width;
1129
+
1130
+ for (var j = 0; j < info.width; ++j) {
1131
+ var diff = rawBuffer[ptr[0]++] << 8 | rawBuffer[ptr[1]++];
1132
+ pixel += diff;
1133
+ tmpBuffer[writePtr] = pixel;
1134
+ writePtr++;
1135
+ }
1136
+
1137
+ break;
1138
+
1139
+ case 2:
1140
+ ptr[0] = tmpBufferEnd;
1141
+ ptr[1] = ptr[0] + info.width;
1142
+ ptr[2] = ptr[1] + info.width;
1143
+ tmpBufferEnd = ptr[2] + info.width;
1144
+
1145
+ for (var _j = 0; _j < info.width; ++_j) {
1146
+ var _diff = rawBuffer[ptr[0]++] << 24 | rawBuffer[ptr[1]++] << 16 | rawBuffer[ptr[2]++] << 8;
1147
+
1148
+ pixel += _diff;
1149
+ tmpBuffer[writePtr] = pixel;
1150
+ writePtr++;
1151
+ }
1152
+
1153
+ break;
1154
+ }
1155
+ }
1156
+ }
1157
+
1158
+ return new DataView(tmpBuffer.buffer);
1159
+ }
1160
+
1161
+ function uncompressDWA(info) {
1162
+ var inDataView = info.viewer;
1163
+ var inOffset = {
1164
+ value: info.offset.value
1165
+ };
1166
+ var outBuffer = new Uint8Array(info.width * info.lines * (EXRHeader.channels.length * info.type * INT16_SIZE)); // Read compression header information
1167
+
1168
+ var dwaHeader = {
1169
+ version: parseInt64(inDataView, inOffset),
1170
+ unknownUncompressedSize: parseInt64(inDataView, inOffset),
1171
+ unknownCompressedSize: parseInt64(inDataView, inOffset),
1172
+ acCompressedSize: parseInt64(inDataView, inOffset),
1173
+ dcCompressedSize: parseInt64(inDataView, inOffset),
1174
+ rleCompressedSize: parseInt64(inDataView, inOffset),
1175
+ rleUncompressedSize: parseInt64(inDataView, inOffset),
1176
+ rleRawSize: parseInt64(inDataView, inOffset),
1177
+ totalAcUncompressedCount: parseInt64(inDataView, inOffset),
1178
+ totalDcUncompressedCount: parseInt64(inDataView, inOffset),
1179
+ acCompression: parseInt64(inDataView, inOffset)
1180
+ };
1181
+ if (dwaHeader.version < 2) throw 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported'; // Read channel ruleset information
1182
+
1183
+ var channelRules = new Array();
1184
+ var ruleSize = parseUint16(inDataView, inOffset) - INT16_SIZE;
1185
+
1186
+ while (ruleSize > 0) {
1187
+ var name = parseNullTerminatedString(inDataView.buffer, inOffset);
1188
+ var value = parseUint8(inDataView, inOffset);
1189
+ var compression = value >> 2 & 3;
1190
+ var csc = (value >> 4) - 1;
1191
+ var index = new Int8Array([csc])[0];
1192
+ var type = parseUint8(inDataView, inOffset);
1193
+ channelRules.push({
1194
+ name: name,
1195
+ index: index,
1196
+ type: type,
1197
+ compression: compression
1198
+ });
1199
+ ruleSize -= name.length + 3;
1200
+ } // Classify channels
1201
+
1202
+
1203
+ var channels = EXRHeader.channels;
1204
+ var channelData = new Array(info.channels);
1205
+
1206
+ for (var i = 0; i < info.channels; ++i) {
1207
+ var cd = channelData[i] = {};
1208
+ var channel = channels[i];
1209
+ cd.name = channel.name;
1210
+ cd.compression = UNKNOWN;
1211
+ cd.decoded = false;
1212
+ cd.type = channel.pixelType;
1213
+ cd.pLinear = channel.pLinear;
1214
+ cd.width = info.width;
1215
+ cd.height = info.lines;
1216
+ }
1217
+
1218
+ var cscSet = {
1219
+ idx: new Array(3)
1220
+ };
1221
+
1222
+ for (var offset = 0; offset < info.channels; ++offset) {
1223
+ var cd = channelData[offset];
1224
+
1225
+ for (var i = 0; i < channelRules.length; ++i) {
1226
+ var rule = channelRules[i];
1227
+
1228
+ if (cd.name == rule.name) {
1229
+ cd.compression = rule.compression;
1230
+
1231
+ if (rule.index >= 0) {
1232
+ cscSet.idx[rule.index] = offset;
1233
+ }
1234
+
1235
+ cd.offset = offset;
1236
+ }
1237
+ }
1238
+ } // Read DCT - AC component data
1239
+
1240
+
1241
+ if (dwaHeader.acCompressedSize > 0) {
1242
+ switch (dwaHeader.acCompression) {
1243
+ case STATIC_HUFFMAN:
1244
+ var acBuffer = new Uint16Array(dwaHeader.totalAcUncompressedCount);
1245
+ hufUncompress(info.array, inDataView, inOffset, dwaHeader.acCompressedSize, acBuffer, dwaHeader.totalAcUncompressedCount);
1246
+ break;
1247
+
1248
+ case DEFLATE:
1249
+ var compressed = info.array.slice(inOffset.value, inOffset.value + dwaHeader.totalAcUncompressedCount);
1250
+ var data = fflate.unzlibSync(compressed); // eslint-disable-line no-undef
1251
+
1252
+ var acBuffer = new Uint16Array(data.buffer);
1253
+ inOffset.value += dwaHeader.totalAcUncompressedCount;
1254
+ break;
1255
+ }
1256
+ } // Read DCT - DC component data
1257
+
1258
+
1259
+ if (dwaHeader.dcCompressedSize > 0) {
1260
+ var zlibInfo = {
1261
+ array: info.array,
1262
+ offset: inOffset,
1263
+ size: dwaHeader.dcCompressedSize
1264
+ };
1265
+ var dcBuffer = new Uint16Array(uncompressZIP(zlibInfo).buffer);
1266
+ inOffset.value += dwaHeader.dcCompressedSize;
1267
+ } // Read RLE compressed data
1268
+
1269
+
1270
+ if (dwaHeader.rleRawSize > 0) {
1271
+ var compressed = info.array.slice(inOffset.value, inOffset.value + dwaHeader.rleCompressedSize);
1272
+ var data = fflate.unzlibSync(compressed); // eslint-disable-line no-undef
1273
+
1274
+ var rleBuffer = decodeRunLength(data.buffer);
1275
+ inOffset.value += dwaHeader.rleCompressedSize;
1276
+ } // Prepare outbuffer data offset
1277
+
1278
+
1279
+ var outBufferEnd = 0;
1280
+ var rowOffsets = new Array(channelData.length);
1281
+
1282
+ for (var i = 0; i < rowOffsets.length; ++i) {
1283
+ rowOffsets[i] = new Array();
1284
+ }
1285
+
1286
+ for (var y = 0; y < info.lines; ++y) {
1287
+ for (var chan = 0; chan < channelData.length; ++chan) {
1288
+ rowOffsets[chan].push(outBufferEnd);
1289
+ outBufferEnd += channelData[chan].width * info.type * INT16_SIZE;
1290
+ }
1291
+ } // Lossy DCT decode RGB channels
1292
+
1293
+
1294
+ lossyDctDecode(cscSet, rowOffsets, channelData, acBuffer, dcBuffer, outBuffer); // Decode other channels
1295
+
1296
+ for (var i = 0; i < channelData.length; ++i) {
1297
+ var cd = channelData[i];
1298
+ if (cd.decoded) continue;
1299
+
1300
+ switch (cd.compression) {
1301
+ case RLE:
1302
+ var row = 0;
1303
+ var rleOffset = 0;
1304
+
1305
+ for (var y = 0; y < info.lines; ++y) {
1306
+ var rowOffsetBytes = rowOffsets[i][row];
1307
+
1308
+ for (var x = 0; x < cd.width; ++x) {
1309
+ for (var byte = 0; byte < INT16_SIZE * cd.type; ++byte) {
1310
+ outBuffer[rowOffsetBytes++] = rleBuffer[rleOffset + byte * cd.width * cd.height];
1311
+ }
1312
+
1313
+ rleOffset++;
1314
+ }
1315
+
1316
+ row++;
1317
+ }
1318
+
1319
+ break;
1320
+
1321
+ case LOSSY_DCT: // skip
1322
+
1323
+ default:
1324
+ throw 'EXRLoader.parse: unsupported channel compression';
1325
+ }
1326
+ }
1327
+
1328
+ return new DataView(outBuffer.buffer);
1329
+ }
1330
+
1331
+ function parseNullTerminatedString(buffer, offset) {
1332
+ var uintBuffer = new Uint8Array(buffer);
1333
+ var endOffset = 0;
1334
+
1335
+ while (uintBuffer[offset.value + endOffset] != 0) {
1336
+ endOffset += 1;
1337
+ }
1338
+
1339
+ var stringValue = new TextDecoder().decode(uintBuffer.slice(offset.value, offset.value + endOffset));
1340
+ offset.value = offset.value + endOffset + 1;
1341
+ return stringValue;
1342
+ }
1343
+
1344
+ function parseFixedLengthString(buffer, offset, size) {
1345
+ var stringValue = new TextDecoder().decode(new Uint8Array(buffer).slice(offset.value, offset.value + size));
1346
+ offset.value = offset.value + size;
1347
+ return stringValue;
1348
+ }
1349
+
1350
+ function parseUlong(dataView, offset) {
1351
+ var uLong = dataView.getUint32(0, true);
1352
+ offset.value = offset.value + ULONG_SIZE;
1353
+ return uLong;
1354
+ }
1355
+
1356
+ function parseRational(dataView, offset) {
1357
+ var x = parseInt32(dataView, offset);
1358
+ var y = parseUint32(dataView, offset);
1359
+ return [x, y];
1360
+ }
1361
+
1362
+ function parseTimecode(dataView, offset) {
1363
+ var x = parseUint32(dataView, offset);
1364
+ var y = parseUint32(dataView, offset);
1365
+ return [x, y];
1366
+ }
1367
+
1368
+ function parseInt32(dataView, offset) {
1369
+ var Int32 = dataView.getInt32(offset.value, true);
1370
+ offset.value = offset.value + INT32_SIZE;
1371
+ return Int32;
1372
+ }
1373
+
1374
+ function parseUint32(dataView, offset) {
1375
+ var Uint32 = dataView.getUint32(offset.value, true);
1376
+ offset.value = offset.value + INT32_SIZE;
1377
+ return Uint32;
1378
+ }
1379
+
1380
+ function parseUint8Array(uInt8Array, offset) {
1381
+ var Uint8 = uInt8Array[offset.value];
1382
+ offset.value = offset.value + INT8_SIZE;
1383
+ return Uint8;
1384
+ }
1385
+
1386
+ function parseUint8(dataView, offset) {
1387
+ var Uint8 = dataView.getUint8(offset.value);
1388
+ offset.value = offset.value + INT8_SIZE;
1389
+ return Uint8;
1390
+ }
1391
+
1392
+ function parseInt64(dataView, offset) {
1393
+ var int = Number(dataView.getBigInt64(offset.value, true));
1394
+ offset.value += ULONG_SIZE;
1395
+ return int;
1396
+ }
1397
+
1398
+ function parseFloat32(dataView, offset) {
1399
+ var float = dataView.getFloat32(offset.value, true);
1400
+ offset.value += FLOAT32_SIZE;
1401
+ return float;
1402
+ }
1403
+
1404
+ function decodeFloat32(dataView, offset) {
1405
+ return _three.DataUtils.toHalfFloat(parseFloat32(dataView, offset));
1406
+ } // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript
1407
+
1408
+
1409
+ function decodeFloat16(binary) {
1410
+ var exponent = (binary & 0x7C00) >> 10,
1411
+ fraction = binary & 0x03FF;
1412
+ return (binary >> 15 ? -1 : 1) * (exponent ? exponent === 0x1F ? fraction ? NaN : Infinity : Math.pow(2, exponent - 15) * (1 + fraction / 0x400) : 6.103515625e-5 * (fraction / 0x400));
1413
+ }
1414
+
1415
+ function parseUint16(dataView, offset) {
1416
+ var Uint16 = dataView.getUint16(offset.value, true);
1417
+ offset.value += INT16_SIZE;
1418
+ return Uint16;
1419
+ }
1420
+
1421
+ function parseFloat16(buffer, offset) {
1422
+ return decodeFloat16(parseUint16(buffer, offset));
1423
+ }
1424
+
1425
+ function parseChlist(dataView, buffer, offset, size) {
1426
+ var startOffset = offset.value;
1427
+ var channels = [];
1428
+
1429
+ while (offset.value < startOffset + size - 1) {
1430
+ var name = parseNullTerminatedString(buffer, offset);
1431
+ var pixelType = parseInt32(dataView, offset);
1432
+ var pLinear = parseUint8(dataView, offset);
1433
+ offset.value += 3; // reserved, three chars
1434
+
1435
+ var xSampling = parseInt32(dataView, offset);
1436
+ var ySampling = parseInt32(dataView, offset);
1437
+ channels.push({
1438
+ name: name,
1439
+ pixelType: pixelType,
1440
+ pLinear: pLinear,
1441
+ xSampling: xSampling,
1442
+ ySampling: ySampling
1443
+ });
1444
+ }
1445
+
1446
+ offset.value += 1;
1447
+ return channels;
1448
+ }
1449
+
1450
+ function parseChromaticities(dataView, offset) {
1451
+ var redX = parseFloat32(dataView, offset);
1452
+ var redY = parseFloat32(dataView, offset);
1453
+ var greenX = parseFloat32(dataView, offset);
1454
+ var greenY = parseFloat32(dataView, offset);
1455
+ var blueX = parseFloat32(dataView, offset);
1456
+ var blueY = parseFloat32(dataView, offset);
1457
+ var whiteX = parseFloat32(dataView, offset);
1458
+ var whiteY = parseFloat32(dataView, offset);
1459
+ return {
1460
+ redX: redX,
1461
+ redY: redY,
1462
+ greenX: greenX,
1463
+ greenY: greenY,
1464
+ blueX: blueX,
1465
+ blueY: blueY,
1466
+ whiteX: whiteX,
1467
+ whiteY: whiteY
1468
+ };
1469
+ }
1470
+
1471
+ function parseCompression(dataView, offset) {
1472
+ var compressionCodes = ['NO_COMPRESSION', 'RLE_COMPRESSION', 'ZIPS_COMPRESSION', 'ZIP_COMPRESSION', 'PIZ_COMPRESSION', 'PXR24_COMPRESSION', 'B44_COMPRESSION', 'B44A_COMPRESSION', 'DWAA_COMPRESSION', 'DWAB_COMPRESSION'];
1473
+ var compression = parseUint8(dataView, offset);
1474
+ return compressionCodes[compression];
1475
+ }
1476
+
1477
+ function parseBox2i(dataView, offset) {
1478
+ var xMin = parseUint32(dataView, offset);
1479
+ var yMin = parseUint32(dataView, offset);
1480
+ var xMax = parseUint32(dataView, offset);
1481
+ var yMax = parseUint32(dataView, offset);
1482
+ return {
1483
+ xMin: xMin,
1484
+ yMin: yMin,
1485
+ xMax: xMax,
1486
+ yMax: yMax
1487
+ };
1488
+ }
1489
+
1490
+ function parseLineOrder(dataView, offset) {
1491
+ var lineOrders = ['INCREASING_Y'];
1492
+ var lineOrder = parseUint8(dataView, offset);
1493
+ return lineOrders[lineOrder];
1494
+ }
1495
+
1496
+ function parseV2f(dataView, offset) {
1497
+ var x = parseFloat32(dataView, offset);
1498
+ var y = parseFloat32(dataView, offset);
1499
+ return [x, y];
1500
+ }
1501
+
1502
+ function parseV3f(dataView, offset) {
1503
+ var x = parseFloat32(dataView, offset);
1504
+ var y = parseFloat32(dataView, offset);
1505
+ var z = parseFloat32(dataView, offset);
1506
+ return [x, y, z];
1507
+ }
1508
+
1509
+ function parseValue(dataView, buffer, offset, type, size) {
1510
+ if (type === 'string' || type === 'stringvector' || type === 'iccProfile') {
1511
+ return parseFixedLengthString(buffer, offset, size);
1512
+ } else if (type === 'chlist') {
1513
+ return parseChlist(dataView, buffer, offset, size);
1514
+ } else if (type === 'chromaticities') {
1515
+ return parseChromaticities(dataView, offset);
1516
+ } else if (type === 'compression') {
1517
+ return parseCompression(dataView, offset);
1518
+ } else if (type === 'box2i') {
1519
+ return parseBox2i(dataView, offset);
1520
+ } else if (type === 'lineOrder') {
1521
+ return parseLineOrder(dataView, offset);
1522
+ } else if (type === 'float') {
1523
+ return parseFloat32(dataView, offset);
1524
+ } else if (type === 'v2f') {
1525
+ return parseV2f(dataView, offset);
1526
+ } else if (type === 'v3f') {
1527
+ return parseV3f(dataView, offset);
1528
+ } else if (type === 'int') {
1529
+ return parseInt32(dataView, offset);
1530
+ } else if (type === 'rational') {
1531
+ return parseRational(dataView, offset);
1532
+ } else if (type === 'timecode') {
1533
+ return parseTimecode(dataView, offset);
1534
+ } else if (type === 'preview') {
1535
+ offset.value += size;
1536
+ return 'skipped';
1537
+ } else {
1538
+ offset.value += size;
1539
+ return undefined;
1540
+ }
1541
+ }
1542
+
1543
+ var bufferDataView = new DataView(buffer);
1544
+ var uInt8Array = new Uint8Array(buffer);
1545
+ var EXRHeader = {};
1546
+ bufferDataView.getUint32(0, true); // magic
1547
+
1548
+ bufferDataView.getUint8(4, true); // versionByteZero
1549
+
1550
+ bufferDataView.getUint8(5, true); // fullMask
1551
+ // start of header
1552
+
1553
+ var offset = {
1554
+ value: 8
1555
+ }; // start at 8, after magic stuff
1556
+
1557
+ var keepReading = true;
1558
+
1559
+ while (keepReading) {
1560
+ var attributeName = parseNullTerminatedString(buffer, offset);
1561
+
1562
+ if (attributeName == 0) {
1563
+ keepReading = false;
1564
+ } else {
1565
+ var attributeType = parseNullTerminatedString(buffer, offset);
1566
+ var attributeSize = parseUint32(bufferDataView, offset);
1567
+ var attributeValue = parseValue(bufferDataView, buffer, offset, attributeType, attributeSize);
1568
+
1569
+ if (attributeValue === undefined) {
1570
+ console.warn("EXRLoader.parse: skipped unknown header attribute type '".concat(attributeType, "'."));
1571
+ } else {
1572
+ EXRHeader[attributeName] = attributeValue;
1573
+ }
1574
+ }
1575
+ } // offsets
1576
+
1577
+
1578
+ var dataWindowHeight = EXRHeader.dataWindow.yMax + 1;
1579
+ var uncompress;
1580
+ var scanlineBlockSize;
1581
+
1582
+ switch (EXRHeader.compression) {
1583
+ case 'NO_COMPRESSION':
1584
+ scanlineBlockSize = 1;
1585
+ uncompress = uncompressRAW;
1586
+ break;
1587
+
1588
+ case 'RLE_COMPRESSION':
1589
+ scanlineBlockSize = 1;
1590
+ uncompress = uncompressRLE;
1591
+ break;
1592
+
1593
+ case 'ZIPS_COMPRESSION':
1594
+ scanlineBlockSize = 1;
1595
+ uncompress = uncompressZIP;
1596
+ break;
1597
+
1598
+ case 'ZIP_COMPRESSION':
1599
+ scanlineBlockSize = 16;
1600
+ uncompress = uncompressZIP;
1601
+ break;
1602
+
1603
+ case 'PIZ_COMPRESSION':
1604
+ scanlineBlockSize = 32;
1605
+ uncompress = uncompressPIZ;
1606
+ break;
1607
+
1608
+ case 'PXR24_COMPRESSION':
1609
+ scanlineBlockSize = 16;
1610
+ uncompress = uncompressPXR;
1611
+ break;
1612
+
1613
+ case 'DWAA_COMPRESSION':
1614
+ scanlineBlockSize = 32;
1615
+ uncompress = uncompressDWA;
1616
+ break;
1617
+
1618
+ case 'DWAB_COMPRESSION':
1619
+ scanlineBlockSize = 256;
1620
+ uncompress = uncompressDWA;
1621
+ break;
1622
+
1623
+ default:
1624
+ throw 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported';
1625
+ }
1626
+
1627
+ var size_t;
1628
+ var getValue; // mixed pixelType not supported
1629
+
1630
+ var pixelType = EXRHeader.channels[0].pixelType;
1631
+
1632
+ if (pixelType === 1) {
1633
+ // half
1634
+ switch (this.type) {
1635
+ case _three.UnsignedByteType:
1636
+ case _three.FloatType:
1637
+ getValue = parseFloat16;
1638
+ size_t = INT16_SIZE;
1639
+ break;
1640
+
1641
+ case _three.HalfFloatType:
1642
+ getValue = parseUint16;
1643
+ size_t = INT16_SIZE;
1644
+ break;
1645
+ }
1646
+ } else if (pixelType === 2) {
1647
+ // float
1648
+ switch (this.type) {
1649
+ case _three.UnsignedByteType:
1650
+ case _three.FloatType:
1651
+ getValue = parseFloat32;
1652
+ size_t = FLOAT32_SIZE;
1653
+ break;
1654
+
1655
+ case _three.HalfFloatType:
1656
+ getValue = decodeFloat32;
1657
+ size_t = FLOAT32_SIZE;
1658
+ }
1659
+ } else {
1660
+ throw 'EXRLoader.parse: unsupported pixelType ' + pixelType + ' for ' + EXRHeader.compression + '.';
1661
+ }
1662
+
1663
+ var numBlocks = dataWindowHeight / scanlineBlockSize;
1664
+
1665
+ for (var i = 0; i < numBlocks; i++) {
1666
+ parseUlong(bufferDataView, offset); // scanlineOffset
1667
+ } // we should be passed the scanline offset table, start reading pixel data
1668
+
1669
+
1670
+ var width = EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1;
1671
+ var height = EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1; // Firefox only supports RGBA (half) float textures
1672
+ // var numChannels = EXRHeader.channels.length;
1673
+
1674
+ var numChannels = 4;
1675
+ var size = width * height * numChannels; // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten
1676
+
1677
+ switch (this.type) {
1678
+ case _three.UnsignedByteType:
1679
+ case _three.FloatType:
1680
+ var byteArray = new Float32Array(size);
1681
+
1682
+ if (EXRHeader.channels.length < numChannels) {
1683
+ byteArray.fill(1, 0, size);
1684
+ }
1685
+
1686
+ break;
1687
+
1688
+ case _three.HalfFloatType:
1689
+ var byteArray = new Uint16Array(size);
1690
+
1691
+ if (EXRHeader.channels.length < numChannels) {
1692
+ byteArray.fill(0x3C00, 0, size); // Uint16Array holds half float data, 0x3C00 is 1
1693
+ }
1694
+
1695
+ break;
1696
+
1697
+ default:
1698
+ console.error('THREE.EXRLoader: unsupported type: ', this.type);
1699
+ break;
1700
+ }
1701
+
1702
+ var channelOffsets = {
1703
+ R: 0,
1704
+ G: 1,
1705
+ B: 2,
1706
+ A: 3
1707
+ };
1708
+ var compressionInfo = {
1709
+ size: 0,
1710
+ width: width,
1711
+ lines: scanlineBlockSize,
1712
+ offset: offset,
1713
+ array: uInt8Array,
1714
+ viewer: bufferDataView,
1715
+ type: pixelType,
1716
+ channels: EXRHeader.channels.length
1717
+ };
1718
+ var line;
1719
+ var size;
1720
+ var viewer;
1721
+ var tmpOffset = {
1722
+ value: 0
1723
+ };
1724
+
1725
+ for (var scanlineBlockIdx = 0; scanlineBlockIdx < height / scanlineBlockSize; scanlineBlockIdx++) {
1726
+ line = parseUint32(bufferDataView, offset); // line_no
1727
+
1728
+ size = parseUint32(bufferDataView, offset); // data_len
1729
+
1730
+ compressionInfo.lines = line + scanlineBlockSize > height ? height - line : scanlineBlockSize;
1731
+ compressionInfo.offset = offset;
1732
+ compressionInfo.size = size;
1733
+ viewer = uncompress(compressionInfo);
1734
+ offset.value += size;
1735
+
1736
+ for (var line_y = 0; line_y < scanlineBlockSize; line_y++) {
1737
+ var true_y = line_y + scanlineBlockIdx * scanlineBlockSize;
1738
+ if (true_y >= height) break;
1739
+
1740
+ for (var channelID = 0; channelID < EXRHeader.channels.length; channelID++) {
1741
+ var cOff = channelOffsets[EXRHeader.channels[channelID].name];
1742
+
1743
+ for (var x = 0; x < width; x++) {
1744
+ var idx = line_y * (EXRHeader.channels.length * width) + channelID * width + x;
1745
+ tmpOffset.value = idx * size_t;
1746
+ var val = getValue(viewer, tmpOffset);
1747
+ byteArray[(height - 1 - true_y) * (width * numChannels) + x * numChannels + cOff] = val;
1748
+ }
1749
+ }
1750
+ }
1751
+ }
1752
+
1753
+ if (this.type === _three.UnsignedByteType) {
1754
+ var v, _i;
1755
+
1756
+ var _size = byteArray.length;
1757
+ var RGBEArray = new Uint8Array(_size);
1758
+
1759
+ for (var h = 0; h < height; ++h) {
1760
+ for (var w = 0; w < width; ++w) {
1761
+ _i = h * width * 4 + w * 4;
1762
+ var red = byteArray[_i];
1763
+ var green = byteArray[_i + 1];
1764
+ var blue = byteArray[_i + 2];
1765
+ v = red > green ? red : green;
1766
+ v = blue > v ? blue : v;
1767
+
1768
+ if (v < 1e-32) {
1769
+ RGBEArray[_i] = RGBEArray[_i + 1] = RGBEArray[_i + 2] = RGBEArray[_i + 3] = 0;
1770
+ } else {
1771
+ var res = frexp(v);
1772
+ v = res[0] * 256 / v;
1773
+ RGBEArray[_i] = red * v;
1774
+ RGBEArray[_i + 1] = green * v;
1775
+ RGBEArray[_i + 2] = blue * v;
1776
+ RGBEArray[_i + 3] = res[1] + 128;
1777
+ }
1778
+ }
1779
+ }
1780
+
1781
+ byteArray = RGBEArray;
1782
+ }
1783
+
1784
+ var format = this.type === _three.UnsignedByteType ? _three.RGBEFormat : numChannels === 4 ? _three.RGBAFormat : _three.RGBFormat;
1785
+ return {
1786
+ header: EXRHeader,
1787
+ width: width,
1788
+ height: height,
1789
+ data: byteArray,
1790
+ format: format,
1791
+ type: this.type
1792
+ };
1793
+ }
1794
+ }, {
1795
+ key: "setDataType",
1796
+ value: function setDataType(value) {
1797
+ this.type = value;
1798
+ return this;
1799
+ }
1800
+ }, {
1801
+ key: "load",
1802
+ value: function load(url, onLoad, onProgress, onError) {
1803
+ function onLoadCallback(texture, texData) {
1804
+ switch (texture.type) {
1805
+ case _three.UnsignedByteType:
1806
+ texture.encoding = _three.RGBEEncoding;
1807
+ texture.minFilter = _three.NearestFilter;
1808
+ texture.magFilter = _three.NearestFilter;
1809
+ texture.generateMipmaps = false;
1810
+ texture.flipY = false;
1811
+ break;
1812
+
1813
+ case _three.FloatType:
1814
+ case _three.HalfFloatType:
1815
+ texture.encoding = _three.LinearEncoding;
1816
+ texture.minFilter = _three.LinearFilter;
1817
+ texture.magFilter = _three.LinearFilter;
1818
+ texture.generateMipmaps = false;
1819
+ texture.flipY = false;
1820
+ break;
1821
+ }
1822
+
1823
+ if (onLoad) onLoad(texture, texData);
1824
+ }
1825
+
1826
+ return _get(_getPrototypeOf(EXRLoader.prototype), "load", this).call(this, url, onLoadCallback, onProgress, onError);
1827
+ }
1828
+ }]);
1829
+
1830
+ return EXRLoader;
1831
+ }(_three.DataTextureLoader);
1832
+
1833
+ _exports.EXRLoader = EXRLoader;
1834
+ });