super-three 0.167.0 → 0.169.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 (387) hide show
  1. package/build/three.cjs +532 -173
  2. package/build/three.module.js +532 -174
  3. package/build/three.module.min.js +1 -1
  4. package/build/three.webgpu.js +18173 -14266
  5. package/build/three.webgpu.min.js +1 -1
  6. package/build/three.webgpu.nodes.js +79941 -0
  7. package/build/three.webgpu.nodes.min.js +6 -0
  8. package/examples/jsm/Addons.js +0 -4
  9. package/examples/jsm/animation/AnimationClipCreator.js +1 -1
  10. package/examples/jsm/capabilities/WebGL.js +27 -21
  11. package/examples/jsm/controls/ArcballControls.js +174 -158
  12. package/examples/jsm/controls/DragControls.js +260 -132
  13. package/examples/jsm/controls/FirstPersonControls.js +175 -163
  14. package/examples/jsm/controls/FlyControls.js +194 -188
  15. package/examples/jsm/controls/OrbitControls.js +777 -786
  16. package/examples/jsm/controls/PointerLockControls.js +24 -15
  17. package/examples/jsm/controls/TrackballControls.js +469 -448
  18. package/examples/jsm/controls/TransformControls.js +97 -62
  19. package/examples/jsm/effects/AnaglyphEffect.js +6 -13
  20. package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
  21. package/examples/jsm/effects/StereoEffect.js +6 -1
  22. package/examples/jsm/environments/RoomEnvironment.js +1 -1
  23. package/examples/jsm/exporters/DRACOExporter.js +4 -2
  24. package/examples/jsm/exporters/EXRExporter.js +19 -11
  25. package/examples/jsm/exporters/GLTFExporter.js +6 -1
  26. package/examples/jsm/exporters/KTX2Exporter.js +21 -13
  27. package/examples/jsm/exporters/OBJExporter.js +5 -1
  28. package/examples/jsm/exporters/PLYExporter.js +9 -7
  29. package/examples/jsm/exporters/USDZExporter.js +29 -8
  30. package/examples/jsm/geometries/DecalGeometry.js +4 -1
  31. package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
  32. package/examples/jsm/helpers/LightProbeHelper.js +43 -44
  33. package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
  34. package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
  35. package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  36. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  37. package/examples/jsm/lights/LightProbeGenerator.js +24 -10
  38. package/examples/jsm/loaders/ColladaLoader.js +9 -6
  39. package/examples/jsm/loaders/DRACOLoader.js +3 -1
  40. package/examples/jsm/loaders/FBXLoader.js +30 -20
  41. package/examples/jsm/loaders/GLTFLoader.js +5 -10
  42. package/examples/jsm/loaders/KTX2Loader.js +27 -12
  43. package/examples/jsm/loaders/MTLLoader.js +4 -3
  44. package/examples/jsm/loaders/MaterialXLoader.js +40 -14
  45. package/examples/jsm/loaders/OBJLoader.js +5 -3
  46. package/examples/jsm/loaders/PCDLoader.js +14 -13
  47. package/examples/jsm/loaders/PDBLoader.js +3 -2
  48. package/examples/jsm/loaders/PLYLoader.js +8 -5
  49. package/examples/jsm/loaders/STLLoader.js +3 -2
  50. package/examples/jsm/loaders/VRMLLoader.js +10 -10
  51. package/examples/jsm/loaders/VTKLoader.js +4 -3
  52. package/examples/jsm/loaders/XYZLoader.js +3 -2
  53. package/examples/jsm/misc/Timer.js +1 -1
  54. package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
  55. package/examples/jsm/objects/LensflareMesh.js +322 -0
  56. package/examples/jsm/objects/SkyMesh.js +187 -0
  57. package/examples/jsm/objects/Water2Mesh.js +158 -0
  58. package/examples/jsm/objects/WaterMesh.js +101 -0
  59. package/examples/jsm/physics/JoltPhysics.js +1 -1
  60. package/examples/jsm/physics/RapierPhysics.js +21 -1
  61. package/examples/jsm/postprocessing/OutlinePass.js +31 -46
  62. package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
  63. package/examples/jsm/shaders/BleachBypassShader.js +1 -2
  64. package/examples/jsm/shaders/OutputShader.js +1 -1
  65. package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
  66. package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
  67. package/examples/jsm/transpiler/TSLEncoder.js +8 -8
  68. package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
  69. package/examples/jsm/utils/ShadowMapViewer.js +3 -8
  70. package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
  71. package/examples/jsm/utils/SkeletonUtils.js +84 -66
  72. package/examples/jsm/utils/TextureUtils.js +2 -1
  73. package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
  74. package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
  75. package/package.json +3 -2
  76. package/src/Three.WebGPU.Nodes.js +200 -0
  77. package/src/Three.WebGPU.js +7 -0
  78. package/src/Three.js +1 -0
  79. package/src/audio/Audio.js +2 -2
  80. package/src/constants.js +1 -1
  81. package/src/core/BufferAttribute.js +0 -9
  82. package/src/core/Clock.js +1 -1
  83. package/src/core/InterleavedBuffer.js +0 -9
  84. package/src/extras/Controls.js +32 -0
  85. package/src/geometries/CylinderGeometry.js +11 -4
  86. package/src/loaders/MaterialLoader.js +7 -1
  87. package/src/loaders/ObjectLoader.js +3 -3
  88. package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +25 -5
  89. package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +21 -18
  90. package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +19 -0
  91. package/src/materials/Material.js +4 -7
  92. package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
  93. package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +56 -59
  94. package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +8 -5
  95. package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +12 -10
  96. package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +16 -12
  97. package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +10 -6
  98. package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +13 -9
  99. package/src/{nodes/materials → materials/nodes}/MeshNormalNodeMaterial.js +13 -9
  100. package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +14 -9
  101. package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +22 -18
  102. package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +10 -7
  103. package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +22 -12
  104. package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +9 -5
  105. package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +71 -115
  106. package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +3 -1
  107. package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +8 -5
  108. package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +9 -5
  109. package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +47 -14
  110. package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +24 -22
  111. package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
  112. package/src/math/Triangle.js +24 -0
  113. package/src/nodes/Nodes.js +103 -159
  114. package/src/nodes/TSL.js +179 -0
  115. package/src/nodes/accessors/AccessorsUtils.js +8 -8
  116. package/src/nodes/accessors/BatchNode.js +53 -21
  117. package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
  118. package/src/nodes/accessors/BufferAttributeNode.js +8 -5
  119. package/src/nodes/accessors/BufferNode.js +7 -4
  120. package/src/nodes/accessors/Camera.js +13 -0
  121. package/src/nodes/accessors/ClippingNode.js +19 -13
  122. package/src/nodes/accessors/CubeTextureNode.js +9 -8
  123. package/src/nodes/accessors/InstanceNode.js +19 -15
  124. package/src/nodes/accessors/InstancedPointsMaterialNode.js +8 -5
  125. package/src/nodes/accessors/Lights.js +51 -0
  126. package/src/nodes/accessors/MaterialNode.js +56 -55
  127. package/src/nodes/accessors/MaterialProperties.js +3 -0
  128. package/src/nodes/accessors/MaterialReferenceNode.js +9 -4
  129. package/src/nodes/accessors/ModelNode.js +47 -12
  130. package/src/nodes/accessors/ModelViewProjectionNode.js +12 -9
  131. package/src/nodes/accessors/MorphNode.js +17 -13
  132. package/src/nodes/accessors/Normal.js +88 -0
  133. package/src/nodes/accessors/Object3DNode.js +17 -33
  134. package/src/nodes/accessors/PointUVNode.js +9 -5
  135. package/src/nodes/accessors/Position.js +10 -0
  136. package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
  137. package/src/nodes/accessors/ReferenceNode.js +50 -7
  138. package/src/nodes/accessors/ReflectVector.js +10 -0
  139. package/src/nodes/accessors/RendererReferenceNode.js +12 -6
  140. package/src/nodes/accessors/SceneNode.js +9 -6
  141. package/src/nodes/accessors/SkinningNode.js +88 -21
  142. package/src/nodes/accessors/StorageBufferNode.js +22 -5
  143. package/src/nodes/accessors/StorageTextureNode.js +9 -6
  144. package/src/nodes/accessors/Tangent.js +22 -0
  145. package/src/nodes/accessors/Texture3DNode.js +16 -13
  146. package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
  147. package/src/nodes/accessors/TextureNode.js +29 -23
  148. package/src/nodes/accessors/TextureSizeNode.js +10 -9
  149. package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +26 -14
  150. package/src/nodes/accessors/UserDataNode.js +10 -7
  151. package/src/nodes/accessors/VelocityNode.js +134 -0
  152. package/src/nodes/accessors/VertexColorNode.js +7 -4
  153. package/src/nodes/code/CodeNode.js +9 -5
  154. package/src/nodes/code/ExpressionNode.js +10 -6
  155. package/src/nodes/code/FunctionCallNode.js +8 -5
  156. package/src/nodes/code/FunctionNode.js +8 -23
  157. package/src/nodes/code/ScriptableNode.js +13 -10
  158. package/src/nodes/code/ScriptableValueNode.js +9 -7
  159. package/src/nodes/core/AssignNode.js +12 -9
  160. package/src/nodes/core/AttributeNode.js +12 -21
  161. package/src/nodes/core/BypassNode.js +11 -7
  162. package/src/nodes/core/CacheNode.js +10 -6
  163. package/src/nodes/core/ConstNode.js +6 -3
  164. package/src/nodes/core/ContextNode.js +21 -11
  165. package/src/nodes/core/IndexNode.js +35 -8
  166. package/src/nodes/core/InputNode.js +7 -3
  167. package/src/nodes/core/MRTNode.js +16 -7
  168. package/src/nodes/core/Node.js +19 -40
  169. package/src/nodes/core/NodeBuilder.js +117 -38
  170. package/src/nodes/core/NodeUtils.js +49 -6
  171. package/src/nodes/core/OutputStructNode.js +10 -6
  172. package/src/nodes/core/ParameterNode.js +7 -4
  173. package/src/nodes/core/PropertyNode.js +36 -32
  174. package/src/nodes/core/StackNode.js +31 -11
  175. package/src/nodes/core/StructTypeNode.js +7 -3
  176. package/src/nodes/core/TempNode.js +8 -4
  177. package/src/nodes/core/UniformGroupNode.js +14 -11
  178. package/src/nodes/core/UniformNode.js +7 -4
  179. package/src/nodes/core/VarNode.js +12 -8
  180. package/src/nodes/core/VaryingNode.js +10 -6
  181. package/src/nodes/display/AfterImageNode.js +15 -9
  182. package/src/nodes/display/AnaglyphPassNode.js +67 -0
  183. package/src/nodes/display/AnamorphicNode.js +17 -11
  184. package/src/nodes/display/BleachBypass.js +26 -0
  185. package/src/nodes/display/BlendMode.js +54 -0
  186. package/src/nodes/display/BloomNode.js +27 -19
  187. package/src/nodes/display/BumpMapNode.js +13 -12
  188. package/src/nodes/display/ColorAdjustment.js +46 -0
  189. package/src/nodes/display/ColorSpaceFunctions.js +38 -0
  190. package/src/nodes/display/ColorSpaceNode.js +67 -61
  191. package/src/nodes/display/DenoiseNode.js +23 -17
  192. package/src/nodes/display/DepthOfFieldNode.js +12 -7
  193. package/src/nodes/display/DotScreenNode.js +13 -22
  194. package/src/nodes/display/FXAANode.js +21 -16
  195. package/src/nodes/display/FilmNode.js +11 -7
  196. package/src/nodes/display/FrontFacingNode.js +10 -6
  197. package/src/nodes/display/GTAONode.js +22 -15
  198. package/src/nodes/display/GaussianBlurNode.js +14 -8
  199. package/src/nodes/display/Lut3DNode.js +10 -6
  200. package/src/nodes/display/MotionBlur.js +25 -0
  201. package/src/nodes/display/NormalMapNode.js +13 -13
  202. package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
  203. package/src/nodes/display/PassNode.js +95 -8
  204. package/src/nodes/display/PixelationPassNode.js +20 -8
  205. package/src/nodes/display/PosterizeNode.js +8 -7
  206. package/src/nodes/display/RGBShiftNode.js +11 -7
  207. package/src/nodes/display/RenderOutputNode.js +15 -11
  208. package/src/nodes/display/SSAAPassNode.js +287 -0
  209. package/src/nodes/display/ScreenNode.js +181 -0
  210. package/src/nodes/display/Sepia.js +17 -0
  211. package/src/nodes/display/SobelOperatorNode.js +13 -8
  212. package/src/nodes/display/StereoCompositePassNode.js +110 -0
  213. package/src/nodes/display/StereoPassNode.js +83 -0
  214. package/src/nodes/display/ToneMappingFunctions.js +190 -0
  215. package/src/nodes/display/ToneMappingNode.js +15 -175
  216. package/src/nodes/display/ToonOutlinePassNode.js +111 -0
  217. package/src/nodes/display/TransitionNode.js +12 -8
  218. package/src/nodes/display/ViewportDepthNode.js +34 -29
  219. package/src/nodes/display/ViewportDepthTextureNode.js +10 -9
  220. package/src/nodes/display/ViewportSharedTextureNode.js +10 -9
  221. package/src/nodes/display/ViewportTextureNode.js +11 -11
  222. package/src/nodes/fog/FogExp2Node.js +8 -7
  223. package/src/nodes/fog/FogNode.js +10 -8
  224. package/src/nodes/fog/FogRangeNode.js +8 -7
  225. package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
  226. package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  227. package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
  228. package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
  229. package/src/nodes/functions/BSDF/D_GGX.js +2 -2
  230. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
  231. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  232. package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
  233. package/src/nodes/functions/BSDF/LTC.js +6 -6
  234. package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
  235. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
  236. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
  237. package/src/nodes/functions/BasicLightingModel.js +1 -1
  238. package/src/nodes/functions/PhongLightingModel.js +5 -5
  239. package/src/nodes/functions/PhysicalLightingModel.js +34 -33
  240. package/src/nodes/functions/ShadowMaskModel.js +1 -1
  241. package/src/nodes/functions/ToonLightingModel.js +3 -3
  242. package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
  243. package/src/nodes/functions/material/getRoughness.js +2 -2
  244. package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
  245. package/src/nodes/geometry/RangeNode.js +9 -5
  246. package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
  247. package/src/nodes/gpgpu/BarrierNode.js +40 -0
  248. package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
  249. package/src/nodes/gpgpu/ComputeNode.js +10 -6
  250. package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
  251. package/src/nodes/lighting/AONode.js +6 -3
  252. package/src/nodes/lighting/AmbientLightNode.js +6 -8
  253. package/src/nodes/lighting/AnalyticLightNode.js +225 -36
  254. package/src/nodes/lighting/BasicEnvironmentNode.js +8 -4
  255. package/src/nodes/lighting/BasicLightMapNode.js +7 -4
  256. package/src/nodes/lighting/DirectionalLightNode.js +7 -9
  257. package/src/nodes/lighting/EnvironmentNode.js +23 -19
  258. package/src/nodes/lighting/HemisphereLightNode.js +11 -11
  259. package/src/nodes/lighting/IESSpotLightNode.js +7 -9
  260. package/src/nodes/lighting/IrradianceNode.js +6 -3
  261. package/src/nodes/lighting/LightProbeNode.js +53 -0
  262. package/src/nodes/lighting/LightUtils.js +3 -3
  263. package/src/nodes/lighting/LightingContextNode.js +19 -18
  264. package/src/nodes/lighting/LightingNode.js +7 -3
  265. package/src/nodes/lighting/LightsNode.js +112 -75
  266. package/src/nodes/lighting/PointLightNode.js +12 -13
  267. package/src/nodes/lighting/RectAreaLightNode.js +11 -11
  268. package/src/nodes/lighting/SpotLightNode.js +14 -16
  269. package/src/nodes/materialx/MaterialXNodes.js +2 -2
  270. package/src/nodes/materialx/lib/mx_hsv.js +36 -31
  271. package/src/nodes/materialx/lib/mx_noise.js +96 -96
  272. package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
  273. package/src/nodes/math/{CondNode.js → ConditionalNode.js} +38 -10
  274. package/src/nodes/math/Hash.js +13 -0
  275. package/src/nodes/math/MathNode.js +127 -124
  276. package/src/nodes/math/MathUtils.js +0 -7
  277. package/src/nodes/math/OperatorNode.js +97 -52
  278. package/src/nodes/math/TriNoise3D.js +19 -29
  279. package/src/nodes/pmrem/PMREMNode.js +61 -15
  280. package/src/nodes/pmrem/PMREMUtils.js +46 -46
  281. package/src/nodes/procedural/Checker.js +14 -0
  282. package/src/nodes/tsl/TSLBase.js +30 -0
  283. package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
  284. package/src/nodes/utils/ArrayElementNode.js +8 -4
  285. package/src/nodes/utils/ConvertNode.js +7 -3
  286. package/src/nodes/utils/CubeMapNode.js +160 -0
  287. package/src/nodes/utils/Discard.js +8 -0
  288. package/src/nodes/utils/EquirectUVNode.js +9 -6
  289. package/src/nodes/utils/FlipNode.js +68 -0
  290. package/src/nodes/utils/FunctionOverloadingNode.js +9 -5
  291. package/src/nodes/utils/JoinNode.js +6 -3
  292. package/src/nodes/utils/LoopNode.js +16 -6
  293. package/src/nodes/utils/MatcapUVNode.js +10 -7
  294. package/src/nodes/utils/MaxMipLevelNode.js +8 -5
  295. package/src/nodes/utils/OscNode.js +12 -8
  296. package/src/nodes/utils/Packing.js +4 -0
  297. package/src/nodes/utils/RTTNode.js +11 -8
  298. package/src/nodes/utils/ReflectorNode.js +12 -4
  299. package/src/nodes/utils/RemapNode.js +12 -8
  300. package/src/nodes/utils/RotateNode.js +8 -13
  301. package/src/nodes/utils/SetNode.js +7 -4
  302. package/src/nodes/utils/SplitNode.js +7 -3
  303. package/src/nodes/utils/SpriteSheetUVNode.js +10 -6
  304. package/src/nodes/utils/SpriteUtils.js +47 -0
  305. package/src/nodes/utils/StorageArrayElementNode.js +11 -12
  306. package/src/nodes/utils/TimerNode.js +8 -5
  307. package/src/nodes/utils/TriplanarTexturesNode.js +11 -9
  308. package/src/nodes/utils/UVUtils.js +19 -0
  309. package/src/nodes/utils/ViewportUtils.js +14 -0
  310. package/src/objects/BatchedMesh.js +78 -13
  311. package/src/objects/LOD.js +21 -0
  312. package/src/objects/Line.js +1 -0
  313. package/src/objects/Mesh.js +7 -23
  314. package/src/objects/Points.js +2 -0
  315. package/src/renderers/WebGLRenderer.js +88 -41
  316. package/src/renderers/common/Backend.js +2 -2
  317. package/src/renderers/common/Background.js +3 -1
  318. package/src/renderers/common/BindGroup.js +3 -1
  319. package/src/renderers/common/Bindings.js +13 -15
  320. package/src/renderers/common/BundleGroup.js +26 -0
  321. package/src/renderers/common/ClippingContext.js +15 -5
  322. package/src/renderers/common/CubeRenderTarget.js +9 -3
  323. package/src/renderers/common/PostProcessing.js +4 -1
  324. package/src/renderers/common/QuadMesh.js +2 -0
  325. package/src/renderers/common/RenderContext.js +23 -0
  326. package/src/renderers/common/RenderList.js +1 -1
  327. package/src/renderers/common/RenderObject.js +117 -6
  328. package/src/renderers/common/RenderObjects.js +8 -1
  329. package/src/renderers/common/Renderer.js +128 -94
  330. package/src/renderers/common/SampledTexture.js +12 -3
  331. package/src/renderers/common/Textures.js +8 -12
  332. package/src/renderers/common/extras/PMREMGenerator.js +19 -22
  333. package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
  334. package/src/renderers/common/nodes/NodeLibrary.js +118 -0
  335. package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
  336. package/src/renderers/common/nodes/Nodes.js +65 -19
  337. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
  338. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
  339. package/src/renderers/webgl/WebGLAttributes.js +45 -14
  340. package/src/renderers/webgl/WebGLCapabilities.js +9 -0
  341. package/src/renderers/webgl/WebGLProgram.js +3 -1
  342. package/src/renderers/webgl/WebGLPrograms.js +21 -17
  343. package/src/renderers/webgl/WebGLProperties.js +7 -0
  344. package/src/renderers/webgl/WebGLState.js +21 -0
  345. package/src/renderers/webgl/WebGLTextures.js +83 -4
  346. package/src/renderers/webgl-fallback/WebGLBackend.js +135 -110
  347. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +60 -12
  348. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
  349. package/src/renderers/webgl-fallback/utils/WebGLState.js +20 -2
  350. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +89 -37
  351. package/src/renderers/webgpu/WebGPUBackend.js +112 -86
  352. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
  353. package/src/renderers/webgpu/WebGPURenderer.js +9 -6
  354. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
  355. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
  356. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +189 -73
  357. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
  358. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
  359. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
  360. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +7 -16
  361. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
  362. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +43 -26
  363. package/src/renderers/webgpu/utils/WebGPUUtils.js +19 -2
  364. package/src/renderers/webxr/WebXRManager.js +32 -25
  365. package/src/utils.js +33 -1
  366. package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
  367. package/examples/jsm/loaders/LogLuvLoader.js +0 -606
  368. package/examples/jsm/loaders/TiltLoader.js +0 -520
  369. package/examples/jsm/utils/GPUStatsPanel.js +0 -95
  370. package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
  371. package/src/nodes/accessors/CameraNode.js +0 -19
  372. package/src/nodes/accessors/NormalNode.js +0 -14
  373. package/src/nodes/accessors/PositionNode.js +0 -10
  374. package/src/nodes/accessors/ReflectVectorNode.js +0 -10
  375. package/src/nodes/accessors/TangentNode.js +0 -23
  376. package/src/nodes/core/NodeKeywords.js +0 -80
  377. package/src/nodes/display/BlendModeNode.js +0 -128
  378. package/src/nodes/display/ColorAdjustmentNode.js +0 -104
  379. package/src/nodes/display/ViewportNode.js +0 -137
  380. package/src/nodes/lighting/LightNode.js +0 -57
  381. package/src/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
  382. package/src/nodes/math/HashNode.js +0 -34
  383. package/src/nodes/procedural/CheckerNode.js +0 -42
  384. package/src/nodes/utils/DiscardNode.js +0 -28
  385. package/src/nodes/utils/PackingNode.js +0 -55
  386. package/src/nodes/utils/RotateUVNode.js +0 -35
  387. /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
