@plastic-software/three 0.180.0 → 0.181.2

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 (357) hide show
  1. package/build/three.cjs +944 -487
  2. package/build/three.core.js +506 -327
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +436 -164
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +8 -2
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +3753 -1177
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +3752 -1176
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  13. package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
  14. package/examples/jsm/animation/CCDIKSolver.js +1 -1
  15. package/examples/jsm/controls/ArcballControls.js +1 -1
  16. package/examples/jsm/controls/DragControls.js +1 -1
  17. package/examples/jsm/controls/FirstPersonControls.js +1 -1
  18. package/examples/jsm/controls/FlyControls.js +1 -1
  19. package/examples/jsm/controls/OrbitControls.js +2 -2
  20. package/examples/jsm/controls/PointerLockControls.js +2 -2
  21. package/examples/jsm/controls/TrackballControls.js +1 -1
  22. package/examples/jsm/controls/TransformControls.js +1 -1
  23. package/examples/jsm/effects/AsciiEffect.js +8 -8
  24. package/examples/jsm/exporters/DRACOExporter.js +2 -2
  25. package/examples/jsm/exporters/EXRExporter.js +1 -1
  26. package/examples/jsm/exporters/GLTFExporter.js +3 -3
  27. package/examples/jsm/exporters/USDZExporter.js +9 -2
  28. package/examples/jsm/geometries/DecalGeometry.js +2 -2
  29. package/examples/jsm/geometries/ParametricGeometry.js +1 -1
  30. package/examples/jsm/geometries/TeapotGeometry.js +2 -2
  31. package/examples/jsm/geometries/TextGeometry.js +3 -2
  32. package/examples/jsm/gpgpu/BitonicSort.js +715 -0
  33. package/examples/jsm/helpers/ViewHelper.js +43 -5
  34. package/examples/jsm/inspector/Inspector.js +427 -0
  35. package/examples/jsm/inspector/RendererInspector.js +415 -0
  36. package/examples/jsm/inspector/tabs/Console.js +204 -0
  37. package/examples/jsm/inspector/tabs/Parameters.js +332 -0
  38. package/examples/jsm/inspector/tabs/Performance.js +268 -0
  39. package/examples/jsm/inspector/tabs/Viewer.js +166 -0
  40. package/examples/jsm/inspector/ui/Graph.js +95 -0
  41. package/examples/jsm/inspector/ui/Item.js +170 -0
  42. package/examples/jsm/inspector/ui/List.js +75 -0
  43. package/examples/jsm/inspector/ui/Profiler.js +170 -0
  44. package/examples/jsm/inspector/ui/Style.js +654 -0
  45. package/examples/jsm/inspector/ui/Tab.js +46 -0
  46. package/examples/jsm/inspector/ui/Values.js +423 -0
  47. package/examples/jsm/inspector/ui/utils.js +56 -0
  48. package/examples/jsm/interactive/HTMLMesh.js +6 -10
  49. package/examples/jsm/interactive/InteractiveGroup.js +1 -1
  50. package/examples/jsm/interactive/SelectionBox.js +30 -0
  51. package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
  52. package/examples/jsm/loaders/3MFLoader.js +1 -1
  53. package/examples/jsm/loaders/ColladaLoader.js +2 -2
  54. package/examples/jsm/loaders/DDSLoader.js +1 -1
  55. package/examples/jsm/loaders/DRACOLoader.js +73 -22
  56. package/examples/jsm/loaders/FBXLoader.js +2 -2
  57. package/examples/jsm/loaders/FontLoader.js +23 -5
  58. package/examples/jsm/loaders/GLTFLoader.js +5 -3
  59. package/examples/jsm/loaders/KTX2Loader.js +28 -21
  60. package/examples/jsm/loaders/KTXLoader.js +2 -2
  61. package/examples/jsm/loaders/LDrawLoader.js +1 -1
  62. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  63. package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
  64. package/examples/jsm/loaders/LWOLoader.js +2 -2
  65. package/examples/jsm/loaders/MaterialXLoader.js +22 -5
  66. package/examples/jsm/loaders/OBJLoader.js +1 -1
  67. package/examples/jsm/loaders/PDBLoader.js +1 -1
  68. package/examples/jsm/loaders/SVGLoader.js +2 -2
  69. package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
  70. package/examples/jsm/math/ConvexHull.js +1 -1
  71. package/examples/jsm/math/ImprovedNoise.js +1 -1
  72. package/examples/jsm/math/SimplexNoise.js +1 -1
  73. package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
  74. package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
  75. package/examples/jsm/misc/TubePainter.js +383 -40
  76. package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
  77. package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
  78. package/examples/jsm/objects/Sky.js +1 -1
  79. package/examples/jsm/objects/SkyMesh.js +1 -1
  80. package/examples/jsm/objects/Water.js +3 -3
  81. package/examples/jsm/objects/WaterMesh.js +6 -6
  82. package/examples/jsm/postprocessing/GlitchPass.js +2 -2
  83. package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
  84. package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
  85. package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
  86. package/examples/jsm/renderers/SVGRenderer.js +1 -1
  87. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
  88. package/examples/jsm/shaders/AfterimageShader.js +1 -1
  89. package/examples/jsm/shaders/BleachBypassShader.js +1 -1
  90. package/examples/jsm/shaders/BokehShader.js +1 -1
  91. package/examples/jsm/shaders/BokehShader2.js +1 -1
  92. package/examples/jsm/shaders/DotScreenShader.js +1 -1
  93. package/examples/jsm/shaders/FocusShader.js +1 -1
  94. package/examples/jsm/shaders/GTAOShader.js +2 -2
  95. package/examples/jsm/shaders/GodRaysShader.js +1 -1
  96. package/examples/jsm/shaders/KaleidoShader.js +1 -1
  97. package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
  98. package/examples/jsm/shaders/SSRShader.js +1 -1
  99. package/examples/jsm/shaders/SepiaShader.js +1 -1
  100. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
  101. package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
  102. package/examples/jsm/shaders/VignetteShader.js +1 -1
  103. package/examples/jsm/transpiler/TSLEncoder.js +7 -0
  104. package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
  105. package/examples/jsm/tsl/display/AnamorphicNode.js +2 -1
  106. package/examples/jsm/tsl/display/BloomNode.js +4 -0
  107. package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
  108. package/examples/jsm/tsl/display/DepthOfFieldNode.js +7 -0
  109. package/examples/jsm/tsl/display/GTAONode.js +45 -5
  110. package/examples/jsm/tsl/display/GaussianBlurNode.js +5 -3
  111. package/examples/jsm/tsl/display/OutlineNode.js +11 -0
  112. package/examples/jsm/tsl/display/SSGINode.js +654 -0
  113. package/examples/jsm/tsl/display/SSRNode.js +2 -0
  114. package/examples/jsm/tsl/display/SSSNode.js +488 -0
  115. package/examples/jsm/tsl/display/TRAANode.js +123 -6
  116. package/examples/jsm/tsl/display/boxBlur.js +1 -0
  117. package/examples/jsm/tsl/display/hashBlur.js +1 -0
  118. package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
  119. package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
  120. package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
  121. package/package.json +5 -10
  122. package/src/Three.Core.js +3 -2
  123. package/src/Three.TSL.js +7 -1
  124. package/src/Three.WebGPU.Nodes.js +2 -0
  125. package/src/Three.WebGPU.js +2 -0
  126. package/src/animation/AnimationClip.js +3 -2
  127. package/src/animation/AnimationMixer.js +3 -3
  128. package/src/animation/AnimationObjectGroup.js +2 -1
  129. package/src/animation/KeyframeTrack.js +7 -6
  130. package/src/animation/PropertyBinding.js +12 -11
  131. package/src/audio/Audio.js +10 -9
  132. package/src/audio/PositionalAudio.js +1 -1
  133. package/src/cameras/OrthographicCamera.js +1 -1
  134. package/src/cameras/PerspectiveCamera.js +1 -1
  135. package/src/cameras/StereoCamera.js +2 -2
  136. package/src/constants.js +1 -1
  137. package/src/core/BufferGeometry.js +8 -8
  138. package/src/core/EventDispatcher.js +1 -1
  139. package/src/core/InterleavedBuffer.js +1 -1
  140. package/src/core/InterleavedBufferAttribute.js +3 -2
  141. package/src/core/Object3D.js +3 -2
  142. package/src/core/Raycaster.js +2 -1
  143. package/src/core/RenderTarget.js +10 -1
  144. package/src/extras/Controls.js +5 -4
  145. package/src/extras/DataUtils.js +2 -1
  146. package/src/extras/Earcut.js +6 -0
  147. package/src/extras/ImageUtils.js +2 -2
  148. package/src/extras/PMREMGenerator.js +268 -55
  149. package/src/extras/core/Curve.js +2 -1
  150. package/src/extras/core/Interpolations.js +7 -1
  151. package/src/extras/core/ShapePath.js +4 -4
  152. package/src/extras/lib/earcut.js +7 -7
  153. package/src/geometries/BoxGeometry.js +1 -0
  154. package/src/geometries/CapsuleGeometry.js +1 -0
  155. package/src/geometries/CircleGeometry.js +1 -0
  156. package/src/geometries/ConeGeometry.js +1 -0
  157. package/src/geometries/CylinderGeometry.js +1 -0
  158. package/src/geometries/DodecahedronGeometry.js +1 -0
  159. package/src/geometries/ExtrudeGeometry.js +8 -6
  160. package/src/geometries/IcosahedronGeometry.js +1 -0
  161. package/src/geometries/LatheGeometry.js +1 -0
  162. package/src/geometries/OctahedronGeometry.js +1 -0
  163. package/src/geometries/PlaneGeometry.js +1 -0
  164. package/src/geometries/RingGeometry.js +1 -0
  165. package/src/geometries/ShapeGeometry.js +1 -0
  166. package/src/geometries/SphereGeometry.js +1 -0
  167. package/src/geometries/TetrahedronGeometry.js +1 -0
  168. package/src/geometries/TorusGeometry.js +1 -0
  169. package/src/geometries/TorusKnotGeometry.js +1 -0
  170. package/src/geometries/TubeGeometry.js +1 -0
  171. package/src/helpers/CameraHelper.js +1 -1
  172. package/src/loaders/AnimationLoader.js +2 -1
  173. package/src/loaders/AudioLoader.js +2 -1
  174. package/src/loaders/BufferGeometryLoader.js +2 -2
  175. package/src/loaders/Cache.js +2 -2
  176. package/src/loaders/DataTextureLoader.js +1 -1
  177. package/src/loaders/FileLoader.js +3 -2
  178. package/src/loaders/ImageBitmapLoader.js +5 -4
  179. package/src/loaders/ImageLoader.js +1 -1
  180. package/src/loaders/Loader.js +3 -3
  181. package/src/loaders/LoadingManager.js +25 -3
  182. package/src/loaders/MaterialLoader.js +3 -2
  183. package/src/loaders/ObjectLoader.js +13 -13
  184. package/src/loaders/TextureLoader.js +1 -1
  185. package/src/loaders/nodes/NodeLoader.js +3 -2
  186. package/src/materials/Material.js +4 -3
  187. package/src/materials/MeshBasicMaterial.js +1 -0
  188. package/src/materials/MeshDepthMaterial.js +1 -0
  189. package/src/materials/MeshLambertMaterial.js +2 -1
  190. package/src/materials/MeshMatcapMaterial.js +22 -0
  191. package/src/materials/MeshNormalMaterial.js +1 -0
  192. package/src/materials/MeshPhongMaterial.js +2 -1
  193. package/src/materials/MeshPhysicalMaterial.js +2 -1
  194. package/src/materials/MeshStandardMaterial.js +8 -7
  195. package/src/materials/MeshToonMaterial.js +1 -0
  196. package/src/materials/PointsMaterial.js +1 -1
  197. package/src/materials/ShaderMaterial.js +2 -2
  198. package/src/materials/nodes/Line2NodeMaterial.js +2 -2
  199. package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
  200. package/src/materials/nodes/NodeMaterial.js +62 -22
  201. package/src/materials/nodes/manager/NodeMaterialObserver.js +2 -1
  202. package/src/math/Color.js +6 -5
  203. package/src/math/ColorManagement.js +2 -2
  204. package/src/math/Cylindrical.js +1 -1
  205. package/src/math/Euler.js +2 -1
  206. package/src/math/MathUtils.js +13 -11
  207. package/src/math/Matrix2.js +1 -1
  208. package/src/math/Matrix3.js +2 -2
  209. package/src/math/Matrix4.js +7 -7
  210. package/src/math/Plane.js +1 -1
  211. package/src/math/Quaternion.js +68 -66
  212. package/src/math/Spherical.js +1 -1
  213. package/src/nodes/Nodes.js +1 -1
  214. package/src/nodes/TSL.js +1 -1
  215. package/src/nodes/accessors/CubeTextureNode.js +3 -2
  216. package/src/nodes/accessors/InstanceNode.js +22 -4
  217. package/src/nodes/accessors/Lights.js +10 -0
  218. package/src/nodes/accessors/Normal.js +5 -4
  219. package/src/nodes/accessors/Position.js +18 -2
  220. package/src/nodes/accessors/ReferenceNode.js +2 -1
  221. package/src/nodes/accessors/SceneNode.js +2 -1
  222. package/src/nodes/accessors/StorageBufferNode.js +2 -1
  223. package/src/nodes/accessors/StorageTextureNode.js +22 -0
  224. package/src/nodes/accessors/Texture3DNode.js +1 -1
  225. package/src/nodes/accessors/TextureNode.js +61 -27
  226. package/src/nodes/code/FunctionCallNode.js +5 -4
  227. package/src/nodes/core/ArrayNode.js +1 -0
  228. package/src/nodes/core/AttributeNode.js +2 -1
  229. package/src/nodes/core/ContextNode.js +5 -10
  230. package/src/nodes/core/IndexNode.js +2 -2
  231. package/src/nodes/core/InputNode.js +2 -1
  232. package/src/nodes/core/InspectorNode.js +128 -0
  233. package/src/nodes/core/{CacheNode.js → IsolateNode.js} +40 -7
  234. package/src/nodes/core/Node.js +137 -12
  235. package/src/nodes/core/NodeBuilder.js +135 -21
  236. package/src/nodes/core/NodeFrame.js +20 -20
  237. package/src/nodes/core/NodeFunction.js +2 -1
  238. package/src/nodes/core/NodeParser.js +2 -1
  239. package/src/nodes/core/NodeUtils.js +17 -90
  240. package/src/nodes/core/ParameterNode.js +31 -0
  241. package/src/nodes/core/PropertyNode.js +7 -0
  242. package/src/nodes/core/StackNode.js +16 -14
  243. package/src/nodes/core/UniformNode.js +2 -1
  244. package/src/nodes/core/VarNode.js +70 -12
  245. package/src/nodes/core/VaryingNode.js +3 -2
  246. package/src/nodes/display/BlendModes.js +5 -4
  247. package/src/nodes/display/BumpMapNode.js +1 -1
  248. package/src/nodes/display/ColorAdjustment.js +1 -1
  249. package/src/nodes/display/NormalMapNode.js +2 -1
  250. package/src/nodes/display/PassNode.js +51 -10
  251. package/src/nodes/display/RenderOutputNode.js +28 -2
  252. package/src/nodes/display/ScreenNode.js +2 -1
  253. package/src/nodes/display/ToneMappingNode.js +31 -4
  254. package/src/nodes/display/ToonOutlinePassNode.js +8 -0
  255. package/src/nodes/fog/Fog.js +3 -2
  256. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
  257. package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
  258. package/src/nodes/functions/BasicLightingModel.js +2 -1
  259. package/src/nodes/functions/PhysicalLightingModel.js +3 -2
  260. package/src/nodes/functions/VolumetricLightingModel.js +5 -5
  261. package/src/nodes/geometry/RangeNode.js +40 -4
  262. package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
  263. package/src/nodes/gpgpu/ComputeNode.js +17 -5
  264. package/src/nodes/gpgpu/SubgroupFunctionNode.js +25 -0
  265. package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
  266. package/src/nodes/lighting/EnvironmentNode.js +6 -6
  267. package/src/nodes/lighting/LightsNode.js +2 -3
  268. package/src/nodes/lighting/PointShadowNode.js +6 -0
  269. package/src/nodes/lighting/ShadowFilterNode.js +2 -0
  270. package/src/nodes/lighting/ShadowNode.js +75 -8
  271. package/src/nodes/math/ConditionalNode.js +6 -5
  272. package/src/nodes/math/MathNode.js +22 -4
  273. package/src/nodes/math/OperatorNode.js +3 -2
  274. package/src/nodes/pmrem/PMREMUtils.js +117 -2
  275. package/src/nodes/shapes/Shapes.js +1 -1
  276. package/src/nodes/tsl/TSLBase.js +5 -2
  277. package/src/nodes/tsl/TSLCore.js +36 -15
  278. package/src/nodes/utils/DebugNode.js +2 -1
  279. package/src/nodes/utils/EventNode.js +36 -0
  280. package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
  281. package/src/nodes/utils/JoinNode.js +3 -2
  282. package/src/nodes/utils/LoopNode.js +20 -24
  283. package/src/nodes/utils/MemberNode.js +2 -1
  284. package/src/nodes/utils/PostProcessingUtils.js +28 -1
  285. package/src/nodes/utils/RTTNode.js +12 -2
  286. package/src/nodes/utils/ReflectorNode.js +10 -3
  287. package/src/objects/Line.js +2 -1
  288. package/src/objects/LineSegments.js +2 -1
  289. package/src/objects/Skeleton.js +3 -2
  290. package/src/objects/SkinnedMesh.js +3 -1
  291. package/src/objects/Sprite.js +2 -1
  292. package/src/renderers/WebGLRenderer.js +49 -33
  293. package/src/renderers/common/Animation.js +13 -1
  294. package/src/renderers/common/Backend.js +93 -30
  295. package/src/renderers/common/Background.js +2 -1
  296. package/src/renderers/common/Bindings.js +56 -2
  297. package/src/renderers/common/CanvasTarget.js +341 -0
  298. package/src/renderers/common/Geometries.js +26 -0
  299. package/src/renderers/common/Info.js +4 -2
  300. package/src/renderers/common/InspectorBase.js +146 -0
  301. package/src/renderers/common/PostProcessing.js +6 -25
  302. package/src/renderers/common/QuadMesh.js +7 -1
  303. package/src/renderers/common/RenderList.js +7 -3
  304. package/src/renderers/common/RenderObject.js +3 -1
  305. package/src/renderers/common/RenderObjects.js +1 -1
  306. package/src/renderers/common/Renderer.js +436 -228
  307. package/src/renderers/common/RendererUtils.js +9 -0
  308. package/src/renderers/common/SampledTexture.js +8 -0
  309. package/src/renderers/common/Sampler.js +37 -11
  310. package/src/renderers/common/StorageTexture.js +9 -1
  311. package/src/renderers/common/Textures.js +89 -35
  312. package/src/renderers/common/TimestampQueryPool.js +63 -1
  313. package/src/renderers/common/UniformsGroup.js +2 -1
  314. package/src/renderers/common/XRManager.js +7 -3
  315. package/src/renderers/common/extras/PMREMGenerator.js +160 -65
  316. package/src/renderers/common/nodes/NodeLibrary.js +4 -2
  317. package/src/renderers/common/nodes/NodeSampler.js +13 -1
  318. package/src/renderers/common/nodes/Nodes.js +38 -16
  319. package/src/renderers/shaders/DFGLUTData.js +64 -0
  320. package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
  321. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
  322. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
  323. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
  324. package/src/renderers/shaders/UniformsLib.js +1 -0
  325. package/src/renderers/shaders/UniformsUtils.js +25 -4
  326. package/src/renderers/webgl/WebGLCapabilities.js +2 -1
  327. package/src/renderers/webgl/WebGLExtensions.js +2 -25
  328. package/src/renderers/webgl/WebGLInfo.js +3 -1
  329. package/src/renderers/webgl/WebGLProgram.js +11 -10
  330. package/src/renderers/webgl/WebGLPrograms.js +2 -1
  331. package/src/renderers/webgl/WebGLShadowMap.js +2 -1
  332. package/src/renderers/webgl/WebGLState.js +15 -14
  333. package/src/renderers/webgl/WebGLTextures.js +18 -14
  334. package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
  335. package/src/renderers/webgl-fallback/WebGLBackend.js +22 -41
  336. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +74 -11
  337. package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
  338. package/src/renderers/webgl-fallback/utils/WebGLState.js +6 -5
  339. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +117 -16
  340. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +42 -12
  341. package/src/renderers/webgpu/WebGPUBackend.js +134 -108
  342. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
  343. package/src/renderers/webgpu/WebGPURenderer.js +3 -2
  344. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +21 -19
  345. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
  346. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +5 -3
  347. package/src/renderers/webgpu/utils/WebGPUConstants.js +5 -0
  348. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +44 -16
  349. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
  350. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +146 -74
  351. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +29 -6
  352. package/src/renderers/webgpu/utils/WebGPUUtils.js +22 -2
  353. package/src/renderers/webxr/WebXRManager.js +3 -2
  354. package/src/textures/Source.js +2 -1
  355. package/src/textures/Texture.js +3 -2
  356. package/src/textures/VideoTexture.js +2 -0
  357. package/src/utils.js +67 -3
