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,108 +1,114 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { mix } from '../math/MathNode.js';
3
- import { addNodeClass } from '../core/Node.js';
4
- import { addNodeElement, tslFn, nodeObject, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
2
+ import { addMethodChaining, nodeObject, vec4 } from '../tsl/TSLCore.js';
5
3
 
6
4
  import { LinearSRGBColorSpace, SRGBColorSpace } from '../../constants.js';
5
+ import { ColorManagement } from '../../math/ColorManagement.js';
7
6
 
8
- const sRGBToLinearShader = tslFn( ( inputs ) => {
7
+ const WORKING_COLOR_SPACE = 'WorkingColorSpace';
8
+ const OUTPUT_COLOR_SPACE = 'OutputColorSpace';
9
9
 
10
- const { value } = inputs;
11
- const { rgb } = value;
10
+ function getColorSpaceName( colorSpace ) {
12
11
 
13
- const a = rgb.mul( 0.9478672986 ).add( 0.0521327014 ).pow( 2.4 );
14
- const b = rgb.mul( 0.0773993808 );
15
- const factor = rgb.lessThanEqual( 0.04045 );
12
+ let method = null;
16
13
 
17
- const rgbResult = mix( a, b, factor );
14
+ if ( colorSpace === LinearSRGBColorSpace ) {
18
15
 
19
- return vec4( rgbResult, value.a );
16
+ method = 'Linear';
20
17
 
21
- } );
18
+ } else if ( colorSpace === SRGBColorSpace ) {
22
19
 
23
- const LinearTosRGBShader = tslFn( ( inputs ) => {
20
+ method = 'sRGB';
24
21
 
25
- const { value } = inputs;
26
- const { rgb } = value;
22
+ }
27
23
 
28
- const a = rgb.pow( 0.41666 ).mul( 1.055 ).sub( 0.055 );
29
- const b = rgb.mul( 12.92 );
30
- const factor = rgb.lessThanEqual( 0.0031308 );
24
+ return method;
31
25
 
32
- const rgbResult = mix( a, b, factor );
26
+ }
33
27
 
34
- return vec4( rgbResult, value.a );
28
+ export function getColorSpaceMethod( source, target ) {
35
29
 
36
- } );
30
+ return getColorSpaceName( source ) + 'To' + getColorSpaceName( target );
37
31
 
38
- const getColorSpaceMethod = ( colorSpace ) => {
32
+ }
39
33
 
40
- let method = null;
34
+ class ColorSpaceNode extends TempNode {
41
35
 
42
- if ( colorSpace === LinearSRGBColorSpace ) {
36
+ static get type() {
43
37
 
44
- method = 'Linear';
38
+ return 'ColorSpaceNode';
45
39
 
46
- } else if ( colorSpace === SRGBColorSpace ) {
40
+ }
47
41
 
48
- method = 'sRGB';
42
+ constructor( colorNode, source, target ) {
49
43
 
50
- }
44
+ super( 'vec4' );
51
45
 
52
- return method;
46
+ this.colorNode = colorNode;
47
+ this.source = source;
48
+ this.target = target;
53
49
 
54
- };
50
+ }
55
51
 
56
- const getMethod = ( source, target ) => {
52
+ getColorSpace( builder, colorSpace ) {
57
53
 
58
- return getColorSpaceMethod( source ) + 'To' + getColorSpaceMethod( target );
54
+ if ( colorSpace === WORKING_COLOR_SPACE ) {
59
55
 
60
- };
56
+ return ColorManagement.workingColorSpace;
61
57
 
62
- class ColorSpaceNode extends TempNode {
58
+ } else if ( colorSpace === OUTPUT_COLOR_SPACE ) {
63
59
 
64
- constructor( method, node ) {
60
+ return builder.context.outputColorSpace || builder.renderer.outputColorSpace;
65
61
 
66
- super( 'vec4' );
62
+ }
67
63
 
68
- this.method = method;
69
- this.node = node;
64
+ return colorSpace;
70
65
 
71
66
  }
72
67
 
73
- setup() {
68
+ setup( builder ) {
74
69
 
75
- const { method, node } = this;
70
+ const { renderer } = builder;
71
+ const { colorNode } = this;
76
72
 
77
- if ( method === ColorSpaceNode.LINEAR_TO_LINEAR )
78
- return node;
73
+ const source = this.getColorSpace( builder, this.source );
74
+ const target = this.getColorSpace( builder, this.target );
79
75
 
80
- return Methods[ method ]( { value: node } );
76
+ if ( source === target ) return colorNode;
81
77
 
82
- }
78
+ const colorSpace = getColorSpaceMethod( source, target );
83
79
 
84
- }
80
+ let outputNode = null;
81
+
82
+ const colorSpaceFn = renderer.nodes.library.getColorSpaceFunction( colorSpace );
83
+
84
+ if ( colorSpaceFn !== null ) {
85
85
 
86
- ColorSpaceNode.LINEAR_TO_LINEAR = 'LinearToLinear';
87
- ColorSpaceNode.LINEAR_TO_sRGB = 'LinearTosRGB';
88
- ColorSpaceNode.sRGB_TO_LINEAR = 'sRGBToLinear';
86
+ outputNode = vec4( colorSpaceFn( colorNode.rgb ), colorNode.a );
89
87
 
90
- const Methods = {
91
- [ ColorSpaceNode.LINEAR_TO_sRGB ]: LinearTosRGBShader,
92
- [ ColorSpaceNode.sRGB_TO_LINEAR ]: sRGBToLinearShader
93
- };
88
+ } else {
89
+
90
+ console.error( 'ColorSpaceNode: Unsupported Color Space configuration.', colorSpace );
91
+
92
+ outputNode = colorNode;
93
+
94
+ }
95
+
96
+ return outputNode;
97
+
98
+ }
99
+
100
+ }
94
101
 
95
102
  export default ColorSpaceNode;
96
103
 
97
- export const linearToColorSpace = ( node, colorSpace ) => nodeObject( new ColorSpaceNode( getMethod( LinearSRGBColorSpace, colorSpace ), nodeObject( node ) ) );
98
- export const colorSpaceToLinear = ( node, colorSpace ) => nodeObject( new ColorSpaceNode( getMethod( colorSpace, LinearSRGBColorSpace ), nodeObject( node ) ) );
104
+ export const toOutputColorSpace = ( node ) => nodeObject( new ColorSpaceNode( nodeObject( node ), WORKING_COLOR_SPACE, OUTPUT_COLOR_SPACE ) );
105
+ export const toWorkingColorSpace = ( node ) => nodeObject( new ColorSpaceNode( nodeObject( node ), OUTPUT_COLOR_SPACE, WORKING_COLOR_SPACE ) );
99
106
 
100
- export const linearTosRGB = nodeProxy( ColorSpaceNode, ColorSpaceNode.LINEAR_TO_sRGB );
101
- export const sRGBToLinear = nodeProxy( ColorSpaceNode, ColorSpaceNode.sRGB_TO_LINEAR );
107
+ export const workingToColorSpace = ( node, colorSpace ) => nodeObject( new ColorSpaceNode( nodeObject( node ), WORKING_COLOR_SPACE, colorSpace ) );
108
+ export const colorSpaceToWorking = ( node, colorSpace ) => nodeObject( new ColorSpaceNode( nodeObject( node ), colorSpace, WORKING_COLOR_SPACE ) );
102
109
 
103
- addNodeElement( 'linearTosRGB', linearTosRGB );
104
- addNodeElement( 'sRGBToLinear', sRGBToLinear );
105
- addNodeElement( 'linearToColorSpace', linearToColorSpace );
106
- addNodeElement( 'colorSpaceToLinear', colorSpaceToLinear );
110
+ addMethodChaining( 'toOutputColorSpace', toOutputColorSpace );
111
+ addMethodChaining( 'toWorkingColorSpace', toWorkingColorSpace );
107
112
 
108
- addNodeClass( 'ColorSpaceNode', ColorSpaceNode );
113
+ addMethodChaining( 'workingToColorSpace', workingToColorSpace );
114
+ addMethodChaining( 'colorSpaceToWorking', colorSpaceToWorking );
@@ -1,18 +1,26 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { uv } from '../accessors/UVNode.js';
3
- import { addNodeElement, tslFn, nodeObject, float, int, vec2, vec3, vec4, mat2, If } from '../shadernode/ShaderNode.js';
2
+ import { uv } from '../accessors/UV.js';
3
+ import { Fn, nodeObject, float, int, vec2, vec3, vec4, mat2, If } from '../tsl/TSLBase.js';
4
4
  import { NodeUpdateType } from '../core/constants.js';
5
5
  import { uniform } from '../core/UniformNode.js';
6
- import { uniforms } from '../accessors/UniformsNode.js';
6
+ import { uniformArray } from '../accessors/UniformArrayNode.js';
7
7
  import { abs, dot, sin, cos, PI, pow, max } from '../math/MathNode.js';
8
- import { loop } from '../utils/LoopNode.js';
9
- import { luminance } from './ColorAdjustmentNode.js';
8
+ import { Loop } from '../utils/LoopNode.js';
9
+ import { luminance } from './ColorAdjustment.js';
10
10
  import { textureSize } from '../accessors/TextureSizeNode.js';
11
+ import { convertToTexture } from '../utils/RTTNode.js';
12
+
11
13
  import { Vector2 } from '../../math/Vector2.js';
12
14
  import { Vector3 } from '../../math/Vector3.js';
13
15
 
14
16
  class DenoiseNode extends TempNode {
15
17
 
18
+ static get type() {
19
+
20
+ return 'DenoiseNode';
21
+
22
+ }
23
+
16
24
  constructor( textureNode, depthNode, normalNode, noiseNode, camera ) {
17
25
 
18
26
  super();
@@ -30,7 +38,7 @@ class DenoiseNode extends TempNode {
30
38
  this.index = uniform( 0 );
31
39
 
32
40
  this._resolution = uniform( new Vector2() );
33
- this._sampleVectors = uniforms( generatePdSamplePointInitializer( 16, 2, 1 ) );
41
+ this._sampleVectors = uniformArray( generatePdSamplePointInitializer( 16, 2, 1 ) );
34
42
 
35
43
  this.updateBeforeType = NodeUpdateType.RENDER;
36
44
 
@@ -53,7 +61,7 @@ class DenoiseNode extends TempNode {
53
61
  const sampleNormal = ( uv ) => this.normalNode.uv( uv );
54
62
  const sampleNoise = ( uv ) => this.noiseNode.uv( uv );
55
63
 
56
- const getViewPosition = tslFn( ( [ screenPosition, depth ] ) => {
64
+ const getViewPosition = Fn( ( [ screenPosition, depth ] ) => {
57
65
 
58
66
  screenPosition = vec2( screenPosition.x, screenPosition.y.oneMinus() ).mul( 2.0 ).sub( 1.0 );
59
67
 
@@ -64,7 +72,7 @@ class DenoiseNode extends TempNode {
64
72
 
65
73
  } );
66
74
 
67
- const denoiseSample = tslFn( ( [ center, viewNormal, viewPosition, sampleUv ] ) => {
75
+ const denoiseSample = Fn( ( [ center, viewNormal, viewPosition, sampleUv ] ) => {
68
76
 
69
77
  const texel = sampleTexture( sampleUv );
70
78
  const depth = sampleDepth( sampleUv );
@@ -84,7 +92,7 @@ class DenoiseNode extends TempNode {
84
92
 
85
93
  } );
86
94
 
87
- const denoise = tslFn( ( [ uvNode ] ) => {
95
+ const denoise = Fn( ( [ uvNode ] ) => {
88
96
 
89
97
  const depth = sampleDepth( uvNode );
90
98
  const viewNormal = sampleNormal( uvNode ).rgb.normalize();
@@ -115,7 +123,7 @@ class DenoiseNode extends TempNode {
115
123
  const totalWeight = float( 1.0 ).toVar();
116
124
  const denoised = vec3( texel.rgb ).toVar();
117
125
 
118
- loop( { start: int( 0 ), end: int( 16 ), type: 'int', condition: '<' }, ( { i } ) => {
126
+ Loop( { start: int( 0 ), end: int( 16 ), type: 'int', condition: '<' }, ( { i } ) => {
119
127
 
120
128
  const sampleDir = this._sampleVectors.element( i ).toVar();
121
129
  const offset = rotationMatrix.mul( sampleDir.xy.mul( float( 1.0 ).add( sampleDir.z.mul( this.radius.sub( 1 ) ) ) ) ).div( this._resolution ).toVar();
@@ -126,7 +134,7 @@ class DenoiseNode extends TempNode {
126
134
  denoised.addAssign( result.xyz );
127
135
  totalWeight.addAssign( result.w );
128
136
 
129
- } );
137
+ } );
130
138
 
131
139
  If( totalWeight.greaterThan( float( 0 ) ), () => {
132
140
 
@@ -144,7 +152,7 @@ class DenoiseNode extends TempNode {
144
152
  ]
145
153
  } );
146
154
 
147
- const output = tslFn( () => {
155
+ const output = Fn( () => {
148
156
 
149
157
  return denoise( uvNode );
150
158
 
@@ -158,6 +166,8 @@ class DenoiseNode extends TempNode {
158
166
 
159
167
  }
160
168
 
169
+ export default DenoiseNode;
170
+
161
171
  function generatePdSamplePointInitializer( samples, rings, radiusExponent ) {
162
172
 
163
173
  const poissonDisk = generateDenoiseSamples( samples, rings, radiusExponent );
@@ -191,8 +201,4 @@ function generateDenoiseSamples( numSamples, numRings, radiusExponent ) {
191
201
 
192
202
  }
193
203
 
194
- export const denoise = ( node, depthNode, normalNode, noiseNode, camera ) => nodeObject( new DenoiseNode( nodeObject( node ).toTexture(), nodeObject( depthNode ), nodeObject( normalNode ), nodeObject( noiseNode ), camera ) );
195
-
196
- addNodeElement( 'denoise', denoise );
197
-
198
- export default DenoiseNode;
204
+ export const denoise = ( node, depthNode, normalNode, noiseNode, camera ) => nodeObject( new DenoiseNode( convertToTexture( node ), nodeObject( depthNode ), nodeObject( normalNode ), nodeObject( noiseNode ), camera ) );
@@ -1,12 +1,19 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { uv } from '../accessors/UVNode.js';
3
- import { addNodeElement, tslFn, nodeObject, vec2, vec4 } from '../shadernode/ShaderNode.js';
2
+ import { uv } from '../accessors/UV.js';
3
+ import { Fn, nodeObject, vec2, vec4 } from '../tsl/TSLBase.js';
4
4
  import { NodeUpdateType } from '../core/constants.js';
5
5
  import { uniform } from '../core/UniformNode.js';
6
6
  import { clamp } from '../math/MathNode.js';
7
+ import { convertToTexture } from '../utils/RTTNode.js';
7
8
 
8
9
  class DepthOfFieldNode extends TempNode {
9
10
 
11
+ static get type() {
12
+
13
+ return 'DepthOfFieldNode';
14
+
15
+ }
16
+
10
17
  constructor( textureNode, viewZNode, focusNode, apertureNode, maxblurNode ) {
11
18
 
12
19
  super();
@@ -39,7 +46,7 @@ class DepthOfFieldNode extends TempNode {
39
46
 
40
47
  const sampleTexture = ( uv ) => textureNode.uv( uv );
41
48
 
42
- const dof = tslFn( () => {
49
+ const dof = Fn( () => {
43
50
 
44
51
  const aspectcorrect = vec2( 1.0, this._aspect );
45
52
 
@@ -112,8 +119,6 @@ class DepthOfFieldNode extends TempNode {
112
119
 
113
120
  }
114
121
 
115
- export const dof = ( node, viewZNode, focus = 1, aperture = 0.025, maxblur = 1 ) => nodeObject( new DepthOfFieldNode( nodeObject( node ).toTexture(), nodeObject( viewZNode ), nodeObject( focus ), nodeObject( aperture ), nodeObject( maxblur ) ) );
116
-
117
- addNodeElement( 'dof', dof );
118
-
119
122
  export default DepthOfFieldNode;
123
+
124
+ export const dof = ( node, viewZNode, focus = 1, aperture = 0.025, maxblur = 1 ) => nodeObject( new DepthOfFieldNode( convertToTexture( node ), nodeObject( viewZNode ), nodeObject( focus ), nodeObject( aperture ), nodeObject( maxblur ) ) );
@@ -1,15 +1,21 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { nodeObject, addNodeElement, tslFn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
2
+ import { nodeObject, Fn, vec2, vec3, vec4 } from '../tsl/TSLBase.js';
3
3
  import { uniform } from '../core/UniformNode.js';
4
- import { NodeUpdateType } from '../core/constants.js';
5
- import { uv } from '../accessors/UVNode.js';
4
+ import { uv } from '../accessors/UV.js';
6
5
  import { sin, cos } from '../math/MathNode.js';
7
6
  import { add } from '../math/OperatorNode.js';
7
+ import { screenSize } from './ScreenNode.js';
8
8
 
9
9
  import { Vector2 } from '../../math/Vector2.js';
10
10
 
11
11
  class DotScreenNode extends TempNode {
12
12
 
13
+ static get type() {
14
+
15
+ return 'DotScreenNode';
16
+
17
+ }
18
+
13
19
  constructor( inputNode, center = new Vector2( 0.5, 0.5 ), angle = 1.57, scale = 1 ) {
14
20
 
15
21
  super( 'vec4' );
@@ -19,37 +25,25 @@ class DotScreenNode extends TempNode {
19
25
  this.angle = uniform( angle );
20
26
  this.scale = uniform( scale );
21
27
 
22
- this._size = uniform( new Vector2() );
23
-
24
- this.updateBeforeType = NodeUpdateType.RENDER;
25
-
26
- }
27
-
28
- updateBefore( frame ) {
29
-
30
- const { renderer } = frame;
31
-
32
- renderer.getDrawingBufferSize( this._size.value );
33
-
34
28
  }
35
29
 
36
30
  setup() {
37
31
 
38
32
  const inputNode = this.inputNode;
39
33
 
40
- const pattern = tslFn( () => {
34
+ const pattern = Fn( () => {
41
35
 
42
36
  const s = sin( this.angle );
43
37
  const c = cos( this.angle );
44
38
 
45
- const tex = uv().mul( this._size ).sub( this.center );
39
+ const tex = uv().mul( screenSize ).sub( this.center );
46
40
  const point = vec2( c.mul( tex.x ).sub( s.mul( tex.y ) ), s.mul( tex.x ).add( c.mul( tex.y ) ) ).mul( this.scale );
47
41
 
48
42
  return sin( point.x ).mul( sin( point.y ) ).mul( 4 );
49
43
 
50
44
  } );
51
45
 
52
- const dotScreen = tslFn( () => {
46
+ const dotScreen = Fn( () => {
53
47
 
54
48
  const color = inputNode;
55
49
 
@@ -67,9 +61,6 @@ class DotScreenNode extends TempNode {
67
61
 
68
62
  }
69
63
 
70
- export const dotScreen = ( node, center, angle, scale ) => nodeObject( new DotScreenNode( nodeObject( node ), center, angle, scale ) );
71
-
72
- addNodeElement( 'dotScreen', dotScreen );
73
-
74
64
  export default DotScreenNode;
75
65
 
66
+ export const dotScreen = ( node, center, angle, scale ) => nodeObject( new DotScreenNode( nodeObject( node ), center, angle, scale ) );
@@ -1,16 +1,23 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { uv } from '../accessors/UVNode.js';
3
- import { addNodeElement, tslFn, nodeObject, float, vec2, vec4, int, If } from '../shadernode/ShaderNode.js';
2
+ import { uv } from '../accessors/UV.js';
3
+ import { Fn, nodeObject, float, vec2, vec4, int, If } from '../tsl/TSLBase.js';
4
4
  import { NodeUpdateType } from '../core/constants.js';
5
5
  import { uniform } from '../core/UniformNode.js';
6
6
  import { abs, max, min, mix, pow } from '../math/MathNode.js';
7
7
  import { sub } from '../math/OperatorNode.js';
8
- import { loop, Break } from '../utils/LoopNode.js';
8
+ import { Loop, Break } from '../utils/LoopNode.js';
9
+ import { convertToTexture } from '../utils/RTTNode.js';
9
10
 
10
11
  import { Vector2 } from '../../math/Vector2.js';
11
12
 
12
13
  class FXAANode extends TempNode {
13
14
 
15
+ static get type() {
16
+
17
+ return 'FXAANode';
18
+
19
+ }
20
+
14
21
  constructor( textureNode ) {
15
22
 
16
23
  super();
@@ -77,7 +84,7 @@ class FXAANode extends TempNode {
77
84
 
78
85
  const NUM_SAMPLES = int( 5 );
79
86
 
80
- const contrast = tslFn( ( [ a_immutable, b_immutable ] ) => {
87
+ const contrast = Fn( ( [ a_immutable, b_immutable ] ) => {
81
88
 
82
89
  // assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
83
90
 
@@ -91,7 +98,7 @@ class FXAANode extends TempNode {
91
98
 
92
99
  // FXAA3 QUALITY - PC
93
100
 
94
- const FxaaPixelShader = tslFn( ( [ uv, fxaaQualityRcpFrame, fxaaQualityEdgeThreshold, fxaaQualityinvEdgeThreshold ] ) => {
101
+ const FxaaPixelShader = Fn( ( [ uv, fxaaQualityRcpFrame, fxaaQualityEdgeThreshold, fxaaQualityinvEdgeThreshold ] ) => {
95
102
 
96
103
  const rgbaM = FxaaTexTop( uv ).toVar();
97
104
  const rgbaS = FxaaTexOff( uv, vec2( 0.0, - 1.0 ), fxaaQualityRcpFrame.xy ).toVar();
@@ -130,8 +137,8 @@ class FXAANode extends TempNode {
130
137
 
131
138
  // locate the edge
132
139
 
133
- const x = contrastE.greaterThan( contrastW ).cond( 1, - 1 ).toVar();
134
- const y = contrastS.greaterThan( contrastN ).cond( 1, - 1 ).toVar();
140
+ const x = contrastE.greaterThan( contrastW ).select( 1, - 1 ).toVar();
141
+ const y = contrastS.greaterThan( contrastN ).select( 1, - 1 ).toVar();
135
142
 
136
143
  const dirToEdge = vec2( x, y ).toVar();
137
144
  // . 2 . . 1 .
@@ -184,7 +191,7 @@ class FXAANode extends TempNode {
184
191
  offNP.x.assign( 0 );
185
192
  offNP.y.assign( fxaaQualityRcpFrame.y );
186
193
 
187
- } ).else( () => {
194
+ } ).Else( () => {
188
195
 
189
196
  offNP.x.assign( fxaaQualityRcpFrame.x );
190
197
  offNP.y.assign( 0 );
@@ -212,7 +219,7 @@ class FXAANode extends TempNode {
212
219
  const iterationsUsedN = int( 0 ).toVar();
213
220
  const iterationsUsedP = int( 0 ).toVar();
214
221
 
215
- loop( NUM_SAMPLES, ( { i } ) => {
222
+ Loop( NUM_SAMPLES, ( { i } ) => {
216
223
 
217
224
  const increment = i.add( 1 ).toVar();
218
225
 
@@ -233,7 +240,7 @@ class FXAANode extends TempNode {
233
240
 
234
241
  iterationsUsedN.assign( i );
235
242
 
236
- } );
243
+ } );
237
244
 
238
245
  If( doneP.equal( 0 ), () => {
239
246
 
@@ -252,7 +259,7 @@ class FXAANode extends TempNode {
252
259
 
253
260
  iterationsUsedP.assign( i );
254
261
 
255
- } );
262
+ } );
256
263
 
257
264
  If( doneN.equal( 1 ).or( doneP.equal( 1 ) ), () => {
258
265
 
@@ -303,7 +310,7 @@ class FXAANode extends TempNode {
303
310
  ]
304
311
  } );
305
312
 
306
- const fxaa = tslFn( () => {
313
+ const fxaa = Fn( () => {
307
314
 
308
315
  const edgeDetectionQuality = float( 0.2 );
309
316
  const invEdgeDetectionQuality = float( 1 ).div( edgeDetectionQuality );
@@ -320,8 +327,6 @@ class FXAANode extends TempNode {
320
327
 
321
328
  }
322
329
 
323
- export const fxaa = ( node ) => nodeObject( new FXAANode( nodeObject( node ).toTexture() ) );
324
-
325
- addNodeElement( 'fxaa', fxaa );
326
-
327
330
  export default FXAANode;
331
+
332
+ export const fxaa = ( node ) => nodeObject( new FXAANode( convertToTexture( node ) ) );
@@ -1,11 +1,17 @@
1
1
  import TempNode from '../core/TempNode.js';
2
- import { uv } from '../accessors/UVNode.js';
3
- import { addNodeElement, tslFn, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
2
+ import { uv } from '../accessors/UV.js';
3
+ import { Fn, nodeProxy, vec4 } from '../tsl/TSLBase.js';
4
4
  import { mix, fract, clamp, rand } from '../math/MathNode.js';
5
5
  import { timerLocal } from '../utils/TimerNode.js';
6
6
 
7
7
  class FilmNode extends TempNode {
8
8
 
9
+ static get type() {
10
+
11
+ return 'FilmNode';
12
+
13
+ }
14
+
9
15
  constructor( inputNode, intensityNode = null, uvNode = null ) {
10
16
 
11
17
  super();
@@ -20,7 +26,7 @@ class FilmNode extends TempNode {
20
26
 
21
27
  const uvNode = this.uvNode || uv();
22
28
 
23
- const film = tslFn( () => {
29
+ const film = Fn( () => {
24
30
 
25
31
  const base = this.inputNode.rgb;
26
32
  const noise = rand( fract( uvNode.add( timerLocal() ) ) );
@@ -45,8 +51,6 @@ class FilmNode extends TempNode {
45
51
 
46
52
  }
47
53
 
48
- export const film = nodeProxy( FilmNode );
49
-
50
- addNodeElement( 'film', film );
51
-
52
54
  export default FilmNode;
55
+
56
+ export const film = /*@__PURE__*/ nodeProxy( FilmNode );
@@ -1,10 +1,16 @@
1
- import Node, { addNodeClass } from '../core/Node.js';
2
- import { nodeImmutable, float } from '../shadernode/ShaderNode.js';
1
+ import Node from '../core/Node.js';
2
+ import { nodeImmutable, float } from '../tsl/TSLBase.js';
3
3
 
4
4
  import { BackSide, WebGLCoordinateSystem } from '../../constants.js';
5
5
 
6
6
  class FrontFacingNode extends Node {
7
7
 
8
+ static get type() {
9
+
10
+ return 'FrontFacingNode';
11
+
12
+ }
13
+
8
14
  constructor() {
9
15
 
10
16
  super( 'bool' );
@@ -35,7 +41,5 @@ class FrontFacingNode extends Node {
35
41
 
36
42
  export default FrontFacingNode;
37
43
 
38
- export const frontFacing = nodeImmutable( FrontFacingNode );
39
- export const faceDirection = float( frontFacing ).mul( 2.0 ).sub( 1.0 );
40
-
41
- addNodeClass( 'FrontFacingNode', FrontFacingNode );
44
+ export const frontFacing = /*@__PURE__*/ nodeImmutable( FrontFacingNode );
45
+ export const faceDirection = /*@__PURE__*/ float( frontFacing ).mul( 2.0 ).sub( 1.0 );