super-three 0.184.0 → 0.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/build/three.cjs +1260 -927
  2. package/build/three.core.js +1104 -829
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +156 -98
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +11 -4
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +7538 -3367
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7538 -3366
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -0
  13. package/examples/jsm/controls/ArcballControls.js +6 -2
  14. package/examples/jsm/controls/FirstPersonControls.js +79 -42
  15. package/examples/jsm/controls/TransformControls.js +68 -15
  16. package/examples/jsm/csm/CSMFrustum.js +31 -6
  17. package/examples/jsm/csm/CSMShadowNode.js +4 -1
  18. package/examples/jsm/effects/AsciiEffect.js +14 -1
  19. package/examples/jsm/exporters/DRACOExporter.js +27 -6
  20. package/examples/jsm/exporters/GLTFExporter.js +114 -12
  21. package/examples/jsm/exporters/PLYExporter.js +286 -73
  22. package/examples/jsm/exporters/USDZExporter.js +347 -112
  23. package/examples/jsm/generators/CityGenerator.js +346 -0
  24. package/examples/jsm/generators/ForestGenerator.js +347 -0
  25. package/examples/jsm/generators/TerrainGenerator.js +504 -0
  26. package/examples/jsm/generators/TreeGenerator.js +377 -0
  27. package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
  28. package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
  29. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  30. package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
  31. package/examples/jsm/helpers/LightProbeHelper.js +5 -4
  32. package/examples/jsm/helpers/ViewHelper.js +16 -6
  33. package/examples/jsm/inspector/Inspector.js +53 -15
  34. package/examples/jsm/inspector/RendererInspector.js +152 -36
  35. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
  36. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
  37. package/examples/jsm/inspector/tabs/Console.js +200 -18
  38. package/examples/jsm/inspector/tabs/Memory.js +8 -0
  39. package/examples/jsm/inspector/tabs/Parameters.js +64 -4
  40. package/examples/jsm/inspector/tabs/Performance.js +21 -6
  41. package/examples/jsm/inspector/tabs/Settings.js +51 -9
  42. package/examples/jsm/inspector/tabs/Timeline.js +178 -93
  43. package/examples/jsm/inspector/tabs/Viewer.js +628 -16
  44. package/examples/jsm/inspector/ui/Graph.js +162 -25
  45. package/examples/jsm/inspector/ui/Item.js +92 -13
  46. package/examples/jsm/inspector/ui/List.js +1 -1
  47. package/examples/jsm/inspector/ui/Profiler.js +90 -45
  48. package/examples/jsm/inspector/ui/Style.js +1788 -1401
  49. package/examples/jsm/inspector/ui/Tab.js +5 -3
  50. package/examples/jsm/inspector/ui/Values.js +71 -6
  51. package/examples/jsm/inspector/ui/utils.js +130 -10
  52. package/examples/jsm/libs/basis/README.md +0 -1
  53. package/examples/jsm/libs/demuxer_mp4.js +3 -3
  54. package/examples/jsm/libs/draco/README.md +0 -1
  55. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  56. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  57. package/examples/jsm/libs/mikktspace.module.js +34 -9
  58. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  59. package/examples/jsm/lighting/LightProbeGrid.js +106 -76
  60. package/examples/jsm/lines/LineMaterial.js +38 -15
  61. package/examples/jsm/lines/LineSegments2.js +8 -0
  62. package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
  63. package/examples/jsm/loaders/3DMLoader.js +1 -1
  64. package/examples/jsm/loaders/DRACOLoader.js +46 -13
  65. package/examples/jsm/loaders/EXRLoader.js +27 -55
  66. package/examples/jsm/loaders/HDRLoader.js +6 -28
  67. package/examples/jsm/loaders/KTX2Loader.js +31 -12
  68. package/examples/jsm/loaders/LDrawLoader.js +8 -8
  69. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  70. package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
  71. package/examples/jsm/loaders/LWOLoader.js +4 -0
  72. package/examples/jsm/loaders/LottieLoader.js +1 -1
  73. package/examples/jsm/loaders/MaterialXLoader.js +31 -9
  74. package/examples/jsm/loaders/NRRDLoader.js +3 -3
  75. package/examples/jsm/loaders/PCDLoader.js +7 -7
  76. package/examples/jsm/loaders/PLYLoader.js +218 -55
  77. package/examples/jsm/loaders/SVGLoader.js +547 -495
  78. package/examples/jsm/loaders/TTFLoader.js +1 -1
  79. package/examples/jsm/loaders/USDLoader.js +33 -9
  80. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  81. package/examples/jsm/loaders/usd/USDAParser.js +93 -20
  82. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  83. package/examples/jsm/loaders/usd/USDComposer.js +52 -19
  84. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  85. package/examples/jsm/misc/Volume.js +2 -2
  86. package/examples/jsm/objects/GroundedSkybox.js +1 -1
  87. package/examples/jsm/objects/Reflector.js +2 -3
  88. package/examples/jsm/objects/Water2Mesh.js +1 -1
  89. package/examples/jsm/physics/AmmoPhysics.js +15 -8
  90. package/examples/jsm/physics/RapierPhysics.js +27 -2
  91. package/examples/jsm/shaders/VolumeShader.js +31 -44
  92. package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
  93. package/examples/jsm/transpiler/Linker.js +1 -1
  94. package/examples/jsm/tsl/display/BloomNode.js +59 -19
  95. package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
  96. package/examples/jsm/tsl/display/FXAANode.js +11 -12
  97. package/examples/jsm/tsl/display/GTAONode.js +34 -13
  98. package/examples/jsm/tsl/display/GodraysNode.js +1 -1
  99. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  100. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
  101. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
  102. package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
  103. package/examples/jsm/tsl/display/SSGINode.js +89 -39
  104. package/examples/jsm/tsl/display/SSRNode.js +829 -132
  105. package/examples/jsm/tsl/display/SSSNode.js +2 -2
  106. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
  107. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
  108. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
  109. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  110. package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
  111. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
  112. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  113. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  114. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  115. package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
  116. package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
  117. package/examples/jsm/utils/SceneOptimizer.js +1 -1
  118. package/examples/jsm/webxr/ARButton.js +1 -1
  119. package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
  120. package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
  121. package/package.json +7 -7
  122. package/src/Three.TSL.js +10 -3
  123. package/src/Three.WebGPU.js +4 -0
  124. package/src/animation/AnimationAction.js +15 -11
  125. package/src/animation/AnimationClip.js +0 -139
  126. package/src/animation/KeyframeTrack.js +2 -2
  127. package/src/animation/PropertyBinding.js +2 -2
  128. package/src/cameras/Camera.js +2 -2
  129. package/src/cameras/StereoCamera.js +5 -2
  130. package/src/constants.js +1 -1
  131. package/src/core/BufferGeometry.js +29 -7
  132. package/src/core/Object3D.js +17 -7
  133. package/src/core/Raycaster.js +1 -1
  134. package/src/core/RenderTarget.js +15 -2
  135. package/src/extras/PMREMGenerator.js +6 -4
  136. package/src/extras/TextureUtils.js +1 -1
  137. package/src/extras/core/ShapePath.js +149 -160
  138. package/src/geometries/SphereGeometry.js +8 -3
  139. package/src/helpers/DirectionalLightHelper.js +2 -0
  140. package/src/helpers/HemisphereLightHelper.js +2 -0
  141. package/src/helpers/PointLightHelper.js +2 -0
  142. package/src/helpers/SpotLightHelper.js +1 -1
  143. package/src/loaders/DataTextureLoader.js +69 -38
  144. package/src/loaders/LoadingManager.js +5 -0
  145. package/src/loaders/MaterialLoader.js +36 -266
  146. package/src/loaders/ObjectLoader.js +3 -1
  147. package/src/materials/LineBasicMaterial.js +4 -0
  148. package/src/materials/Material.js +196 -1
  149. package/src/materials/MeshBasicMaterial.js +24 -0
  150. package/src/materials/MeshDepthMaterial.js +10 -0
  151. package/src/materials/MeshDistanceMaterial.js +10 -0
  152. package/src/materials/MeshLambertMaterial.js +40 -1
  153. package/src/materials/MeshMatcapMaterial.js +25 -1
  154. package/src/materials/MeshNormalMaterial.js +9 -1
  155. package/src/materials/MeshPhongMaterial.js +40 -1
  156. package/src/materials/MeshPhysicalMaterial.js +38 -0
  157. package/src/materials/MeshStandardMaterial.js +42 -1
  158. package/src/materials/MeshToonMaterial.js +34 -1
  159. package/src/materials/PointsMaterial.js +7 -0
  160. package/src/materials/ShaderMaterial.js +86 -0
  161. package/src/materials/SpriteMaterial.js +7 -0
  162. package/src/materials/nodes/Line2NodeMaterial.js +378 -322
  163. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  164. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  165. package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
  166. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
  167. package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
  168. package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
  169. package/src/materials/nodes/NodeMaterial.js +115 -71
  170. package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
  171. package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
  172. package/src/math/Box3.js +5 -0
  173. package/src/math/FrustumArray.js +103 -133
  174. package/src/math/Interpolant.js +1 -1
  175. package/src/math/MathUtils.js +2 -2
  176. package/src/math/Matrix3.js +11 -0
  177. package/src/math/Matrix4.js +28 -3
  178. package/src/math/Vector2.js +2 -2
  179. package/src/math/Vector3.js +2 -2
  180. package/src/math/Vector4.js +2 -2
  181. package/src/math/interpolants/BezierInterpolant.js +4 -6
  182. package/src/nodes/Nodes.js +2 -5
  183. package/src/nodes/TSL.js +8 -6
  184. package/src/nodes/accessors/Arrays.js +4 -4
  185. package/src/nodes/accessors/Batch.js +108 -0
  186. package/src/nodes/accessors/Bitangent.js +2 -2
  187. package/src/nodes/accessors/BufferAttributeNode.js +13 -2
  188. package/src/nodes/accessors/Camera.js +7 -7
  189. package/src/nodes/accessors/ClippingNode.js +1 -1
  190. package/src/nodes/accessors/Instance.js +264 -0
  191. package/src/nodes/accessors/MaterialNode.js +18 -2
  192. package/src/nodes/accessors/MaterialProperties.js +4 -3
  193. package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
  194. package/src/nodes/accessors/Normal.js +13 -13
  195. package/src/nodes/accessors/Position.js +5 -1
  196. package/src/nodes/accessors/ReferenceNode.js +1 -0
  197. package/src/nodes/accessors/ReflectVector.js +3 -3
  198. package/src/nodes/accessors/SceneProperties.js +1 -1
  199. package/src/nodes/accessors/Skinning.js +263 -0
  200. package/src/nodes/accessors/StorageBufferNode.js +2 -2
  201. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  202. package/src/nodes/accessors/StorageTextureNode.js +39 -7
  203. package/src/nodes/accessors/Tangent.js +4 -4
  204. package/src/nodes/accessors/TextureNode.js +60 -5
  205. package/src/nodes/code/FunctionNode.js +2 -16
  206. package/src/nodes/core/MRTNode.js +7 -2
  207. package/src/nodes/core/Node.js +39 -2
  208. package/src/nodes/core/NodeBuilder.js +201 -41
  209. package/src/nodes/core/NodeUtils.js +13 -13
  210. package/src/nodes/core/OutputStructNode.js +1 -1
  211. package/src/nodes/core/OverrideContextNode.js +153 -0
  212. package/src/nodes/core/PropertyNode.js +51 -5
  213. package/src/nodes/core/StackNode.js +56 -34
  214. package/src/nodes/core/StructNode.js +4 -6
  215. package/src/nodes/core/StructTypeNode.js +6 -6
  216. package/src/nodes/core/VarNode.js +8 -0
  217. package/src/nodes/core/VaryingNode.js +12 -2
  218. package/src/nodes/display/BlendModes.js +1 -41
  219. package/src/nodes/display/BumpMapNode.js +6 -1
  220. package/src/nodes/display/ColorAdjustment.js +10 -9
  221. package/src/nodes/display/FrontFacingNode.js +38 -9
  222. package/src/nodes/display/NormalMapNode.js +2 -2
  223. package/src/nodes/display/PassNode.js +35 -43
  224. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  225. package/src/nodes/display/RenderOutputNode.js +12 -3
  226. package/src/nodes/functions/VolumetricLightingModel.js +40 -7
  227. package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
  228. package/src/nodes/lighting/EnvironmentNode.js +2 -2
  229. package/src/nodes/lighting/IESSpotLightNode.js +40 -2
  230. package/src/nodes/lighting/LightingContextNode.js +10 -2
  231. package/src/nodes/lighting/LightsNode.js +90 -37
  232. package/src/nodes/lighting/PointShadowNode.js +6 -1
  233. package/src/nodes/lighting/ShadowFilterNode.js +21 -52
  234. package/src/nodes/lighting/ShadowNode.js +34 -14
  235. package/src/nodes/materialx/lib/mx_noise.js +2 -2
  236. package/src/nodes/math/ConditionalNode.js +3 -3
  237. package/src/nodes/math/MathNode.js +39 -11
  238. package/src/nodes/math/OperatorNode.js +23 -23
  239. package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
  240. package/src/nodes/pmrem/PMREMNode.js +33 -2
  241. package/src/nodes/tsl/TSLCore.js +63 -18
  242. package/src/nodes/utils/EquirectUV.js +30 -5
  243. package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
  244. package/src/nodes/utils/Packing.js +35 -4
  245. package/src/nodes/utils/RTTNode.js +40 -24
  246. package/src/nodes/utils/ReflectorNode.js +1 -0
  247. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  248. package/src/objects/BatchedMesh.js +22 -14
  249. package/src/objects/InstancedMesh.js +0 -11
  250. package/src/objects/Skeleton.js +0 -9
  251. package/src/renderers/WebGLRenderer.js +19 -15
  252. package/src/renderers/common/Backend.js +49 -5
  253. package/src/renderers/common/Bindings.js +114 -45
  254. package/src/renderers/common/Buffer.js +9 -0
  255. package/src/renderers/common/ClippingContext.js +10 -2
  256. package/src/renderers/common/Info.js +63 -22
  257. package/src/renderers/common/Lighting.js +53 -5
  258. package/src/renderers/common/RenderList.js +41 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +281 -108
  261. package/src/renderers/common/Sampler.js +16 -48
  262. package/src/renderers/common/Textures.js +32 -5
  263. package/src/renderers/common/TimestampQueryPool.js +1 -1
  264. package/src/renderers/common/UniformsGroup.js +31 -9
  265. package/src/renderers/common/XRManager.js +340 -22
  266. package/src/renderers/common/extras/PMREMGenerator.js +15 -38
  267. package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
  268. package/src/renderers/common/nodes/NodeLibrary.js +4 -4
  269. package/src/renderers/common/nodes/NodeManager.js +63 -14
  270. package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
  271. package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
  272. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
  273. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  274. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  275. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
  276. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  277. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
  278. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
  279. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
  280. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
  281. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
  283. package/src/renderers/webgl/WebGLOutput.js +2 -1
  284. package/src/renderers/webgl/WebGLProgram.js +5 -4
  285. package/src/renderers/webgl/WebGLPrograms.js +12 -5
  286. package/src/renderers/webgl/WebGLRenderLists.js +9 -1
  287. package/src/renderers/webgl/WebGLShaderCache.js +5 -11
  288. package/src/renderers/webgl/WebGLTextures.js +20 -7
  289. package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
  290. package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
  291. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
  292. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
  293. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
  294. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
  295. package/src/renderers/webgpu/WebGPUBackend.js +480 -169
  296. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  297. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  298. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  299. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  300. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  301. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  302. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  303. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  304. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  305. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  306. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  307. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  308. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  309. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  310. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  311. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  312. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  313. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  314. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  315. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  316. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  317. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  318. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  319. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
  320. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
  321. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
  322. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
  323. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
  324. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
  325. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
  326. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
  327. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
  328. package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
  329. package/src/textures/DepthTexture.js +1 -1
  330. package/src/textures/ExternalTexture.js +0 -3
  331. package/examples/fonts/LICENSE +0 -13
  332. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  333. package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
  334. package/examples/fonts/README.md +0 -11
  335. package/examples/fonts/droid/NOTICE +0 -190
  336. package/examples/fonts/droid/README.txt +0 -18
  337. package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
  338. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
  339. package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
  340. package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
  341. package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
  342. package/examples/fonts/gentilis_bold.typeface.json +0 -1
  343. package/examples/fonts/gentilis_regular.typeface.json +0 -1
  344. package/examples/fonts/helvetiker_bold.typeface.json +0 -1
  345. package/examples/fonts/helvetiker_regular.typeface.json +0 -1
  346. package/examples/fonts/optimer_bold.typeface.json +0 -1
  347. package/examples/fonts/optimer_regular.typeface.json +0 -1
  348. package/examples/fonts/ttf/README.md +0 -9
  349. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  350. package/examples/jsm/inspector/extensions/extensions.json +0 -6
  351. package/examples/jsm/libs/ammo.wasm.js +0 -822
  352. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  353. package/examples/jsm/libs/draco/draco_encoder.js +0 -33
  354. package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
  355. package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
  356. package/examples/jsm/libs/opentype.module.js +0 -14506
  357. package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
  358. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
  359. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  360. package/examples/jsm/lighting/TiledLighting.js +0 -42
  361. package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
  362. package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
  363. package/src/nodes/accessors/BatchNode.js +0 -163
  364. package/src/nodes/accessors/InstanceNode.js +0 -349
  365. package/src/nodes/accessors/InstancedMeshNode.js +0 -50
  366. package/src/nodes/accessors/SkinningNode.js +0 -328
