super-three 0.171.0 → 0.173.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 (455) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/build/three.cjs +594 -427
  4. package/build/three.core.js +515 -81
  5. package/build/three.core.min.js +2 -2
  6. package/build/three.module.js +79 -350
  7. package/build/three.module.min.js +2 -2
  8. package/build/three.tsl.js +20 -7
  9. package/build/three.tsl.min.js +2 -2
  10. package/build/three.webgpu.js +29362 -3427
  11. package/build/three.webgpu.min.js +2 -2
  12. package/build/three.webgpu.nodes.js +29361 -3427
  13. package/build/three.webgpu.nodes.min.js +2 -2
  14. package/examples/jsm/Addons.js +0 -5
  15. package/examples/jsm/animation/CCDIKSolver.js +9 -7
  16. package/examples/jsm/capabilities/WebGPU.js +1 -1
  17. package/examples/jsm/controls/ArcballControls.js +48 -37
  18. package/examples/jsm/controls/OrbitControls.js +5 -4
  19. package/examples/jsm/csm/CSMShadowNode.js +16 -11
  20. package/examples/jsm/curves/NURBSCurve.js +1 -1
  21. package/examples/jsm/curves/NURBSUtils.js +3 -0
  22. package/examples/jsm/effects/OutlineEffect.js +1 -1
  23. package/examples/jsm/exporters/GLTFExporter.js +34 -29
  24. package/examples/jsm/exporters/KTX2Exporter.js +1 -1
  25. package/examples/jsm/exporters/PLYExporter.js +2 -2
  26. package/examples/jsm/geometries/TextGeometry.js +1 -12
  27. package/examples/jsm/helpers/TextureHelperGPU.js +15 -5
  28. package/examples/jsm/helpers/VertexNormalsHelper.js +2 -0
  29. package/examples/jsm/interactive/InteractiveGroup.js +108 -51
  30. package/examples/jsm/libs/demuxer_mp4.js +109 -0
  31. package/examples/jsm/lights/LightProbeGenerator.js +3 -3
  32. package/examples/jsm/lines/webgpu/LineSegments2.js +15 -6
  33. package/examples/jsm/loaders/3MFLoader.js +6 -3
  34. package/examples/jsm/loaders/BVHLoader.js +1 -1
  35. package/examples/jsm/loaders/ColladaLoader.js +5 -5
  36. package/examples/jsm/loaders/DDSLoader.js +42 -0
  37. package/examples/jsm/loaders/GCodeLoader.js +4 -2
  38. package/examples/jsm/loaders/GLTFLoader.js +22 -4
  39. package/examples/jsm/loaders/KTX2Loader.js +6 -1
  40. package/examples/jsm/loaders/KTXLoader.js +4 -4
  41. package/examples/jsm/loaders/LDrawLoader.js +1 -1
  42. package/examples/jsm/loaders/LottieLoader.js +1 -1
  43. package/examples/jsm/loaders/MTLLoader.js +1 -0
  44. package/examples/jsm/loaders/NRRDLoader.js +1 -1
  45. package/examples/jsm/loaders/PLYLoader.js +7 -7
  46. package/examples/jsm/loaders/PVRLoader.js +1 -1
  47. package/examples/jsm/loaders/SVGLoader.js +2 -2
  48. package/examples/jsm/loaders/TDSLoader.js +1 -2
  49. package/examples/jsm/loaders/VRMLLoader.js +7 -7
  50. package/examples/jsm/loaders/lwo/IFFParser.js +4 -4
  51. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
  52. package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
  53. package/examples/jsm/math/ConvexHull.js +1 -1
  54. package/examples/jsm/math/OBB.js +17 -0
  55. package/examples/jsm/misc/GPUComputationRenderer.js +6 -7
  56. package/examples/jsm/misc/ProgressiveLightMap.js +4 -3
  57. package/examples/jsm/misc/ProgressiveLightMapGPU.js +14 -13
  58. package/examples/jsm/misc/Volume.js +27 -17
  59. package/examples/jsm/misc/VolumeSlice.js +7 -5
  60. package/examples/jsm/modifiers/CurveModifier.js +10 -8
  61. package/examples/jsm/modifiers/CurveModifierGPU.js +9 -7
  62. package/examples/jsm/modifiers/SimplifyModifier.js +2 -2
  63. package/examples/jsm/objects/GroundedSkybox.js +4 -4
  64. package/examples/jsm/objects/Sky.js +2 -2
  65. package/examples/jsm/objects/SkyMesh.js +3 -3
  66. package/examples/jsm/objects/Water2.js +1 -1
  67. package/examples/jsm/objects/Water2Mesh.js +2 -2
  68. package/examples/jsm/objects/WaterMesh.js +29 -24
  69. package/examples/jsm/physics/JoltPhysics.js +7 -7
  70. package/examples/jsm/physics/RapierPhysics.js +4 -4
  71. package/examples/jsm/postprocessing/BloomPass.js +2 -2
  72. package/examples/jsm/postprocessing/EffectComposer.js +1 -2
  73. package/examples/jsm/postprocessing/OutlinePass.js +4 -4
  74. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  75. package/examples/jsm/postprocessing/SAOPass.js +1 -2
  76. package/examples/jsm/postprocessing/SMAAPass.js +1 -3
  77. package/examples/jsm/postprocessing/SSAOPass.js +2 -4
  78. package/examples/jsm/postprocessing/SSRPass.js +2 -4
  79. package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -2
  80. package/examples/jsm/renderers/SVGRenderer.js +6 -4
  81. package/examples/jsm/shaders/BokehShader2.js +1 -1
  82. package/examples/jsm/shaders/GodRaysShader.js +3 -3
  83. package/examples/jsm/shaders/OutputShader.js +5 -1
  84. package/examples/jsm/shaders/SobelOperatorShader.js +1 -1
  85. package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
  86. package/examples/jsm/transpiler/TSLEncoder.js +2 -0
  87. package/examples/jsm/tsl/display/AfterImageNode.js +93 -4
  88. package/examples/jsm/tsl/display/AnaglyphPassNode.js +46 -2
  89. package/examples/jsm/tsl/display/AnamorphicNode.js +118 -5
  90. package/examples/jsm/tsl/display/BleachBypass.js +10 -0
  91. package/examples/jsm/tsl/display/BloomNode.js +233 -26
  92. package/examples/jsm/tsl/display/DenoiseNode.js +141 -25
  93. package/examples/jsm/tsl/display/DepthOfFieldNode.js +80 -1
  94. package/examples/jsm/tsl/display/DotScreenNode.js +50 -5
  95. package/examples/jsm/tsl/display/FXAANode.js +52 -3
  96. package/examples/jsm/tsl/display/FilmNode.js +47 -1
  97. package/examples/jsm/tsl/display/GTAONode.js +210 -14
  98. package/examples/jsm/tsl/display/GaussianBlurNode.js +152 -8
  99. package/examples/jsm/tsl/display/LensflareNode.js +131 -13
  100. package/examples/jsm/tsl/display/Lut3DNode.js +55 -1
  101. package/examples/jsm/tsl/display/MotionBlur.js +12 -2
  102. package/examples/jsm/tsl/display/OutlineNode.js +343 -26
  103. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +36 -2
  104. package/examples/jsm/tsl/display/PixelationPassNode.js +142 -9
  105. package/examples/jsm/tsl/display/RGBShiftNode.js +49 -2
  106. package/examples/jsm/tsl/display/SMAANode.js +187 -46
  107. package/examples/jsm/tsl/display/SSAAPassNode.js +110 -25
  108. package/examples/jsm/tsl/display/SSRNode.js +194 -21
  109. package/examples/jsm/tsl/display/Sepia.js +9 -0
  110. package/examples/jsm/tsl/display/SobelOperatorNode.js +54 -4
  111. package/examples/jsm/tsl/display/StereoCompositePassNode.js +79 -3
  112. package/examples/jsm/tsl/display/StereoPassNode.js +41 -3
  113. package/examples/jsm/tsl/display/TRAAPassNode.js +116 -21
  114. package/examples/jsm/tsl/display/TransitionNode.js +71 -6
  115. package/examples/jsm/tsl/display/hashBlur.js +14 -3
  116. package/examples/jsm/tsl/lighting/TiledLightsNode.js +40 -34
  117. package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
  118. package/examples/jsm/utils/CameraUtils.js +4 -1
  119. package/examples/jsm/utils/GeometryUtils.js +22 -19
  120. package/examples/jsm/utils/SceneUtils.js +2 -2
  121. package/examples/jsm/webxr/XRControllerModelFactory.js +6 -1
  122. package/examples/jsm/webxr/XREstimatedLight.js +1 -1
  123. package/package.json +8 -3
  124. package/src/Three.Core.js +4 -0
  125. package/src/Three.Legacy.js +0 -21
  126. package/src/Three.TSL.js +18 -5
  127. package/src/Three.WebGPU.Nodes.js +2 -2
  128. package/src/Three.WebGPU.js +2 -2
  129. package/src/animation/PropertyBinding.js +2 -2
  130. package/src/cameras/ArrayCamera.js +1 -0
  131. package/src/cameras/PerspectiveCamera.js +18 -2
  132. package/src/constants.js +6 -1
  133. package/src/core/BufferAttribute.js +4 -0
  134. package/src/core/EventDispatcher.js +8 -6
  135. package/src/core/RenderTarget.js +18 -0
  136. package/src/core/RenderTarget3D.js +22 -0
  137. package/src/core/RenderTargetArray.js +22 -0
  138. package/src/extras/Earcut.js +1 -1
  139. package/src/extras/ImageUtils.js +1 -11
  140. package/src/extras/PMREMGenerator.js +20 -0
  141. package/src/extras/TextureUtils.js +6 -0
  142. package/src/helpers/CameraHelper.js +16 -13
  143. package/src/loaders/nodes/NodeLoader.js +59 -0
  144. package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
  145. package/src/loaders/nodes/NodeObjectLoader.js +61 -0
  146. package/src/materials/nodes/Line2NodeMaterial.js +128 -34
  147. package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
  148. package/src/materials/nodes/LineDashedNodeMaterial.js +78 -5
  149. package/src/materials/nodes/MeshBasicNodeMaterial.js +56 -0
  150. package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
  151. package/src/materials/nodes/MeshMatcapNodeMaterial.js +22 -2
  152. package/src/materials/nodes/MeshNormalNodeMaterial.js +21 -2
  153. package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
  154. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +269 -0
  155. package/src/materials/nodes/MeshSSSNodeMaterial.js +97 -6
  156. package/src/materials/nodes/MeshStandardNodeMaterial.js +78 -0
  157. package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
  158. package/src/materials/nodes/NodeMaterial.js +476 -23
  159. package/src/materials/nodes/NodeMaterials.js +0 -1
  160. package/src/materials/nodes/PointsNodeMaterial.js +121 -10
  161. package/src/materials/nodes/ShadowNodeMaterial.js +29 -0
  162. package/src/materials/nodes/SpriteNodeMaterial.js +78 -20
  163. package/src/materials/nodes/VolumeNodeMaterial.js +80 -4
  164. package/src/materials/nodes/manager/NodeMaterialObserver.js +95 -0
  165. package/src/nodes/Nodes.js +5 -6
  166. package/src/nodes/TSL.js +6 -3
  167. package/src/nodes/accessors/AccessorsUtils.js +27 -0
  168. package/src/nodes/accessors/Arrays.js +47 -6
  169. package/src/nodes/accessors/BatchNode.js +42 -6
  170. package/src/nodes/accessors/Bitangent.js +37 -0
  171. package/src/nodes/accessors/BufferAttributeNode.js +178 -5
  172. package/src/nodes/accessors/BufferNode.js +63 -0
  173. package/src/nodes/accessors/BuiltinNode.js +38 -0
  174. package/src/nodes/accessors/Camera.js +113 -3
  175. package/src/nodes/accessors/ClippingNode.js +71 -2
  176. package/src/nodes/accessors/CubeTextureNode.js +64 -0
  177. package/src/nodes/accessors/InstanceNode.js +85 -2
  178. package/src/nodes/accessors/InstancedMeshNode.js +28 -3
  179. package/src/nodes/accessors/Lights.js +50 -1
  180. package/src/nodes/accessors/MaterialNode.js +306 -12
  181. package/src/nodes/accessors/MaterialProperties.js +7 -0
  182. package/src/nodes/accessors/MaterialReferenceNode.js +53 -13
  183. package/src/nodes/accessors/ModelNode.js +100 -5
  184. package/src/nodes/accessors/ModelViewProjectionNode.js +10 -38
  185. package/src/nodes/accessors/MorphNode.js +48 -4
  186. package/src/nodes/accessors/Normal.js +65 -5
  187. package/src/nodes/accessors/Object3DNode.js +101 -1
  188. package/src/nodes/accessors/PointUVNode.js +26 -0
  189. package/src/nodes/accessors/Position.js +56 -7
  190. package/src/nodes/accessors/ReferenceBaseNode.js +186 -0
  191. package/src/nodes/accessors/ReferenceNode.js +201 -2
  192. package/src/nodes/accessors/ReflectVector.js +24 -0
  193. package/src/nodes/accessors/RendererReferenceNode.js +46 -1
  194. package/src/nodes/accessors/SceneNode.js +54 -0
  195. package/src/nodes/accessors/SkinningNode.js +127 -1
  196. package/src/nodes/accessors/StorageBufferNode.js +209 -8
  197. package/src/nodes/accessors/StorageTextureNode.js +118 -0
  198. package/src/nodes/accessors/Tangent.js +38 -2
  199. package/src/nodes/accessors/Texture3DNode.js +91 -7
  200. package/src/nodes/accessors/TextureBicubic.js +12 -2
  201. package/src/nodes/accessors/TextureNode.js +316 -10
  202. package/src/nodes/accessors/TextureSizeNode.js +42 -0
  203. package/src/nodes/accessors/UV.js +10 -1
  204. package/src/nodes/accessors/UniformArrayNode.js +231 -25
  205. package/src/nodes/accessors/UserDataNode.js +46 -0
  206. package/src/nodes/accessors/VelocityNode.js +80 -0
  207. package/src/nodes/accessors/VertexColorNode.js +39 -2
  208. package/src/nodes/code/CodeNode.js +95 -1
  209. package/src/nodes/code/ExpressionNode.js +28 -0
  210. package/src/nodes/code/FunctionCallNode.js +37 -0
  211. package/src/nodes/code/FunctionNode.js +45 -0
  212. package/src/nodes/code/ScriptableNode.js +223 -1
  213. package/src/nodes/code/ScriptableValueNode.js +85 -1
  214. package/src/nodes/core/ArrayNode.js +125 -0
  215. package/src/nodes/core/AssignNode.js +48 -2
  216. package/src/nodes/core/AttributeNode.js +43 -0
  217. package/src/nodes/core/BypassNode.js +47 -2
  218. package/src/nodes/core/CacheNode.js +53 -2
  219. package/src/nodes/core/ConstNode.js +32 -0
  220. package/src/nodes/core/ContextNode.js +65 -0
  221. package/src/nodes/core/IndexNode.js +68 -7
  222. package/src/nodes/core/InputNode.js +48 -0
  223. package/src/nodes/core/LightingModel.js +60 -0
  224. package/src/nodes/core/MRTNode.js +66 -0
  225. package/src/nodes/core/Node.js +350 -12
  226. package/src/nodes/core/NodeAttribute.js +38 -0
  227. package/src/nodes/core/NodeBuilder.js +1166 -26
  228. package/src/nodes/core/NodeCache.js +41 -2
  229. package/src/nodes/core/NodeCode.js +31 -0
  230. package/src/nodes/core/NodeFrame.js +123 -2
  231. package/src/nodes/core/NodeFunction.js +46 -0
  232. package/src/nodes/core/NodeFunctionInput.js +44 -0
  233. package/src/nodes/core/NodeParser.js +11 -0
  234. package/src/nodes/core/NodeUniform.js +52 -0
  235. package/src/nodes/core/NodeUtils.js +152 -1
  236. package/src/nodes/core/NodeVar.js +47 -1
  237. package/src/nodes/core/NodeVarying.js +28 -0
  238. package/src/nodes/core/OutputStructNode.js +51 -10
  239. package/src/nodes/core/ParameterNode.js +28 -0
  240. package/src/nodes/core/PropertyNode.js +232 -0
  241. package/src/nodes/core/StackNode.js +98 -1
  242. package/src/nodes/core/StructNode.js +121 -0
  243. package/src/nodes/core/StructType.js +13 -0
  244. package/src/nodes/core/StructTypeNode.js +105 -6
  245. package/src/nodes/core/TempNode.js +31 -5
  246. package/src/nodes/core/UniformGroupNode.js +82 -7
  247. package/src/nodes/core/UniformNode.js +66 -0
  248. package/src/nodes/core/VarNode.js +146 -7
  249. package/src/nodes/core/VaryingNode.js +100 -3
  250. package/src/nodes/core/constants.js +36 -0
  251. package/src/nodes/display/BlendModes.js +88 -1
  252. package/src/nodes/display/BumpMapNode.js +37 -0
  253. package/src/nodes/display/ColorAdjustment.js +53 -11
  254. package/src/nodes/display/ColorSpaceFunctions.js +16 -0
  255. package/src/nodes/display/ColorSpaceNode.js +82 -0
  256. package/src/nodes/display/FrontFacingNode.js +29 -0
  257. package/src/nodes/display/NormalMapNode.js +43 -0
  258. package/src/nodes/display/PassNode.js +300 -7
  259. package/src/nodes/display/PosterizeNode.js +33 -0
  260. package/src/nodes/display/RenderOutputNode.js +66 -1
  261. package/src/nodes/display/ScreenNode.js +96 -0
  262. package/src/nodes/display/ToneMappingFunctions.js +58 -10
  263. package/src/nodes/display/ToneMappingNode.js +55 -2
  264. package/src/nodes/display/ToonOutlinePassNode.js +73 -0
  265. package/src/nodes/display/ViewportDepthNode.js +122 -8
  266. package/src/nodes/display/ViewportDepthTextureNode.js +23 -0
  267. package/src/nodes/display/ViewportSharedTextureNode.js +23 -0
  268. package/src/nodes/display/ViewportTextureNode.js +57 -0
  269. package/src/nodes/fog/Fog.js +110 -0
  270. package/src/nodes/functions/BasicLightingModel.js +24 -0
  271. package/src/nodes/functions/PhongLightingModel.js +34 -2
  272. package/src/nodes/functions/PhysicalLightingModel.js +167 -8
  273. package/src/nodes/functions/ShadowMaskModel.js +23 -0
  274. package/src/nodes/functions/ToonLightingModel.js +20 -0
  275. package/src/nodes/functions/material/getAlphaHashThreshold.js +1 -3
  276. package/src/nodes/functions/material/getParallaxCorrectNormal.js +16 -1
  277. package/src/nodes/geometry/RangeNode.js +54 -2
  278. package/src/nodes/gpgpu/AtomicFunctionNode.js +174 -2
  279. package/src/nodes/gpgpu/BarrierNode.js +47 -0
  280. package/src/nodes/gpgpu/ComputeBuiltinNode.js +134 -0
  281. package/src/nodes/gpgpu/ComputeNode.js +106 -2
  282. package/src/nodes/gpgpu/WorkgroupInfoNode.js +115 -6
  283. package/src/nodes/lighting/AONode.js +18 -0
  284. package/src/nodes/lighting/AmbientLightNode.js +10 -0
  285. package/src/nodes/lighting/AnalyticLightNode.js +97 -2
  286. package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
  287. package/src/nodes/lighting/BasicLightMapNode.js +17 -0
  288. package/src/nodes/lighting/DirectionalLightNode.js +10 -0
  289. package/src/nodes/lighting/EnvironmentNode.js +18 -0
  290. package/src/nodes/lighting/HemisphereLightNode.js +31 -0
  291. package/src/nodes/lighting/IESSpotLightNode.js +11 -0
  292. package/src/nodes/lighting/IrradianceNode.js +17 -0
  293. package/src/nodes/lighting/LightProbeNode.js +20 -0
  294. package/src/nodes/lighting/LightUtils.js +12 -0
  295. package/src/nodes/lighting/LightingContextNode.js +48 -0
  296. package/src/nodes/lighting/LightingNode.js +15 -6
  297. package/src/nodes/lighting/LightsNode.js +132 -1
  298. package/src/nodes/lighting/PointLightNode.js +32 -1
  299. package/src/nodes/lighting/PointShadowNode.js +54 -1
  300. package/src/nodes/lighting/RectAreaLightNode.js +44 -6
  301. package/src/nodes/lighting/ShadowBaseNode.js +93 -0
  302. package/src/nodes/lighting/ShadowNode.js +241 -35
  303. package/src/nodes/lighting/SpotLightNode.js +43 -0
  304. package/src/nodes/math/ConditionalNode.js +78 -4
  305. package/src/nodes/math/Hash.js +9 -0
  306. package/src/nodes/math/MathNode.js +627 -11
  307. package/src/nodes/math/MathUtils.js +45 -1
  308. package/src/nodes/math/OperatorNode.js +329 -18
  309. package/src/nodes/math/TriNoise3D.js +18 -7
  310. package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
  311. package/src/nodes/parsers/GLSLNodeParser.js +11 -0
  312. package/src/nodes/pmrem/PMREMNode.js +133 -0
  313. package/src/nodes/pmrem/PMREMUtils.js +2 -2
  314. package/src/nodes/procedural/Checker.js +9 -0
  315. package/src/nodes/shapes/Shapes.js +33 -0
  316. package/src/nodes/tsl/TSLBase.js +3 -2
  317. package/src/nodes/tsl/TSLCore.js +22 -2
  318. package/src/nodes/utils/ArrayElementNode.js +39 -3
  319. package/src/nodes/utils/ConvertNode.js +31 -0
  320. package/src/nodes/utils/CubeMapNode.js +78 -0
  321. package/src/nodes/utils/Discard.js +16 -0
  322. package/src/nodes/utils/EquirectUVNode.js +31 -1
  323. package/src/nodes/utils/FlipNode.js +38 -0
  324. package/src/nodes/utils/FunctionOverloadingNode.js +53 -1
  325. package/src/nodes/utils/JoinNode.js +25 -0
  326. package/src/nodes/utils/LoopNode.js +82 -2
  327. package/src/nodes/utils/MatcapUVNode.js +17 -0
  328. package/src/nodes/utils/MaxMipLevelNode.js +49 -0
  329. package/src/nodes/utils/MemberNode.js +68 -0
  330. package/src/nodes/utils/Oscillators.js +33 -0
  331. package/src/nodes/utils/Packing.js +17 -0
  332. package/src/nodes/utils/PostProcessingUtils.js +28 -23
  333. package/src/nodes/utils/RTTNode.js +123 -2
  334. package/src/nodes/utils/ReflectorNode.js +174 -4
  335. package/src/nodes/utils/RemapNode.js +79 -0
  336. package/src/nodes/utils/RotateNode.js +41 -0
  337. package/src/nodes/utils/SetNode.js +44 -1
  338. package/src/nodes/utils/SplitNode.js +55 -3
  339. package/src/nodes/utils/SpriteSheetUVNode.js +46 -0
  340. package/src/nodes/utils/SpriteUtils.js +17 -0
  341. package/src/nodes/utils/StorageArrayElementNode.js +54 -0
  342. package/src/nodes/utils/Timer.js +40 -0
  343. package/src/nodes/utils/TriplanarTexturesNode.js +84 -0
  344. package/src/nodes/utils/UVUtils.js +20 -0
  345. package/src/nodes/utils/ViewportUtils.js +13 -0
  346. package/src/objects/BatchedMesh.js +2 -3
  347. package/src/objects/ClippingGroup.js +49 -0
  348. package/src/objects/Line.js +6 -6
  349. package/src/renderers/WebGLRenderer.js +30 -4
  350. package/src/renderers/common/Animation.js +85 -0
  351. package/src/renderers/common/Attributes.js +36 -0
  352. package/src/renderers/common/Backend.js +502 -44
  353. package/src/renderers/common/Background.js +48 -1
  354. package/src/renderers/common/BindGroup.js +43 -0
  355. package/src/renderers/common/Binding.js +35 -0
  356. package/src/renderers/common/Bindings.js +93 -1
  357. package/src/renderers/common/Buffer.js +49 -0
  358. package/src/renderers/common/BufferUtils.js +27 -0
  359. package/src/renderers/common/BundleGroup.js +57 -0
  360. package/src/renderers/common/ChainMap.js +45 -6
  361. package/src/renderers/common/ClippingContext.js +108 -15
  362. package/src/renderers/common/Color4.js +40 -0
  363. package/src/renderers/common/ComputePipeline.js +24 -0
  364. package/src/renderers/common/CubeRenderTarget.js +13 -0
  365. package/src/renderers/common/DataMap.js +37 -1
  366. package/src/renderers/common/Geometries.js +91 -14
  367. package/src/renderers/common/IndirectStorageBufferAttribute.js +25 -2
  368. package/src/renderers/common/Info.js +78 -35
  369. package/src/renderers/common/Lighting.js +34 -6
  370. package/src/renderers/common/Pipeline.js +22 -0
  371. package/src/renderers/common/Pipelines.js +148 -5
  372. package/src/renderers/common/PostProcessing.js +99 -11
  373. package/src/renderers/common/ProgrammableStage.js +60 -2
  374. package/src/renderers/common/QuadMesh.js +54 -5
  375. package/src/renderers/common/RenderBundle.js +14 -8
  376. package/src/renderers/common/RenderBundles.js +39 -10
  377. package/src/renderers/common/RenderContext.js +201 -2
  378. package/src/renderers/common/RenderContexts.js +59 -6
  379. package/src/renderers/common/RenderList.js +178 -0
  380. package/src/renderers/common/RenderLists.js +40 -3
  381. package/src/renderers/common/RenderObject.js +400 -17
  382. package/src/renderers/common/RenderObjects.js +103 -7
  383. package/src/renderers/common/RenderPipeline.js +24 -0
  384. package/src/renderers/common/Renderer.js +1170 -86
  385. package/src/renderers/common/RendererUtils.js +193 -0
  386. package/src/renderers/common/SampledTexture.js +120 -0
  387. package/src/renderers/common/Sampler.js +30 -0
  388. package/src/renderers/common/StorageBuffer.js +24 -0
  389. package/src/renderers/common/StorageBufferAttribute.js +31 -2
  390. package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
  391. package/src/renderers/common/StorageTexture.js +38 -0
  392. package/src/renderers/common/Textures.js +97 -7
  393. package/src/renderers/common/TimestampQueryPool.js +39 -0
  394. package/src/renderers/common/Uniform.js +225 -3
  395. package/src/renderers/common/UniformBuffer.js +19 -0
  396. package/src/renderers/common/UniformsGroup.js +141 -2
  397. package/src/renderers/common/XRManager.js +1193 -0
  398. package/src/renderers/common/XRRenderTarget.js +74 -0
  399. package/src/renderers/common/extras/PMREMGenerator.js +76 -10
  400. package/src/renderers/common/nodes/NodeBuilderState.js +99 -5
  401. package/src/renderers/common/nodes/NodeLibrary.js +89 -0
  402. package/src/renderers/common/nodes/NodeSampledTexture.js +90 -2
  403. package/src/renderers/common/nodes/NodeSampler.js +28 -0
  404. package/src/renderers/common/nodes/NodeStorageBuffer.js +35 -0
  405. package/src/renderers/common/nodes/NodeUniform.js +243 -2
  406. package/src/renderers/common/nodes/NodeUniformBuffer.js +29 -0
  407. package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
  408. package/src/renderers/common/nodes/Nodes.js +352 -78
  409. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
  410. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
  411. package/src/renderers/webgl/WebGLBackground.js +4 -0
  412. package/src/renderers/webgl-fallback/WebGLBackend.js +819 -116
  413. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +347 -18
  414. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +58 -1
  415. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
  416. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
  417. package/src/renderers/webgl-fallback/utils/WebGLState.js +323 -11
  418. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +168 -22
  419. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +359 -0
  420. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +43 -0
  421. package/src/renderers/webgpu/WebGPUBackend.js +578 -164
  422. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +36 -0
  423. package/src/renderers/webgpu/WebGPURenderer.js +36 -0
  424. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +20 -8
  425. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +21 -8
  426. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +674 -52
  427. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +17 -0
  428. package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
  429. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +95 -14
  430. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +94 -1
  431. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +102 -3
  432. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +98 -1
  433. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +262 -18
  434. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +274 -0
  435. package/src/renderers/webgpu/utils/WebGPUUtils.js +116 -4
  436. package/src/renderers/webxr/WebXRDepthSensing.js +1 -1
  437. package/src/renderers/webxr/WebXRManager.js +19 -2
  438. package/src/textures/Data3DTexture.js +2 -2
  439. package/src/textures/Texture.js +4 -0
  440. package/src/textures/VideoFrameTexture.js +35 -0
  441. package/examples/jsm/animation/MMDAnimationHelper.js +0 -1209
  442. package/examples/jsm/animation/MMDPhysics.js +0 -1408
  443. package/examples/jsm/exporters/MMDExporter.js +0 -223
  444. package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -176
  445. package/examples/jsm/libs/mmdparser.module.js +0 -11530
  446. package/examples/jsm/loaders/MMDLoader.js +0 -2298
  447. package/examples/jsm/objects/InstancedPoints.js +0 -19
  448. package/examples/jsm/shaders/MMDToonShader.js +0 -134
  449. package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -156
  450. package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -24
  451. package/src/nodes/core/UniformGroup.js +0 -13
  452. package/src/nodes/fog/FogExp2Node.js +0 -35
  453. package/src/nodes/fog/FogNode.js +0 -50
  454. package/src/nodes/fog/FogRangeNode.js +0 -36
  455. package/src/renderers/common/PostProcessingUtils.js +0 -86
