super-three 0.167.0 → 0.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +532 -173
- package/build/three.module.js +532 -174
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +18173 -14266
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -4
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +27 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +40 -14
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +21 -1
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +2 -1
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +3 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +7 -0
- package/src/Three.js +1 -0
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +32 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +25 -5
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +21 -18
- package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +19 -0
- package/src/materials/Material.js +4 -7
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +56 -59
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +12 -10
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +16 -12
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +10 -6
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshNormalNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +14 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +22 -18
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +22 -12
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +71 -115
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +3 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +47 -14
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +24 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +53 -21
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +8 -5
- package/src/nodes/accessors/BufferNode.js +7 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/src/nodes/accessors/ClippingNode.js +19 -13
- package/src/nodes/accessors/CubeTextureNode.js +9 -8
- package/src/nodes/accessors/InstanceNode.js +19 -15
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +8 -5
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +56 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +9 -4
- package/src/nodes/accessors/ModelNode.js +47 -12
- package/src/nodes/accessors/ModelViewProjectionNode.js +12 -9
- package/src/nodes/accessors/MorphNode.js +17 -13
- package/src/nodes/accessors/Normal.js +88 -0
- package/src/nodes/accessors/Object3DNode.js +17 -33
- package/src/nodes/accessors/PointUVNode.js +9 -5
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/src/nodes/accessors/ReferenceNode.js +50 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +12 -6
- package/src/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +88 -21
- package/src/nodes/accessors/StorageBufferNode.js +22 -5
- package/src/nodes/accessors/StorageTextureNode.js +9 -6
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +16 -13
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +29 -23
- package/src/nodes/accessors/TextureSizeNode.js +10 -9
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +26 -14
- package/src/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/src/nodes/accessors/VertexColorNode.js +7 -4
- package/src/nodes/code/CodeNode.js +9 -5
- package/src/nodes/code/ExpressionNode.js +10 -6
- package/src/nodes/code/FunctionCallNode.js +8 -5
- package/src/nodes/code/FunctionNode.js +8 -23
- package/src/nodes/code/ScriptableNode.js +13 -10
- package/src/nodes/code/ScriptableValueNode.js +9 -7
- package/src/nodes/core/AssignNode.js +12 -9
- package/src/nodes/core/AttributeNode.js +12 -21
- package/src/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +10 -6
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +21 -11
- package/src/nodes/core/IndexNode.js +35 -8
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +16 -7
- package/src/nodes/core/Node.js +19 -40
- package/src/nodes/core/NodeBuilder.js +117 -38
- package/src/nodes/core/NodeUtils.js +49 -6
- package/src/nodes/core/OutputStructNode.js +10 -6
- package/src/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +36 -32
- package/src/nodes/core/StackNode.js +31 -11
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +14 -11
- package/src/nodes/core/UniformNode.js +7 -4
- package/src/nodes/core/VarNode.js +12 -8
- package/src/nodes/core/VaryingNode.js +10 -6
- package/src/nodes/display/AfterImageNode.js +15 -9
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/src/nodes/display/AnamorphicNode.js +17 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +27 -19
- package/src/nodes/display/BumpMapNode.js +13 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +67 -61
- package/src/nodes/display/DenoiseNode.js +23 -17
- package/src/nodes/display/DepthOfFieldNode.js +12 -7
- package/src/nodes/display/DotScreenNode.js +13 -22
- package/src/nodes/display/FXAANode.js +21 -16
- package/src/nodes/display/FilmNode.js +11 -7
- package/src/nodes/display/FrontFacingNode.js +10 -6
- package/src/nodes/display/GTAONode.js +22 -15
- package/src/nodes/display/GaussianBlurNode.js +14 -8
- package/src/nodes/display/Lut3DNode.js +10 -6
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +13 -13
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +95 -8
- package/src/nodes/display/PixelationPassNode.js +20 -8
- package/src/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +11 -7
- package/src/nodes/display/RenderOutputNode.js +15 -11
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +13 -8
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +15 -175
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +12 -8
- package/src/nodes/display/ViewportDepthNode.js +34 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +10 -9
- package/src/nodes/display/ViewportSharedTextureNode.js +10 -9
- package/src/nodes/display/ViewportTextureNode.js +11 -11
- package/src/nodes/fog/FogExp2Node.js +8 -7
- package/src/nodes/fog/FogNode.js +10 -8
- package/src/nodes/fog/FogRangeNode.js +8 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +34 -33
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +9 -5
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +225 -36
- package/src/nodes/lighting/BasicEnvironmentNode.js +8 -4
- package/src/nodes/lighting/BasicLightMapNode.js +7 -4
- package/src/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +23 -19
- package/src/nodes/lighting/HemisphereLightNode.js +11 -11
- package/src/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +19 -18
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +112 -75
- package/src/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +11 -11
- package/src/nodes/lighting/SpotLightNode.js +14 -16
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +38 -10
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +127 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +97 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +61 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +9 -6
- package/src/nodes/utils/FlipNode.js +68 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +9 -5
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +16 -6
- package/src/nodes/utils/MatcapUVNode.js +10 -7
- package/src/nodes/utils/MaxMipLevelNode.js +8 -5
- package/src/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +11 -8
- package/src/nodes/utils/ReflectorNode.js +12 -4
- package/src/nodes/utils/RemapNode.js +12 -8
- package/src/nodes/utils/RotateNode.js +8 -13
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +11 -12
- package/src/nodes/utils/TimerNode.js +8 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +78 -13
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +88 -41
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +15 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +23 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +117 -6
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +128 -94
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +19 -22
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +65 -19
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +3 -1
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +83 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +135 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +60 -12
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +20 -2
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +89 -37
- package/src/renderers/webgpu/WebGPUBackend.js +112 -86
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +9 -6
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +189 -73
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +7 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +43 -26
- package/src/renderers/webgpu/utils/WebGPUUtils.js +19 -2
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/accessors/CameraNode.js +0 -19
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/display/ViewportNode.js +0 -137
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import Node
|
|
2
|
-
import { nodeProxy } from '../
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
4
|
class FunctionOverloadingNode extends Node {
|
|
5
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'FunctionOverloadingNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
constructor( functionNodes = [], ...parametersNodes ) {
|
|
7
13
|
|
|
8
14
|
super();
|
|
@@ -90,8 +96,6 @@ class FunctionOverloadingNode extends Node {
|
|
|
90
96
|
|
|
91
97
|
export default FunctionOverloadingNode;
|
|
92
98
|
|
|
93
|
-
const overloadingBaseFn = nodeProxy( FunctionOverloadingNode );
|
|
99
|
+
const overloadingBaseFn = /*@__PURE__*/ nodeProxy( FunctionOverloadingNode );
|
|
94
100
|
|
|
95
101
|
export const overloadingFn = ( functionNodes ) => ( ...params ) => overloadingBaseFn( functionNodes, ...params );
|
|
96
|
-
|
|
97
|
-
addNodeClass( 'FunctionOverloadingNode', FunctionOverloadingNode );
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { addNodeClass } from '../core/Node.js';
|
|
2
1
|
import TempNode from '../core/TempNode.js';
|
|
3
2
|
|
|
4
3
|
class JoinNode extends TempNode {
|
|
5
4
|
|
|
5
|
+
static get type() {
|
|
6
|
+
|
|
7
|
+
return 'JoinNode';
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
constructor( nodes = [], nodeType = null ) {
|
|
7
12
|
|
|
8
13
|
super( nodeType );
|
|
@@ -57,5 +62,3 @@ class JoinNode extends TempNode {
|
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
export default JoinNode;
|
|
60
|
-
|
|
61
|
-
addNodeClass( 'JoinNode', JoinNode );
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { expression } from '../code/ExpressionNode.js';
|
|
3
|
-
import {
|
|
4
|
-
import { addNodeElement, nodeObject, nodeArray } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeObject, nodeArray } from '../tsl/TSLBase.js';
|
|
5
4
|
|
|
6
5
|
class LoopNode extends Node {
|
|
7
6
|
|
|
7
|
+
static get type() {
|
|
8
|
+
|
|
9
|
+
return 'LoopNode';
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
constructor( params = [] ) {
|
|
9
14
|
|
|
10
15
|
super();
|
|
@@ -192,10 +197,15 @@ class LoopNode extends Node {
|
|
|
192
197
|
|
|
193
198
|
export default LoopNode;
|
|
194
199
|
|
|
195
|
-
export const
|
|
200
|
+
export const Loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).append();
|
|
196
201
|
export const Continue = () => expression( 'continue' ).append();
|
|
197
202
|
export const Break = () => expression( 'break' ).append();
|
|
198
203
|
|
|
199
|
-
|
|
204
|
+
//
|
|
205
|
+
|
|
206
|
+
export const loop = ( ...params ) => { // @deprecated, r168
|
|
207
|
+
|
|
208
|
+
console.warn( 'TSL.LoopNode: loop() has been renamed to Loop().' );
|
|
209
|
+
return Loop( ...params );
|
|
200
210
|
|
|
201
|
-
|
|
211
|
+
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import { transformedNormalView } from '../accessors/
|
|
3
|
-
import { positionViewDirection } from '../accessors/
|
|
4
|
-
import { nodeImmutable, vec2, vec3 } from '../
|
|
5
|
-
import { addNodeClass } from '../core/Node.js';
|
|
2
|
+
import { transformedNormalView } from '../accessors/Normal.js';
|
|
3
|
+
import { positionViewDirection } from '../accessors/Position.js';
|
|
4
|
+
import { nodeImmutable, vec2, vec3 } from '../tsl/TSLBase.js';
|
|
6
5
|
|
|
7
6
|
class MatcapUVNode extends TempNode {
|
|
8
7
|
|
|
8
|
+
static get type() {
|
|
9
|
+
|
|
10
|
+
return 'MatcapUVNode';
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
constructor() {
|
|
10
15
|
|
|
11
16
|
super( 'vec2' );
|
|
@@ -25,6 +30,4 @@ class MatcapUVNode extends TempNode {
|
|
|
25
30
|
|
|
26
31
|
export default MatcapUVNode;
|
|
27
32
|
|
|
28
|
-
export const matcapUV = nodeImmutable( MatcapUVNode );
|
|
29
|
-
|
|
30
|
-
addNodeClass( 'MatcapUVNode', MatcapUVNode );
|
|
33
|
+
export const matcapUV = /*@__PURE__*/ nodeImmutable( MatcapUVNode );
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import UniformNode from '../core/UniformNode.js';
|
|
2
2
|
import { NodeUpdateType } from '../core/constants.js';
|
|
3
|
-
import { nodeProxy } from '../
|
|
4
|
-
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
5
4
|
|
|
6
5
|
class MaxMipLevelNode extends UniformNode {
|
|
7
6
|
|
|
7
|
+
static get type() {
|
|
8
|
+
|
|
9
|
+
return 'MaxMipLevelNode';
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
constructor( textureNode ) {
|
|
9
14
|
|
|
10
15
|
super( 0 );
|
|
@@ -47,6 +52,4 @@ class MaxMipLevelNode extends UniformNode {
|
|
|
47
52
|
|
|
48
53
|
export default MaxMipLevelNode;
|
|
49
54
|
|
|
50
|
-
export const maxMipLevel = nodeProxy( MaxMipLevelNode );
|
|
51
|
-
|
|
52
|
-
addNodeClass( 'MaxMipLevelNode', MaxMipLevelNode );
|
|
55
|
+
export const maxMipLevel = /*@__PURE__*/ nodeProxy( MaxMipLevelNode );
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { timerLocal } from './TimerNode.js';
|
|
3
|
-
import { nodeObject, nodeProxy } from '../
|
|
3
|
+
import { nodeObject, nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class OscNode extends Node {
|
|
6
6
|
|
|
7
|
+
static get type() {
|
|
8
|
+
|
|
9
|
+
return 'OscNode';
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
constructor( method = OscNode.SINE, timeNode = timerLocal() ) {
|
|
8
14
|
|
|
9
15
|
super();
|
|
@@ -73,9 +79,7 @@ OscNode.SAWTOOTH = 'sawtooth';
|
|
|
73
79
|
|
|
74
80
|
export default OscNode;
|
|
75
81
|
|
|
76
|
-
export const oscSine = nodeProxy( OscNode, OscNode.SINE );
|
|
77
|
-
export const oscSquare = nodeProxy( OscNode, OscNode.SQUARE );
|
|
78
|
-
export const oscTriangle = nodeProxy( OscNode, OscNode.TRIANGLE );
|
|
79
|
-
export const oscSawtooth = nodeProxy( OscNode, OscNode.SAWTOOTH );
|
|
80
|
-
|
|
81
|
-
addNodeClass( 'OscNode', OscNode );
|
|
82
|
+
export const oscSine = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SINE );
|
|
83
|
+
export const oscSquare = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SQUARE );
|
|
84
|
+
export const oscTriangle = /*@__PURE__*/ nodeProxy( OscNode, OscNode.TRIANGLE );
|
|
85
|
+
export const oscSawtooth = /*@__PURE__*/ nodeProxy( OscNode, OscNode.SAWTOOTH );
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { nodeObject
|
|
1
|
+
import { nodeObject } from '../tsl/TSLCore.js';
|
|
2
2
|
import TextureNode from '../accessors/TextureNode.js';
|
|
3
3
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
|
-
import {
|
|
5
|
-
import NodeMaterial from '
|
|
6
|
-
import { uv } from '../accessors/UVNode.js';
|
|
4
|
+
import { uv } from '../accessors/UV.js';
|
|
5
|
+
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
7
6
|
import QuadMesh from '../../renderers/common/QuadMesh.js';
|
|
8
7
|
|
|
9
8
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
@@ -14,6 +13,12 @@ const _size = /*@__PURE__*/ new Vector2();
|
|
|
14
13
|
|
|
15
14
|
class RTTNode extends TextureNode {
|
|
16
15
|
|
|
16
|
+
static get type() {
|
|
17
|
+
|
|
18
|
+
return 'RTTNode';
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
constructor( node, width = null, height = null, options = { type: HalfFloatType } ) {
|
|
18
23
|
|
|
19
24
|
const renderTarget = new RenderTarget( width, height, options );
|
|
@@ -47,6 +52,7 @@ class RTTNode extends TextureNode {
|
|
|
47
52
|
setup( builder ) {
|
|
48
53
|
|
|
49
54
|
this._rttNode = this.node.context( builder.getSharedContext() );
|
|
55
|
+
this._quadMesh.material.name = 'RTT';
|
|
50
56
|
this._quadMesh.material.needsUpdate = true;
|
|
51
57
|
|
|
52
58
|
return super.setup( builder );
|
|
@@ -124,7 +130,4 @@ class RTTNode extends TextureNode {
|
|
|
124
130
|
export default RTTNode;
|
|
125
131
|
|
|
126
132
|
export const rtt = ( node, ...params ) => nodeObject( new RTTNode( nodeObject( node ), ...params ) );
|
|
127
|
-
|
|
128
|
-
addNodeElement( 'toTexture', ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params ) );
|
|
129
|
-
|
|
130
|
-
addNodeClass( 'RTTNode', RTTNode );
|
|
133
|
+
export const convertToTexture = ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import TextureNode from '../accessors/TextureNode.js';
|
|
2
|
-
import { nodeObject
|
|
2
|
+
import { nodeObject } from '../tsl/TSLBase.js';
|
|
3
3
|
import { NodeUpdateType } from '../core/constants.js';
|
|
4
|
-
import {
|
|
4
|
+
import { screenUV } from '../display/ScreenNode.js';
|
|
5
5
|
|
|
6
6
|
import { HalfFloatType, LinearMipMapLinearFilter } from '../../constants.js';
|
|
7
7
|
import { Plane } from '../../math/Plane.js';
|
|
@@ -27,12 +27,18 @@ const _q = new Vector4();
|
|
|
27
27
|
const _size = new Vector2();
|
|
28
28
|
|
|
29
29
|
const _defaultRT = new RenderTarget();
|
|
30
|
-
const _defaultUV =
|
|
30
|
+
const _defaultUV = screenUV.flipX();
|
|
31
31
|
|
|
32
32
|
let _inReflector = false;
|
|
33
33
|
|
|
34
34
|
class ReflectorNode extends TextureNode {
|
|
35
35
|
|
|
36
|
+
static get type() {
|
|
37
|
+
|
|
38
|
+
return 'ReflectorNode';
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
constructor( parameters = {} ) {
|
|
37
43
|
|
|
38
44
|
super( _defaultRT.texture, _defaultUV );
|
|
@@ -214,11 +220,14 @@ class ReflectorNode extends TextureNode {
|
|
|
214
220
|
material.visible = false;
|
|
215
221
|
|
|
216
222
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
223
|
+
const currentMRT = renderer.getMRT();
|
|
217
224
|
|
|
225
|
+
renderer.setMRT( null );
|
|
218
226
|
renderer.setRenderTarget( renderTarget );
|
|
219
227
|
|
|
220
228
|
renderer.render( scene, virtualCamera );
|
|
221
229
|
|
|
230
|
+
renderer.setMRT( currentMRT );
|
|
222
231
|
renderer.setRenderTarget( currentRenderTarget );
|
|
223
232
|
|
|
224
233
|
material.visible = true;
|
|
@@ -232,4 +241,3 @@ class ReflectorNode extends TextureNode {
|
|
|
232
241
|
export const reflector = ( parameters ) => nodeObject( new ReflectorNode( parameters ) );
|
|
233
242
|
|
|
234
243
|
export default ReflectorNode;
|
|
235
|
-
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import Node
|
|
2
|
-
import { float,
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { float, addMethodChaining, nodeProxy } from '../tsl/TSLCore.js';
|
|
3
3
|
|
|
4
4
|
class RemapNode extends Node {
|
|
5
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'RemapNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
constructor( node, inLowNode, inHighNode, outLowNode = float( 0 ), outHighNode = float( 1 ) ) {
|
|
7
13
|
|
|
8
14
|
super();
|
|
@@ -33,10 +39,8 @@ class RemapNode extends Node {
|
|
|
33
39
|
|
|
34
40
|
export default RemapNode;
|
|
35
41
|
|
|
36
|
-
export const remap = nodeProxy( RemapNode, null, null, { doClamp: false } );
|
|
37
|
-
export const remapClamp = nodeProxy( RemapNode );
|
|
38
|
-
|
|
39
|
-
addNodeElement( 'remap', remap );
|
|
40
|
-
addNodeElement( 'remapClamp', remapClamp );
|
|
42
|
+
export const remap = /*@__PURE__*/ nodeProxy( RemapNode, null, null, { doClamp: false } );
|
|
43
|
+
export const remapClamp = /*@__PURE__*/ nodeProxy( RemapNode );
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
addMethodChaining( 'remap', remap );
|
|
46
|
+
addMethodChaining( 'remapClamp', remapClamp );
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import TempNode from '../core/TempNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
addNodeElement,
|
|
5
|
-
nodeProxy,
|
|
6
|
-
vec4,
|
|
7
|
-
mat2,
|
|
8
|
-
mat4,
|
|
9
|
-
} from '../shadernode/ShaderNode.js';
|
|
2
|
+
import { nodeProxy, vec4, mat2, mat4 } from '../tsl/TSLBase.js';
|
|
10
3
|
import { cos, sin } from '../math/MathNode.js';
|
|
11
4
|
|
|
12
5
|
class RotateNode extends TempNode {
|
|
13
6
|
|
|
7
|
+
static get type() {
|
|
8
|
+
|
|
9
|
+
return 'RotateNode';
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
14
13
|
constructor( positionNode, rotationNode ) {
|
|
15
14
|
|
|
16
15
|
super();
|
|
@@ -61,8 +60,4 @@ class RotateNode extends TempNode {
|
|
|
61
60
|
|
|
62
61
|
export default RotateNode;
|
|
63
62
|
|
|
64
|
-
export const rotate = nodeProxy( RotateNode );
|
|
65
|
-
|
|
66
|
-
addNodeElement( 'rotate', rotate );
|
|
67
|
-
|
|
68
|
-
addNodeClass( 'RotateNode', RotateNode );
|
|
63
|
+
export const rotate = /*@__PURE__*/ nodeProxy( RotateNode );
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { addNodeClass } from '../core/Node.js';
|
|
2
1
|
import TempNode from '../core/TempNode.js';
|
|
3
2
|
import { vectorComponents } from '../core/constants.js';
|
|
4
3
|
|
|
5
4
|
class SetNode extends TempNode {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'SetNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( sourceNode, components, targetNode ) {
|
|
8
13
|
|
|
9
14
|
super();
|
|
@@ -25,7 +30,7 @@ class SetNode extends TempNode {
|
|
|
25
30
|
const { sourceNode, components, targetNode } = this;
|
|
26
31
|
|
|
27
32
|
const sourceType = this.getNodeType( builder );
|
|
28
|
-
const targetType = builder.getTypeFromLength( components.length );
|
|
33
|
+
const targetType = builder.getTypeFromLength( components.length, targetNode.getNodeType( builder ) );
|
|
29
34
|
|
|
30
35
|
const targetSnippet = targetNode.build( builder, targetType );
|
|
31
36
|
const sourceSnippet = sourceNode.build( builder, sourceType );
|
|
@@ -58,5 +63,3 @@ class SetNode extends TempNode {
|
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
export default SetNode;
|
|
61
|
-
|
|
62
|
-
addNodeClass( 'SetNode', SetNode );
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { vectorComponents } from '../core/constants.js';
|
|
3
3
|
|
|
4
4
|
const stringVectorComponents = vectorComponents.join( '' );
|
|
5
5
|
|
|
6
6
|
class SplitNode extends Node {
|
|
7
7
|
|
|
8
|
+
static get type() {
|
|
9
|
+
|
|
10
|
+
return 'SplitNode';
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
constructor( node, components = 'x' ) {
|
|
9
15
|
|
|
10
16
|
super();
|
|
@@ -108,5 +114,3 @@ class SplitNode extends Node {
|
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
export default SplitNode;
|
|
111
|
-
|
|
112
|
-
addNodeClass( 'SplitNode', SplitNode );
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import Node
|
|
2
|
-
import { uv } from '../accessors/
|
|
3
|
-
import { nodeProxy, float, vec2 } from '../
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
|
+
import { uv } from '../accessors/UV.js';
|
|
3
|
+
import { nodeProxy, float, vec2 } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class SpriteSheetUVNode extends Node {
|
|
6
6
|
|
|
7
|
+
static get type() {
|
|
8
|
+
|
|
9
|
+
return 'SpriteSheetUVNode';
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
constructor( countNode, uvNode = uv(), frameNode = float( 0 ) ) {
|
|
8
14
|
|
|
9
15
|
super( 'vec2' );
|
|
@@ -36,6 +42,4 @@ class SpriteSheetUVNode extends Node {
|
|
|
36
42
|
|
|
37
43
|
export default SpriteSheetUVNode;
|
|
38
44
|
|
|
39
|
-
export const spritesheetUV = nodeProxy( SpriteSheetUVNode );
|
|
40
|
-
|
|
41
|
-
addNodeClass( 'SpriteSheetUVNode', SpriteSheetUVNode );
|
|
45
|
+
export const spritesheetUV = /*@__PURE__*/ nodeProxy( SpriteSheetUVNode );
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { modelWorldMatrix } from '../accessors/ModelNode.js';
|
|
2
|
+
import { cameraViewMatrix, cameraProjectionMatrix } from '../accessors/Camera.js';
|
|
3
|
+
import { positionLocal } from '../accessors/Position.js';
|
|
4
|
+
import { Fn, defined } from '../tsl/TSLBase.js';
|
|
5
|
+
|
|
6
|
+
export const billboarding = /*@__PURE__*/ Fn( ( { position = null, horizontal = true, vertical = false } ) => {
|
|
7
|
+
|
|
8
|
+
let worldMatrix;
|
|
9
|
+
|
|
10
|
+
if ( position !== null ) {
|
|
11
|
+
|
|
12
|
+
worldMatrix = modelWorldMatrix.toVar();
|
|
13
|
+
worldMatrix[ 3 ][ 0 ] = position.x;
|
|
14
|
+
worldMatrix[ 3 ][ 1 ] = position.y;
|
|
15
|
+
worldMatrix[ 3 ][ 2 ] = position.z;
|
|
16
|
+
|
|
17
|
+
} else {
|
|
18
|
+
|
|
19
|
+
worldMatrix = modelWorldMatrix;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const modelViewMatrix = cameraViewMatrix.mul( worldMatrix );
|
|
24
|
+
|
|
25
|
+
if ( defined( horizontal ) ) {
|
|
26
|
+
|
|
27
|
+
modelViewMatrix[ 0 ][ 0 ] = modelWorldMatrix[ 0 ].length();
|
|
28
|
+
modelViewMatrix[ 0 ][ 1 ] = 0;
|
|
29
|
+
modelViewMatrix[ 0 ][ 2 ] = 0;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if ( defined( vertical ) ) {
|
|
34
|
+
|
|
35
|
+
modelViewMatrix[ 1 ][ 0 ] = 0;
|
|
36
|
+
modelViewMatrix[ 1 ][ 1 ] = modelWorldMatrix[ 1 ].length();
|
|
37
|
+
modelViewMatrix[ 1 ][ 2 ] = 0;
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
modelViewMatrix[ 2 ][ 0 ] = 0;
|
|
42
|
+
modelViewMatrix[ 2 ][ 1 ] = 0;
|
|
43
|
+
modelViewMatrix[ 2 ][ 2 ] = 1;
|
|
44
|
+
|
|
45
|
+
return cameraProjectionMatrix.mul( modelViewMatrix ).mul( positionLocal );
|
|
46
|
+
|
|
47
|
+
} );
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nodeProxy, addNodeElement } from '../shadernode/ShaderNode.js';
|
|
1
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
2
|
import ArrayElementNode from './ArrayElementNode.js';
|
|
4
3
|
|
|
5
4
|
class StorageArrayElementNode extends ArrayElementNode {
|
|
6
5
|
|
|
6
|
+
static get type() {
|
|
7
|
+
|
|
8
|
+
return 'StorageArrayElementNode';
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
constructor( storageBufferNode, indexNode ) {
|
|
8
13
|
|
|
9
14
|
super( storageBufferNode, indexNode );
|
|
@@ -28,7 +33,7 @@ class StorageArrayElementNode extends ArrayElementNode {
|
|
|
28
33
|
|
|
29
34
|
if ( builder.isAvailable( 'storageBuffer' ) === false ) {
|
|
30
35
|
|
|
31
|
-
if (
|
|
36
|
+
if ( this.node.bufferObject === true ) {
|
|
32
37
|
|
|
33
38
|
builder.setupPBO( this.node );
|
|
34
39
|
|
|
@@ -50,15 +55,13 @@ class StorageArrayElementNode extends ArrayElementNode {
|
|
|
50
55
|
|
|
51
56
|
if ( builder.isAvailable( 'storageBuffer' ) === false ) {
|
|
52
57
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if ( ! node.instanceIndex && this.node.bufferObject === true && isAssignContext !== true ) {
|
|
58
|
+
if ( this.node.bufferObject === true && isAssignContext !== true ) {
|
|
56
59
|
|
|
57
60
|
snippet = builder.generatePBO( this );
|
|
58
61
|
|
|
59
62
|
} else {
|
|
60
63
|
|
|
61
|
-
snippet = node.build( builder );
|
|
64
|
+
snippet = this.node.build( builder );
|
|
62
65
|
|
|
63
66
|
}
|
|
64
67
|
|
|
@@ -84,8 +87,4 @@ class StorageArrayElementNode extends ArrayElementNode {
|
|
|
84
87
|
|
|
85
88
|
export default StorageArrayElementNode;
|
|
86
89
|
|
|
87
|
-
export const storageElement = nodeProxy( StorageArrayElementNode );
|
|
88
|
-
|
|
89
|
-
addNodeElement( 'storageElement', storageElement );
|
|
90
|
-
|
|
91
|
-
addNodeClass( 'StorageArrayElementNode', StorageArrayElementNode );
|
|
90
|
+
export const storageElement = /*@__PURE__*/ nodeProxy( StorageArrayElementNode );
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import UniformNode from '../core/UniformNode.js';
|
|
2
2
|
import { NodeUpdateType } from '../core/constants.js';
|
|
3
|
-
import { nodeObject, nodeImmutable } from '../
|
|
4
|
-
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { nodeObject, nodeImmutable } from '../tsl/TSLBase.js';
|
|
5
4
|
|
|
6
5
|
class TimerNode extends UniformNode {
|
|
7
6
|
|
|
7
|
+
static get type() {
|
|
8
|
+
|
|
9
|
+
return 'TimerNode';
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
constructor( scope = TimerNode.LOCAL, scale = 1, value = 0 ) {
|
|
9
14
|
|
|
10
15
|
super( value );
|
|
@@ -89,6 +94,4 @@ export default TimerNode;
|
|
|
89
94
|
export const timerLocal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.LOCAL, timeScale, value ) );
|
|
90
95
|
export const timerGlobal = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.GLOBAL, timeScale, value ) );
|
|
91
96
|
export const timerDelta = ( timeScale, value = 0 ) => nodeObject( new TimerNode( TimerNode.DELTA, timeScale, value ) );
|
|
92
|
-
export const frameId = nodeImmutable( TimerNode, TimerNode.FRAME ).toUint();
|
|
93
|
-
|
|
94
|
-
addNodeClass( 'TimerNode', TimerNode );
|
|
97
|
+
export const frameId = /*@__PURE__*/ nodeImmutable( TimerNode, TimerNode.FRAME ).toUint();
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import Node
|
|
1
|
+
import Node from '../core/Node.js';
|
|
2
2
|
import { add } from '../math/OperatorNode.js';
|
|
3
|
-
import { normalLocal } from '../accessors/
|
|
4
|
-
import { positionLocal } from '../accessors/
|
|
3
|
+
import { normalLocal } from '../accessors/Normal.js';
|
|
4
|
+
import { positionLocal } from '../accessors/Position.js';
|
|
5
5
|
import { texture } from '../accessors/TextureNode.js';
|
|
6
|
-
import {
|
|
6
|
+
import { nodeProxy, float, vec3 } from '../tsl/TSLBase.js';
|
|
7
7
|
|
|
8
8
|
class TriplanarTexturesNode extends Node {
|
|
9
9
|
|
|
10
|
+
static get type() {
|
|
11
|
+
|
|
12
|
+
return 'TriplanarTexturesNode';
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
constructor( textureXNode, textureYNode = null, textureZNode = null, scaleNode = float( 1 ), positionNode = positionLocal, normalNode = normalLocal ) {
|
|
11
17
|
|
|
12
18
|
super( 'vec4' );
|
|
@@ -54,9 +60,5 @@ class TriplanarTexturesNode extends Node {
|
|
|
54
60
|
|
|
55
61
|
export default TriplanarTexturesNode;
|
|
56
62
|
|
|
57
|
-
export const triplanarTextures = nodeProxy( TriplanarTexturesNode );
|
|
63
|
+
export const triplanarTextures = /*@__PURE__*/ nodeProxy( TriplanarTexturesNode );
|
|
58
64
|
export const triplanarTexture = ( ...params ) => triplanarTextures( ...params );
|
|
59
|
-
|
|
60
|
-
addNodeElement( 'triplanarTexture', triplanarTexture );
|
|
61
|
-
|
|
62
|
-
addNodeClass( 'TriplanarTexturesNode', TriplanarTexturesNode );
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fn, vec2 } from '../tsl/TSLBase.js';
|
|
2
|
+
import { rotate } from './RotateNode.js';
|
|
3
|
+
|
|
4
|
+
export const rotateUV = /*@__PURE__*/ Fn( ( [ uv, rotation, center = vec2( 0.5 ) ] ) => {
|
|
5
|
+
|
|
6
|
+
return rotate( uv.sub( center ), rotation ).add( center );
|
|
7
|
+
|
|
8
|
+
} );
|
|
9
|
+
|
|
10
|
+
export const spherizeUV = /*@__PURE__*/ Fn( ( [ uv, strength, center = vec2( 0.5 ) ] ) => {
|
|
11
|
+
|
|
12
|
+
const delta = uv.sub( center );
|
|
13
|
+
const delta2 = delta.dot( delta );
|
|
14
|
+
const delta4 = delta2.mul( delta2 );
|
|
15
|
+
const deltaOffset = delta4.mul( strength );
|
|
16
|
+
|
|
17
|
+
return uv.add( delta.mul( deltaOffset ) );
|
|
18
|
+
|
|
19
|
+
} );
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fn } from '../tsl/TSLBase.js';
|
|
2
|
+
import { screenUV } from '../display/ScreenNode.js';
|
|
3
|
+
import { viewportDepthTexture } from '../display/ViewportDepthTextureNode.js';
|
|
4
|
+
import { linearDepth } from '../display/ViewportDepthNode.js';
|
|
5
|
+
|
|
6
|
+
export const viewportSafeUV = /*@__PURE__*/ Fn( ( [ uv = null ] ) => {
|
|
7
|
+
|
|
8
|
+
const depth = linearDepth();
|
|
9
|
+
const depthDiff = linearDepth( viewportDepthTexture( uv ) ).sub( depth );
|
|
10
|
+
const finalUV = depthDiff.lessThan( 0 ).select( screenUV, uv );
|
|
11
|
+
|
|
12
|
+
return finalUV;
|
|
13
|
+
|
|
14
|
+
} );
|