@@ -1,7 +1,10 @@
1
1
  import { Color } from '../../math/Color.js';
2
+ import { Box2 } from '../../math/Box2.js';
3
+ import { Vector2 } from '../../math/Vector2.js';
2
4
  import { Path } from './Path.js';
3
5
  import { Shape } from './Shape.js';
4
6
  import { ShapeUtils } from '../ShapeUtils.js';
7
+ import { warn } from '../../utils.js';
5
8
 
6
9
  /**
7
10
  * This class is used to convert a series of paths to an array of
@@ -39,6 +42,14 @@ class ShapePath {
39
42
  */
40
43
  this.currentPath = null;
41
44
 
45
+ /**
46
+ * An object that can be used to store custom data about the shape path.
47
+ * Mainly used by SVGLoader to store style information.
48
+ *
49
+ * @type {Object}
50
+ */
51
+ this.userData = {};
52
+
42
53
  }
43
54
 
44
55
  /**
@@ -130,235 +141,213 @@ class ShapePath {
130
141
  /**
131
142
  * Converts the paths into an array of shapes.
132
143
  *
133
- * @param {boolean} isCCW - By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
134
- * If this flag is set to `true`, then those are flipped.
135
144
  * @return {Array<Shape>} An array of shapes.
136
145
  */
137
- toShapes( isCCW ) {
146
+ toShapes() {
138
147
 
139
- function toShapesNoHoles( inSubpaths ) {
148
+ // Point-in-polygon test using the even-odd ray-casting rule. Valid for
149
+ // simple (non self-intersecting) polygons.
150
+ function pointInPolygon( p, polygon ) {
140
151
 
141
- const shapes = [];
152
+ let inside = false;
153
+ const n = polygon.length;
154
+
155
+ for ( let i = 0, j = n - 1; i < n; j = i ++ ) {
142
156
 
143
- for ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {
157
+ const a = polygon[ i ];
158
+ const b = polygon[ j ];
144
159
 
145
- const tmpPath = inSubpaths[ i ];
160
+ if ( ( a.y > p.y ) !== ( b.y > p.y ) &&
161
+ p.x < ( b.x - a.x ) * ( p.y - a.y ) / ( b.y - a.y ) + a.x ) {
146
162
 
147
- const tmpShape = new Shape();
148
- tmpShape.curves = tmpPath.curves;
163
+ inside = ! inside;
149
164
 
150
- shapes.push( tmpShape );
165
+ }
151
166
 
152
167
  }
153
168
 
154
- return shapes;
169
+ return inside;
155
170
 
156
171
  }
157
172
 
158
- function isPointInsidePolygon( inPt, inPolygon ) {
159
-
160
- const polyLen = inPolygon.length;
161
-
162
- // inPt on polygon contour => immediate success or
163
- // toggling of inside/outside at every single! intersection point of an edge
164
- // with the horizontal line through inPt, left of inPt
165
- // not counting lowerY endpoints of edges and whole edges on that line
166
- let inside = false;
167
- for ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
168
-
169
- let edgeLowPt = inPolygon[ p ];
170
- let edgeHighPt = inPolygon[ q ];
171
-
172
- let edgeDx = edgeHighPt.x - edgeLowPt.x;
173
- let edgeDy = edgeHighPt.y - edgeLowPt.y;
174
-
175
- if ( Math.abs( edgeDy ) > Number.EPSILON ) {
176
-
177
- // not parallel
178
- if ( edgeDy < 0 ) {
179
-
180
- edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;
181
- edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;
173
+ // Returns a point guaranteed to be strictly inside the given simple
174
+ // polygon. First tries the bounding-box center; if that falls outside
175
+ // the polygon, casts a horizontal ray at the center's y and picks the
176
+ // midpoint between the first two sorted intercepts.
177
+ //
178
+ // Port of paper.js' Path#getInteriorPoint()
179
+ // https://github.com/paperjs/paper.js/blob/develop/src/path/PathItem.Boolean.js
180
+ function getInteriorPoint( polygon, boundingBox ) {
182
181
 
183
- }
182
+ const point = boundingBox.getCenter( new Vector2() );
184
183
 
185
- if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue;
184
+ if ( pointInPolygon( point, polygon ) ) return point;
186
185
 
187
- if ( inPt.y === edgeLowPt.y ) {
186
+ const y = point.y;
187
+ const intercepts = [];
188
+ const n = polygon.length;
188
189
 
189
- if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ?
190
- // continue; // no intersection or edgeLowPt => doesn't count !!!
190
+ for ( let i = 0; i < n; i ++ ) {
191
191
 
192
- } else {
192
+ const a = polygon[ i ];
193
+ const b = polygon[ ( i + 1 ) % n ];
193
194
 
194
- const perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );
195
- if ( perpEdge === 0 ) return true; // inPt is on contour ?
196
- if ( perpEdge < 0 ) continue;
197
- inside = ! inside; // true intersection left of inPt
195
+ // Half-open crossing rule counts each vertex exactly once and
196
+ // skips horizontal edges.
197
+ if ( ( a.y > y ) !== ( b.y > y ) ) {
198
198
 
199
- }
200
-
201
- } else {
202
-
203
- // parallel or collinear
204
- if ( inPt.y !== edgeLowPt.y ) continue; // parallel
205
- // edge lies on the same horizontal line as inPt
206
- if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||
207
- ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour !
208
- // continue;
199
+ const x = a.x + ( y - a.y ) * ( b.x - a.x ) / ( b.y - a.y );
200
+ intercepts.push( x );
209
201
 
210
202
  }
211
203
 
212
204
  }
213
205
 
214
- return inside;
215
-
216
- }
206
+ if ( intercepts.length > 1 ) {
217
207
 
218
- const isClockWise = ShapeUtils.isClockWise;
219
-
220
- const subPaths = this.subPaths;
221
- if ( subPaths.length === 0 ) return [];
222
-
223
- let solid, tmpPath, tmpShape;
224
- const shapes = [];
208
+ intercepts.sort( ( a, b ) => a - b );
209
+ point.x = ( intercepts[ 0 ] + intercepts[ 1 ] ) / 2;
225
210
 
226
- if ( subPaths.length === 1 ) {
211
+ }
227
212
 
228
- tmpPath = subPaths[ 0 ];
229
- tmpShape = new Shape();
230
- tmpShape.curves = tmpPath.curves;
231
- shapes.push( tmpShape );
232
- return shapes;
213
+ return point;
233
214
 
234
215
  }
235
216
 
236
- let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );
237
- holesFirst = isCCW ? ! holesFirst : holesFirst;
238
-
239
- // log("Holes first", holesFirst);
217
+ // Resolve fill-rule. Defaults to 'nonzero'.
218
+ let fillRule = ( this.userData.style && this.userData.style.fillRule ) || 'nonzero';
240
219
 
241
- const betterShapeHoles = [];
242
- const newShapes = [];
243
- let newShapeHoles = [];
244
- let mainIdx = 0;
245
- let tmpPoints;
220
+ if ( fillRule !== 'nonzero' && fillRule !== 'evenodd' ) {
246
221
 
247
- newShapes[ mainIdx ] = undefined;
248
- newShapeHoles[ mainIdx ] = [];
222
+ warn( 'Fill-rule "' + fillRule + '" is not supported, falling back to "nonzero".' );
223
+ fillRule = 'nonzero';
249
224
 
250
- for ( let i = 0, l = subPaths.length; i < l; i ++ ) {
225
+ }
251
226
 
252
- tmpPath = subPaths[ i ];
253
- tmpPoints = tmpPath.getPoints();
254
- solid = isClockWise( tmpPoints );
255
- solid = isCCW ? ! solid : solid;
227
+ // Predicate that decides whether a winding number falls inside the fill
228
+ // region, per the SVG fill-rule spec. Works for negative windings too,
229
+ // because JavaScript's bitwise AND preserves odd/even under two's
230
+ // complement.
231
+ const isInside = fillRule === 'nonzero'
232
+ ? ( w => w !== 0 )
233
+ : ( w => ( w & 1 ) !== 0 );
234
+
235
+ // Build an entry per usable subpath. Self-winding follows the standard
236
+ // convention used by ShapeUtils: counter-clockwise (signed area > 0)
237
+ // contributes +1 to the winding number at an interior point,
238
+ // clockwise contributes -1.
239
+ const entries = [];
240
+
241
+ for ( const subPath of this.subPaths ) {
242
+
243
+ const points = subPath.getPoints();
244
+ if ( points.length < 3 ) continue;
245
+
246
+ const area = ShapeUtils.area( points );
247
+ if ( area === 0 ) continue;
248
+
249
+ const boundingBox = new Box2();
250
+ for ( let i = 0; i < points.length; i ++ ) boundingBox.expandByPoint( points[ i ] );
251
+
252
+ entries.push( {
253
+ subPath: subPath,
254
+ points: points,
255
+ boundingBox: boundingBox,
256
+ interiorPoint: getInteriorPoint( points, boundingBox ),
257
+ absArea: Math.abs( area ),
258
+ winding: area < 0 ? - 1 : 1,
259
+ container: null,
260
+ exclude: false,
261
+ role: null
262
+ } );
256
263
 
257
- if ( solid ) {
264
+ }
258
265
 
259
- if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++;
266
+ // Sort by area descending. This guarantees that any subpath that could
267
+ // contain `entries[i]` is located at a smaller index and has already
268
+ // been processed when it's entries[i]'s turn. Port of paper.js'
269
+ // reorientPaths() algorithm.
270
+ entries.sort( ( a, b ) => b.absArea - a.absArea );
260
271
 
261
- newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };
262
- newShapes[ mainIdx ].s.curves = tmpPath.curves;
272
+ // Walk already-processed entries from closest-in-size to largest,
273
+ // stopping at the innermost container. Accumulate the container's
274
+ // cumulative winding into this entry's winding so that the final value
275
+ // equals the winding number at this entry's interior point.
276
+ //
277
+ // A subpath only contributes to the fill boundary when crossing it
278
+ // actually flips the "insideness" per the fill rule; otherwise it's a
279
+ // redundant overlap and gets excluded to avoid double-counting.
280
+ for ( let i = 0; i < entries.length; i ++ ) {
263
281
 
264
- if ( holesFirst ) mainIdx ++;
265
- newShapeHoles[ mainIdx ] = [];
282
+ const entry = entries[ i ];
283
+ let containerWinding = 0;
266
284
 
267
- //log('cw', i);
285
+ for ( let j = i - 1; j >= 0; j -- ) {
268
286
 
269
- } else {
287
+ const candidate = entries[ j ];
270
288
 
271
- newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
289
+ if ( ! candidate.boundingBox.containsBox( entry.boundingBox ) ) continue;
290
+ if ( ! pointInPolygon( entry.interiorPoint, candidate.points ) ) continue;
272
291
 
273
- //log('ccw', i);
292
+ entry.container = candidate.exclude ? candidate.container : candidate;
293
+ containerWinding = candidate.winding;
294
+ entry.winding += containerWinding;
295
+ break;
274
296
 
275
297
  }
276
298
 
277
- }
278
-
279
- // only Holes? -> probably all Shapes with wrong orientation
280
- if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths );
281
-
299
+ if ( isInside( entry.winding ) === isInside( containerWinding ) ) {
282
300
 
283
- if ( newShapes.length > 1 ) {
284
-
285
- let ambiguous = false;
286
- let toChange = 0;
287
-
288
- for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
289
-
290
- betterShapeHoles[ sIdx ] = [];
301
+ entry.exclude = true;
291
302
 
292
303
  }
293
304
 
294
- for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
295
-
296
- const sho = newShapeHoles[ sIdx ];
297
-
298
- for ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {
299
-
300
- const ho = sho[ hIdx ];
301
- let hole_unassigned = true;
302
-
303
- for ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
304
-
305
- if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
306
-
307
- if ( sIdx !== s2Idx ) toChange ++;
308
-
309
- if ( hole_unassigned ) {
310
-
311
- hole_unassigned = false;
312
- betterShapeHoles[ s2Idx ].push( ho );
313
-
314
- } else {
315
-
316
- ambiguous = true;
317
-
318
- }
319
-
320
- }
321
-
322
- }
323
-
324
- if ( hole_unassigned ) {
305
+ }
325
306
 
326
- betterShapeHoles[ sIdx ].push( ho );
307
+ // Classify retained entries. An entry is an outer shape if it has no
308
+ // container or if its container is itself a hole (a solid nested inside
309
+ // a hole becomes a new top-level shape); otherwise it's a hole in its
310
+ // container. Entries were already sorted outermost-first, so each
311
+ // container's role is known by the time we look at it.
312
+ for ( const entry of entries ) {
327
313
 
328
- }
314
+ if ( entry.exclude ) continue;
315
+ entry.role = ( entry.container === null || entry.container.role === 'hole' ) ? 'outer' : 'hole';
329
316
 
330
- }
317
+ }
331
318
 
332
- }
319
+ // Build Shapes for outers first, then attach holes to their container's
320
+ // Shape.
321
+ const shapes = [];
322
+ const shapeByEntry = new Map();
333
323
 
334
- if ( toChange > 0 && ambiguous === false ) {
324
+ for ( const entry of entries ) {
335
325
 
336
- newShapeHoles = betterShapeHoles;
326
+ if ( entry.exclude || entry.role !== 'outer' ) continue;
337
327
 
338
- }
328
+ const shape = new Shape();
329
+ shape.curves = entry.subPath.curves;
330
+ shapes.push( shape );
331
+ shapeByEntry.set( entry, shape );
339
332
 
340
333
  }
341
334
 
342
- let tmpHoles;
335
+ for ( const entry of entries ) {
343
336
 
344
- for ( let i = 0, il = newShapes.length; i < il; i ++ ) {
337
+ if ( entry.exclude || entry.role !== 'hole' ) continue;
345
338
 
346
- tmpShape = newShapes[ i ].s;
347
- shapes.push( tmpShape );
348
- tmpHoles = newShapeHoles[ i ];
339
+ const shape = shapeByEntry.get( entry.container );
340
+ if ( ! shape ) continue;
349
341
 
350
- for ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {
351
-
352
- tmpShape.holes.push( tmpHoles[ j ].h );
353
-
354
- }
342
+ const hole = new Path();
343
+ hole.curves = entry.subPath.curves;
344
+ shape.holes.push( hole );
355
345
 
356
346
  }
357
347
 
358
- //log("shape", shapes);
359
-
360
348
  return shapes;
361
349
 
350
+
362
351
  }
363
352
 
364
353
  }