@@ -6,7 +6,9 @@ import {
6
6
  FileLoader,
7
7
  Loader,
8
8
  LinearSRGBColorSpace,
9
- SRGBColorSpace
9
+ SRGBColorSpace,
10
+ InterleavedBuffer,
11
+ InterleavedBufferAttribute
10
12
  } from 'three';
11
13
 
12
14
  const _taskCache = new WeakMap();
@@ -14,14 +16,14 @@ const _taskCache = new WeakMap();
14
16
  /**
15
17
  * A loader for the Draco format.
16
18
  *
17
- * [Draco]{@link https://google.github.io/draco/} is an open source library for compressing
19
+ * [Draco](https://google.github.io/draco/) is an open source library for compressing
18
20
  * and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller,
19
21
  * at the cost of additional decoding time on the client device.
20
22
  *
21
23
  * Standalone Draco files have a `.drc` extension, and contain vertex positions, normals, colors,
22
24
  * and other attributes. Draco files do not contain materials, textures, animation, or node hierarchies –
23
25
  * to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted
24
- * to a Draco-compressed glTF file using [glTF-Pipeline]{@link https://github.com/CesiumGS/gltf-pipeline}.
26
+ * to a Draco-compressed glTF file using [glTF-Pipeline](https://github.com/CesiumGS/gltf-pipeline).
25
27
  * When using Draco with glTF, an instance of `DRACOLoader` will be used internally by {@link GLTFLoader}.
26
28
  *
27
29
  * It is recommended to create one DRACOLoader instance and reuse it to avoid loading and creating
@@ -273,16 +275,25 @@ class DRACOLoader extends Loader {
273
275
 
274
276
  for ( let i = 0; i < geometryData.attributes.length; i ++ ) {
275
277
 
276
- const result = geometryData.attributes[ i ];
277
- const name = result.name;
278
- const array = result.array;
279
- const itemSize = result.itemSize;
278
+ const { name, array, itemSize, stride, vertexColorSpace } = geometryData.attributes[ i ];
280
279
 
281
- const attribute = new BufferAttribute( array, itemSize );
280
+ let attribute;
281
+
282
+ if ( itemSize === stride ) {
283
+
284
+ attribute = new BufferAttribute( array, itemSize );
285
+
286
+ } else {
287
+
288
+ const buffer = new InterleavedBuffer( array, stride );
289
+
290
+ attribute = new InterleavedBufferAttribute( buffer, itemSize, 0 );
291
+
292
+ }
282
293
 
283
294
  if ( name === 'color' ) {
284
295
 
285
- this._assignVertexColorSpace( attribute, result.vertexColorSpace );
296
+ this._assignVertexColorSpace( attribute, vertexColorSpace );
286
297
 
287
298
  attribute.normalized = ( array instanceof Float32Array ) === false;
288
299
 
@@ -646,30 +657,70 @@ function DRACOWorker() {
646
657
 
647
658
  }
648
659
 
649
- function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
660
+ function decodeAttribute( draco, decoder, dracoGeometry, attributeName, TypedArray, attribute ) {
650
661
 
651
- const numComponents = attribute.num_components();
652
- const numPoints = dracoGeometry.num_points();
653
- const numValues = numPoints * numComponents;
654
- const byteLength = numValues * attributeType.BYTES_PER_ELEMENT;
655
- const dataType = getDracoDataType( draco, attributeType );
662
+ const count = dracoGeometry.num_points();
663
+ const itemSize = attribute.num_components();
664
+ const dracoDataType = getDracoDataType( draco, TypedArray );
665
+
666
+ // Reference: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#data-alignment
667
+ const srcByteStride = itemSize * TypedArray.BYTES_PER_ELEMENT;
668
+ const dstByteStride = Math.ceil( srcByteStride / 4 ) * 4;
669
+
670
+ const dstStride = dstByteStride / TypedArray.BYTES_PER_ELEMENT
671
+
672
+ const srcByteLength = count * srcByteStride;
673
+ const dstByteLength = count * dstByteStride;
674
+
675
+ const ptr = draco._malloc( srcByteLength );
676
+ decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dracoDataType, srcByteLength, ptr );
677
+
678
+ const srcArray = new TypedArray( draco.HEAPF32.buffer, ptr, srcByteLength / TypedArray.BYTES_PER_ELEMENT );
679
+ let dstArray;
680
+
681
+ if ( srcByteStride === dstByteStride ) {
682
+
683
+ // THREE.BufferAttribute
684
+
685
+ dstArray = srcArray.slice();
686
+
687
+ } else {
688
+
689
+ // THREE.InterleavedBufferAttribute
690
+
691
+ dstArray = new TypedArray( dstByteLength / TypedArray.BYTES_PER_ELEMENT );
692
+
693
+ let dstOffset = 0
694
+
695
+ for ( let i = 0, il = srcArray.length; i < il; i++ ) {
696
+
697
+ for ( let j = 0; j < itemSize; j++ ) {
698
+
699
+ dstArray[ dstOffset + j ] = srcArray[ i * itemSize + j ]
700
+
701
+ }
702
+
703
+ dstOffset += dstStride;
704
+
705
+ }
706
+
707
+ }
656
708
 
657
- const ptr = draco._malloc( byteLength );
658
- decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dataType, byteLength, ptr );
659
- const array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice();
660
709
  draco._free( ptr );
661
710
 
662
711
  return {
663
712
  name: attributeName,
664
- array: array,
665
- itemSize: numComponents
713
+ count: count,
714
+ itemSize: itemSize,
715
+ array: dstArray,
716
+ stride: dstStride
666
717
  };
667
718
 
668
719
  }
669
720
 
670
- function getDracoDataType( draco, attributeType ) {
721
+ function getDracoDataType( draco, TypedArray ) {
671
722
 
672
- switch ( attributeType ) {
723
+ switch ( TypedArray ) {
673
724
 
674
725
  case Float32Array: return draco.DT_FLOAT32;
675
726
  case Int8Array: return draco.DT_INT8;
@@ -61,10 +61,10 @@ let sceneGraph;
61
61
  * - Morph normals / blend shape normals
62
62
  *
63
63
  * FBX format references:
64
- * - [C++ SDK reference]{@link https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html}
64
+ * - [C++ SDK reference](https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html)
65
65
  *
66
66
  * Binary format specification:
67
- * - [FBX binary file format specification]{@link https://code.blender.org/2013/08/fbx-binary-file-format-specification/}
67
+ * - [FBX binary file format specification](https://code.blender.org/2013/08/fbx-binary-file-format-specification/)
68
68
  *
69
69
  * ```js
70
70
  * const loader = new FBXLoader();
@@ -7,7 +7,7 @@ import {
7
7
  /**
8
8
  * A loader for loading fonts.
9
9
  *
10
- * You can convert fonts online using [facetype.js]{@link https://gero3.github.io/facetype.js/}.
10
+ * You can convert fonts online using [facetype.js](https://gero3.github.io/facetype.js/).
11
11
  *
12
12
  * ```js
13
13
  * const loader = new FontLoader();
@@ -109,12 +109,13 @@ class Font {
109
109
  *
110
110
  * @param {string} text - The text.
111
111
  * @param {number} [size=100] - The text size.
112
+ * @param {string} [direction='ltr'] - Char direction: ltr(left to right), rtl(right to left) & tb(top bottom).
112
113
  * @return {Array<Shape>} An array of shapes representing the text.
113
114
  */
