@needle-tools/three 0.162.12 → 0.169.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 (635) hide show
  1. package/README.md +3 -3
  2. package/build/three.cjs +29789 -1941
  3. package/build/three.module.js +29095 -1933
  4. package/build/three.module.min.js +2 -2
  5. package/build/three.webgpu.js +80003 -0
  6. package/build/three.webgpu.min.js +6 -0
  7. package/build/three.webgpu.nodes.js +79951 -0
  8. package/build/three.webgpu.nodes.min.js +6 -0
  9. package/examples/jsm/Addons.js +2 -5
  10. package/examples/jsm/animation/AnimationClipCreator.js +1 -1
  11. package/examples/jsm/animation/CCDIKSolver.js +4 -2
  12. package/examples/jsm/capabilities/WebGL.js +27 -21
  13. package/examples/jsm/controls/ArcballControls.js +174 -158
  14. package/examples/jsm/controls/DragControls.js +260 -132
  15. package/examples/jsm/controls/FirstPersonControls.js +175 -163
  16. package/examples/jsm/controls/FlyControls.js +194 -188
  17. package/examples/jsm/controls/OrbitControls.js +790 -797
  18. package/examples/jsm/controls/PointerLockControls.js +24 -15
  19. package/examples/jsm/controls/TrackballControls.js +469 -448
  20. package/examples/jsm/controls/TransformControls.js +98 -63
  21. package/examples/jsm/csm/CSMShader.js +4 -4
  22. package/examples/jsm/effects/AnaglyphEffect.js +6 -13
  23. package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
  24. package/examples/jsm/effects/StereoEffect.js +6 -1
  25. package/examples/jsm/environments/RoomEnvironment.js +2 -6
  26. package/examples/jsm/exporters/DRACOExporter.js +4 -2
  27. package/examples/jsm/exporters/EXRExporter.js +19 -11
  28. package/examples/jsm/exporters/GLTFExporter.js +77 -8
  29. package/examples/jsm/exporters/KTX2Exporter.js +21 -13
  30. package/examples/jsm/exporters/OBJExporter.js +5 -1
  31. package/examples/jsm/exporters/PLYExporter.js +9 -7
  32. package/examples/jsm/exporters/USDZExporter.js +55 -11
  33. package/examples/jsm/geometries/DecalGeometry.js +4 -1
  34. package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
  35. package/examples/jsm/geometries/TeapotGeometry.js +1 -1
  36. package/examples/jsm/geometries/TextGeometry.js +10 -2
  37. package/examples/jsm/helpers/LightProbeHelper.js +43 -44
  38. package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
  39. package/examples/jsm/helpers/ViewHelper.js +75 -61
  40. package/examples/jsm/interactive/HTMLMesh.js +7 -9
  41. package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
  42. package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  43. package/examples/jsm/libs/draco/README.md +2 -2
  44. package/examples/jsm/libs/fflate.module.js +694 -496
  45. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  46. package/examples/jsm/lights/LightProbeGenerator.js +24 -10
  47. package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
  48. package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
  49. package/examples/jsm/lines/LineMaterial.js +1 -17
  50. package/examples/jsm/lines/LineSegments2.js +15 -0
  51. package/examples/jsm/lines/Wireframe.js +16 -1
  52. package/examples/jsm/lines/webgpu/Line2.js +20 -0
  53. package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
  54. package/examples/jsm/loaders/3MFLoader.js +2 -0
  55. package/examples/jsm/loaders/ColladaLoader.js +9 -6
  56. package/examples/jsm/loaders/DRACOLoader.js +4 -2
  57. package/examples/jsm/loaders/EXRLoader.js +351 -97
  58. package/examples/jsm/loaders/FBXLoader.js +77 -78
  59. package/examples/jsm/loaders/GLTFLoader.js +76 -14
  60. package/examples/jsm/loaders/KTX2Loader.js +30 -22
  61. package/examples/jsm/loaders/LDrawLoader.js +3 -2
  62. package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
  63. package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
  64. package/examples/jsm/loaders/LUTImageLoader.js +0 -14
  65. package/examples/jsm/loaders/MMDLoader.js +31 -12
  66. package/examples/jsm/loaders/MTLLoader.js +4 -3
  67. package/examples/jsm/loaders/MaterialXLoader.js +45 -21
  68. package/examples/jsm/loaders/OBJLoader.js +5 -3
  69. package/examples/jsm/loaders/PCDLoader.js +14 -13
  70. package/examples/jsm/loaders/PDBLoader.js +3 -2
  71. package/examples/jsm/loaders/PLYLoader.js +8 -5
  72. package/examples/jsm/loaders/RGBMLoader.js +16 -0
  73. package/examples/jsm/loaders/STLLoader.js +3 -2
  74. package/examples/jsm/loaders/USDZLoader.js +124 -76
  75. package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
  76. package/examples/jsm/loaders/VRMLLoader.js +11 -11
  77. package/examples/jsm/loaders/VTKLoader.js +80 -6
  78. package/examples/jsm/loaders/XYZLoader.js +3 -2
  79. package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
  80. package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
  81. package/examples/jsm/math/Octree.js +26 -20
  82. package/examples/jsm/misc/GPUComputationRenderer.js +9 -25
  83. package/examples/jsm/misc/Timer.js +1 -1
  84. package/examples/jsm/modifiers/CurveModifier.js +11 -9
  85. package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
  86. package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
  87. package/examples/jsm/objects/InstancedPoints.js +2 -2
  88. package/examples/jsm/objects/Lensflare.js +2 -2
  89. package/examples/jsm/objects/LensflareMesh.js +322 -0
  90. package/examples/jsm/objects/SkyMesh.js +187 -0
  91. package/examples/jsm/objects/Water2Mesh.js +158 -0
  92. package/examples/jsm/objects/WaterMesh.js +101 -0
  93. package/examples/jsm/physics/JoltPhysics.js +281 -0
  94. package/examples/jsm/physics/RapierPhysics.js +25 -5
  95. package/examples/jsm/postprocessing/GlitchPass.js +0 -3
  96. package/examples/jsm/postprocessing/LUTPass.js +5 -71
  97. package/examples/jsm/postprocessing/OutlinePass.js +31 -46
  98. package/examples/jsm/postprocessing/RenderPass.js +1 -1
  99. package/examples/jsm/postprocessing/RenderTransitionPass.js +168 -0
  100. package/examples/jsm/postprocessing/SAOPass.js +0 -1
  101. package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
  102. package/examples/jsm/postprocessing/SSAOPass.js +6 -12
  103. package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
  104. package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
  105. package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
  106. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +1 -3
  107. package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
  108. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +7 -4
  109. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +19 -5
  110. package/examples/jsm/shaders/BleachBypassShader.js +1 -2
  111. package/examples/jsm/shaders/ColorifyShader.js +1 -2
  112. package/examples/jsm/shaders/FXAAShader.js +0 -2
  113. package/examples/jsm/shaders/GTAOShader.js +1 -1
  114. package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
  115. package/examples/jsm/shaders/OutputShader.js +1 -1
  116. package/examples/jsm/transpiler/GLSLDecoder.js +47 -5
  117. package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
  118. package/examples/jsm/transpiler/TSLEncoder.js +24 -22
  119. package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
  120. package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
  121. package/examples/jsm/utils/SceneUtils.js +60 -1
  122. package/examples/jsm/utils/ShadowMapViewer.js +3 -8
  123. package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
  124. package/examples/jsm/utils/SkeletonUtils.js +84 -66
  125. package/examples/jsm/utils/SortUtils.js +8 -5
  126. package/examples/jsm/utils/TextureUtils.js +3 -2
  127. package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
  128. package/examples/jsm/webxr/OculusHandModel.js +3 -2
  129. package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
  130. package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
  131. package/package.json +11 -8
  132. package/src/Three.WebGPU.Nodes.js +200 -0
  133. package/src/Three.WebGPU.js +201 -0
  134. package/src/Three.js +23 -1
  135. package/src/animation/AnimationClip.js +1 -1
  136. package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
  137. package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
  138. package/src/animation/tracks/StringKeyframeTrack.js +10 -1
  139. package/src/audio/Audio.js +2 -2
  140. package/src/constants.js +6 -7
  141. package/src/core/BufferAttribute.js +0 -9
  142. package/src/core/Clock.js +1 -1
  143. package/src/core/InterleavedBuffer.js +0 -9
  144. package/src/core/Object3D.js +34 -29
  145. package/src/core/Raycaster.js +6 -2
  146. package/src/core/RenderTarget.js +8 -0
  147. package/src/extras/Controls.js +32 -0
  148. package/src/extras/PMREMGenerator.js +12 -11
  149. package/src/extras/TextureUtils.js +210 -0
  150. package/src/geometries/CylinderGeometry.js +11 -4
  151. package/src/lights/Light.js +1 -0
  152. package/src/lights/LightShadow.js +5 -0
  153. package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
  154. package/src/loaders/FileLoader.js +5 -1
  155. package/src/loaders/LoaderUtils.js +3 -1
  156. package/src/loaders/MaterialLoader.js +8 -1
  157. package/src/loaders/ObjectLoader.js +36 -2
  158. package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeLoader.js +27 -5
  159. package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeMaterialLoader.js +22 -18
  160. package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeObjectLoader.js +21 -1
  161. package/src/materials/Material.js +4 -0
  162. package/src/materials/MeshPhysicalMaterial.js +20 -0
  163. package/src/materials/ShaderMaterial.js +0 -4
  164. package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
  165. package/{examples/jsm/nodes/materials → src/materials/nodes}/Line2NodeMaterial.js +69 -68
  166. package/src/materials/nodes/LineBasicNodeMaterial.js +31 -0
  167. package/{examples/jsm/nodes/materials → src/materials/nodes}/LineDashedNodeMaterial.js +15 -12
  168. package/src/materials/nodes/MeshBasicNodeMaterial.js +77 -0
  169. package/src/materials/nodes/MeshLambertNodeMaterial.js +47 -0
  170. package/src/materials/nodes/MeshMatcapNodeMaterial.js +57 -0
  171. package/src/materials/nodes/MeshNormalNodeMaterial.js +44 -0
  172. package/src/materials/nodes/MeshPhongNodeMaterial.js +78 -0
  173. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +248 -0
  174. package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshSSSNodeMaterial.js +10 -7
  175. package/src/materials/nodes/MeshStandardNodeMaterial.js +108 -0
  176. package/src/materials/nodes/MeshToonNodeMaterial.js +38 -0
  177. package/{examples/jsm/nodes/materials → src/materials/nodes}/NodeMaterial.js +198 -157
  178. package/{examples/jsm/nodes/materials/Materials.js → src/materials/nodes/NodeMaterials.js} +7 -1
  179. package/{examples/jsm/nodes/materials → src/materials/nodes}/PointsNodeMaterial.js +10 -7
  180. package/src/materials/nodes/ShadowNodeMaterial.js +38 -0
  181. package/src/materials/nodes/SpriteNodeMaterial.js +123 -0
  182. package/src/materials/nodes/VolumeNodeMaterial.js +108 -0
  183. package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
  184. package/src/math/Box2.js +4 -4
  185. package/src/math/Box3.js +6 -6
  186. package/src/math/ColorManagement.js +10 -0
  187. package/src/math/Matrix2.js +54 -0
  188. package/src/math/Spherical.js +4 -5
  189. package/src/math/Triangle.js +24 -0
  190. package/src/math/Vector4.js +13 -0
  191. package/src/nodes/Nodes.js +164 -0
  192. package/src/nodes/TSL.js +179 -0
  193. package/src/nodes/accessors/AccessorsUtils.js +25 -0
  194. package/src/nodes/accessors/BatchNode.js +128 -0
  195. package/src/nodes/accessors/Bitangent.js +13 -0
  196. package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +44 -6
  197. package/{examples/jsm → src}/nodes/accessors/BufferNode.js +13 -4
  198. package/src/nodes/accessors/Camera.js +13 -0
  199. package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +22 -15
  200. package/src/nodes/accessors/CubeTextureNode.js +79 -0
  201. package/src/nodes/accessors/InstanceNode.js +144 -0
  202. package/src/nodes/accessors/InstancedPointsMaterialNode.js +24 -0
  203. package/src/nodes/accessors/Lights.js +51 -0
  204. package/src/nodes/accessors/MaterialNode.js +441 -0
  205. package/src/nodes/accessors/MaterialProperties.js +3 -0
  206. package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +10 -5
  207. package/src/nodes/accessors/ModelNode.js +72 -0
  208. package/src/nodes/accessors/ModelViewProjectionNode.js +42 -0
  209. package/{examples/jsm → src}/nodes/accessors/MorphNode.js +51 -33
  210. package/src/nodes/accessors/Normal.js +88 -0
  211. package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +18 -34
  212. package/src/nodes/accessors/PointUVNode.js +30 -0
  213. package/src/nodes/accessors/Position.js +10 -0
  214. package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
  215. package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +58 -9
  216. package/src/nodes/accessors/ReflectVector.js +10 -0
  217. package/src/nodes/accessors/RendererReferenceNode.js +35 -0
  218. package/{examples/jsm → src}/nodes/accessors/SceneNode.js +9 -6
  219. package/src/nodes/accessors/SkinningNode.js +191 -0
  220. package/src/nodes/accessors/StorageBufferNode.js +147 -0
  221. package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +35 -10
  222. package/src/nodes/accessors/Tangent.js +22 -0
  223. package/src/nodes/accessors/Texture3DNode.js +103 -0
  224. package/{examples/jsm/nodes/accessors/TextureBicubicNode.js → src/nodes/accessors/TextureBicubic.js} +3 -32
  225. package/{examples/jsm → src}/nodes/accessors/TextureNode.js +123 -39
  226. package/src/nodes/accessors/TextureSizeNode.js +36 -0
  227. package/src/nodes/accessors/UV.js +3 -0
  228. package/{examples/jsm/nodes/accessors/UniformsNode.js → src/nodes/accessors/UniformArrayNode.js} +33 -15
  229. package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +10 -7
  230. package/src/nodes/accessors/VelocityNode.js +134 -0
  231. package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +9 -5
  232. package/{examples/jsm → src}/nodes/code/CodeNode.js +9 -5
  233. package/{examples/jsm → src}/nodes/code/ExpressionNode.js +10 -6
  234. package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +8 -5
  235. package/{examples/jsm → src}/nodes/code/FunctionNode.js +8 -31
  236. package/{examples/jsm → src}/nodes/code/ScriptableNode.js +24 -7
  237. package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +11 -8
  238. package/{examples/jsm → src}/nodes/core/AssignNode.js +12 -9
  239. package/{examples/jsm → src}/nodes/core/AttributeNode.js +29 -12
  240. package/{examples/jsm → src}/nodes/core/BypassNode.js +11 -7
  241. package/src/nodes/core/CacheNode.js +50 -0
  242. package/{examples/jsm → src}/nodes/core/ConstNode.js +6 -3
  243. package/{examples/jsm → src}/nodes/core/ContextNode.js +27 -11
  244. package/src/nodes/core/IndexNode.js +99 -0
  245. package/{examples/jsm → src}/nodes/core/InputNode.js +7 -3
  246. package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
  247. package/src/nodes/core/MRTNode.js +85 -0
  248. package/{examples/jsm → src}/nodes/core/Node.js +114 -57
  249. package/{examples/jsm → src}/nodes/core/NodeBuilder.js +327 -90
  250. package/src/nodes/core/NodeCache.js +36 -0
  251. package/{examples/jsm → src}/nodes/core/NodeFrame.js +52 -10
  252. package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
  253. package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
  254. package/{examples/jsm → src}/nodes/core/NodeUtils.js +56 -8
  255. package/{examples/jsm → src}/nodes/core/OutputStructNode.js +13 -12
  256. package/{examples/jsm → src}/nodes/core/ParameterNode.js +7 -4
  257. package/src/nodes/core/PropertyNode.js +88 -0
  258. package/{examples/jsm → src}/nodes/core/StackNode.js +31 -11
  259. package/{examples/jsm → src}/nodes/core/StructTypeNode.js +7 -3
  260. package/{examples/jsm → src}/nodes/core/TempNode.js +10 -6
  261. package/src/nodes/core/UniformGroupNode.js +59 -0
  262. package/{examples/jsm → src}/nodes/core/UniformNode.js +37 -5
  263. package/{examples/jsm → src}/nodes/core/VarNode.js +14 -14
  264. package/src/nodes/core/VaryingNode.js +108 -0
  265. package/{examples/jsm → src}/nodes/display/AfterImageNode.js +38 -28
  266. package/src/nodes/display/AnaglyphPassNode.js +67 -0
  267. package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +33 -30
  268. package/src/nodes/display/BleachBypass.js +26 -0
  269. package/src/nodes/display/BlendMode.js +54 -0
  270. package/src/nodes/display/BloomNode.js +341 -0
  271. package/{examples/jsm → src}/nodes/display/BumpMapNode.js +20 -38
  272. package/src/nodes/display/ColorAdjustment.js +46 -0
  273. package/src/nodes/display/ColorSpaceFunctions.js +38 -0
  274. package/src/nodes/display/ColorSpaceNode.js +114 -0
  275. package/src/nodes/display/DenoiseNode.js +204 -0
  276. package/src/nodes/display/DepthOfFieldNode.js +124 -0
  277. package/src/nodes/display/DotScreenNode.js +66 -0
  278. package/src/nodes/display/FXAANode.js +332 -0
  279. package/src/nodes/display/FilmNode.js +56 -0
  280. package/src/nodes/display/FrontFacingNode.js +45 -0
  281. package/src/nodes/display/GTAONode.js +331 -0
  282. package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +47 -24
  283. package/src/nodes/display/Lut3DNode.js +57 -0
  284. package/src/nodes/display/MotionBlur.js +25 -0
  285. package/{examples/jsm → src}/nodes/display/NormalMapNode.js +14 -14
  286. package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
  287. package/src/nodes/display/PassNode.js +378 -0
  288. package/src/nodes/display/PixelationPassNode.js +213 -0
  289. package/{examples/jsm → src}/nodes/display/PosterizeNode.js +8 -7
  290. package/src/nodes/display/RGBShiftNode.js +53 -0
  291. package/src/nodes/display/RenderOutputNode.js +60 -0
  292. package/src/nodes/display/SSAAPassNode.js +287 -0
  293. package/src/nodes/display/ScreenNode.js +181 -0
  294. package/src/nodes/display/Sepia.js +17 -0
  295. package/src/nodes/display/SobelOperatorNode.js +126 -0
  296. package/src/nodes/display/StereoCompositePassNode.js +110 -0
  297. package/src/nodes/display/StereoPassNode.js +83 -0
  298. package/src/nodes/display/ToneMappingFunctions.js +190 -0
  299. package/src/nodes/display/ToneMappingNode.js +67 -0
  300. package/src/nodes/display/ToonOutlinePassNode.js +111 -0
  301. package/src/nodes/display/TransitionNode.js +80 -0
  302. package/src/nodes/display/ViewportDepthNode.js +125 -0
  303. package/src/nodes/display/ViewportDepthTextureNode.js +33 -0
  304. package/src/nodes/display/ViewportSharedTextureNode.js +39 -0
  305. package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +20 -14
  306. package/src/nodes/fog/FogExp2Node.js +35 -0
  307. package/src/nodes/fog/FogNode.js +50 -0
  308. package/src/nodes/fog/FogRangeNode.js +36 -0
  309. package/src/nodes/functions/BSDF/BRDF_GGX.js +59 -0
  310. package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  311. package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
  312. package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +2 -2
  313. package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +2 -2
  314. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
  315. package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  316. package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +2 -2
  317. package/src/nodes/functions/BSDF/LTC.js +131 -0
  318. package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
  319. package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -4
  320. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
  321. package/src/nodes/functions/BasicLightingModel.js +78 -0
  322. package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +11 -9
  323. package/src/nodes/functions/PhysicalLightingModel.js +633 -0
  324. package/src/nodes/functions/ShadowMaskModel.js +31 -0
  325. package/src/nodes/functions/ToonLightingModel.js +51 -0
  326. package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
  327. package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +2 -2
  328. package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
  329. package/{examples/jsm → src}/nodes/geometry/RangeNode.js +28 -11
  330. package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
  331. package/src/nodes/gpgpu/BarrierNode.js +40 -0
  332. package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
  333. package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +10 -6
  334. package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
  335. package/src/nodes/lighting/AONode.js +27 -0
  336. package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +6 -8
  337. package/src/nodes/lighting/AnalyticLightNode.js +522 -0
  338. package/src/nodes/lighting/BasicEnvironmentNode.js +30 -0
  339. package/src/nodes/lighting/BasicLightMapNode.js +32 -0
  340. package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +7 -9
  341. package/src/nodes/lighting/EnvironmentNode.js +138 -0
  342. package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +12 -11
  343. package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +7 -9
  344. package/src/nodes/lighting/IrradianceNode.js +27 -0
  345. package/src/nodes/lighting/LightProbeNode.js +53 -0
  346. package/{examples/jsm → src}/nodes/lighting/LightUtils.js +3 -3
  347. package/src/nodes/lighting/LightingContextNode.js +67 -0
  348. package/{examples/jsm → src}/nodes/lighting/LightingNode.js +9 -3
  349. package/src/nodes/lighting/LightsNode.js +250 -0
  350. package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +12 -13
  351. package/src/nodes/lighting/RectAreaLightNode.js +97 -0
  352. package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +14 -16
  353. package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +2 -2
  354. package/src/nodes/materialx/lib/mx_hsv.js +127 -0
  355. package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +500 -603
  356. package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +3 -9
  357. package/{examples/jsm/nodes/math/CondNode.js → src/nodes/math/ConditionalNode.js} +48 -13
  358. package/src/nodes/math/Hash.js +13 -0
  359. package/src/nodes/math/MathNode.js +407 -0
  360. package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -7
  361. package/src/nodes/math/OperatorNode.js +319 -0
  362. package/{examples/jsm → src}/nodes/math/TriNoise3D.js +19 -29
  363. package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
  364. package/src/nodes/pmrem/PMREMNode.js +240 -0
  365. package/src/nodes/pmrem/PMREMUtils.js +288 -0
  366. package/src/nodes/procedural/Checker.js +14 -0
  367. package/src/nodes/tsl/TSLBase.js +30 -0
  368. package/{examples/jsm/nodes/shadernode/ShaderNode.js → src/nodes/tsl/TSLCore.js} +122 -96
  369. package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +9 -5
  370. package/{examples/jsm → src}/nodes/utils/ConvertNode.js +7 -3
  371. package/src/nodes/utils/CubeMapNode.js +160 -0
  372. package/src/nodes/utils/Discard.js +8 -0
  373. package/src/nodes/utils/EquirectUVNode.js +36 -0
  374. package/src/nodes/utils/FlipNode.js +68 -0
  375. package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +11 -5
  376. package/{examples/jsm → src}/nodes/utils/JoinNode.js +6 -3
  377. package/{examples/jsm → src}/nodes/utils/LoopNode.js +23 -12
  378. package/src/nodes/utils/MatcapUVNode.js +33 -0
  379. package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +16 -7
  380. package/{examples/jsm → src}/nodes/utils/OscNode.js +12 -8
  381. package/src/nodes/utils/Packing.js +4 -0
  382. package/src/nodes/utils/RTTNode.js +133 -0
  383. package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +21 -5
  384. package/{examples/jsm → src}/nodes/utils/RemapNode.js +12 -8
  385. package/{examples/jsm → src}/nodes/utils/RotateNode.js +8 -13
  386. package/{examples/jsm → src}/nodes/utils/SetNode.js +7 -4
  387. package/{examples/jsm → src}/nodes/utils/SplitNode.js +7 -3
  388. package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +10 -6
  389. package/src/nodes/utils/SpriteUtils.js +47 -0
  390. package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +11 -12
  391. package/{examples/jsm → src}/nodes/utils/TimerNode.js +8 -5
  392. package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +11 -9
  393. package/src/nodes/utils/UVUtils.js +19 -0
  394. package/src/nodes/utils/ViewportUtils.js +14 -0
  395. package/src/objects/BatchedMesh.js +302 -144
  396. package/src/objects/InstancedMesh.js +11 -1
  397. package/src/objects/LOD.js +21 -0
  398. package/src/objects/Line.js +67 -43
  399. package/src/objects/Mesh.js +7 -23
  400. package/src/objects/Points.js +2 -0
  401. package/src/renderers/WebGLRenderer.js +473 -224
  402. package/{examples/jsm → src}/renderers/common/Animation.js +3 -0
  403. package/{examples/jsm → src}/renderers/common/Attributes.js +4 -1
  404. package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
  405. package/{examples/jsm → src}/renderers/common/Background.js +18 -10
  406. package/src/renderers/common/BindGroup.js +18 -0
  407. package/src/renderers/common/Bindings.js +203 -0
  408. package/src/renderers/common/BundleGroup.js +26 -0
  409. package/src/renderers/common/ChainMap.js +59 -0
  410. package/{examples/jsm → src}/renderers/common/ClippingContext.js +24 -12
  411. package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
  412. package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +16 -4
  413. package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
  414. package/{examples/jsm → src}/renderers/common/Info.js +35 -15
  415. package/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
  416. package/src/renderers/common/PostProcessing.js +90 -0
  417. package/src/renderers/common/QuadMesh.js +55 -0
  418. package/src/renderers/common/RenderBundle.js +18 -0
  419. package/src/renderers/common/RenderBundles.js +38 -0
  420. package/{examples/jsm → src}/renderers/common/RenderContext.js +25 -2
  421. package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
  422. package/{examples/jsm → src}/renderers/common/RenderList.js +11 -2
  423. package/src/renderers/common/RenderObject.js +413 -0
  424. package/{examples/jsm → src}/renderers/common/RenderObjects.js +9 -2
  425. package/{examples/jsm → src}/renderers/common/Renderer.js +431 -83
  426. package/{examples/jsm → src}/renderers/common/SampledTexture.js +14 -5
  427. package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
  428. package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
  429. package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
  430. package/{examples/jsm → src}/renderers/common/Textures.js +15 -15
  431. package/{examples/jsm → src}/renderers/common/Uniform.js +10 -5
  432. package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
  433. package/src/renderers/common/extras/PMREMGenerator.js +771 -0
  434. package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
  435. package/src/renderers/common/nodes/NodeLibrary.js +118 -0
  436. package/src/renderers/common/nodes/NodeSampledTexture.js +64 -0
  437. package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -1
  438. package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
  439. package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
  440. package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
  441. package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
  442. package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +106 -68
  443. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +31 -1
  444. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
  445. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
  446. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
  447. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
  448. package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
  449. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
  450. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
  451. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
  452. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
  453. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
  454. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  455. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
  456. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
  457. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
  458. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
  459. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
  460. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
  461. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
  462. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
  463. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +38 -25
  464. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
  465. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
  466. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +19 -11
  467. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  468. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
  469. package/src/renderers/shaders/ShaderChunk.js +0 -2
  470. package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
  471. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
  472. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
  473. package/src/renderers/shaders/ShaderLib.js +2 -1
  474. package/src/renderers/shaders/UniformsLib.js +3 -0
  475. package/src/renderers/shaders/UniformsUtils.js +10 -1
  476. package/src/renderers/webgl/WebGLAttributes.js +42 -38
  477. package/src/renderers/webgl/WebGLBackground.js +24 -3
  478. package/src/renderers/webgl/WebGLBindingStates.js +14 -51
  479. package/src/renderers/webgl/WebGLBufferRenderer.js +23 -22
  480. package/src/renderers/webgl/WebGLCapabilities.js +44 -13
  481. package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
  482. package/src/renderers/webgl/WebGLExtensions.js +7 -20
  483. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +23 -21
  484. package/src/renderers/webgl/WebGLLights.js +21 -44
  485. package/src/renderers/webgl/WebGLMaterials.js +9 -8
  486. package/src/renderers/webgl/WebGLMorphtargets.js +78 -217
  487. package/src/renderers/webgl/WebGLProgram.js +46 -78
  488. package/src/renderers/webgl/WebGLPrograms.js +37 -40
  489. package/src/renderers/webgl/WebGLProperties.js +7 -0
  490. package/src/renderers/webgl/WebGLRenderStates.js +15 -9
  491. package/src/renderers/webgl/WebGLShadowMap.js +25 -25
  492. package/src/renderers/webgl/WebGLState.js +35 -58
  493. package/src/renderers/webgl/WebGLTextures.js +313 -358
  494. package/src/renderers/webgl/WebGLUniforms.js +12 -2
  495. package/src/renderers/webgl/WebGLUniformsGroups.js +8 -8
  496. package/src/renderers/webgl/WebGLUtils.js +9 -78
  497. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +389 -152
  498. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +145 -0
  499. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +245 -44
  500. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +7 -1
  501. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +2 -0
  502. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
  503. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +21 -3
  504. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +271 -43
  505. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +6 -23
  506. package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +318 -141
  507. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
  508. package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +10 -7
  509. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
  510. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
  511. package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +424 -95
  512. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
  513. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +37 -18
  514. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +86 -32
  515. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +10 -1
  516. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +68 -27
  517. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
  518. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +235 -68
  519. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +43 -5
  520. package/src/renderers/webxr/WebXRDepthSensing.js +11 -6
  521. package/src/renderers/webxr/WebXRManager.js +53 -38
  522. package/src/scenes/Scene.js +7 -1
  523. package/src/textures/CompressedArrayTexture.js +14 -0
  524. package/src/textures/DataArrayTexture.js +14 -0
  525. package/src/textures/DepthTexture.js +1 -3
  526. package/src/textures/Texture.js +12 -2
  527. package/src/utils.js +62 -1
  528. package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
  529. package/examples/jsm/loaders/LogLuvLoader.js +0 -606
  530. package/examples/jsm/loaders/TiltLoader.js +0 -520
  531. package/examples/jsm/nodes/Nodes.js +0 -195
  532. package/examples/jsm/nodes/accessors/AccessorsUtils.js +0 -10
  533. package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
  534. package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
  535. package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -61
  536. package/examples/jsm/nodes/accessors/InstanceNode.js +0 -71
  537. package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +0 -21
  538. package/examples/jsm/nodes/accessors/MaterialNode.js +0 -314
  539. package/examples/jsm/nodes/accessors/ModelNode.js +0 -33
  540. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +0 -39
  541. package/examples/jsm/nodes/accessors/NormalNode.js +0 -96
  542. package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
  543. package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
  544. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
  545. package/examples/jsm/nodes/accessors/SkinningNode.js +0 -124
  546. package/examples/jsm/nodes/accessors/StorageBufferNode.js +0 -72
  547. package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
  548. package/examples/jsm/nodes/accessors/TextureSizeNode.js +0 -35
  549. package/examples/jsm/nodes/accessors/UVNode.js +0 -47
  550. package/examples/jsm/nodes/core/CacheNode.js +0 -49
  551. package/examples/jsm/nodes/core/IndexNode.js +0 -66
  552. package/examples/jsm/nodes/core/NodeCache.js +0 -26
  553. package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
  554. package/examples/jsm/nodes/core/PropertyNode.js +0 -72
  555. package/examples/jsm/nodes/core/UniformGroupNode.js +0 -36
  556. package/examples/jsm/nodes/core/VaryingNode.js +0 -65
  557. package/examples/jsm/nodes/display/BlendModeNode.js +0 -128
  558. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -99
  559. package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
  560. package/examples/jsm/nodes/display/FrontFacingNode.js +0 -27
  561. package/examples/jsm/nodes/display/PassNode.js +0 -183
  562. package/examples/jsm/nodes/display/ToneMappingNode.js +0 -184
  563. package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -97
  564. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -31
  565. package/examples/jsm/nodes/display/ViewportNode.js +0 -134
  566. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -31
  567. package/examples/jsm/nodes/fog/FogExp2Node.js +0 -35
  568. package/examples/jsm/nodes/fog/FogNode.js +0 -38
  569. package/examples/jsm/nodes/fog/FogRangeNode.js +0 -34
  570. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +0 -40
  571. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +0 -393
  572. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
  573. package/examples/jsm/nodes/lighting/AONode.js +0 -27
  574. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -241
  575. package/examples/jsm/nodes/lighting/EnvironmentNode.js +0 -181
  576. package/examples/jsm/nodes/lighting/LightNode.js +0 -57
  577. package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -66
  578. package/examples/jsm/nodes/lighting/LightsNode.js +0 -188
  579. package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
  580. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
  581. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
  582. package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
  583. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -40
  584. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
  585. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +0 -155
  586. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +0 -80
  587. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -90
  588. package/examples/jsm/nodes/materialx/lib/mx_hsv.js +0 -130
  589. package/examples/jsm/nodes/math/HashNode.js +0 -34
  590. package/examples/jsm/nodes/math/MathNode.js +0 -391
  591. package/examples/jsm/nodes/math/OperatorNode.js +0 -274
  592. package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
  593. package/examples/jsm/nodes/utils/DiscardNode.js +0 -27
  594. package/examples/jsm/nodes/utils/EquirectUVNode.js +0 -33
  595. package/examples/jsm/nodes/utils/MatcapUVNode.js +0 -30
  596. package/examples/jsm/nodes/utils/PackingNode.js +0 -55
  597. package/examples/jsm/nodes/utils/RotateUVNode.js +0 -35
  598. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
  599. package/examples/jsm/objects/QuadMesh.js +0 -66
  600. package/examples/jsm/renderers/common/Bindings.js +0 -173
  601. package/examples/jsm/renderers/common/ChainMap.js +0 -89
  602. package/examples/jsm/renderers/common/PostProcessing.js +0 -25
  603. package/examples/jsm/renderers/common/RenderObject.js +0 -221
  604. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
  605. package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +0 -49
  606. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
  607. package/examples/jsm/utils/GPUStatsPanel.js +0 -128
  608. package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
  609. package/src/renderers/WebGL1Renderer.js +0 -7
  610. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
  611. /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
  612. /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
  613. /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
  614. /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
  615. /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
  616. /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
  617. /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
  618. /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
  619. /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
  620. /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
  621. /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
  622. /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
  623. /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
  624. /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
  625. /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
  626. /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
  627. /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
  628. /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
  629. /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
  630. /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
  631. /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
  632. /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
  633. /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
  634. /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
  635. /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