@@ -76,6 +76,10 @@ class SphereGeometry extends BufferGeometry {
76
76
  const verticesRow = [];
77
77
 
78
78
  const v = iy / heightSegments;
79
+ const theta = thetaStart + v * thetaLength;
80
+
81
+ const y = radius * Math.cos( theta );
82
+ const ringRadius = Math.sqrt( radius * radius - y * y );
79
83
 
80
84
  // special case for the poles
81
85
 
@@ -94,12 +98,13 @@ class SphereGeometry extends BufferGeometry {
94
98
  for ( let ix = 0; ix <= widthSegments; ix ++ ) {
95
99
 
96
100
  const u = ix / widthSegments;
101
+ const phi = phiStart + u * phiLength;
97
102
 
98
103
  // vertex
99
104
 
100
- vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
101
- vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
102
- vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
105
+ vertex.x = - ringRadius * Math.cos( phi );
106
+ vertex.y = y;
107
+ vertex.z = ringRadius * Math.sin( phi );
103
108
 
104
109
  vertices.push( vertex.x, vertex.y, vertex.z );
105
110
 
@@ -116,6 +116,8 @@ class DirectionalLightHelper extends Object3D {
116
116
  */
117
117
  update() {
118
118
 
119
+ this.matrixWorldNeedsUpdate = true;
120
+
119
121
  this.light.updateWorldMatrix( true, false );
120
122
  this.light.target.updateWorldMatrix( true, false );
121
123
 
@@ -118,6 +118,8 @@ class HemisphereLightHelper extends Object3D {
118
118
 
119
119
  }
120
120
 
121
+ this.matrixWorldNeedsUpdate = true;
122
+
121
123
  this.light.updateWorldMatrix( true, false );
122
124
 
123
125
  mesh.lookAt( _vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );
@@ -76,6 +76,8 @@ class PointLightHelper extends Mesh {
76
76
  */
77
77
  update() {
78
78
 
79
+ this.matrixWorldNeedsUpdate = true;
80
+
79
81
  this.light.updateWorldMatrix( true, false );
80
82
 
81
83
  if ( this.color !== undefined ) {
@@ -125,7 +125,7 @@ class SpotLightHelper extends Object3D {
125
125
 
126
126
  }
127
127
 
128
- this.matrixWorld.copy( this.light.matrixWorld );
128
+ this.matrixWorldNeedsUpdate = true;
129
129
 
130
130
  const coneLength = this.light.distance ? this.light.distance : 1000;
131
131
  const coneWidth = coneLength * Math.tan( this.light.angle );
@@ -74,77 +74,108 @@ class DataTextureLoader extends Loader {
74
74
 
75
75
  }
76
76
 
77
- if ( texData.image !== undefined ) {
77
+ scope._applyTexData( texture, texData );
78
78
 
79
- texture.image = texData.image;
79
+ if ( onLoad ) onLoad( texture, texData );
80
80
 
81
- } else if ( texData.data !== undefined ) {
81
+ }, onProgress, onError );
82
82
 
83
- texture.image.width = texData.width;
84
- texture.image.height = texData.height;
85
- texture.image.data = texData.data;
86
83
 
87
- }
84
+ return texture;
88
85
 
89
- texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
90
- texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
86
+ }
91
87
 
92
- texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
93
- texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
88
+ /**
89
+ * Parses the given buffer and returns a configured data texture. Use this method
90
+ * for parsing texture data that is already in memory (e.g. drag and drop or data
91
+ * loaded from a server) without going through {@link DataTextureLoader#load}.
92
+ *
93
+ * @param {ArrayBuffer} buffer - The raw texture data.
94
+ * @return {DataTexture} The data texture.
95
+ */
96
+ createDataTexture( buffer ) {
94
97
 
95
- texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
98
+ const texture = new DataTexture();
96
99
 
97
- if ( texData.colorSpace !== undefined ) {
100
+ this._applyTexData( texture, this.parse( buffer ) );
98
101
 
99
- texture.colorSpace = texData.colorSpace;
102
+ return texture;
100
103
 
101
- }
104
+ }
102
105
 
103
- if ( texData.flipY !== undefined ) {
106
+ /**
107
+ * Applies the given parsed texture data to the given data texture.
108
+ *
109
+ * @private
110
+ * @param {DataTexture} texture - The data texture.
111
+ * @param {DataTextureLoader~TexData} texData - The parsed texture data.
112
+ */
113
+ _applyTexData( texture, texData ) {
104
114
 
105
- texture.flipY = texData.flipY;
115
+ if ( texData.image !== undefined ) {
106
116
 
107
- }
117
+ texture.image = texData.image;
108
118
 
109
- if ( texData.format !== undefined ) {
119
+ } else if ( texData.data !== undefined ) {
110
120
 
111
- texture.format = texData.format;
121
+ texture.image.width = texData.width;
122
+ texture.image.height = texData.height;
123
+ texture.image.data = texData.data;
112
124
 
113
- }
125
+ }
114
126
 
115
- if ( texData.type !== undefined ) {
127
+ texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
128
+ texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
116
129
 
117
- texture.type = texData.type;
130
+ texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
131
+ texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
118
132
 
119
- }
133
+ texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
120
134
 
121
- if ( texData.mipmaps !== undefined ) {
135
+ if ( texData.colorSpace !== undefined ) {
122
136
 
123
- texture.mipmaps = texData.mipmaps;
124
- texture.minFilter = LinearMipmapLinearFilter; // presumably...
137
+ texture.colorSpace = texData.colorSpace;
125
138
 
126
- }
139
+ }
127
140
 
128
- if ( texData.mipmapCount === 1 ) {
141
+ if ( texData.flipY !== undefined ) {
129
142
 
130
- texture.minFilter = LinearFilter;
143
+ texture.flipY = texData.flipY;
131
144
 
132
- }
145
+ }
133
146
 
134
- if ( texData.generateMipmaps !== undefined ) {
147
+ if ( texData.format !== undefined ) {
135
148
 
136
- texture.generateMipmaps = texData.generateMipmaps;
149
+ texture.format = texData.format;
137
150
 
138
- }
151
+ }
139
152
 
140
- texture.needsUpdate = true;
153
+ if ( texData.type !== undefined ) {
141
154
 
142
- if ( onLoad ) onLoad( texture, texData );
155
+ texture.type = texData.type;
143
156
 
144
- }, onProgress, onError );
157
+ }
145
158
 
159
+ if ( texData.mipmaps !== undefined ) {
146
160
 
147
- return texture;
161
+ texture.mipmaps = texData.mipmaps;
162
+ texture.minFilter = LinearMipmapLinearFilter; // presumably...
163
+
164
+ }
165
+
166
+ if ( texData.mipmapCount === 1 ) {
167
+
168
+ texture.minFilter = LinearFilter;
169
+
170
+ }
171
+
172
+ if ( texData.generateMipmaps !== undefined ) {
173
+
174
+ texture.generateMipmaps = texData.generateMipmaps;
175
+
176
+ }
177
+
178
+ texture.needsUpdate = true;
148
179
 
149
180
  }
150
181
 
@@ -156,6 +156,11 @@ class LoadingManager {
156
156
  */
157
157
  this.resolveURL = function ( url ) {
158
158
 
159
+ // Normalize to NFC so that Unicode URIs (e.g. from glTF)
160
+ // are percent-encoded correctly per RFC 3987.
161
+
162
+ url = url.normalize( 'NFC' );
163
+
159
164
  if ( urlModifier ) {
160
165
 
161
166
  return urlModifier( url );