super-three 0.164.0 → 0.167.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/README.md +3 -3
- package/build/three.cjs +1273 -503
- package/build/three.module.js +1269 -504
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +76086 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +8 -4
- package/examples/jsm/exporters/USDZExporter.js +6 -4
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +75 -61
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/FBXLoader.js +47 -58
- package/examples/jsm/loaders/GLTFLoader.js +12 -4
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/MaterialXLoader.js +2 -9
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VTKLoader.js +76 -3
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -19
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +13 -38
- package/examples/jsm/postprocessing/SSAOPass.js +6 -9
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/transpiler/GLSLDecoder.js +46 -4
- package/examples/jsm/transpiler/TSLEncoder.js +17 -15
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/package.json +9 -7
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +2 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +24 -22
- package/src/core/Raycaster.js +6 -2
- package/src/extras/TextureUtils.js +210 -0
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/FileLoader.js +4 -0
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/ObjectLoader.js +34 -2
- package/src/materials/Material.js +13 -4
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Vector4.js +13 -0
- package/{examples/jsm → src}/nodes/Nodes.js +39 -20
- package/{examples/jsm → src}/nodes/accessors/BatchNode.js +28 -10
- package/src/nodes/accessors/BitangentNode.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +36 -1
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +6 -0
- package/src/nodes/accessors/CameraNode.js +19 -0
- package/{examples/jsm → src}/nodes/accessors/CubeTextureNode.js +22 -5
- package/src/nodes/accessors/InstanceNode.js +140 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +24 -2
- package/{examples/jsm → src}/nodes/accessors/ModelNode.js +4 -0
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +24 -20
- package/src/nodes/accessors/NormalNode.js +14 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/PositionNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +7 -1
- package/src/nodes/accessors/ReflectVectorNode.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +50 -1
- package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +28 -6
- package/src/nodes/accessors/TangentNode.js +23 -0
- package/src/nodes/accessors/Texture3DNode.js +100 -0
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +55 -18
- package/src/nodes/accessors/UVNode.js +3 -0
- package/{examples/jsm → src}/nodes/accessors/UniformsNode.js +7 -1
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +2 -1
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +14 -0
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +2 -1
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +34 -8
- package/{examples/jsm → src}/nodes/core/CacheNode.js +7 -10
- package/{examples/jsm → src}/nodes/core/ContextNode.js +6 -0
- package/{examples/jsm → src}/nodes/core/IndexNode.js +6 -0
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +76 -0
- package/{examples/jsm → src}/nodes/core/Node.js +33 -14
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +194 -45
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +42 -0
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeKeywords.js +1 -1
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +6 -1
- package/{examples/jsm → src}/nodes/core/OutputStructNode.js +1 -5
- package/{examples/jsm → src}/nodes/core/PropertyNode.js +2 -0
- package/{examples/jsm → src}/nodes/core/TempNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/UniformGroupNode.js +20 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +10 -1
- package/{examples/jsm → src}/nodes/core/VarNode.js +2 -6
- package/src/nodes/core/VaryingNode.js +104 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +24 -20
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +18 -21
- package/src/nodes/display/BloomNode.js +333 -0
- package/{examples/jsm → src}/nodes/display/ColorAdjustmentNode.js +7 -2
- package/{examples/jsm → src}/nodes/display/ColorSpaceNode.js +1 -1
- package/src/nodes/display/DenoiseNode.js +198 -0
- package/src/nodes/display/DepthOfFieldNode.js +119 -0
- package/src/nodes/display/DotScreenNode.js +75 -0
- package/src/nodes/display/FXAANode.js +327 -0
- package/src/nodes/display/FilmNode.js +52 -0
- package/{examples/jsm → src}/nodes/display/FrontFacingNode.js +2 -1
- package/src/nodes/display/GTAONode.js +324 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +34 -17
- package/src/nodes/display/Lut3DNode.js +53 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +1 -1
- package/src/nodes/display/PassNode.js +291 -0
- package/src/nodes/display/PixelationPassNode.js +201 -0
- package/src/nodes/display/RGBShiftNode.js +49 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SobelOperatorNode.js +121 -0
- package/{examples/jsm → src}/nodes/display/ToneMappingNode.js +44 -5
- package/src/nodes/display/TransitionNode.js +76 -0
- package/{examples/jsm → src}/nodes/display/ViewportDepthNode.js +39 -16
- package/{examples/jsm → src}/nodes/display/ViewportDepthTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportNode.js +3 -2
- package/{examples/jsm → src}/nodes/display/ViewportSharedTextureNode.js +2 -1
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +5 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +5 -3
- package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +103 -18
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +19 -6
- package/{examples/jsm → src}/nodes/lighting/AONode.js +1 -4
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +1 -1
- package/src/nodes/lighting/AnalyticLightNode.js +333 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +26 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +5 -4
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +2 -1
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +1 -1
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +2 -0
- package/{examples/jsm → src}/nodes/lighting/LightsNode.js +18 -3
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +2 -3
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +2 -3
- package/{examples/jsm → src}/nodes/loaders/NodeLoader.js +3 -1
- package/{examples/jsm → src}/nodes/loaders/NodeMaterialLoader.js +2 -1
- package/{examples/jsm → src}/nodes/loaders/NodeObjectLoader.js +2 -1
- package/{examples/jsm → src}/nodes/materials/InstancedPointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/Line2NodeMaterial.js +4 -4
- package/{examples/jsm → src}/nodes/materials/LineBasicNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/LineDashedNodeMaterial.js +4 -3
- package/{examples/jsm → src}/nodes/materials/Materials.js +3 -0
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/{examples/jsm → src}/nodes/materials/MeshLambertNodeMaterial.js +12 -3
- package/src/nodes/materials/MeshMatcapNodeMaterial.js +53 -0
- package/{examples/jsm → src}/nodes/materials/MeshNormalNodeMaterial.js +5 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhongNodeMaterial.js +11 -3
- package/{examples/jsm → src}/nodes/materials/MeshPhysicalNodeMaterial.js +26 -8
- package/{examples/jsm → src}/nodes/materials/MeshStandardNodeMaterial.js +14 -3
- package/src/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/{examples/jsm → src}/nodes/materials/NodeMaterial.js +97 -24
- package/{examples/jsm → src}/nodes/materials/PointsNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/ShadowNodeMaterial.js +3 -3
- package/{examples/jsm → src}/nodes/materials/SpriteNodeMaterial.js +3 -3
- package/src/nodes/materials/VolumeNodeMaterial.js +106 -0
- package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +9 -17
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +474 -577
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +2 -8
- package/{examples/jsm → src}/nodes/math/CondNode.js +13 -6
- package/{examples/jsm → src}/nodes/math/HashNode.js +2 -2
- package/{examples/jsm → src}/nodes/math/MathNode.js +14 -1
- package/{examples/jsm → src}/nodes/math/OperatorNode.js +6 -6
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +2 -1
- package/{examples/jsm → src}/nodes/shadernode/ShaderNode.js +57 -33
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +1 -1
- package/{examples/jsm → src}/nodes/utils/DiscardNode.js +1 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +2 -0
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +7 -6
- package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +1 -1
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +8 -2
- package/src/nodes/utils/RTTNode.js +130 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +9 -1
- package/{examples/jsm → src}/nodes/utils/TimerNode.js +1 -1
- package/src/objects/BatchedMesh.js +232 -162
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +312 -68
- package/{examples/jsm → src}/renderers/common/Attributes.js +4 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +9 -3
- package/src/renderers/common/BindGroup.js +16 -0
- package/{examples/jsm → src}/renderers/common/Bindings.js +54 -22
- package/src/renderers/common/ChainMap.js +59 -0
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +8 -6
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +7 -1
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +34 -6
- package/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
- package/src/renderers/common/PostProcessing.js +87 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +6 -3
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- package/{examples/jsm → src}/renderers/common/RenderContext.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderList.js +9 -0
- package/{examples/jsm → src}/renderers/common/RenderObject.js +50 -11
- package/{examples/jsm → src}/renderers/common/Renderer.js +220 -40
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +2 -2
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +6 -2
- package/{examples/jsm → src}/renderers/common/Uniform.js +10 -5
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/{examples/jsm → src}/renderers/common/extras/PMREMGenerator.js +13 -12
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +19 -4
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +37 -16
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +31 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +6 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +15 -12
- package/src/renderers/webgl/WebGLMaterials.js +1 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +28 -31
- package/src/renderers/webgl/WebGLPrograms.js +15 -15
- package/src/renderers/webgl/WebGLRenderStates.js +2 -2
- package/src/renderers/webgl/WebGLTextures.js +100 -70
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +7 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +156 -54
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +188 -41
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +2 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +1 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +1 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +126 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +212 -78
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +2 -2
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +245 -49
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +30 -14
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +9 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +74 -24
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +101 -25
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +24 -3
- package/src/renderers/webxr/WebXRDepthSensing.js +9 -3
- package/src/renderers/webxr/WebXRManager.js +12 -2
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -106
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/VaryingNode.js +0 -65
- package/examples/jsm/nodes/display/PassNode.js +0 -199
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -255
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- package/examples/jsm/renderers/common/PostProcessing.js +0 -33
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- /package/{examples/jsm → src}/nodes/accessors/AccessorsUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/InstancedPointsMaterialNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/PointUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SceneNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/SkinningNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureBicubicNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/CodeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/ExpressionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +0 -0
- /package/{examples/jsm → src}/nodes/code/FunctionNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/AssignNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/BypassNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ConstNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/InputNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/ParameterNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StackNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/StructTypeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BlendModeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/BumpMapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/display/PosterizeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogNode.js +0 -0
- /package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getGeometryRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +0 -0
- /package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightNode.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/lighting/LightingContextNode.js +0 -0
- /package/{examples/jsm → src}/nodes/materials/MeshSSSNodeMaterial.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +0 -0
- /package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/math/TriNoise3D.js +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +0 -0
- /package/{examples/jsm → src}/nodes/procedural/CheckerNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/ConvertNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/JoinNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/OscNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/PackingNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RemapNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/RotateUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SetNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SplitNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +0 -0
- /package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Animation.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderObjects.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBufferRenderer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +0 -0
|
@@ -8,11 +8,15 @@ import { normalLocal } from './NormalNode.js';
|
|
|
8
8
|
import { textureLoad } from './TextureNode.js';
|
|
9
9
|
import { instanceIndex, vertexIndex } from '../core/IndexNode.js';
|
|
10
10
|
import { ivec2, int } from '../shadernode/ShaderNode.js';
|
|
11
|
-
import { DataArrayTexture, Vector2, Vector4, FloatType } from 'three';
|
|
12
11
|
import { loop } from '../utils/LoopNode.js';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { DataArrayTexture } from '../../textures/DataArrayTexture.js';
|
|
14
|
+
import { Vector2 } from '../../math/Vector2.js';
|
|
15
|
+
import { Vector4 } from '../../math/Vector4.js';
|
|
16
|
+
import { FloatType } from '../../constants.js';
|
|
17
|
+
|
|
18
|
+
const _morphTextures = new WeakMap();
|
|
19
|
+
const _morphVec4 = /*@__PURE__*/ new Vector4();
|
|
16
20
|
|
|
17
21
|
const getMorph = tslFn( ( { bufferMap, influence, stride, width, depth, offset } ) => {
|
|
18
22
|
|
|
@@ -39,7 +43,7 @@ function getEntry( geometry ) {
|
|
|
39
43
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
40
44
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
41
45
|
|
|
42
|
-
let entry =
|
|
46
|
+
let entry = _morphTextures.get( geometry );
|
|
43
47
|
|
|
44
48
|
if ( entry === undefined || entry.count !== morphTargetsCount ) {
|
|
45
49
|
|
|
@@ -91,34 +95,34 @@ function getEntry( geometry ) {
|
|
|
91
95
|
|
|
92
96
|
if ( hasMorphPosition === true ) {
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
_morphVec4.fromBufferAttribute( morphTarget, j );
|
|
95
99
|
|
|
96
|
-
buffer[ offset + stride + 0 ] =
|
|
97
|
-
buffer[ offset + stride + 1 ] =
|
|
98
|
-
buffer[ offset + stride + 2 ] =
|
|
100
|
+
buffer[ offset + stride + 0 ] = _morphVec4.x;
|
|
101
|
+
buffer[ offset + stride + 1 ] = _morphVec4.y;
|
|
102
|
+
buffer[ offset + stride + 2 ] = _morphVec4.z;
|
|
99
103
|
buffer[ offset + stride + 3 ] = 0;
|
|
100
104
|
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
if ( hasMorphNormals === true ) {
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
_morphVec4.fromBufferAttribute( morphNormal, j );
|
|
106
110
|
|
|
107
|
-
buffer[ offset + stride + 4 ] =
|
|
108
|
-
buffer[ offset + stride + 5 ] =
|
|
109
|
-
buffer[ offset + stride + 6 ] =
|
|
111
|
+
buffer[ offset + stride + 4 ] = _morphVec4.x;
|
|
112
|
+
buffer[ offset + stride + 5 ] = _morphVec4.y;
|
|
113
|
+
buffer[ offset + stride + 6 ] = _morphVec4.z;
|
|
110
114
|
buffer[ offset + stride + 7 ] = 0;
|
|
111
115
|
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
if ( hasMorphColors === true ) {
|
|
115
119
|
|
|
116
|
-
|
|
120
|
+
_morphVec4.fromBufferAttribute( morphColor, j );
|
|
117
121
|
|
|
118
|
-
buffer[ offset + stride + 8 ] =
|
|
119
|
-
buffer[ offset + stride + 9 ] =
|
|
120
|
-
buffer[ offset + stride + 10 ] =
|
|
121
|
-
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ?
|
|
122
|
+
buffer[ offset + stride + 8 ] = _morphVec4.x;
|
|
123
|
+
buffer[ offset + stride + 9 ] = _morphVec4.y;
|
|
124
|
+
buffer[ offset + stride + 10 ] = _morphVec4.z;
|
|
125
|
+
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? _morphVec4.w : 1;
|
|
122
126
|
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -133,13 +137,13 @@ function getEntry( geometry ) {
|
|
|
133
137
|
size: new Vector2( width, height )
|
|
134
138
|
};
|
|
135
139
|
|
|
136
|
-
|
|
140
|
+
_morphTextures.set( geometry, entry );
|
|
137
141
|
|
|
138
142
|
function disposeTexture() {
|
|
139
143
|
|
|
140
144
|
bufferTexture.dispose();
|
|
141
145
|
|
|
142
|
-
|
|
146
|
+
_morphTextures.delete( geometry );
|
|
143
147
|
|
|
144
148
|
geometry.removeEventListener( 'dispose', disposeTexture );
|
|
145
149
|
|
|
@@ -190,7 +194,7 @@ class MorphNode extends Node {
|
|
|
190
194
|
|
|
191
195
|
const influence = float( 0 ).toVar();
|
|
192
196
|
|
|
193
|
-
if ( this.mesh.
|
|
197
|
+
if ( this.mesh.count > 1 && ( this.mesh.morphTexture !== null && this.mesh.morphTexture !== undefined ) ) {
|
|
194
198
|
|
|
195
199
|
influence.assign( textureLoad( this.mesh.morphTexture, ivec2( int( i ).add( 1 ), int( instanceIndex ) ) ).r );
|
|
196
200
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { attribute } from '../core/AttributeNode.js';
|
|
2
|
+
import { varying } from '../core/VaryingNode.js';
|
|
3
|
+
import { property } from '../core/PropertyNode.js';
|
|
4
|
+
import { cameraViewMatrix } from './CameraNode.js';
|
|
5
|
+
import { modelNormalMatrix } from './ModelNode.js';
|
|
6
|
+
import { vec3 } from '../shadernode/ShaderNode.js';
|
|
7
|
+
|
|
8
|
+
export const normalGeometry = /*#__PURE__*/ attribute( 'normal', 'vec3', vec3( 0, 1, 0 ) );
|
|
9
|
+
export const normalLocal = /*#__PURE__*/ normalGeometry.toVar( 'normalLocal' );
|
|
10
|
+
export const normalView = /*#__PURE__*/ varying( modelNormalMatrix.mul( normalLocal ), 'v_normalView' ).normalize().toVar( 'normalView' );
|
|
11
|
+
export const normalWorld = /*#__PURE__*/ varying( normalView.transformDirection( cameraViewMatrix ), 'v_normalWorld' ).normalize().toVar( 'normalWorld' );
|
|
12
|
+
export const transformedNormalView = /*#__PURE__*/ property( 'vec3', 'transformedNormalView' );
|
|
13
|
+
export const transformedNormalWorld = /*#__PURE__*/ transformedNormalView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedNormalWorld' );
|
|
14
|
+
export const transformedClearcoatNormalView = /*#__PURE__*/ property( 'vec3', 'transformedClearcoatNormalView' );
|
|
@@ -3,7 +3,7 @@ import { NodeUpdateType } from '../core/constants.js';
|
|
|
3
3
|
import UniformNode from '../core/UniformNode.js';
|
|
4
4
|
import { nodeProxy } from '../shadernode/ShaderNode.js';
|
|
5
5
|
|
|
6
|
-
import { Vector3 } from '
|
|
6
|
+
import { Vector3 } from '../../math/Vector3.js';
|
|
7
7
|
|
|
8
8
|
class Object3DNode extends Node {
|
|
9
9
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { attribute } from '../core/AttributeNode.js';
|
|
2
|
+
import { varying } from '../core/VaryingNode.js';
|
|
3
|
+
import { modelWorldMatrix, modelViewMatrix } from './ModelNode.js';
|
|
4
|
+
|
|
5
|
+
export const positionGeometry = /*#__PURE__*/ attribute( 'position', 'vec3' );
|
|
6
|
+
export const positionLocal = /*#__PURE__*/ positionGeometry.toVar( 'positionLocal' );
|
|
7
|
+
export const positionWorld = /*#__PURE__*/ varying( modelWorldMatrix.mul( positionLocal ).xyz, 'v_positionWorld' );
|
|
8
|
+
export const positionWorldDirection = /*#__PURE__*/ varying( positionLocal.transformDirection( modelWorldMatrix ), 'v_positionWorldDirection' ).normalize().toVar( 'positionWorldDirection' );
|
|
9
|
+
export const positionView = /*#__PURE__*/ varying( modelViewMatrix.mul( positionLocal ).xyz, 'v_positionView' );
|
|
10
|
+
export const positionViewDirection = /*#__PURE__*/ varying( positionView.negate(), 'v_positionViewDirection' ).normalize().toVar( 'positionViewDirection' );
|
|
@@ -49,7 +49,7 @@ class ReferenceNode extends Node {
|
|
|
49
49
|
this.count = count;
|
|
50
50
|
|
|
51
51
|
this.properties = property.split( '.' );
|
|
52
|
-
this.reference =
|
|
52
|
+
this.reference = object;
|
|
53
53
|
this.node = null;
|
|
54
54
|
|
|
55
55
|
this.updateType = NodeUpdateType.OBJECT;
|
|
@@ -90,6 +90,12 @@ class ReferenceNode extends Node {
|
|
|
90
90
|
|
|
91
91
|
getNodeType( builder ) {
|
|
92
92
|
|
|
93
|
+
if ( this.node === null ) {
|
|
94
|
+
|
|
95
|
+
this.updateValue();
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
return this.node.getNodeType( builder );
|
|
94
100
|
|
|
95
101
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cameraViewMatrix } from './CameraNode.js';
|
|
2
|
+
import { transformedNormalView } from './NormalNode.js';
|
|
3
|
+
import { positionViewDirection } from './PositionNode.js';
|
|
4
|
+
import { materialRefractionRatio } from './MaterialNode.js';
|
|
5
|
+
|
|
6
|
+
export const reflectView = /*#__PURE__*/ positionViewDirection.negate().reflect( transformedNormalView );
|
|
7
|
+
export const refractView = /*#__PURE__*/ positionViewDirection.negate().refract( transformedNormalView, materialRefractionRatio );
|
|
8
|
+
|
|
9
|
+
export const reflectVector = /*#__PURE__*/ reflectView.transformDirection( cameraViewMatrix ).toVar( 'reflectVector' );
|
|
10
|
+
export const refractVector = /*#__PURE__*/ refractView.transformDirection( cameraViewMatrix ).toVar( 'reflectVector' );
|
|
@@ -4,6 +4,7 @@ import { addNodeClass } from '../core/Node.js';
|
|
|
4
4
|
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
5
5
|
import { varying } from '../core/VaryingNode.js';
|
|
6
6
|
import { storageElement } from '../utils/StorageArrayElementNode.js';
|
|
7
|
+
import { GPUBufferBindingType } from '../../renderers/webgpu/utils/WebGPUConstants.js';
|
|
7
8
|
|
|
8
9
|
class StorageBufferNode extends BufferNode {
|
|
9
10
|
|
|
@@ -13,11 +14,16 @@ class StorageBufferNode extends BufferNode {
|
|
|
13
14
|
|
|
14
15
|
this.isStorageBufferNode = true;
|
|
15
16
|
|
|
17
|
+
this.access = GPUBufferBindingType.Storage;
|
|
18
|
+
|
|
16
19
|
this.bufferObject = false;
|
|
20
|
+
this.bufferCount = bufferCount;
|
|
17
21
|
|
|
18
22
|
this._attribute = null;
|
|
19
23
|
this._varying = null;
|
|
20
24
|
|
|
25
|
+
this.global = true;
|
|
26
|
+
|
|
21
27
|
if ( value.isStorageBufferAttribute !== true && value.isStorageInstancedBufferAttribute !== true ) {
|
|
22
28
|
|
|
23
29
|
// TOOD: Improve it, possibly adding a new property to the BufferAttribute to identify it as a storage buffer read-only attribute in Renderer
|
|
@@ -29,6 +35,30 @@ class StorageBufferNode extends BufferNode {
|
|
|
29
35
|
|
|
30
36
|
}
|
|
31
37
|
|
|
38
|
+
getHash( builder ) {
|
|
39
|
+
|
|
40
|
+
if ( this.bufferCount === 0 ) {
|
|
41
|
+
|
|
42
|
+
let bufferData = builder.globalCache.getData( this.value );
|
|
43
|
+
|
|
44
|
+
if ( bufferData === undefined ) {
|
|
45
|
+
|
|
46
|
+
bufferData = {
|
|
47
|
+
node: this
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
builder.globalCache.setData( this.value, bufferData );
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return bufferData.node.uuid;
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return this.uuid;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
32
62
|
getInputType( /*builder*/ ) {
|
|
33
63
|
|
|
34
64
|
return 'storageBuffer';
|
|
@@ -49,9 +79,27 @@ class StorageBufferNode extends BufferNode {
|
|
|
49
79
|
|
|
50
80
|
}
|
|
51
81
|
|
|
82
|
+
setAccess( value ) {
|
|
83
|
+
|
|
84
|
+
this.access = value;
|
|
85
|
+
|
|
86
|
+
return this;
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
toReadOnly() {
|
|
91
|
+
|
|
92
|
+
return this.setAccess( GPUBufferBindingType.ReadOnlyStorage );
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
52
96
|
generate( builder ) {
|
|
53
97
|
|
|
54
|
-
if ( builder.isAvailable( 'storageBuffer' ) )
|
|
98
|
+
if ( builder.isAvailable( 'storageBuffer' ) ) {
|
|
99
|
+
|
|
100
|
+
return super.generate( builder );
|
|
101
|
+
|
|
102
|
+
}
|
|
55
103
|
|
|
56
104
|
const nodeType = this.getNodeType( builder );
|
|
57
105
|
|
|
@@ -75,6 +123,7 @@ class StorageBufferNode extends BufferNode {
|
|
|
75
123
|
|
|
76
124
|
export default StorageBufferNode;
|
|
77
125
|
|
|
126
|
+
// Read-Write Storage
|
|
78
127
|
export const storage = ( value, type, count ) => nodeObject( new StorageBufferNode( value, type, count ) );
|
|
79
128
|
export const storageObject = ( value, type, count ) => nodeObject( new StorageBufferNode( value, type, count ).setBufferObject( true ) );
|
|
80
129
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { addNodeClass } from '../core/Node.js';
|
|
2
2
|
import TextureNode from './TextureNode.js';
|
|
3
3
|
import { nodeProxy } from '../shadernode/ShaderNode.js';
|
|
4
|
+
import { GPUStorageTextureAccess } from '../../renderers/webgpu/utils/WebGPUConstants.js';
|
|
4
5
|
|
|
5
|
-
class
|
|
6
|
+
class StorageTextureNode extends TextureNode {
|
|
6
7
|
|
|
7
8
|
constructor( value, uvNode, storeNode = null ) {
|
|
8
9
|
|
|
@@ -10,7 +11,9 @@ class TextureStoreNode extends TextureNode {
|
|
|
10
11
|
|
|
11
12
|
this.storeNode = storeNode;
|
|
12
13
|
|
|
13
|
-
this.
|
|
14
|
+
this.isStorageTextureNode = true;
|
|
15
|
+
|
|
16
|
+
this.access = GPUStorageTextureAccess.WriteOnly;
|
|
14
17
|
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -29,6 +32,13 @@ class TextureStoreNode extends TextureNode {
|
|
|
29
32
|
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
setAccess( value ) {
|
|
36
|
+
|
|
37
|
+
this.access = value;
|
|
38
|
+
return this;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
generate( builder, output ) {
|
|
33
43
|
|
|
34
44
|
let snippet;
|
|
@@ -47,6 +57,18 @@ class TextureStoreNode extends TextureNode {
|
|
|
47
57
|
|
|
48
58
|
}
|
|
49
59
|
|
|
60
|
+
toReadOnly() {
|
|
61
|
+
|
|
62
|
+
return this.setAccess( GPUStorageTextureAccess.ReadOnly );
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
toWriteOnly() {
|
|
67
|
+
|
|
68
|
+
return this.setAccess( GPUStorageTextureAccess.WriteOnly );
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
generateStore( builder ) {
|
|
51
73
|
|
|
52
74
|
const properties = builder.getNodeProperties( this );
|
|
@@ -65,13 +87,13 @@ class TextureStoreNode extends TextureNode {
|
|
|
65
87
|
|
|
66
88
|
}
|
|
67
89
|
|
|
68
|
-
export default
|
|
90
|
+
export default StorageTextureNode;
|
|
69
91
|
|
|
70
|
-
const
|
|
92
|
+
export const storageTexture = nodeProxy( StorageTextureNode );
|
|
71
93
|
|
|
72
94
|
export const textureStore = ( value, uvNode, storeNode ) => {
|
|
73
95
|
|
|
74
|
-
const node =
|
|
96
|
+
const node = storageTexture( value, uvNode, storeNode );
|
|
75
97
|
|
|
76
98
|
if ( storeNode !== null ) node.append();
|
|
77
99
|
|
|
@@ -79,4 +101,4 @@ export const textureStore = ( value, uvNode, storeNode ) => {
|
|
|
79
101
|
|
|
80
102
|
};
|
|
81
103
|
|
|
82
|
-
addNodeClass( '
|
|
104
|
+
addNodeClass( 'StorageTextureNode', StorageTextureNode );
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { attribute } from '../core/AttributeNode.js';
|
|
2
|
+
import { varying } from '../core/VaryingNode.js';
|
|
3
|
+
import { cameraViewMatrix } from './CameraNode.js';
|
|
4
|
+
import { modelViewMatrix } from './ModelNode.js';
|
|
5
|
+
import { tslFn, vec4 } from '../shadernode/ShaderNode.js';
|
|
6
|
+
|
|
7
|
+
export const tangentGeometry = /*#__PURE__*/ tslFn( ( stack, builder ) => {
|
|
8
|
+
|
|
9
|
+
if ( builder.geometry.hasAttribute( 'tangent' ) === false ) {
|
|
10
|
+
|
|
11
|
+
builder.geometry.computeTangents();
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return attribute( 'tangent', 'vec4' );
|
|
16
|
+
|
|
17
|
+
} )();
|
|
18
|
+
|
|
19
|
+
export const tangentLocal = /*#__PURE__*/ tangentGeometry.xyz.toVar( 'tangentLocal' );
|
|
20
|
+
export const tangentView = /*#__PURE__*/ varying( modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz, 'v_tangentView' ).normalize().toVar( 'tangentView' );
|
|
21
|
+
export const tangentWorld = /*#__PURE__*/ varying( tangentView.transformDirection( cameraViewMatrix ), 'v_tangentWorld' ).normalize().toVar( 'tangentWorld' );
|
|
22
|
+
export const transformedTangentView = /*#__PURE__*/ tangentView.toVar( 'transformedTangentView' );
|
|
23
|
+
export const transformedTangentWorld = /*#__PURE__*/ transformedTangentView.transformDirection( cameraViewMatrix ).normalize().toVar( 'transformedTangentWorld' );
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import TextureNode from './TextureNode.js';
|
|
2
|
+
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { nodeProxy, vec3, tslFn, If } from '../shadernode/ShaderNode.js';
|
|
4
|
+
|
|
5
|
+
const normal = tslFn( ( { texture, uv } ) => {
|
|
6
|
+
|
|
7
|
+
const epsilon = 0.0001;
|
|
8
|
+
|
|
9
|
+
const ret = vec3().temp();
|
|
10
|
+
|
|
11
|
+
If( uv.x.lessThan( epsilon ), () => {
|
|
12
|
+
|
|
13
|
+
ret.assign( vec3( 1, 0, 0 ) );
|
|
14
|
+
|
|
15
|
+
} ).elseif( uv.y.lessThan( epsilon ), () => {
|
|
16
|
+
|
|
17
|
+
ret.assign( vec3( 0, 1, 0 ) );
|
|
18
|
+
|
|
19
|
+
} ).elseif( uv.z.lessThan( epsilon ), () => {
|
|
20
|
+
|
|
21
|
+
ret.assign( vec3( 0, 0, 1 ) );
|
|
22
|
+
|
|
23
|
+
} ).elseif( uv.x.greaterThan( 1 - epsilon ), () => {
|
|
24
|
+
|
|
25
|
+
ret.assign( vec3( - 1, 0, 0 ) );
|
|
26
|
+
|
|
27
|
+
} ).elseif( uv.y.greaterThan( 1 - epsilon ), () => {
|
|
28
|
+
|
|
29
|
+
ret.assign( vec3( 0, - 1, 0 ) );
|
|
30
|
+
|
|
31
|
+
} ).elseif( uv.z.greaterThan( 1 - epsilon ), () => {
|
|
32
|
+
|
|
33
|
+
ret.assign( vec3( 0, 0, - 1 ) );
|
|
34
|
+
|
|
35
|
+
} ).else( () => {
|
|
36
|
+
|
|
37
|
+
const step = 0.01;
|
|
38
|
+
|
|
39
|
+
const x = texture.uv( uv.add( vec3( - step, 0.0, 0.0 ) ) ).r.sub( texture.uv( uv.add( vec3( step, 0.0, 0.0 ) ) ).r );
|
|
40
|
+
const y = texture.uv( uv.add( vec3( 0.0, - step, 0.0 ) ) ).r.sub( texture.uv( uv.add( vec3( 0.0, step, 0.0 ) ) ).r );
|
|
41
|
+
const z = texture.uv( uv.add( vec3( 0.0, 0.0, - step ) ) ).r.sub( texture.uv( uv.add( vec3( 0.0, 0.0, step ) ) ).r );
|
|
42
|
+
|
|
43
|
+
ret.assign( vec3( x, y, z ) );
|
|
44
|
+
|
|
45
|
+
} );
|
|
46
|
+
|
|
47
|
+
return ret.normalize();
|
|
48
|
+
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Texture3DNode extends TextureNode {
|
|
53
|
+
|
|
54
|
+
constructor( value, uvNode = null, levelNode = null ) {
|
|
55
|
+
|
|
56
|
+
super( value, uvNode, levelNode );
|
|
57
|
+
|
|
58
|
+
this.isTexture3DNode = true;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
getInputType( /*builder*/ ) {
|
|
63
|
+
|
|
64
|
+
return 'texture3D';
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getDefaultUV() {
|
|
69
|
+
|
|
70
|
+
return vec3( 0.5, 0.5, 0.5 );
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setUpdateMatrix( /*updateMatrix*/ ) { } // Ignore .updateMatrix for 3d TextureNode
|
|
75
|
+
|
|
76
|
+
setupUV( builder, uvNode ) {
|
|
77
|
+
|
|
78
|
+
return uvNode;
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
generateUV( builder, uvNode ) {
|
|
83
|
+
|
|
84
|
+
return uvNode.build( builder, 'vec3' );
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
normal( uvNode ) {
|
|
89
|
+
|
|
90
|
+
return normal( { texture: this, uv: uvNode } );
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default Texture3DNode;
|
|
97
|
+
|
|
98
|
+
export const texture3D = nodeProxy( Texture3DNode );
|
|
99
|
+
|
|
100
|
+
addNodeClass( 'Texture3DNode', Texture3DNode );
|
|
@@ -8,9 +8,11 @@ import { maxMipLevel } from '../utils/MaxMipLevelNode.js';
|
|
|
8
8
|
import { addNodeElement, nodeProxy, vec3, nodeObject } from '../shadernode/ShaderNode.js';
|
|
9
9
|
import { NodeUpdateType } from '../core/constants.js';
|
|
10
10
|
|
|
11
|
+
import { IntType, UnsignedIntType } from '../../constants.js';
|
|
12
|
+
|
|
11
13
|
class TextureNode extends UniformNode {
|
|
12
14
|
|
|
13
|
-
constructor( value, uvNode = null, levelNode = null ) {
|
|
15
|
+
constructor( value, uvNode = null, levelNode = null, biasNode = null ) {
|
|
14
16
|
|
|
15
17
|
super( value );
|
|
16
18
|
|
|
@@ -18,6 +20,7 @@ class TextureNode extends UniformNode {
|
|
|
18
20
|
|
|
19
21
|
this.uvNode = uvNode;
|
|
20
22
|
this.levelNode = levelNode;
|
|
23
|
+
this.biasNode = biasNode;
|
|
21
24
|
this.compareNode = null;
|
|
22
25
|
this.depthNode = null;
|
|
23
26
|
this.gradNode = null;
|
|
@@ -29,6 +32,7 @@ class TextureNode extends UniformNode {
|
|
|
29
32
|
this.referenceNode = null;
|
|
30
33
|
|
|
31
34
|
this._value = value;
|
|
35
|
+
this._matrixUniform = null;
|
|
32
36
|
|
|
33
37
|
this.setUpdateMatrix( uvNode === null );
|
|
34
38
|
|
|
@@ -64,6 +68,16 @@ class TextureNode extends UniformNode {
|
|
|
64
68
|
|
|
65
69
|
if ( this.value.isDepthTexture === true ) return 'float';
|
|
66
70
|
|
|
71
|
+
if ( this.value.type === UnsignedIntType ) {
|
|
72
|
+
|
|
73
|
+
return 'uvec4';
|
|
74
|
+
|
|
75
|
+
} else if ( this.value.type === IntType ) {
|
|
76
|
+
|
|
77
|
+
return 'ivec4';
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
67
81
|
return 'vec4';
|
|
68
82
|
|
|
69
83
|
}
|
|
@@ -88,9 +102,10 @@ class TextureNode extends UniformNode {
|
|
|
88
102
|
|
|
89
103
|
getTransformedUV( uvNode ) {
|
|
90
104
|
|
|
91
|
-
|
|
105
|
+
if ( this._matrixUniform === null ) this._matrixUniform = uniform( this.value.matrix );
|
|
106
|
+
|
|
107
|
+
return this._matrixUniform.mul( vec3( uvNode, 1 ) ).xy;
|
|
92
108
|
|
|
93
|
-
return uniform( texture.matrix ).mul( vec3( uvNode, 1 ) ).xy;
|
|
94
109
|
|
|
95
110
|
}
|
|
96
111
|
|
|
@@ -120,6 +135,7 @@ class TextureNode extends UniformNode {
|
|
|
120
135
|
setup( builder ) {
|
|
121
136
|
|
|
122
137
|
const properties = builder.getNodeProperties( this );
|
|
138
|
+
properties.referenceNode = this.referenceNode;
|
|
123
139
|
|
|
124
140
|
//
|
|
125
141
|
|
|
@@ -155,6 +171,7 @@ class TextureNode extends UniformNode {
|
|
|
155
171
|
|
|
156
172
|
properties.uvNode = uvNode;
|
|
157
173
|
properties.levelNode = levelNode;
|
|
174
|
+
properties.biasNode = this.biasNode;
|
|
158
175
|
properties.compareNode = this.compareNode;
|
|
159
176
|
properties.gradNode = this.gradNode;
|
|
160
177
|
properties.depthNode = this.depthNode;
|
|
@@ -167,7 +184,7 @@ class TextureNode extends UniformNode {
|
|
|
167
184
|
|
|
168
185
|
}
|
|
169
186
|
|
|
170
|
-
generateSnippet( builder, textureProperty, uvSnippet, levelSnippet, depthSnippet, compareSnippet, gradSnippet ) {
|
|
187
|
+
generateSnippet( builder, textureProperty, uvSnippet, levelSnippet, biasSnippet, depthSnippet, compareSnippet, gradSnippet ) {
|
|
171
188
|
|
|
172
189
|
const texture = this.value;
|
|
173
190
|
|
|
@@ -177,6 +194,10 @@ class TextureNode extends UniformNode {
|
|
|
177
194
|
|
|
178
195
|
snippet = builder.generateTextureLevel( texture, textureProperty, uvSnippet, levelSnippet, depthSnippet );
|
|
179
196
|
|
|
197
|
+
} else if ( biasSnippet ) {
|
|
198
|
+
|
|
199
|
+
snippet = builder.generateTextureBias( texture, textureProperty, uvSnippet, biasSnippet, depthSnippet );
|
|
200
|
+
|
|
180
201
|
} else if ( gradSnippet ) {
|
|
181
202
|
|
|
182
203
|
snippet = builder.generateTextureGrad( texture, textureProperty, uvSnippet, gradSnippet, depthSnippet );
|
|
@@ -229,10 +250,11 @@ class TextureNode extends UniformNode {
|
|
|
229
250
|
|
|
230
251
|
if ( propertyName === undefined ) {
|
|
231
252
|
|
|
232
|
-
const { uvNode, levelNode, compareNode, depthNode, gradNode } = properties;
|
|
253
|
+
const { uvNode, levelNode, biasNode, compareNode, depthNode, gradNode } = properties;
|
|
233
254
|
|
|
234
255
|
const uvSnippet = this.generateUV( builder, uvNode );
|
|
235
256
|
const levelSnippet = levelNode ? levelNode.build( builder, 'float' ) : null;
|
|
257
|
+
const biasSnippet = biasNode ? biasNode.build( builder, 'float' ) : null;
|
|
236
258
|
const depthSnippet = depthNode ? depthNode.build( builder, 'int' ) : null;
|
|
237
259
|
const compareSnippet = compareNode ? compareNode.build( builder, 'float' ) : null;
|
|
238
260
|
const gradSnippet = gradNode ? [ gradNode[ 0 ].build( builder, 'vec2' ), gradNode[ 1 ].build( builder, 'vec2' ) ] : null;
|
|
@@ -241,16 +263,12 @@ class TextureNode extends UniformNode {
|
|
|
241
263
|
|
|
242
264
|
propertyName = builder.getPropertyName( nodeVar );
|
|
243
265
|
|
|
244
|
-
const snippet = this.generateSnippet( builder, textureProperty, uvSnippet, levelSnippet, depthSnippet, compareSnippet, gradSnippet );
|
|
266
|
+
const snippet = this.generateSnippet( builder, textureProperty, uvSnippet, levelSnippet, biasSnippet, depthSnippet, compareSnippet, gradSnippet );
|
|
245
267
|
|
|
246
268
|
builder.addLineFlowCode( `${propertyName} = ${snippet}` );
|
|
247
269
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
nodeData.snippet = snippet;
|
|
251
|
-
nodeData.propertyName = propertyName;
|
|
252
|
-
|
|
253
|
-
}
|
|
270
|
+
nodeData.snippet = snippet;
|
|
271
|
+
nodeData.propertyName = propertyName;
|
|
254
272
|
|
|
255
273
|
}
|
|
256
274
|
|
|
@@ -288,17 +306,17 @@ class TextureNode extends UniformNode {
|
|
|
288
306
|
uv( uvNode ) {
|
|
289
307
|
|
|
290
308
|
const textureNode = this.clone();
|
|
291
|
-
textureNode.uvNode = uvNode;
|
|
309
|
+
textureNode.uvNode = nodeObject( uvNode );
|
|
292
310
|
textureNode.referenceNode = this;
|
|
293
311
|
|
|
294
312
|
return nodeObject( textureNode );
|
|
295
313
|
|
|
296
314
|
}
|
|
297
315
|
|
|
298
|
-
blur(
|
|
316
|
+
blur( amountNode ) {
|
|
299
317
|
|
|
300
318
|
const textureNode = this.clone();
|
|
301
|
-
textureNode.
|
|
319
|
+
textureNode.biasNode = nodeObject( amountNode ).mul( maxMipLevel( textureNode ) );
|
|
302
320
|
textureNode.referenceNode = this;
|
|
303
321
|
|
|
304
322
|
return nodeObject( textureNode );
|
|
@@ -308,10 +326,10 @@ class TextureNode extends UniformNode {
|
|
|
308
326
|
level( levelNode ) {
|
|
309
327
|
|
|
310
328
|
const textureNode = this.clone();
|
|
311
|
-
textureNode.levelNode = levelNode;
|
|
329
|
+
textureNode.levelNode = nodeObject( levelNode );
|
|
312
330
|
textureNode.referenceNode = this;
|
|
313
331
|
|
|
314
|
-
return textureNode;
|
|
332
|
+
return nodeObject( textureNode );
|
|
315
333
|
|
|
316
334
|
}
|
|
317
335
|
|
|
@@ -321,6 +339,16 @@ class TextureNode extends UniformNode {
|
|
|
321
339
|
|
|
322
340
|
}
|
|
323
341
|
|
|
342
|
+
bias( biasNode ) {
|
|
343
|
+
|
|
344
|
+
const textureNode = this.clone();
|
|
345
|
+
textureNode.biasNode = nodeObject( biasNode );
|
|
346
|
+
textureNode.referenceNode = this;
|
|
347
|
+
|
|
348
|
+
return nodeObject( textureNode );
|
|
349
|
+
|
|
350
|
+
}
|
|
351
|
+
|
|
324
352
|
compare( compareNode ) {
|
|
325
353
|
|
|
326
354
|
const textureNode = this.clone();
|
|
@@ -359,6 +387,9 @@ class TextureNode extends UniformNode {
|
|
|
359
387
|
super.serialize( data );
|
|
360
388
|
|
|
361
389
|
data.value = this.value.toJSON( data.meta ).uuid;
|
|
390
|
+
data.sampler = this.sampler;
|
|
391
|
+
data.updateMatrix = this.updateMatrix;
|
|
392
|
+
data.updateType = this.updateType;
|
|
362
393
|
|
|
363
394
|
}
|
|
364
395
|
|
|
@@ -367,12 +398,18 @@ class TextureNode extends UniformNode {
|
|
|
367
398
|
super.deserialize( data );
|
|
368
399
|
|
|
369
400
|
this.value = data.meta.textures[ data.value ];
|
|
401
|
+
this.sampler = data.sampler;
|
|
402
|
+
this.updateMatrix = data.updateMatrix;
|
|
403
|
+
this.updateType = data.updateType;
|
|
370
404
|
|
|
371
405
|
}
|
|
372
406
|
|
|
373
407
|
update() {
|
|
374
408
|
|
|
375
409
|
const texture = this.value;
|
|
410
|
+
const matrixUniform = this._matrixUniform;
|
|
411
|
+
|
|
412
|
+
if ( matrixUniform !== null ) matrixUniform.value = texture.matrix;
|
|
376
413
|
|
|
377
414
|
if ( texture.matrixAutoUpdate === true ) {
|
|
378
415
|
|
|
@@ -384,7 +421,7 @@ class TextureNode extends UniformNode {
|
|
|
384
421
|
|
|
385
422
|
clone() {
|
|
386
423
|
|
|
387
|
-
const newNode = new this.constructor( this.value, this.uvNode, this.levelNode );
|
|
424
|
+
const newNode = new this.constructor( this.value, this.uvNode, this.levelNode, this.biasNode );
|
|
388
425
|
newNode.sampler = this.sampler;
|
|
389
426
|
|
|
390
427
|
return newNode;
|