@@ -1,11 +1,17 @@
1
- import Node, { addNodeClass } from '../core/Node.js';
2
- import { nodeImmutable, nodeProxy } from '../shadernode/ShaderNode.js';
3
- import { cameraNear, cameraFar } from '../accessors/CameraNode.js';
4
- import { positionView } from '../accessors/PositionNode.js';
1
+ import Node from '../core/Node.js';
2
+ import { nodeImmutable, nodeProxy } from '../tsl/TSLBase.js';
3
+ import { cameraNear, cameraFar } from '../accessors/Camera.js';
4
+ import { positionView } from '../accessors/Position.js';
5
5
  import { viewportDepthTexture } from './ViewportDepthTextureNode.js';
6
6
 
7
7
  class ViewportDepthNode extends Node {
8
8
 
9
+ static get type() {
10
+
11
+ return 'ViewportDepthNode';
12
+
13
+ }
14
+
9
15
  constructor( scope, valueNode = null ) {
10
16
 
11
17
  super( 'float' );
@@ -21,7 +27,7 @@ class ViewportDepthNode extends Node {
21
27
 
22
28
  const { scope } = this;
23
29
 
24
- if ( scope === ViewportDepthNode.DEPTH ) {
30
+ if ( scope === ViewportDepthNode.DEPTH_BASE ) {
25
31
 
26
32
  return builder.getFragDepth();
27
33
 
@@ -34,43 +40,43 @@ class ViewportDepthNode extends Node {
34
40
  setup( { camera } ) {
35
41
 
36
42
  const { scope } = this;
37
- const texture = this.valueNode;
43
+ const value = this.valueNode;
38
44
 
39
45
  let node = null;
40
46
 
41
- if ( scope === ViewportDepthNode.DEPTH ) {
47
+ if ( scope === ViewportDepthNode.DEPTH_BASE ) {
42
48
 
43
- if ( texture !== null ) {
49
+ if ( value !== null ) {
44
50
 
45
- node = depthBase().assign( texture );
51
+ node = depthBase().assign( value );
46
52
 
47
- } else {
53
+ }
48
54
 
49
- if ( camera.isPerspectiveCamera ) {
55
+ } else if ( scope === ViewportDepthNode.DEPTH ) {
50
56
 
51
- node = viewZToPerspectiveDepth( positionView.z, cameraNear, cameraFar );
57
+ if ( camera.isPerspectiveCamera ) {
52
58
 
53
- } else {
59
+ node = viewZToPerspectiveDepth( positionView.z, cameraNear, cameraFar );
54
60
 
55
- node = viewZToOrthographicDepth( positionView.z, cameraNear, cameraFar );
61
+ } else {
56
62
 
57
- }
63
+ node = viewZToOrthographicDepth( positionView.z, cameraNear, cameraFar );
58
64
 
59
65
  }
60
66
 
61
67
  } else if ( scope === ViewportDepthNode.LINEAR_DEPTH ) {
62
68
 
63
- if ( texture !== null ) {
69
+ if ( value !== null ) {
64
70
 
65
71
  if ( camera.isPerspectiveCamera ) {
66
72
 
67
- const viewZ = perspectiveDepthToViewZ( texture, cameraNear, cameraFar );
73
+ const viewZ = perspectiveDepthToViewZ( value, cameraNear, cameraFar );
68
74
 
69
75
  node = viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
70
76
 
71
77
  } else {
72
78
 
73
- node = texture;
79
+ node = value;
74
80
 
75
81
  }
76
82
 
@@ -88,6 +94,12 @@ class ViewportDepthNode extends Node {
88
94
 
89
95
  }
90
96
 
97
+ ViewportDepthNode.DEPTH_BASE = 'depthBase';
98
+ ViewportDepthNode.DEPTH = 'depth';
99
+ ViewportDepthNode.LINEAR_DEPTH = 'linearDepth';
100
+
101
+ export default ViewportDepthNode;
102
+
91
103
  // NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera
92
104
 
93
105
  // -near maps to 0; -far maps to 1
@@ -104,17 +116,10 @@ export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ )
104
116
  // maps perspective depth in [ 0, 1 ] to viewZ
105
117
  export const perspectiveDepthToViewZ = ( depth, near, far ) => near.mul( far ).div( far.sub( near ).mul( depth ).sub( far ) );
106
118
 
107
- ViewportDepthNode.DEPTH = 'depth';
108
- ViewportDepthNode.LINEAR_DEPTH = 'linearDepth';
109
-
110
- export default ViewportDepthNode;
119
+ const depthBase = /*@__PURE__*/ nodeProxy( ViewportDepthNode, ViewportDepthNode.DEPTH_BASE );
111
120
 
112
- const depthBase = nodeProxy( ViewportDepthNode, ViewportDepthNode.DEPTH );
113
-
114
- export const depth = nodeImmutable( ViewportDepthNode, ViewportDepthNode.DEPTH );
115
- export const linearDepth = nodeProxy( ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH );
116
- export const viewportLinearDepth = linearDepth( viewportDepthTexture() );
121
+ export const depth = /*@__PURE__*/ nodeImmutable( ViewportDepthNode, ViewportDepthNode.DEPTH );
122
+ export const linearDepth = /*@__PURE__*/ nodeProxy( ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH );
123
+ export const viewportLinearDepth = /*@__PURE__*/ linearDepth( viewportDepthTexture() );
117
124
 
118
125
  depth.assign = ( value ) => depthBase( value );
119
-
120
- addNodeClass( 'ViewportDepthNode', ViewportDepthNode );
@@ -1,7 +1,6 @@
1
1
  import ViewportTextureNode from './ViewportTextureNode.js';
2
- import { addNodeClass } from '../core/Node.js';
3
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
4
- import { viewportTopLeft } from './ViewportNode.js';
2
+ import { nodeProxy } from '../tsl/TSLBase.js';
3
+ import { screenUV } from './ScreenNode.js';
5
4
 
6
5
  import { DepthTexture } from '../../textures/DepthTexture.js';
7
6
 
@@ -9,7 +8,13 @@ let sharedDepthbuffer = null;
9
8
 
10
9
  class ViewportDepthTextureNode extends ViewportTextureNode {
11
10
 
12
- constructor( uvNode = viewportTopLeft, levelNode = null ) {
11
+ static get type() {
12
+
13
+ return 'ViewportDepthTextureNode';
14
+
15
+ }
16
+
17
+ constructor( uvNode = screenUV, levelNode = null ) {
13
18
 
14
19
  if ( sharedDepthbuffer === null ) {
15
20
 
@@ -25,8 +30,4 @@ class ViewportDepthTextureNode extends ViewportTextureNode {
25
30
 
26
31
  export default ViewportDepthTextureNode;
27
32
 
28
- export const viewportDepthTexture = nodeProxy( ViewportDepthTextureNode );
29
-
30
- addNodeElement( 'viewportDepthTexture', viewportDepthTexture );
31
-
32
- addNodeClass( 'ViewportDepthTextureNode', ViewportDepthTextureNode );
33
+ export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode );
@@ -1,7 +1,6 @@
1
1
  import ViewportTextureNode from './ViewportTextureNode.js';
2
- import { addNodeClass } from '../core/Node.js';
3
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
4
- import { viewportTopLeft } from './ViewportNode.js';
2
+ import { nodeProxy } from '../tsl/TSLBase.js';
3
+ import { screenUV } from './ScreenNode.js';
5
4
 
6
5
  import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
7
6
 
@@ -9,7 +8,13 @@ let _sharedFramebuffer = null;
9
8
 
10
9
  class ViewportSharedTextureNode extends ViewportTextureNode {
11
10
 
12
- constructor( uvNode = viewportTopLeft, levelNode = null ) {
11
+ static get type() {
12
+
13
+ return 'ViewportSharedTextureNode';
14
+
15
+ }
16
+
17
+ constructor( uvNode = screenUV, levelNode = null ) {
13
18
 
14
19
  if ( _sharedFramebuffer === null ) {
15
20
 
@@ -31,8 +36,4 @@ class ViewportSharedTextureNode extends ViewportTextureNode {
31
36
 
32
37
  export default ViewportSharedTextureNode;
33
38
 
34
- export const viewportSharedTexture = nodeProxy( ViewportSharedTextureNode );
35
-
36
- addNodeElement( 'viewportSharedTexture', viewportSharedTexture );
37
-
38
- addNodeClass( 'ViewportSharedTextureNode', ViewportSharedTextureNode );
39
+ export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode );
@@ -1,8 +1,7 @@
1
1
  import TextureNode from '../accessors/TextureNode.js';
2
2
  import { NodeUpdateType } from '../core/constants.js';
3
- import { addNodeClass } from '../core/Node.js';
4
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
5
- import { viewportTopLeft } from './ViewportNode.js';
3
+ import { nodeProxy } from '../tsl/TSLBase.js';
4
+ import { screenUV } from './ScreenNode.js';
6
5
 
7
6
  import { Vector2 } from '../../math/Vector2.js';
8
7
  import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
@@ -12,7 +11,13 @@ const _size = /*@__PURE__*/ new Vector2();
12
11
 
13
12
  class ViewportTextureNode extends TextureNode {
14
13
 
15
- constructor( uvNode = viewportTopLeft, levelNode = null, framebufferTexture = null ) {
14
+ static get type() {
15
+
16
+ return 'ViewportTextureNode';
17
+
18
+ }
19
+
20
+ constructor( uvNode = screenUV, levelNode = null, framebufferTexture = null ) {
16
21
 
17
22
  if ( framebufferTexture === null ) {
18
23
 
@@ -72,10 +77,5 @@ class ViewportTextureNode extends TextureNode {
72
77
 
73
78
  export default ViewportTextureNode;
74
79
 
75
- export const viewportTexture = nodeProxy( ViewportTextureNode );
76
- export const viewportMipTexture = nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
77
-
78
- addNodeElement( 'viewportTexture', viewportTexture );
79
- addNodeElement( 'viewportMipTexture', viewportMipTexture );
80
-
81
- addNodeClass( 'ViewportTextureNode', ViewportTextureNode );
80
+ export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode );
81
+ export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
@@ -1,9 +1,14 @@
1
1
  import FogNode from './FogNode.js';
2
- import { addNodeClass } from '../core/Node.js';
3
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
2
+ import { nodeProxy } from '../tsl/TSLBase.js';
4
3
 
5
4
  class FogExp2Node extends FogNode {
6
5
 
6
+ static get type() {
7
+
8
+ return 'FogExp2Node';
9
+
10
+ }
11
+
7
12
  constructor( colorNode, densityNode ) {
8
13
 
9
14
  super( colorNode );
@@ -27,8 +32,4 @@ class FogExp2Node extends FogNode {
27
32
 
28
33
  export default FogExp2Node;
29
34
 
30
- export const densityFog = nodeProxy( FogExp2Node );
31
-
32
- addNodeElement( 'densityFog', densityFog );
33
-
34
- addNodeClass( 'FogExp2Node', FogExp2Node );
35
+ export const densityFog = /*@__PURE__*/ nodeProxy( FogExp2Node );
@@ -1,9 +1,15 @@
1
- import Node, { addNodeClass } from '../core/Node.js';
2
- import { positionView } from '../accessors/PositionNode.js';
3
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
1
+ import Node from '../core/Node.js';
2
+ import { positionView } from '../accessors/Position.js';
3
+ import { nodeProxy } from '../tsl/TSLBase.js';
4
4
 
5
5
  class FogNode extends Node {
6
6
 
7
+ static get type() {
8
+
9
+ return 'FogNode';
10
+
11
+ }
12
+
7
13
  constructor( colorNode, factorNode ) {
8
14
 
9
15
  super( 'float' );
@@ -41,8 +47,4 @@ class FogNode extends Node {
41
47
 
42
48
  export default FogNode;
43
49
 
44
- export const fog = nodeProxy( FogNode );
45
-
46
- addNodeElement( 'fog', fog );
47
-
48
- addNodeClass( 'FogNode', FogNode );
50
+ export const fog = /*@__PURE__*/ nodeProxy( FogNode );
@@ -1,10 +1,15 @@
1
1
  import FogNode from './FogNode.js';
2
2
  import { smoothstep } from '../math/MathNode.js';
3
- import { addNodeClass } from '../core/Node.js';
4
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
3
+ import { nodeProxy } from '../tsl/TSLBase.js';
5
4
 
6
5
  class FogRangeNode extends FogNode {
7
6
 
7
+ static get type() {
8
+
9
+ return 'FogRangeNode';
10
+
11
+ }
12
+
8
13
  constructor( colorNode, nearNode, farNode ) {
9
14
 
10
15
  super( colorNode );
@@ -28,8 +33,4 @@ class FogRangeNode extends FogNode {
28
33
 
29
34
  export default FogRangeNode;
30
35
 
31
- export const rangeFog = nodeProxy( FogRangeNode );
32
-
33
- addNodeElement( 'rangeFog', rangeFog );
34
-
35
- addNodeClass( 'FogRangeNode', FogRangeNode );
36
+ export const rangeFog = /*@__PURE__*/ nodeProxy( FogRangeNode );
@@ -3,13 +3,13 @@ import V_GGX_SmithCorrelated from './V_GGX_SmithCorrelated.js';
3
3
  import V_GGX_SmithCorrelated_Anisotropic from './V_GGX_SmithCorrelated_Anisotropic.js';
4
4
  import D_GGX from './D_GGX.js';
5
5
  import D_GGX_Anisotropic from './D_GGX_Anisotropic.js';
6
- import { transformedNormalView } from '../../accessors/NormalNode.js';
7
- import { positionViewDirection } from '../../accessors/PositionNode.js';
6
+ import { transformedNormalView } from '../../accessors/Normal.js';
7
+ import { positionViewDirection } from '../../accessors/Position.js';
8
8
  import { iridescence, alphaT, anisotropyT, anisotropyB } from '../../core/PropertyNode.js';
9
- import { tslFn, defined } from '../../shadernode/ShaderNode.js';
9
+ import { Fn, defined } from '../../tsl/TSLBase.js';
10
10
 
11
11
  // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
12
- const BRDF_GGX = tslFn( ( inputs ) => {
12
+ const BRDF_GGX = /*@__PURE__*/ Fn( ( inputs ) => {
13
13
 
14
14
  const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs;
15
15
 
@@ -1,6 +1,6 @@
1
- import { tslFn } from '../../shadernode/ShaderNode.js';
1
+ import { Fn } from '../../tsl/TSLBase.js';
2
2
 
3
- const BRDF_Lambert = tslFn( ( inputs ) => {
3
+ const BRDF_Lambert = /*@__PURE__*/ Fn( ( inputs ) => {
4
4
 
5
5
  return inputs.diffuseColor.mul( 1 / Math.PI ); // punctual light
6
6
 
@@ -1,10 +1,10 @@
1
- import { transformedNormalView } from '../../accessors/NormalNode.js';
2
- import { positionViewDirection } from '../../accessors/PositionNode.js';
1
+ import { transformedNormalView } from '../../accessors/Normal.js';
2
+ import { positionViewDirection } from '../../accessors/Position.js';
3
3
  import { sheen, sheenRoughness } from '../../core/PropertyNode.js';
4
- import { tslFn, float } from '../../shadernode/ShaderNode.js';
4
+ import { Fn, float } from '../../tsl/TSLBase.js';
5
5
 
6
6
  // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
7
- const D_Charlie = tslFn( ( { roughness, dotNH } ) => {
7
+ const D_Charlie = /*@__PURE__*/ Fn( ( { roughness, dotNH } ) => {
8
8
 
9
9
  const alpha = roughness.pow2();
10
10
 
@@ -25,7 +25,7 @@ const D_Charlie = tslFn( ( { roughness, dotNH } ) => {
25
25
  } );
26
26
 
27
27
  // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
28
- const V_Neubelt = tslFn( ( { dotNV, dotNL } ) => {
28
+ const V_Neubelt = /*@__PURE__*/ Fn( ( { dotNV, dotNL } ) => {
29
29
 
30
30
  // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
31
31
  return float( 1.0 ).div( float( 4.0 ).mul( dotNL.add( dotNV ).sub( dotNL.mul( dotNV ) ) ) );
@@ -39,7 +39,7 @@ const V_Neubelt = tslFn( ( { dotNV, dotNL } ) => {
39
39
  ]
40
40
  } );
41
41
 
42
- const BRDF_Sheen = tslFn( ( { lightDirection } ) => {
42
+ const BRDF_Sheen = /*@__PURE__*/ Fn( ( { lightDirection } ) => {
43
43
 
44
44
  const halfDir = lightDirection.add( positionViewDirection ).normalize();
45
45
 
@@ -1,10 +1,10 @@
1
- import { tslFn, vec2, vec4 } from '../../shadernode/ShaderNode.js';
1
+ import { Fn, vec2, vec4 } from '../../tsl/TSLBase.js';
2
2
 
3
3
  // Analytical approximation of the DFG LUT, one half of the
4
4
  // split-sum approximation used in indirect specular lighting.
5
5
  // via 'environmentBRDF' from "Physically Based Shading on Mobile"
6
6
  // https://www.unrealengine.com/blog/physically-based-shading-on-mobile
7
- const DFGApprox = tslFn( ( { roughness, dotNV } ) => {
7
+ const DFGApprox = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => {
8
8
 
9
9
  const c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
10
10
 
@@ -1,9 +1,9 @@
1
- import { tslFn } from '../../shadernode/ShaderNode.js';
1
+ import { Fn } from '../../tsl/TSLBase.js';
2
2
 
3
3
  // Microfacet Models for Refraction through Rough Surfaces - equation (33)
4
4
  // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
5
5
  // alpha is "roughness squared" in Disney’s reparameterization
6
- const D_GGX = tslFn( ( { alpha, dotNH } ) => {
6
+ const D_GGX = /*@__PURE__*/ Fn( ( { alpha, dotNH } ) => {
7
7
 
8
8
  const a2 = alpha.pow2();
9
9
 
@@ -1,10 +1,10 @@
1
- import { tslFn, float, vec3 } from '../../shadernode/ShaderNode.js';
1
+ import { Fn, float, vec3 } from '../../tsl/TSLBase.js';
2
2
 
3
- const RECIPROCAL_PI = float( 1 / Math.PI );
3
+ const RECIPROCAL_PI = /*@__PURE__*/ float( 1 / Math.PI );
4
4
 
5
5
  // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
6
6
 
7
- const D_GGX_Anisotropic = tslFn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => {
7
+ const D_GGX_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => {
8
8
 
9
9
  const a2 = alphaT.mul( alphaB );
10
10
  const v = vec3( alphaB.mul( dotTH ), alphaT.mul( dotBH ), a2.mul( dotNH ) );
@@ -1,7 +1,7 @@
1
1
  import DFGApprox from './DFGApprox.js';
2
- import { tslFn } from '../../shadernode/ShaderNode.js';
2
+ import { Fn } from '../../tsl/TSLBase.js';
3
3
 
4
- const EnvironmentBRDF = tslFn( ( inputs ) => {
4
+ const EnvironmentBRDF = /*@__PURE__*/ Fn( ( inputs ) => {
5
5
 
6
6
  const { dotNV, specularColor, specularF90, roughness } = inputs;
7
7
 
@@ -1,6 +1,6 @@
1
- import { tslFn } from '../../shadernode/ShaderNode.js';
1
+ import { Fn } from '../../tsl/TSLBase.js';
2
2
 
3
- const F_Schlick = tslFn( ( { f0, f90, dotVH } ) => {
3
+ const F_Schlick = /*@__PURE__*/ Fn( ( { f0, f90, dotVH } ) => {
4
4
 
5
5
  // Original approximation by Christophe Schlick '94
6
6
  // float fresnel = pow( 1.0 - dotVH, 5.0 );
@@ -1,4 +1,4 @@
1
- import { tslFn, If, mat3, vec2, vec3 } from '../../shadernode/ShaderNode.js';
1
+ import { Fn, If, mat3, vec2, vec3 } from '../../tsl/TSLBase.js';
2
2
  import { max } from '../../math/MathNode.js';
3
3
 
4
4
  // Rect Area Light
@@ -7,7 +7,7 @@ import { max } from '../../math/MathNode.js';
7
7
  // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
8
8
  // code: https://github.com/selfshadow/ltc_code/
9
9
 
10
- const LTC_Uv = tslFn( ( { N, V, roughness } ) => {
10
+ const LTC_Uv = /*@__PURE__*/ Fn( ( { N, V, roughness } ) => {
11
11
 
12
12
  const LUT_SIZE = 64.0;
13
13
  const LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
@@ -32,7 +32,7 @@ const LTC_Uv = tslFn( ( { N, V, roughness } ) => {
32
32
  ]
33
33
  } );
34
34
 
35
- const LTC_ClippedSphereFormFactor = tslFn( ( { f } ) => {
35
+ const LTC_ClippedSphereFormFactor = /*@__PURE__*/ Fn( ( { f } ) => {
36
36
 
37
37
  // Real-Time Area Lighting: a Journey from Research to Production (p.102)
38
38
  // An approximation of the form factor of a horizon-clipped rectangle.
@@ -49,7 +49,7 @@ const LTC_ClippedSphereFormFactor = tslFn( ( { f } ) => {
49
49
  ]
50
50
  } );
51
51
 
52
- const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
52
+ const LTC_EdgeVectorFormFactor = /*@__PURE__*/ Fn( ( { v1, v2 } ) => {
53
53
 
54
54
  const x = v1.dot( v2 );
55
55
  const y = x.abs().toVar();
@@ -59,7 +59,7 @@ const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
59
59
  const b = y.add( 4.1616724 ).mul( y ).add( 3.4175940 ).toVar();
60
60
  const v = a.div( b );
61
61
 
62
- const theta_sintheta = x.greaterThan( 0.0 ).cond( v, max( x.mul( x ).oneMinus(), 1e-7 ).inverseSqrt().mul( 0.5 ).sub( v ) );
62
+ const theta_sintheta = x.greaterThan( 0.0 ).select( v, max( x.mul( x ).oneMinus(), 1e-7 ).inverseSqrt().mul( 0.5 ).sub( v ) );
63
63
 
64
64
  return v1.cross( v2 ).mul( theta_sintheta );
65
65
 
@@ -72,7 +72,7 @@ const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
72
72
  ]
73
73
  } );
74
74
 
75
- const LTC_Evaluate = tslFn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => {
75
+ const LTC_Evaluate = /*@__PURE__*/ Fn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => {
76
76
 
77
77
  // bail if point is on back side of plane of light
78
78
  // assumes ccw winding order of light vertices
@@ -1,6 +1,6 @@
1
- import { tslFn, vec3 } from '../../shadernode/ShaderNode.js';
1
+ import { Fn, vec3 } from '../../tsl/TSLBase.js';
2
2
 
3
- const Schlick_to_F0 = tslFn( ( { f, f90, dotVH } ) => {
3
+ const Schlick_to_F0 = /*@__PURE__*/ Fn( ( { f, f90, dotVH } ) => {
4
4
 
5
5
  const x = dotVH.oneMinus().saturate();
6
6
  const x2 = x.mul( x );
@@ -1,10 +1,10 @@
1
1
  import { div } from '../../math/OperatorNode.js';
2
2
  import { EPSILON } from '../../math/MathNode.js';
3
- import { tslFn } from '../../shadernode/ShaderNode.js';
3
+ import { Fn } from '../../tsl/TSLBase.js';
4
4
 
5
5
  // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
6
6
  // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
7
- const V_GGX_SmithCorrelated = tslFn( ( { alpha, dotNL, dotNV } ) => {
7
+ const V_GGX_SmithCorrelated = /*@__PURE__*/ Fn( ( { alpha, dotNL, dotNV } ) => {
8
8
 
9
9
  const a2 = alpha.pow2();
10
10
 
@@ -1,9 +1,9 @@
1
1
  import { div } from '../../math/OperatorNode.js';
2
- import { tslFn, vec3 } from '../../shadernode/ShaderNode.js';
2
+ import { Fn, vec3 } from '../../tsl/TSLBase.js';
3
3
 
4
4
  // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
5
5
 
6
- const V_GGX_SmithCorrelated_Anisotropic = tslFn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => {
6
+ const V_GGX_SmithCorrelated_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => {
7
7
 
8
8
  const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() );
9
9
  const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );
@@ -3,7 +3,7 @@ import { diffuseColor } from '../core/PropertyNode.js';
3
3
  import { MultiplyOperation, MixOperation, AddOperation } from '../../constants.js';
4
4
  import { materialSpecularStrength, materialReflectivity } from '../accessors/MaterialNode.js';
5
5
  import { mix } from '../math/MathNode.js';
6
- import { vec4 } from '../shadernode/ShaderNode.js';
6
+ import { vec4 } from '../tsl/TSLBase.js';
7
7
 
8
8
  class BasicLightingModel extends LightingModel {
9
9
 
@@ -2,21 +2,21 @@ import BasicLightingModel from './BasicLightingModel.js';
2
2
  import F_Schlick from './BSDF/F_Schlick.js';
3
3
  import BRDF_Lambert from './BSDF/BRDF_Lambert.js';
4
4
  import { diffuseColor } from '../core/PropertyNode.js';
5
- import { transformedNormalView } from '../accessors/NormalNode.js';
5
+ import { transformedNormalView } from '../accessors/Normal.js';
6
6
  import { materialSpecularStrength } from '../accessors/MaterialNode.js';
7
7
  import { shininess, specularColor } from '../core/PropertyNode.js';
8
- import { positionViewDirection } from '../accessors/PositionNode.js';
9
- import { tslFn, float } from '../shadernode/ShaderNode.js';
8
+ import { positionViewDirection } from '../accessors/Position.js';
9
+ import { Fn, float } from '../tsl/TSLBase.js';
10
10
 
11
11
  const G_BlinnPhong_Implicit = () => float( 0.25 );
12
12
 
13
- const D_BlinnPhong = tslFn( ( { dotNH } ) => {
13
+ const D_BlinnPhong = /*@__PURE__*/ Fn( ( { dotNH } ) => {
14
14
 
15
15
  return shininess.mul( float( 0.5 ) ).add( 1.0 ).mul( float( 1 / Math.PI ) ).mul( dotNH.pow( shininess ) );
16
16
 
17
17
  } );
18
18
 
19
- const BRDF_BlinnPhong = tslFn( ( { lightDirection } ) => {
19
+ const BRDF_BlinnPhong = /*@__PURE__*/ Fn( ( { lightDirection } ) => {
20
20
 
21
21
  const halfDir = lightDirection.add( positionViewDirection ).normalize();
22
22