diff --git a/src/loaders/nodes/NodeMaterialLoader.js b/src/loaders/nodes/NodeMaterialLoader.js index 6101ee87da6d75..6e0aac7d43097c 100644 --- a/src/loaders/nodes/NodeMaterialLoader.js +++ b/src/loaders/nodes/NodeMaterialLoader.js @@ -1,4 +1,21 @@ import { MaterialLoader } from '../../loaders/MaterialLoader.js'; +import { createNodeMaterialFromType } from '../../materials/nodes/NodeMaterial.js'; + +const superFromTypeFunction = MaterialLoader.createMaterialFromType; + +MaterialLoader.createMaterialFromType = function ( type ) { + + const material = createNodeMaterialFromType( type ); + + if ( material !== undefined ) { + + return material; + + } + + return superFromTypeFunction.call( this, type ); + +}; class NodeMaterialLoader extends MaterialLoader { diff --git a/src/materials/nodes/InstancedPointsNodeMaterial.js b/src/materials/nodes/InstancedPointsNodeMaterial.js index b0ff584c3fecad..4bce83166b32b3 100644 --- a/src/materials/nodes/InstancedPointsNodeMaterial.js +++ b/src/materials/nodes/InstancedPointsNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { property } from '../../nodes/core/PropertyNode.js'; import { attribute } from '../../nodes/core/AttributeNode.js'; import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js'; @@ -165,3 +165,5 @@ class InstancedPointsNodeMaterial extends NodeMaterial { } export default InstancedPointsNodeMaterial; + +InstancedPointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'InstancedPoints', InstancedPointsNodeMaterial ); diff --git a/src/materials/nodes/Line2NodeMaterial.js b/src/materials/nodes/Line2NodeMaterial.js index e9a897377c11fd..d4e88f7dd494a9 100644 --- a/src/materials/nodes/Line2NodeMaterial.js +++ b/src/materials/nodes/Line2NodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { property, varyingProperty } from '../../nodes/core/PropertyNode.js'; import { attribute } from '../../nodes/core/AttributeNode.js'; import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js'; @@ -433,3 +433,5 @@ class Line2NodeMaterial extends NodeMaterial { } export default Line2NodeMaterial; + +Line2NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Line2', Line2NodeMaterial ); diff --git a/src/materials/nodes/LineBasicNodeMaterial.js b/src/materials/nodes/LineBasicNodeMaterial.js index 39215b89dc971b..1157ab91563eae 100644 --- a/src/materials/nodes/LineBasicNodeMaterial.js +++ b/src/materials/nodes/LineBasicNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { LineBasicMaterial } from '../LineBasicMaterial.js'; @@ -23,3 +23,5 @@ class LineBasicNodeMaterial extends NodeMaterial { } export default LineBasicNodeMaterial; + +LineBasicNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'LineBasic', LineBasicNodeMaterial ); diff --git a/src/materials/nodes/LineDashedNodeMaterial.js b/src/materials/nodes/LineDashedNodeMaterial.js index 08777f8a19a8c9..23e1436132695c 100644 --- a/src/materials/nodes/LineDashedNodeMaterial.js +++ b/src/materials/nodes/LineDashedNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { attribute } from '../../nodes/core/AttributeNode.js'; import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../../nodes/accessors/MaterialNode.js'; import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js'; @@ -49,3 +49,5 @@ class LineDashedNodeMaterial extends NodeMaterial { } export default LineDashedNodeMaterial; + +LineDashedNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'LineDashed', LineDashedNodeMaterial ); diff --git a/src/materials/nodes/MeshBasicNodeMaterial.js b/src/materials/nodes/MeshBasicNodeMaterial.js index a4e2a533ee9e13..041365bcffb757 100644 --- a/src/materials/nodes/MeshBasicNodeMaterial.js +++ b/src/materials/nodes/MeshBasicNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { materialLightMap } from '../../nodes/accessors/MaterialNode.js'; import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; import BasicLightMapNode from '../../nodes/lighting/BasicLightMapNode.js'; @@ -69,3 +69,5 @@ class MeshBasicNodeMaterial extends NodeMaterial { } export default MeshBasicNodeMaterial; + +MeshBasicNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshBasic', MeshBasicNodeMaterial ); diff --git a/src/materials/nodes/MeshLambertNodeMaterial.js b/src/materials/nodes/MeshLambertNodeMaterial.js index 095f1fc0e521ec..a480bb0383101c 100644 --- a/src/materials/nodes/MeshLambertNodeMaterial.js +++ b/src/materials/nodes/MeshLambertNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js'; @@ -39,3 +39,5 @@ class MeshLambertNodeMaterial extends NodeMaterial { } export default MeshLambertNodeMaterial; + +MeshLambertNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshLambert', MeshLambertNodeMaterial ); diff --git a/src/materials/nodes/MeshMatcapNodeMaterial.js b/src/materials/nodes/MeshMatcapNodeMaterial.js index 9bf35ff34d804d..7f372238a544cf 100644 --- a/src/materials/nodes/MeshMatcapNodeMaterial.js +++ b/src/materials/nodes/MeshMatcapNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js'; import { diffuseColor } from '../../nodes/core/PropertyNode.js'; import { vec3 } from '../../nodes/tsl/TSLBase.js'; @@ -49,3 +49,5 @@ class MeshMatcapNodeMaterial extends NodeMaterial { export default MeshMatcapNodeMaterial; + +MeshMatcapNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshMatcap', MeshMatcapNodeMaterial ); diff --git a/src/materials/nodes/MeshNormalNodeMaterial.js b/src/materials/nodes/MeshNormalNodeMaterial.js index 0b6124eebbc064..3cd292f453b078 100644 --- a/src/materials/nodes/MeshNormalNodeMaterial.js +++ b/src/materials/nodes/MeshNormalNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { diffuseColor } from '../../nodes/core/PropertyNode.js'; import { directionToColor } from '../../nodes/utils/Packing.js'; import { materialOpacity } from '../../nodes/accessors/MaterialNode.js'; @@ -36,3 +36,5 @@ class MeshNormalNodeMaterial extends NodeMaterial { } export default MeshNormalNodeMaterial; + +MeshNormalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshNormal', MeshNormalNodeMaterial ); diff --git a/src/materials/nodes/MeshPhongNodeMaterial.js b/src/materials/nodes/MeshPhongNodeMaterial.js index fad1568b3ef841..d40d16964669b8 100644 --- a/src/materials/nodes/MeshPhongNodeMaterial.js +++ b/src/materials/nodes/MeshPhongNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { shininess, specularColor } from '../../nodes/core/PropertyNode.js'; import { materialShininess, materialSpecular } from '../../nodes/accessors/MaterialNode.js'; import { float } from '../../nodes/tsl/TSLBase.js'; @@ -70,3 +70,5 @@ class MeshPhongNodeMaterial extends NodeMaterial { } export default MeshPhongNodeMaterial; + +MeshPhongNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhong', MeshPhongNodeMaterial ); diff --git a/src/materials/nodes/MeshPhysicalNodeMaterial.js b/src/materials/nodes/MeshPhysicalNodeMaterial.js index fb71314d0ecddd..4dbe72ac37eb3c 100644 --- a/src/materials/nodes/MeshPhysicalNodeMaterial.js +++ b/src/materials/nodes/MeshPhysicalNodeMaterial.js @@ -8,6 +8,7 @@ import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js'; import { mix, pow2, min } from '../../nodes/math/MathNode.js'; import { MeshPhysicalMaterial } from '../MeshPhysicalMaterial.js'; +import { registerNodeMaterial } from './NodeMaterial.js'; const _defaultValues = /*@__PURE__*/ new MeshPhysicalMaterial(); @@ -240,3 +241,5 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial { } export default MeshPhysicalNodeMaterial; + +MeshPhysicalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhysical', MeshPhysicalNodeMaterial ); diff --git a/src/materials/nodes/MeshSSSNodeMaterial.js b/src/materials/nodes/MeshSSSNodeMaterial.js index 02f35640c6d9a9..0a8ff593f68832 100644 --- a/src/materials/nodes/MeshSSSNodeMaterial.js +++ b/src/materials/nodes/MeshSSSNodeMaterial.js @@ -3,6 +3,7 @@ import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.j import { transformedNormalView } from '../../nodes/accessors/Normal.js'; import { positionViewDirection } from '../../nodes/accessors/Position.js'; import { float, vec3 } from '../../nodes/tsl/TSLBase.js'; +import { registerNodeMaterial } from './NodeMaterial.js'; class SSSLightingModel extends PhysicalLightingModel { @@ -79,3 +80,5 @@ class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial { } export default MeshSSSNodeMaterial; + +MeshSSSNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshSSS', MeshSSSNodeMaterial ); diff --git a/src/materials/nodes/MeshStandardNodeMaterial.js b/src/materials/nodes/MeshStandardNodeMaterial.js index f18da47d12bcf0..6c6565b62f9d9f 100644 --- a/src/materials/nodes/MeshStandardNodeMaterial.js +++ b/src/materials/nodes/MeshStandardNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { diffuseColor, metalness, roughness, specularColor, specularF90 } from '../../nodes/core/PropertyNode.js'; import { mix } from '../../nodes/math/MathNode.js'; import { materialRoughness, materialMetalness } from '../../nodes/accessors/MaterialNode.js'; @@ -100,3 +100,5 @@ class MeshStandardNodeMaterial extends NodeMaterial { } export default MeshStandardNodeMaterial; + +MeshStandardNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshStandard', MeshStandardNodeMaterial ); diff --git a/src/materials/nodes/MeshToonNodeMaterial.js b/src/materials/nodes/MeshToonNodeMaterial.js index 1ca19cc100a8f8..bd2a9ec2ecaf92 100644 --- a/src/materials/nodes/MeshToonNodeMaterial.js +++ b/src/materials/nodes/MeshToonNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import ToonLightingModel from '../../nodes/functions/ToonLightingModel.js'; import { MeshToonMaterial } from '../MeshToonMaterial.js'; @@ -30,3 +30,5 @@ class MeshToonNodeMaterial extends NodeMaterial { } export default MeshToonNodeMaterial; + +MeshToonNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshToon', MeshToonNodeMaterial ); diff --git a/src/materials/nodes/NodeMaterial.js b/src/materials/nodes/NodeMaterial.js index 90e45fe46de5b7..d092d324c8f9ec 100644 --- a/src/materials/nodes/NodeMaterial.js +++ b/src/materials/nodes/NodeMaterial.js @@ -23,6 +23,8 @@ import { depth } from '../../nodes/display/ViewportDepthNode.js'; import { cameraLogDepth } from '../../nodes/accessors/Camera.js'; import { clipping, clippingAlpha } from '../../nodes/accessors/ClippingNode.js'; +const NodeMaterials = new Map(); + class NodeMaterial extends Material { constructor() { @@ -621,3 +623,45 @@ class NodeMaterial extends Material { } export default NodeMaterial; + +NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( '', NodeMaterial ); + +export function registerNodeMaterial( type, nodeMaterialClass ) { + + const suffix = 'NodeMaterial'; + const nodeMaterialType = type + suffix; + + if ( typeof nodeMaterialClass !== 'function' ) throw new Error( `THREE.Node: NodeMaterial class "${ type }" is not a class.` ); + + if ( NodeMaterials.has( nodeMaterialType ) ) { + + console.warn( `THREE.Node: Redefinition of NodeMaterial class "${ nodeMaterialType }".` ); + return; + + } + + if ( type.slice( - suffix.length ) === suffix ) { + + console.warn( `THREE.NodeMaterial: NodeMaterial class ${ nodeMaterialType } should not have '${ suffix }' suffix.` ); + return; + + } + + NodeMaterials.set( nodeMaterialType, nodeMaterialClass ); + nodeMaterialClass.type = nodeMaterialType; + + return nodeMaterialType; + +} + +export function createNodeMaterialFromType( type ) { + + const Material = NodeMaterials.get( type ); + + if ( Material !== undefined ) { + + return new Material(); + + } + +} diff --git a/src/materials/nodes/PointsNodeMaterial.js b/src/materials/nodes/PointsNodeMaterial.js index 0b5d0e9bddffbf..6b132ba5e210b3 100644 --- a/src/materials/nodes/PointsNodeMaterial.js +++ b/src/materials/nodes/PointsNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { PointsMaterial } from '../PointsMaterial.js'; @@ -34,3 +34,5 @@ class PointsNodeMaterial extends NodeMaterial { } export default PointsNodeMaterial; + +PointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Points', PointsNodeMaterial ); diff --git a/src/materials/nodes/ShadowNodeMaterial.js b/src/materials/nodes/ShadowNodeMaterial.js index 016122f02cb57d..019d9f37817c1a 100644 --- a/src/materials/nodes/ShadowNodeMaterial.js +++ b/src/materials/nodes/ShadowNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js'; import { ShadowMaterial } from '../ShadowMaterial.js'; @@ -30,3 +30,5 @@ class ShadowNodeMaterial extends NodeMaterial { } export default ShadowNodeMaterial; + +ShadowNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Shadow', ShadowNodeMaterial ); diff --git a/src/materials/nodes/SpriteNodeMaterial.js b/src/materials/nodes/SpriteNodeMaterial.js index 8a6e2a5b70d577..382b12df4e3473 100644 --- a/src/materials/nodes/SpriteNodeMaterial.js +++ b/src/materials/nodes/SpriteNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { uniform } from '../../nodes/core/UniformNode.js'; import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js'; import { materialRotation } from '../../nodes/accessors/MaterialNode.js'; @@ -86,3 +86,5 @@ class SpriteNodeMaterial extends NodeMaterial { } export default SpriteNodeMaterial; + +SpriteNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Sprite', SpriteNodeMaterial ); diff --git a/src/materials/nodes/VolumeNodeMaterial.js b/src/materials/nodes/VolumeNodeMaterial.js index b2b52fab03d3d3..304dd9b8535a63 100644 --- a/src/materials/nodes/VolumeNodeMaterial.js +++ b/src/materials/nodes/VolumeNodeMaterial.js @@ -1,4 +1,4 @@ -import NodeMaterial from './NodeMaterial.js'; +import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js'; import { property } from '../../nodes/core/PropertyNode.js'; import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js'; import { modelWorldMatrixInverse } from '../../nodes/accessors/ModelNode.js'; @@ -100,3 +100,5 @@ class VolumeNodeMaterial extends NodeMaterial { } export default VolumeNodeMaterial; + +VolumeNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Volume', VolumeNodeMaterial ); diff --git a/src/nodes/Nodes.js b/src/nodes/Nodes.js index 33ac34bd796175..ebab879bc5f394 100644 --- a/src/nodes/Nodes.js +++ b/src/nodes/Nodes.js @@ -10,7 +10,7 @@ export { default as ConstNode } from './core/ConstNode.js'; export { default as ContextNode } from './core/ContextNode.js'; export { default as IndexNode } from './core/IndexNode.js'; export { default as LightingModel } from './core/LightingModel.js'; -export { default as Node } from './core/Node.js'; +export { default as Node, registerNode } from './core/Node.js'; export { default as VarNode } from './core/VarNode.js'; export { default as NodeAttribute } from './core/NodeAttribute.js'; export { default as NodeBuilder } from './core/NodeBuilder.js'; diff --git a/src/nodes/accessors/AccessorsUtils.js b/src/nodes/accessors/AccessorsUtils.js index 6a49007a44d874..bcd2d72863e432 100644 --- a/src/nodes/accessors/AccessorsUtils.js +++ b/src/nodes/accessors/AccessorsUtils.js @@ -6,12 +6,12 @@ import { mix } from '../math/MathNode.js'; import { anisotropy, anisotropyB, roughness } from '../core/PropertyNode.js'; import { positionViewDirection } from './Position.js'; -export const TBNViewMatrix = mat3( tangentView, bitangentView, normalView ); +export const TBNViewMatrix = /*@__PURE__*/ mat3( tangentView, bitangentView, normalView ); -export const parallaxDirection = positionViewDirection.mul( TBNViewMatrix )/*.normalize()*/; +export const parallaxDirection = /*@__PURE__*/ positionViewDirection.mul( TBNViewMatrix )/*.normalize()*/; export const parallaxUV = ( uv, scale ) => uv.sub( parallaxDirection.mul( scale ) ); -export const transformedBentNormalView = ( () => { +export const transformedBentNormalView = /*@__PURE__*/ ( () => { // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy diff --git a/src/nodes/accessors/BatchNode.js b/src/nodes/accessors/BatchNode.js index ec4e7c50159408..2c7dba0ad4eb2f 100644 --- a/src/nodes/accessors/BatchNode.js +++ b/src/nodes/accessors/BatchNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { normalLocal } from './Normal.js'; import { positionLocal } from './Position.js'; import { nodeProxy, vec3, mat3, mat4, int, ivec2, float, Fn } from '../tsl/TSLBase.js'; @@ -119,6 +119,6 @@ class BatchNode extends Node { export default BatchNode; -registerNodeClass( 'Batch', BatchNode ); +BatchNode.type = /*@__PURE__*/ registerNode( 'Batch', BatchNode ); -export const batch = nodeProxy( BatchNode ); +export const batch = /*@__PURE__*/ nodeProxy( BatchNode ); diff --git a/src/nodes/accessors/Bitangent.js b/src/nodes/accessors/Bitangent.js index 2e8ea0548eb5b2..ff76e5fffd105e 100644 --- a/src/nodes/accessors/Bitangent.js +++ b/src/nodes/accessors/Bitangent.js @@ -5,9 +5,9 @@ import { tangentGeometry, tangentLocal, tangentView, tangentWorld, transformedTa const getBitangent = ( crossNormalTangent ) => crossNormalTangent.mul( tangentGeometry.w ).xyz; -export const bitangentGeometry = /*#__PURE__*/ varying( getBitangent( normalGeometry.cross( tangentGeometry ) ), 'v_bitangentGeometry' ).normalize().toVar( 'bitangentGeometry' ); -export const bitangentLocal = /*#__PURE__*/ varying( getBitangent( normalLocal.cross( tangentLocal ) ), 'v_bitangentLocal' ).normalize().toVar( 'bitangentLocal' ); -export const bitangentView = /*#__PURE__*/ varying( getBitangent( normalView.cross( tangentView ) ), 'v_bitangentView' ).normalize().toVar( 'bitangentView' ); -export const bitangentWorld = /*#__PURE__*/ varying( getBitangent( normalWorld.cross( tangentWorld ) ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' ); -export const transformedBitangentView = /*#__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ) ).normalize().toVar( 'transformedBitangentView' ); -export const transformedBitangentWorld = /*#__PURE__*/ transformedBitangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedBitangentWorld' ); +export const bitangentGeometry = /*@__PURE__*/ varying( getBitangent( normalGeometry.cross( tangentGeometry ) ), 'v_bitangentGeometry' ).normalize().toVar( 'bitangentGeometry' ); +export const bitangentLocal = /*@__PURE__*/ varying( getBitangent( normalLocal.cross( tangentLocal ) ), 'v_bitangentLocal' ).normalize().toVar( 'bitangentLocal' ); +export const bitangentView = /*@__PURE__*/ varying( getBitangent( normalView.cross( tangentView ) ), 'v_bitangentView' ).normalize().toVar( 'bitangentView' ); +export const bitangentWorld = /*@__PURE__*/ varying( getBitangent( normalWorld.cross( tangentWorld ) ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' ); +export const transformedBitangentView = /*@__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ) ).normalize().toVar( 'transformedBitangentView' ); +export const transformedBitangentWorld = /*@__PURE__*/ transformedBitangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedBitangentWorld' ); diff --git a/src/nodes/accessors/BufferAttributeNode.js b/src/nodes/accessors/BufferAttributeNode.js index 183684263a7a77..d0a6a8858c7062 100644 --- a/src/nodes/accessors/BufferAttributeNode.js +++ b/src/nodes/accessors/BufferAttributeNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import InputNode from '../core/InputNode.js'; import { nodeObject, addMethodChaining } from '../tsl/TSLCore.js'; import { varying } from '../core/VaryingNode.js'; @@ -151,7 +151,7 @@ class BufferAttributeNode extends InputNode { export default BufferAttributeNode; -registerNodeClass( 'BufferAttribute', BufferAttributeNode ); +BufferAttributeNode.type = /*@__PURE__*/ registerNode( 'BufferAttribute', BufferAttributeNode ); export const bufferAttribute = ( array, type, stride, offset ) => nodeObject( new BufferAttributeNode( array, type, stride, offset ) ); export const dynamicBufferAttribute = ( array, type, stride, offset ) => bufferAttribute( array, type, stride, offset ).setUsage( DynamicDrawUsage ); diff --git a/src/nodes/accessors/BufferNode.js b/src/nodes/accessors/BufferNode.js index 74d260403259f8..c6872994b97200 100644 --- a/src/nodes/accessors/BufferNode.js +++ b/src/nodes/accessors/BufferNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import UniformNode from '../core/UniformNode.js'; import { nodeObject } from '../tsl/TSLBase.js'; @@ -31,6 +31,6 @@ class BufferNode extends UniformNode { export default BufferNode; -registerNodeClass( 'Buffer', BufferNode ); +BufferNode.type = /*@__PURE__*/ registerNode( 'Buffer', BufferNode ); export const buffer = ( value, type, count ) => nodeObject( new BufferNode( value, type, count ) ); diff --git a/src/nodes/accessors/Camera.js b/src/nodes/accessors/Camera.js index 5db5e5ae14e2c4..2019079283acd2 100644 --- a/src/nodes/accessors/Camera.js +++ b/src/nodes/accessors/Camera.js @@ -2,18 +2,18 @@ import { uniform } from '../core/UniformNode.js'; import { sharedUniformGroup } from '../core/UniformGroupNode.js'; import { Vector3 } from '../../math/Vector3.js'; -const cameraGroup = /*#__PURE__*/ sharedUniformGroup( 'camera' ).onRenderUpdate( () => { +const cameraGroup = /*@__PURE__*/ sharedUniformGroup( 'camera' ).onRenderUpdate( () => { cameraGroup.needsUpdate = true; } ); -export const cameraNear = /*#__PURE__*/ uniform( 'float' ).label( 'cameraNear' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.near ); -export const cameraFar = /*#__PURE__*/ uniform( 'float' ).label( 'cameraFar' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.far ); -export const cameraLogDepth = /*#__PURE__*/ uniform( 'float' ).label( 'cameraLogDepth' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) ); -export const cameraProjectionMatrix = /*#__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix ); -export const cameraProjectionMatrixInverse = /*#__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrixInverse' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse ); -export const cameraViewMatrix = /*#__PURE__*/ uniform( 'mat4' ).label( 'cameraViewMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse ); -export const cameraWorldMatrix = /*#__PURE__*/ uniform( 'mat4' ).label( 'cameraWorldMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorld ); -export const cameraNormalMatrix = /*#__PURE__*/ uniform( 'mat3' ).label( 'cameraNormalMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.normalMatrix ); -export const cameraPosition = /*#__PURE__*/ uniform( new Vector3() ).label( 'cameraPosition' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera }, self ) => self.value.setFromMatrixPosition( camera.matrixWorld ) ); +export const cameraNear = /*@__PURE__*/ uniform( 'float' ).label( 'cameraNear' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.near ); +export const cameraFar = /*@__PURE__*/ uniform( 'float' ).label( 'cameraFar' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.far ); +export const cameraLogDepth = /*@__PURE__*/ uniform( 'float' ).label( 'cameraLogDepth' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) ); +export const cameraProjectionMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrix ); +export const cameraProjectionMatrixInverse = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrixInverse' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse ); +export const cameraViewMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraViewMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorldInverse ); +export const cameraWorldMatrix = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraWorldMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.matrixWorld ); +export const cameraNormalMatrix = /*@__PURE__*/ uniform( 'mat3' ).label( 'cameraNormalMatrix' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera } ) => camera.normalMatrix ); +export const cameraPosition = /*@__PURE__*/ uniform( new Vector3() ).label( 'cameraPosition' ).setGroup( cameraGroup ).onRenderUpdate( ( { camera }, self ) => self.value.setFromMatrixPosition( camera.matrixWorld ) ); diff --git a/src/nodes/accessors/ClippingNode.js b/src/nodes/accessors/ClippingNode.js index b46e97a311a042..55fb74662be814 100644 --- a/src/nodes/accessors/ClippingNode.js +++ b/src/nodes/accessors/ClippingNode.js @@ -1,5 +1,5 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeObject } from '../tsl/TSLBase.js'; import { positionView } from './Position.js'; import { diffuseColor, property } from '../core/PropertyNode.js'; @@ -140,7 +140,7 @@ ClippingNode.DEFAULT = 'default'; export default ClippingNode; -registerNodeClass( 'Clipping', ClippingNode ); +ClippingNode.type = /*@__PURE__*/ registerNode( 'Clipping', ClippingNode ); export const clipping = () => nodeObject( new ClippingNode() ); diff --git a/src/nodes/accessors/CubeTextureNode.js b/src/nodes/accessors/CubeTextureNode.js index 9515fcd2f2fc3e..5a60f771aa350f 100644 --- a/src/nodes/accessors/CubeTextureNode.js +++ b/src/nodes/accessors/CubeTextureNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TextureNode from './TextureNode.js'; import { reflectVector, refractVector } from './ReflectVector.js'; import { nodeProxy, vec3 } from '../tsl/TSLBase.js'; @@ -71,6 +71,6 @@ class CubeTextureNode extends TextureNode { export default CubeTextureNode; -registerNodeClass( 'CubeTexture', CubeTextureNode ); +CubeTextureNode.type = /*@__PURE__*/ registerNode( 'CubeTexture', CubeTextureNode ); -export const cubeTexture = nodeProxy( CubeTextureNode ); +export const cubeTexture = /*@__PURE__*/ nodeProxy( CubeTextureNode ); diff --git a/src/nodes/accessors/InstanceNode.js b/src/nodes/accessors/InstanceNode.js index 3854362550ae6f..5e394ebb0c9109 100644 --- a/src/nodes/accessors/InstanceNode.js +++ b/src/nodes/accessors/InstanceNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { varyingProperty } from '../core/PropertyNode.js'; import { instancedBufferAttribute, instancedDynamicBufferAttribute } from './BufferAttributeNode.js'; import { normalLocal } from './Normal.js'; @@ -139,6 +139,6 @@ class InstanceNode extends Node { export default InstanceNode; -registerNodeClass( 'Instance', InstanceNode ); +InstanceNode.type = /*@__PURE__*/ registerNode( 'Instance', InstanceNode ); -export const instance = nodeProxy( InstanceNode ); +export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ); diff --git a/src/nodes/accessors/InstancedPointsMaterialNode.js b/src/nodes/accessors/InstancedPointsMaterialNode.js index 7e09505324f4e7..26d53732296ed1 100644 --- a/src/nodes/accessors/InstancedPointsMaterialNode.js +++ b/src/nodes/accessors/InstancedPointsMaterialNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import MaterialNode from './MaterialNode.js'; import { nodeImmutable } from '../tsl/TSLBase.js'; @@ -16,6 +16,6 @@ InstancedPointsMaterialNode.POINT_WIDTH = 'pointWidth'; export default InstancedPointsMaterialNode; -registerNodeClass( 'InstancedPointsMaterial', InstancedPointsMaterialNode ); +InstancedPointsMaterialNode.type = /*@__PURE__*/ registerNode( 'InstancedPointsMaterial', InstancedPointsMaterialNode ); -export const materialPointWidth = nodeImmutable( InstancedPointsMaterialNode, InstancedPointsMaterialNode.POINT_WIDTH ); +export const materialPointWidth = /*@__PURE__*/ nodeImmutable( InstancedPointsMaterialNode, InstancedPointsMaterialNode.POINT_WIDTH ); diff --git a/src/nodes/accessors/MaterialNode.js b/src/nodes/accessors/MaterialNode.js index df85854f468d70..0e9a25de94e650 100644 --- a/src/nodes/accessors/MaterialNode.js +++ b/src/nodes/accessors/MaterialNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { reference } from './ReferenceNode.js'; import { materialReference } from './MaterialReferenceNode.js'; import { normalView } from './Normal.js'; @@ -384,49 +384,49 @@ MaterialNode.AO_MAP = 'ao'; export default MaterialNode; -registerNodeClass( 'Material', MaterialNode ); - -export const materialAlphaTest = nodeImmutable( MaterialNode, MaterialNode.ALPHA_TEST ); -export const materialColor = nodeImmutable( MaterialNode, MaterialNode.COLOR ); -export const materialShininess = nodeImmutable( MaterialNode, MaterialNode.SHININESS ); -export const materialEmissive = nodeImmutable( MaterialNode, MaterialNode.EMISSIVE ); -export const materialOpacity = nodeImmutable( MaterialNode, MaterialNode.OPACITY ); -export const materialSpecular = nodeImmutable( MaterialNode, MaterialNode.SPECULAR ); - -export const materialSpecularIntensity = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_INTENSITY ); -export const materialSpecularColor = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_COLOR ); - -export const materialSpecularStrength = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_STRENGTH ); -export const materialReflectivity = nodeImmutable( MaterialNode, MaterialNode.REFLECTIVITY ); -export const materialRoughness = nodeImmutable( MaterialNode, MaterialNode.ROUGHNESS ); -export const materialMetalness = nodeImmutable( MaterialNode, MaterialNode.METALNESS ); -export const materialNormal = nodeImmutable( MaterialNode, MaterialNode.NORMAL ).context( { getUV: null } ); -export const materialClearcoat = nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT ); -export const materialClearcoatRoughness = nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS ); -export const materialClearcoatNormal = nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_NORMAL ).context( { getUV: null } ); -export const materialRotation = nodeImmutable( MaterialNode, MaterialNode.ROTATION ); -export const materialSheen = nodeImmutable( MaterialNode, MaterialNode.SHEEN ); -export const materialSheenRoughness = nodeImmutable( MaterialNode, MaterialNode.SHEEN_ROUGHNESS ); -export const materialAnisotropy = nodeImmutable( MaterialNode, MaterialNode.ANISOTROPY ); -export const materialIridescence = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE ); -export const materialIridescenceIOR = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_IOR ); -export const materialIridescenceThickness = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS ); -export const materialTransmission = nodeImmutable( MaterialNode, MaterialNode.TRANSMISSION ); -export const materialThickness = nodeImmutable( MaterialNode, MaterialNode.THICKNESS ); -export const materialIOR = nodeImmutable( MaterialNode, MaterialNode.IOR ); -export const materialAttenuationDistance = nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_DISTANCE ); -export const materialAttenuationColor = nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_COLOR ); -export const materialLineScale = nodeImmutable( MaterialNode, MaterialNode.LINE_SCALE ); -export const materialLineDashSize = nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_SIZE ); -export const materialLineGapSize = nodeImmutable( MaterialNode, MaterialNode.LINE_GAP_SIZE ); -export const materialLineWidth = nodeImmutable( MaterialNode, MaterialNode.LINE_WIDTH ); -export const materialLineDashOffset = nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_OFFSET ); -export const materialPointWidth = nodeImmutable( MaterialNode, MaterialNode.POINT_WIDTH ); -export const materialDispersion = nodeImmutable( MaterialNode, MaterialNode.DISPERSION ); -export const materialLightMap = nodeImmutable( MaterialNode, MaterialNode.LIGHT_MAP ); -export const materialAOMap = nodeImmutable( MaterialNode, MaterialNode.AO_MAP ); -export const materialRefractionRatio = nodeImmutable( MaterialNode, MaterialNode.REFRACTION_RATIO ); -export const materialAnisotropyVector = uniform( new Vector2() ).onReference( function ( frame ) { +MaterialNode.type = /*@__PURE__*/ registerNode( 'Material', MaterialNode ); + +export const materialAlphaTest = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ALPHA_TEST ); +export const materialColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.COLOR ); +export const materialShininess = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHININESS ); +export const materialEmissive = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.EMISSIVE ); +export const materialOpacity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.OPACITY ); +export const materialSpecular = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR ); + +export const materialSpecularIntensity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_INTENSITY ); +export const materialSpecularColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_COLOR ); + +export const materialSpecularStrength = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_STRENGTH ); +export const materialReflectivity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.REFLECTIVITY ); +export const materialRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ROUGHNESS ); +export const materialMetalness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.METALNESS ); +export const materialNormal = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.NORMAL ).context( { getUV: null } ); +export const materialClearcoat = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT ); +export const materialClearcoatRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS ); +export const materialClearcoatNormal = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_NORMAL ).context( { getUV: null } ); +export const materialRotation = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ROTATION ); +export const materialSheen = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHEEN ); +export const materialSheenRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHEEN_ROUGHNESS ); +export const materialAnisotropy = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ANISOTROPY ); +export const materialIridescence = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE ); +export const materialIridescenceIOR = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_IOR ); +export const materialIridescenceThickness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS ); +export const materialTransmission = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.TRANSMISSION ); +export const materialThickness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.THICKNESS ); +export const materialIOR = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IOR ); +export const materialAttenuationDistance = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_DISTANCE ); +export const materialAttenuationColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_COLOR ); +export const materialLineScale = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_SCALE ); +export const materialLineDashSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_SIZE ); +export const materialLineGapSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_GAP_SIZE ); +export const materialLineWidth = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_WIDTH ); +export const materialLineDashOffset = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_OFFSET ); +export const materialPointWidth = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.POINT_WIDTH ); +export const materialDispersion = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.DISPERSION ); +export const materialLightMap = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LIGHT_MAP ); +export const materialAOMap = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.AO_MAP ); +export const materialRefractionRatio = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.REFRACTION_RATIO ); +export const materialAnisotropyVector = /*@__PURE__*/ uniform( new Vector2() ).onReference( function ( frame ) { return frame.material; diff --git a/src/nodes/accessors/MaterialReferenceNode.js b/src/nodes/accessors/MaterialReferenceNode.js index bade7495deb93f..1f7d862d940cee 100644 --- a/src/nodes/accessors/MaterialReferenceNode.js +++ b/src/nodes/accessors/MaterialReferenceNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import ReferenceNode from './ReferenceNode.js'; //import { renderGroup } from '../core/UniformGroupNode.js'; //import { NodeUpdateType } from '../core/constants.js'; @@ -38,6 +38,6 @@ class MaterialReferenceNode extends ReferenceNode { export default MaterialReferenceNode; -registerNodeClass( 'MaterialReference', MaterialReferenceNode ); +MaterialReferenceNode.type = /*@__PURE__*/ registerNode( 'MaterialReference', MaterialReferenceNode ); export const materialReference = ( name, type, material ) => nodeObject( new MaterialReferenceNode( name, type, material ) ); diff --git a/src/nodes/accessors/ModelNode.js b/src/nodes/accessors/ModelNode.js index 4a4e1b80d780f9..15d034dfb3590d 100644 --- a/src/nodes/accessors/ModelNode.js +++ b/src/nodes/accessors/ModelNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import Object3DNode from './Object3DNode.js'; import { nodeImmutable } from '../tsl/TSLBase.js'; import { uniform } from '../core/UniformNode.js'; @@ -25,13 +25,13 @@ class ModelNode extends Object3DNode { export default ModelNode; -registerNodeClass( 'Model', ModelNode ); +ModelNode.type = /*@__PURE__*/ registerNode( 'Model', ModelNode ); -export const modelDirection = nodeImmutable( ModelNode, ModelNode.DIRECTION ); -export const modelViewMatrix = nodeImmutable( ModelNode, ModelNode.VIEW_MATRIX ).label( 'modelViewMatrix' ).toVar( 'ModelViewMatrix' ); -export const modelNormalMatrix = nodeImmutable( ModelNode, ModelNode.NORMAL_MATRIX ); -export const modelWorldMatrix = nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX ); -export const modelPosition = nodeImmutable( ModelNode, ModelNode.POSITION ); -export const modelScale = nodeImmutable( ModelNode, ModelNode.SCALE ); -export const modelViewPosition = nodeImmutable( ModelNode, ModelNode.VIEW_POSITION ); -export const modelWorldMatrixInverse = uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() ); +export const modelDirection = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.DIRECTION ); +export const modelViewMatrix = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.VIEW_MATRIX ).label( 'modelViewMatrix' ).toVar( 'ModelViewMatrix' ); +export const modelNormalMatrix = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.NORMAL_MATRIX ); +export const modelWorldMatrix = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX ); +export const modelPosition = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.POSITION ); +export const modelScale = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.SCALE ); +export const modelViewPosition = /*@__PURE__*/ nodeImmutable( ModelNode, ModelNode.VIEW_POSITION ); +export const modelWorldMatrixInverse = /*@__PURE__*/ uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() ); diff --git a/src/nodes/accessors/ModelViewProjectionNode.js b/src/nodes/accessors/ModelViewProjectionNode.js index def9cc7620f69d..76586a5d8208b0 100644 --- a/src/nodes/accessors/ModelViewProjectionNode.js +++ b/src/nodes/accessors/ModelViewProjectionNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { cameraProjectionMatrix } from './Camera.js'; import { modelViewMatrix } from './ModelNode.js'; @@ -33,6 +33,6 @@ class ModelViewProjectionNode extends TempNode { export default ModelViewProjectionNode; -registerNodeClass( 'ModelViewProjection', ModelViewProjectionNode ); +ModelViewProjectionNode.type = /*@__PURE__*/ registerNode( 'ModelViewProjection', ModelViewProjectionNode ); -export const modelViewProjection = nodeProxy( ModelViewProjectionNode ); +export const modelViewProjection = /*@__PURE__*/ nodeProxy( ModelViewProjectionNode ); diff --git a/src/nodes/accessors/MorphNode.js b/src/nodes/accessors/MorphNode.js index 61310811c9f81a..0b4ed77cf61b19 100644 --- a/src/nodes/accessors/MorphNode.js +++ b/src/nodes/accessors/MorphNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import { float, nodeProxy, Fn } from '../tsl/TSLBase.js'; import { uniform } from '../core/UniformNode.js'; @@ -15,10 +15,10 @@ import { Vector2 } from '../../math/Vector2.js'; import { Vector4 } from '../../math/Vector4.js'; import { FloatType } from '../../constants.js'; -const _morphTextures = new WeakMap(); +const _morphTextures = /*@__PURE__*/ new WeakMap(); const _morphVec4 = /*@__PURE__*/ new Vector4(); -const getMorph = Fn( ( { bufferMap, influence, stride, width, depth, offset } ) => { +const getMorph = /*@__PURE__*/ Fn( ( { bufferMap, influence, stride, width, depth, offset } ) => { const texelIndex = int( vertexIndex ).mul( stride ).add( offset ); @@ -254,6 +254,6 @@ class MorphNode extends Node { export default MorphNode; -registerNodeClass( 'Morph', MorphNode ); +MorphNode.type = /*@__PURE__*/ registerNode( 'Morph', MorphNode ); -export const morphReference = nodeProxy( MorphNode ); +export const morphReference = /*@__PURE__*/ nodeProxy( MorphNode ); diff --git a/src/nodes/accessors/Normal.js b/src/nodes/accessors/Normal.js index 719826425c73df..67a32dfe9338ac 100644 --- a/src/nodes/accessors/Normal.js +++ b/src/nodes/accessors/Normal.js @@ -6,9 +6,9 @@ import { positionView } from './Position.js'; import { Fn, varying } from '../tsl/TSLBase.js'; import { faceDirection } from '../display/FrontFacingNode.js'; -export const normalGeometry = /*#__PURE__*/ attribute( 'normal', 'vec3' ); +export const normalGeometry = /*@__PURE__*/ attribute( 'normal', 'vec3' ); -export const normalLocal = /*#__PURE__*/ ( Fn( ( builder ) => { +export const normalLocal = /*@__PURE__*/ ( Fn( ( builder ) => { if ( builder.geometry.hasAttribute( 'normal' ) === false ) { @@ -22,11 +22,11 @@ export const normalLocal = /*#__PURE__*/ ( Fn( ( builder ) => { }, 'vec3' ).once() )().toVar( 'normalLocal' ); -export const normalFlat = /*#__PURE__*/ positionView.dFdx().cross( positionView.dFdy() ).normalize().toVar( 'normalFlat' ); +export const normalFlat = /*@__PURE__*/ positionView.dFdx().cross( positionView.dFdy() ).normalize().toVar( 'normalFlat' ); let normalViewVarying = null; -export const normalView = /*#__PURE__*/ ( Fn( ( builder ) => { +export const normalView = /*@__PURE__*/ ( Fn( ( builder ) => { let node; @@ -44,18 +44,18 @@ export const normalView = /*#__PURE__*/ ( Fn( ( builder ) => { }, 'vec3' ).once() )().toVar( 'normalView' ); -export const normalWorld = /*#__PURE__*/ varying( normalView.transformDirection( cameraViewMatrix ), 'v_normalWorld' ).normalize().toVar( 'normalWorld' ); +export const normalWorld = /*@__PURE__*/ varying( normalView.transformDirection( cameraViewMatrix ), 'v_normalWorld' ).normalize().toVar( 'normalWorld' ); -export const transformedNormalView = /*#__PURE__*/ ( Fn( ( builder ) => { +export const transformedNormalView = /*@__PURE__*/ ( Fn( ( builder ) => { return builder.context.setupNormal(); }, 'vec3' ).once() )().mul( faceDirection ).toVar( 'transformedNormalView' ); -export const transformedNormalWorld = /*#__PURE__*/ transformedNormalView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedNormalWorld' ); +export const transformedNormalWorld = /*@__PURE__*/ transformedNormalView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedNormalWorld' ); -export const transformedClearcoatNormalView = /*#__PURE__*/ ( Fn( ( builder ) => { +export const transformedClearcoatNormalView = /*@__PURE__*/ ( Fn( ( builder ) => { return builder.context.setupClearcoatNormal(); diff --git a/src/nodes/accessors/Object3DNode.js b/src/nodes/accessors/Object3DNode.js index cf84f41a49e5f3..7439ca08bebd3f 100644 --- a/src/nodes/accessors/Object3DNode.js +++ b/src/nodes/accessors/Object3DNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import UniformNode from '../core/UniformNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -139,12 +139,12 @@ Object3DNode.DIRECTION = 'direction'; export default Object3DNode; -registerNodeClass( 'Object3D', Object3DNode ); +Object3DNode.type = /*@__PURE__*/ registerNode( 'Object3D', Object3DNode ); -export const objectDirection = nodeProxy( Object3DNode, Object3DNode.DIRECTION ); -export const objectViewMatrix = nodeProxy( Object3DNode, Object3DNode.VIEW_MATRIX ); -export const objectNormalMatrix = nodeProxy( Object3DNode, Object3DNode.NORMAL_MATRIX ); -export const objectWorldMatrix = nodeProxy( Object3DNode, Object3DNode.WORLD_MATRIX ); -export const objectPosition = nodeProxy( Object3DNode, Object3DNode.POSITION ); -export const objectScale = nodeProxy( Object3DNode, Object3DNode.SCALE ); -export const objectViewPosition = nodeProxy( Object3DNode, Object3DNode.VIEW_POSITION ); +export const objectDirection = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.DIRECTION ); +export const objectViewMatrix = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.VIEW_MATRIX ); +export const objectNormalMatrix = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.NORMAL_MATRIX ); +export const objectWorldMatrix = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.WORLD_MATRIX ); +export const objectPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.POSITION ); +export const objectScale = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.SCALE ); +export const objectViewPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.VIEW_POSITION ); diff --git a/src/nodes/accessors/PointUVNode.js b/src/nodes/accessors/PointUVNode.js index f88607138d3263..5eb8de5bb79364 100644 --- a/src/nodes/accessors/PointUVNode.js +++ b/src/nodes/accessors/PointUVNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeImmutable } from '../tsl/TSLBase.js'; class PointUVNode extends Node { @@ -21,6 +21,6 @@ class PointUVNode extends Node { export default PointUVNode; -registerNodeClass( 'PointUV', PointUVNode ); +PointUVNode.type = /*@__PURE__*/ registerNode( 'PointUV', PointUVNode ); -export const pointUV = nodeImmutable( PointUVNode ); +export const pointUV = /*@__PURE__*/ nodeImmutable( PointUVNode ); diff --git a/src/nodes/accessors/Position.js b/src/nodes/accessors/Position.js index 2349963a34e7e4..3e63c04d512051 100644 --- a/src/nodes/accessors/Position.js +++ b/src/nodes/accessors/Position.js @@ -1,10 +1,10 @@ import { attribute } from '../core/AttributeNode.js'; import { modelWorldMatrix, modelViewMatrix } from './ModelNode.js'; -export const positionGeometry = /*#__PURE__*/ attribute( 'position', 'vec3' ); -export const positionLocal = /*#__PURE__*/ positionGeometry.varying( 'positionLocal' ); -export const positionPrevious = /*#__PURE__*/ positionGeometry.varying( 'positionPrevious' ); -export const positionWorld = /*#__PURE__*/ modelWorldMatrix.mul( positionLocal ).xyz.varying( 'v_positionWorld' ); -export const positionWorldDirection = /*#__PURE__*/ positionLocal.transformDirection( modelWorldMatrix ).varying( 'v_positionWorldDirection' ).normalize().toVar( 'positionWorldDirection' ); -export const positionView = /*#__PURE__*/ modelViewMatrix.mul( positionLocal ).xyz.varying( 'v_positionView' ); -export const positionViewDirection = /*#__PURE__*/ positionView.negate().varying( 'v_positionViewDirection' ).normalize().toVar( 'positionViewDirection' ); +export const positionGeometry = /*@__PURE__*/ attribute( 'position', 'vec3' ); +export const positionLocal = /*@__PURE__*/ positionGeometry.varying( 'positionLocal' ); +export const positionPrevious = /*@__PURE__*/ positionGeometry.varying( 'positionPrevious' ); +export const positionWorld = /*@__PURE__*/ modelWorldMatrix.mul( positionLocal ).xyz.varying( 'v_positionWorld' ); +export const positionWorldDirection = /*@__PURE__*/ positionLocal.transformDirection( modelWorldMatrix ).varying( 'v_positionWorldDirection' ).normalize().toVar( 'positionWorldDirection' ); +export const positionView = /*@__PURE__*/ modelViewMatrix.mul( positionLocal ).xyz.varying( 'v_positionView' ); +export const positionViewDirection = /*@__PURE__*/ positionView.negate().varying( 'v_positionViewDirection' ).normalize().toVar( 'positionViewDirection' ); diff --git a/src/nodes/accessors/ReferenceBaseNode.js b/src/nodes/accessors/ReferenceBaseNode.js index 2721f5948ea516..50de2ebd01e5f8 100644 --- a/src/nodes/accessors/ReferenceBaseNode.js +++ b/src/nodes/accessors/ReferenceBaseNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import { uniform } from '../core/UniformNode.js'; import { nodeObject } from '../tsl/TSLCore.js'; @@ -137,7 +137,7 @@ class ReferenceBaseNode extends Node { export default ReferenceBaseNode; -registerNodeClass( 'ReferenceBase', ReferenceBaseNode ); +ReferenceBaseNode.type = /*@__PURE__*/ registerNode( 'ReferenceBase', ReferenceBaseNode ); export const reference = ( name, type, object ) => nodeObject( new ReferenceBaseNode( name, type, object ) ); export const referenceBuffer = ( name, type, count, object ) => nodeObject( new ReferenceBaseNode( name, type, object, count ) ); diff --git a/src/nodes/accessors/ReferenceNode.js b/src/nodes/accessors/ReferenceNode.js index 296312efc0548d..9b48fa0e380e4d 100644 --- a/src/nodes/accessors/ReferenceNode.js +++ b/src/nodes/accessors/ReferenceNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import { uniform } from '../core/UniformNode.js'; import { texture } from './TextureNode.js'; @@ -166,7 +166,7 @@ class ReferenceNode extends Node { export default ReferenceNode; -registerNodeClass( 'Reference', ReferenceNode ); +ReferenceNode.type = /*@__PURE__*/ registerNode( 'Reference', ReferenceNode ); export const reference = ( name, type, object ) => nodeObject( new ReferenceNode( name, type, object ) ); export const referenceBuffer = ( name, type, count, object ) => nodeObject( new ReferenceNode( name, type, object, count ) ); diff --git a/src/nodes/accessors/ReflectVector.js b/src/nodes/accessors/ReflectVector.js index 48f01f5d66a250..eafd166528c771 100644 --- a/src/nodes/accessors/ReflectVector.js +++ b/src/nodes/accessors/ReflectVector.js @@ -3,8 +3,8 @@ import { transformedNormalView } from './Normal.js'; import { positionViewDirection } from './Position.js'; import { materialRefractionRatio } from './MaterialProperties.js'; -export const reflectView = /*#__PURE__*/ positionViewDirection.negate().reflect( transformedNormalView ); -export const refractView = /*#__PURE__*/ positionViewDirection.negate().refract( transformedNormalView, materialRefractionRatio ); +export const reflectView = /*@__PURE__*/ positionViewDirection.negate().reflect( transformedNormalView ); +export const refractView = /*@__PURE__*/ positionViewDirection.negate().refract( transformedNormalView, materialRefractionRatio ); -export const reflectVector = /*#__PURE__*/ reflectView.transformDirection( cameraViewMatrix ).toVar( 'reflectVector' ); -export const refractVector = /*#__PURE__*/ refractView.transformDirection( cameraViewMatrix ).toVar( 'reflectVector' ); +export const reflectVector = /*@__PURE__*/ reflectView.transformDirection( cameraViewMatrix ).toVar( 'reflectVector' ); +export const refractVector = /*@__PURE__*/ refractView.transformDirection( cameraViewMatrix ).toVar( 'reflectVector' ); diff --git a/src/nodes/accessors/RendererReferenceNode.js b/src/nodes/accessors/RendererReferenceNode.js index 1601c3ff192cc6..65a4ca177ac064 100644 --- a/src/nodes/accessors/RendererReferenceNode.js +++ b/src/nodes/accessors/RendererReferenceNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import ReferenceBaseNode from './ReferenceBaseNode.js'; import { nodeObject } from '../tsl/TSLCore.js'; @@ -24,6 +24,6 @@ class RendererReferenceNode extends ReferenceBaseNode { export default RendererReferenceNode; -registerNodeClass( 'RendererReference', RendererReferenceNode ); +RendererReferenceNode.type = /*@__PURE__*/ registerNode( 'RendererReference', RendererReferenceNode ); export const rendererReference = ( name, type, renderer ) => nodeObject( new RendererReferenceNode( name, type, renderer ) ); diff --git a/src/nodes/accessors/SceneNode.js b/src/nodes/accessors/SceneNode.js index 7f28b1e9bbdb7b..3934bbc38e9cad 100644 --- a/src/nodes/accessors/SceneNode.js +++ b/src/nodes/accessors/SceneNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeImmutable } from '../tsl/TSLBase.js'; import { reference } from './ReferenceNode.js'; @@ -45,7 +45,7 @@ SceneNode.BACKGROUND_INTENSITY = 'backgroundIntensity'; export default SceneNode; -registerNodeClass( 'Scene', SceneNode ); +SceneNode.type = /*@__PURE__*/ registerNode( 'Scene', SceneNode ); -export const backgroundBlurriness = nodeImmutable( SceneNode, SceneNode.BACKGROUND_BLURRINESS ); -export const backgroundIntensity = nodeImmutable( SceneNode, SceneNode.BACKGROUND_INTENSITY ); +export const backgroundBlurriness = /*@__PURE__*/ nodeImmutable( SceneNode, SceneNode.BACKGROUND_BLURRINESS ); +export const backgroundIntensity = /*@__PURE__*/ nodeImmutable( SceneNode, SceneNode.BACKGROUND_INTENSITY ); diff --git a/src/nodes/accessors/SkinningNode.js b/src/nodes/accessors/SkinningNode.js index 1213960000aacd..e4cfc9c9a33e4d 100644 --- a/src/nodes/accessors/SkinningNode.js +++ b/src/nodes/accessors/SkinningNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import { nodeObject } from '../tsl/TSLBase.js'; import { attribute } from '../core/AttributeNode.js'; @@ -181,7 +181,7 @@ class SkinningNode extends Node { export default SkinningNode; -registerNodeClass( 'Skinning', SkinningNode ); +SkinningNode.type = /*@__PURE__*/ registerNode( 'Skinning', SkinningNode ); export const skinning = ( skinnedMesh ) => nodeObject( new SkinningNode( skinnedMesh ) ); export const skinningReference = ( skinnedMesh ) => nodeObject( new SkinningNode( skinnedMesh, true ) ); diff --git a/src/nodes/accessors/StorageBufferNode.js b/src/nodes/accessors/StorageBufferNode.js index 69009811c2bb69..f917daf35539f8 100644 --- a/src/nodes/accessors/StorageBufferNode.js +++ b/src/nodes/accessors/StorageBufferNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import BufferNode from './BufferNode.js'; import { bufferAttribute } from './BufferAttributeNode.js'; import { nodeObject, varying } from '../tsl/TSLBase.js'; @@ -122,7 +122,7 @@ class StorageBufferNode extends BufferNode { export default StorageBufferNode; -registerNodeClass( 'StorageBuffer', StorageBufferNode ); +StorageBufferNode.type = /*@__PURE__*/ registerNode( 'StorageBuffer', StorageBufferNode ); // Read-Write Storage export const storage = ( value, type, count ) => nodeObject( new StorageBufferNode( value, type, count ) ); diff --git a/src/nodes/accessors/StorageTextureNode.js b/src/nodes/accessors/StorageTextureNode.js index f339ade144eb28..2809c9ba632523 100644 --- a/src/nodes/accessors/StorageTextureNode.js +++ b/src/nodes/accessors/StorageTextureNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TextureNode from './TextureNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; import { GPUStorageTextureAccess } from '../../renderers/webgpu/utils/WebGPUConstants.js'; @@ -89,9 +89,9 @@ class StorageTextureNode extends TextureNode { export default StorageTextureNode; -registerNodeClass( 'StorageTexture', StorageTextureNode ); +StorageTextureNode.type = /*@__PURE__*/ registerNode( 'StorageTexture', StorageTextureNode ); -export const storageTexture = nodeProxy( StorageTextureNode ); +export const storageTexture = /*@__PURE__*/ nodeProxy( StorageTextureNode ); export const textureStore = ( value, uvNode, storeNode ) => { diff --git a/src/nodes/accessors/Tangent.js b/src/nodes/accessors/Tangent.js index 3983ab95e15790..18ca58a29a78fe 100644 --- a/src/nodes/accessors/Tangent.js +++ b/src/nodes/accessors/Tangent.js @@ -3,7 +3,7 @@ import { cameraViewMatrix } from './Camera.js'; import { modelViewMatrix } from './ModelNode.js'; import { Fn, vec4 } from '../tsl/TSLBase.js'; -export const tangentGeometry = /*#__PURE__*/ Fn( ( builder ) => { +export const tangentGeometry = /*@__PURE__*/ Fn( ( builder ) => { if ( builder.geometry.hasAttribute( 'tangent' ) === false ) { @@ -15,8 +15,8 @@ export const tangentGeometry = /*#__PURE__*/ Fn( ( builder ) => { } )(); -export const tangentLocal = /*#__PURE__*/ tangentGeometry.xyz.toVar( 'tangentLocal' ); -export const tangentView = /*#__PURE__*/ modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.varying( 'v_tangentView' ).normalize().toVar( 'tangentView' ); -export const tangentWorld = /*#__PURE__*/ tangentView.transformDirection( cameraViewMatrix ).varying( 'v_tangentWorld' ).normalize().toVar( 'tangentWorld' ); -export const transformedTangentView = /*#__PURE__*/ tangentView.toVar( 'transformedTangentView' ); -export const transformedTangentWorld = /*#__PURE__*/ transformedTangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedTangentWorld' ); +export const tangentLocal = /*@__PURE__*/ tangentGeometry.xyz.toVar( 'tangentLocal' ); +export const tangentView = /*@__PURE__*/ modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.varying( 'v_tangentView' ).normalize().toVar( 'tangentView' ); +export const tangentWorld = /*@__PURE__*/ tangentView.transformDirection( cameraViewMatrix ).varying( 'v_tangentWorld' ).normalize().toVar( 'tangentWorld' ); +export const transformedTangentView = /*@__PURE__*/ tangentView.toVar( 'transformedTangentView' ); +export const transformedTangentWorld = /*@__PURE__*/ transformedTangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedTangentWorld' ); diff --git a/src/nodes/accessors/Texture3DNode.js b/src/nodes/accessors/Texture3DNode.js index d0d06192327ef7..fd7fe4b6a8d23e 100644 --- a/src/nodes/accessors/Texture3DNode.js +++ b/src/nodes/accessors/Texture3DNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TextureNode from './TextureNode.js'; import { nodeProxy, vec3, Fn, If } from '../tsl/TSLBase.js'; @@ -95,6 +95,6 @@ class Texture3DNode extends TextureNode { export default Texture3DNode; -registerNodeClass( 'Texture3D', Texture3DNode ); +Texture3DNode.type = /*@__PURE__*/ registerNode( 'Texture3D', Texture3DNode ); -export const texture3D = nodeProxy( Texture3DNode ); +export const texture3D = /*@__PURE__*/ nodeProxy( Texture3DNode ); diff --git a/src/nodes/accessors/TextureBicubic.js b/src/nodes/accessors/TextureBicubic.js index 1fe7752f3edd69..7682f0ab014cf4 100644 --- a/src/nodes/accessors/TextureBicubic.js +++ b/src/nodes/accessors/TextureBicubic.js @@ -51,7 +51,7 @@ const bicubic = ( textureNode, texelSize, lod ) => { }; -export const textureBicubic = Fn( ( [ textureNode, lodNode = float( 3 ) ] ) => { +export const textureBicubic = /*@__PURE__*/ Fn( ( [ textureNode, lodNode = float( 3 ) ] ) => { const fLodSize = vec2( textureNode.size( int( lodNode ) ) ); const cLodSize = vec2( textureNode.size( int( lodNode.add( 1.0 ) ) ) ); diff --git a/src/nodes/accessors/TextureNode.js b/src/nodes/accessors/TextureNode.js index 73f42ab44976c2..36244cd4153672 100644 --- a/src/nodes/accessors/TextureNode.js +++ b/src/nodes/accessors/TextureNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import UniformNode, { uniform } from '../core/UniformNode.js'; import { uv } from './UV.js'; import { textureSize } from './TextureSizeNode.js'; @@ -430,9 +430,9 @@ class TextureNode extends UniformNode { export default TextureNode; -registerNodeClass( 'Texture', TextureNode ); +TextureNode.type = /*@__PURE__*/ registerNode( 'Texture', TextureNode ); -export const texture = nodeProxy( TextureNode ); +export const texture = /*@__PURE__*/ nodeProxy( TextureNode ); export const textureLoad = ( ...params ) => texture( ...params ).setSampler( false ); //export const textureLevel = ( value, uv, level ) => texture( value, uv ).level( level ); diff --git a/src/nodes/accessors/TextureSizeNode.js b/src/nodes/accessors/TextureSizeNode.js index bd078641fe38ae..72de83c2965622 100644 --- a/src/nodes/accessors/TextureSizeNode.js +++ b/src/nodes/accessors/TextureSizeNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import Node from '../core/Node.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -28,6 +28,6 @@ class TextureSizeNode extends Node { export default TextureSizeNode; -registerNodeClass( 'TextureSize', TextureSizeNode ); +TextureSizeNode.type = /*@__PURE__*/ registerNode( 'TextureSize', TextureSizeNode ); -export const textureSize = nodeProxy( TextureSizeNode ); +export const textureSize = /*@__PURE__*/ nodeProxy( TextureSizeNode ); diff --git a/src/nodes/accessors/UniformArrayNode.js b/src/nodes/accessors/UniformArrayNode.js index 0b44de82710dae..ce97313c5af4e0 100644 --- a/src/nodes/accessors/UniformArrayNode.js +++ b/src/nodes/accessors/UniformArrayNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import { nodeObject } from '../tsl/TSLBase.js'; import { NodeUpdateType } from '../core/constants.js'; import { getValueType } from '../core/NodeUtils.js'; @@ -141,7 +141,7 @@ class UniformArrayNode extends BufferNode { export default UniformArrayNode; -registerNodeClass( 'UniformArray', UniformArrayNode ); +UniformArrayNode.type = /*@__PURE__*/ registerNode( 'UniformArray', UniformArrayNode ); export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) ); diff --git a/src/nodes/accessors/UserDataNode.js b/src/nodes/accessors/UserDataNode.js index 65da59844e2e55..c18c590a365790 100644 --- a/src/nodes/accessors/UserDataNode.js +++ b/src/nodes/accessors/UserDataNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import ReferenceNode from './ReferenceNode.js'; import { nodeObject } from '../tsl/TSLBase.js'; @@ -24,6 +24,6 @@ class UserDataNode extends ReferenceNode { export default UserDataNode; -registerNodeClass( 'UserData', UserDataNode ); +UserDataNode.type = /*@__PURE__*/ registerNode( 'UserData', UserDataNode ); export const userData = ( name, inputType, userData ) => nodeObject( new UserDataNode( name, inputType, userData ) ); diff --git a/src/nodes/accessors/VelocityNode.js b/src/nodes/accessors/VelocityNode.js index 049bc3cd50f8d2..0729a082cf9907 100644 --- a/src/nodes/accessors/VelocityNode.js +++ b/src/nodes/accessors/VelocityNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { modelViewMatrix } from './ModelNode.js'; import { positionLocal, positionPrevious } from './Position.js'; @@ -78,6 +78,6 @@ function getPreviousMatrix( object ) { export default VelocityNode; -registerNodeClass( 'Velocity', VelocityNode ); +VelocityNode.type = /*@__PURE__*/ registerNode( 'Velocity', VelocityNode ); -export const velocity = nodeImmutable( VelocityNode ); +export const velocity = /*@__PURE__*/ nodeImmutable( VelocityNode ); diff --git a/src/nodes/accessors/VertexColorNode.js b/src/nodes/accessors/VertexColorNode.js index b7b88fd7452217..622b80db04e489 100644 --- a/src/nodes/accessors/VertexColorNode.js +++ b/src/nodes/accessors/VertexColorNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AttributeNode from '../core/AttributeNode.js'; import { nodeObject } from '../tsl/TSLBase.js'; @@ -66,6 +66,6 @@ class VertexColorNode extends AttributeNode { export default VertexColorNode; -registerNodeClass( 'VertexColor', VertexColorNode ); +VertexColorNode.type = /*@__PURE__*/ registerNode( 'VertexColor', VertexColorNode ); export const vertexColor = ( ...params ) => nodeObject( new VertexColorNode( ...params ) ); diff --git a/src/nodes/code/CodeNode.js b/src/nodes/code/CodeNode.js index 6dac776dbc46b0..9ecbfa0853be6b 100644 --- a/src/nodes/code/CodeNode.js +++ b/src/nodes/code/CodeNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeProxy } from '../tsl/TSLBase.js'; class CodeNode extends Node { @@ -75,9 +75,9 @@ class CodeNode extends Node { export default CodeNode; -registerNodeClass( 'Code', CodeNode ); +CodeNode.type = /*@__PURE__*/ registerNode( 'Code', CodeNode ); -export const code = nodeProxy( CodeNode ); +export const code = /*@__PURE__*/ nodeProxy( CodeNode ); export const js = ( src, includes ) => code( src, includes, 'js' ); export const wgsl = ( src, includes ) => code( src, includes, 'wgsl' ); diff --git a/src/nodes/code/ExpressionNode.js b/src/nodes/code/ExpressionNode.js index 5c56363192f5c1..f0ae62c5181da6 100644 --- a/src/nodes/code/ExpressionNode.js +++ b/src/nodes/code/ExpressionNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeProxy } from '../tsl/TSLCore.js'; class ExpressionNode extends Node { @@ -32,6 +32,6 @@ class ExpressionNode extends Node { export default ExpressionNode; -registerNodeClass( 'Expression', ExpressionNode ); +ExpressionNode.type = /*@__PURE__*/ registerNode( 'Expression', ExpressionNode ); -export const expression = nodeProxy( ExpressionNode ); +export const expression = /*@__PURE__*/ nodeProxy( ExpressionNode ); diff --git a/src/nodes/code/FunctionCallNode.js b/src/nodes/code/FunctionCallNode.js index 83f9a4018821e2..09bd26be24cfb4 100644 --- a/src/nodes/code/FunctionCallNode.js +++ b/src/nodes/code/FunctionCallNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { addMethodChaining, nodeArray, nodeObject, nodeObjects } from '../tsl/TSLCore.js'; @@ -83,7 +83,7 @@ class FunctionCallNode extends TempNode { export default FunctionCallNode; -registerNodeClass( 'FunctionCall', FunctionCallNode ); +FunctionCallNode.type = /*@__PURE__*/ registerNode( 'FunctionCall', FunctionCallNode ); export const call = ( func, ...params ) => { diff --git a/src/nodes/code/FunctionNode.js b/src/nodes/code/FunctionNode.js index 2a04618cfa76c1..ea958c3cfd554b 100644 --- a/src/nodes/code/FunctionNode.js +++ b/src/nodes/code/FunctionNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import CodeNode from './CodeNode.js'; import { nodeObject } from '../tsl/TSLBase.js'; @@ -81,7 +81,7 @@ class FunctionNode extends CodeNode { export default FunctionNode; -registerNodeClass( 'Function', FunctionNode ); +FunctionNode.type = /*@__PURE__*/ registerNode( 'Function', FunctionNode ); const nativeFn = ( code, includes = [], language = '' ) => { diff --git a/src/nodes/code/ScriptableNode.js b/src/nodes/code/ScriptableNode.js index 7398cdd68d4e10..bf6e330a59e450 100644 --- a/src/nodes/code/ScriptableNode.js +++ b/src/nodes/code/ScriptableNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { scriptableValue } from './ScriptableValueNode.js'; import { nodeProxy, float } from '../tsl/TSLBase.js'; @@ -495,6 +495,6 @@ class ScriptableNode extends Node { export default ScriptableNode; -registerNodeClass( 'Scriptable', ScriptableNode ); +ScriptableNode.type = /*@__PURE__*/ registerNode( 'Scriptable', ScriptableNode ); -export const scriptable = nodeProxy( ScriptableNode ); +export const scriptable = /*@__PURE__*/ nodeProxy( ScriptableNode ); diff --git a/src/nodes/code/ScriptableValueNode.js b/src/nodes/code/ScriptableValueNode.js index f736b5a02d6dbb..eea06e9cbfb762 100644 --- a/src/nodes/code/ScriptableValueNode.js +++ b/src/nodes/code/ScriptableValueNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { arrayBufferToBase64, base64ToArrayBuffer } from '../core/NodeUtils.js'; import { nodeProxy, float } from '../tsl/TSLBase.js'; @@ -161,6 +161,6 @@ class ScriptableValueNode extends Node { export default ScriptableValueNode; -registerNodeClass( 'ScriptableValue', ScriptableValueNode ); +ScriptableValueNode.type = /*@__PURE__*/ registerNode( 'ScriptableValue', ScriptableValueNode ); -export const scriptableValue = nodeProxy( ScriptableValueNode ); +export const scriptableValue = /*@__PURE__*/ nodeProxy( ScriptableValueNode ); diff --git a/src/nodes/core/AssignNode.js b/src/nodes/core/AssignNode.js index fc080b6d36ca5f..a246673450127b 100644 --- a/src/nodes/core/AssignNode.js +++ b/src/nodes/core/AssignNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; import { vectorComponents } from '../core/constants.js'; @@ -121,8 +121,8 @@ class AssignNode extends TempNode { export default AssignNode; -registerNodeClass( 'Assign', AssignNode ); +AssignNode.type = /*@__PURE__*/ registerNode( 'Assign', AssignNode ); -export const assign = nodeProxy( AssignNode ); +export const assign = /*@__PURE__*/ nodeProxy( AssignNode ); addMethodChaining( 'assign', assign ); diff --git a/src/nodes/core/AttributeNode.js b/src/nodes/core/AttributeNode.js index 439107721b2ba7..712da43d3d6659 100644 --- a/src/nodes/core/AttributeNode.js +++ b/src/nodes/core/AttributeNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { nodeObject, varying } from '../tsl/TSLBase.js'; class AttributeNode extends Node { @@ -116,6 +116,6 @@ class AttributeNode extends Node { export default AttributeNode; -registerNodeClass( 'Attribute', AttributeNode ); +AttributeNode.type = /*@__PURE__*/ registerNode( 'Attribute', AttributeNode ); export const attribute = ( name, nodeType ) => nodeObject( new AttributeNode( name, nodeType ) ); diff --git a/src/nodes/core/BypassNode.js b/src/nodes/core/BypassNode.js index f620b772df7d12..198b50389c2163 100644 --- a/src/nodes/core/BypassNode.js +++ b/src/nodes/core/BypassNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; class BypassNode extends Node { @@ -38,8 +38,8 @@ class BypassNode extends Node { export default BypassNode; -registerNodeClass( 'Bypass', BypassNode ); +BypassNode.type = /*@__PURE__*/ registerNode( 'Bypass', BypassNode ); -export const bypass = nodeProxy( BypassNode ); +export const bypass = /*@__PURE__*/ nodeProxy( BypassNode ); addMethodChaining( 'bypass', bypass ); diff --git a/src/nodes/core/CacheNode.js b/src/nodes/core/CacheNode.js index 8f80efbc4c4582..1b0ebce8dd7998 100644 --- a/src/nodes/core/CacheNode.js +++ b/src/nodes/core/CacheNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js'; class CacheNode extends Node { @@ -39,7 +39,7 @@ class CacheNode extends Node { export default CacheNode; -registerNodeClass( 'Cache', CacheNode ); +CacheNode.type = /*@__PURE__*/ registerNode( 'Cache', CacheNode ); export const cache = ( node, ...params ) => nodeObject( new CacheNode( nodeObject( node ), ...params ) ); diff --git a/src/nodes/core/ConstNode.js b/src/nodes/core/ConstNode.js index 0ac95093ab1fef..3680e0c0717eff 100644 --- a/src/nodes/core/ConstNode.js +++ b/src/nodes/core/ConstNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from './Node.js'; +import { registerNode } from './Node.js'; import InputNode from './InputNode.js'; class ConstNode extends InputNode { @@ -29,4 +29,4 @@ class ConstNode extends InputNode { export default ConstNode; -registerNodeClass( 'Const', ConstNode ); +ConstNode.type = /*@__PURE__*/ registerNode( 'Const', ConstNode ); diff --git a/src/nodes/core/ContextNode.js b/src/nodes/core/ContextNode.js index 706fefe70ec563..b0b4e54e82df02 100644 --- a/src/nodes/core/ContextNode.js +++ b/src/nodes/core/ContextNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; class ContextNode extends Node { @@ -64,9 +64,9 @@ class ContextNode extends Node { export default ContextNode; -registerNodeClass( 'Context', ContextNode ); +ContextNode.type = /*@__PURE__*/ registerNode( 'Context', ContextNode ); -export const context = nodeProxy( ContextNode ); +export const context = /*@__PURE__*/ nodeProxy( ContextNode ); export const label = ( node, name ) => context( node, { label: name } ); addMethodChaining( 'context', context ); diff --git a/src/nodes/core/IndexNode.js b/src/nodes/core/IndexNode.js index 8ee3c8bac4b08a..9413c3bd51106a 100644 --- a/src/nodes/core/IndexNode.js +++ b/src/nodes/core/IndexNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { nodeImmutable, varying } from '../tsl/TSLBase.js'; class IndexNode extends Node { @@ -69,9 +69,9 @@ IndexNode.DRAW = 'draw'; export default IndexNode; -registerNodeClass( 'Index', IndexNode ); +IndexNode.type = /*@__PURE__*/ registerNode( 'Index', IndexNode ); -export const vertexIndex = nodeImmutable( IndexNode, IndexNode.VERTEX ); -export const instanceIndex = nodeImmutable( IndexNode, IndexNode.INSTANCE ); -export const invocationLocalIndex = nodeImmutable( IndexNode, IndexNode.INVOCATION_LOCAL ); -export const drawIndex = nodeImmutable( IndexNode, IndexNode.DRAW ); +export const vertexIndex = /*@__PURE__*/ nodeImmutable( IndexNode, IndexNode.VERTEX ); +export const instanceIndex = /*@__PURE__*/ nodeImmutable( IndexNode, IndexNode.INSTANCE ); +export const invocationLocalIndex = /*@__PURE__*/ nodeImmutable( IndexNode, IndexNode.INVOCATION_LOCAL ); +export const drawIndex = /*@__PURE__*/ nodeImmutable( IndexNode, IndexNode.DRAW ); diff --git a/src/nodes/core/InputNode.js b/src/nodes/core/InputNode.js index 38558b1aac7835..a1999477285800 100644 --- a/src/nodes/core/InputNode.js +++ b/src/nodes/core/InputNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { getValueType, getValueFromType, arrayBufferToBase64 } from './NodeUtils.js'; class InputNode extends Node { @@ -80,4 +80,4 @@ class InputNode extends Node { export default InputNode; -registerNodeClass( 'Input', InputNode ); +InputNode.type = /*@__PURE__*/ registerNode( 'Input', InputNode ); diff --git a/src/nodes/core/MRTNode.js b/src/nodes/core/MRTNode.js index 8a5cc83c85e8bb..4443c5c9b07905 100644 --- a/src/nodes/core/MRTNode.js +++ b/src/nodes/core/MRTNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from './Node.js'; +import { registerNode } from './Node.js'; import OutputStructNode from './OutputStructNode.js'; import { nodeProxy, vec4 } from '../tsl/TSLBase.js'; @@ -77,6 +77,6 @@ class MRTNode extends OutputStructNode { export default MRTNode; -registerNodeClass( 'MRT', MRTNode ); +MRTNode.type = /*@__PURE__*/ registerNode( 'MRT', MRTNode ); -export const mrt = nodeProxy( MRTNode ); +export const mrt = /*@__PURE__*/ nodeProxy( MRTNode ); diff --git a/src/nodes/core/Node.js b/src/nodes/core/Node.js index e5d0feabb5ae06..2d800c70f3aa9a 100644 --- a/src/nodes/core/Node.js +++ b/src/nodes/core/Node.js @@ -4,7 +4,7 @@ import { getNodeChildren, getCacheKey } from './NodeUtils.js'; import { EventDispatcher } from '../../core/EventDispatcher.js'; import { MathUtils } from '../../math/MathUtils.js'; -const NodeClasses = new Map(); +const Nodes = new Map(); let _nodeId = 0; @@ -541,34 +541,39 @@ class Node extends EventDispatcher { export default Node; -export function registerNodeClass( type, nodeClass ) { +Node.type = /*@__PURE__*/ registerNode( '', Node ); - const nodeType = type + 'Node'; +export function registerNode( type, nodeClass ) { - if ( typeof nodeClass !== 'function' || ! type ) throw new Error( `TSL.Node: Node class ${ type } is not a class` ); + const suffix = 'Node'; + const nodeType = type + suffix; - if ( NodeClasses.has( nodeType ) ) { + if ( typeof nodeClass !== 'function' ) throw new Error( `TSL.Node: Node class ${ type } is not a class` ); + + if ( Nodes.has( nodeType ) ) { console.warn( `TSL.Node: Redefinition of node class ${ nodeType }` ); return; } - if ( type.slice( - 4 ) === 'Node' ) { + if ( type.slice( - suffix.length ) === suffix ) { - console.warn( `TSL.Node: Node class ${ nodeType } should not have 'Node' suffix.` ); + console.warn( `TSL.Node: Node class ${ nodeType } should not have '${ suffix }' suffix.` ); return; } - NodeClasses.set( nodeType, nodeClass ); + Nodes.set( nodeType, nodeClass ); nodeClass.type = nodeType; + return nodeType; + } export function createNodeFromType( type ) { - const Class = NodeClasses.get( type ); + const Class = Nodes.get( type ); if ( Class !== undefined ) { @@ -580,7 +585,7 @@ export function createNodeFromType( type ) { export function addNodeClass( type, nodeClass ) { - console.warn( 'TSL.Node: Function addNodeClass() is deprecated. Use registerNodeClass() instead.' ); - registerNodeClass( type.slice( 0, - 4 ), nodeClass ); + console.warn( 'TSL.Node: Function addNodeClass() is deprecated. Use /*@__PURE__*/ registerNode() instead.' ); + /*@__PURE__*/ registerNode( type.slice( 0, - 4 ), nodeClass ); } diff --git a/src/nodes/core/OutputStructNode.js b/src/nodes/core/OutputStructNode.js index 138b01e9b21962..1227033e9ef51d 100644 --- a/src/nodes/core/OutputStructNode.js +++ b/src/nodes/core/OutputStructNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import StructTypeNode from './StructTypeNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -54,6 +54,6 @@ class OutputStructNode extends Node { export default OutputStructNode; -registerNodeClass( 'OutputStruct', OutputStructNode ); +OutputStructNode.type = /*@__PURE__*/ registerNode( 'OutputStruct', OutputStructNode ); -export const outputStruct = nodeProxy( OutputStructNode ); +export const outputStruct = /*@__PURE__*/ nodeProxy( OutputStructNode ); diff --git a/src/nodes/core/ParameterNode.js b/src/nodes/core/ParameterNode.js index 2367f6fbe0a3e3..ba6872c9a82f11 100644 --- a/src/nodes/core/ParameterNode.js +++ b/src/nodes/core/ParameterNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from './Node.js'; +import { registerNode } from './Node.js'; import { nodeObject } from '../tsl/TSLBase.js'; import PropertyNode from './PropertyNode.js'; @@ -28,6 +28,6 @@ class ParameterNode extends PropertyNode { export default ParameterNode; -registerNodeClass( 'Parameter', ParameterNode ); +ParameterNode.type = /*@__PURE__*/ registerNode( 'Parameter', ParameterNode ); export const parameter = ( type, name ) => nodeObject( new ParameterNode( type, name ) ); diff --git a/src/nodes/core/PropertyNode.js b/src/nodes/core/PropertyNode.js index 63a335013feae5..8c092b741e4700 100644 --- a/src/nodes/core/PropertyNode.js +++ b/src/nodes/core/PropertyNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { nodeImmutable, nodeObject } from '../tsl/TSLCore.js'; class PropertyNode extends Node { @@ -49,36 +49,36 @@ class PropertyNode extends Node { export default PropertyNode; -registerNodeClass( 'Property', PropertyNode ); +PropertyNode.type = /*@__PURE__*/ registerNode( 'Property', PropertyNode ); export const property = ( type, name ) => nodeObject( new PropertyNode( type, name ) ); export const varyingProperty = ( type, name ) => nodeObject( new PropertyNode( type, name, true ) ); -export const diffuseColor = nodeImmutable( PropertyNode, 'vec4', 'DiffuseColor' ); -export const emissive = nodeImmutable( PropertyNode, 'vec3', 'EmissiveColor' ); -export const roughness = nodeImmutable( PropertyNode, 'float', 'Roughness' ); -export const metalness = nodeImmutable( PropertyNode, 'float', 'Metalness' ); -export const clearcoat = nodeImmutable( PropertyNode, 'float', 'Clearcoat' ); -export const clearcoatRoughness = nodeImmutable( PropertyNode, 'float', 'ClearcoatRoughness' ); -export const sheen = nodeImmutable( PropertyNode, 'vec3', 'Sheen' ); -export const sheenRoughness = nodeImmutable( PropertyNode, 'float', 'SheenRoughness' ); -export const iridescence = nodeImmutable( PropertyNode, 'float', 'Iridescence' ); -export const iridescenceIOR = nodeImmutable( PropertyNode, 'float', 'IridescenceIOR' ); -export const iridescenceThickness = nodeImmutable( PropertyNode, 'float', 'IridescenceThickness' ); -export const alphaT = nodeImmutable( PropertyNode, 'float', 'AlphaT' ); -export const anisotropy = nodeImmutable( PropertyNode, 'float', 'Anisotropy' ); -export const anisotropyT = nodeImmutable( PropertyNode, 'vec3', 'AnisotropyT' ); -export const anisotropyB = nodeImmutable( PropertyNode, 'vec3', 'AnisotropyB' ); -export const specularColor = nodeImmutable( PropertyNode, 'color', 'SpecularColor' ); -export const specularF90 = nodeImmutable( PropertyNode, 'float', 'SpecularF90' ); -export const shininess = nodeImmutable( PropertyNode, 'float', 'Shininess' ); -export const output = nodeImmutable( PropertyNode, 'vec4', 'Output' ); -export const dashSize = nodeImmutable( PropertyNode, 'float', 'dashSize' ); -export const gapSize = nodeImmutable( PropertyNode, 'float', 'gapSize' ); -export const pointWidth = nodeImmutable( PropertyNode, 'float', 'pointWidth' ); -export const ior = nodeImmutable( PropertyNode, 'float', 'IOR' ); -export const transmission = nodeImmutable( PropertyNode, 'float', 'Transmission' ); -export const thickness = nodeImmutable( PropertyNode, 'float', 'Thickness' ); -export const attenuationDistance = nodeImmutable( PropertyNode, 'float', 'AttenuationDistance' ); -export const attenuationColor = nodeImmutable( PropertyNode, 'color', 'AttenuationColor' ); -export const dispersion = nodeImmutable( PropertyNode, 'float', 'Dispersion' ); +export const diffuseColor = /*@__PURE__*/ nodeImmutable( PropertyNode, 'vec4', 'DiffuseColor' ); +export const emissive = /*@__PURE__*/ nodeImmutable( PropertyNode, 'vec3', 'EmissiveColor' ); +export const roughness = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Roughness' ); +export const metalness = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Metalness' ); +export const clearcoat = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Clearcoat' ); +export const clearcoatRoughness = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'ClearcoatRoughness' ); +export const sheen = /*@__PURE__*/ nodeImmutable( PropertyNode, 'vec3', 'Sheen' ); +export const sheenRoughness = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'SheenRoughness' ); +export const iridescence = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Iridescence' ); +export const iridescenceIOR = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'IridescenceIOR' ); +export const iridescenceThickness = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'IridescenceThickness' ); +export const alphaT = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'AlphaT' ); +export const anisotropy = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Anisotropy' ); +export const anisotropyT = /*@__PURE__*/ nodeImmutable( PropertyNode, 'vec3', 'AnisotropyT' ); +export const anisotropyB = /*@__PURE__*/ nodeImmutable( PropertyNode, 'vec3', 'AnisotropyB' ); +export const specularColor = /*@__PURE__*/ nodeImmutable( PropertyNode, 'color', 'SpecularColor' ); +export const specularF90 = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'SpecularF90' ); +export const shininess = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Shininess' ); +export const output = /*@__PURE__*/ nodeImmutable( PropertyNode, 'vec4', 'Output' ); +export const dashSize = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'dashSize' ); +export const gapSize = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'gapSize' ); +export const pointWidth = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'pointWidth' ); +export const ior = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'IOR' ); +export const transmission = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Transmission' ); +export const thickness = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Thickness' ); +export const attenuationDistance = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'AttenuationDistance' ); +export const attenuationColor = /*@__PURE__*/ nodeImmutable( PropertyNode, 'color', 'AttenuationColor' ); +export const dispersion = /*@__PURE__*/ nodeImmutable( PropertyNode, 'float', 'Dispersion' ); diff --git a/src/nodes/core/StackNode.js b/src/nodes/core/StackNode.js index d334422e7e4503..73848e1cc227b0 100644 --- a/src/nodes/core/StackNode.js +++ b/src/nodes/core/StackNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { select } from '../math/ConditionalNode.js'; import { ShaderNode, nodeProxy, getCurrentStack, setCurrentStack } from '../tsl/TSLBase.js'; @@ -100,6 +100,6 @@ class StackNode extends Node { export default StackNode; -registerNodeClass( 'Stack', StackNode ); +StackNode.type = /*@__PURE__*/ registerNode( 'Stack', StackNode ); -export const stack = nodeProxy( StackNode ); +export const stack = /*@__PURE__*/ nodeProxy( StackNode ); diff --git a/src/nodes/core/StructTypeNode.js b/src/nodes/core/StructTypeNode.js index bb51c2867ee563..a49b8558aa0dab 100644 --- a/src/nodes/core/StructTypeNode.js +++ b/src/nodes/core/StructTypeNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; class StructTypeNode extends Node { @@ -21,4 +21,4 @@ class StructTypeNode extends Node { export default StructTypeNode; -registerNodeClass( 'StructType', StructTypeNode ); +StructTypeNode.type = /*@__PURE__*/ registerNode( 'StructType', StructTypeNode ); diff --git a/src/nodes/core/TempNode.js b/src/nodes/core/TempNode.js index b2266f0651870b..b10d2bf371f33c 100644 --- a/src/nodes/core/TempNode.js +++ b/src/nodes/core/TempNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; class TempNode extends Node { @@ -55,4 +55,4 @@ class TempNode extends Node { export default TempNode; -registerNodeClass( 'Temp', TempNode ); +TempNode.type = /*@__PURE__*/ registerNode( 'Temp', TempNode ); diff --git a/src/nodes/core/UniformGroupNode.js b/src/nodes/core/UniformGroupNode.js index 95575246f4de58..5c48f43080c79a 100644 --- a/src/nodes/core/UniformGroupNode.js +++ b/src/nodes/core/UniformGroupNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; class UniformGroupNode extends Node { @@ -45,11 +45,11 @@ class UniformGroupNode extends Node { export default UniformGroupNode; -registerNodeClass( 'UniformGroup', UniformGroupNode ); +UniformGroupNode.type = /*@__PURE__*/ registerNode( 'UniformGroup', UniformGroupNode ); export const uniformGroup = ( name ) => new UniformGroupNode( name ); export const sharedUniformGroup = ( name ) => new UniformGroupNode( name, true ); -export const frameGroup = sharedUniformGroup( 'frame' ); -export const renderGroup = sharedUniformGroup( 'render' ); -export const objectGroup = uniformGroup( 'object' ); +export const frameGroup = /*@__PURE__*/ sharedUniformGroup( 'frame' ); +export const renderGroup = /*@__PURE__*/ sharedUniformGroup( 'render' ); +export const objectGroup = /*@__PURE__*/ uniformGroup( 'object' ); diff --git a/src/nodes/core/UniformNode.js b/src/nodes/core/UniformNode.js index 55edf35b1054b1..bbff8f79f17c12 100644 --- a/src/nodes/core/UniformNode.js +++ b/src/nodes/core/UniformNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from './Node.js'; +import { registerNode } from './Node.js'; import InputNode from './InputNode.js'; import { objectGroup } from './UniformGroupNode.js'; import { nodeObject, getConstNodeType } from '../tsl/TSLCore.js'; @@ -95,7 +95,7 @@ class UniformNode extends InputNode { export default UniformNode; -registerNodeClass( 'Uniform', UniformNode ); +UniformNode.type = /*@__PURE__*/ registerNode( 'Uniform', UniformNode ); export const uniform = ( arg1, arg2 ) => { diff --git a/src/nodes/core/VarNode.js b/src/nodes/core/VarNode.js index 539b2124c55f24..baef176f9ccd32 100644 --- a/src/nodes/core/VarNode.js +++ b/src/nodes/core/VarNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; class VarNode extends Node { @@ -48,9 +48,9 @@ class VarNode extends Node { export default VarNode; -registerNodeClass( 'Var', VarNode ); +VarNode.type = /*@__PURE__*/ registerNode( 'Var', VarNode ); -export const temp = nodeProxy( VarNode ); +export const temp = /*@__PURE__*/ nodeProxy( VarNode ); addMethodChaining( 'temp', temp ); // @TODO: Will be removed in the future addMethodChaining( 'toVar', ( ...params ) => temp( ...params ).append() ); diff --git a/src/nodes/core/VaryingNode.js b/src/nodes/core/VaryingNode.js index d7133125c5f5df..027146ae682d9b 100644 --- a/src/nodes/core/VaryingNode.js +++ b/src/nodes/core/VaryingNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from './Node.js'; +import Node, { registerNode } from './Node.js'; import { NodeShaderStage } from './constants.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; @@ -97,8 +97,8 @@ class VaryingNode extends Node { export default VaryingNode; -registerNodeClass( 'Varying', VaryingNode ); +VaryingNode.type = /*@__PURE__*/ registerNode( 'Varying', VaryingNode ); -export const varying = nodeProxy( VaryingNode ); +export const varying = /*@__PURE__*/ nodeProxy( VaryingNode ); addMethodChaining( 'varying', varying ); diff --git a/src/nodes/display/BlendMode.js b/src/nodes/display/BlendMode.js index 069d2aea8bc6d7..ad22b6a69e5315 100644 --- a/src/nodes/display/BlendMode.js +++ b/src/nodes/display/BlendMode.js @@ -1,7 +1,7 @@ import { Fn } from '../tsl/TSLBase.js'; import { mix, min, step } from '../math/MathNode.js'; -export const burn = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { +export const burn = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return min( 1.0, base.oneMinus().div( blend ) ).oneMinus(); @@ -14,7 +14,7 @@ export const burn = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { ] } ); -export const dodge = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { +export const dodge = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return min( base.div( blend.oneMinus() ), 1.0 ); @@ -27,7 +27,7 @@ export const dodge = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { ] } ); -export const screen = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { +export const screen = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return base.oneMinus().mul( blend.oneMinus() ).oneMinus(); @@ -40,7 +40,7 @@ export const screen = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { ] } ); -export const overlay = /*#__PURE__*/ Fn( ( [ base, blend ] ) => { +export const overlay = /*@__PURE__*/ Fn( ( [ base, blend ] ) => { return mix( base.mul( 2.0 ).mul( blend ), base.oneMinus().mul( 2.0 ).mul( blend.oneMinus() ).oneMinus(), step( 0.5, base ) ); diff --git a/src/nodes/display/BumpMapNode.js b/src/nodes/display/BumpMapNode.js index 1729cd87d59cfe..ad8f0d04b84e19 100644 --- a/src/nodes/display/BumpMapNode.js +++ b/src/nodes/display/BumpMapNode.js @@ -72,4 +72,4 @@ class BumpMapNode extends TempNode { export default BumpMapNode; -export const bumpMap = nodeProxy( BumpMapNode ); +export const bumpMap = /*@__PURE__*/ nodeProxy( BumpMapNode ); diff --git a/src/nodes/display/ColorAdjustment.js b/src/nodes/display/ColorAdjustment.js index 845522396638cc..640c9b59fb7787 100644 --- a/src/nodes/display/ColorAdjustment.js +++ b/src/nodes/display/ColorAdjustment.js @@ -4,19 +4,19 @@ import { Fn, float, vec3 } from '../tsl/TSLBase.js'; import { ColorManagement } from '../../math/ColorManagement.js'; import { Vector3 } from '../../math/Vector3.js'; -export const grayscale = /*#__PURE__*/ Fn( ( [ color ] ) => { +export const grayscale = /*@__PURE__*/ Fn( ( [ color ] ) => { return luminance( color.rgb ); } ); -export const saturation = /*#__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { +export const saturation = /*@__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { return adjustment.mix( luminance( color.rgb ), color.rgb ); } ); -export const vibrance = /*#__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { +export const vibrance = /*@__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { const average = add( color.r, color.g, color.b ).div( 3.0 ); @@ -27,7 +27,7 @@ export const vibrance = /*#__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) } ); -export const hue = /*#__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { +export const hue = /*@__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { const k = vec3( 0.57735, 0.57735, 0.57735 ); @@ -37,7 +37,7 @@ export const hue = /*#__PURE__*/ Fn( ( [ color, adjustment = float( 1 ) ] ) => { } ); -const _luminanceCoefficients = /*#__PURE__*/ new Vector3(); +const _luminanceCoefficients = /*@__PURE__*/ new Vector3(); export const luminance = ( color, luminanceCoefficients = vec3( ... ColorManagement.getLuminanceCoefficients( _luminanceCoefficients ) ) diff --git a/src/nodes/display/ColorSpaceFunctions.js b/src/nodes/display/ColorSpaceFunctions.js index 821bc02912777b..e4bfd0c9c33058 100644 --- a/src/nodes/display/ColorSpaceFunctions.js +++ b/src/nodes/display/ColorSpaceFunctions.js @@ -1,7 +1,7 @@ import { mix } from '../math/MathNode.js'; import { Fn } from '../tsl/TSLBase.js'; -export const sRGBToLinearShader = Fn( ( [ color ] ) => { +export const sRGBToLinear = /*@__PURE__*/ Fn( ( [ color ] ) => { const a = color.mul( 0.9478672986 ).add( 0.0521327014 ).pow( 2.4 ); const b = color.mul( 0.0773993808 ); @@ -12,14 +12,14 @@ export const sRGBToLinearShader = Fn( ( [ color ] ) => { return rgbResult; } ).setLayout( { - name: 'sRGBToLinearShader', + name: 'sRGBToLinear', type: 'vec3', inputs: [ { name: 'color', type: 'vec3' } ] } ); -export const LinearTosRGBShader = Fn( ( [ color ] ) => { +export const LinearTosRGB = /*@__PURE__*/ Fn( ( [ color ] ) => { const a = color.pow( 0.41666 ).mul( 1.055 ).sub( 0.055 ); const b = color.mul( 12.92 ); @@ -30,7 +30,7 @@ export const LinearTosRGBShader = Fn( ( [ color ] ) => { return rgbResult; } ).setLayout( { - name: 'LinearTosRGBShader', + name: 'LinearTosRGB', type: 'vec3', inputs: [ { name: 'color', type: 'vec3' } diff --git a/src/nodes/display/ColorSpaceNode.js b/src/nodes/display/ColorSpaceNode.js index 59968275fae25d..f2dccf62ad62d9 100644 --- a/src/nodes/display/ColorSpaceNode.js +++ b/src/nodes/display/ColorSpaceNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { addMethodChaining, nodeObject, vec4 } from '../tsl/TSLCore.js'; @@ -76,7 +76,7 @@ class ColorSpaceNode extends TempNode { export default ColorSpaceNode; -registerNodeClass( 'ColorSpace', ColorSpaceNode ); +ColorSpaceNode.type = /*@__PURE__*/ registerNode( 'ColorSpace', ColorSpaceNode ); export const linearSRGBToColorSpace = ( node, colorSpace = null ) => nodeObject( new ColorSpaceNode( nodeObject( node ), colorSpace, LinearSRGBColorSpace ) ); export const colorSpaceToLinearSRGB = ( node, colorSpace = null ) => nodeObject( new ColorSpaceNode( nodeObject( node ), LinearSRGBColorSpace, colorSpace ) ); diff --git a/src/nodes/display/DenoiseNode.js b/src/nodes/display/DenoiseNode.js index 1a45cc01045a8d..f8bb7dc4a33adf 100644 --- a/src/nodes/display/DenoiseNode.js +++ b/src/nodes/display/DenoiseNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { Fn, nodeObject, float, int, vec2, vec3, vec4, mat2, If } from '../tsl/TSLBase.js'; @@ -163,7 +163,7 @@ class DenoiseNode extends TempNode { export default DenoiseNode; -registerNodeClass( 'Denoise', DenoiseNode ); +DenoiseNode.type = /*@__PURE__*/ registerNode( 'Denoise', DenoiseNode ); function generatePdSamplePointInitializer( samples, rings, radiusExponent ) { diff --git a/src/nodes/display/DepthOfFieldNode.js b/src/nodes/display/DepthOfFieldNode.js index d23153172bf778..c8d42271a70f15 100644 --- a/src/nodes/display/DepthOfFieldNode.js +++ b/src/nodes/display/DepthOfFieldNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { Fn, nodeObject, vec2, vec4 } from '../tsl/TSLBase.js'; @@ -116,6 +116,6 @@ class DepthOfFieldNode extends TempNode { export default DepthOfFieldNode; -registerNodeClass( 'DepthOfField', DepthOfFieldNode ); +DepthOfFieldNode.type = /*@__PURE__*/ registerNode( 'DepthOfField', DepthOfFieldNode ); 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 ) ) ); diff --git a/src/nodes/display/DotScreenNode.js b/src/nodes/display/DotScreenNode.js index 4acb13091daffe..e180d800d2fbb7 100644 --- a/src/nodes/display/DotScreenNode.js +++ b/src/nodes/display/DotScreenNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { nodeObject, Fn, vec2, vec3, vec4 } from '../tsl/TSLBase.js'; import { uniform } from '../core/UniformNode.js'; @@ -58,6 +58,6 @@ class DotScreenNode extends TempNode { export default DotScreenNode; -registerNodeClass( 'DotScreen', DotScreenNode ); +DotScreenNode.type = /*@__PURE__*/ registerNode( 'DotScreen', DotScreenNode ); export const dotScreen = ( node, center, angle, scale ) => nodeObject( new DotScreenNode( nodeObject( node ), center, angle, scale ) ); diff --git a/src/nodes/display/FXAANode.js b/src/nodes/display/FXAANode.js index 66b15e3bbecd32..31a6cdf57060ed 100644 --- a/src/nodes/display/FXAANode.js +++ b/src/nodes/display/FXAANode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { Fn, nodeObject, float, vec2, vec4, int, If } from '../tsl/TSLBase.js'; @@ -324,6 +324,6 @@ class FXAANode extends TempNode { export default FXAANode; -registerNodeClass( 'FXAA', FXAANode ); +FXAANode.type = /*@__PURE__*/ registerNode( 'FXAA', FXAANode ); export const fxaa = ( node ) => nodeObject( new FXAANode( convertToTexture( node ) ) ); diff --git a/src/nodes/display/FilmNode.js b/src/nodes/display/FilmNode.js index 983e5ec07a61fc..11dd9a39bc8eb5 100644 --- a/src/nodes/display/FilmNode.js +++ b/src/nodes/display/FilmNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { Fn, nodeProxy, vec4 } from '../tsl/TSLBase.js'; @@ -48,6 +48,6 @@ class FilmNode extends TempNode { export default FilmNode; -registerNodeClass( 'Film', FilmNode ); +FilmNode.type = /*@__PURE__*/ registerNode( 'Film', FilmNode ); -export const film = nodeProxy( FilmNode ); +export const film = /*@__PURE__*/ nodeProxy( FilmNode ); diff --git a/src/nodes/display/FrontFacingNode.js b/src/nodes/display/FrontFacingNode.js index afa92ecf6a9db7..d5f95557eb0753 100644 --- a/src/nodes/display/FrontFacingNode.js +++ b/src/nodes/display/FrontFacingNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeImmutable, float } from '../tsl/TSLBase.js'; import { BackSide, WebGLCoordinateSystem } from '../../constants.js'; @@ -35,7 +35,7 @@ class FrontFacingNode extends Node { export default FrontFacingNode; -registerNodeClass( 'FrontFacing', FrontFacingNode ); +FrontFacingNode.type = /*@__PURE__*/ registerNode( 'FrontFacing', FrontFacingNode ); -export const frontFacing = nodeImmutable( FrontFacingNode ); -export const faceDirection = float( frontFacing ).mul( 2.0 ).sub( 1.0 ); +export const frontFacing = /*@__PURE__*/ nodeImmutable( FrontFacingNode ); +export const faceDirection = /*@__PURE__*/ float( frontFacing ).mul( 2.0 ).sub( 1.0 ); diff --git a/src/nodes/display/GTAONode.js b/src/nodes/display/GTAONode.js index ad549da07481be..a2fb98832d4b10 100644 --- a/src/nodes/display/GTAONode.js +++ b/src/nodes/display/GTAONode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { texture } from '../accessors/TextureNode.js'; import { textureSize } from '../accessors/TextureSizeNode.js'; @@ -239,7 +239,7 @@ class GTAONode extends TempNode { export default GTAONode; -registerNodeClass( 'GTAO', GTAONode ); +GTAONode.type = /*@__PURE__*/ registerNode( 'GTAO', GTAONode ); function generateMagicSquareNoise( size = 5 ) { diff --git a/src/nodes/display/GaussianBlurNode.js b/src/nodes/display/GaussianBlurNode.js index 792c7db91a2db3..59123e91697678 100644 --- a/src/nodes/display/GaussianBlurNode.js +++ b/src/nodes/display/GaussianBlurNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { nodeObject, Fn, float, vec2, vec4 } from '../tsl/TSLBase.js'; import { NodeUpdateType } from '../core/constants.js'; @@ -205,6 +205,6 @@ class GaussianBlurNode extends TempNode { export default GaussianBlurNode; -registerNodeClass( 'GaussianBlur', GaussianBlurNode ); +GaussianBlurNode.type = /*@__PURE__*/ registerNode( 'GaussianBlur', GaussianBlurNode ); export const gaussianBlur = ( node, directionNode, sigma ) => nodeObject( new GaussianBlurNode( convertToTexture( node ), directionNode, sigma ) ); diff --git a/src/nodes/display/Lut3DNode.js b/src/nodes/display/Lut3DNode.js index e6ffbe621190e6..8541a36a3eea3b 100644 --- a/src/nodes/display/Lut3DNode.js +++ b/src/nodes/display/Lut3DNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { Fn, nodeObject, vec3, vec4, float } from '../tsl/TSLBase.js'; import { uniform } from '../core/UniformNode.js'; @@ -49,6 +49,6 @@ class Lut3DNode extends TempNode { export default Lut3DNode; -registerNodeClass( 'Lut3D', Lut3DNode ); +Lut3DNode.type = /*@__PURE__*/ registerNode( 'Lut3D', Lut3DNode ); export const lut3D = ( node, lut, size, intensity ) => nodeObject( new Lut3DNode( nodeObject( node ), nodeObject( lut ), size, nodeObject( intensity ) ) ); diff --git a/src/nodes/display/MotionBlur.js b/src/nodes/display/MotionBlur.js index 28d591395c28ab..2f8de9b79ab9d8 100644 --- a/src/nodes/display/MotionBlur.js +++ b/src/nodes/display/MotionBlur.js @@ -2,7 +2,7 @@ import { float, int, Fn } from '../tsl/TSLBase.js'; import { Loop } from '../utils/LoopNode.js'; import { uv } from '../accessors/UV.js'; -export const motionBlur = /*#__PURE__*/ Fn( ( [ inputNode, velocity, numSamples = int( 16 ) ] ) => { +export const motionBlur = /*@__PURE__*/ Fn( ( [ inputNode, velocity, numSamples = int( 16 ) ] ) => { const sampleColor = ( uv ) => inputNode.uv( uv ); diff --git a/src/nodes/display/NormalMapNode.js b/src/nodes/display/NormalMapNode.js index d56475698b12de..e18d9e849997a9 100644 --- a/src/nodes/display/NormalMapNode.js +++ b/src/nodes/display/NormalMapNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { add } from '../math/OperatorNode.js'; @@ -15,7 +15,7 @@ import { TangentSpaceNormalMap, ObjectSpaceNormalMap } from '../../constants.js' // Normal Mapping Without Precomputed Tangents // http://www.thetenthplanet.de/archives/1180 -const perturbNormal2Arb = Fn( ( inputs ) => { +const perturbNormal2Arb = /*@__PURE__*/ Fn( ( inputs ) => { const { eye_pos, surf_norm, mapN, uv } = inputs; @@ -99,6 +99,6 @@ class NormalMapNode extends TempNode { export default NormalMapNode; -registerNodeClass( 'NormalMap', NormalMapNode ); +NormalMapNode.type = /*@__PURE__*/ registerNode( 'NormalMap', NormalMapNode ); -export const normalMap = nodeProxy( NormalMapNode ); +export const normalMap = /*@__PURE__*/ nodeProxy( NormalMapNode ); diff --git a/src/nodes/display/ParallaxBarrierPassNode.js b/src/nodes/display/ParallaxBarrierPassNode.js index 3f6fc9931a42ae..0c06b5e26b1779 100644 --- a/src/nodes/display/ParallaxBarrierPassNode.js +++ b/src/nodes/display/ParallaxBarrierPassNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import { Fn, If, nodeObject, vec4 } from '../tsl/TSLBase.js'; import { uv } from '../accessors/UV.js'; import { mod } from '../math/MathNode.js'; @@ -50,6 +50,6 @@ class ParallaxBarrierPassNode extends StereoCompositePassNode { export default ParallaxBarrierPassNode; -registerNodeClass( 'ParallaxBarrierPass', ParallaxBarrierPassNode ); +ParallaxBarrierPassNode.type = /*@__PURE__*/ registerNode( 'ParallaxBarrierPass', ParallaxBarrierPassNode ); export const parallaxBarrierPass = ( scene, camera ) => nodeObject( new ParallaxBarrierPassNode( scene, camera ) ); diff --git a/src/nodes/display/PassNode.js b/src/nodes/display/PassNode.js index 6ca84df059290d..cfd8e342040bec 100644 --- a/src/nodes/display/PassNode.js +++ b/src/nodes/display/PassNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { default as TextureNode/*, texture*/ } from '../accessors/TextureNode.js'; import { NodeUpdateType } from '../core/constants.js'; @@ -41,7 +41,7 @@ class PassTextureNode extends TextureNode { } -registerNodeClass( 'PassTexture', PassTextureNode ); +PassTextureNode.type = /*@__PURE__*/ registerNode( 'PassTexture', PassTextureNode ); class PassMultipleTextureNode extends PassTextureNode { @@ -76,7 +76,7 @@ class PassMultipleTextureNode extends PassTextureNode { } -registerNodeClass( 'PassMultipleTexture', PassMultipleTextureNode ); +PassMultipleTextureNode.type = /*@__PURE__*/ registerNode( 'PassMultipleTexture', PassMultipleTextureNode ); class PassNode extends TempNode { @@ -360,7 +360,7 @@ PassNode.DEPTH = 'depth'; export default PassNode; -registerNodeClass( 'Pass', PassNode ); +PassNode.type = /*@__PURE__*/ registerNode( 'Pass', PassNode ); export const pass = ( scene, camera, options ) => nodeObject( new PassNode( PassNode.COLOR, scene, camera, options ) ); export const passTexture = ( pass, texture ) => nodeObject( new PassTextureNode( pass, texture ) ); diff --git a/src/nodes/display/PixelationPassNode.js b/src/nodes/display/PixelationPassNode.js index c3b78b350a90dc..372accbf81310b 100644 --- a/src/nodes/display/PixelationPassNode.js +++ b/src/nodes/display/PixelationPassNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { Fn, nodeObject, vec2, vec3, float, If } from '../tsl/TSLBase.js'; @@ -153,7 +153,7 @@ class PixelationNode extends TempNode { } -registerNodeClass( 'Pixelation', PixelationNode ); +PixelationNode.type = /*@__PURE__*/ registerNode( 'Pixelation', PixelationNode ); const pixelation = ( node, depthNode, normalNode, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4 ) => nodeObject( new PixelationNode( convertToTexture( node ), convertToTexture( depthNode ), convertToTexture( normalNode ), nodeObject( pixelSize ), nodeObject( normalEdgeStrength ), nodeObject( depthEdgeStrength ) ) ); @@ -203,4 +203,4 @@ export const pixelationPass = ( scene, camera, pixelSize, normalEdgeStrength, de export default PixelationPassNode; -registerNodeClass( 'PixelationPass', PixelationPassNode ); +PixelationPassNode.type = /*@__PURE__*/ registerNode( 'PixelationPass', PixelationPassNode ); diff --git a/src/nodes/display/PosterizeNode.js b/src/nodes/display/PosterizeNode.js index bece19f69aca5e..17f53df57d3840 100644 --- a/src/nodes/display/PosterizeNode.js +++ b/src/nodes/display/PosterizeNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -25,6 +25,6 @@ class PosterizeNode extends TempNode { export default PosterizeNode; -registerNodeClass( 'Posterize', PosterizeNode ); +PosterizeNode.type = /*@__PURE__*/ registerNode( 'Posterize', PosterizeNode ); -export const posterize = nodeProxy( PosterizeNode ); +export const posterize = /*@__PURE__*/ nodeProxy( PosterizeNode ); diff --git a/src/nodes/display/RGBShiftNode.js b/src/nodes/display/RGBShiftNode.js index 6317ab20018f09..8bf924b18d5389 100644 --- a/src/nodes/display/RGBShiftNode.js +++ b/src/nodes/display/RGBShiftNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { nodeObject, Fn, vec2, vec4 } from '../tsl/TSLBase.js'; import { uniform } from '../core/UniformNode.js'; @@ -45,6 +45,6 @@ class RGBShiftNode extends TempNode { export default RGBShiftNode; -registerNodeClass( 'RGBShift', RGBShiftNode ); +RGBShiftNode.type = /*@__PURE__*/ registerNode( 'RGBShift', RGBShiftNode ); export const rgbShift = ( node, amount, angle ) => nodeObject( new RGBShiftNode( convertToTexture( node ), amount, angle ) ); diff --git a/src/nodes/display/RenderOutputNode.js b/src/nodes/display/RenderOutputNode.js index 60a92028f32f42..23448b8f47af36 100644 --- a/src/nodes/display/RenderOutputNode.js +++ b/src/nodes/display/RenderOutputNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js'; @@ -49,7 +49,7 @@ class RenderOutputNode extends TempNode { export default RenderOutputNode; -registerNodeClass( 'RenderOutput', RenderOutputNode ); +RenderOutputNode.type = /*@__PURE__*/ registerNode( 'RenderOutput', RenderOutputNode ); export const renderOutput = ( color, toneMapping = null, outputColorSpace = null ) => nodeObject( new RenderOutputNode( nodeObject( color ), toneMapping, outputColorSpace ) ); diff --git a/src/nodes/display/SSAAPassNode.js b/src/nodes/display/SSAAPassNode.js index 374d56f93179ac..db5939753c8039 100644 --- a/src/nodes/display/SSAAPassNode.js +++ b/src/nodes/display/SSAAPassNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import { nodeObject } from '../tsl/TSLBase.js'; import PassNode from './PassNode.js'; import { Color } from '../../math/Color.js'; @@ -242,7 +242,7 @@ class SSAAPassNode extends PassNode { export default SSAAPassNode; -registerNodeClass( 'SSAAPass', SSAAPassNode ); +SSAAPassNode.type = /*@__PURE__*/ registerNode( 'SSAAPass', SSAAPassNode ); // These jitter vectors are specified in integers because it is easier. // I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5) diff --git a/src/nodes/display/SobelOperatorNode.js b/src/nodes/display/SobelOperatorNode.js index cdd1121099cef0..ea71d38b1cb8c8 100644 --- a/src/nodes/display/SobelOperatorNode.js +++ b/src/nodes/display/SobelOperatorNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { luminance } from './ColorAdjustment.js'; @@ -118,6 +118,6 @@ class SobelOperatorNode extends TempNode { export default SobelOperatorNode; -registerNodeClass( 'SobelOperator', SobelOperatorNode ); +SobelOperatorNode.type = /*@__PURE__*/ registerNode( 'SobelOperator', SobelOperatorNode ); export const sobel = ( node ) => nodeObject( new SobelOperatorNode( convertToTexture( node ) ) ); diff --git a/src/nodes/display/StereoCompositePassNode.js b/src/nodes/display/StereoCompositePassNode.js index 6c7e2cfbe05e58..264a718ee832eb 100644 --- a/src/nodes/display/StereoCompositePassNode.js +++ b/src/nodes/display/StereoCompositePassNode.js @@ -1,5 +1,5 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import PassNode from './PassNode.js'; import { StereoCamera } from '../../cameras/StereoCamera.js'; import { HalfFloatType, LinearFilter, NearestFilter } from '../../constants.js'; @@ -104,4 +104,4 @@ class StereoCompositePassNode extends PassNode { export default StereoCompositePassNode; -registerNodeClass( 'StereoCompositePass', StereoCompositePassNode ); +StereoCompositePassNode.type = /*@__PURE__*/ registerNode( 'StereoCompositePass', StereoCompositePassNode ); diff --git a/src/nodes/display/StereoPassNode.js b/src/nodes/display/StereoPassNode.js index 01cf9ca54bff61..5818042fb89bdd 100644 --- a/src/nodes/display/StereoPassNode.js +++ b/src/nodes/display/StereoPassNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import { nodeObject } from '../tsl/TSLBase.js'; import PassNode from './PassNode.js'; import { Vector2 } from '../../math/Vector2.js'; @@ -75,6 +75,6 @@ class StereoPassNode extends PassNode { export default StereoPassNode; -registerNodeClass( 'StereoPass', StereoPassNode ); +StereoPassNode.type = /*@__PURE__*/ registerNode( 'StereoPass', StereoPassNode ); export const stereoPass = ( scene, camera ) => nodeObject( new StereoPassNode( scene, camera ) ); diff --git a/src/nodes/display/ToneMappingNode.js b/src/nodes/display/ToneMappingNode.js index 19ff61ee23f333..78e9f0e45744d7 100644 --- a/src/nodes/display/ToneMappingNode.js +++ b/src/nodes/display/ToneMappingNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { addMethodChaining, nodeObject, vec4 } from '../tsl/TSLCore.js'; import { rendererReference } from '../accessors/RendererReferenceNode.js'; @@ -58,7 +58,7 @@ class ToneMappingNode extends TempNode { export default ToneMappingNode; -registerNodeClass( 'ToneMapping', ToneMappingNode ); +ToneMappingNode.type = /*@__PURE__*/ registerNode( 'ToneMapping', ToneMappingNode ); export const toneMapping = ( mapping, exposure, color ) => nodeObject( new ToneMappingNode( mapping, nodeObject( exposure ), nodeObject( color ) ) ); export const toneMappingExposure = /*@__PURE__*/ rendererReference( 'toneMappingExposure', 'float' ); diff --git a/src/nodes/display/TransitionNode.js b/src/nodes/display/TransitionNode.js index 952995d30147e9..4aadef7ea83482 100644 --- a/src/nodes/display/TransitionNode.js +++ b/src/nodes/display/TransitionNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { uv } from '../accessors/UV.js'; import { Fn, nodeObject, float, int, vec4, If } from '../tsl/TSLBase.js'; @@ -72,6 +72,6 @@ class TransitionNode extends TempNode { export default TransitionNode; -registerNodeClass( 'Transition', TransitionNode ); +TransitionNode.type = /*@__PURE__*/ registerNode( 'Transition', TransitionNode ); export const transition = ( nodeA, nodeB, mixTexture, mixRatio = 0.0, threshold = 0.1, useTexture = 0 ) => nodeObject( new TransitionNode( convertToTexture( nodeA ), convertToTexture( nodeB ), convertToTexture( mixTexture ), nodeObject( mixRatio ), nodeObject( threshold ), nodeObject( useTexture ) ) ); diff --git a/src/nodes/display/ViewportDepthNode.js b/src/nodes/display/ViewportDepthNode.js index 748128195251d9..f83a8b14f483e2 100644 --- a/src/nodes/display/ViewportDepthNode.js +++ b/src/nodes/display/ViewportDepthNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeImmutable, nodeProxy } from '../tsl/TSLBase.js'; import { cameraNear, cameraFar } from '../accessors/Camera.js'; import { positionView } from '../accessors/Position.js'; @@ -94,7 +94,7 @@ ViewportDepthNode.LINEAR_DEPTH = 'linearDepth'; export default ViewportDepthNode; -registerNodeClass( 'ViewportDepth', ViewportDepthNode ); +ViewportDepthNode.type = /*@__PURE__*/ registerNode( 'ViewportDepth', ViewportDepthNode ); // NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera @@ -112,10 +112,10 @@ export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ ) // maps perspective depth in [ 0, 1 ] to viewZ export const perspectiveDepthToViewZ = ( depth, near, far ) => near.mul( far ).div( far.sub( near ).mul( depth ).sub( far ) ); -const depthBase = nodeProxy( ViewportDepthNode, ViewportDepthNode.DEPTH_BASE ); +const depthBase = /*@__PURE__*/ nodeProxy( ViewportDepthNode, ViewportDepthNode.DEPTH_BASE ); -export const depth = nodeImmutable( ViewportDepthNode, ViewportDepthNode.DEPTH ); -export const linearDepth = nodeProxy( ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH ); -export const viewportLinearDepth = linearDepth( viewportDepthTexture() ); +export const depth = /*@__PURE__*/ nodeImmutable( ViewportDepthNode, ViewportDepthNode.DEPTH ); +export const linearDepth = /*@__PURE__*/ nodeProxy( ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH ); +export const viewportLinearDepth = /*@__PURE__*/ linearDepth( viewportDepthTexture() ); depth.assign = ( value ) => depthBase( value ); diff --git a/src/nodes/display/ViewportDepthTextureNode.js b/src/nodes/display/ViewportDepthTextureNode.js index d97ba4e9b3043c..c4e4456e4ee126 100644 --- a/src/nodes/display/ViewportDepthTextureNode.js +++ b/src/nodes/display/ViewportDepthTextureNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import ViewportTextureNode from './ViewportTextureNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; import { viewportUV } from './ViewportNode.js'; @@ -25,6 +25,6 @@ class ViewportDepthTextureNode extends ViewportTextureNode { export default ViewportDepthTextureNode; -registerNodeClass( 'ViewportDepthTexture', ViewportDepthTextureNode ); +ViewportDepthTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportDepthTexture', ViewportDepthTextureNode ); -export const viewportDepthTexture = nodeProxy( ViewportDepthTextureNode ); +export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode ); diff --git a/src/nodes/display/ViewportNode.js b/src/nodes/display/ViewportNode.js index 6fda7ab8436e48..a354d1fd5f85e5 100644 --- a/src/nodes/display/ViewportNode.js +++ b/src/nodes/display/ViewportNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import { uniform } from '../core/UniformNode.js'; import { Fn, nodeImmutable, vec2 } from '../tsl/TSLBase.js'; @@ -114,12 +114,12 @@ ViewportNode.UV = 'uv'; export default ViewportNode; -registerNodeClass( 'Viewport', ViewportNode ); +ViewportNode.type = /*@__PURE__*/ registerNode( 'Viewport', ViewportNode ); -export const viewportCoordinate = nodeImmutable( ViewportNode, ViewportNode.COORDINATE ); -export const viewportResolution = nodeImmutable( ViewportNode, ViewportNode.RESOLUTION ); -export const viewport = nodeImmutable( ViewportNode, ViewportNode.VIEWPORT ); -export const viewportUV = nodeImmutable( ViewportNode, ViewportNode.UV ); +export const viewportCoordinate = /*@__PURE__*/ nodeImmutable( ViewportNode, ViewportNode.COORDINATE ); +export const viewportResolution = /*@__PURE__*/ nodeImmutable( ViewportNode, ViewportNode.RESOLUTION ); +export const viewport = /*@__PURE__*/ nodeImmutable( ViewportNode, ViewportNode.VIEWPORT ); +export const viewportUV = /*@__PURE__*/ nodeImmutable( ViewportNode, ViewportNode.UV ); export const viewportTopLeft = /*@__PURE__*/ ( Fn( () => { // @deprecated, r168 diff --git a/src/nodes/display/ViewportSharedTextureNode.js b/src/nodes/display/ViewportSharedTextureNode.js index 18b1301efe5022..d887230a154ea6 100644 --- a/src/nodes/display/ViewportSharedTextureNode.js +++ b/src/nodes/display/ViewportSharedTextureNode.js @@ -3,7 +3,7 @@ import { nodeProxy } from '../tsl/TSLBase.js'; import { viewportUV } from './ViewportNode.js'; import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; let _sharedFramebuffer = null; @@ -31,6 +31,6 @@ class ViewportSharedTextureNode extends ViewportTextureNode { export default ViewportSharedTextureNode; -registerNodeClass( 'ViewportSharedTexture', ViewportSharedTextureNode ); +ViewportSharedTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportSharedTexture', ViewportSharedTextureNode ); -export const viewportSharedTexture = nodeProxy( ViewportSharedTextureNode ); +export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode ); diff --git a/src/nodes/display/ViewportTextureNode.js b/src/nodes/display/ViewportTextureNode.js index 83189c60c60eea..1ba58e0f396883 100644 --- a/src/nodes/display/ViewportTextureNode.js +++ b/src/nodes/display/ViewportTextureNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TextureNode from '../accessors/TextureNode.js'; import { NodeUpdateType } from '../core/constants.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -72,7 +72,7 @@ class ViewportTextureNode extends TextureNode { export default ViewportTextureNode; -registerNodeClass( 'ViewportTexture', ViewportTextureNode ); +ViewportTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportTexture', ViewportTextureNode ); -export const viewportTexture = nodeProxy( ViewportTextureNode ); -export const viewportMipTexture = nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } ); +export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode ); +export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } ); diff --git a/src/nodes/fog/FogExp2Node.js b/src/nodes/fog/FogExp2Node.js index af086fffb8982e..729a161cf9b00a 100644 --- a/src/nodes/fog/FogExp2Node.js +++ b/src/nodes/fog/FogExp2Node.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import FogNode from './FogNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -27,6 +27,6 @@ class FogExp2Node extends FogNode { export default FogExp2Node; -registerNodeClass( 'FogExp2', FogExp2Node ); +FogExp2Node.type = /*@__PURE__*/ registerNode( 'FogExp2', FogExp2Node ); -export const densityFog = nodeProxy( FogExp2Node ); +export const densityFog = /*@__PURE__*/ nodeProxy( FogExp2Node ); diff --git a/src/nodes/fog/FogNode.js b/src/nodes/fog/FogNode.js index adce402e378bc0..50c06ab26ffff1 100644 --- a/src/nodes/fog/FogNode.js +++ b/src/nodes/fog/FogNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { positionView } from '../accessors/Position.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -41,6 +41,6 @@ class FogNode extends Node { export default FogNode; -registerNodeClass( 'Fog', FogNode ); +FogNode.type = /*@__PURE__*/ registerNode( 'Fog', FogNode ); -export const fog = nodeProxy( FogNode ); +export const fog = /*@__PURE__*/ nodeProxy( FogNode ); diff --git a/src/nodes/fog/FogRangeNode.js b/src/nodes/fog/FogRangeNode.js index fa5278e4c253a8..ca651bb9ffe1f7 100644 --- a/src/nodes/fog/FogRangeNode.js +++ b/src/nodes/fog/FogRangeNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import FogNode from './FogNode.js'; import { smoothstep } from '../math/MathNode.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -28,6 +28,6 @@ class FogRangeNode extends FogNode { export default FogRangeNode; -registerNodeClass( 'FogRange', FogRangeNode ); +FogRangeNode.type = /*@__PURE__*/ registerNode( 'FogRange', FogRangeNode ); -export const rangeFog = nodeProxy( FogRangeNode ); +export const rangeFog = /*@__PURE__*/ nodeProxy( FogRangeNode ); diff --git a/src/nodes/functions/BSDF/BRDF_GGX.js b/src/nodes/functions/BSDF/BRDF_GGX.js index 7db1857b8c28b8..b00f66366d892c 100644 --- a/src/nodes/functions/BSDF/BRDF_GGX.js +++ b/src/nodes/functions/BSDF/BRDF_GGX.js @@ -9,7 +9,7 @@ import { iridescence, alphaT, anisotropyT, anisotropyB } from '../../core/Proper import { Fn, defined } from '../../tsl/TSLBase.js'; // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility -const BRDF_GGX = Fn( ( inputs ) => { +const BRDF_GGX = /*@__PURE__*/ Fn( ( inputs ) => { const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs; diff --git a/src/nodes/functions/BSDF/BRDF_Lambert.js b/src/nodes/functions/BSDF/BRDF_Lambert.js index 0250105a1eaa11..342f053318c91b 100644 --- a/src/nodes/functions/BSDF/BRDF_Lambert.js +++ b/src/nodes/functions/BSDF/BRDF_Lambert.js @@ -1,6 +1,6 @@ import { Fn } from '../../tsl/TSLBase.js'; -const BRDF_Lambert = Fn( ( inputs ) => { +const BRDF_Lambert = /*@__PURE__*/ Fn( ( inputs ) => { return inputs.diffuseColor.mul( 1 / Math.PI ); // punctual light diff --git a/src/nodes/functions/BSDF/BRDF_Sheen.js b/src/nodes/functions/BSDF/BRDF_Sheen.js index 55bbeff9c2e89b..e667fdaff8c5b7 100644 --- a/src/nodes/functions/BSDF/BRDF_Sheen.js +++ b/src/nodes/functions/BSDF/BRDF_Sheen.js @@ -4,7 +4,7 @@ import { sheen, sheenRoughness } from '../../core/PropertyNode.js'; import { Fn, float } from '../../tsl/TSLBase.js'; // https://github.com/google/filament/blob/master/shaders/src/brdf.fs -const D_Charlie = Fn( ( { roughness, dotNH } ) => { +const D_Charlie = /*@__PURE__*/ Fn( ( { roughness, dotNH } ) => { const alpha = roughness.pow2(); @@ -25,7 +25,7 @@ const D_Charlie = Fn( ( { roughness, dotNH } ) => { } ); // https://github.com/google/filament/blob/master/shaders/src/brdf.fs -const V_Neubelt = Fn( ( { dotNV, dotNL } ) => { +const V_Neubelt = /*@__PURE__*/ Fn( ( { dotNV, dotNL } ) => { // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" return float( 1.0 ).div( float( 4.0 ).mul( dotNL.add( dotNV ).sub( dotNL.mul( dotNV ) ) ) ); @@ -39,7 +39,7 @@ const V_Neubelt = Fn( ( { dotNV, dotNL } ) => { ] } ); -const BRDF_Sheen = Fn( ( { lightDirection } ) => { +const BRDF_Sheen = /*@__PURE__*/ Fn( ( { lightDirection } ) => { const halfDir = lightDirection.add( positionViewDirection ).normalize(); diff --git a/src/nodes/functions/BSDF/DFGApprox.js b/src/nodes/functions/BSDF/DFGApprox.js index 625a457a5a0832..1170ed0aa6227b 100644 --- a/src/nodes/functions/BSDF/DFGApprox.js +++ b/src/nodes/functions/BSDF/DFGApprox.js @@ -4,7 +4,7 @@ import { Fn, vec2, vec4 } from '../../tsl/TSLBase.js'; // split-sum approximation used in indirect specular lighting. // via 'environmentBRDF' from "Physically Based Shading on Mobile" // https://www.unrealengine.com/blog/physically-based-shading-on-mobile -const DFGApprox = Fn( ( { roughness, dotNV } ) => { +const DFGApprox = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => { const c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); diff --git a/src/nodes/functions/BSDF/D_GGX.js b/src/nodes/functions/BSDF/D_GGX.js index 7e8b998ccfc325..75a032509cb600 100644 --- a/src/nodes/functions/BSDF/D_GGX.js +++ b/src/nodes/functions/BSDF/D_GGX.js @@ -3,7 +3,7 @@ import { Fn } from '../../tsl/TSLBase.js'; // Microfacet Models for Refraction through Rough Surfaces - equation (33) // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html // alpha is "roughness squared" in Disney’s reparameterization -const D_GGX = Fn( ( { alpha, dotNH } ) => { +const D_GGX = /*@__PURE__*/ Fn( ( { alpha, dotNH } ) => { const a2 = alpha.pow2(); diff --git a/src/nodes/functions/BSDF/D_GGX_Anisotropic.js b/src/nodes/functions/BSDF/D_GGX_Anisotropic.js index 84c5f1c1741115..c16d397a95199b 100644 --- a/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +++ b/src/nodes/functions/BSDF/D_GGX_Anisotropic.js @@ -1,10 +1,10 @@ import { Fn, float, vec3 } from '../../tsl/TSLBase.js'; -const RECIPROCAL_PI = float( 1 / Math.PI ); +const RECIPROCAL_PI = /*@__PURE__*/ float( 1 / Math.PI ); // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf -const D_GGX_Anisotropic = Fn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => { +const D_GGX_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => { const a2 = alphaT.mul( alphaB ); const v = vec3( alphaB.mul( dotTH ), alphaT.mul( dotBH ), a2.mul( dotNH ) ); diff --git a/src/nodes/functions/BSDF/EnvironmentBRDF.js b/src/nodes/functions/BSDF/EnvironmentBRDF.js index 74516197b97413..3074e78029121b 100644 --- a/src/nodes/functions/BSDF/EnvironmentBRDF.js +++ b/src/nodes/functions/BSDF/EnvironmentBRDF.js @@ -1,7 +1,7 @@ import DFGApprox from './DFGApprox.js'; import { Fn } from '../../tsl/TSLBase.js'; -const EnvironmentBRDF = Fn( ( inputs ) => { +const EnvironmentBRDF = /*@__PURE__*/ Fn( ( inputs ) => { const { dotNV, specularColor, specularF90, roughness } = inputs; diff --git a/src/nodes/functions/BSDF/F_Schlick.js b/src/nodes/functions/BSDF/F_Schlick.js index 6494e75c5c5a17..8384c6494619d6 100644 --- a/src/nodes/functions/BSDF/F_Schlick.js +++ b/src/nodes/functions/BSDF/F_Schlick.js @@ -1,6 +1,6 @@ import { Fn } from '../../tsl/TSLBase.js'; -const F_Schlick = Fn( ( { f0, f90, dotVH } ) => { +const F_Schlick = /*@__PURE__*/ Fn( ( { f0, f90, dotVH } ) => { // Original approximation by Christophe Schlick '94 // float fresnel = pow( 1.0 - dotVH, 5.0 ); diff --git a/src/nodes/functions/BSDF/LTC.js b/src/nodes/functions/BSDF/LTC.js index 7036dcc568e4b1..b3be3c9c37bd2e 100644 --- a/src/nodes/functions/BSDF/LTC.js +++ b/src/nodes/functions/BSDF/LTC.js @@ -7,7 +7,7 @@ import { max } from '../../math/MathNode.js'; // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt // code: https://github.com/selfshadow/ltc_code/ -const LTC_Uv = Fn( ( { N, V, roughness } ) => { +const LTC_Uv = /*@__PURE__*/ Fn( ( { N, V, roughness } ) => { const LUT_SIZE = 64.0; const LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; @@ -32,7 +32,7 @@ const LTC_Uv = Fn( ( { N, V, roughness } ) => { ] } ); -const LTC_ClippedSphereFormFactor = Fn( ( { f } ) => { +const LTC_ClippedSphereFormFactor = /*@__PURE__*/ Fn( ( { f } ) => { // Real-Time Area Lighting: a Journey from Research to Production (p.102) // An approximation of the form factor of a horizon-clipped rectangle. @@ -49,7 +49,7 @@ const LTC_ClippedSphereFormFactor = Fn( ( { f } ) => { ] } ); -const LTC_EdgeVectorFormFactor = Fn( ( { v1, v2 } ) => { +const LTC_EdgeVectorFormFactor = /*@__PURE__*/ Fn( ( { v1, v2 } ) => { const x = v1.dot( v2 ); const y = x.abs().toVar(); @@ -72,7 +72,7 @@ const LTC_EdgeVectorFormFactor = Fn( ( { v1, v2 } ) => { ] } ); -const LTC_Evaluate = Fn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => { +const LTC_Evaluate = /*@__PURE__*/ Fn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => { // bail if point is on back side of plane of light // assumes ccw winding order of light vertices diff --git a/src/nodes/functions/BSDF/Schlick_to_F0.js b/src/nodes/functions/BSDF/Schlick_to_F0.js index 2137dd6d4316e4..11109483c5492a 100644 --- a/src/nodes/functions/BSDF/Schlick_to_F0.js +++ b/src/nodes/functions/BSDF/Schlick_to_F0.js @@ -1,6 +1,6 @@ import { Fn, vec3 } from '../../tsl/TSLBase.js'; -const Schlick_to_F0 = Fn( ( { f, f90, dotVH } ) => { +const Schlick_to_F0 = /*@__PURE__*/ Fn( ( { f, f90, dotVH } ) => { const x = dotVH.oneMinus().saturate(); const x2 = x.mul( x ); diff --git a/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js b/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js index 991c84654ee86c..05fb9424956948 100644 --- a/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +++ b/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js @@ -4,7 +4,7 @@ import { Fn } from '../../tsl/TSLBase.js'; // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2 // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf -const V_GGX_SmithCorrelated = Fn( ( { alpha, dotNL, dotNV } ) => { +const V_GGX_SmithCorrelated = /*@__PURE__*/ Fn( ( { alpha, dotNL, dotNV } ) => { const a2 = alpha.pow2(); diff --git a/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js b/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js index c7926898c13325..7b739e685deb9a 100644 --- a/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +++ b/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js @@ -3,7 +3,7 @@ import { Fn, vec3 } from '../../tsl/TSLBase.js'; // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf -const V_GGX_SmithCorrelated_Anisotropic = Fn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => { +const V_GGX_SmithCorrelated_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => { const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() ); const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() ); diff --git a/src/nodes/functions/PhongLightingModel.js b/src/nodes/functions/PhongLightingModel.js index 0499783fa08da6..507e5d27cacc4c 100644 --- a/src/nodes/functions/PhongLightingModel.js +++ b/src/nodes/functions/PhongLightingModel.js @@ -10,13 +10,13 @@ import { Fn, float } from '../tsl/TSLBase.js'; const G_BlinnPhong_Implicit = () => float( 0.25 ); -const D_BlinnPhong = Fn( ( { dotNH } ) => { +const D_BlinnPhong = /*@__PURE__*/ Fn( ( { dotNH } ) => { return shininess.mul( float( 0.5 ) ).add( 1.0 ).mul( float( 1 / Math.PI ) ).mul( dotNH.pow( shininess ) ); } ); -const BRDF_BlinnPhong = Fn( ( { lightDirection } ) => { +const BRDF_BlinnPhong = /*@__PURE__*/ Fn( ( { lightDirection } ) => { const halfDir = lightDirection.add( positionViewDirection ).normalize(); diff --git a/src/nodes/functions/PhysicalLightingModel.js b/src/nodes/functions/PhysicalLightingModel.js index 49798027f93645..64458d8f7f72c0 100644 --- a/src/nodes/functions/PhysicalLightingModel.js +++ b/src/nodes/functions/PhysicalLightingModel.js @@ -25,7 +25,7 @@ import { Loop } from '../utils/LoopNode.js'; // Transmission // -const getVolumeTransmissionRay = Fn( ( [ n, v, thickness, ior, modelMatrix ] ) => { +const getVolumeTransmissionRay = /*@__PURE__*/ Fn( ( [ n, v, thickness, ior, modelMatrix ] ) => { // Direction of refracted light. const refractionVector = vec3( refract( v.negate(), normalize( n ), div( 1.0, ior ) ) ); @@ -52,7 +52,7 @@ const getVolumeTransmissionRay = Fn( ( [ n, v, thickness, ior, modelMatrix ] ) = ] } ); -const applyIorToRoughness = Fn( ( [ roughness, ior ] ) => { +const applyIorToRoughness = /*@__PURE__*/ Fn( ( [ roughness, ior ] ) => { // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and // an IOR of 1.5 results in the default amount of microfacet refraction. @@ -67,9 +67,9 @@ const applyIorToRoughness = Fn( ( [ roughness, ior ] ) => { ] } ); -const singleViewportMipTexture = viewportMipTexture(); +const singleViewportMipTexture = /*@__PURE__*/ viewportMipTexture(); -const getTransmissionSample = Fn( ( [ fragCoord, roughness, ior ] ) => { +const getTransmissionSample = /*@__PURE__*/ Fn( ( [ fragCoord, roughness, ior ] ) => { const transmissionSample = singleViewportMipTexture.uv( fragCoord ); //const transmissionSample = viewportMipTexture( fragCoord ); @@ -80,7 +80,7 @@ const getTransmissionSample = Fn( ( [ fragCoord, roughness, ior ] ) => { } ); -const volumeAttenuation = Fn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => { +const volumeAttenuation = /*@__PURE__*/ Fn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => { If( attenuationDistance.notEqual( 0 ), () => { @@ -105,7 +105,7 @@ const volumeAttenuation = Fn( ( [ transmissionDistance, attenuationColor, attenu ] } ); -const getIBLVolumeRefraction = Fn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => { +const getIBLVolumeRefraction = /*@__PURE__*/ Fn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => { let transmittedLight, transmittance; @@ -185,7 +185,7 @@ const getIBLVolumeRefraction = Fn( ( [ n, v, roughness, diffuseColor, specularCo // // XYZ to linear-sRGB color space -const XYZ_TO_REC709 = mat3( +const XYZ_TO_REC709 = /*@__PURE__*/ mat3( 3.2404542, - 0.9692660, 0.0556434, - 1.5371385, 1.8760108, - 0.2040259, - 0.4985314, 0.0415560, 1.0572252 @@ -228,7 +228,7 @@ const evalSensitivity = ( OPD, shift ) => { }; -const evalIridescence = Fn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => { +const evalIridescence = /*@__PURE__*/ Fn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => { // Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0 const iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); @@ -308,7 +308,7 @@ const evalIridescence = Fn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing -const IBLSheenBRDF = Fn( ( { normal, viewDir, roughness } ) => { +const IBLSheenBRDF = /*@__PURE__*/ Fn( ( { normal, viewDir, roughness } ) => { const dotNV = normal.dot( viewDir ).saturate(); diff --git a/src/nodes/functions/ToonLightingModel.js b/src/nodes/functions/ToonLightingModel.js index f71fa08fddcbcc..7e35f4aeb7f503 100644 --- a/src/nodes/functions/ToonLightingModel.js +++ b/src/nodes/functions/ToonLightingModel.js @@ -6,7 +6,7 @@ import { Fn, float, vec2, vec3 } from '../tsl/TSLBase.js'; import { mix, smoothstep } from '../math/MathNode.js'; import { materialReference } from '../accessors/MaterialReferenceNode.js'; -const getGradientIrradiance = Fn( ( { normal, lightDirection, builder } ) => { +const getGradientIrradiance = /*@__PURE__*/ Fn( ( { normal, lightDirection, builder } ) => { // dotNL will be from -1.0 to 1.0 const dotNL = normal.dot( lightDirection ); diff --git a/src/nodes/functions/material/getGeometryRoughness.js b/src/nodes/functions/material/getGeometryRoughness.js index fabed316e973d0..c4200d5ed7ae7e 100644 --- a/src/nodes/functions/material/getGeometryRoughness.js +++ b/src/nodes/functions/material/getGeometryRoughness.js @@ -1,7 +1,7 @@ import { normalView } from '../../accessors/Normal.js'; import { Fn } from '../../tsl/TSLBase.js'; -const getGeometryRoughness = Fn( () => { +const getGeometryRoughness = /*@__PURE__*/ Fn( () => { const dxy = normalView.dFdx().abs().max( normalView.dFdy().abs() ); const geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z ); diff --git a/src/nodes/functions/material/getRoughness.js b/src/nodes/functions/material/getRoughness.js index 73c8e49e684159..cd29c75aa6344c 100644 --- a/src/nodes/functions/material/getRoughness.js +++ b/src/nodes/functions/material/getRoughness.js @@ -1,7 +1,7 @@ import getGeometryRoughness from './getGeometryRoughness.js'; import { Fn } from '../../tsl/TSLBase.js'; -const getRoughness = Fn( ( inputs ) => { +const getRoughness = /*@__PURE__*/ Fn( ( inputs ) => { const { roughness } = inputs; diff --git a/src/nodes/geometry/RangeNode.js b/src/nodes/geometry/RangeNode.js index 49950714873208..a33c6803e6935c 100644 --- a/src/nodes/geometry/RangeNode.js +++ b/src/nodes/geometry/RangeNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { getValueType } from '../core/NodeUtils.js'; import { buffer } from '../accessors/BufferNode.js'; import { instancedBufferAttribute } from '../accessors/BufferAttributeNode.js'; @@ -112,6 +112,6 @@ class RangeNode extends Node { export default RangeNode; -registerNodeClass( 'Range', RangeNode ); +RangeNode.type = /*@__PURE__*/ registerNode( 'Range', RangeNode ); -export const range = nodeProxy( RangeNode ); +export const range = /*@__PURE__*/ nodeProxy( RangeNode ); diff --git a/src/nodes/gpgpu/ComputeNode.js b/src/nodes/gpgpu/ComputeNode.js index 71ad6fb6f81873..5a5d363c2a6d11 100644 --- a/src/nodes/gpgpu/ComputeNode.js +++ b/src/nodes/gpgpu/ComputeNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { NodeUpdateType } from '../core/constants.js'; import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js'; @@ -78,7 +78,7 @@ class ComputeNode extends Node { export default ComputeNode; -registerNodeClass( 'Compute', ComputeNode ); +ComputeNode.type = /*@__PURE__*/ registerNode( 'Compute', ComputeNode ); export const compute = ( node, count, workgroupSize ) => nodeObject( new ComputeNode( nodeObject( node ), count, workgroupSize ) ); diff --git a/src/nodes/lighting/AONode.js b/src/nodes/lighting/AONode.js index 12204eb8d94b82..0a6e1e8c8d7986 100644 --- a/src/nodes/lighting/AONode.js +++ b/src/nodes/lighting/AONode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import LightingNode from './LightingNode.js'; class AONode extends LightingNode { @@ -21,4 +21,4 @@ class AONode extends LightingNode { export default AONode; -registerNodeClass( 'AO', AONode ); +AONode.type = /*@__PURE__*/ registerNode( 'AO', AONode ); diff --git a/src/nodes/lighting/AmbientLightNode.js b/src/nodes/lighting/AmbientLightNode.js index 9bdc79e418f1fb..c2177df51c0630 100644 --- a/src/nodes/lighting/AmbientLightNode.js +++ b/src/nodes/lighting/AmbientLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; class AmbientLightNode extends AnalyticLightNode { @@ -19,4 +19,4 @@ class AmbientLightNode extends AnalyticLightNode { export default AmbientLightNode; -registerNodeClass( 'AmbientLight', AmbientLightNode ); +AmbientLightNode.type = /*@__PURE__*/ registerNode( 'AmbientLight', AmbientLightNode ); diff --git a/src/nodes/lighting/AnalyticLightNode.js b/src/nodes/lighting/AnalyticLightNode.js index 4baeaa28d9f245..dc761d57bba879 100644 --- a/src/nodes/lighting/AnalyticLightNode.js +++ b/src/nodes/lighting/AnalyticLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import LightingNode from './LightingNode.js'; import { NodeUpdateType } from '../core/constants.js'; import { uniform } from '../core/UniformNode.js'; @@ -351,4 +351,4 @@ class AnalyticLightNode extends LightingNode { export default AnalyticLightNode; -registerNodeClass( 'AnalyticLight', AnalyticLightNode ); +AnalyticLightNode.type = /*@__PURE__*/ registerNode( 'AnalyticLight', AnalyticLightNode ); diff --git a/src/nodes/lighting/BasicEnvironmentNode.js b/src/nodes/lighting/BasicEnvironmentNode.js index e153e3a5f1e6c9..a95efcadb6fe3b 100644 --- a/src/nodes/lighting/BasicEnvironmentNode.js +++ b/src/nodes/lighting/BasicEnvironmentNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import LightingNode from './LightingNode.js'; import { cubeMapNode } from '../utils/CubeMapNode.js'; @@ -24,4 +24,4 @@ class BasicEnvironmentNode extends LightingNode { export default BasicEnvironmentNode; -registerNodeClass( 'BasicEnvironment', BasicEnvironmentNode ); +BasicEnvironmentNode.type = /*@__PURE__*/ registerNode( 'BasicEnvironment', BasicEnvironmentNode ); diff --git a/src/nodes/lighting/BasicLightMapNode.js b/src/nodes/lighting/BasicLightMapNode.js index b9198d8ba4f499..4362f9db3b9a72 100644 --- a/src/nodes/lighting/BasicLightMapNode.js +++ b/src/nodes/lighting/BasicLightMapNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import LightingNode from './LightingNode.js'; import { float } from '../tsl/TSLBase.js'; @@ -26,4 +26,4 @@ class BasicLightMapNode extends LightingNode { export default BasicLightMapNode; -registerNodeClass( 'BasicLightMap', BasicLightMapNode ); +BasicLightMapNode.type = /*@__PURE__*/ registerNode( 'BasicLightMap', BasicLightMapNode ); diff --git a/src/nodes/lighting/DirectionalLightNode.js b/src/nodes/lighting/DirectionalLightNode.js index b7369ded3c46c2..8f8078aba40716 100644 --- a/src/nodes/lighting/DirectionalLightNode.js +++ b/src/nodes/lighting/DirectionalLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; import { lightTargetDirection } from './LightNode.js'; @@ -32,4 +32,4 @@ class DirectionalLightNode extends AnalyticLightNode { export default DirectionalLightNode; -registerNodeClass( 'DirectionalLight', DirectionalLightNode ); +DirectionalLightNode.type = /*@__PURE__*/ registerNode( 'DirectionalLight', DirectionalLightNode ); diff --git a/src/nodes/lighting/EnvironmentNode.js b/src/nodes/lighting/EnvironmentNode.js index 35ea67f8944624..5936363dd81b68 100644 --- a/src/nodes/lighting/EnvironmentNode.js +++ b/src/nodes/lighting/EnvironmentNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import LightingNode from './LightingNode.js'; import { cache } from '../core/CacheNode.js'; import { roughness, clearcoatRoughness } from '../core/PropertyNode.js'; @@ -85,7 +85,7 @@ class EnvironmentNode extends LightingNode { export default EnvironmentNode; -registerNodeClass( 'Environment', EnvironmentNode ); +EnvironmentNode.type = /*@__PURE__*/ registerNode( 'Environment', EnvironmentNode ); const createRadianceContext = ( roughnessNode, normalViewNode ) => { diff --git a/src/nodes/lighting/HemisphereLightNode.js b/src/nodes/lighting/HemisphereLightNode.js index efd0c11641ca00..3ad2af55dbdba4 100644 --- a/src/nodes/lighting/HemisphereLightNode.js +++ b/src/nodes/lighting/HemisphereLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; import { uniform } from '../core/UniformNode.js'; import { mix } from '../math/MathNode.js'; @@ -49,4 +49,4 @@ class HemisphereLightNode extends AnalyticLightNode { export default HemisphereLightNode; -registerNodeClass( 'HemisphereLight', HemisphereLightNode ); +HemisphereLightNode.type = /*@__PURE__*/ registerNode( 'HemisphereLight', HemisphereLightNode ); diff --git a/src/nodes/lighting/IESSpotLightNode.js b/src/nodes/lighting/IESSpotLightNode.js index 427c9d90557611..579d293d617f82 100644 --- a/src/nodes/lighting/IESSpotLightNode.js +++ b/src/nodes/lighting/IESSpotLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import SpotLightNode from './SpotLightNode.js'; import { texture } from '../accessors/TextureNode.js'; import { vec2 } from '../tsl/TSLBase.js'; @@ -31,4 +31,4 @@ class IESSpotLightNode extends SpotLightNode { export default IESSpotLightNode; -registerNodeClass( 'IESSpotLight', IESSpotLightNode ); +IESSpotLightNode.type = /*@__PURE__*/ registerNode( 'IESSpotLight', IESSpotLightNode ); diff --git a/src/nodes/lighting/IrradianceNode.js b/src/nodes/lighting/IrradianceNode.js index 433bdaff556c6a..8415beef0f8429 100644 --- a/src/nodes/lighting/IrradianceNode.js +++ b/src/nodes/lighting/IrradianceNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import LightingNode from './LightingNode.js'; class IrradianceNode extends LightingNode { @@ -21,4 +21,4 @@ class IrradianceNode extends LightingNode { export default IrradianceNode; -registerNodeClass( 'Irradiance', IrradianceNode ); +IrradianceNode.type = /*@__PURE__*/ registerNode( 'Irradiance', IrradianceNode ); diff --git a/src/nodes/lighting/LightNode.js b/src/nodes/lighting/LightNode.js index 38f03e0cc3c60f..d94510a9a4abfc 100644 --- a/src/nodes/lighting/LightNode.js +++ b/src/nodes/lighting/LightNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeProxy } from '../tsl/TSLBase.js'; import { objectPosition } from '../accessors/Object3DNode.js'; import { cameraViewMatrix } from '../accessors/Camera.js'; @@ -52,6 +52,6 @@ LightNode.TARGET_DIRECTION = 'targetDirection'; export default LightNode; -registerNodeClass( 'Light', LightNode ); +LightNode.type = /*@__PURE__*/ registerNode( 'Light', LightNode ); -export const lightTargetDirection = nodeProxy( LightNode, LightNode.TARGET_DIRECTION ); +export const lightTargetDirection = /*@__PURE__*/ nodeProxy( LightNode, LightNode.TARGET_DIRECTION ); diff --git a/src/nodes/lighting/LightProbeNode.js b/src/nodes/lighting/LightProbeNode.js index d78307eaaa8758..6fc10c274c030d 100644 --- a/src/nodes/lighting/LightProbeNode.js +++ b/src/nodes/lighting/LightProbeNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; import { normalWorld } from '../accessors/Normal.js'; import { uniformArray } from '../accessors/UniformArrayNode.js'; @@ -48,9 +48,9 @@ class LightProbeNode extends AnalyticLightNode { export default LightProbeNode; -registerNodeClass( 'LightProbe', LightProbeNode ); +LightProbeNode.type = /*@__PURE__*/ registerNode( 'LightProbe', LightProbeNode ); -const shGetIrradianceAt = Fn( ( [ normal, shCoefficients ] ) => { +const shGetIrradianceAt = /*@__PURE__*/ Fn( ( [ normal, shCoefficients ] ) => { // normal is assumed to have unit length diff --git a/src/nodes/lighting/LightUtils.js b/src/nodes/lighting/LightUtils.js index 7a5519eeb49428..a5785e7800d216 100644 --- a/src/nodes/lighting/LightUtils.js +++ b/src/nodes/lighting/LightUtils.js @@ -1,6 +1,6 @@ import { Fn } from '../tsl/TSLBase.js'; -export const getDistanceAttenuation = Fn( ( inputs ) => { +export const getDistanceAttenuation = /*@__PURE__*/ Fn( ( inputs ) => { const { lightDistance, cutoffDistance, decayExponent } = inputs; diff --git a/src/nodes/lighting/LightingContextNode.js b/src/nodes/lighting/LightingContextNode.js index d5ff4e48b447b9..fe2d32a48eb34c 100644 --- a/src/nodes/lighting/LightingContextNode.js +++ b/src/nodes/lighting/LightingContextNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import ContextNode from '../core/ContextNode.js'; import { nodeProxy, float, vec3 } from '../tsl/TSLBase.js'; @@ -59,6 +59,6 @@ class LightingContextNode extends ContextNode { export default LightingContextNode; -registerNodeClass( 'LightingContext', LightingContextNode ); +LightingContextNode.type = /*@__PURE__*/ registerNode( 'LightingContext', LightingContextNode ); -export const lightingContext = nodeProxy( LightingContextNode ); +export const lightingContext = /*@__PURE__*/ nodeProxy( LightingContextNode ); diff --git a/src/nodes/lighting/LightingNode.js b/src/nodes/lighting/LightingNode.js index cfc5e3d5f0c422..3e1e3982fa5ee7 100644 --- a/src/nodes/lighting/LightingNode.js +++ b/src/nodes/lighting/LightingNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; class LightingNode extends Node { @@ -20,4 +20,4 @@ class LightingNode extends Node { export default LightingNode; -registerNodeClass( 'Lighting', LightingNode ); +LightingNode.type = /*@__PURE__*/ registerNode( 'Lighting', LightingNode ); diff --git a/src/nodes/lighting/LightsNode.js b/src/nodes/lighting/LightsNode.js index c243c363a271ec..7070188c5a824a 100644 --- a/src/nodes/lighting/LightsNode.js +++ b/src/nodes/lighting/LightsNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeObject, nodeProxy, vec3 } from '../tsl/TSLBase.js'; const sortLights = ( lights ) => { @@ -226,6 +226,6 @@ class LightsNode extends Node { export default LightsNode; -registerNodeClass( 'Lights', LightsNode ); +LightsNode.type = /*@__PURE__*/ registerNode( 'Lights', LightsNode ); -export const lights = nodeProxy( LightsNode ); +export const lights = /*@__PURE__*/ nodeProxy( LightsNode ); diff --git a/src/nodes/lighting/PointLightNode.js b/src/nodes/lighting/PointLightNode.js index d00ec2b4f0bc1a..77a25360170318 100644 --- a/src/nodes/lighting/PointLightNode.js +++ b/src/nodes/lighting/PointLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; import { getDistanceAttenuation } from './LightUtils.js'; import { uniform } from '../core/UniformNode.js'; @@ -60,4 +60,4 @@ class PointLightNode extends AnalyticLightNode { export default PointLightNode; -registerNodeClass( 'PointLight', PointLightNode ); +PointLightNode.type = /*@__PURE__*/ registerNode( 'PointLight', PointLightNode ); diff --git a/src/nodes/lighting/RectAreaLightNode.js b/src/nodes/lighting/RectAreaLightNode.js index b5961a2ff6e66a..2f46a2d8204d5d 100644 --- a/src/nodes/lighting/RectAreaLightNode.js +++ b/src/nodes/lighting/RectAreaLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; import { texture } from '../accessors/TextureNode.js'; import { uniform } from '../core/UniformNode.js'; @@ -90,4 +90,4 @@ class RectAreaLightNode extends AnalyticLightNode { export default RectAreaLightNode; -registerNodeClass( 'RectAreaLight', RectAreaLightNode ); +RectAreaLightNode.type = /*@__PURE__*/ registerNode( 'RectAreaLight', RectAreaLightNode ); diff --git a/src/nodes/lighting/SpotLightNode.js b/src/nodes/lighting/SpotLightNode.js index 96586d15a28a66..efc859279a8cf7 100644 --- a/src/nodes/lighting/SpotLightNode.js +++ b/src/nodes/lighting/SpotLightNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import AnalyticLightNode from './AnalyticLightNode.js'; import { lightTargetDirection } from './LightNode.js'; import { getDistanceAttenuation } from './LightUtils.js'; @@ -81,4 +81,4 @@ class SpotLightNode extends AnalyticLightNode { export default SpotLightNode; -registerNodeClass( 'SpotLight', SpotLightNode ); +SpotLightNode.type = /*@__PURE__*/ registerNode( 'SpotLight', SpotLightNode ); diff --git a/src/nodes/materialx/lib/mx_hsv.js b/src/nodes/materialx/lib/mx_hsv.js index e007cf7a010754..394cda51d27bcf 100644 --- a/src/nodes/materialx/lib/mx_hsv.js +++ b/src/nodes/materialx/lib/mx_hsv.js @@ -5,7 +5,7 @@ import { int, float, vec3, If, Fn } from '../../tsl/TSLBase.js'; import { add } from '../../math/OperatorNode.js'; import { floor, trunc, max, min } from '../../math/MathNode.js'; -export const mx_hsvtorgb = /*#__PURE__*/ Fn( ( [ hsv ] ) => { +export const mx_hsvtorgb = /*@__PURE__*/ Fn( ( [ hsv ] ) => { const s = hsv.y; const v = hsv.z; @@ -64,7 +64,7 @@ export const mx_hsvtorgb = /*#__PURE__*/ Fn( ( [ hsv ] ) => { ] } ); -export const mx_rgbtohsv = /*#__PURE__*/ Fn( ( [ c_immutable ] ) => { +export const mx_rgbtohsv = /*@__PURE__*/ Fn( ( [ c_immutable ] ) => { const c = vec3( c_immutable ).toVar(); const r = float( c.x ).toVar(); diff --git a/src/nodes/materialx/lib/mx_noise.js b/src/nodes/materialx/lib/mx_noise.js index 236dfeba00fffa..996429a3d3bdf2 100644 --- a/src/nodes/materialx/lib/mx_noise.js +++ b/src/nodes/materialx/lib/mx_noise.js @@ -9,7 +9,7 @@ import { overloadingFn } from '../../utils/FunctionOverloadingNode.js'; import { Loop } from '../../utils/LoopNode.js'; -export const mx_select = /*#__PURE__*/ Fn( ( [ b_immutable, t_immutable, f_immutable ] ) => { +export const mx_select = /*@__PURE__*/ Fn( ( [ b_immutable, t_immutable, f_immutable ] ) => { const f = float( f_immutable ).toVar(); const t = float( t_immutable ).toVar(); @@ -27,7 +27,7 @@ export const mx_select = /*#__PURE__*/ Fn( ( [ b_immutable, t_immutable, f_immut ] } ); -export const mx_negate_if = /*#__PURE__*/ Fn( ( [ val_immutable, b_immutable ] ) => { +export const mx_negate_if = /*@__PURE__*/ Fn( ( [ val_immutable, b_immutable ] ) => { const b = bool( b_immutable ).toVar(); const val = float( val_immutable ).toVar(); @@ -43,7 +43,7 @@ export const mx_negate_if = /*#__PURE__*/ Fn( ( [ val_immutable, b_immutable ] ) ] } ); -export const mx_floor = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => { +export const mx_floor = /*@__PURE__*/ Fn( ( [ x_immutable ] ) => { const x = float( x_immutable ).toVar(); @@ -57,7 +57,7 @@ export const mx_floor = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => { ] } ); -export const mx_floorfrac = /*#__PURE__*/ Fn( ( [ x_immutable, i ] ) => { +export const mx_floorfrac = /*@__PURE__*/ Fn( ( [ x_immutable, i ] ) => { const x = float( x_immutable ).toVar(); i.assign( mx_floor( x ) ); @@ -66,7 +66,7 @@ export const mx_floorfrac = /*#__PURE__*/ Fn( ( [ x_immutable, i ] ) => { } ); -export const mx_bilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => { +export const mx_bilerp_0 = /*@__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => { const t = float( t_immutable ).toVar(); const s = float( s_immutable ).toVar(); @@ -91,7 +91,7 @@ export const mx_bilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_ ] } ); -export const mx_bilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => { +export const mx_bilerp_1 = /*@__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => { const t = float( t_immutable ).toVar(); const s = float( s_immutable ).toVar(); @@ -116,9 +116,9 @@ export const mx_bilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_ ] } ); -export const mx_bilerp = /*#__PURE__*/ overloadingFn( [ mx_bilerp_0, mx_bilerp_1 ] ); +export const mx_bilerp = /*@__PURE__*/ overloadingFn( [ mx_bilerp_0, mx_bilerp_1 ] ); -export const mx_trilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => { +export const mx_trilerp_0 = /*@__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => { const r = float( r_immutable ).toVar(); const t = float( t_immutable ).toVar(); @@ -155,7 +155,7 @@ export const mx_trilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2 ] } ); -export const mx_trilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => { +export const mx_trilerp_1 = /*@__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => { const r = float( r_immutable ).toVar(); const t = float( t_immutable ).toVar(); @@ -192,9 +192,9 @@ export const mx_trilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2 ] } ); -export const mx_trilerp = /*#__PURE__*/ overloadingFn( [ mx_trilerp_0, mx_trilerp_1 ] ); +export const mx_trilerp = /*@__PURE__*/ overloadingFn( [ mx_trilerp_0, mx_trilerp_1 ] ); -export const mx_gradient_float_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => { +export const mx_gradient_float_0 = /*@__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => { const y = float( y_immutable ).toVar(); const x = float( x_immutable ).toVar(); @@ -215,7 +215,7 @@ export const mx_gradient_float_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immut ] } ); -export const mx_gradient_float_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => { +export const mx_gradient_float_1 = /*@__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => { const z = float( z_immutable ).toVar(); const y = float( y_immutable ).toVar(); @@ -238,9 +238,9 @@ export const mx_gradient_float_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immut ] } ); -export const mx_gradient_float = /*#__PURE__*/ overloadingFn( [ mx_gradient_float_0, mx_gradient_float_1 ] ); +export const mx_gradient_float = /*@__PURE__*/ overloadingFn( [ mx_gradient_float_0, mx_gradient_float_1 ] ); -export const mx_gradient_vec3_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => { +export const mx_gradient_vec3_0 = /*@__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => { const y = float( y_immutable ).toVar(); const x = float( x_immutable ).toVar(); @@ -258,7 +258,7 @@ export const mx_gradient_vec3_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immuta ] } ); -export const mx_gradient_vec3_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => { +export const mx_gradient_vec3_1 = /*@__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => { const z = float( z_immutable ).toVar(); const y = float( y_immutable ).toVar(); @@ -278,9 +278,9 @@ export const mx_gradient_vec3_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immuta ] } ); -export const mx_gradient_vec3 = /*#__PURE__*/ overloadingFn( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] ); +export const mx_gradient_vec3 = /*@__PURE__*/ overloadingFn( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] ); -export const mx_gradient_scale2d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { +export const mx_gradient_scale2d_0 = /*@__PURE__*/ Fn( ( [ v_immutable ] ) => { const v = float( v_immutable ).toVar(); @@ -294,7 +294,7 @@ export const mx_gradient_scale2d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { ] } ); -export const mx_gradient_scale3d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { +export const mx_gradient_scale3d_0 = /*@__PURE__*/ Fn( ( [ v_immutable ] ) => { const v = float( v_immutable ).toVar(); @@ -308,7 +308,7 @@ export const mx_gradient_scale3d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { ] } ); -export const mx_gradient_scale2d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { +export const mx_gradient_scale2d_1 = /*@__PURE__*/ Fn( ( [ v_immutable ] ) => { const v = vec3( v_immutable ).toVar(); @@ -322,9 +322,9 @@ export const mx_gradient_scale2d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { ] } ); -export const mx_gradient_scale2d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] ); +export const mx_gradient_scale2d = /*@__PURE__*/ overloadingFn( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] ); -export const mx_gradient_scale3d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { +export const mx_gradient_scale3d_1 = /*@__PURE__*/ Fn( ( [ v_immutable ] ) => { const v = vec3( v_immutable ).toVar(); @@ -338,9 +338,9 @@ export const mx_gradient_scale3d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => { ] } ); -export const mx_gradient_scale3d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] ); +export const mx_gradient_scale3d = /*@__PURE__*/ overloadingFn( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] ); -export const mx_rotl32 = /*#__PURE__*/ Fn( ( [ x_immutable, k_immutable ] ) => { +export const mx_rotl32 = /*@__PURE__*/ Fn( ( [ x_immutable, k_immutable ] ) => { const k = int( k_immutable ).toVar(); const x = uint( x_immutable ).toVar(); @@ -356,7 +356,7 @@ export const mx_rotl32 = /*#__PURE__*/ Fn( ( [ x_immutable, k_immutable ] ) => { ] } ); -export const mx_bjmix = /*#__PURE__*/ Fn( ( [ a, b, c ] ) => { +export const mx_bjmix = /*@__PURE__*/ Fn( ( [ a, b, c ] ) => { a.subAssign( c ); a.bitXorAssign( mx_rotl32( c, int( 4 ) ) ); @@ -379,7 +379,7 @@ export const mx_bjmix = /*#__PURE__*/ Fn( ( [ a, b, c ] ) => { } ); -export const mx_bjfinal = /*#__PURE__*/ Fn( ( [ a_immutable, b_immutable, c_immutable ] ) => { +export const mx_bjfinal = /*@__PURE__*/ Fn( ( [ a_immutable, b_immutable, c_immutable ] ) => { const c = uint( c_immutable ).toVar(); const b = uint( b_immutable ).toVar(); @@ -411,7 +411,7 @@ export const mx_bjfinal = /*#__PURE__*/ Fn( ( [ a_immutable, b_immutable, c_immu ] } ); -export const mx_bits_to_01 = /*#__PURE__*/ Fn( ( [ bits_immutable ] ) => { +export const mx_bits_to_01 = /*@__PURE__*/ Fn( ( [ bits_immutable ] ) => { const bits = uint( bits_immutable ).toVar(); @@ -425,7 +425,7 @@ export const mx_bits_to_01 = /*#__PURE__*/ Fn( ( [ bits_immutable ] ) => { ] } ); -export const mx_fade = /*#__PURE__*/ Fn( ( [ t_immutable ] ) => { +export const mx_fade = /*@__PURE__*/ Fn( ( [ t_immutable ] ) => { const t = float( t_immutable ).toVar(); @@ -439,7 +439,7 @@ export const mx_fade = /*#__PURE__*/ Fn( ( [ t_immutable ] ) => { ] } ); -export const mx_hash_int_0 = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => { +export const mx_hash_int_0 = /*@__PURE__*/ Fn( ( [ x_immutable ] ) => { const x = int( x_immutable ).toVar(); const len = uint( uint( 1 ) ).toVar(); @@ -455,7 +455,7 @@ export const mx_hash_int_0 = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => { ] } ); -export const mx_hash_int_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => { +export const mx_hash_int_1 = /*@__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => { const y = int( y_immutable ).toVar(); const x = int( x_immutable ).toVar(); @@ -476,7 +476,7 @@ export const mx_hash_int_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) ] } ); -export const mx_hash_int_2 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => { +export const mx_hash_int_2 = /*@__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => { const z = int( z_immutable ).toVar(); const y = int( y_immutable ).toVar(); @@ -500,7 +500,7 @@ export const mx_hash_int_2 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_i ] } ); -export const mx_hash_int_3 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => { +export const mx_hash_int_3 = /*@__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => { const xx = int( xx_immutable ).toVar(); const z = int( z_immutable ).toVar(); @@ -528,7 +528,7 @@ export const mx_hash_int_3 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_i ] } ); -export const mx_hash_int_4 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => { +export const mx_hash_int_4 = /*@__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => { const yy = int( yy_immutable ).toVar(); const xx = int( xx_immutable ).toVar(); @@ -559,9 +559,9 @@ export const mx_hash_int_4 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_i ] } ); -export const mx_hash_int = /*#__PURE__*/ overloadingFn( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] ); +export const mx_hash_int = /*@__PURE__*/ overloadingFn( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] ); -export const mx_hash_vec3_0 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => { +export const mx_hash_vec3_0 = /*@__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => { const y = int( y_immutable ).toVar(); const x = int( x_immutable ).toVar(); @@ -582,7 +582,7 @@ export const mx_hash_vec3_0 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) ] } ); -export const mx_hash_vec3_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => { +export const mx_hash_vec3_1 = /*@__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => { const z = int( z_immutable ).toVar(); const y = int( y_immutable ).toVar(); @@ -605,9 +605,9 @@ export const mx_hash_vec3_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_ ] } ); -export const mx_hash_vec3 = /*#__PURE__*/ overloadingFn( [ mx_hash_vec3_0, mx_hash_vec3_1 ] ); +export const mx_hash_vec3 = /*@__PURE__*/ overloadingFn( [ mx_hash_vec3_0, mx_hash_vec3_1 ] ); -export const mx_perlin_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_perlin_noise_float_0 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec2( p_immutable ).toVar(); const X = int().toVar(), Y = int().toVar(); @@ -627,7 +627,7 @@ export const mx_perlin_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => ] } ); -export const mx_perlin_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_perlin_noise_float_1 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec3( p_immutable ).toVar(); const X = int().toVar(), Y = int().toVar(), Z = int().toVar(); @@ -649,9 +649,9 @@ export const mx_perlin_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => ] } ); -export const mx_perlin_noise_float = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] ); +export const mx_perlin_noise_float = /*@__PURE__*/ overloadingFn( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] ); -export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_perlin_noise_vec3_0 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec2( p_immutable ).toVar(); const X = int().toVar(), Y = int().toVar(); @@ -671,7 +671,7 @@ export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_perlin_noise_vec3_1 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec3( p_immutable ).toVar(); const X = int().toVar(), Y = int().toVar(), Z = int().toVar(); @@ -693,9 +693,9 @@ export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_perlin_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] ); +export const mx_perlin_noise_vec3 = /*@__PURE__*/ overloadingFn( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] ); -export const mx_cell_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_float_0 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = float( p_immutable ).toVar(); const ix = int( mx_floor( p ) ).toVar(); @@ -710,7 +710,7 @@ export const mx_cell_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_float_1 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec2( p_immutable ).toVar(); const ix = int( mx_floor( p.x ) ).toVar(); @@ -726,7 +726,7 @@ export const mx_cell_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_float_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_float_2 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec3( p_immutable ).toVar(); const ix = int( mx_floor( p.x ) ).toVar(); @@ -743,7 +743,7 @@ export const mx_cell_noise_float_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_float_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_float_3 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec4( p_immutable ).toVar(); const ix = int( mx_floor( p.x ) ).toVar(); @@ -761,9 +761,9 @@ export const mx_cell_noise_float_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_float = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] ); +export const mx_cell_noise_float = /*@__PURE__*/ overloadingFn( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] ); -export const mx_cell_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_vec3_0 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = float( p_immutable ).toVar(); const ix = int( mx_floor( p ) ).toVar(); @@ -778,7 +778,7 @@ export const mx_cell_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_vec3_1 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec2( p_immutable ).toVar(); const ix = int( mx_floor( p.x ) ).toVar(); @@ -794,7 +794,7 @@ export const mx_cell_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_vec3_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_vec3_2 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec3( p_immutable ).toVar(); const ix = int( mx_floor( p.x ) ).toVar(); @@ -811,7 +811,7 @@ export const mx_cell_noise_vec3_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_vec3_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { +export const mx_cell_noise_vec3_3 = /*@__PURE__*/ Fn( ( [ p_immutable ] ) => { const p = vec4( p_immutable ).toVar(); const ix = int( mx_floor( p.x ) ).toVar(); @@ -829,9 +829,9 @@ export const mx_cell_noise_vec3_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => { ] } ); -export const mx_cell_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] ); +export const mx_cell_noise_vec3 = /*@__PURE__*/ overloadingFn( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] ); -export const mx_fractal_noise_float = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { +export const mx_fractal_noise_float = /*@__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { const diminish = float( diminish_immutable ).toVar(); const lacunarity = float( lacunarity_immutable ).toVar(); @@ -861,7 +861,7 @@ export const mx_fractal_noise_float = /*#__PURE__*/ Fn( ( [ p_immutable, octaves ] } ); -export const mx_fractal_noise_vec3 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { +export const mx_fractal_noise_vec3 = /*@__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { const diminish = float( diminish_immutable ).toVar(); const lacunarity = float( lacunarity_immutable ).toVar(); @@ -891,7 +891,7 @@ export const mx_fractal_noise_vec3 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_ ] } ); -export const mx_fractal_noise_vec2 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { +export const mx_fractal_noise_vec2 = /*@__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { const diminish = float( diminish_immutable ).toVar(); const lacunarity = float( lacunarity_immutable ).toVar(); @@ -911,7 +911,7 @@ export const mx_fractal_noise_vec2 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_ ] } ); -export const mx_fractal_noise_vec4 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { +export const mx_fractal_noise_vec4 = /*@__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => { const diminish = float( diminish_immutable ).toVar(); const lacunarity = float( lacunarity_immutable ).toVar(); @@ -933,7 +933,7 @@ export const mx_fractal_noise_vec4 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_ ] } ); -export const mx_worley_distance_0 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_distance_0 = /*@__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -978,7 +978,7 @@ export const mx_worley_distance_0 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutab ] } ); -export const mx_worley_distance_1 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_distance_1 = /*@__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1026,9 +1026,9 @@ export const mx_worley_distance_1 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutab ] } ); -export const mx_worley_distance = /*#__PURE__*/ overloadingFn( [ mx_worley_distance_0, mx_worley_distance_1 ] ); +export const mx_worley_distance = /*@__PURE__*/ overloadingFn( [ mx_worley_distance_0, mx_worley_distance_1 ] ); -export const mx_worley_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_noise_float_0 = /*@__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1066,7 +1066,7 @@ export const mx_worley_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter ] } ); -export const mx_worley_noise_vec2_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_noise_vec2_0 = /*@__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1114,7 +1114,7 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_ ] } ); -export const mx_worley_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_noise_vec3_0 = /*@__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1168,7 +1168,7 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_ ] } ); -export const mx_worley_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_noise_float_1 = /*@__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1210,9 +1210,9 @@ export const mx_worley_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter ] } ); -export const mx_worley_noise_float = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] ); +export const mx_worley_noise_float = /*@__PURE__*/ overloadingFn( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] ); -export const mx_worley_noise_vec2_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_noise_vec2_1 = /*@__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1264,9 +1264,9 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_ ] } ); -export const mx_worley_noise_vec2 = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] ); +export const mx_worley_noise_vec2 = /*@__PURE__*/ overloadingFn( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] ); -export const mx_worley_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { +export const mx_worley_noise_vec3_1 = /*@__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => { const metric = int( metric_immutable ).toVar(); const jitter = float( jitter_immutable ).toVar(); @@ -1324,4 +1324,4 @@ export const mx_worley_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_ ] } ); -export const mx_worley_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_vec3_0, mx_worley_noise_vec3_1 ] ); +export const mx_worley_noise_vec3 = /*@__PURE__*/ overloadingFn( [ mx_worley_noise_vec3_0, mx_worley_noise_vec3_1 ] ); diff --git a/src/nodes/materialx/lib/mx_transform_color.js b/src/nodes/materialx/lib/mx_transform_color.js index b146c99f708758..128e1269f3cd8e 100644 --- a/src/nodes/materialx/lib/mx_transform_color.js +++ b/src/nodes/materialx/lib/mx_transform_color.js @@ -5,7 +5,7 @@ import { bvec3, vec3, Fn } from '../../tsl/TSLBase.js'; import { greaterThan } from '../../math/OperatorNode.js'; import { max, pow, mix } from '../../math/MathNode.js'; -export const mx_srgb_texture_to_lin_rec709 = /*#__PURE__*/ Fn( ( [ color_immutable ] ) => { +export const mx_srgb_texture_to_lin_rec709 = /*@__PURE__*/ Fn( ( [ color_immutable ] ) => { const color = vec3( color_immutable ).toVar(); const isAbove = bvec3( greaterThan( color, vec3( 0.04045 ) ) ).toVar(); diff --git a/src/nodes/math/ConditionalNode.js b/src/nodes/math/ConditionalNode.js index 177b0d90de5815..92f97ec6749c72 100644 --- a/src/nodes/math/ConditionalNode.js +++ b/src/nodes/math/ConditionalNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { property } from '../core/PropertyNode.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; @@ -121,9 +121,9 @@ class ConditionalNode extends Node { export default ConditionalNode; -registerNodeClass( 'Conditional', ConditionalNode ); +ConditionalNode.type = /*@__PURE__*/ registerNode( 'Conditional', ConditionalNode ); -export const select = nodeProxy( ConditionalNode ); +export const select = /*@__PURE__*/ nodeProxy( ConditionalNode ); addMethodChaining( 'select', select ); diff --git a/src/nodes/math/Hash.js b/src/nodes/math/Hash.js index 14a6c17284670b..fe226cf36b709e 100644 --- a/src/nodes/math/Hash.js +++ b/src/nodes/math/Hash.js @@ -1,6 +1,6 @@ import { Fn } from '../tsl/TSLBase.js'; -export const hash = Fn( ( [ seed ] ) => { +export const hash = /*@__PURE__*/ Fn( ( [ seed ] ) => { // Taken from https://www.shadertoy.com/view/XlGcRh, originally from pcg-random.org diff --git a/src/nodes/math/MathNode.js b/src/nodes/math/MathNode.js index 0fcfbd94ea3ff4..0e5e3b7c2d221a 100644 --- a/src/nodes/math/MathNode.js +++ b/src/nodes/math/MathNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { sub, mul, div } from './OperatorNode.js'; import { addMethodChaining, nodeObject, nodeProxy, float, vec2, vec3, vec4, Fn } from '../tsl/TSLCore.js'; @@ -264,75 +264,75 @@ MathNode.FACEFORWARD = 'faceforward'; export default MathNode; -registerNodeClass( 'Math', MathNode ); - -export const EPSILON = float( 1e-6 ); -export const INFINITY = float( 1e6 ); -export const PI = float( Math.PI ); -export const PI2 = float( Math.PI * 2 ); - -export const all = nodeProxy( MathNode, MathNode.ALL ); -export const any = nodeProxy( MathNode, MathNode.ANY ); -export const equals = nodeProxy( MathNode, MathNode.EQUALS ); - -export const radians = nodeProxy( MathNode, MathNode.RADIANS ); -export const degrees = nodeProxy( MathNode, MathNode.DEGREES ); -export const exp = nodeProxy( MathNode, MathNode.EXP ); -export const exp2 = nodeProxy( MathNode, MathNode.EXP2 ); -export const log = nodeProxy( MathNode, MathNode.LOG ); -export const log2 = nodeProxy( MathNode, MathNode.LOG2 ); -export const sqrt = nodeProxy( MathNode, MathNode.SQRT ); -export const inverseSqrt = nodeProxy( MathNode, MathNode.INVERSE_SQRT ); -export const floor = nodeProxy( MathNode, MathNode.FLOOR ); -export const ceil = nodeProxy( MathNode, MathNode.CEIL ); -export const normalize = nodeProxy( MathNode, MathNode.NORMALIZE ); -export const fract = nodeProxy( MathNode, MathNode.FRACT ); -export const sin = nodeProxy( MathNode, MathNode.SIN ); -export const cos = nodeProxy( MathNode, MathNode.COS ); -export const tan = nodeProxy( MathNode, MathNode.TAN ); -export const asin = nodeProxy( MathNode, MathNode.ASIN ); -export const acos = nodeProxy( MathNode, MathNode.ACOS ); -export const atan = nodeProxy( MathNode, MathNode.ATAN ); -export const abs = nodeProxy( MathNode, MathNode.ABS ); -export const sign = nodeProxy( MathNode, MathNode.SIGN ); -export const length = nodeProxy( MathNode, MathNode.LENGTH ); -export const negate = nodeProxy( MathNode, MathNode.NEGATE ); -export const oneMinus = nodeProxy( MathNode, MathNode.ONE_MINUS ); -export const dFdx = nodeProxy( MathNode, MathNode.DFDX ); -export const dFdy = nodeProxy( MathNode, MathNode.DFDY ); -export const round = nodeProxy( MathNode, MathNode.ROUND ); -export const reciprocal = nodeProxy( MathNode, MathNode.RECIPROCAL ); -export const trunc = nodeProxy( MathNode, MathNode.TRUNC ); -export const fwidth = nodeProxy( MathNode, MathNode.FWIDTH ); -export const bitcast = nodeProxy( MathNode, MathNode.BITCAST ); -export const transpose = nodeProxy( MathNode, MathNode.TRANSPOSE ); - -export const atan2 = nodeProxy( MathNode, MathNode.ATAN2 ); -export const min = nodeProxy( MathNode, MathNode.MIN ); -export const max = nodeProxy( MathNode, MathNode.MAX ); -export const mod = nodeProxy( MathNode, MathNode.MOD ); -export const step = nodeProxy( MathNode, MathNode.STEP ); -export const reflect = nodeProxy( MathNode, MathNode.REFLECT ); -export const distance = nodeProxy( MathNode, MathNode.DISTANCE ); -export const difference = nodeProxy( MathNode, MathNode.DIFFERENCE ); -export const dot = nodeProxy( MathNode, MathNode.DOT ); -export const cross = nodeProxy( MathNode, MathNode.CROSS ); -export const pow = nodeProxy( MathNode, MathNode.POW ); -export const pow2 = nodeProxy( MathNode, MathNode.POW, 2 ); -export const pow3 = nodeProxy( MathNode, MathNode.POW, 3 ); -export const pow4 = nodeProxy( MathNode, MathNode.POW, 4 ); -export const transformDirection = nodeProxy( MathNode, MathNode.TRANSFORM_DIRECTION ); +MathNode.type = /*@__PURE__*/ registerNode( 'Math', MathNode ); + +export const EPSILON = /*@__PURE__*/ float( 1e-6 ); +export const INFINITY = /*@__PURE__*/ float( 1e6 ); +export const PI = /*@__PURE__*/ float( Math.PI ); +export const PI2 = /*@__PURE__*/ float( Math.PI * 2 ); + +export const all = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ALL ); +export const any = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ANY ); +export const equals = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EQUALS ); + +export const radians = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RADIANS ); +export const degrees = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DEGREES ); +export const exp = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP ); +export const exp2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP2 ); +export const log = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG ); +export const log2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG2 ); +export const sqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SQRT ); +export const inverseSqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.INVERSE_SQRT ); +export const floor = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FLOOR ); +export const ceil = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CEIL ); +export const normalize = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NORMALIZE ); +export const fract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FRACT ); +export const sin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIN ); +export const cos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.COS ); +export const tan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TAN ); +export const asin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ASIN ); +export const acos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ACOS ); +export const atan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ATAN ); +export const abs = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ABS ); +export const sign = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIGN ); +export const length = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LENGTH ); +export const negate = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NEGATE ); +export const oneMinus = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ONE_MINUS ); +export const dFdx = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDX ); +export const dFdy = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDY ); +export const round = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ROUND ); +export const reciprocal = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RECIPROCAL ); +export const trunc = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRUNC ); +export const fwidth = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FWIDTH ); +export const bitcast = /*@__PURE__*/ nodeProxy( MathNode, MathNode.BITCAST ); +export const transpose = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSPOSE ); + +export const atan2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ATAN2 ); +export const min = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIN ); +export const max = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MAX ); +export const mod = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MOD ); +export const step = /*@__PURE__*/ nodeProxy( MathNode, MathNode.STEP ); +export const reflect = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFLECT ); +export const distance = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DISTANCE ); +export const difference = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DIFFERENCE ); +export const dot = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DOT ); +export const cross = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CROSS ); +export const pow = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW ); +export const pow2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 2 ); +export const pow3 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 3 ); +export const pow4 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 4 ); +export const transformDirection = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSFORM_DIRECTION ); export const cbrt = ( a ) => mul( sign( a ), pow( abs( a ), 1.0 / 3.0 ) ); export const lengthSq = ( a ) => dot( a, a ); -export const mix = nodeProxy( MathNode, MathNode.MIX ); +export const mix = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIX ); export const clamp = ( value, low = 0, high = 1 ) => nodeObject( new MathNode( MathNode.CLAMP, nodeObject( value ), nodeObject( low ), nodeObject( high ) ) ); export const saturate = ( value ) => clamp( value ); -export const refract = nodeProxy( MathNode, MathNode.REFRACT ); -export const smoothstep = nodeProxy( MathNode, MathNode.SMOOTHSTEP ); -export const faceForward = nodeProxy( MathNode, MathNode.FACEFORWARD ); +export const refract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFRACT ); +export const smoothstep = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SMOOTHSTEP ); +export const faceForward = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FACEFORWARD ); -export const rand = Fn( ( [ uv ] ) => { +export const rand = /*@__PURE__*/ Fn( ( [ uv ] ) => { const a = 12.9898, b = 78.233, c = 43758.5453; const dt = dot( uv.xy, vec2( a, b ) ), sn = mod( dt, PI ); diff --git a/src/nodes/math/OperatorNode.js b/src/nodes/math/OperatorNode.js index 5d423a3709981b..df6fb63129f969 100644 --- a/src/nodes/math/OperatorNode.js +++ b/src/nodes/math/OperatorNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; @@ -259,29 +259,29 @@ class OperatorNode extends TempNode { export default OperatorNode; -registerNodeClass( 'Operator', OperatorNode ); - -export const add = nodeProxy( OperatorNode, '+' ); -export const sub = nodeProxy( OperatorNode, '-' ); -export const mul = nodeProxy( OperatorNode, '*' ); -export const div = nodeProxy( OperatorNode, '/' ); -export const modInt = nodeProxy( OperatorNode, '%' ); -export const equal = nodeProxy( OperatorNode, '==' ); -export const notEqual = nodeProxy( OperatorNode, '!=' ); -export const lessThan = nodeProxy( OperatorNode, '<' ); -export const greaterThan = nodeProxy( OperatorNode, '>' ); -export const lessThanEqual = nodeProxy( OperatorNode, '<=' ); -export const greaterThanEqual = nodeProxy( OperatorNode, '>=' ); -export const and = nodeProxy( OperatorNode, '&&' ); -export const or = nodeProxy( OperatorNode, '||' ); -export const not = nodeProxy( OperatorNode, '!' ); -export const xor = nodeProxy( OperatorNode, '^^' ); -export const bitAnd = nodeProxy( OperatorNode, '&' ); -export const bitNot = nodeProxy( OperatorNode, '~' ); -export const bitOr = nodeProxy( OperatorNode, '|' ); -export const bitXor = nodeProxy( OperatorNode, '^' ); -export const shiftLeft = nodeProxy( OperatorNode, '<<' ); -export const shiftRight = nodeProxy( OperatorNode, '>>' ); +OperatorNode.type = /*@__PURE__*/ registerNode( 'Operator', OperatorNode ); + +export const add = /*@__PURE__*/ nodeProxy( OperatorNode, '+' ); +export const sub = /*@__PURE__*/ nodeProxy( OperatorNode, '-' ); +export const mul = /*@__PURE__*/ nodeProxy( OperatorNode, '*' ); +export const div = /*@__PURE__*/ nodeProxy( OperatorNode, '/' ); +export const modInt = /*@__PURE__*/ nodeProxy( OperatorNode, '%' ); +export const equal = /*@__PURE__*/ nodeProxy( OperatorNode, '==' ); +export const notEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '!=' ); +export const lessThan = /*@__PURE__*/ nodeProxy( OperatorNode, '<' ); +export const greaterThan = /*@__PURE__*/ nodeProxy( OperatorNode, '>' ); +export const lessThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '<=' ); +export const greaterThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '>=' ); +export const and = /*@__PURE__*/ nodeProxy( OperatorNode, '&&' ); +export const or = /*@__PURE__*/ nodeProxy( OperatorNode, '||' ); +export const not = /*@__PURE__*/ nodeProxy( OperatorNode, '!' ); +export const xor = /*@__PURE__*/ nodeProxy( OperatorNode, '^^' ); +export const bitAnd = /*@__PURE__*/ nodeProxy( OperatorNode, '&' ); +export const bitNot = /*@__PURE__*/ nodeProxy( OperatorNode, '~' ); +export const bitOr = /*@__PURE__*/ nodeProxy( OperatorNode, '|' ); +export const bitXor = /*@__PURE__*/ nodeProxy( OperatorNode, '^' ); +export const shiftLeft = /*@__PURE__*/ nodeProxy( OperatorNode, '<<' ); +export const shiftRight = /*@__PURE__*/ nodeProxy( OperatorNode, '>>' ); addMethodChaining( 'add', add ); addMethodChaining( 'sub', sub ); diff --git a/src/nodes/math/TriNoise3D.js b/src/nodes/math/TriNoise3D.js index eb293a74fb923a..c0428826928d9f 100644 --- a/src/nodes/math/TriNoise3D.js +++ b/src/nodes/math/TriNoise3D.js @@ -3,7 +3,7 @@ import { Loop } from '../utils/LoopNode.js'; import { float, vec3, Fn } from '../tsl/TSLBase.js'; -export const tri = Fn( ( [ x ] ) => { +export const tri = /*@__PURE__*/ Fn( ( [ x ] ) => { return x.fract().sub( .5 ).abs(); @@ -15,7 +15,7 @@ export const tri = Fn( ( [ x ] ) => { ] } ); -export const tri3 = Fn( ( [ p ] ) => { +export const tri3 = /*@__PURE__*/ Fn( ( [ p ] ) => { return vec3( tri( p.z.add( tri( p.y.mul( 1. ) ) ) ), tri( p.z.add( tri( p.x.mul( 1. ) ) ) ), tri( p.y.add( tri( p.x.mul( 1. ) ) ) ) ); @@ -27,7 +27,7 @@ export const tri3 = Fn( ( [ p ] ) => { ] } ); -export const triNoise3D = Fn( ( [ p_immutable, spd, time ] ) => { +export const triNoise3D = /*@__PURE__*/ Fn( ( [ p_immutable, spd, time ] ) => { const p = vec3( p_immutable ).toVar(); const z = float( 1.4 ).toVar(); diff --git a/src/nodes/pmrem/PMREMNode.js b/src/nodes/pmrem/PMREMNode.js index 3102c354b961f8..988b76b4d86aac 100644 --- a/src/nodes/pmrem/PMREMNode.js +++ b/src/nodes/pmrem/PMREMNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { texture } from '../accessors/TextureNode.js'; import { textureCubeUV } from './PMREMUtils.js'; @@ -206,7 +206,7 @@ class PMREMNode extends TempNode { export default PMREMNode; -registerNodeClass( 'PMREM', PMREMNode ); +PMREMNode.type = /*@__PURE__*/ registerNode( 'PMREM', PMREMNode ); function isCubeMapReady( image ) { @@ -234,4 +234,4 @@ function isEquirectangularMapReady( image ) { } -export const pmremTexture = nodeProxy( PMREMNode ); +export const pmremTexture = /*@__PURE__*/ nodeProxy( PMREMNode ); diff --git a/src/nodes/pmrem/PMREMUtils.js b/src/nodes/pmrem/PMREMUtils.js index d34bb620fe551c..cb7c7c43d4fc3b 100644 --- a/src/nodes/pmrem/PMREMUtils.js +++ b/src/nodes/pmrem/PMREMUtils.js @@ -6,25 +6,25 @@ import { Loop, Break } from '../utils/LoopNode.js'; // These defines must match with PMREMGenerator -const cubeUV_r0 = float( 1.0 ); -const cubeUV_m0 = float( - 2.0 ); -const cubeUV_r1 = float( 0.8 ); -const cubeUV_m1 = float( - 1.0 ); -const cubeUV_r4 = float( 0.4 ); -const cubeUV_m4 = float( 2.0 ); -const cubeUV_r5 = float( 0.305 ); -const cubeUV_m5 = float( 3.0 ); -const cubeUV_r6 = float( 0.21 ); -const cubeUV_m6 = float( 4.0 ); - -const cubeUV_minMipLevel = float( 4.0 ); -const cubeUV_minTileSize = float( 16.0 ); +const cubeUV_r0 = /*@__PURE__*/ float( 1.0 ); +const cubeUV_m0 = /*@__PURE__*/ float( - 2.0 ); +const cubeUV_r1 = /*@__PURE__*/ float( 0.8 ); +const cubeUV_m1 = /*@__PURE__*/ float( - 1.0 ); +const cubeUV_r4 = /*@__PURE__*/ float( 0.4 ); +const cubeUV_m4 = /*@__PURE__*/ float( 2.0 ); +const cubeUV_r5 = /*@__PURE__*/ float( 0.305 ); +const cubeUV_m5 = /*@__PURE__*/ float( 3.0 ); +const cubeUV_r6 = /*@__PURE__*/ float( 0.21 ); +const cubeUV_m6 = /*@__PURE__*/ float( 4.0 ); + +const cubeUV_minMipLevel = /*@__PURE__*/ float( 4.0 ); +const cubeUV_minTileSize = /*@__PURE__*/ float( 16.0 ); // These shader functions convert between the UV coordinates of a single face of // a cubemap, the 0-5 integer index of a cube face, and the direction vector for // sampling a textureCube (not generally normalized ). -const getFace = Fn( ( [ direction ] ) => { +const getFace = /*@__PURE__*/ Fn( ( [ direction ] ) => { const absDirection = vec3( abs( direction ) ).toVar(); const face = float( - 1.0 ).toVar(); @@ -66,7 +66,7 @@ const getFace = Fn( ( [ direction ] ) => { } ); // RH coordinate system; PMREM face-indexing convention -const getUV = Fn( ( [ direction, face ] ) => { +const getUV = /*@__PURE__*/ Fn( ( [ direction, face ] ) => { const uv = vec2().toVar(); @@ -107,7 +107,7 @@ const getUV = Fn( ( [ direction, face ] ) => { ] } ); -const roughnessToMip = Fn( ( [ roughness ] ) => { +const roughnessToMip = /*@__PURE__*/ Fn( ( [ roughness ] ) => { const mip = float( 0.0 ).toVar(); @@ -144,7 +144,7 @@ const roughnessToMip = Fn( ( [ roughness ] ) => { } ); // RH coordinate system; PMREM face-indexing convention -export const getDirection = Fn( ( [ uv_immutable, face ] ) => { +export const getDirection = /*@__PURE__*/ Fn( ( [ uv_immutable, face ] ) => { const uv = uv_immutable.toVar(); uv.assign( mul( 2.0, uv ).sub( 1.0 ) ); @@ -192,7 +192,7 @@ export const getDirection = Fn( ( [ uv_immutable, face ] ) => { // -export const textureCubeUV = Fn( ( [ envMap, sampleDir_immutable, roughness_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => { +export const textureCubeUV = /*@__PURE__*/ Fn( ( [ envMap, sampleDir_immutable, roughness_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => { const roughness = float( roughness_immutable ); const sampleDir = vec3( sampleDir_immutable ); @@ -214,7 +214,7 @@ export const textureCubeUV = Fn( ( [ envMap, sampleDir_immutable, roughness_immu } ); -const bilinearCubeUV = Fn( ( [ envMap, direction_immutable, mipInt_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => { +const bilinearCubeUV = /*@__PURE__*/ Fn( ( [ envMap, direction_immutable, mipInt_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => { const mipInt = float( mipInt_immutable ).toVar(); const direction = vec3( direction_immutable ); @@ -241,7 +241,7 @@ const bilinearCubeUV = Fn( ( [ envMap, direction_immutable, mipInt_immutable, CU } ); -const getSample = Fn( ( { envMap, mipInt, outputDirection, theta, axis, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => { +const getSample = /*@__PURE__*/ Fn( ( { envMap, mipInt, outputDirection, theta, axis, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => { const cosTheta = cos( theta ); @@ -254,7 +254,7 @@ const getSample = Fn( ( { envMap, mipInt, outputDirection, theta, axis, CUBEUV_T } ); -export const blur = Fn( ( { n, latitudinal, poleAxis, outputDirection, weights, samples, dTheta, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => { +export const blur = /*@__PURE__*/ Fn( ( { n, latitudinal, poleAxis, outputDirection, weights, samples, dTheta, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => { const axis = vec3( select( latitudinal, poleAxis, cross( poleAxis, outputDirection ) ) ).toVar(); diff --git a/src/nodes/procedural/Checker.js b/src/nodes/procedural/Checker.js index 933e68fac95f9e..ee8e71a70c6b18 100644 --- a/src/nodes/procedural/Checker.js +++ b/src/nodes/procedural/Checker.js @@ -1,7 +1,7 @@ import { uv } from '../accessors/UV.js'; import { Fn } from '../tsl/TSLBase.js'; -export const checker = Fn( ( [ coord = uv() ] ) => { +export const checker = /*@__PURE__*/ Fn( ( [ coord = uv() ] ) => { const uv = coord.mul( 2.0 ); diff --git a/src/nodes/tsl/TSLCore.js b/src/nodes/tsl/TSLCore.js index 0e24ce1f7294fb..612362d8eaca00 100644 --- a/src/nodes/tsl/TSLCore.js +++ b/src/nodes/tsl/TSLCore.js @@ -652,7 +652,7 @@ addMethodChaining( 'toMat4', mat4 ); // basic nodes -export const element = nodeProxy( ArrayElementNode ); +export const element = /*@__PURE__*/ nodeProxy( ArrayElementNode ); export const convert = ( node, types ) => nodeObject( new ConvertNode( nodeObject( node ), types ) ); export const split = ( node, channels ) => nodeObject( new SplitNode( nodeObject( node ), channels ) ); diff --git a/src/nodes/utils/ArrayElementNode.js b/src/nodes/utils/ArrayElementNode.js index b988028754acf2..eb071f6a2132c9 100644 --- a/src/nodes/utils/ArrayElementNode.js +++ b/src/nodes/utils/ArrayElementNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; class ArrayElementNode extends Node { // @TODO: If extending from TempNode it breaks webgpu_compute @@ -32,4 +32,4 @@ class ArrayElementNode extends Node { // @TODO: If extending from TempNode it br export default ArrayElementNode; -registerNodeClass( 'ArrayElement', ArrayElementNode ); +ArrayElementNode.type = /*@__PURE__*/ registerNode( 'ArrayElement', ArrayElementNode ); diff --git a/src/nodes/utils/ConvertNode.js b/src/nodes/utils/ConvertNode.js index ccdbde035297b5..efe314a0f34709 100644 --- a/src/nodes/utils/ConvertNode.js +++ b/src/nodes/utils/ConvertNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; class ConvertNode extends Node { @@ -62,4 +62,4 @@ class ConvertNode extends Node { export default ConvertNode; -registerNodeClass( 'Convert', ConvertNode ); +ConvertNode.type = /*@__PURE__*/ registerNode( 'Convert', ConvertNode ); diff --git a/src/nodes/utils/CubeMapNode.js b/src/nodes/utils/CubeMapNode.js index 5f57292327c68e..eec93cdd712cf4 100644 --- a/src/nodes/utils/CubeMapNode.js +++ b/src/nodes/utils/CubeMapNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { NodeUpdateType } from '../core/constants.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -112,7 +112,7 @@ class CubeMapNode extends TempNode { export default CubeMapNode; -registerNodeClass( 'CubeMap', CubeMapNode ); +CubeMapNode.type = /*@__PURE__*/ registerNode( 'CubeMap', CubeMapNode ); function isEquirectangularMapReady( image ) { @@ -154,4 +154,4 @@ function mapTextureMapping( texture, mapping ) { } -export const cubeMapNode = nodeProxy( CubeMapNode ); +export const cubeMapNode = /*@__PURE__*/ nodeProxy( CubeMapNode ); diff --git a/src/nodes/utils/EquirectUVNode.js b/src/nodes/utils/EquirectUVNode.js index dc25b379499ee0..b4c4d562856ce6 100644 --- a/src/nodes/utils/EquirectUVNode.js +++ b/src/nodes/utils/EquirectUVNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { positionWorldDirection } from '../accessors/Position.js'; import { nodeProxy, vec2 } from '../tsl/TSLBase.js'; @@ -28,6 +28,6 @@ class EquirectUVNode extends TempNode { export default EquirectUVNode; -registerNodeClass( 'EquirectUV', EquirectUVNode ); +EquirectUVNode.type = /*@__PURE__*/ registerNode( 'EquirectUV', EquirectUVNode ); -export const equirectUV = nodeProxy( EquirectUVNode ); +export const equirectUV = /*@__PURE__*/ nodeProxy( EquirectUVNode ); diff --git a/src/nodes/utils/FlipNode.js b/src/nodes/utils/FlipNode.js index 13d24e27fbc089..356622b04838d2 100644 --- a/src/nodes/utils/FlipNode.js +++ b/src/nodes/utils/FlipNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { vectorComponents } from '../core/constants.js'; @@ -62,4 +62,4 @@ class FlipNode extends TempNode { export default FlipNode; -registerNodeClass( 'Flip', FlipNode ); +FlipNode.type = /*@__PURE__*/ registerNode( 'Flip', FlipNode ); diff --git a/src/nodes/utils/FunctionOverloadingNode.js b/src/nodes/utils/FunctionOverloadingNode.js index 2fbb61a01fdc8e..9b48e107d138a0 100644 --- a/src/nodes/utils/FunctionOverloadingNode.js +++ b/src/nodes/utils/FunctionOverloadingNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { nodeProxy } from '../tsl/TSLBase.js'; class FunctionOverloadingNode extends Node { @@ -90,8 +90,8 @@ class FunctionOverloadingNode extends Node { export default FunctionOverloadingNode; -registerNodeClass( 'FunctionOverloading', FunctionOverloadingNode ); +FunctionOverloadingNode.type = /*@__PURE__*/ registerNode( 'FunctionOverloading', FunctionOverloadingNode ); -const overloadingBaseFn = nodeProxy( FunctionOverloadingNode ); +const overloadingBaseFn = /*@__PURE__*/ nodeProxy( FunctionOverloadingNode ); export const overloadingFn = ( functionNodes ) => ( ...params ) => overloadingBaseFn( functionNodes, ...params ); diff --git a/src/nodes/utils/JoinNode.js b/src/nodes/utils/JoinNode.js index dde24bc0125ef3..d369fb274eca20 100644 --- a/src/nodes/utils/JoinNode.js +++ b/src/nodes/utils/JoinNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; class JoinNode extends TempNode { @@ -58,4 +58,4 @@ class JoinNode extends TempNode { export default JoinNode; -registerNodeClass( 'Join', JoinNode ); +JoinNode.type = /*@__PURE__*/ registerNode( 'Join', JoinNode ); diff --git a/src/nodes/utils/LoopNode.js b/src/nodes/utils/LoopNode.js index f6af56026dec44..96948cb297ca4e 100644 --- a/src/nodes/utils/LoopNode.js +++ b/src/nodes/utils/LoopNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { expression } from '../code/ExpressionNode.js'; import { nodeObject, nodeArray } from '../tsl/TSLBase.js'; @@ -191,7 +191,7 @@ class LoopNode extends Node { export default LoopNode; -registerNodeClass( 'Loop', LoopNode ); +LoopNode.type = /*@__PURE__*/ registerNode( 'Loop', LoopNode ); export const Loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).append(); export const Continue = () => expression( 'continue' ).append(); diff --git a/src/nodes/utils/MatcapUVNode.js b/src/nodes/utils/MatcapUVNode.js index 1b905c3b22c91e..6b68c73224ec34 100644 --- a/src/nodes/utils/MatcapUVNode.js +++ b/src/nodes/utils/MatcapUVNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { transformedNormalView } from '../accessors/Normal.js'; import { positionViewDirection } from '../accessors/Position.js'; @@ -25,6 +25,6 @@ class MatcapUVNode extends TempNode { export default MatcapUVNode; -registerNodeClass( 'MatcapUV', MatcapUVNode ); +MatcapUVNode.type = /*@__PURE__*/ registerNode( 'MatcapUV', MatcapUVNode ); -export const matcapUV = nodeImmutable( MatcapUVNode ); +export const matcapUV = /*@__PURE__*/ nodeImmutable( MatcapUVNode ); diff --git a/src/nodes/utils/MaxMipLevelNode.js b/src/nodes/utils/MaxMipLevelNode.js index 950512dc3de3f1..adb6bc72ccdaad 100644 --- a/src/nodes/utils/MaxMipLevelNode.js +++ b/src/nodes/utils/MaxMipLevelNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import UniformNode from '../core/UniformNode.js'; import { NodeUpdateType } from '../core/constants.js'; import { nodeProxy } from '../tsl/TSLBase.js'; @@ -47,6 +47,6 @@ class MaxMipLevelNode extends UniformNode { export default MaxMipLevelNode; -registerNodeClass( 'MaxMipLevel', MaxMipLevelNode ); +MaxMipLevelNode.type = /*@__PURE__*/ registerNode( 'MaxMipLevel', MaxMipLevelNode ); -export const maxMipLevel = nodeProxy( MaxMipLevelNode ); +export const maxMipLevel = /*@__PURE__*/ nodeProxy( MaxMipLevelNode ); diff --git a/src/nodes/utils/OscNode.js b/src/nodes/utils/OscNode.js index 5852878a3c7953..1fb69c8f90440b 100644 --- a/src/nodes/utils/OscNode.js +++ b/src/nodes/utils/OscNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { timerLocal } from './TimerNode.js'; import { nodeObject, nodeProxy } from '../tsl/TSLBase.js'; @@ -73,9 +73,9 @@ OscNode.SAWTOOTH = 'sawtooth'; export default OscNode; -registerNodeClass( 'Osc', OscNode ); +OscNode.type = /*@__PURE__*/ registerNode( 'Osc', OscNode ); -export const oscSine = nodeProxy( OscNode, OscNode.SINE ); -export const oscSquare = nodeProxy( OscNode, OscNode.SQUARE ); -export const oscTriangle = nodeProxy( OscNode, OscNode.TRIANGLE ); -export const oscSawtooth = nodeProxy( OscNode, OscNode.SAWTOOTH ); +export const oscSine = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SINE ); +export const oscSquare = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SQUARE ); +export const oscTriangle = /*@__PURE__*/ nodeProxy( OscNode, OscNode.TRIANGLE ); +export const oscSawtooth = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SAWTOOTH ); diff --git a/src/nodes/utils/RTTNode.js b/src/nodes/utils/RTTNode.js index 5e4646b481efdb..a81b0cc0d272ea 100644 --- a/src/nodes/utils/RTTNode.js +++ b/src/nodes/utils/RTTNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import { nodeObject } from '../tsl/TSLCore.js'; import TextureNode from '../accessors/TextureNode.js'; import { NodeUpdateType } from '../core/constants.js'; @@ -124,7 +124,7 @@ class RTTNode extends TextureNode { export default RTTNode; -registerNodeClass( 'RTT', RTTNode ); +RTTNode.type = /*@__PURE__*/ registerNode( 'RTT', RTTNode ); export const rtt = ( node, ...params ) => nodeObject( new RTTNode( nodeObject( node ), ...params ) ); export const convertToTexture = ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params ); diff --git a/src/nodes/utils/ReflectorNode.js b/src/nodes/utils/ReflectorNode.js index e390ac84b292f8..62f7b61c43c1e9 100644 --- a/src/nodes/utils/ReflectorNode.js +++ b/src/nodes/utils/ReflectorNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TextureNode from '../accessors/TextureNode.js'; import { nodeObject } from '../tsl/TSLBase.js'; import { NodeUpdateType } from '../core/constants.js'; @@ -237,4 +237,4 @@ export const reflector = ( parameters ) => nodeObject( new ReflectorNode( parame export default ReflectorNode; -registerNodeClass( 'Reflector', ReflectorNode ); +ReflectorNode.type = /*@__PURE__*/ registerNode( 'Reflector', ReflectorNode ); diff --git a/src/nodes/utils/RemapNode.js b/src/nodes/utils/RemapNode.js index 99f586902287fd..25f7faf91b23ba 100644 --- a/src/nodes/utils/RemapNode.js +++ b/src/nodes/utils/RemapNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { float, addMethodChaining, nodeProxy } from '../tsl/TSLCore.js'; class RemapNode extends Node { @@ -33,10 +33,10 @@ class RemapNode extends Node { export default RemapNode; -registerNodeClass( 'Remap', RemapNode ); +RemapNode.type = /*@__PURE__*/ registerNode( 'Remap', RemapNode ); -export const remap = nodeProxy( RemapNode, null, null, { doClamp: false } ); -export const remapClamp = nodeProxy( RemapNode ); +export const remap = /*@__PURE__*/ nodeProxy( RemapNode, null, null, { doClamp: false } ); +export const remapClamp = /*@__PURE__*/ nodeProxy( RemapNode ); addMethodChaining( 'remap', remap ); addMethodChaining( 'remapClamp', remapClamp ); diff --git a/src/nodes/utils/RotateNode.js b/src/nodes/utils/RotateNode.js index 907369fcf37d31..77f04df8317e0c 100644 --- a/src/nodes/utils/RotateNode.js +++ b/src/nodes/utils/RotateNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { nodeProxy, vec4, mat2, mat4 } from '../tsl/TSLBase.js'; import { cos, sin } from '../math/MathNode.js'; @@ -55,6 +55,6 @@ class RotateNode extends TempNode { export default RotateNode; -registerNodeClass( 'Rotate', RotateNode ); +RotateNode.type = /*@__PURE__*/ registerNode( 'Rotate', RotateNode ); -export const rotate = nodeProxy( RotateNode ); +export const rotate = /*@__PURE__*/ nodeProxy( RotateNode ); diff --git a/src/nodes/utils/SetNode.js b/src/nodes/utils/SetNode.js index 4a84110f961679..47a45fa608f4d4 100644 --- a/src/nodes/utils/SetNode.js +++ b/src/nodes/utils/SetNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import TempNode from '../core/TempNode.js'; import { vectorComponents } from '../core/constants.js'; @@ -59,4 +59,4 @@ class SetNode extends TempNode { export default SetNode; -registerNodeClass( 'Set', SetNode ); +SetNode.type = /*@__PURE__*/ registerNode( 'Set', SetNode ); diff --git a/src/nodes/utils/SplitNode.js b/src/nodes/utils/SplitNode.js index c34bd838b9ad31..8be34225427f65 100644 --- a/src/nodes/utils/SplitNode.js +++ b/src/nodes/utils/SplitNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { vectorComponents } from '../core/constants.js'; const stringVectorComponents = vectorComponents.join( '' ); @@ -109,4 +109,4 @@ class SplitNode extends Node { export default SplitNode; -registerNodeClass( 'Split', SplitNode ); +SplitNode.type = /*@__PURE__*/ registerNode( 'Split', SplitNode ); diff --git a/src/nodes/utils/SpriteSheetUVNode.js b/src/nodes/utils/SpriteSheetUVNode.js index 59335bf3ec8e60..86f64685b86296 100644 --- a/src/nodes/utils/SpriteSheetUVNode.js +++ b/src/nodes/utils/SpriteSheetUVNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { uv } from '../accessors/UV.js'; import { nodeProxy, float, vec2 } from '../tsl/TSLBase.js'; @@ -36,6 +36,6 @@ class SpriteSheetUVNode extends Node { export default SpriteSheetUVNode; -registerNodeClass( 'SpriteSheetUV', SpriteSheetUVNode ); +SpriteSheetUVNode.type = /*@__PURE__*/ registerNode( 'SpriteSheetUV', SpriteSheetUVNode ); -export const spritesheetUV = nodeProxy( SpriteSheetUVNode ); +export const spritesheetUV = /*@__PURE__*/ nodeProxy( SpriteSheetUVNode ); diff --git a/src/nodes/utils/SpriteUtils.js b/src/nodes/utils/SpriteUtils.js index 12f365663b66b0..b7cf2013e9a478 100644 --- a/src/nodes/utils/SpriteUtils.js +++ b/src/nodes/utils/SpriteUtils.js @@ -3,7 +3,7 @@ import { cameraViewMatrix, cameraProjectionMatrix } from '../accessors/Camera.js import { positionLocal } from '../accessors/Position.js'; import { Fn, defined } from '../tsl/TSLBase.js'; -export const billboarding = Fn( ( { position = null, horizontal = true, vertical = false } ) => { +export const billboarding = /*@__PURE__*/ Fn( ( { position = null, horizontal = true, vertical = false } ) => { let worldMatrix; diff --git a/src/nodes/utils/StorageArrayElementNode.js b/src/nodes/utils/StorageArrayElementNode.js index 6da309693460df..30f3c146dcd426 100644 --- a/src/nodes/utils/StorageArrayElementNode.js +++ b/src/nodes/utils/StorageArrayElementNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import { nodeProxy } from '../tsl/TSLBase.js'; import ArrayElementNode from './ArrayElementNode.js'; @@ -84,6 +84,6 @@ class StorageArrayElementNode extends ArrayElementNode { export default StorageArrayElementNode; -registerNodeClass( 'StorageArrayElement', StorageArrayElementNode ); +StorageArrayElementNode.type = /*@__PURE__*/ registerNode( 'StorageArrayElement', StorageArrayElementNode ); -export const storageElement = nodeProxy( StorageArrayElementNode ); +export const storageElement = /*@__PURE__*/ nodeProxy( StorageArrayElementNode ); diff --git a/src/nodes/utils/TimerNode.js b/src/nodes/utils/TimerNode.js index 32fcc05a348a29..73da66d8205e00 100644 --- a/src/nodes/utils/TimerNode.js +++ b/src/nodes/utils/TimerNode.js @@ -1,4 +1,4 @@ -import { registerNodeClass } from '../core/Node.js'; +import { registerNode } from '../core/Node.js'; import UniformNode from '../core/UniformNode.js'; import { NodeUpdateType } from '../core/constants.js'; import { nodeObject, nodeImmutable } from '../tsl/TSLBase.js'; @@ -85,10 +85,10 @@ TimerNode.FRAME = 'frame'; export default TimerNode; -registerNodeClass( 'Timer', TimerNode ); +TimerNode.type = /*@__PURE__*/ registerNode( 'Timer', TimerNode ); // @TODO: add support to use node in timeScale export const timerLocal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.LOCAL, timeScale, value ) ); export const timerGlobal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.GLOBAL, timeScale, value ) ); export const timerDelta = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.DELTA, timeScale, value ) ); -export const frameId = nodeImmutable( TimerNode, TimerNode.FRAME ).toUint(); +export const frameId = /*@__PURE__*/ nodeImmutable( TimerNode, TimerNode.FRAME ).toUint(); diff --git a/src/nodes/utils/TriplanarTexturesNode.js b/src/nodes/utils/TriplanarTexturesNode.js index d3b89bec652876..f5d7fc1c693c38 100644 --- a/src/nodes/utils/TriplanarTexturesNode.js +++ b/src/nodes/utils/TriplanarTexturesNode.js @@ -1,4 +1,4 @@ -import Node, { registerNodeClass } from '../core/Node.js'; +import Node, { registerNode } from '../core/Node.js'; import { add } from '../math/OperatorNode.js'; import { normalLocal } from '../accessors/Normal.js'; import { positionLocal } from '../accessors/Position.js'; @@ -54,7 +54,7 @@ class TriplanarTexturesNode extends Node { export default TriplanarTexturesNode; -registerNodeClass( 'TriplanarTextures', TriplanarTexturesNode ); +TriplanarTexturesNode.type = /*@__PURE__*/ registerNode( 'TriplanarTextures', TriplanarTexturesNode ); -export const triplanarTextures = nodeProxy( TriplanarTexturesNode ); +export const triplanarTextures = /*@__PURE__*/ nodeProxy( TriplanarTexturesNode ); export const triplanarTexture = ( ...params ) => triplanarTextures( ...params ); diff --git a/src/nodes/utils/UVUtils.js b/src/nodes/utils/UVUtils.js index 1c0cf3dd604bf7..b74e034a5ac083 100644 --- a/src/nodes/utils/UVUtils.js +++ b/src/nodes/utils/UVUtils.js @@ -1,13 +1,13 @@ import { Fn, vec2 } from '../tsl/TSLBase.js'; import { rotate } from './RotateNode.js'; -export const rotateUV = Fn( ( [ uv, rotation, center = vec2( 0.5 ) ] ) => { +export const rotateUV = /*@__PURE__*/ Fn( ( [ uv, rotation, center = vec2( 0.5 ) ] ) => { return rotate( uv.sub( center ), rotation ).add( center ); } ); -export const spherizeUV = Fn( ( [ uv, strength, center = vec2( 0.5 ) ] ) => { +export const spherizeUV = /*@__PURE__*/ Fn( ( [ uv, strength, center = vec2( 0.5 ) ] ) => { const delta = uv.sub( center ); const delta2 = delta.dot( delta ); diff --git a/src/nodes/utils/ViewportUtils.js b/src/nodes/utils/ViewportUtils.js index 3e22632c55d01a..97fdd7310c6f0e 100644 --- a/src/nodes/utils/ViewportUtils.js +++ b/src/nodes/utils/ViewportUtils.js @@ -3,7 +3,7 @@ import { viewportUV } from '../display/ViewportNode.js'; import { viewportDepthTexture } from '../display/ViewportDepthTextureNode.js'; import { linearDepth } from '../display/ViewportDepthNode.js'; -export const viewportSafeUV = Fn( ( [ uv = null ] ) => { +export const viewportSafeUV = /*@__PURE__*/ Fn( ( [ uv = null ] ) => { const depth = linearDepth(); const depthDiff = linearDepth( viewportDepthTexture( uv ) ).sub( depth ); diff --git a/src/renderers/common/nodes/StandardNodeLibrary.js b/src/renderers/common/nodes/StandardNodeLibrary.js index ad6a4ecb5c6ce9..5bfbe4f12a310e 100644 --- a/src/renderers/common/nodes/StandardNodeLibrary.js +++ b/src/renderers/common/nodes/StandardNodeLibrary.js @@ -95,8 +95,8 @@ class StandardNodeLibrary extends NodeLibrary { this.addToneMapping( TMF.AgXToneMapping, AgXToneMapping ); this.addToneMapping( TMF.NeutralToneMapping, NeutralToneMapping ); - this.addColorSpace( CSF.LinearTosRGBShader, getColorSpaceMethod( LinearSRGBColorSpace, SRGBColorSpace ) ); - this.addColorSpace( CSF.sRGBToLinearShader, getColorSpaceMethod( SRGBColorSpace, LinearSRGBColorSpace ) ); + this.addColorSpace( CSF.LinearTosRGB, getColorSpaceMethod( LinearSRGBColorSpace, SRGBColorSpace ) ); + this.addColorSpace( CSF.sRGBToLinear, getColorSpaceMethod( SRGBColorSpace, LinearSRGBColorSpace ) ); }