@plastic-software/three 0.180.0 → 0.181.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +943 -486
- package/build/three.core.js +506 -327
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +435 -163
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +8 -2
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3753 -1177
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3752 -1176
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/animation/CCDIKSolver.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +1 -1
- package/examples/jsm/controls/DragControls.js +1 -1
- package/examples/jsm/controls/FirstPersonControls.js +1 -1
- package/examples/jsm/controls/FlyControls.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +2 -2
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +3 -3
- package/examples/jsm/exporters/USDZExporter.js +9 -2
- package/examples/jsm/geometries/DecalGeometry.js +2 -2
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +3 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/ViewHelper.js +43 -5
- package/examples/jsm/inspector/Inspector.js +427 -0
- package/examples/jsm/inspector/RendererInspector.js +415 -0
- package/examples/jsm/inspector/tabs/Console.js +204 -0
- package/examples/jsm/inspector/tabs/Parameters.js +332 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +170 -0
- package/examples/jsm/inspector/ui/Style.js +654 -0
- package/examples/jsm/inspector/ui/Tab.js +46 -0
- package/examples/jsm/inspector/ui/Values.js +423 -0
- package/examples/jsm/inspector/ui/utils.js +56 -0
- package/examples/jsm/interactive/HTMLMesh.js +6 -10
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/jsm/interactive/SelectionBox.js +30 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +2 -2
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GLTFLoader.js +5 -3
- package/examples/jsm/loaders/KTX2Loader.js +28 -21
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +22 -5
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/math/SimplexNoise.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
- package/examples/jsm/misc/TubePainter.js +383 -40
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/SkyMesh.js +1 -1
- package/examples/jsm/objects/Water.js +3 -3
- package/examples/jsm/objects/WaterMesh.js +6 -6
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
- package/examples/jsm/renderers/SVGRenderer.js +1 -1
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/examples/jsm/shaders/AfterimageShader.js +1 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -1
- package/examples/jsm/shaders/BokehShader.js +1 -1
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/DotScreenShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +1 -1
- package/examples/jsm/shaders/GTAOShader.js +2 -2
- package/examples/jsm/shaders/GodRaysShader.js +1 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SepiaShader.js +1 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +7 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
- package/examples/jsm/tsl/display/AnamorphicNode.js +2 -1
- package/examples/jsm/tsl/display/BloomNode.js +4 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +7 -0
- package/examples/jsm/tsl/display/GTAONode.js +45 -5
- package/examples/jsm/tsl/display/GaussianBlurNode.js +5 -3
- package/examples/jsm/tsl/display/OutlineNode.js +11 -0
- package/examples/jsm/tsl/display/SSGINode.js +654 -0
- package/examples/jsm/tsl/display/SSRNode.js +2 -0
- package/examples/jsm/tsl/display/SSSNode.js +488 -0
- package/examples/jsm/tsl/display/TRAANode.js +123 -6
- package/examples/jsm/tsl/display/boxBlur.js +1 -0
- package/examples/jsm/tsl/display/hashBlur.js +1 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
- package/package.json +5 -10
- package/src/Three.Core.js +3 -2
- package/src/Three.TSL.js +7 -1
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +2 -0
- package/src/animation/AnimationClip.js +3 -2
- package/src/animation/AnimationMixer.js +3 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/KeyframeTrack.js +7 -6
- package/src/animation/PropertyBinding.js +12 -11
- package/src/audio/Audio.js +10 -9
- package/src/audio/PositionalAudio.js +1 -1
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +8 -8
- package/src/core/EventDispatcher.js +1 -1
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +3 -2
- package/src/core/Object3D.js +3 -2
- package/src/core/Raycaster.js +2 -1
- package/src/core/RenderTarget.js +10 -1
- package/src/extras/Controls.js +5 -4
- package/src/extras/DataUtils.js +2 -1
- package/src/extras/Earcut.js +6 -0
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +268 -55
- package/src/extras/core/Curve.js +2 -1
- package/src/extras/core/Interpolations.js +7 -1
- package/src/extras/core/ShapePath.js +4 -4
- package/src/extras/lib/earcut.js +7 -7
- package/src/geometries/BoxGeometry.js +1 -0
- package/src/geometries/CapsuleGeometry.js +1 -0
- package/src/geometries/CircleGeometry.js +1 -0
- package/src/geometries/ConeGeometry.js +1 -0
- package/src/geometries/CylinderGeometry.js +1 -0
- package/src/geometries/DodecahedronGeometry.js +1 -0
- package/src/geometries/ExtrudeGeometry.js +8 -6
- package/src/geometries/IcosahedronGeometry.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -0
- package/src/geometries/OctahedronGeometry.js +1 -0
- package/src/geometries/PlaneGeometry.js +1 -0
- package/src/geometries/RingGeometry.js +1 -0
- package/src/geometries/ShapeGeometry.js +1 -0
- package/src/geometries/SphereGeometry.js +1 -0
- package/src/geometries/TetrahedronGeometry.js +1 -0
- package/src/geometries/TorusGeometry.js +1 -0
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +2 -1
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +2 -2
- package/src/loaders/DataTextureLoader.js +1 -1
- package/src/loaders/FileLoader.js +3 -2
- package/src/loaders/ImageBitmapLoader.js +5 -4
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/Loader.js +3 -3
- package/src/loaders/LoadingManager.js +25 -3
- package/src/loaders/MaterialLoader.js +3 -2
- package/src/loaders/ObjectLoader.js +13 -13
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +3 -2
- package/src/materials/Material.js +4 -3
- package/src/materials/MeshBasicMaterial.js +1 -0
- package/src/materials/MeshDepthMaterial.js +1 -0
- package/src/materials/MeshLambertMaterial.js +2 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +2 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +1 -0
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +2 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/NodeMaterial.js +62 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +2 -1
- package/src/math/Color.js +6 -5
- package/src/math/ColorManagement.js +2 -2
- package/src/math/Cylindrical.js +1 -1
- package/src/math/Euler.js +2 -1
- package/src/math/MathUtils.js +13 -11
- package/src/math/Matrix2.js +1 -1
- package/src/math/Matrix3.js +2 -2
- package/src/math/Matrix4.js +7 -7
- package/src/math/Plane.js +1 -1
- package/src/math/Quaternion.js +68 -66
- package/src/math/Spherical.js +1 -1
- package/src/nodes/Nodes.js +1 -1
- package/src/nodes/TSL.js +1 -1
- package/src/nodes/accessors/CubeTextureNode.js +3 -2
- package/src/nodes/accessors/InstanceNode.js +22 -4
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/Normal.js +5 -4
- package/src/nodes/accessors/Position.js +18 -2
- package/src/nodes/accessors/ReferenceNode.js +2 -1
- package/src/nodes/accessors/SceneNode.js +2 -1
- package/src/nodes/accessors/StorageBufferNode.js +2 -1
- package/src/nodes/accessors/StorageTextureNode.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +61 -27
- package/src/nodes/code/FunctionCallNode.js +5 -4
- package/src/nodes/core/ArrayNode.js +1 -0
- package/src/nodes/core/AttributeNode.js +2 -1
- package/src/nodes/core/ContextNode.js +5 -10
- package/src/nodes/core/IndexNode.js +2 -2
- package/src/nodes/core/InputNode.js +2 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +40 -7
- package/src/nodes/core/Node.js +137 -12
- package/src/nodes/core/NodeBuilder.js +135 -21
- package/src/nodes/core/NodeFrame.js +20 -20
- package/src/nodes/core/NodeFunction.js +2 -1
- package/src/nodes/core/NodeParser.js +2 -1
- package/src/nodes/core/NodeUtils.js +17 -90
- package/src/nodes/core/ParameterNode.js +31 -0
- package/src/nodes/core/PropertyNode.js +7 -0
- package/src/nodes/core/StackNode.js +16 -14
- package/src/nodes/core/UniformNode.js +2 -1
- package/src/nodes/core/VarNode.js +70 -12
- package/src/nodes/core/VaryingNode.js +3 -2
- package/src/nodes/display/BlendModes.js +5 -4
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +1 -1
- package/src/nodes/display/NormalMapNode.js +2 -1
- package/src/nodes/display/PassNode.js +51 -10
- package/src/nodes/display/RenderOutputNode.js +28 -2
- package/src/nodes/display/ScreenNode.js +2 -1
- package/src/nodes/display/ToneMappingNode.js +31 -4
- package/src/nodes/display/ToonOutlinePassNode.js +8 -0
- package/src/nodes/fog/Fog.js +3 -2
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhysicalLightingModel.js +3 -2
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/geometry/RangeNode.js +40 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
- package/src/nodes/gpgpu/ComputeNode.js +17 -5
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +25 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
- package/src/nodes/lighting/EnvironmentNode.js +6 -6
- package/src/nodes/lighting/LightsNode.js +2 -3
- package/src/nodes/lighting/PointShadowNode.js +6 -0
- package/src/nodes/lighting/ShadowFilterNode.js +2 -0
- package/src/nodes/lighting/ShadowNode.js +75 -8
- package/src/nodes/math/ConditionalNode.js +6 -5
- package/src/nodes/math/MathNode.js +22 -4
- package/src/nodes/math/OperatorNode.js +3 -2
- package/src/nodes/pmrem/PMREMUtils.js +117 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +5 -2
- package/src/nodes/tsl/TSLCore.js +36 -15
- package/src/nodes/utils/DebugNode.js +2 -1
- package/src/nodes/utils/EventNode.js +36 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +3 -2
- package/src/nodes/utils/LoopNode.js +20 -24
- package/src/nodes/utils/MemberNode.js +2 -1
- package/src/nodes/utils/PostProcessingUtils.js +28 -1
- package/src/nodes/utils/RTTNode.js +12 -2
- package/src/nodes/utils/ReflectorNode.js +10 -3
- package/src/objects/Line.js +2 -1
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Skeleton.js +3 -2
- package/src/objects/SkinnedMesh.js +3 -1
- package/src/objects/Sprite.js +2 -1
- package/src/renderers/WebGLRenderer.js +48 -32
- package/src/renderers/common/Animation.js +13 -1
- package/src/renderers/common/Backend.js +93 -30
- package/src/renderers/common/Background.js +2 -1
- package/src/renderers/common/Bindings.js +56 -2
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/Geometries.js +26 -0
- package/src/renderers/common/Info.js +4 -2
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/PostProcessing.js +6 -25
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderObject.js +3 -1
- package/src/renderers/common/RenderObjects.js +1 -1
- package/src/renderers/common/Renderer.js +436 -228
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +8 -0
- package/src/renderers/common/Sampler.js +37 -11
- package/src/renderers/common/StorageTexture.js +9 -1
- package/src/renderers/common/Textures.js +89 -35
- package/src/renderers/common/TimestampQueryPool.js +63 -1
- package/src/renderers/common/UniformsGroup.js +2 -1
- package/src/renderers/common/XRManager.js +7 -3
- package/src/renderers/common/extras/PMREMGenerator.js +160 -65
- package/src/renderers/common/nodes/NodeLibrary.js +4 -2
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/Nodes.js +38 -16
- package/src/renderers/shaders/DFGLUTData.js +64 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
- package/src/renderers/shaders/UniformsLib.js +1 -0
- package/src/renderers/shaders/UniformsUtils.js +25 -4
- package/src/renderers/webgl/WebGLCapabilities.js +2 -1
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +11 -10
- package/src/renderers/webgl/WebGLPrograms.js +2 -1
- package/src/renderers/webgl/WebGLShadowMap.js +2 -1
- package/src/renderers/webgl/WebGLState.js +15 -14
- package/src/renderers/webgl/WebGLTextures.js +18 -14
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +22 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +74 -11
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +6 -5
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +117 -16
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +42 -12
- package/src/renderers/webgpu/WebGPUBackend.js +134 -108
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +3 -2
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +21 -19
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +5 -3
- package/src/renderers/webgpu/utils/WebGPUConstants.js +5 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +44 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +146 -74
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +29 -6
- package/src/renderers/webgpu/utils/WebGPUUtils.js +22 -2
- package/src/renderers/webxr/WebXRManager.js +3 -2
- package/src/textures/Source.js +2 -1
- package/src/textures/Texture.js +3 -2
- package/src/textures/VideoTexture.js +2 -0
- package/src/utils.js +67 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Node from './Node.js';
|
|
2
2
|
import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js';
|
|
3
|
+
import { warn } from '../../utils.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* This node can be used as a cache management component for another node.
|
|
@@ -8,11 +9,11 @@ import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js';
|
|
|
8
9
|
*
|
|
9
10
|
* @augments Node
|
|
10
11
|
*/
|
|
11
|
-
class
|
|
12
|
+
class IsolateNode extends Node {
|
|
12
13
|
|
|
13
14
|
static get type() {
|
|
14
15
|
|
|
15
|
-
return '
|
|
16
|
+
return 'IsolateNode';
|
|
16
17
|
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -48,7 +49,7 @@ class CacheNode extends Node {
|
|
|
48
49
|
* @readonly
|
|
49
50
|
* @default true
|
|
50
51
|
*/
|
|
51
|
-
this.
|
|
52
|
+
this.isIsolateNode = true;
|
|
52
53
|
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -82,19 +83,51 @@ class CacheNode extends Node {
|
|
|
82
83
|
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
setParent( parent ) {
|
|
87
|
+
|
|
88
|
+
this.parent = parent;
|
|
89
|
+
|
|
90
|
+
return this;
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getParent() {
|
|
95
|
+
|
|
96
|
+
return this.parent;
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
85
100
|
}
|
|
86
101
|
|
|
87
|
-
export default
|
|
102
|
+
export default IsolateNode;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* TSL function for creating a cache node.
|
|
106
|
+
*
|
|
107
|
+
* @tsl
|
|
108
|
+
* @function
|
|
109
|
+
* @param {Node} node - The node that should be cached.
|
|
110
|
+
* @returns {IsolateNode}
|
|
111
|
+
*/
|
|
112
|
+
export const isolate = ( node ) => new IsolateNode( nodeObject( node ) );
|
|
88
113
|
|
|
89
114
|
/**
|
|
90
115
|
* TSL function for creating a cache node.
|
|
91
116
|
*
|
|
92
117
|
* @tsl
|
|
93
118
|
* @function
|
|
119
|
+
* @deprecated
|
|
94
120
|
* @param {Node} node - The node that should be cached.
|
|
95
|
-
* @param {boolean} [parent] - Whether this node refers to a shared parent cache or not.
|
|
96
|
-
* @returns {
|
|
121
|
+
* @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not.
|
|
122
|
+
* @returns {IsolateNode}
|
|
97
123
|
*/
|
|
98
|
-
export
|
|
124
|
+
export function cache( node, parent = true ) {
|
|
125
|
+
|
|
126
|
+
warn( 'TSL: "cache()" has been deprecated. Use "isolate()" instead.' ); // @deprecated r181
|
|
127
|
+
|
|
128
|
+
return isolate( node ).setParent( parent );
|
|
129
|
+
|
|
130
|
+
}
|
|
99
131
|
|
|
100
132
|
addMethodChaining( 'cache', cache );
|
|
133
|
+
addMethodChaining( 'isolate', isolate );
|
package/src/nodes/core/Node.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NodeUpdateType } from './constants.js';
|
|
2
|
-
import {
|
|
2
|
+
import { hash, hashArray, hashString } from './NodeUtils.js';
|
|
3
3
|
|
|
4
4
|
import { EventDispatcher } from '../../core/EventDispatcher.js';
|
|
5
5
|
import { MathUtils } from '../../math/MathUtils.js';
|
|
6
|
+
import { warn, error } from '../../utils.js';
|
|
6
7
|
|
|
7
8
|
const _parentBuildStage = {
|
|
8
9
|
analyze: 'setup',
|
|
@@ -82,6 +83,14 @@ class Node extends EventDispatcher {
|
|
|
82
83
|
*/
|
|
83
84
|
this.version = 0;
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The name of the node.
|
|
88
|
+
*
|
|
89
|
+
* @type {string}
|
|
90
|
+
* @default ''
|
|
91
|
+
*/
|
|
92
|
+
this.name = '';
|
|
93
|
+
|
|
85
94
|
/**
|
|
86
95
|
* Whether this node is global or not. This property is relevant for the internal
|
|
87
96
|
* node caching system. All nodes which should be declared just once should
|
|
@@ -111,6 +120,8 @@ class Node extends EventDispatcher {
|
|
|
111
120
|
|
|
112
121
|
// private
|
|
113
122
|
|
|
123
|
+
this._beforeNodes = null;
|
|
124
|
+
|
|
114
125
|
/**
|
|
115
126
|
* The cache key of this node.
|
|
116
127
|
*
|
|
@@ -266,7 +277,7 @@ class Node extends EventDispatcher {
|
|
|
266
277
|
*/
|
|
267
278
|
* getChildren() {
|
|
268
279
|
|
|
269
|
-
for ( const { childNode } of
|
|
280
|
+
for ( const { childNode } of this._getChildren() ) {
|
|
270
281
|
|
|
271
282
|
yield childNode;
|
|
272
283
|
|
|
@@ -308,19 +319,100 @@ class Node extends EventDispatcher {
|
|
|
308
319
|
|
|
309
320
|
}
|
|
310
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Returns the child nodes of this node.
|
|
324
|
+
*
|
|
325
|
+
* @private
|
|
326
|
+
* @param {Set<Node>} [ignores=new Set()] - A set of nodes to ignore during the search to avoid circular references.
|
|
327
|
+
* @returns {Array<Object>} An array of objects describing the child nodes.
|
|
328
|
+
*/
|
|
329
|
+
_getChildren( ignores = new Set() ) {
|
|
330
|
+
|
|
331
|
+
const children = [];
|
|
332
|
+
|
|
333
|
+
// avoid circular references
|
|
334
|
+
ignores.add( this );
|
|
335
|
+
|
|
336
|
+
for ( const property of Object.getOwnPropertyNames( this ) ) {
|
|
337
|
+
|
|
338
|
+
const object = this[ property ];
|
|
339
|
+
|
|
340
|
+
// Ignore private properties and ignored nodes.
|
|
341
|
+
if ( property.startsWith( '_' ) === true || ignores.has( object ) ) continue;
|
|
342
|
+
|
|
343
|
+
if ( Array.isArray( object ) === true ) {
|
|
344
|
+
|
|
345
|
+
for ( let i = 0; i < object.length; i ++ ) {
|
|
346
|
+
|
|
347
|
+
const child = object[ i ];
|
|
348
|
+
|
|
349
|
+
if ( child && child.isNode === true ) {
|
|
350
|
+
|
|
351
|
+
children.push( { property, index: i, childNode: child } );
|
|
352
|
+
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
} else if ( object && object.isNode === true ) {
|
|
358
|
+
|
|
359
|
+
children.push( { property, childNode: object } );
|
|
360
|
+
|
|
361
|
+
} else if ( object && Object.getPrototypeOf( object ) === Object.prototype ) {
|
|
362
|
+
|
|
363
|
+
for ( const subProperty in object ) {
|
|
364
|
+
|
|
365
|
+
// Ignore private sub-properties.
|
|
366
|
+
if ( subProperty.startsWith( '_' ) === true ) continue;
|
|
367
|
+
|
|
368
|
+
const child = object[ subProperty ];
|
|
369
|
+
|
|
370
|
+
if ( child && child.isNode === true ) {
|
|
371
|
+
|
|
372
|
+
children.push( { property, index: subProperty, childNode: child } );
|
|
373
|
+
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
//
|
|
383
|
+
|
|
384
|
+
return children;
|
|
385
|
+
|
|
386
|
+
}
|
|
387
|
+
|
|
311
388
|
/**
|
|
312
389
|
* Returns the cache key for this node.
|
|
313
390
|
*
|
|
314
391
|
* @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced.
|
|
392
|
+
* @param {Set<Node>} [ignores=null] - A set of nodes to ignore during the computation of the cache key.
|
|
315
393
|
* @return {number} The cache key of the node.
|
|
316
394
|
*/
|
|
317
|
-
getCacheKey( force = false ) {
|
|
395
|
+
getCacheKey( force = false, ignores = null ) {
|
|
318
396
|
|
|
319
397
|
force = force || this.version !== this._cacheKeyVersion;
|
|
320
398
|
|
|
321
399
|
if ( force === true || this._cacheKey === null ) {
|
|
322
400
|
|
|
323
|
-
|
|
401
|
+
if ( ignores === null ) ignores = new Set();
|
|
402
|
+
|
|
403
|
+
//
|
|
404
|
+
|
|
405
|
+
const values = [];
|
|
406
|
+
|
|
407
|
+
for ( const { property, childNode } of this._getChildren( ignores ) ) {
|
|
408
|
+
|
|
409
|
+
values.push( hashString( property.slice( 0, - 4 ) ), childNode.getCacheKey( force, ignores ) );
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
//
|
|
414
|
+
|
|
415
|
+
this._cacheKey = hash( hashArray( values ), this.customCacheKey() );
|
|
324
416
|
this._cacheKeyVersion = this.version;
|
|
325
417
|
|
|
326
418
|
}
|
|
@@ -336,7 +428,7 @@ class Node extends EventDispatcher {
|
|
|
336
428
|
*/
|
|
337
429
|
customCacheKey() {
|
|
338
430
|
|
|
339
|
-
return
|
|
431
|
+
return this.id;
|
|
340
432
|
|
|
341
433
|
}
|
|
342
434
|
|
|
@@ -574,7 +666,7 @@ class Node extends EventDispatcher {
|
|
|
574
666
|
*/
|
|
575
667
|
updateBefore( /*frame*/ ) {
|
|
576
668
|
|
|
577
|
-
|
|
669
|
+
warn( 'Abstract function.' );
|
|
578
670
|
|
|
579
671
|
}
|
|
580
672
|
|
|
@@ -588,7 +680,7 @@ class Node extends EventDispatcher {
|
|
|
588
680
|
*/
|
|
589
681
|
updateAfter( /*frame*/ ) {
|
|
590
682
|
|
|
591
|
-
|
|
683
|
+
warn( 'Abstract function.' );
|
|
592
684
|
|
|
593
685
|
}
|
|
594
686
|
|
|
@@ -602,7 +694,17 @@ class Node extends EventDispatcher {
|
|
|
602
694
|
*/
|
|
603
695
|
update( /*frame*/ ) {
|
|
604
696
|
|
|
605
|
-
|
|
697
|
+
warn( 'Abstract function.' );
|
|
698
|
+
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
before( node ) {
|
|
702
|
+
|
|
703
|
+
if ( this._beforeNodes === null ) this._beforeNodes = [];
|
|
704
|
+
|
|
705
|
+
this._beforeNodes.push( node );
|
|
706
|
+
|
|
707
|
+
return this;
|
|
606
708
|
|
|
607
709
|
}
|
|
608
710
|
|
|
@@ -628,6 +730,24 @@ class Node extends EventDispatcher {
|
|
|
628
730
|
|
|
629
731
|
//
|
|
630
732
|
|
|
733
|
+
if ( this._beforeNodes !== null ) {
|
|
734
|
+
|
|
735
|
+
const currentBeforeNodes = this._beforeNodes;
|
|
736
|
+
|
|
737
|
+
this._beforeNodes = null;
|
|
738
|
+
|
|
739
|
+
for ( const beforeNode of currentBeforeNodes ) {
|
|
740
|
+
|
|
741
|
+
beforeNode.build( builder, output );
|
|
742
|
+
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
this._beforeNodes = currentBeforeNodes;
|
|
746
|
+
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
//
|
|
750
|
+
|
|
631
751
|
const nodeData = builder.getDataFromNode( this );
|
|
632
752
|
nodeData.buildStages = nodeData.buildStages || {};
|
|
633
753
|
nodeData.buildStages[ builder.buildStage ] = true;
|
|
@@ -710,7 +830,12 @@ class Node extends EventDispatcher {
|
|
|
710
830
|
|
|
711
831
|
} else if ( buildStage === 'generate' ) {
|
|
712
832
|
|
|
713
|
-
|
|
833
|
+
// If generate has just one argument, it means the output type is not required.
|
|
834
|
+
// This means that the node does not handle output conversions internally,
|
|
835
|
+
// so the value is stored in a cache and the builder handles the conversion
|
|
836
|
+
// for all requested output types.
|
|
837
|
+
|
|
838
|
+
const isGenerateOnce = this.generate.length < 2;
|
|
714
839
|
|
|
715
840
|
if ( isGenerateOnce ) {
|
|
716
841
|
|
|
@@ -731,7 +856,7 @@ class Node extends EventDispatcher {
|
|
|
731
856
|
|
|
732
857
|
} else {
|
|
733
858
|
|
|
734
|
-
|
|
859
|
+
warn( 'Node: Recursion detected.', this );
|
|
735
860
|
|
|
736
861
|
result = '/* Recursion detected. */';
|
|
737
862
|
|
|
@@ -755,7 +880,7 @@ class Node extends EventDispatcher {
|
|
|
755
880
|
|
|
756
881
|
// if no snippet is generated, return a default value
|
|
757
882
|
|
|
758
|
-
|
|
883
|
+
error( `TSL: Invalid generated code, expected a "${ output }".` );
|
|
759
884
|
|
|
760
885
|
result = builder.generateConst( output );
|
|
761
886
|
|
|
@@ -777,7 +902,7 @@ class Node extends EventDispatcher {
|
|
|
777
902
|
*/
|
|
778
903
|
getSerializeChildren() {
|
|
779
904
|
|
|
780
|
-
return
|
|
905
|
+
return this._getChildren();
|
|
781
906
|
|
|
782
907
|
}
|
|
783
908
|
|
|
@@ -24,13 +24,16 @@ import ChainMap from '../../renderers/common/ChainMap.js';
|
|
|
24
24
|
|
|
25
25
|
import BindGroup from '../../renderers/common/BindGroup.js';
|
|
26
26
|
|
|
27
|
-
import { REVISION, IntType, UnsignedIntType, LinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter } from '../../constants.js';
|
|
27
|
+
import { REVISION, IntType, UnsignedIntType, LinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter, NormalBlending } from '../../constants.js';
|
|
28
28
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
29
29
|
import { Color } from '../../math/Color.js';
|
|
30
30
|
import { Vector2 } from '../../math/Vector2.js';
|
|
31
31
|
import { Vector3 } from '../../math/Vector3.js';
|
|
32
32
|
import { Vector4 } from '../../math/Vector4.js';
|
|
33
33
|
import { Float16BufferAttribute } from '../../core/BufferAttribute.js';
|
|
34
|
+
import { warn, error } from '../../utils.js';
|
|
35
|
+
|
|
36
|
+
let _id = 0;
|
|
34
37
|
|
|
35
38
|
const rendererCache = new WeakMap();
|
|
36
39
|
|
|
@@ -434,13 +437,13 @@ class NodeBuilder {
|
|
|
434
437
|
*/
|
|
435
438
|
this.subBuildLayers = [];
|
|
436
439
|
|
|
440
|
+
|
|
437
441
|
/**
|
|
438
|
-
* The
|
|
442
|
+
* The active stack nodes.
|
|
439
443
|
*
|
|
440
|
-
* @type {
|
|
441
|
-
* @default null
|
|
444
|
+
* @type {Array<StackNode>}
|
|
442
445
|
*/
|
|
443
|
-
this.
|
|
446
|
+
this.activeStacks = [];
|
|
444
447
|
|
|
445
448
|
/**
|
|
446
449
|
* The current sub-build TSL function(Fn).
|
|
@@ -450,6 +453,29 @@ class NodeBuilder {
|
|
|
450
453
|
*/
|
|
451
454
|
this.subBuildFn = null;
|
|
452
455
|
|
|
456
|
+
/**
|
|
457
|
+
* The current TSL function(Fn) call node.
|
|
458
|
+
*
|
|
459
|
+
* @type {?Node}
|
|
460
|
+
* @default null
|
|
461
|
+
*/
|
|
462
|
+
this.fnCall = null;
|
|
463
|
+
|
|
464
|
+
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
465
|
+
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Whether the material is opaque or not.
|
|
470
|
+
*
|
|
471
|
+
* @return {boolean} Whether the material is opaque or not.
|
|
472
|
+
*/
|
|
473
|
+
isOpaque() {
|
|
474
|
+
|
|
475
|
+
const material = this.material;
|
|
476
|
+
|
|
477
|
+
return material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false;
|
|
478
|
+
|
|
453
479
|
}
|
|
454
480
|
|
|
455
481
|
/**
|
|
@@ -792,7 +818,7 @@ class NodeBuilder {
|
|
|
792
818
|
/*
|
|
793
819
|
if ( this.chaining.indexOf( node ) !== - 1 ) {
|
|
794
820
|
|
|
795
|
-
|
|
821
|
+
warn( 'Recursive node: ', node );
|
|
796
822
|
|
|
797
823
|
}
|
|
798
824
|
*/
|
|
@@ -898,6 +924,22 @@ class NodeBuilder {
|
|
|
898
924
|
|
|
899
925
|
}
|
|
900
926
|
|
|
927
|
+
/**
|
|
928
|
+
* Adds context data to the builder's current context.
|
|
929
|
+
*
|
|
930
|
+
* @param {Object} context - The context to add.
|
|
931
|
+
* @return {Object} The previous context.
|
|
932
|
+
*/
|
|
933
|
+
addContext( context ) {
|
|
934
|
+
|
|
935
|
+
const previousContext = this.getContext();
|
|
936
|
+
|
|
937
|
+
this.setContext( { ...this.context, ...context } );
|
|
938
|
+
|
|
939
|
+
return previousContext;
|
|
940
|
+
|
|
941
|
+
}
|
|
942
|
+
|
|
901
943
|
/**
|
|
902
944
|
* Gets a context used in shader construction that can be shared across different materials.
|
|
903
945
|
* This is necessary since the renderer cache can reuse shaders generated in one material and use them in another.
|
|
@@ -973,19 +1015,20 @@ class NodeBuilder {
|
|
|
973
1015
|
*/
|
|
974
1016
|
getVertexIndex() {
|
|
975
1017
|
|
|
976
|
-
|
|
1018
|
+
warn( 'Abstract function.' );
|
|
977
1019
|
|
|
978
1020
|
}
|
|
979
1021
|
|
|
980
1022
|
/**
|
|
981
|
-
*
|
|
1023
|
+
* Contextually returns either the vertex stage instance index builtin
|
|
1024
|
+
* or the linearized index of an compute invocation within a grid of workgroups.
|
|
982
1025
|
*
|
|
983
1026
|
* @abstract
|
|
984
1027
|
* @return {string} The instanceIndex shader string.
|
|
985
1028
|
*/
|
|
986
1029
|
getInstanceIndex() {
|
|
987
1030
|
|
|
988
|
-
|
|
1031
|
+
warn( 'Abstract function.' );
|
|
989
1032
|
|
|
990
1033
|
}
|
|
991
1034
|
|
|
@@ -998,7 +1041,7 @@ class NodeBuilder {
|
|
|
998
1041
|
*/
|
|
999
1042
|
getDrawIndex() {
|
|
1000
1043
|
|
|
1001
|
-
|
|
1044
|
+
warn( 'Abstract function.' );
|
|
1002
1045
|
|
|
1003
1046
|
}
|
|
1004
1047
|
|
|
@@ -1010,7 +1053,7 @@ class NodeBuilder {
|
|
|
1010
1053
|
*/
|
|
1011
1054
|
getFrontFacing() {
|
|
1012
1055
|
|
|
1013
|
-
|
|
1056
|
+
warn( 'Abstract function.' );
|
|
1014
1057
|
|
|
1015
1058
|
}
|
|
1016
1059
|
|
|
@@ -1022,7 +1065,7 @@ class NodeBuilder {
|
|
|
1022
1065
|
*/
|
|
1023
1066
|
getFragCoord() {
|
|
1024
1067
|
|
|
1025
|
-
|
|
1068
|
+
warn( 'Abstract function.' );
|
|
1026
1069
|
|
|
1027
1070
|
}
|
|
1028
1071
|
|
|
@@ -1065,7 +1108,7 @@ class NodeBuilder {
|
|
|
1065
1108
|
*/
|
|
1066
1109
|
generateTexture( /* texture, textureProperty, uvSnippet */ ) {
|
|
1067
1110
|
|
|
1068
|
-
|
|
1111
|
+
warn( 'Abstract function.' );
|
|
1069
1112
|
|
|
1070
1113
|
}
|
|
1071
1114
|
|
|
@@ -1082,7 +1125,7 @@ class NodeBuilder {
|
|
|
1082
1125
|
*/
|
|
1083
1126
|
generateTextureLod( /* texture, textureProperty, uvSnippet, depthSnippet, levelSnippet */ ) {
|
|
1084
1127
|
|
|
1085
|
-
|
|
1128
|
+
warn( 'Abstract function.' );
|
|
1086
1129
|
|
|
1087
1130
|
}
|
|
1088
1131
|
|
|
@@ -1566,6 +1609,58 @@ class NodeBuilder {
|
|
|
1566
1609
|
|
|
1567
1610
|
}
|
|
1568
1611
|
|
|
1612
|
+
/**
|
|
1613
|
+
* Adds an active stack to the internal stack.
|
|
1614
|
+
*
|
|
1615
|
+
* @param {StackNode} stack - The stack node to add.
|
|
1616
|
+
*/
|
|
1617
|
+
setActiveStack( stack ) {
|
|
1618
|
+
|
|
1619
|
+
this.activeStacks.push( stack );
|
|
1620
|
+
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* Removes the active stack from the internal stack.
|
|
1625
|
+
*
|
|
1626
|
+
* @param {StackNode} stack - The stack node to remove.
|
|
1627
|
+
*/
|
|
1628
|
+
removeActiveStack( stack ) {
|
|
1629
|
+
|
|
1630
|
+
if ( this.activeStacks[ this.activeStacks.length - 1 ] === stack ) {
|
|
1631
|
+
|
|
1632
|
+
this.activeStacks.pop();
|
|
1633
|
+
|
|
1634
|
+
} else {
|
|
1635
|
+
|
|
1636
|
+
throw new Error( 'NodeBuilder: Invalid active stack removal.' );
|
|
1637
|
+
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Returns the active stack.
|
|
1644
|
+
*
|
|
1645
|
+
* @return {StackNode} The active stack.
|
|
1646
|
+
*/
|
|
1647
|
+
getActiveStack() {
|
|
1648
|
+
|
|
1649
|
+
return this.activeStacks[ this.activeStacks.length - 1 ];
|
|
1650
|
+
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Returns the base stack.
|
|
1655
|
+
*
|
|
1656
|
+
* @return {StackNode} The base stack.
|
|
1657
|
+
*/
|
|
1658
|
+
getBaseStack() {
|
|
1659
|
+
|
|
1660
|
+
return this.activeStacks[ 0 ];
|
|
1661
|
+
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1569
1664
|
/**
|
|
1570
1665
|
* Adds a stack node to the internal stack.
|
|
1571
1666
|
*
|
|
@@ -1592,6 +1687,14 @@ class NodeBuilder {
|
|
|
1592
1687
|
removeStack() {
|
|
1593
1688
|
|
|
1594
1689
|
const lastStack = this.stack;
|
|
1690
|
+
|
|
1691
|
+
for ( const node of lastStack.nodes ) {
|
|
1692
|
+
|
|
1693
|
+
const nodeData = this.getDataFromNode( node );
|
|
1694
|
+
nodeData.stack = lastStack;
|
|
1695
|
+
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1595
1698
|
this.stack = lastStack.parent;
|
|
1596
1699
|
|
|
1597
1700
|
setCurrentStack( this.stacks.pop() );
|
|
@@ -1648,6 +1751,11 @@ class NodeBuilder {
|
|
|
1648
1751
|
/**
|
|
1649
1752
|
* Returns the properties for the given node and shader stage.
|
|
1650
1753
|
*
|
|
1754
|
+
* Properties are typically used within a build stage to reference a node's
|
|
1755
|
+
* child node or nodes manually assigned to the properties in a separate build stage.
|
|
1756
|
+
* A typical usage pattern for defining nodes manually would be assigning dependency nodes
|
|
1757
|
+
* to the current node's properties in the setup stage and building those properties in the generate stage.
|
|
1758
|
+
*
|
|
1651
1759
|
* @param {Node} node - The node to get the properties for.
|
|
1652
1760
|
* @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage.
|
|
1653
1761
|
* @return {Object} The node properties.
|
|
@@ -1971,7 +2079,7 @@ class NodeBuilder {
|
|
|
1971
2079
|
|
|
1972
2080
|
node.name = name;
|
|
1973
2081
|
|
|
1974
|
-
|
|
2082
|
+
warn( `TSL: Declaration name '${ property }' of '${ node.type }' already in use. Renamed to '${ name }'.` );
|
|
1975
2083
|
|
|
1976
2084
|
}
|
|
1977
2085
|
|
|
@@ -2258,6 +2366,12 @@ class NodeBuilder {
|
|
|
2258
2366
|
/**
|
|
2259
2367
|
* Executes the node in a specific build stage.
|
|
2260
2368
|
*
|
|
2369
|
+
* This function can be used to arbitrarily execute the specified build stage
|
|
2370
|
+
* outside of the standard build process. For instance, if a node's type depends
|
|
2371
|
+
* on properties created by the 'setup' stage, then flowBuildStage(node, 'setup')
|
|
2372
|
+
* can be used to execute the setup build stage and access its generated nodes
|
|
2373
|
+
* before the standard build process begins.
|
|
2374
|
+
*
|
|
2261
2375
|
* @param {Node} node - The node to execute.
|
|
2262
2376
|
* @param {string} buildStage - The build stage to execute the node in.
|
|
2263
2377
|
* @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'.
|
|
@@ -2348,7 +2462,7 @@ class NodeBuilder {
|
|
|
2348
2462
|
*/
|
|
2349
2463
|
buildFunctionCode( /* shaderNode */ ) {
|
|
2350
2464
|
|
|
2351
|
-
|
|
2465
|
+
warn( 'Abstract function.' );
|
|
2352
2466
|
|
|
2353
2467
|
}
|
|
2354
2468
|
|
|
@@ -2457,7 +2571,7 @@ class NodeBuilder {
|
|
|
2457
2571
|
*/
|
|
2458
2572
|
getAttributes( /*shaderStage*/ ) {
|
|
2459
2573
|
|
|
2460
|
-
|
|
2574
|
+
warn( 'Abstract function.' );
|
|
2461
2575
|
|
|
2462
2576
|
}
|
|
2463
2577
|
|
|
@@ -2470,7 +2584,7 @@ class NodeBuilder {
|
|
|
2470
2584
|
*/
|
|
2471
2585
|
getVaryings( /*shaderStage*/ ) {
|
|
2472
2586
|
|
|
2473
|
-
|
|
2587
|
+
warn( 'Abstract function.' );
|
|
2474
2588
|
|
|
2475
2589
|
}
|
|
2476
2590
|
|
|
@@ -2523,7 +2637,7 @@ class NodeBuilder {
|
|
|
2523
2637
|
*/
|
|
2524
2638
|
getUniforms( /*shaderStage*/ ) {
|
|
2525
2639
|
|
|
2526
|
-
|
|
2640
|
+
warn( 'Abstract function.' );
|
|
2527
2641
|
|
|
2528
2642
|
}
|
|
2529
2643
|
|
|
@@ -2615,7 +2729,7 @@ class NodeBuilder {
|
|
|
2615
2729
|
*/
|
|
2616
2730
|
buildCode() {
|
|
2617
2731
|
|
|
2618
|
-
|
|
2732
|
+
warn( 'Abstract function.' );
|
|
2619
2733
|
|
|
2620
2734
|
}
|
|
2621
2735
|
|
|
@@ -2773,7 +2887,7 @@ class NodeBuilder {
|
|
|
2773
2887
|
|
|
2774
2888
|
if ( nodeMaterial === null ) {
|
|
2775
2889
|
|
|
2776
|
-
|
|
2890
|
+
error( `NodeMaterial: Material "${ material.type }" is not compatible.` );
|
|
2777
2891
|
|
|
2778
2892
|
nodeMaterial = new NodeMaterial();
|
|
2779
2893
|
|