package/build/three.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2010-2024 Three.js Authors
3
+ * Copyright 2010-2025 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
  'use strict';
7
7
 
8
- const REVISION = '171';
8
+ const REVISION = '173';
9
9
 
10
10
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
11
11
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -217,6 +217,11 @@ const GLSL3 = '300 es';
217
217
  const WebGLCoordinateSystem = 2000;
218
218
  const WebGPUCoordinateSystem = 2001;
219
219
 
220
+ const TimestampQuery = {
221
+ COMPUTE: 'compute',
222
+ RENDER: 'render'
223
+ };
224
+
220
225
  /**
221
226
  * https://github.com/mrdoob/eventdispatcher.js/
222
227
  */
@@ -245,19 +250,20 @@ class EventDispatcher {
245
250
 
246
251
  hasEventListener( type, listener ) {
247
252
 
248
- if ( this._listeners === undefined ) return false;
249
-
250
253
  const listeners = this._listeners;
251
254
 
255
+ if ( listeners === undefined ) return false;
256
+
252
257
  return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
253
258
 
254
259
  }
255
260
 
256
261
  removeEventListener( type, listener ) {
257
262
 
258
- if ( this._listeners === undefined ) return;
259
-
260
263
  const listeners = this._listeners;
264
+
265
+ if ( listeners === undefined ) return;
266
+
261
267
  const listenerArray = listeners[ type ];
262
268
 
263
269
  if ( listenerArray !== undefined ) {
@@ -276,9 +282,10 @@ class EventDispatcher {
276
282
 
277
283
  dispatchEvent( event ) {
278
284
 
279
- if ( this._listeners === undefined ) return;
280
-
281
285
  const listeners = this._listeners;
286
+
287
+ if ( listeners === undefined ) return;
288
+
282
289
  const listenerArray = listeners[ event.type ];
283
290
 
284
291
  if ( listenerArray !== undefined ) {
@@ -1856,17 +1863,7 @@ class ImageUtils {
1856
1863
 
1857
1864
  }
1858
1865
 
1859
- if ( canvas.width > 2048 || canvas.height > 2048 ) {
1860
-
1861
- console.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );
1862
-
1863
- return canvas.toDataURL( 'image/jpeg', 0.6 );
1864
-
1865
- } else {
1866
-
1867
- return canvas.toDataURL( 'image/png' );
1868
-
1869
- }
1866
+ return canvas.toDataURL( 'image/png' );
1870
1867
 
1871
1868
  }
1872
1869
 
@@ -2112,6 +2109,7 @@ class Texture extends EventDispatcher {
2112
2109
  this.version = 0;
2113
2110
  this.onUpdate = null;
2114
2111
 
2112
+ this.renderTarget = null; // assign texture to a render target
2115
2113
  this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
2116
2114
  this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
2117
2115
 
@@ -2177,6 +2175,9 @@ class Texture extends EventDispatcher {
2177
2175
  this.unpackAlignment = source.unpackAlignment;
2178
2176
  this.colorSpace = source.colorSpace;
2179
2177
 
2178
+ this.renderTarget = source.renderTarget;
2179
+ this.isRenderTargetTexture = source.isRenderTargetTexture;
2180
+
2180
2181
  this.userData = JSON.parse( JSON.stringify( source.userData ) );
2181
2182
 
2182
2183
  this.needsUpdate = true;
@@ -3077,6 +3078,7 @@ class RenderTarget extends EventDispatcher {
3077
3078
 
3078
3079
  this.textures[ i ] = texture.clone();
3079
3080
  this.textures[ i ].isRenderTargetTexture = true;
3081
+ this.textures[ i ].renderTarget = this;
3080
3082
 
3081
3083
  }
3082
3084
 
@@ -3086,6 +3088,7 @@ class RenderTarget extends EventDispatcher {
3086
3088
  this.resolveDepthBuffer = options.resolveDepthBuffer;
3087
3089
  this.resolveStencilBuffer = options.resolveStencilBuffer;
3088
3090
 
3091
+ this._depthTexture = null;
3089
3092
  this.depthTexture = options.depthTexture;
3090
3093
 
3091
3094
  this.samples = options.samples;
@@ -3104,6 +3107,21 @@ class RenderTarget extends EventDispatcher {
3104
3107
 
3105
3108
  }
3106
3109
 
3110
+ set depthTexture( current ) {
3111
+
3112
+ if ( this._depthTexture !== null ) this._depthTexture.renderTarget = null;
3113
+ if ( current !== null ) current.renderTarget = this;
3114
+
3115
+ this._depthTexture = current;
3116
+
3117
+ }
3118
+
3119
+ get depthTexture() {
3120
+
3121
+ return this._depthTexture;
3122
+
3123
+ }
3124
+
3107
3125
  setSize( width, height, depth = 1 ) {
3108
3126
 
3109
3127
  if ( this.width !== width || this.height !== height || this.depth !== depth ) {
@@ -3152,6 +3170,7 @@ class RenderTarget extends EventDispatcher {
3152
3170
 
3153
3171
  this.textures[ i ] = source.textures[ i ].clone();
3154
3172
  this.textures[ i ].isRenderTargetTexture = true;
3173
+ this.textures[ i ].renderTarget = this;
3155
3174
 
3156
3175
  }
3157
3176
 
@@ -3254,9 +3273,9 @@ class Data3DTexture extends Texture {
3254
3273
  constructor( data = null, width = 1, height = 1, depth = 1 ) {
3255
3274
 
3256
3275
  // We're going to add .setXXX() methods for setting properties later.
3257
- // Users can still set in DataTexture3D directly.
3276
+ // Users can still set in Data3DTexture directly.
3258
3277
  //
3259
- // const texture = new THREE.DataTexture3D( data, width, height, depth );
3278
+ // const texture = new THREE.Data3DTexture( data, width, height, depth );
3260
3279
  // texture.anisotropy = 16;
3261
3280
  //
3262
3281
  // See #14839
@@ -9980,6 +9999,8 @@ const DataUtils = {
9980
9999
  const _vector$9 = /*@__PURE__*/ new Vector3();
9981
10000
  const _vector2$1 = /*@__PURE__*/ new Vector2();
9982
10001
 
10002
+ let _id$3 = 0;
10003
+
9983
10004
  class BufferAttribute {
9984
10005
 
9985
10006
  constructor( array, itemSize, normalized = false ) {
@@ -9992,6 +10013,8 @@ class BufferAttribute {
9992
10013
 
9993
10014
  this.isBufferAttribute = true;
9994
10015
 
10016
+ Object.defineProperty( this, 'id', { value: _id$3 ++ } );
10017
+
9995
10018
  this.name = '';
9996
10019
 
9997
10020
  this.array = array;
@@ -12677,7 +12700,7 @@ class PerspectiveCamera extends Camera {
12677
12700
  * The default film gauge is 35, so that the focal length can be specified for
12678
12701
  * a 35mm (full frame) camera.
12679
12702
  *
12680
- * Values for focal length and film gauge must have the same unit.
12703
+ * @param {number} focalLength - Values for focal length and film gauge must have the same unit.
12681
12704
  */
12682
12705
  setFocalLength( focalLength ) {
12683
12706
 
@@ -12691,6 +12714,8 @@ class PerspectiveCamera extends Camera {
12691
12714
 
12692
12715
  /**
12693
12716
  * Calculates the focal length from the current .fov and .filmGauge.
12717
+ *
12718
+ * @returns {number}
12694
12719
  */
12695
12720
  getFocalLength() {
12696
12721
 
@@ -12724,6 +12749,10 @@ class PerspectiveCamera extends Camera {
12724
12749
  /**
12725
12750
  * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
12726
12751
  * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
12752
+ *
12753
+ * @param {number} distance
12754
+ * @param {Vector2} minTarget
12755
+ * @param {Vector2} maxTarget
12727
12756
  */
12728
12757
  getViewBounds( distance, minTarget, maxTarget ) {
12729
12758
 
@@ -12739,7 +12768,10 @@ class PerspectiveCamera extends Camera {
12739
12768
 
12740
12769
  /**
12741
12770
  * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
12742
- * Copies the result into the target Vector2, where x is width and y is height.
12771
+ *
12772
+ * @param {number} distance
12773
+ * @param {Vector2} target - Vector2 target used to store result where x is width and y is height.
12774
+ * @returns {Vector2}
12743
12775
  */
12744
12776
  getViewSize( distance, target ) {
12745
12777
 
@@ -12783,6 +12815,13 @@ class PerspectiveCamera extends Camera {
12783
12815
  * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
12784
12816
  *
12785
12817
  * Note there is no reason monitors have to be the same size or in a grid.
12818
+ *
12819
+ * @param {number} fullWidth
12820
+ * @param {number} fullHeight
12821
+ * @param {number} x
12822
+ * @param {number} y
12823
+ * @param {number} width
12824
+ * @param {number} height
12786
12825
  */
12787
12826
  setViewOffset( fullWidth, fullHeight, x, y, width, height ) {
12788
12827
 
@@ -13213,6 +13252,358 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
13213
13252
 
13214
13253
  }
13215
13254
 
13255
+ class Group extends Object3D {
13256
+
13257
+ constructor() {
13258
+
13259
+ super();
13260
+
13261
+ this.isGroup = true;
13262
+
13263
+ this.type = 'Group';
13264
+
13265
+ }
13266
+
13267
+ }
13268
+
13269
+ const _moveEvent = { type: 'move' };
13270
+
13271
+ class WebXRController {
13272
+
13273
+ constructor() {
13274
+
13275
+ this._targetRay = null;
13276
+ this._grip = null;
13277
+ this._hand = null;
13278
+
13279
+ }
13280
+
13281
+ getHandSpace() {
13282
+
13283
+ if ( this._hand === null ) {
13284
+
13285
+ this._hand = new Group();
13286
+ this._hand.matrixAutoUpdate = false;
13287
+ this._hand.visible = false;
13288
+
13289
+ this._hand.joints = {};
13290
+ this._hand.inputState = { pinching: false };
13291
+
13292
+ }
13293
+
13294
+ return this._hand;
13295
+
13296
+ }
13297
+
13298
+ getTargetRaySpace() {
13299
+
13300
+ if ( this._targetRay === null ) {
13301
+
13302
+ this._targetRay = new Group();
13303
+ this._targetRay.matrixAutoUpdate = false;
13304
+ this._targetRay.visible = false;
13305
+ this._targetRay.hasLinearVelocity = false;
13306
+ this._targetRay.linearVelocity = new Vector3();
13307
+ this._targetRay.hasAngularVelocity = false;
13308
+ this._targetRay.angularVelocity = new Vector3();
13309
+
13310
+ }
13311
+
13312
+ return this._targetRay;
13313
+
13314
+ }
13315
+
13316
+ getGripSpace() {
13317
+
13318
+ if ( this._grip === null ) {
13319
+
13320
+ this._grip = new Group();
13321
+ this._grip.matrixAutoUpdate = false;
13322
+ this._grip.visible = false;
13323
+ this._grip.hasLinearVelocity = false;
13324
+ this._grip.linearVelocity = new Vector3();
13325
+ this._grip.hasAngularVelocity = false;
13326
+ this._grip.angularVelocity = new Vector3();
13327
+
13328
+ }
13329
+
13330
+ return this._grip;
13331
+
13332
+ }
13333
+
13334
+ dispatchEvent( event ) {
13335
+
13336
+ if ( this._targetRay !== null ) {
13337
+
13338
+ this._targetRay.dispatchEvent( event );
13339
+
13340
+ }
13341
+
13342
+ if ( this._grip !== null ) {
13343
+
13344
+ this._grip.dispatchEvent( event );
13345
+
13346
+ }
13347
+
13348
+ if ( this._hand !== null ) {
13349
+
13350
+ this._hand.dispatchEvent( event );
13351
+
13352
+ }
13353
+
13354
+ return this;
13355
+
13356
+ }
13357
+
13358
+ connect( inputSource ) {
13359
+
13360
+ if ( inputSource && inputSource.hand ) {
13361
+
13362
+ const hand = this._hand;
13363
+
13364
+ if ( hand ) {
13365
+
13366
+ for ( const inputjoint of inputSource.hand.values() ) {
13367
+
13368
+ // Initialize hand with joints when connected
13369
+ this._getHandJoint( hand, inputjoint );
13370
+
13371
+ }
13372
+
13373
+ }
13374
+
13375
+ }
13376
+
13377
+ this.dispatchEvent( { type: 'connected', data: inputSource } );
13378
+
13379
+ return this;
13380
+
13381
+ }
13382
+
13383
+ disconnect( inputSource ) {
13384
+
13385
+ this.dispatchEvent( { type: 'disconnected', data: inputSource } );
13386
+
13387
+ if ( this._targetRay !== null ) {
13388
+
13389
+ this._targetRay.visible = false;
13390
+
13391
+ }
13392
+
13393
+ if ( this._grip !== null ) {
13394
+
13395
+ this._grip.visible = false;
13396
+
13397
+ }
13398
+
13399
+ if ( this._hand !== null ) {
13400
+
13401
+ this._hand.visible = false;
13402
+
13403
+ }
13404
+
13405
+ return this;
13406
+
13407
+ }
13408
+
13409
+ update( inputSource, frame, referenceSpace ) {
13410
+
13411
+ let inputPose = null;
13412
+ let gripPose = null;
13413
+ let handPose = null;
13414
+
13415
+ const targetRay = this._targetRay;
13416
+ const grip = this._grip;
13417
+ const hand = this._hand;
13418
+
13419
+ if ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {
13420
+
13421
+ if ( hand && inputSource.hand ) {
13422
+
13423
+ handPose = true;
13424
+
13425
+ for ( const inputjoint of inputSource.hand.values() ) {
13426
+
13427
+ // Update the joints groups with the XRJoint poses
13428
+ const jointPose = frame.getJointPose( inputjoint, referenceSpace );
13429
+
13430
+ // The transform of this joint will be updated with the joint pose on each frame
13431
+ const joint = this._getHandJoint( hand, inputjoint );
13432
+
13433
+ if ( jointPose !== null ) {
13434
+
13435
+ joint.matrix.fromArray( jointPose.transform.matrix );
13436
+ joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
13437
+ joint.matrixWorldNeedsUpdate = true;
13438
+ joint.jointRadius = jointPose.radius;
13439
+
13440
+ }
13441
+
13442
+ joint.visible = jointPose !== null;
13443
+
13444
+ }
13445
+
13446
+ // Custom events
13447
+
13448
+ // Check pinchz
13449
+ const indexTip = hand.joints[ 'index-finger-tip' ];
13450
+ const thumbTip = hand.joints[ 'thumb-tip' ];
13451
+ const distance = indexTip.position.distanceTo( thumbTip.position );
13452
+
13453
+ const distanceToPinch = 0.02;
13454
+ const threshold = 0.005;
13455
+
13456
+ if ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {
13457
+
13458
+ hand.inputState.pinching = false;
13459
+ this.dispatchEvent( {
13460
+ type: 'pinchend',
13461
+ handedness: inputSource.handedness,
13462
+ target: this
13463
+ } );
13464
+
13465
+ } else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {
13466
+
13467
+ hand.inputState.pinching = true;
13468
+ this.dispatchEvent( {
13469
+ type: 'pinchstart',
13470
+ handedness: inputSource.handedness,
13471
+ target: this
13472
+ } );
13473
+
13474
+ }
13475
+
13476
+ } else {
13477
+
13478
+ if ( grip !== null && inputSource.gripSpace ) {
13479
+
13480
+ gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
13481
+
13482
+ if ( gripPose !== null ) {
13483
+
13484
+ grip.matrix.fromArray( gripPose.transform.matrix );
13485
+ grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
13486
+ grip.matrixWorldNeedsUpdate = true;
13487
+
13488
+ if ( gripPose.linearVelocity ) {
13489
+
13490
+ grip.hasLinearVelocity = true;
13491
+ grip.linearVelocity.copy( gripPose.linearVelocity );
13492
+
13493
+ } else {
13494
+
13495
+ grip.hasLinearVelocity = false;
13496
+
13497
+ }
13498
+
13499
+ if ( gripPose.angularVelocity ) {
13500
+
13501
+ grip.hasAngularVelocity = true;
13502
+ grip.angularVelocity.copy( gripPose.angularVelocity );
13503
+
13504
+ } else {
13505
+
13506
+ grip.hasAngularVelocity = false;
13507
+
13508
+ }
13509
+
13510
+ }
13511
+
13512
+ }
13513
+
13514
+ }
13515
+
13516
+ if ( targetRay !== null ) {
13517
+
13518
+ inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
13519
+
13520
+ // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it
13521
+ if ( inputPose === null && gripPose !== null ) {
13522
+
13523
+ inputPose = gripPose;
13524
+
13525
+ }
13526
+
13527
+ if ( inputPose !== null ) {
13528
+
13529
+ targetRay.matrix.fromArray( inputPose.transform.matrix );
13530
+ targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
13531
+ targetRay.matrixWorldNeedsUpdate = true;
13532
+
13533
+ if ( inputPose.linearVelocity ) {
13534
+
13535
+ targetRay.hasLinearVelocity = true;
13536
+ targetRay.linearVelocity.copy( inputPose.linearVelocity );
13537
+
13538
+ } else {
13539
+
13540
+ targetRay.hasLinearVelocity = false;
13541
+
13542
+ }
13543
+
13544
+ if ( inputPose.angularVelocity ) {
13545
+
13546
+ targetRay.hasAngularVelocity = true;
13547
+ targetRay.angularVelocity.copy( inputPose.angularVelocity );
13548
+
13549
+ } else {
13550
+
13551
+ targetRay.hasAngularVelocity = false;
13552
+
13553
+ }
13554
+
13555
+ this.dispatchEvent( _moveEvent );
13556
+
13557
+ }
13558
+
13559
+ }
13560
+
13561
+
13562
+ }
13563
+
13564
+ if ( targetRay !== null ) {
13565
+
13566
+ targetRay.visible = ( inputPose !== null );
13567
+
13568
+ }
13569
+
13570
+ if ( grip !== null ) {
13571
+
13572
+ grip.visible = ( gripPose !== null );
13573
+
13574
+ }
13575
+
13576
+ if ( hand !== null ) {
13577
+
13578
+ hand.visible = ( handPose !== null );
13579
+
13580
+ }
13581
+
13582
+ return this;
13583
+
13584
+ }
13585
+
13586
+ // private method
13587
+
13588
+ _getHandJoint( hand, inputjoint ) {
13589
+
13590
+ if ( hand.joints[ inputjoint.jointName ] === undefined ) {
13591
+
13592
+ const joint = new Group();
13593
+ joint.matrixAutoUpdate = false;
13594
+ joint.visible = false;
13595
+ hand.joints[ inputjoint.jointName ] = joint;
13596
+
13597
+ hand.add( joint );
13598
+
13599
+ }
13600
+
13601
+ return hand.joints[ inputjoint.jointName ];
13602
+
13603
+ }
13604
+
13605
+ }
13606
+
13216
13607
  class FogExp2 {
13217
13608
 
13218
13609
  constructor( color, density = 0.00025 ) {
@@ -16176,7 +16567,7 @@ class BatchedMesh extends Mesh {
16176
16567
  const instanceInfo = this._instanceInfo;
16177
16568
  for ( let i = 0, l = instanceInfo.length; i < l; i ++ ) {
16178
16569
 
16179
- if ( instanceInfo[ i ].geometryIndex === geometryId ) {
16570
+ if ( instanceInfo[ i ].active && instanceInfo[ i ].geometryIndex === geometryId ) {
16180
16571
 
16181
16572
  this.deleteInstance( i );
16182
16573
 
@@ -17027,7 +17418,7 @@ class Line extends Object3D {
17027
17418
  const a = index.getX( i );
17028
17419
  const b = index.getX( i + 1 );
17029
17420
 
17030
- const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
17421
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b, i );
17031
17422
 
17032
17423
  if ( intersect ) {
17033
17424
 
@@ -17042,7 +17433,7 @@ class Line extends Object3D {
17042
17433
  const a = index.getX( end - 1 );
17043
17434
  const b = index.getX( start );
17044
17435
 
17045
- const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b );
17436
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, a, b, end - 1 );
17046
17437
 
17047
17438
  if ( intersect ) {
17048
17439
 
@@ -17059,7 +17450,7 @@ class Line extends Object3D {
17059
17450
 
17060
17451
  for ( let i = start, l = end - 1; i < l; i += step ) {
17061
17452
 
17062
- const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1 );
17453
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, i, i + 1, i );
17063
17454
 
17064
17455
  if ( intersect ) {
17065
17456
 
@@ -17071,7 +17462,7 @@ class Line extends Object3D {
17071
17462
 
17072
17463
  if ( this.isLineLoop ) {
17073
17464
 
17074
- const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start );
17465
+ const intersect = checkIntersection( this, raycaster, _ray$1, localThresholdSq, end - 1, start, end - 1 );
17075
17466
 
17076
17467
  if ( intersect ) {
17077
17468
 
@@ -17118,7 +17509,7 @@ class Line extends Object3D {
17118
17509
 
17119
17510
  }
17120
17511
 
17121
- function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
17512
+ function checkIntersection( object, raycaster, ray, thresholdSq, a, b, i ) {
17122
17513
 
17123
17514
  const positionAttribute = object.geometry.attributes.position;
17124
17515
 
@@ -17141,7 +17532,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
17141
17532
  // What do we want? intersection point on the ray or on the segment??
17142
17533
  // point: raycaster.ray.at( distance ),
17143
17534
  point: _intersectPointOnSegment.clone().applyMatrix4( object.matrixWorld ),
17144
- index: a,
17535
+ index: i,
17145
17536
  face: null,
17146
17537
  faceIndex: null,
17147
17538
  barycoord: null,
@@ -17420,20 +17811,6 @@ function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, inte
17420
17811
 
17421
17812
  }
17422
17813
 
17423
- class Group extends Object3D {
17424
-
17425
- constructor() {
17426
-
17427
- super();
17428
-
17429
- this.isGroup = true;
17430
-
17431
- this.type = 'Group';
17432
-
17433
- }
17434
-
17435
- }
17436
-
17437
17814
  class VideoTexture extends Texture {
17438
17815
 
17439
17816
  constructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
@@ -17485,6 +17862,38 @@ class VideoTexture extends Texture {
17485
17862
 
17486
17863
  }
17487
17864
 
17865
+ class VideoFrameTexture extends VideoTexture {
17866
+
17867
+ constructor( mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
17868
+
17869
+ super( {}, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
17870
+
17871
+ this.isVideoFrameTexture = true;
17872
+
17873
+ }
17874
+
17875
+ update() {
17876
+
17877
+ // overwrites `VideoTexture.update()` with an empty method since
17878
+ // this type of texture is updated via `setFrame()`.
17879
+
17880
+ }
17881
+
17882
+ clone() {
17883
+
17884
+ return new this.constructor().copy( this ); // restoring Texture.clone()
17885
+
17886
+ }
17887
+
17888
+ setFrame( frame ) {
17889
+
17890
+ this.image = frame;
17891
+ this.needsUpdate = true;
17892
+
17893
+ }
17894
+
17895
+ }
17896
+
17488
17897
  class FramebufferTexture extends Texture {
17489
17898
 
17490
17899
  constructor( width, height ) {
@@ -21374,7 +21783,7 @@ function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {
21374
21783
  // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
21375
21784
  function isValidDiagonal( a, b ) {
21376
21785
 
21377
- return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges
21786
+ return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // doesn't intersect other edges
21378
21787
  ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible
21379
21788
  ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors
21380
21789
  equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case
@@ -30666,6 +31075,7 @@ class ArrayCamera extends PerspectiveCamera {
30666
31075
  this.isArrayCamera = true;
30667
31076
 
30668
31077
  this.cameras = array;
31078
+ this.index = 0;
30669
31079
 
30670
31080
  }
30671
31081
 
@@ -32374,11 +32784,11 @@ class PropertyBinding {
32374
32784
 
32375
32785
  this.targetObject = targetObject;
32376
32786
 
32377
- if ( targetObject.needsUpdate !== undefined ) { // material
32787
+ if ( targetObject.isMaterial === true ) {
32378
32788
 
32379
32789
  versioning = this.Versioning.NeedsUpdate;
32380
32790
 
32381
- } else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform
32791
+ } else if ( targetObject.isObject3D === true ) {
32382
32792
 
32383
32793
  versioning = this.Versioning.MatrixWorldNeedsUpdate;
32384
32794
 
@@ -34358,6 +34768,42 @@ class AnimationMixer extends EventDispatcher {
34358
34768
 
34359
34769
  }
34360
34770
 
34771
+ class RenderTarget3D extends RenderTarget {
34772
+
34773
+ constructor( width = 1, height = 1, depth = 1, options = {} ) {
34774
+
34775
+ super( width, height, options );
34776
+
34777
+ this.isRenderTarget3D = true;
34778
+
34779
+ this.depth = depth;
34780
+
34781
+ this.texture = new Data3DTexture( null, width, height, depth );
34782
+
34783
+ this.texture.isRenderTargetTexture = true;
34784
+
34785
+ }
34786
+
34787
+ }
34788
+
34789
+ class RenderTargetArray extends RenderTarget {
34790
+
34791
+ constructor( width = 1, height = 1, depth = 1, options = {} ) {
34792
+
34793
+ super( width, height, options );
34794
+
34795
+ this.isRenderTargetArray = true;
34796
+
34797
+ this.depth = depth;
34798
+
34799
+ this.texture = new DataArrayTexture( null, width, height, depth );
34800
+
34801
+ this.texture.isRenderTargetTexture = true;
34802
+
34803
+ }
34804
+
34805
+ }
34806
+
34361
34807
  class Uniform {
34362
34808
 
34363
34809
  constructor( value ) {
@@ -35997,17 +36443,19 @@ class CameraHelper extends LineSegments {
35997
36443
 
35998
36444
  _camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
35999
36445
 
36000
- // center / target
36446
+ // Adjust z values based on coordinate system
36447
+ const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? - 1 : 0;
36001
36448
 
36002
- setPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );
36449
+ // center / target
36450
+ setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
36003
36451
  setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );
36004
36452
 
36005
36453
  // near
36006
36454
 
36007
- setPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );
36008
- setPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );
36009
- setPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );
36010
- setPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );
36455
+ setPoint( 'n1', pointMap, geometry, _camera, - w, - h, nearZ );
36456
+ setPoint( 'n2', pointMap, geometry, _camera, w, - h, nearZ );
36457
+ setPoint( 'n3', pointMap, geometry, _camera, - w, h, nearZ );
36458
+ setPoint( 'n4', pointMap, geometry, _camera, w, h, nearZ );
36011
36459
 
36012
36460
  // far
36013
36461
 
@@ -36018,9 +36466,9 @@ class CameraHelper extends LineSegments {
36018
36466
 
36019
36467
  // up
36020
36468
 
36021
- setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );
36022
- setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );
36023
- setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );
36469
+ setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, nearZ );
36470
+ setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, nearZ );
36471
+ setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, nearZ );
36024
36472
 
36025
36473
  // cross
36026
36474
 
@@ -36029,10 +36477,10 @@ class CameraHelper extends LineSegments {
36029
36477
  setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
36030
36478
  setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
36031
36479
 
36032
- setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );
36033
- setPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );
36034
- setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );
36035
- setPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );
36480
+ setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );
36481
+ setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
36482
+ setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, nearZ );
36483
+ setPoint( 'cn4', pointMap, geometry, _camera, 0, h, nearZ );
36036
36484
 
36037
36485
  geometry.getAttribute( 'position' ).needsUpdate = true;
36038
36486
 
@@ -36821,6 +37269,12 @@ function fill( texture ) {
36821
37269
  /**
36822
37270
  * Given the width, height, format, and type of a texture. Determines how many
36823
37271
  * bytes must be used to represent the texture.
37272
+ *
37273
+ * @param {Number} width
37274
+ * @param {Number} height
37275
+ * @param {Number} format
37276
+ * @param {Number} type
37277
+ * @return {Number} The number of bytes required to represent the texture.
36824
37278
  */
36825
37279
  function getByteLength( width, height, format, type ) {
36826
37280
 
@@ -36959,26 +37413,6 @@ const TextureUtils = {
36959
37413
  getByteLength
36960
37414
  };
36961
37415
 
36962
- class WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162
36963
-
36964
- constructor( width = 1, height = 1, count = 1, options = {} ) {
36965
-
36966
- console.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.' );
36967
-
36968
- super( width, height, { ...options, count } );
36969
-
36970
- this.isWebGLMultipleRenderTargets = true;
36971
-
36972
- }
36973
-
36974
- get texture() {
36975
-
36976
- return this.textures;
36977
-
36978
- }
36979
-
36980
- }
36981
-
36982
37416
  if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
36983
37417
 
36984
37418
  __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
@@ -37488,7 +37922,7 @@ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp(
37488
37922
 
37489
37923
  var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
37490
37924
 
37491
- var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
37925
+ var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
37492
37926
 
37493
37927
  var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
37494
37928
 
@@ -38530,6 +38964,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
38530
38964
  boxMesh.geometry.dispose();
38531
38965
  boxMesh.material.dispose();
38532
38966
 
38967
+ boxMesh = undefined;
38968
+
38533
38969
  }
38534
38970
 
38535
38971
  if ( planeMesh !== undefined ) {
@@ -38537,6 +38973,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
38537
38973
  planeMesh.geometry.dispose();
38538
38974
  planeMesh.material.dispose();
38539
38975
 
38976
+ planeMesh = undefined;
38977
+
38540
38978
  }
38541
38979
 
38542
38980
  }
@@ -39731,6 +40169,12 @@ class PMREMGenerator {
39731
40169
  * in radians to be applied to the scene before PMREM generation. Optional near
39732
40170
  * and far planes ensure the scene is rendered in its entirety (the cubeCamera
39733
40171
  * is placed at the origin).
40172
+ *
40173
+ * @param {Scene} scene
40174
+ * @param {number} sigma
40175
+ * @param {number} near
40176
+ * @param {number} far
40177
+ * @return {WebGLRenderTarget}
39734
40178
  */
39735
40179
  fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
39736
40180
 
@@ -39766,6 +40210,10 @@ class PMREMGenerator {
39766
40210
  * or HDR. The ideal input image size is 1k (1024 x 512),
39767
40211
  * as this matches best with the 256 x 256 cubemap output.
39768
40212
  * The smallest supported equirectangular image size is 64 x 32.
40213
+ *
40214
+ * @param {Texture} equirectangular
40215
+ * @param {WebGLRenderTarget} [renderTarget=null] - Optional render target.
40216
+ * @return {WebGLRenderTarget}
39769
40217
  */
39770
40218
  fromEquirectangular( equirectangular, renderTarget = null ) {
39771
40219
 
@@ -39778,6 +40226,10 @@ class PMREMGenerator {
39778
40226
  * or HDR. The ideal input cube size is 256 x 256,
39779
40227
  * as this matches best with the 256 x 256 cubemap output.
39780
40228
  * The smallest supported cube size is 16 x 16.
40229
+ *
40230
+ * @param {Texture} cubemap
40231
+ * @param {null} [renderTarget=null] - Optional render target.
40232
+ * @return {WebGLRenderTarget}
39781
40233
  */
39782
40234
  fromCubemap( cubemap, renderTarget = null ) {
39783
40235
 
@@ -40095,6 +40547,12 @@ class PMREMGenerator {
40095
40547
  * the blur latitudinally (around the poles), and then longitudinally (towards
40096
40548
  * the poles) to approximate the orthogonally-separable blur. It is least
40097
40549
  * accurate at the poles, but still does a decent job.
40550
+ *
40551
+ * @param {WebGLRenderTarget} cubeUVRenderTarget
40552
+ * @param {number} lodIn
40553
+ * @param {number} lodOut
40554
+ * @param {number} sigma
40555
+ * @param {Vector3} [poleAxis]
40098
40556
  */
40099
40557
  _blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {
40100
40558
 
@@ -49817,344 +50275,6 @@ class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
49817
50275
 
49818
50276
  WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
49819
50277
 
49820
- const _moveEvent = { type: 'move' };
49821
-
49822
- class WebXRController {
49823
-
49824
- constructor() {
49825
-
49826
- this._targetRay = null;
49827
- this._grip = null;
49828
- this._hand = null;
49829
-
49830
- }
49831
-
49832
- getHandSpace() {
49833
-
49834
- if ( this._hand === null ) {
49835
-
49836
- this._hand = new Group();
49837
- this._hand.matrixAutoUpdate = false;
49838
- this._hand.visible = false;
49839
-
49840
- this._hand.joints = {};
49841
- this._hand.inputState = { pinching: false };
49842
-
49843
- }
49844
-
49845
- return this._hand;
49846
-
49847
- }
49848
-
49849
- getTargetRaySpace() {
49850
-
49851
- if ( this._targetRay === null ) {
49852
-
49853
- this._targetRay = new Group();
49854
- this._targetRay.matrixAutoUpdate = false;
49855
- this._targetRay.visible = false;
49856
- this._targetRay.hasLinearVelocity = false;
49857
- this._targetRay.linearVelocity = new Vector3();
49858
- this._targetRay.hasAngularVelocity = false;
49859
- this._targetRay.angularVelocity = new Vector3();
49860
-
49861
- }
49862
-
49863
- return this._targetRay;
49864
-
49865
- }
49866
-
49867
- getGripSpace() {
49868
-
49869
- if ( this._grip === null ) {
49870
-
49871
- this._grip = new Group();
49872
- this._grip.matrixAutoUpdate = false;
49873
- this._grip.visible = false;
49874
- this._grip.hasLinearVelocity = false;
49875
- this._grip.linearVelocity = new Vector3();
49876
- this._grip.hasAngularVelocity = false;
49877
- this._grip.angularVelocity = new Vector3();
49878
-
49879
- }
49880
-
49881
- return this._grip;
49882
-
49883
- }
49884
-
49885
- dispatchEvent( event ) {
49886
-
49887
- if ( this._targetRay !== null ) {
49888
-
49889
- this._targetRay.dispatchEvent( event );
49890
-
49891
- }
49892
-
49893
- if ( this._grip !== null ) {
49894
-
49895
- this._grip.dispatchEvent( event );
49896
-
49897
- }
49898
-
49899
- if ( this._hand !== null ) {
49900
-
49901
- this._hand.dispatchEvent( event );
49902
-
49903
- }
49904
-
49905
- return this;
49906
-
49907
- }
49908
-
49909
- connect( inputSource ) {
49910
-
49911
- if ( inputSource && inputSource.hand ) {
49912
-
49913
- const hand = this._hand;
49914
-
49915
- if ( hand ) {
49916
-
49917
- for ( const inputjoint of inputSource.hand.values() ) {
49918
-
49919
- // Initialize hand with joints when connected
49920
- this._getHandJoint( hand, inputjoint );
49921
-
49922
- }
49923
-
49924
- }
49925
-
49926
- }
49927
-
49928
- this.dispatchEvent( { type: 'connected', data: inputSource } );
49929
-
49930
- return this;
49931
-
49932
- }
49933
-
49934
- disconnect( inputSource ) {
49935
-
49936
- this.dispatchEvent( { type: 'disconnected', data: inputSource } );
49937
-
49938
- if ( this._targetRay !== null ) {
49939
-
49940
- this._targetRay.visible = false;
49941
-
49942
- }
49943
-
49944
- if ( this._grip !== null ) {
49945
-
49946
- this._grip.visible = false;
49947
-
49948
- }
49949
-
49950
- if ( this._hand !== null ) {
49951
-
49952
- this._hand.visible = false;
49953
-
49954
- }
49955
-
49956
- return this;
49957
-
49958
- }
49959
-
49960
- update( inputSource, frame, referenceSpace ) {
49961
-
49962
- let inputPose = null;
49963
- let gripPose = null;
49964
- let handPose = null;
49965
-
49966
- const targetRay = this._targetRay;
49967
- const grip = this._grip;
49968
- const hand = this._hand;
49969
-
49970
- if ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {
49971
-
49972
- if ( hand && inputSource.hand ) {
49973
-
49974
- handPose = true;
49975
-
49976
- for ( const inputjoint of inputSource.hand.values() ) {
49977
-
49978
- // Update the joints groups with the XRJoint poses
49979
- const jointPose = frame.getJointPose( inputjoint, referenceSpace );
49980
-
49981
- // The transform of this joint will be updated with the joint pose on each frame
49982
- const joint = this._getHandJoint( hand, inputjoint );
49983
-
49984
- if ( jointPose !== null ) {
49985
-
49986
- joint.matrix.fromArray( jointPose.transform.matrix );
49987
- joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
49988
- joint.matrixWorldNeedsUpdate = true;
49989
- joint.jointRadius = jointPose.radius;
49990
-
49991
- }
49992
-
49993
- joint.visible = jointPose !== null;
49994
-
49995
- }
49996
-
49997
- // Custom events
49998
-
49999
- // Check pinchz
50000
- const indexTip = hand.joints[ 'index-finger-tip' ];
50001
- const thumbTip = hand.joints[ 'thumb-tip' ];
50002
- const distance = indexTip.position.distanceTo( thumbTip.position );
50003
-
50004
- const distanceToPinch = 0.02;
50005
- const threshold = 0.005;
50006
-
50007
- if ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {
50008
-
50009
- hand.inputState.pinching = false;
50010
- this.dispatchEvent( {
50011
- type: 'pinchend',
50012
- handedness: inputSource.handedness,
50013
- target: this
50014
- } );
50015
-
50016
- } else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {
50017
-
50018
- hand.inputState.pinching = true;
50019
- this.dispatchEvent( {
50020
- type: 'pinchstart',
50021
- handedness: inputSource.handedness,
50022
- target: this
50023
- } );
50024
-
50025
- }
50026
-
50027
- } else {
50028
-
50029
- if ( grip !== null && inputSource.gripSpace ) {
50030
-
50031
- gripPose = frame.getPose( inputSource.gripSpace, referenceSpace );
50032
-
50033
- if ( gripPose !== null ) {
50034
-
50035
- grip.matrix.fromArray( gripPose.transform.matrix );
50036
- grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
50037
- grip.matrixWorldNeedsUpdate = true;
50038
-
50039
- if ( gripPose.linearVelocity ) {
50040
-
50041
- grip.hasLinearVelocity = true;
50042
- grip.linearVelocity.copy( gripPose.linearVelocity );
50043
-
50044
- } else {
50045
-
50046
- grip.hasLinearVelocity = false;
50047
-
50048
- }
50049
-
50050
- if ( gripPose.angularVelocity ) {
50051
-
50052
- grip.hasAngularVelocity = true;
50053
- grip.angularVelocity.copy( gripPose.angularVelocity );
50054
-
50055
- } else {
50056
-
50057
- grip.hasAngularVelocity = false;
50058
-
50059
- }
50060
-
50061
- }
50062
-
50063
- }
50064
-
50065
- }
50066
-
50067
- if ( targetRay !== null ) {
50068
-
50069
- inputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );
50070
-
50071
- // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it
50072
- if ( inputPose === null && gripPose !== null ) {
50073
-
50074
- inputPose = gripPose;
50075
-
50076
- }
50077
-
50078
- if ( inputPose !== null ) {
50079
-
50080
- targetRay.matrix.fromArray( inputPose.transform.matrix );
50081
- targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
50082
- targetRay.matrixWorldNeedsUpdate = true;
50083
-
50084
- if ( inputPose.linearVelocity ) {
50085
-
50086
- targetRay.hasLinearVelocity = true;
50087
- targetRay.linearVelocity.copy( inputPose.linearVelocity );
50088
-
50089
- } else {
50090
-
50091
- targetRay.hasLinearVelocity = false;
50092
-
50093
- }
50094
-
50095
- if ( inputPose.angularVelocity ) {
50096
-
50097
- targetRay.hasAngularVelocity = true;
50098
- targetRay.angularVelocity.copy( inputPose.angularVelocity );
50099
-
50100
- } else {
50101
-
50102
- targetRay.hasAngularVelocity = false;
50103
-
50104
- }
50105
-
50106
- this.dispatchEvent( _moveEvent );
50107
-
50108
- }
50109
-
50110
- }
50111
-
50112
-
50113
- }
50114
-
50115
- if ( targetRay !== null ) {
50116
-
50117
- targetRay.visible = ( inputPose !== null );
50118
-
50119
- }
50120
-
50121
- if ( grip !== null ) {
50122
-
50123
- grip.visible = ( gripPose !== null );
50124
-
50125
- }
50126
-
50127
- if ( hand !== null ) {
50128
-
50129
- hand.visible = ( handPose !== null );
50130
-
50131
- }
50132
-
50133
- return this;
50134
-
50135
- }
50136
-
50137
- // private method
50138
-
50139
- _getHandJoint( hand, inputjoint ) {
50140
-
50141
- if ( hand.joints[ inputjoint.jointName ] === undefined ) {
50142
-
50143
- const joint = new Group();
50144
- joint.matrixAutoUpdate = false;
50145
- joint.visible = false;
50146
- hand.joints[ inputjoint.jointName ] = joint;
50147
-
50148
- hand.add( joint );
50149
-
50150
- }
50151
-
50152
- return hand.joints[ inputjoint.jointName ];
50153
-
50154
- }
50155
-
50156
- }
50157
-
50158
50278
  const _occlusion_vertex = `
50159
50279
  void main() {
50160
50280
 
@@ -50204,7 +50324,7 @@ class WebXRDepthSensing {
50204
50324
  const texProps = renderer.properties.get( texture );
50205
50325
  texProps.__webglTexture = depthData.texture;
50206
50326
 
50207
- if ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {
50327
+ if ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {
50208
50328
 
50209
50329
  this.depthNear = depthData.depthNear;
50210
50330
  this.depthFar = depthData.depthFar;
@@ -50494,6 +50614,12 @@ class WebXRManager extends EventDispatcher {
50494
50614
 
50495
50615
  };
50496
50616
 
50617
+ this.getRenderTarget = function () {
50618
+
50619
+ return newRenderTarget;
50620
+
50621
+ };
50622
+
50497
50623
  this.getFrame = function () {
50498
50624
 
50499
50625
  return xrFrame;
@@ -50532,7 +50658,11 @@ class WebXRManager extends EventDispatcher {
50532
50658
  currentPixelRatio = renderer.getPixelRatio();
50533
50659
  renderer.getSize( currentSize );
50534
50660
 
50535
- if ( session.renderState.layers === undefined ) {
50661
+ // Check that the browser implements the necessary APIs to use an
50662
+ // XRProjectionLayer rather than an XRWebGLLayer
50663
+ const useLayers = typeof XRWebGLBinding !== 'undefined' && 'createProjectionLayer' in XRWebGLBinding.prototype;
50664
+
50665
+ if ( ! useLayers ) {
50536
50666
 
50537
50667
  const layerInit = {
50538
50668
  antialias: attributes.antialias,
@@ -50757,6 +50887,10 @@ class WebXRManager extends EventDispatcher {
50757
50887
  * the cameras' projection and world matrices have already been set.
50758
50888
  * And that near and far planes are identical for both cameras.
50759
50889
  * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
50890
+ *
50891
+ * @param {ArrayCamera} camera - The camera to update.
50892
+ * @param {PerspectiveCamera} cameraL - The left camera.
50893
+ * @param {PerspectiveCamera} cameraR - The right camera.
50760
50894
  */
50761
50895
  function setProjectionFromUnion( camera, cameraL, cameraR ) {
50762
50896
 
@@ -51085,8 +51219,11 @@ class WebXRManager extends EventDispatcher {
51085
51219
  //
51086
51220
 
51087
51221
  const enabledFeatures = session.enabledFeatures;
51222
+ const gpuDepthSensingEnabled = enabledFeatures &&
51223
+ enabledFeatures.includes( 'depth-sensing' ) &&
51224
+ session.depthUsage == 'gpu-optimized';
51088
51225
 
51089
- if ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {
51226
+ if ( gpuDepthSensingEnabled && glBinding ) {
51090
51227
 
51091
51228
  const depthData = glBinding.getDepthInformation( views[ 0 ] );
51092
51229
 
@@ -52257,6 +52394,9 @@ class WebGLRenderer {
52257
52394
  let _clippingEnabled = false;
52258
52395
  let _localClippingEnabled = false;
52259
52396
 
52397
+ // transmission render target scale
52398
+ this.transmissionResolutionScale = 1.0;
52399
+
52260
52400
  // camera matrices cache
52261
52401
 
52262
52402
  const _currentProjectionMatrix = new Matrix4();
@@ -53345,7 +53485,7 @@ class WebGLRenderer {
53345
53485
 
53346
53486
  //
53347
53487
 
53348
- if ( _currentRenderTarget !== null ) {
53488
+ if ( _currentRenderTarget !== null && _currentActiveMipmapLevel === 0 ) {
53349
53489
 
53350
53490
  // resolve multisample renderbuffers to a single-sample texture if necessary
53351
53491
 
@@ -53573,7 +53713,7 @@ class WebGLRenderer {
53573
53713
  const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];
53574
53714
 
53575
53715
  const activeViewport = camera.viewport || _currentViewport;
53576
- transmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );
53716
+ transmissionRenderTarget.setSize( activeViewport.z * _this.transmissionResolutionScale, activeViewport.w * _this.transmissionResolutionScale );
53577
53717
 
53578
53718
  //
53579
53719
 
@@ -54391,8 +54531,16 @@ class WebGLRenderer {
54391
54531
 
54392
54532
  };
54393
54533
 
54534
+ const _scratchFrameBuffer = _gl.createFramebuffer();
54394
54535
  this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
54395
54536
 
54537
+ // Render to base layer instead of canvas in WebXR
54538
+ if ( renderTarget === null && this.xr.isPresenting ) {
54539
+
54540
+ renderTarget = this.xr.getRenderTarget();
54541
+
54542
+ }
54543
+
54396
54544
  _currentRenderTarget = renderTarget;
54397
54545
  _currentActiveCubeFace = activeCubeFace;
54398
54546
  _currentActiveMipmapLevel = activeMipmapLevel;
@@ -54499,6 +54647,14 @@ class WebGLRenderer {
54499
54647
 
54500
54648
  }
54501
54649
 
54650
+ // Use a scratch frame buffer if rendering to a mip level to avoid depth buffers
54651
+ // being bound that are different sizes.
54652
+ if ( activeMipmapLevel !== 0 ) {
54653
+
54654
+ framebuffer = _scratchFrameBuffer;
54655
+
54656
+ }
54657
+
54502
54658
  const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
54503
54659
 
54504
54660
  if ( framebufferBound && useDefaultFramebuffer ) {
@@ -54519,8 +54675,15 @@ class WebGLRenderer {
54519
54675
  } else if ( isRenderTarget3D ) {
54520
54676
 
54521
54677
  const textureProperties = properties.get( renderTarget.texture );
54522
- const layer = activeCubeFace || 0;
54523
- _gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );
54678
+ const layer = activeCubeFace;
54679
+ _gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel, layer );
54680
+
54681
+ } else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {
54682
+
54683
+ // Only bind the frame buffer if we are using a scratch frame buffer to render to a mipmap.
54684
+ // If we rebind the texture when using a multi sample buffer then an error about inconsistent samples will be thrown.
54685
+ const textureProperties = properties.get( renderTarget.texture );
54686
+ _gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, textureProperties.__webglTexture, activeMipmapLevel );
54524
54687
 
54525
54688
  }
54526
54689
 
@@ -55379,6 +55542,8 @@ exports.RedFormat = RedFormat;
55379
55542
  exports.RedIntegerFormat = RedIntegerFormat;
55380
55543
  exports.ReinhardToneMapping = ReinhardToneMapping;
55381
55544
  exports.RenderTarget = RenderTarget;
55545
+ exports.RenderTarget3D = RenderTarget3D;
55546
+ exports.RenderTargetArray = RenderTargetArray;
55382
55547
  exports.RepeatWrapping = RepeatWrapping;
55383
55548
  exports.ReplaceStencilOp = ReplaceStencilOp;
55384
55549
  exports.ReverseSubtractEquation = ReverseSubtractEquation;
@@ -55429,6 +55594,7 @@ exports.TetrahedronGeometry = TetrahedronGeometry;
55429
55594
  exports.Texture = Texture;
55430
55595
  exports.TextureLoader = TextureLoader;
55431
55596
  exports.TextureUtils = TextureUtils;
55597
+ exports.TimestampQuery = TimestampQuery;
55432
55598
  exports.TorusGeometry = TorusGeometry;
55433
55599
  exports.TorusKnotGeometry = TorusKnotGeometry;
55434
55600
  exports.Triangle = Triangle;
@@ -55457,16 +55623,17 @@ exports.Vector2 = Vector2;
55457
55623
  exports.Vector3 = Vector3;
55458
55624
  exports.Vector4 = Vector4;
55459
55625
  exports.VectorKeyframeTrack = VectorKeyframeTrack;
55626
+ exports.VideoFrameTexture = VideoFrameTexture;
55460
55627
  exports.VideoTexture = VideoTexture;
55461
55628
  exports.WebGL3DRenderTarget = WebGL3DRenderTarget;
55462
55629
  exports.WebGLArrayRenderTarget = WebGLArrayRenderTarget;
55463
55630
  exports.WebGLCoordinateSystem = WebGLCoordinateSystem;
55464
55631
  exports.WebGLCubeRenderTarget = WebGLCubeRenderTarget;
55465
- exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
55466
55632
  exports.WebGLRenderTarget = WebGLRenderTarget;
55467
55633
  exports.WebGLRenderer = WebGLRenderer;
55468
55634
  exports.WebGLUtils = WebGLUtils;
55469
55635
  exports.WebGPUCoordinateSystem = WebGPUCoordinateSystem;
55636
+ exports.WebXRController = WebXRController;
55470
55637
  exports.WireframeGeometry = WireframeGeometry;
55471
55638
  exports.WrapAroundEnding = WrapAroundEnding;
55472
55639
  exports.ZeroCurvatureEnding = ZeroCurvatureEnding;