114
- generateShapes( text, size = 100 ) {
115
+ generateShapes( text, size = 100, direction = 'ltr' ) {
115
116
 
116
117
  const shapes = [];
117
- const paths = createPaths( text, size, this.data );
118
+ const paths = createPaths( text, size, this.data, direction );
118
119
 
119
120
  for ( let p = 0, pl = paths.length; p < pl; p ++ ) {
120
121
 
@@ -128,7 +129,7 @@ class Font {
128
129
 
129
130
  }
130
131
 
131
- function createPaths( text, size, data ) {
132
+ function createPaths( text, size, data, direction ) {
132
133
 
133
134
  const chars = Array.from( text );
134
135
  const scale = size / data.resolution;
@@ -138,6 +139,12 @@ function createPaths( text, size, data ) {
138
139
 
139
140
  let offsetX = 0, offsetY = 0;
140
141
 
142
+ if ( direction == 'rtl' || direction == 'tb' ) {
143
+
144
+ chars.reverse();
145
+
146
+ }
147
+
141
148
  for ( let i = 0; i < chars.length; i ++ ) {
142
149
 
143
150
  const char = chars[ i ];
@@ -150,7 +157,18 @@ function createPaths( text, size, data ) {
150
157
  } else {
151
158
 
152
159
  const ret = createPath( char, scale, offsetX, offsetY, data );
153
- offsetX += ret.offsetX;
160
+
161
+ if ( direction == 'tb' ) {
162
+
163
+ offsetX = 0;
164
+ offsetY += data.ascender * scale;
165
+
166
+ } else {
167
+
168
+ offsetX += ret.offsetX;
169
+
170
+ }
171
+
154
172
  paths.push( ret.path );
155
173
 
156
174
  }
@@ -70,7 +70,7 @@ import { toTrianglesDrawMode } from '../utils/BufferGeometryUtils.js';
70
70
  /**
71
71
  * A loader for the glTF 2.0 format.
72
72
  *
73
- * [glTF]{@link https://www.khronos.org/gltf/} (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0}
73
+ * [glTF](https://www.khronos.org/gltf/} (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0)
74
74
  * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb)
75
75
  * format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver
76
76
  * one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights,
@@ -99,8 +99,10 @@ import { toTrianglesDrawMode } from '../utils/BufferGeometryUtils.js';
99
99
  * - EXT_mesh_gpu_instancing
100
100
  *
101
101
  * The following glTF 2.0 extension is supported by an external user plugin:
102
- * - [KHR_materials_variants]{@link https://github.com/takahirox/three-gltf-extensions}
103
- * - [MSFT_texture_dds]{@link https://github.com/takahirox/three-gltf-extensions}
102
+ * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions)
103
+ * - [MSFT_texture_dds](https://github.com/takahirox/three-gltf-extensions)
104
+ * - [KHR_animation_pointer](https://github.com/needle-tools/three-animation-pointer)
105
+ * - [NEEDLE_progressive](https://github.com/needle-tools/gltf-progressive)
104
106
  *
105
107
  * ```js
106
108
  * const loader = new GLTFLoader();
@@ -113,9 +113,9 @@ let _zstd;
113
113
  * This loader relies on Web Assembly which is not supported in older browsers.
114
114
  *
115
115
  * References:
116
- * - [KTX specification]{@link http://github.khronos.org/KTX-Specification/}
117
- * - [DFD]{@link https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor}
118
- * - [BasisU HDR]{@link https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0}
116
+ * - [KTX specification](http://github.khronos.org/KTX-Specification/)
117
+ * - [DFD](https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor)
118
+ * - [BasisU HDR](https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0)
119
119
  *
120
120
  * ```js
121
121
  * const loader = new KTX2Loader();
@@ -194,22 +194,17 @@ class KTX2Loader extends Loader {
194
194
  * Async version of {@link KTX2Loader#detectSupport}.
195
195
  *
196
196
  * @async
197
- * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer.
197
+ * @deprecated
198
+ * @param {WebGPURenderer} renderer - The renderer.
198
199
  * @return {Promise} A Promise that resolves when the support has been detected.
199
200
  */
200
201
  async detectSupportAsync( renderer ) {
201
202
 
202
- this.workerConfig = {
203
- astcSupported: await renderer.hasFeatureAsync( 'texture-compression-astc' ),
204
- astcHDRSupported: false, // https://github.com/gpuweb/gpuweb/issues/3856
205
- etc1Supported: await renderer.hasFeatureAsync( 'texture-compression-etc2' ),
206
- etc2Supported: await renderer.hasFeatureAsync( 'texture-compression-etc2' ),
207
- dxtSupported: await renderer.hasFeatureAsync( 'texture-compression-bc' ),
208
- bptcSupported: await renderer.hasFeatureAsync( 'texture-compression-bc' ),
209
- pvrtcSupported: await renderer.hasFeatureAsync( 'texture-compression-pvrtc' )
210
- };
203
+ console.warn( 'KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.' ); // @deprecated r181
211
204
 
212
- return this;
205
+ await renderer.init();
206
+
207
+ return this.detectSupport( renderer );
213
208
 
214
209
  }
215
210
 
@@ -227,9 +222,9 @@ class KTX2Loader extends Loader {
227
222
  this.workerConfig = {
228
223
  astcSupported: renderer.hasFeature( 'texture-compression-astc' ),
229
224
  astcHDRSupported: false, // https://github.com/gpuweb/gpuweb/issues/3856
230
- etc1Supported: renderer.hasFeature( 'texture-compression-etc2' ),
225
+ etc1Supported: renderer.hasFeature( 'texture-compression-etc1' ),
231
226
  etc2Supported: renderer.hasFeature( 'texture-compression-etc2' ),
232
- dxtSupported: renderer.hasFeature( 'texture-compression-bc' ),
227
+ dxtSupported: renderer.hasFeature( 'texture-compression-s3tc' ),
233
228
  bptcSupported: renderer.hasFeature( 'texture-compression-bc' ),
234
229
  pvrtcSupported: renderer.hasFeature( 'texture-compression-pvrtc' )
235
230
  };
@@ -248,6 +243,21 @@ class KTX2Loader extends Loader {
248
243
  || renderer.extensions.has( 'WEBKIT_WEBGL_compressed_texture_pvrtc' )
249
244
  };
250
245
 
246
+ if ( typeof navigator !== 'undefined' &&
247
+ navigator.platform.indexOf( 'Linux' ) >= 0 && navigator.userAgent.indexOf( 'Firefox' ) >= 0 &&
248
+ this.workerConfig.astcSupported && this.workerConfig.etc2Supported &&
249
+ this.workerConfig.bptcSupported && this.workerConfig.dxtSupported ) {
250
+
251
+ // On Linux, Mesa drivers for AMD and Intel GPUs expose ETC2 and ASTC even though the hardware doesn't support these.
252
+ // Using these extensions will result in expensive software decompression on the main thread inside the driver, causing performance issues.
253
+ // When using ANGLE (e.g. via Chrome), these extensions are not exposed except for some specific Intel GPU models - however, Firefox doesn't perform this filtering.
254
+ // Since a granular filter is a little too fragile and we can transcode into other GPU formats, disable formats that are likely to be emulated.
255
+
256
+ this.workerConfig.astcSupported = false;
257
+ this.workerConfig.etc2Supported = false;
258
+
259
+ }
260
+
251
261
  }
252
262
 
253
263
  return this;
@@ -349,6 +359,7 @@ class KTX2Loader extends Loader {
349
359
  loader.setPath( this.path );
350
360
  loader.setCrossOrigin( this.crossOrigin );
351
361
  loader.setWithCredentials( this.withCredentials );
362
+ loader.setRequestHeader( this.requestHeader );
352
363
  loader.setResponseType( 'arraybuffer' );
353
364
 
354
365
  loader.load( url, ( buffer ) => {
@@ -846,13 +857,9 @@ KTX2Loader.BasisWorker = function () {
846
857
  ];
847
858
 
848
859
  const OPTIONS = {
849
- // TODO: For ETC1S we intentionally sort by _UASTC_ priority, preserving
850
- // a historical accident shown to avoid performance pitfalls for Linux with
851
- // Firefox & AMD GPU (RadeonSI). Further work needed.
852
- // See https://github.com/mrdoob/three.js/pull/29730.
853
860
  [ BasisFormat.ETC1S ]: FORMAT_OPTIONS
854
861
  .filter( ( opt ) => opt.basisFormat.includes( BasisFormat.ETC1S ) )
855
- .sort( ( a, b ) => a.priorityUASTC - b.priorityUASTC ),
862
+ .sort( ( a, b ) => a.priorityETC1S - b.priorityETC1S ),
856
863
 
857
864
  [ BasisFormat.UASTC ]: FORMAT_OPTIONS
858
865
  .filter( ( opt ) => opt.basisFormat.includes( BasisFormat.UASTC ) )
@@ -6,8 +6,8 @@ import {
6
6
  * A loader for the KTX texture compression format.
7
7
  *
8
8
  * References:
9
- * - [The KTX File Format and Tools]{@link https://www.khronos.org/opengles/sdk/tools/KTX/}
10
- * - [Babylon.JS khronosTextureContainer.ts]{@link https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts}
9
+ * - [The KTX File Format and Tools](https://www.khronos.org/opengles/sdk/tools/KTX/)
10
+ * - [Babylon.JS khronosTextureContainer.ts](https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts)
11
11
  *
12
12
  * ```js
13
13
  * const loader = new KTXLoader();
@@ -1749,7 +1749,7 @@ function createObject( loader, elements, elementSize, isConditionalSegments = fa
1749
1749
  /**
1750
1750
  * A loader for the LDraw format.
1751
1751
  *
1752
- * [LDraw]{@link https://ldraw.org/} (LEGO Draw) is an [open format specification]{@link https://ldraw.org/article/218.html}
1752
+ * [LDraw](https://ldraw.org/} (LEGO Draw) is an [open format specification]{@link https://ldraw.org/article/218.html)
1753
1753
  * for describing LEGO and other construction set 3D models.
1754
1754
  *
1755
1755
  * An LDraw asset (a text file usually with extension .ldr, .dat or .txt) can describe just a single construction
@@ -12,8 +12,8 @@ import {
12
12
  * A loader for the 3DL LUT format.
13
13
  *
14
14
  * References:
15
- * - [3D LUTs]{@link http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492}
16
- * - [Format Spec for .3dl]{@link https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258}
15
+ * - [3D LUTs](http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492)
16
+ * - [Format Spec for .3dl](https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258)
17
17
  *
18
18
  * ```js
19
19
  * const loader = new LUT3dlLoader();
@@ -12,7 +12,7 @@ import {
12
12
  * A loader for the Cube LUT format.
13
13
  *
14
14
  * References:
15
- * - [Cube LUT Specification]{@link https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf}
15
+ * - [Cube LUT Specification](https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf)
16
16
  *
17
17
  * ```js
18
18
  * const loader = new LUTCubeLoader();
@@ -36,8 +36,8 @@ let _lwoTree;
36
36
  * LWO3 and LWO2 formats are supported.
37
37
  *
38
38
  * References:
39
- * - [LWO3 format specification]{@link https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html}
40
- * - [LWO2 format specification]{@link https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html}
39
+ * - [LWO3 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html)
40
+ * - [LWO2 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html)
41
41
  *
42
42
  * ```js
43
43
  * const loader = new LWOLoader();
@@ -1,5 +1,5 @@
1
1
  import {
2
- FileLoader, Loader, TextureLoader, RepeatWrapping, MeshBasicNodeMaterial,
2
+ FileLoader, Loader, ImageBitmapLoader, Texture, RepeatWrapping, MeshBasicNodeMaterial,
3
3
  MeshPhysicalNodeMaterial, DoubleSide,
4
4
  } from 'three/webgpu';
5
5
 
@@ -410,9 +410,15 @@ class MaterialXNode {
410
410
  getTexture() {
411
411
 
412
412
  const filePrefix = this.getRecursiveAttribute( 'fileprefix' ) || '';
413
+ const uri = filePrefix + this.value;
414
+
415
+ if ( this.materialX.textureCache.has( uri ) ) {
416
+
417
+ return this.materialX.textureCache.get( uri );
418
+
419
+ }
413
420
 
414
421
  let loader = this.materialX.textureLoader;
415
- const uri = filePrefix + this.value;
416
422
 
417
423
  if ( uri ) {
418
424
 
@@ -421,9 +427,17 @@ class MaterialXNode {
421
427
 
422
428
  }
423
429
 
424
- const texture = loader.load( uri );
430
+ const texture = new Texture();
425
431
  texture.wrapS = texture.wrapT = RepeatWrapping;
426
- texture.flipY = false;
432
+
433
+ this.materialX.textureCache.set( uri, texture );
434
+
435
+ loader.load( uri, function ( imageBitmap ) {
436
+
437
+ texture.image = imageBitmap;
438
+ texture.needsUpdate = true;
439
+
440
+ } );
427
441
 
428
442
  return texture;
429
443
 
@@ -1030,7 +1044,10 @@ class MaterialX {
1030
1044
  this.nodesXLib = new Map();
1031
1045
  //this.nodesXRefLib = new WeakMap();
1032
1046
 
1033
- this.textureLoader = new TextureLoader( manager );
1047
+ this.textureLoader = new ImageBitmapLoader( manager );
1048
+ this.textureLoader.setOptions( { imageOrientation: 'flipY' } );
1049
+
1050
+ this.textureCache = new Map();
1034
1051
 
1035
1052
  }
1036
1053
 
@@ -436,7 +436,7 @@ function ParserState() {
436
436
  /**
437
437
  * A loader for the OBJ format.
438
438
  *
439
- * The [OBJ format]{@link https://en.wikipedia.org/wiki/Wavefront_.obj_file} is a simple data-format that
439
+ * The [OBJ format](https://en.wikipedia.org/wiki/Wavefront_.obj_file) is a simple data-format that
440
440
  * represents 3D geometry in a human readable format as the position of each vertex, the UV position of
441
441
  * each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list
442
442
  * of vertices, and texture vertices.
@@ -10,7 +10,7 @@ import {
10
10
  /**
11
11
  * A loader for the PDB format.
12
12
  *
13
- * The [Protein Data Bank]{@link https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)}
13
+ * The [Protein Data Bank](https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format))
14
14
  * file format is a textual file describing the three-dimensional structures of molecules.
15
15
  *
16
16
  * ```js
@@ -1502,8 +1502,8 @@ class SVGLoader extends Loader {
1502
1502
 
1503
1503
  if ( node.nodeName === 'use' && ( node.hasAttribute( 'x' ) || node.hasAttribute( 'y' ) ) ) {
1504
1504
 
1505
- const tx = parseFloatWithUnits( node.getAttribute( 'x' ) );
1506
- const ty = parseFloatWithUnits( node.getAttribute( 'y' ) );
1505
+ const tx = parseFloatWithUnits( node.getAttribute( 'x' ) || 0 );
1506
+ const ty = parseFloatWithUnits( node.getAttribute( 'y' ) || 0 );
1507
1507
 
1508
1508
  transform.translate( tx, ty );
1509
1509
 
@@ -39,7 +39,7 @@ const SRGB_TO_LINEAR = Array( 1024 )
39
39
  /**
40
40
  * A loader for the Ultra HDR Image Format.
41
41
  *
42
- * Existing HDR or EXR textures can be converted to Ultra HDR with this [tool]{@link https://gainmap-creator.monogrid.com/}.
42
+ * Existing HDR or EXR textures can be converted to Ultra HDR with this [tool](https://gainmap-creator.monogrid.com/).
43
43
  *
44
44
  * Current feature set:
45
45
  * - JPEG headers (required)
@@ -18,7 +18,7 @@ const _triangle = new Triangle();
18
18
  * Can be used to compute the convex hull in 3D space for a given set of points. It
19
19
  * is primarily intended for {@link ConvexGeometry}.
20
20
  *
21
- * This Quickhull 3D implementation is a port of [quickhull3d]{@link https://github.com/maurizzzio/quickhull3d/}
21
+ * This Quickhull 3D implementation is a port of [quickhull3d](https://github.com/maurizzzio/quickhull3d/)
22
22
  * by Mauricio Poppe.
23
23
  *
24
24
  * @three_import import { ConvexHull } from 'three/addons/math/ConvexHull.js';
@@ -36,7 +36,7 @@ function grad( hash, x, y, z ) {
36
36
  /**
37
37
  * A utility class providing a 3D noise function.
38
38
  *
39
- * The code is based on [IMPROVED NOISE]{@link https://cs.nyu.edu/~perlin/noise/}
39
+ * The code is based on [IMPROVED NOISE](https://cs.nyu.edu/~perlin/noise/)
40
40
  * by Ken Perlin, 2002.
41
41
  *
42
42
  * @three_import import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A utility class providing noise functions.
3
3
  *
4
- * The code is based on [Simplex noise demystified]{@link https://web.archive.org/web/20210210162332/http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf}
4
+ * The code is based on [Simplex noise demystified](https://web.archive.org/web/20210210162332/http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf)
5
5
  * by Stefan Gustavson, 2005.
6
6
  *
7
7
  * @three_import import { SimplexNoise } from 'three/addons/math/SimplexNoise.js';
@@ -2,7 +2,7 @@ import { DoubleSide, FloatType, HalfFloatType, Mesh, MeshBasicMaterial, MeshPhon
2
2
  import { potpack } from '../libs/potpack.module.js';
3
3
 
4
4
  /**
5
- * Progressive Light Map Accumulator, by [zalo]{@link https://github.com/zalo/}.
5
+ * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/).
6
6
  *
7
7
  * To use, simply construct a `ProgressiveLightMap` object,
8
8
  * `plmap.addObjectsToLightMap(object)` an array of semi-static
@@ -123,6 +123,12 @@ class ProgressiveLightMap {
123
123
 
124
124
  }
125
125
 
126
+ if ( object.geometry.hasAttribute( 'normal' ) === false ) {
127
+
128
+ console.warn( 'THREE.ProgressiveLightMap: All lightmap objects need normals.' ); continue;
129
+
130
+ }
131
+
126
132
  if ( this.blurringPlane === null ) {
127
133
 
128
134
  this._initializeBlurPlane( this.res, this.progressiveLightMap1 );
@@ -280,9 +286,9 @@ class ProgressiveLightMap {
280
286
  *
281
287
  * @private
282
288
  * @param {number} res - The square resolution of this object's lightMap.
283
- * @param {?WebGLRenderTarget} [lightMap] - The lightmap to initialize the plane with.
289
+ * @param {WebGLRenderTarget} lightMap - The lightmap to initialize the plane with.
284
290
  */
285
- _initializeBlurPlane( res, lightMap = null ) {
291
+ _initializeBlurPlane( res, lightMap ) {
286
292
 
287
293
  const blurMaterial = new MeshBasicMaterial();
288
294
  blurMaterial.uniforms = { previousShadowMap: { value: null },
@@ -4,7 +4,7 @@ import { add, float, mix, output, sub, texture, uniform, uv, vec2, vec4 } from '
4
4
  import { potpack } from '../libs/potpack.module.js';
5
5
 
6
6
  /**
7
- * Progressive Light Map Accumulator, by [zalo]{@link https://github.com/zalo/}.
7
+ * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/).
8
8
  *
9
9
  * To use, simply construct a `ProgressiveLightMap` object,
10
10
  * `plmap.addObjectsToLightMap(object)` an array of semi-static
@@ -101,6 +101,12 @@ class ProgressiveLightMap {
101
101
 
102
102
  }
103
103
 
104
+ if ( object.geometry.hasAttribute( 'normal' ) === false ) {
105
+
106
+ console.warn( 'THREE.ProgressiveLightMap: All lightmap objects need normals.' ); continue;
107
+
108
+ }
109
+
104
110
  if ( this._blurringPlane === null ) {
105
111
 
106
112
  this._initializeBlurPlane();