super-three 0.167.0 → 0.168.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 (311) hide show
  1. package/build/three.cjs +165 -44
  2. package/build/three.module.js +165 -45
  3. package/build/three.module.min.js +1 -1
  4. package/build/three.webgpu.js +23600 -21931
  5. package/build/three.webgpu.min.js +1 -1
  6. package/examples/jsm/Addons.js +3 -1
  7. package/examples/jsm/animation/AnimationClipCreator.js +1 -1
  8. package/examples/jsm/capabilities/WebGL.js +27 -21
  9. package/examples/jsm/controls/ArcballControls.js +174 -158
  10. package/examples/jsm/controls/DragControls.js +260 -132
  11. package/examples/jsm/controls/FirstPersonControls.js +175 -163
  12. package/examples/jsm/controls/FlyControls.js +194 -188
  13. package/examples/jsm/controls/OrbitControls.js +777 -786
  14. package/examples/jsm/controls/PointerLockControls.js +24 -15
  15. package/examples/jsm/controls/TrackballControls.js +453 -452
  16. package/examples/jsm/effects/AnaglyphEffect.js +6 -13
  17. package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
  18. package/examples/jsm/effects/StereoEffect.js +6 -1
  19. package/examples/jsm/environments/RoomEnvironment.js +1 -1
  20. package/examples/jsm/exporters/GLTFExporter.js +6 -1
  21. package/examples/jsm/exporters/USDZExporter.js +29 -8
  22. package/examples/jsm/helpers/LightProbeHelper.js +42 -43
  23. package/examples/jsm/loaders/KTX2Loader.js +19 -7
  24. package/examples/jsm/loaders/MaterialXLoader.js +11 -4
  25. package/examples/jsm/loaders/PCDLoader.js +9 -9
  26. package/examples/jsm/objects/SkyMesh.js +188 -0
  27. package/examples/jsm/objects/Water2Mesh.js +159 -0
  28. package/examples/jsm/objects/WaterMesh.js +102 -0
  29. package/examples/jsm/physics/RapierPhysics.js +20 -0
  30. package/examples/jsm/postprocessing/OutlinePass.js +31 -46
  31. package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
  32. package/examples/jsm/shaders/BleachBypassShader.js +1 -2
  33. package/examples/jsm/shaders/OutputShader.js +1 -1
  34. package/examples/jsm/transpiler/TSLEncoder.js +8 -8
  35. package/examples/jsm/utils/TextureUtils.js +1 -1
  36. package/package.json +2 -1
  37. package/src/Three.WebGPU.js +6 -0
  38. package/src/Three.js +1 -0
  39. package/src/constants.js +1 -1
  40. package/src/extras/Controls.js +32 -0
  41. package/src/loaders/ObjectLoader.js +3 -3
  42. package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
  43. package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
  44. package/src/materials/Material.js +4 -7
  45. package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
  46. package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
  47. package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
  48. package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
  49. package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
  50. package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
  51. package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
  52. package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
  53. package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
  54. package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
  55. package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
  56. package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
  57. package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
  58. package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
  59. package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
  60. package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
  61. package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
  62. package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
  63. package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
  64. package/src/nodes/Nodes.js +103 -159
  65. package/src/nodes/TSL.js +176 -0
  66. package/src/nodes/accessors/AccessorsUtils.js +8 -8
  67. package/src/nodes/accessors/BatchNode.js +48 -20
  68. package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
  69. package/src/nodes/accessors/BufferAttributeNode.js +5 -5
  70. package/src/nodes/accessors/BufferNode.js +4 -4
  71. package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
  72. package/src/nodes/accessors/ClippingNode.js +16 -14
  73. package/src/nodes/accessors/CubeTextureNode.js +5 -7
  74. package/src/nodes/accessors/InstanceNode.js +17 -13
  75. package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
  76. package/src/nodes/accessors/MaterialNode.js +52 -55
  77. package/src/nodes/accessors/MaterialProperties.js +3 -0
  78. package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
  79. package/src/nodes/accessors/ModelNode.js +11 -11
  80. package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
  81. package/src/nodes/accessors/MorphNode.js +12 -12
  82. package/src/nodes/accessors/Normal.js +62 -0
  83. package/src/nodes/accessors/Object3DNode.js +10 -10
  84. package/src/nodes/accessors/PointUVNode.js +4 -4
  85. package/src/nodes/accessors/Position.js +10 -0
  86. package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
  87. package/src/nodes/accessors/ReferenceNode.js +13 -7
  88. package/src/nodes/accessors/ReflectVector.js +10 -0
  89. package/src/nodes/accessors/RendererReferenceNode.js +6 -6
  90. package/src/nodes/accessors/SceneNode.js +5 -6
  91. package/src/nodes/accessors/SkinningNode.js +84 -21
  92. package/src/nodes/accessors/StorageBufferNode.js +4 -5
  93. package/src/nodes/accessors/StorageTextureNode.js +5 -5
  94. package/src/nodes/accessors/Tangent.js +22 -0
  95. package/src/nodes/accessors/Texture3DNode.js +11 -11
  96. package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
  97. package/src/nodes/accessors/TextureNode.js +16 -21
  98. package/src/nodes/accessors/TextureSizeNode.js +4 -6
  99. package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
  100. package/src/nodes/accessors/UserDataNode.js +4 -4
  101. package/src/nodes/accessors/VelocityNode.js +83 -0
  102. package/src/nodes/accessors/VertexColorNode.js +4 -4
  103. package/src/nodes/code/CodeNode.js +5 -5
  104. package/src/nodes/code/ExpressionNode.js +4 -4
  105. package/src/nodes/code/FunctionCallNode.js +5 -5
  106. package/src/nodes/code/FunctionNode.js +5 -23
  107. package/src/nodes/code/ScriptableNode.js +4 -6
  108. package/src/nodes/code/ScriptableValueNode.js +4 -6
  109. package/src/nodes/core/AssignNode.js +5 -5
  110. package/src/nodes/core/AttributeNode.js +7 -20
  111. package/src/nodes/core/BypassNode.js +5 -5
  112. package/src/nodes/core/CacheNode.js +5 -5
  113. package/src/nodes/core/ConstNode.js +2 -2
  114. package/src/nodes/core/ContextNode.js +17 -11
  115. package/src/nodes/core/IndexNode.js +12 -7
  116. package/src/nodes/core/InputNode.js +2 -2
  117. package/src/nodes/core/MRTNode.js +12 -6
  118. package/src/nodes/core/Node.js +39 -19
  119. package/src/nodes/core/NodeBuilder.js +46 -33
  120. package/src/nodes/core/NodeUtils.js +1 -0
  121. package/src/nodes/core/OutputStructNode.js +4 -4
  122. package/src/nodes/core/ParameterNode.js +4 -4
  123. package/src/nodes/core/PropertyNode.js +32 -32
  124. package/src/nodes/core/StackNode.js +26 -10
  125. package/src/nodes/core/StructTypeNode.js +2 -2
  126. package/src/nodes/core/TempNode.js +2 -2
  127. package/src/nodes/core/UniformGroupNode.js +8 -9
  128. package/src/nodes/core/UniformNode.js +4 -4
  129. package/src/nodes/core/VarNode.js +6 -6
  130. package/src/nodes/core/VaryingNode.js +5 -5
  131. package/src/nodes/display/AfterImageNode.js +9 -9
  132. package/src/nodes/display/AnaglyphPassNode.js +61 -0
  133. package/src/nodes/display/AnamorphicNode.js +11 -11
  134. package/src/nodes/display/BleachBypass.js +26 -0
  135. package/src/nodes/display/BlendMode.js +54 -0
  136. package/src/nodes/display/BloomNode.js +21 -19
  137. package/src/nodes/display/BumpMapNode.js +7 -12
  138. package/src/nodes/display/ColorAdjustment.js +46 -0
  139. package/src/nodes/display/ColorSpaceFunctions.js +38 -0
  140. package/src/nodes/display/ColorSpaceNode.js +40 -63
  141. package/src/nodes/display/DenoiseNode.js +20 -17
  142. package/src/nodes/display/DepthOfFieldNode.js +8 -6
  143. package/src/nodes/display/DotScreenNode.js +10 -22
  144. package/src/nodes/display/FXAANode.js +17 -15
  145. package/src/nodes/display/FilmNode.js +7 -6
  146. package/src/nodes/display/FrontFacingNode.js +5 -5
  147. package/src/nodes/display/GTAONode.js +19 -15
  148. package/src/nodes/display/GaussianBlurNode.js +11 -8
  149. package/src/nodes/display/Lut3DNode.js +6 -5
  150. package/src/nodes/display/MotionBlur.js +25 -0
  151. package/src/nodes/display/NormalMapNode.js +8 -10
  152. package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
  153. package/src/nodes/display/PassNode.js +84 -8
  154. package/src/nodes/display/PixelationPassNode.js +12 -7
  155. package/src/nodes/display/PosterizeNode.js +4 -6
  156. package/src/nodes/display/RGBShiftNode.js +8 -7
  157. package/src/nodes/display/RenderOutputNode.js +9 -9
  158. package/src/nodes/display/SSAAPassNode.js +284 -0
  159. package/src/nodes/display/Sepia.js +17 -0
  160. package/src/nodes/display/SobelOperatorNode.js +9 -7
  161. package/src/nodes/display/StereoCompositePassNode.js +107 -0
  162. package/src/nodes/display/StereoPassNode.js +80 -0
  163. package/src/nodes/display/ToneMappingFunctions.js +190 -0
  164. package/src/nodes/display/ToneMappingNode.js +12 -173
  165. package/src/nodes/display/TransitionNode.js +9 -8
  166. package/src/nodes/display/ViewportDepthNode.js +30 -29
  167. package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
  168. package/src/nodes/display/ViewportNode.js +26 -25
  169. package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
  170. package/src/nodes/display/ViewportTextureNode.js +7 -10
  171. package/src/nodes/fog/FogExp2Node.js +4 -6
  172. package/src/nodes/fog/FogNode.js +5 -7
  173. package/src/nodes/fog/FogRangeNode.js +4 -6
  174. package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
  175. package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  176. package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
  177. package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
  178. package/src/nodes/functions/BSDF/D_GGX.js +2 -2
  179. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
  180. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  181. package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
  182. package/src/nodes/functions/BSDF/LTC.js +6 -6
  183. package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
  184. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
  185. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
  186. package/src/nodes/functions/BasicLightingModel.js +1 -1
  187. package/src/nodes/functions/PhongLightingModel.js +5 -5
  188. package/src/nodes/functions/PhysicalLightingModel.js +32 -31
  189. package/src/nodes/functions/ShadowMaskModel.js +1 -1
  190. package/src/nodes/functions/ToonLightingModel.js +3 -3
  191. package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
  192. package/src/nodes/functions/material/getRoughness.js +2 -2
  193. package/src/nodes/geometry/RangeNode.js +4 -4
  194. package/src/nodes/gpgpu/ComputeNode.js +5 -5
  195. package/src/nodes/lighting/AONode.js +2 -2
  196. package/src/nodes/lighting/AmbientLightNode.js +2 -7
  197. package/src/nodes/lighting/AnalyticLightNode.js +34 -13
  198. package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
  199. package/src/nodes/lighting/BasicLightMapNode.js +3 -3
  200. package/src/nodes/lighting/DirectionalLightNode.js +2 -7
  201. package/src/nodes/lighting/EnvironmentNode.js +20 -19
  202. package/src/nodes/lighting/HemisphereLightNode.js +3 -7
  203. package/src/nodes/lighting/IESSpotLightNode.js +3 -8
  204. package/src/nodes/lighting/IrradianceNode.js +2 -2
  205. package/src/nodes/lighting/LightNode.js +5 -5
  206. package/src/nodes/lighting/LightProbeNode.js +76 -0
  207. package/src/nodes/lighting/LightUtils.js +3 -3
  208. package/src/nodes/lighting/LightingContextNode.js +15 -17
  209. package/src/nodes/lighting/LightingNode.js +2 -2
  210. package/src/nodes/lighting/LightsNode.js +94 -76
  211. package/src/nodes/lighting/PointLightNode.js +3 -8
  212. package/src/nodes/lighting/RectAreaLightNode.js +2 -6
  213. package/src/nodes/lighting/SpotLightNode.js +3 -8
  214. package/src/nodes/materialx/MaterialXNodes.js +2 -2
  215. package/src/nodes/materialx/lib/mx_hsv.js +36 -31
  216. package/src/nodes/materialx/lib/mx_noise.js +96 -96
  217. package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
  218. package/src/nodes/math/{CondNode.js → ConditionalNode.js} +18 -7
  219. package/src/nodes/math/Hash.js +13 -0
  220. package/src/nodes/math/MathNode.js +124 -124
  221. package/src/nodes/math/MathUtils.js +0 -7
  222. package/src/nodes/math/OperatorNode.js +94 -52
  223. package/src/nodes/math/TriNoise3D.js +19 -29
  224. package/src/nodes/pmrem/PMREMNode.js +58 -15
  225. package/src/nodes/pmrem/PMREMUtils.js +46 -46
  226. package/src/nodes/procedural/Checker.js +14 -0
  227. package/src/nodes/tsl/TSLBase.js +30 -0
  228. package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
  229. package/src/nodes/utils/ArrayElementNode.js +2 -2
  230. package/src/nodes/utils/ConvertNode.js +2 -2
  231. package/src/nodes/utils/CubeMapNode.js +157 -0
  232. package/src/nodes/utils/Discard.js +8 -0
  233. package/src/nodes/utils/EquirectUVNode.js +5 -5
  234. package/src/nodes/utils/FlipNode.js +65 -0
  235. package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
  236. package/src/nodes/utils/JoinNode.js +2 -2
  237. package/src/nodes/utils/LoopNode.js +12 -6
  238. package/src/nodes/utils/MatcapUVNode.js +6 -6
  239. package/src/nodes/utils/MaxMipLevelNode.js +4 -4
  240. package/src/nodes/utils/OscNode.js +7 -7
  241. package/src/nodes/utils/Packing.js +4 -0
  242. package/src/nodes/utils/RTTNode.js +8 -8
  243. package/src/nodes/utils/ReflectorNode.js +8 -3
  244. package/src/nodes/utils/RemapNode.js +7 -7
  245. package/src/nodes/utils/RotateNode.js +4 -12
  246. package/src/nodes/utils/SetNode.js +2 -2
  247. package/src/nodes/utils/SplitNode.js +2 -2
  248. package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
  249. package/src/nodes/utils/SpriteUtils.js +47 -0
  250. package/src/nodes/utils/StorageArrayElementNode.js +4 -6
  251. package/src/nodes/utils/TimerNode.js +5 -5
  252. package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
  253. package/src/nodes/utils/UVUtils.js +19 -0
  254. package/src/nodes/utils/ViewportUtils.js +14 -0
  255. package/src/objects/BatchedMesh.js +2 -3
  256. package/src/renderers/WebGLRenderer.js +24 -0
  257. package/src/renderers/common/Backend.js +2 -2
  258. package/src/renderers/common/Background.js +3 -1
  259. package/src/renderers/common/BindGroup.js +3 -1
  260. package/src/renderers/common/Bindings.js +13 -15
  261. package/src/renderers/common/ClippingContext.js +14 -5
  262. package/src/renderers/common/CubeRenderTarget.js +9 -3
  263. package/src/renderers/common/PostProcessing.js +4 -1
  264. package/src/renderers/common/QuadMesh.js +2 -0
  265. package/src/renderers/common/RenderContext.js +24 -0
  266. package/src/renderers/common/RenderList.js +1 -1
  267. package/src/renderers/common/RenderObject.js +2 -2
  268. package/src/renderers/common/Renderer.js +75 -49
  269. package/src/renderers/common/SampledTexture.js +12 -3
  270. package/src/renderers/common/StandardRenderer.js +18 -0
  271. package/src/renderers/common/Textures.js +8 -12
  272. package/src/renderers/common/extras/PMREMGenerator.js +12 -13
  273. package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
  274. package/src/renderers/common/nodes/NodeLibrary.js +118 -0
  275. package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
  276. package/src/renderers/common/nodes/Nodes.js +36 -9
  277. package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
  278. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
  279. package/src/renderers/webgl/WebGLProgram.js +1 -1
  280. package/src/renderers/webgl/WebGLProperties.js +7 -0
  281. package/src/renderers/webgl/WebGLTextures.js +61 -4
  282. package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
  283. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
  284. package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
  285. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
  286. package/src/renderers/webgpu/WebGPUBackend.js +86 -68
  287. package/src/renderers/webgpu/WebGPURenderer.js +8 -8
  288. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
  289. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
  290. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
  291. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +6 -15
  292. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
  293. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
  294. package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
  295. package/src/renderers/webxr/WebXRManager.js +32 -25
  296. package/examples/jsm/loaders/LogLuvLoader.js +0 -606
  297. package/src/nodes/accessors/NormalNode.js +0 -14
  298. package/src/nodes/accessors/PositionNode.js +0 -10
  299. package/src/nodes/accessors/ReflectVectorNode.js +0 -10
  300. package/src/nodes/accessors/TangentNode.js +0 -23
  301. package/src/nodes/core/NodeKeywords.js +0 -80
  302. package/src/nodes/display/BlendModeNode.js +0 -128
  303. package/src/nodes/display/ColorAdjustmentNode.js +0 -104
  304. package/src/nodes/materials/MeshNormalNodeMaterial.js +0 -40
  305. package/src/nodes/math/HashNode.js +0 -34
  306. package/src/nodes/procedural/CheckerNode.js +0 -42
  307. package/src/nodes/utils/DiscardNode.js +0 -28
  308. package/src/nodes/utils/PackingNode.js +0 -55
  309. package/src/nodes/utils/RotateUVNode.js +0 -35
  310. /package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
  311. /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