@@ -0,0 +1,522 @@
1
+ import LightingNode from './LightingNode.js';
2
+ import { NodeUpdateType } from '../core/constants.js';
3
+ import { uniform } from '../core/UniformNode.js';
4
+ import { float, vec2, vec3, vec4, If, int, Fn } from '../tsl/TSLBase.js';
5
+ import { reference } from '../accessors/ReferenceNode.js';
6
+ import { texture } from '../accessors/TextureNode.js';
7
+ import { positionWorld } from '../accessors/Position.js';
8
+ import { normalWorld } from '../accessors/Normal.js';
9
+ import { mix, fract, step, max, clamp, sqrt } from '../math/MathNode.js';
10
+ import { add, sub } from '../math/OperatorNode.js';
11
+ import { Color } from '../../math/Color.js';
12
+ import { DepthTexture } from '../../textures/DepthTexture.js';
13
+ import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
14
+ import QuadMesh from '../../renderers/common/QuadMesh.js';
15
+ import { Loop } from '../utils/LoopNode.js';
16
+ import { screenCoordinate } from '../display/ScreenNode.js';
17
+ import { HalfFloatType, LessCompare, RGFormat, VSMShadowMap, WebGPUCoordinateSystem } from '../../constants.js';
18
+ import { renderGroup } from '../core/UniformGroupNode.js';
19
+ import { hash } from '../core/NodeUtils.js';
20
+
21
+ const BasicShadowMap = Fn( ( { depthTexture, shadowCoord } ) => {
22
+
23
+ return texture( depthTexture, shadowCoord.xy ).compare( shadowCoord.z );
24
+
25
+ } );
26
+
27
+ const PCFShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
28
+
29
+ const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
30
+
31
+ const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
32
+ const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
33
+
34
+ const texelSize = vec2( 1 ).div( mapSize );
35
+ const dx0 = texelSize.x.negate().mul( radius );
36
+ const dy0 = texelSize.y.negate().mul( radius );
37
+ const dx1 = texelSize.x.mul( radius );
38
+ const dy1 = texelSize.y.mul( radius );
39
+ const dx2 = dx0.div( 2 );
40
+ const dy2 = dy0.div( 2 );
41
+ const dx3 = dx1.div( 2 );
42
+ const dy3 = dy1.div( 2 );
43
+
44
+ return add(
45
+ depthCompare( shadowCoord.xy.add( vec2( dx0, dy0 ) ), shadowCoord.z ),
46
+ depthCompare( shadowCoord.xy.add( vec2( 0, dy0 ) ), shadowCoord.z ),
47
+ depthCompare( shadowCoord.xy.add( vec2( dx1, dy0 ) ), shadowCoord.z ),
48
+ depthCompare( shadowCoord.xy.add( vec2( dx2, dy2 ) ), shadowCoord.z ),
49
+ depthCompare( shadowCoord.xy.add( vec2( 0, dy2 ) ), shadowCoord.z ),
50
+ depthCompare( shadowCoord.xy.add( vec2( dx3, dy2 ) ), shadowCoord.z ),
51
+ depthCompare( shadowCoord.xy.add( vec2( dx0, 0 ) ), shadowCoord.z ),
52
+ depthCompare( shadowCoord.xy.add( vec2( dx2, 0 ) ), shadowCoord.z ),
53
+ depthCompare( shadowCoord.xy, shadowCoord.z ),
54
+ depthCompare( shadowCoord.xy.add( vec2( dx3, 0 ) ), shadowCoord.z ),
55
+ depthCompare( shadowCoord.xy.add( vec2( dx1, 0 ) ), shadowCoord.z ),
56
+ depthCompare( shadowCoord.xy.add( vec2( dx2, dy3 ) ), shadowCoord.z ),
57
+ depthCompare( shadowCoord.xy.add( vec2( 0, dy3 ) ), shadowCoord.z ),
58
+ depthCompare( shadowCoord.xy.add( vec2( dx3, dy3 ) ), shadowCoord.z ),
59
+ depthCompare( shadowCoord.xy.add( vec2( dx0, dy1 ) ), shadowCoord.z ),
60
+ depthCompare( shadowCoord.xy.add( vec2( 0, dy1 ) ), shadowCoord.z ),
61
+ depthCompare( shadowCoord.xy.add( vec2( dx1, dy1 ) ), shadowCoord.z )
62
+ ).mul( 1 / 17 );
63
+
64
+ } );
65
+
66
+ const PCFSoftShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
67
+
68
+ const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
69
+
70
+ const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
71
+
72
+ const texelSize = vec2( 1 ).div( mapSize );
73
+ const dx = texelSize.x;
74
+ const dy = texelSize.y;
75
+
76
+ const uv = shadowCoord.xy;
77
+ const f = fract( uv.mul( mapSize ).add( 0.5 ) );
78
+ uv.subAssign( f.mul( texelSize ) );
79
+
80
+ return add(
81
+ depthCompare( uv, shadowCoord.z ),
82
+ depthCompare( uv.add( vec2( dx, 0 ) ), shadowCoord.z ),
83
+ depthCompare( uv.add( vec2( 0, dy ) ), shadowCoord.z ),
84
+ depthCompare( uv.add( texelSize ), shadowCoord.z ),
85
+ mix(
86
+ depthCompare( uv.add( vec2( dx.negate(), 0 ) ), shadowCoord.z ),
87
+ depthCompare( uv.add( vec2( dx.mul( 2 ), 0 ) ), shadowCoord.z ),
88
+ f.x
89
+ ),
90
+ mix(
91
+ depthCompare( uv.add( vec2( dx.negate(), dy ) ), shadowCoord.z ),
92
+ depthCompare( uv.add( vec2( dx.mul( 2 ), dy ) ), shadowCoord.z ),
93
+ f.x
94
+ ),
95
+ mix(
96
+ depthCompare( uv.add( vec2( 0, dy.negate() ) ), shadowCoord.z ),
97
+ depthCompare( uv.add( vec2( 0, dy.mul( 2 ) ) ), shadowCoord.z ),
98
+ f.y
99
+ ),
100
+ mix(
101
+ depthCompare( uv.add( vec2( dx, dy.negate() ) ), shadowCoord.z ),
102
+ depthCompare( uv.add( vec2( dx, dy.mul( 2 ) ) ), shadowCoord.z ),
103
+ f.y
104
+ ),
105
+ mix(
106
+ mix(
107
+ depthCompare( uv.add( vec2( dx.negate(), dy.negate() ) ), shadowCoord.z ),
108
+ depthCompare( uv.add( vec2( dx.mul( 2 ), dy.negate() ) ), shadowCoord.z ),
109
+ f.x
110
+ ),
111
+ mix(
112
+ depthCompare( uv.add( vec2( dx.negate(), dy.mul( 2 ) ) ), shadowCoord.z ),
113
+ depthCompare( uv.add( vec2( dx.mul( 2 ), dy.mul( 2 ) ) ), shadowCoord.z ),
114
+ f.x
115
+ ),
116
+ f.y
117
+ )
118
+ ).mul( 1 / 9 );
119
+
120
+ } );
121
+
122
+ // VSM
123
+
124
+ const VSMShadowMapNode = Fn( ( { depthTexture, shadowCoord } ) => {
125
+
126
+ const occlusion = float( 1 ).toVar();
127
+
128
+ const distribution = texture( depthTexture ).uv( shadowCoord.xy ).rg;
129
+
130
+ const hardShadow = step( shadowCoord.z, distribution.x );
131
+
132
+ If( hardShadow.notEqual( float( 1.0 ) ), () => {
133
+
134
+ const distance = shadowCoord.z.sub( distribution.x );
135
+ const variance = max( 0, distribution.y.mul( distribution.y ) );
136
+ let softnessProbability = variance.div( variance.add( distance.mul( distance ) ) ); // Chebeyshevs inequality
137
+ softnessProbability = clamp( sub( softnessProbability, 0.3 ).div( 0.95 - 0.3 ) );
138
+ occlusion.assign( clamp( max( hardShadow, softnessProbability ) ) );
139
+
140
+ } );
141
+
142
+ return occlusion;
143
+
144
+ } );
145
+
146
+ const VSMPassVertical = Fn( ( { samples, radius, size, shadowPass } ) => {
147
+
148
+ const mean = float( 0 ).toVar();
149
+ const squaredMean = float( 0 ).toVar();
150
+
151
+ const uvStride = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( 2 ).div( samples.sub( 1 ) ) );
152
+ const uvStart = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( - 1 ) );
153
+
154
+ Loop( { start: int( 0 ), end: int( samples ), type: 'int', condition: '<' }, ( { i } ) => {
155
+
156
+ const uvOffset = uvStart.add( float( i ).mul( uvStride ) );
157
+
158
+ const depth = shadowPass.uv( add( screenCoordinate.xy, vec2( 0, uvOffset ).mul( radius ) ).div( size ) ).x;
159
+ mean.addAssign( depth );
160
+ squaredMean.addAssign( depth.mul( depth ) );
161
+
162
+ } );
163
+
164
+ mean.divAssign( samples );
165
+ squaredMean.divAssign( samples );
166
+
167
+ const std_dev = sqrt( squaredMean.sub( mean.mul( mean ) ) );
168
+ return vec2( mean, std_dev );
169
+
170
+ } );
171
+
172
+ const VSMPassHorizontal = Fn( ( { samples, radius, size, shadowPass } ) => {
173
+
174
+ const mean = float( 0 ).toVar();
175
+ const squaredMean = float( 0 ).toVar();
176
+
177
+ const uvStride = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( 2 ).div( samples.sub( 1 ) ) );
178
+ const uvStart = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( - 1 ) );
179
+
180
+ Loop( { start: int( 0 ), end: int( samples ), type: 'int', condition: '<' }, ( { i } ) => {
181
+
182
+ const uvOffset = uvStart.add( float( i ).mul( uvStride ) );
183
+
184
+ const distribution = shadowPass.uv( add( screenCoordinate.xy, vec2( uvOffset, 0 ).mul( radius ) ).div( size ) );
185
+ mean.addAssign( distribution.x );
186
+ squaredMean.addAssign( add( distribution.y.mul( distribution.y ), distribution.x.mul( distribution.x ) ) );
187
+
188
+ } );
189
+
190
+ mean.divAssign( samples );
191
+ squaredMean.divAssign( samples );
192
+
193
+ const std_dev = sqrt( squaredMean.sub( mean.mul( mean ) ) );
194
+ return vec2( mean, std_dev );
195
+
196
+ } );
197
+
198
+ const _shadowFilterLib = [ BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, VSMShadowMapNode ];
199
+
200
+ //
201
+
202
+ let _overrideMaterial = null;
203
+ const _quadMesh = /*@__PURE__*/ new QuadMesh();
204
+
205
+ class AnalyticLightNode extends LightingNode {
206
+
207
+ static get type() {
208
+
209
+ return 'AnalyticLightNode';
210
+
211
+ }
212
+
213
+ constructor( light = null ) {
214
+
215
+ super();
216
+
217
+ this.updateType = NodeUpdateType.FRAME;
218
+
219
+ this.light = light;
220
+
221
+ this.color = new Color();
222
+ this.colorNode = uniform( this.color ).setGroup( renderGroup );
223
+
224
+ this.baseColorNode = null;
225
+
226
+ this.shadowMap = null;
227
+ this.shadowNode = null;
228
+ this.shadowColorNode = null;
229
+
230
+ this.vsmShadowMapVertical = null;
231
+ this.vsmShadowMapHorizontal = null;
232
+
233
+ this.vsmMaterialVertical = null;
234
+ this.vsmMaterialHorizontal = null;
235
+
236
+ this.isAnalyticLightNode = true;
237
+
238
+ }
239
+
240
+ getCacheKey() {
241
+
242
+ return hash( super.getCacheKey(), this.light.id, this.light.castShadow ? 1 : 0 );
243
+
244
+ }
245
+
246
+ getHash() {
247
+
248
+ return this.light.uuid;
249
+
250
+ }
251
+
252
+ setupShadow( builder ) {
253
+
254
+ const { object, renderer } = builder;
255
+
256
+ if ( renderer.shadowMap.enabled === false ) return;
257
+
258
+ let shadowColorNode = this.shadowColorNode;
259
+
260
+ if ( shadowColorNode === null ) {
261
+
262
+ if ( _overrideMaterial === null ) {
263
+
264
+ _overrideMaterial = new NodeMaterial();
265
+ _overrideMaterial.fragmentNode = vec4( 0, 0, 0, 1 );
266
+ _overrideMaterial.isShadowNodeMaterial = true; // Use to avoid other overrideMaterial override material.fragmentNode unintentionally when using material.shadowNode
267
+ _overrideMaterial.name = 'ShadowMaterial';
268
+
269
+ }
270
+
271
+ const shadowMapType = renderer.shadowMap.type;
272
+ const shadow = this.light.shadow;
273
+
274
+ const depthTexture = new DepthTexture();
275
+ depthTexture.compareFunction = LessCompare;
276
+
277
+ const shadowMap = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height );
278
+ shadowMap.depthTexture = depthTexture;
279
+
280
+ shadow.camera.updateProjectionMatrix();
281
+
282
+ // VSM
283
+
284
+ if ( shadowMapType === VSMShadowMap ) {
285
+
286
+ depthTexture.compareFunction = null; // VSM does not use textureSampleCompare()/texture2DCompare()
287
+
288
+ this.vsmShadowMapVertical = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType } );
289
+ this.vsmShadowMapHorizontal = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType } );
290
+
291
+ const shadowPassVertical = texture( depthTexture );
292
+ const shadowPassHorizontal = texture( this.vsmShadowMapVertical.texture );
293
+
294
+ const samples = reference( 'blurSamples', 'float', shadow ).setGroup( renderGroup );
295
+ const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
296
+ const size = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
297
+
298
+ let material = this.vsmMaterialVertical || ( this.vsmMaterialVertical = new NodeMaterial() );
299
+ material.fragmentNode = VSMPassVertical( { samples, radius, size, shadowPass: shadowPassVertical } ).context( builder.getSharedContext() );
300
+ material.name = 'VSMVertical';
301
+
302
+ material = this.vsmMaterialHorizontal || ( this.vsmMaterialHorizontal = new NodeMaterial() );
303
+ material.fragmentNode = VSMPassHorizontal( { samples, radius, size, shadowPass: shadowPassHorizontal } ).context( builder.getSharedContext() );
304
+ material.name = 'VSMHorizontal';
305
+
306
+ }
307
+
308
+ //
309
+
310
+ const shadowIntensity = reference( 'intensity', 'float', shadow ).setGroup( renderGroup );
311
+ const bias = reference( 'bias', 'float', shadow ).setGroup( renderGroup );
312
+ const normalBias = reference( 'normalBias', 'float', shadow ).setGroup( renderGroup );
313
+
314
+ const position = object.material.shadowPositionNode || positionWorld;
315
+
316
+ let shadowCoord = uniform( shadow.matrix ).setGroup( renderGroup ).mul( position.add( normalWorld.mul( normalBias ) ) );
317
+ shadowCoord = shadowCoord.xyz.div( shadowCoord.w );
318
+
319
+ let coordZ = shadowCoord.z.add( bias );
320
+
321
+ if ( renderer.coordinateSystem === WebGPUCoordinateSystem ) {
322
+
323
+ coordZ = coordZ.mul( 2 ).sub( 1 ); // WebGPU: Convertion [ 0, 1 ] to [ - 1, 1 ]
324
+
325
+ }
326
+
327
+ shadowCoord = vec3(
328
+ shadowCoord.x,
329
+ shadowCoord.y.oneMinus(), // follow webgpu standards
330
+ coordZ
331
+ );
332
+
333
+ const frustumTest = shadowCoord.x.greaterThanEqual( 0 )
334
+ .and( shadowCoord.x.lessThanEqual( 1 ) )
335
+ .and( shadowCoord.y.greaterThanEqual( 0 ) )
336
+ .and( shadowCoord.y.lessThanEqual( 1 ) )
337
+ .and( shadowCoord.z.lessThanEqual( 1 ) );
338
+
339
+ //
340
+
341
+ const filterFn = shadow.filterNode || _shadowFilterLib[ renderer.shadowMap.type ] || null;
342
+
343
+ if ( filterFn === null ) {
344
+
345
+ throw new Error( 'THREE.WebGPURenderer: Shadow map type not supported yet.' );
346
+
347
+ }
348
+
349
+ const shadowColor = texture( shadowMap.texture, shadowCoord );
350
+ const shadowNode = frustumTest.select( filterFn( { depthTexture: ( shadowMapType === VSMShadowMap ) ? this.vsmShadowMapHorizontal.texture : depthTexture, shadowCoord, shadow } ), float( 1 ) );
351
+
352
+ this.shadowMap = shadowMap;
353
+ this.light.shadow.map = shadowMap;
354
+
355
+ this.shadowNode = shadowNode;
356
+ this.shadowColorNode = shadowColorNode = this.colorNode.mul( mix( 1, shadowNode.rgb.mix( shadowColor, 1 ), shadowIntensity.mul( shadowColor.a ) ) );
357
+
358
+ this.baseColorNode = this.colorNode;
359
+
360
+ }
361
+
362
+ //
363
+
364
+ this.colorNode = shadowColorNode;
365
+
366
+ this.updateBeforeType = NodeUpdateType.RENDER;
367
+
368
+ }
369
+
370
+ setup( builder ) {
371
+
372
+ this.colorNode = this.baseColorNode || this.colorNode;
373
+
374
+ if ( this.light.castShadow ) {
375
+
376
+ if ( builder.object.receiveShadow ) {
377
+
378
+ this.setupShadow( builder );
379
+
380
+ }
381
+
382
+ } else if ( this.shadowNode !== null ) {
383
+
384
+ this.disposeShadow();
385
+
386
+ }
387
+
388
+ }
389
+
390
+ updateShadow( frame ) {
391
+
392
+ const { shadowMap, light } = this;
393
+ const { renderer, scene, camera } = frame;
394
+
395
+ const shadowType = renderer.shadowMap.type;
396
+
397
+ const depthVersion = shadowMap.depthTexture.version;
398
+ this._depthVersionCached = depthVersion;
399
+
400
+ const currentOverrideMaterial = scene.overrideMaterial;
401
+
402
+ scene.overrideMaterial = _overrideMaterial;
403
+
404
+ shadowMap.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );
405
+
406
+ light.shadow.updateMatrices( light );
407
+ light.shadow.camera.layers.mask = camera.layers.mask;
408
+
409
+ const currentRenderTarget = renderer.getRenderTarget();
410
+ const currentRenderObjectFunction = renderer.getRenderObjectFunction();
411
+
412
+ renderer.setRenderObjectFunction( ( object, ...params ) => {
413
+
414
+ if ( object.castShadow === true || ( object.receiveShadow && shadowType === VSMShadowMap ) ) {
415
+
416
+ renderer.renderObject( object, ...params );
417
+
418
+ }
419
+
420
+ } );
421
+
422
+ renderer.setRenderTarget( shadowMap );
423
+ renderer.render( scene, light.shadow.camera );
424
+
425
+ renderer.setRenderObjectFunction( currentRenderObjectFunction );
426
+
427
+ // vsm blur pass
428
+
429
+ if ( light.isPointLight !== true && shadowType === VSMShadowMap ) {
430
+
431
+ this.vsmPass( frame, light );
432
+
433
+ }
434
+
435
+ renderer.setRenderTarget( currentRenderTarget );
436
+
437
+ scene.overrideMaterial = currentOverrideMaterial;
438
+
439
+ }
440
+
441
+ vsmPass( frame, light ) {
442
+
443
+ const { renderer } = frame;
444
+
445
+ this.vsmShadowMapVertical.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );
446
+ this.vsmShadowMapHorizontal.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );
447
+
448
+ renderer.setRenderTarget( this.vsmShadowMapVertical );
449
+ _quadMesh.material = this.vsmMaterialVertical;
450
+ _quadMesh.render( renderer );
451
+
452
+ renderer.setRenderTarget( this.vsmShadowMapHorizontal );
453
+ _quadMesh.material = this.vsmMaterialHorizontal;
454
+ _quadMesh.render( renderer );
455
+
456
+ }
457
+
458
+ disposeShadow() {
459
+
460
+ this.shadowMap.dispose();
461
+ this.shadowMap = null;
462
+
463
+ if ( this.vsmShadowMapVertical !== null ) {
464
+
465
+ this.vsmShadowMapVertical.dispose();
466
+ this.vsmShadowMapVertical = null;
467
+
468
+ this.vsmMaterialVertical.dispose();
469
+ this.vsmMaterialVertical = null;
470
+
471
+ }
472
+
473
+ if ( this.vsmShadowMapHorizontal !== null ) {
474
+
475
+ this.vsmShadowMapHorizontal.dispose();
476
+ this.vsmShadowMapHorizontal = null;
477
+
478
+ this.vsmMaterialHorizontal.dispose();
479
+ this.vsmMaterialHorizontal = null;
480
+
481
+ }
482
+
483
+ this.shadowNode = null;
484
+ this.shadowColorNode = null;
485
+
486
+ this.baseColorNode = null;
487
+
488
+ this.updateBeforeType = NodeUpdateType.NONE;
489
+
490
+ }
491
+
492
+ updateBefore( frame ) {
493
+
494
+ const shadow = this.light.shadow;
495
+
496
+ const needsUpdate = shadow.needsUpdate || shadow.autoUpdate;
497
+
498
+ if ( needsUpdate ) {
499
+
500
+ this.updateShadow( frame );
501
+
502
+ if ( this.shadowMap.depthTexture.version === this._depthVersionCached ) {
503
+
504
+ shadow.needsUpdate = false;
505
+
506
+ }
507
+
508
+ }
509
+
510
+ }
511
+
512
+ update( /*frame*/ ) {
513
+
514
+ const { light } = this;
515
+
516
+ this.color.copy( light.color ).multiplyScalar( light.intensity );
517
+
518
+ }
519
+
520
+ }
521
+
522
+ export default AnalyticLightNode;
@@ -0,0 +1,30 @@
1
+ import LightingNode from './LightingNode.js';
2
+ import { cubeMapNode } from '../utils/CubeMapNode.js';
3
+
4
+ class BasicEnvironmentNode extends LightingNode {
5
+
6
+ static get type() {
7
+
8
+ return 'BasicEnvironmentNode';
9
+
10
+ }
11
+
12
+ constructor( envNode = null ) {
13
+
14
+ super();
15
+
16
+ this.envNode = envNode;
17
+
18
+ }
19
+
20
+ setup( builder ) {
21
+
22
+ // environment property is used in the finish() method of BasicLightingModel
23
+
24
+ builder.context.environment = cubeMapNode( this.envNode );
25
+
26
+ }
27
+
28
+ }
29
+
30
+ export default BasicEnvironmentNode;
@@ -0,0 +1,32 @@
1
+ import LightingNode from './LightingNode.js';
2
+ import { float } from '../tsl/TSLBase.js';
3
+
4
+ class BasicLightMapNode extends LightingNode {
5
+
6
+ static get type() {
7
+
8
+ return 'BasicLightMapNode';
9
+
10
+ }
11
+
12
+ constructor( lightMapNode = null ) {
13
+
14
+ super();
15
+
16
+ this.lightMapNode = lightMapNode;
17
+
18
+ }
19
+
20
+ setup( builder ) {
21
+
22
+ // irradianceLightMap property is used in the indirectDiffuse() method of BasicLightingModel
23
+
24
+ const RECIPROCAL_PI = float( 1 / Math.PI );
25
+
26
+ builder.context.irradianceLightMap = this.lightMapNode.mul( RECIPROCAL_PI );
27
+
28
+ }
29
+
30
+ }
31
+
32
+ export default BasicLightMapNode;
@@ -1,12 +1,14 @@
1
1
  import AnalyticLightNode from './AnalyticLightNode.js';
2
- import { lightTargetDirection } from './LightNode.js';
3
- import { addLightNode } from './LightsNode.js';
4
- import { addNodeClass } from '../core/Node.js';
5
-
6
- import { DirectionalLight } from 'three';
2
+ import { lightTargetDirection } from '../accessors/Lights.js';
7
3
 
8
4
  class DirectionalLightNode extends AnalyticLightNode {
9
5
 
6
+ static get type() {
7
+
8
+ return 'DirectionalLightNode';
9
+
10
+ }
11
+
10
12
  constructor( light = null ) {
11
13
 
12
14
  super( light );
@@ -34,7 +36,3 @@ class DirectionalLightNode extends AnalyticLightNode {
34
36
  }
35
37
 
36
38
  export default DirectionalLightNode;
37
-
38
- addNodeClass( 'DirectionalLightNode', DirectionalLightNode );
39
-
40
- addLightNode( DirectionalLight, DirectionalLightNode );