@@ -1,15 +1,15 @@
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 { viewportUV } from './ViewportNode.js';
5
4
 
6
5
  import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
6
+ import { registerNode } from '../core/Node.js';
7
7
 
8
8
  let _sharedFramebuffer = null;
9
9
 
10
10
  class ViewportSharedTextureNode extends ViewportTextureNode {
11
11
 
12
- constructor( uvNode = viewportTopLeft, levelNode = null ) {
12
+ constructor( uvNode = viewportUV, levelNode = null ) {
13
13
 
14
14
  if ( _sharedFramebuffer === null ) {
15
15
 
@@ -31,8 +31,6 @@ class ViewportSharedTextureNode extends ViewportTextureNode {
31
31
 
32
32
  export default ViewportSharedTextureNode;
33
33
 
34
- export const viewportSharedTexture = nodeProxy( ViewportSharedTextureNode );
34
+ ViewportSharedTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportSharedTexture', ViewportSharedTextureNode );
35
35
 
36
- addNodeElement( 'viewportSharedTexture', viewportSharedTexture );
37
-
38
- addNodeClass( 'ViewportSharedTextureNode', ViewportSharedTextureNode );
36
+ export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode );
@@ -1,8 +1,8 @@
1
+ import { registerNode } from '../core/Node.js';
1
2
  import TextureNode from '../accessors/TextureNode.js';
2
3
  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';
4
+ import { nodeProxy } from '../tsl/TSLBase.js';
5
+ import { viewportUV } from './ViewportNode.js';
6
6
 
7
7
  import { Vector2 } from '../../math/Vector2.js';
8
8
  import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
@@ -12,7 +12,7 @@ const _size = /*@__PURE__*/ new Vector2();
12
12
 
13
13
  class ViewportTextureNode extends TextureNode {
14
14
 
15
- constructor( uvNode = viewportTopLeft, levelNode = null, framebufferTexture = null ) {
15
+ constructor( uvNode = viewportUV, levelNode = null, framebufferTexture = null ) {
16
16
 
17
17
  if ( framebufferTexture === null ) {
18
18
 
@@ -72,10 +72,7 @@ class ViewportTextureNode extends TextureNode {
72
72
 
73
73
  export default ViewportTextureNode;
74
74
 
75
- export const viewportTexture = nodeProxy( ViewportTextureNode );
76
- export const viewportMipTexture = nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
75
+ ViewportTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportTexture', ViewportTextureNode );
77
76
 
78
- addNodeElement( 'viewportTexture', viewportTexture );
79
- addNodeElement( 'viewportMipTexture', viewportMipTexture );
80
-
81
- addNodeClass( 'ViewportTextureNode', ViewportTextureNode );
77
+ export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode );
78
+ export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
@@ -1,6 +1,6 @@
1
+ import { registerNode } from '../core/Node.js';
1
2
  import FogNode from './FogNode.js';
2
- import { addNodeClass } from '../core/Node.js';
3
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
3
+ import { nodeProxy } from '../tsl/TSLBase.js';
4
4
 
5
5
  class FogExp2Node extends FogNode {
6
6
 
@@ -27,8 +27,6 @@ class FogExp2Node extends FogNode {
27
27
 
28
28
  export default FogExp2Node;
29
29
 
30
- export const densityFog = nodeProxy( FogExp2Node );
30
+ FogExp2Node.type = /*@__PURE__*/ registerNode( 'FogExp2', FogExp2Node );
31
31
 
32
- addNodeElement( 'densityFog', densityFog );
33
-
34
- addNodeClass( 'FogExp2Node', FogExp2Node );
32
+ export const densityFog = /*@__PURE__*/ nodeProxy( FogExp2Node );
@@ -1,6 +1,6 @@
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, { registerNode } 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
 
@@ -41,8 +41,6 @@ class FogNode extends Node {
41
41
 
42
42
  export default FogNode;
43
43
 
44
- export const fog = nodeProxy( FogNode );
44
+ FogNode.type = /*@__PURE__*/ registerNode( 'Fog', FogNode );
45
45
 
46
- addNodeElement( 'fog', fog );
47
-
48
- addNodeClass( 'FogNode', FogNode );
46
+ export const fog = /*@__PURE__*/ nodeProxy( FogNode );
@@ -1,7 +1,7 @@
1
+ import { registerNode } from '../core/Node.js';
1
2
  import FogNode from './FogNode.js';
2
3
  import { smoothstep } from '../math/MathNode.js';
3
- import { addNodeClass } from '../core/Node.js';
4
- import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
4
+ import { nodeProxy } from '../tsl/TSLBase.js';
5
5
 
6
6
  class FogRangeNode extends FogNode {
7
7
 
@@ -28,8 +28,6 @@ class FogRangeNode extends FogNode {
28
28
 
29
29
  export default FogRangeNode;
30
30
 
31
- export const rangeFog = nodeProxy( FogRangeNode );
31
+ FogRangeNode.type = /*@__PURE__*/ registerNode( 'FogRange', FogRangeNode );
32
32
 
33
- addNodeElement( 'rangeFog', rangeFog );
34
-
35
- addNodeClass( 'FogRangeNode', FogRangeNode );
33
+ 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
 
@@ -8,23 +8,24 @@ import BRDF_Sheen from './BSDF/BRDF_Sheen.js';
8
8
  import { LTC_Evaluate, LTC_Uv } from './BSDF/LTC.js';
9
9
  import LightingModel from '../core/LightingModel.js';
10
10
  import { diffuseColor, specularColor, specularF90, roughness, clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, ior, thickness, transmission, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
11
- import { transformedNormalView, transformedClearcoatNormalView, transformedNormalWorld } from '../accessors/NormalNode.js';
12
- import { positionViewDirection, positionView, positionWorld } from '../accessors/PositionNode.js';
13
- import { tslFn, float, vec2, vec3, vec4, mat3, If } from '../shadernode/ShaderNode.js';
14
- import { cond } from '../math/CondNode.js';
11
+ import { transformedNormalView, transformedClearcoatNormalView, transformedNormalWorld } from '../accessors/Normal.js';
12
+ import { positionViewDirection, positionView, positionWorld } from '../accessors/Position.js';
13
+ import { Fn, float, vec2, vec3, vec4, mat3, If } from '../tsl/TSLBase.js';
14
+ import { select } from '../math/ConditionalNode.js';
15
15
  import { mix, normalize, refract, length, clamp, log2, log, exp, smoothstep } from '../math/MathNode.js';
16
16
  import { div } from '../math/OperatorNode.js';
17
- import { cameraPosition, cameraProjectionMatrix, cameraViewMatrix } from '../accessors/CameraNode.js';
17
+ import { cameraPosition, cameraProjectionMatrix, cameraViewMatrix } from '../accessors/Camera.js';
18
18
  import { modelWorldMatrix } from '../accessors/ModelNode.js';
19
19
  import { viewportResolution } from '../display/ViewportNode.js';
20
20
  import { viewportMipTexture } from '../display/ViewportTextureNode.js';
21
- import { loop } from '../utils/LoopNode.js';
21
+ import { textureBicubic } from '../accessors/TextureBicubic.js';
22
+ import { Loop } from '../utils/LoopNode.js';
22
23
 
23
24
  //
24
25
  // Transmission
25
26
  //
26
27
 
27
- const getVolumeTransmissionRay = tslFn( ( [ n, v, thickness, ior, modelMatrix ] ) => {
28
+ const getVolumeTransmissionRay = /*@__PURE__*/ Fn( ( [ n, v, thickness, ior, modelMatrix ] ) => {
28
29
 
29
30
  // Direction of refracted light.
30
31
  const refractionVector = vec3( refract( v.negate(), normalize( n ), div( 1.0, ior ) ) );
@@ -51,7 +52,7 @@ const getVolumeTransmissionRay = tslFn( ( [ n, v, thickness, ior, modelMatrix ]
51
52
  ]
52
53
  } );
53
54
 
54
- const applyIorToRoughness = tslFn( ( [ roughness, ior ] ) => {
55
+ const applyIorToRoughness = /*@__PURE__*/ Fn( ( [ roughness, ior ] ) => {
55
56
 
56
57
  // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
57
58
  // an IOR of 1.5 results in the default amount of microfacet refraction.
@@ -66,20 +67,20 @@ const applyIorToRoughness = tslFn( ( [ roughness, ior ] ) => {
66
67
  ]
67
68
  } );
68
69
 
69
- const singleViewportMipTexture = viewportMipTexture();
70
+ const singleViewportMipTexture = /*@__PURE__*/ viewportMipTexture();
70
71
 
71
- const getTransmissionSample = tslFn( ( [ fragCoord, roughness, ior ] ) => {
72
+ const getTransmissionSample = /*@__PURE__*/ Fn( ( [ fragCoord, roughness, ior ] ) => {
72
73
 
73
74
  const transmissionSample = singleViewportMipTexture.uv( fragCoord );
74
75
  //const transmissionSample = viewportMipTexture( fragCoord );
75
76
 
76
77
  const lod = log2( float( viewportResolution.x ) ).mul( applyIorToRoughness( roughness, ior ) );
77
78
 
78
- return transmissionSample.bicubic( lod );
79
+ return textureBicubic( transmissionSample, lod );
79
80
 
80
81
  } );
81
82
 
82
- const volumeAttenuation = tslFn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => {
83
+ const volumeAttenuation = /*@__PURE__*/ Fn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => {
83
84
 
84
85
  If( attenuationDistance.notEqual( 0 ), () => {
85
86
 
@@ -104,7 +105,7 @@ const volumeAttenuation = tslFn( ( [ transmissionDistance, attenuationColor, att
104
105
  ]
105
106
  } );
106
107
 
107
- const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => {
108
+ const getIBLVolumeRefraction = /*@__PURE__*/ Fn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => {
108
109
 
109
110
  let transmittedLight, transmittance;
110
111
 
@@ -116,7 +117,7 @@ const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specula
116
117
  const halfSpread = ior.sub( 1.0 ).mul( dispersion.mul( 0.025 ) );
117
118
  const iors = vec3( ior.sub( halfSpread ), ior, ior.add( halfSpread ) );
118
119
 
119
- loop( { start: 0, end: 3 }, ( { i } ) => {
120
+ Loop( { start: 0, end: 3 }, ( { i } ) => {
120
121
 
121
122
  const ior = iors.element( i );
122
123
 
@@ -184,7 +185,7 @@ const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specula
184
185
  //
185
186
 
186
187
  // XYZ to linear-sRGB color space
187
- const XYZ_TO_REC709 = mat3(
188
+ const XYZ_TO_REC709 = /*@__PURE__*/ mat3(
188
189
  3.2404542, - 0.9692660, 0.0556434,
189
190
  - 1.5371385, 1.8760108, - 0.2040259,
190
191
  - 0.4985314, 0.0415560, 1.0572252
@@ -227,7 +228,7 @@ const evalSensitivity = ( OPD, shift ) => {
227
228
 
228
229
  };
229
230
 
230
- const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => {
231
+ const evalIridescence = /*@__PURE__*/ Fn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => {
231
232
 
232
233
  // Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
233
234
  const iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
@@ -249,7 +250,7 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
249
250
  const R12 = F_Schlick( { f0: R0, f90: 1.0, dotVH: cosTheta1 } );
250
251
  //const R21 = R12;
251
252
  const T121 = R12.oneMinus();
252
- const phi12 = iridescenceIOR.lessThan( outsideIOR ).cond( Math.PI, 0.0 );
253
+ const phi12 = iridescenceIOR.lessThan( outsideIOR ).select( Math.PI, 0.0 );
253
254
  const phi21 = float( Math.PI ).sub( phi12 );
254
255
 
255
256
  // Second interface
@@ -257,9 +258,9 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
257
258
  const R1 = IorToFresnel0( baseIOR, iridescenceIOR.toVec3() );
258
259
  const R23 = F_Schlick( { f0: R1, f90: 1.0, dotVH: cosTheta2 } );
259
260
  const phi23 = vec3(
260
- baseIOR.x.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 ),
261
- baseIOR.y.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 ),
262
- baseIOR.z.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 )
261
+ baseIOR.x.lessThan( iridescenceIOR ).select( Math.PI, 0.0 ),
262
+ baseIOR.y.lessThan( iridescenceIOR ).select( Math.PI, 0.0 ),
263
+ baseIOR.z.lessThan( iridescenceIOR ).select( Math.PI, 0.0 )
263
264
  );
264
265
 
265
266
  // Phase shift
@@ -307,25 +308,25 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
307
308
  // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
308
309
  // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
309
310
  // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
310
- const IBLSheenBRDF = tslFn( ( { normal, viewDir, roughness } ) => {
311
+ const IBLSheenBRDF = /*@__PURE__*/ Fn( ( { normal, viewDir, roughness } ) => {
311
312
 
312
313
  const dotNV = normal.dot( viewDir ).saturate();
313
314
 
314
315
  const r2 = roughness.pow2();
315
316
 
316
- const a = cond(
317
+ const a = select(
317
318
  roughness.lessThan( 0.25 ),
318
319
  float( - 339.2 ).mul( r2 ).add( float( 161.4 ).mul( roughness ) ).sub( 25.9 ),
319
320
  float( - 8.48 ).mul( r2 ).add( float( 14.3 ).mul( roughness ) ).sub( 9.95 )
320
321
  );
321
322
 
322
- const b = cond(
323
+ const b = select(
323
324
  roughness.lessThan( 0.25 ),
324
325
  float( 44.0 ).mul( r2 ).sub( float( 23.7 ).mul( roughness ) ).add( 3.26 ),
325
326
  float( 1.97 ).mul( r2 ).sub( float( 3.27 ).mul( roughness ) ).add( 0.72 )
326
327
  );
327
328
 
328
- const DG = cond( roughness.lessThan( 0.25 ), 0.0, float( 0.1 ).mul( roughness ).sub( 0.025 ) ).add( a.mul( dotNV ).add( b ).exp() );
329
+ const DG = select( roughness.lessThan( 0.25 ), 0.0, float( 0.1 ).mul( roughness ).sub( 0.025 ) ).add( a.mul( dotNV ).add( b ).exp() );
329
330
 
330
331
  return DG.mul( 1.0 / Math.PI ).saturate();
331
332
 
@@ -363,16 +364,16 @@ class PhysicalLightingModel extends LightingModel {
363
364
 
364
365
  if ( this.clearcoat === true ) {
365
366
 
366
- this.clearcoatRadiance = vec3().temp( 'clearcoatRadiance' );
367
- this.clearcoatSpecularDirect = vec3().temp( 'clearcoatSpecularDirect' );
368
- this.clearcoatSpecularIndirect = vec3().temp( 'clearcoatSpecularIndirect' );
367
+ this.clearcoatRadiance = vec3().toVar( 'clearcoatRadiance' );
368
+ this.clearcoatSpecularDirect = vec3().toVar( 'clearcoatSpecularDirect' );
369
+ this.clearcoatSpecularIndirect = vec3().toVar( 'clearcoatSpecularIndirect' );
369
370
 
370
371
  }
371
372
 
372
373
  if ( this.sheen === true ) {
373
374
 
374
- this.sheenSpecularDirect = vec3().temp( 'sheenSpecularDirect' );
375
- this.sheenSpecularIndirect = vec3().temp( 'sheenSpecularIndirect' );
375
+ this.sheenSpecularDirect = vec3().toVar( 'sheenSpecularDirect' );
376
+ this.sheenSpecularIndirect = vec3().toVar( 'sheenSpecularIndirect' );
376
377
 
377
378
  }
378
379
 
@@ -553,8 +554,8 @@ class PhysicalLightingModel extends LightingModel {
553
554
 
554
555
  // Both indirect specular and indirect diffuse light accumulate here
555
556
 
556
- const singleScattering = vec3().temp( 'singleScattering' );
557
- const multiScattering = vec3().temp( 'multiScattering' );
557
+ const singleScattering = vec3().toVar( 'singleScattering' );
558
+ const multiScattering = vec3().toVar( 'multiScattering' );
558
559
  const cosineWeightedIrradiance = iblIrradiance.mul( 1 / Math.PI );
559
560
 
560
561
  this.computeMultiscattering( singleScattering, multiScattering, specularF90 );
@@ -1,6 +1,6 @@
1
1
  import LightingModel from '../core/LightingModel.js';
2
2
  import { diffuseColor } from '../core/PropertyNode.js';
3
- import { float } from '../shadernode/ShaderNode.js';
3
+ import { float } from '../tsl/TSLBase.js';
4
4
 
5
5
  class ShadowMaskModel extends LightingModel {
6
6
 
@@ -1,12 +1,12 @@
1
1
  import LightingModel from '../core/LightingModel.js';
2
2
  import BRDF_Lambert from './BSDF/BRDF_Lambert.js';
3
3
  import { diffuseColor } from '../core/PropertyNode.js';
4
- import { normalGeometry } from '../accessors/NormalNode.js';
5
- import { tslFn, float, vec2, vec3 } from '../shadernode/ShaderNode.js';
4
+ import { normalGeometry } from '../accessors/Normal.js';
5
+ import { Fn, float, vec2, vec3 } from '../tsl/TSLBase.js';
6
6
  import { mix, smoothstep } from '../math/MathNode.js';
7
7
  import { materialReference } from '../accessors/MaterialReferenceNode.js';
8
8
 
9
- const getGradientIrradiance = tslFn( ( { normal, lightDirection, builder } ) => {
9
+ const getGradientIrradiance = /*@__PURE__*/ Fn( ( { normal, lightDirection, builder } ) => {
10
10
 
11
11
  // dotNL will be from -1.0 to 1.0
12
12
  const dotNL = normal.dot( lightDirection );
@@ -1,9 +1,9 @@
1
- import { normalGeometry } from '../../accessors/NormalNode.js';
2
- import { tslFn } from '../../shadernode/ShaderNode.js';
1
+ import { normalView } from '../../accessors/Normal.js';
2
+ import { Fn } from '../../tsl/TSLBase.js';
3
3
 
4
- const getGeometryRoughness = tslFn( () => {
4
+ const getGeometryRoughness = /*@__PURE__*/ Fn( () => {
5
5
 
6
- const dxy = normalGeometry.dFdx().abs().max( normalGeometry.dFdy().abs() );
6
+ const dxy = normalView.dFdx().abs().max( normalView.dFdy().abs() );
7
7
  const geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z );
8
8
 
9
9
  return geometryRoughness;
@@ -1,7 +1,7 @@
1
1
  import getGeometryRoughness from './getGeometryRoughness.js';
2
- import { tslFn } from '../../shadernode/ShaderNode.js';
2
+ import { Fn } from '../../tsl/TSLBase.js';
3
3
 
4
- const getRoughness = tslFn( ( inputs ) => {
4
+ const getRoughness = /*@__PURE__*/ Fn( ( inputs ) => {
5
5
 
6
6
  const { roughness } = inputs;
7
7