super-three 0.170.1 → 0.172.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 +1 -1
- package/build/three.cjs +157 -49
- package/build/three.core.js +104 -42
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +53 -8
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +10 -5
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +21191 -1008
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +21189 -1008
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -5
- package/examples/jsm/animation/CCDIKSolver.js +3 -2
- package/examples/jsm/controls/ArcballControls.js +28 -19
- package/examples/jsm/controls/OrbitControls.js +5 -4
- package/examples/jsm/csm/CSMShadowNode.js +16 -11
- package/examples/jsm/curves/NURBSCurve.js +1 -1
- package/examples/jsm/curves/NURBSUtils.js +3 -0
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +11 -7
- package/examples/jsm/exporters/KTX2Exporter.js +1 -1
- package/examples/jsm/exporters/PLYExporter.js +2 -2
- package/examples/jsm/helpers/TextureHelperGPU.js +15 -5
- package/examples/jsm/helpers/VertexNormalsHelper.js +2 -0
- package/examples/jsm/lights/LightProbeGenerator.js +3 -3
- package/examples/jsm/lines/webgpu/LineSegments2.js +15 -6
- package/examples/jsm/loaders/3MFLoader.js +6 -3
- package/examples/jsm/loaders/BVHLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +5 -5
- package/examples/jsm/loaders/DDSLoader.js +42 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +22 -2
- package/examples/jsm/loaders/KTX2Loader.js +6 -1
- package/examples/jsm/loaders/KTXLoader.js +4 -4
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MTLLoader.js +1 -0
- package/examples/jsm/loaders/NRRDLoader.js +1 -1
- package/examples/jsm/loaders/PLYLoader.js +7 -7
- package/examples/jsm/loaders/PVRLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +1 -1
- package/examples/jsm/loaders/VRMLLoader.js +7 -7
- package/examples/jsm/loaders/lwo/IFFParser.js +4 -4
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/OBB.js +17 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +10 -10
- package/examples/jsm/misc/Volume.js +20 -12
- package/examples/jsm/misc/VolumeSlice.js +2 -2
- package/examples/jsm/modifiers/CurveModifier.js +10 -8
- package/examples/jsm/modifiers/CurveModifierGPU.js +9 -7
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +4 -4
- package/examples/jsm/objects/Sky.js +2 -2
- package/examples/jsm/objects/SkyMesh.js +3 -3
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/objects/Water2Mesh.js +2 -2
- package/examples/jsm/objects/WaterMesh.js +4 -4
- package/examples/jsm/postprocessing/BloomPass.js +2 -2
- package/examples/jsm/postprocessing/EffectComposer.js +1 -2
- package/examples/jsm/postprocessing/OutlinePass.js +4 -4
- package/examples/jsm/postprocessing/SAOPass.js +1 -2
- package/examples/jsm/postprocessing/SMAAPass.js +1 -3
- package/examples/jsm/postprocessing/SSAOPass.js +2 -4
- package/examples/jsm/postprocessing/SSRPass.js +2 -4
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -2
- package/examples/jsm/renderers/SVGRenderer.js +6 -4
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/GodRaysShader.js +3 -3
- package/examples/jsm/shaders/SobelOperatorShader.js +1 -1
- package/examples/jsm/tsl/display/AfterImageNode.js +93 -4
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +46 -2
- package/examples/jsm/tsl/display/AnamorphicNode.js +118 -5
- package/examples/jsm/tsl/display/BleachBypass.js +10 -0
- package/examples/jsm/tsl/display/BloomNode.js +233 -26
- package/examples/jsm/tsl/display/DenoiseNode.js +141 -25
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +80 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +50 -5
- package/examples/jsm/tsl/display/FXAANode.js +52 -3
- package/examples/jsm/tsl/display/FilmNode.js +47 -1
- package/examples/jsm/tsl/display/GTAONode.js +210 -14
- package/examples/jsm/tsl/display/GaussianBlurNode.js +152 -8
- package/examples/jsm/tsl/display/LensflareNode.js +131 -13
- package/examples/jsm/tsl/display/Lut3DNode.js +55 -1
- package/examples/jsm/tsl/display/MotionBlur.js +12 -2
- package/examples/jsm/tsl/display/OutlineNode.js +343 -26
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +36 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +142 -9
- package/examples/jsm/tsl/display/RGBShiftNode.js +49 -2
- package/examples/jsm/tsl/display/SMAANode.js +187 -46
- package/examples/jsm/tsl/display/SSAAPassNode.js +110 -25
- package/examples/jsm/tsl/display/SSRNode.js +194 -21
- package/examples/jsm/tsl/display/Sepia.js +9 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +54 -4
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +79 -3
- package/examples/jsm/tsl/display/StereoPassNode.js +41 -3
- package/examples/jsm/tsl/display/TRAAPassNode.js +116 -21
- package/examples/jsm/tsl/display/TransitionNode.js +71 -6
- package/examples/jsm/tsl/display/hashBlur.js +14 -3
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +40 -34
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +22 -19
- package/examples/jsm/utils/SceneUtils.js +2 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +6 -1
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +8 -3
- package/src/Three.Core.js +2 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +9 -4
- package/src/Three.WebGPU.Nodes.js +2 -2
- package/src/Three.WebGPU.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/PerspectiveCamera.js +18 -2
- package/src/constants.js +1 -1
- package/src/core/RenderTarget.js +18 -0
- package/src/core/RenderTarget3D.js +22 -0
- package/src/core/RenderTargetArray.js +22 -0
- package/src/extras/Earcut.js +1 -1
- package/src/extras/PMREMGenerator.js +20 -0
- package/src/extras/TextureUtils.js +6 -0
- package/src/helpers/CameraHelper.js +16 -13
- package/src/loaders/nodes/NodeLoader.js +59 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
- package/src/loaders/nodes/NodeObjectLoader.js +61 -0
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +72 -19
- package/src/materials/nodes/Line2NodeMaterial.js +128 -34
- package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +78 -5
- package/src/materials/nodes/MeshBasicNodeMaterial.js +56 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +22 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +21 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +269 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +97 -6
- package/src/materials/nodes/MeshStandardNodeMaterial.js +78 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
- package/src/materials/nodes/NodeMaterial.js +474 -21
- package/src/materials/nodes/PointsNodeMaterial.js +22 -13
- package/src/materials/nodes/ShadowNodeMaterial.js +29 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +77 -19
- package/src/materials/nodes/VolumeNodeMaterial.js +80 -4
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -0
- package/src/nodes/Nodes.js +1 -6
- package/src/nodes/TSL.js +2 -3
- package/src/nodes/accessors/AccessorsUtils.js +27 -0
- package/src/nodes/accessors/Arrays.js +24 -5
- package/src/nodes/accessors/BatchNode.js +39 -3
- package/src/nodes/accessors/Bitangent.js +37 -0
- package/src/nodes/accessors/BufferAttributeNode.js +178 -5
- package/src/nodes/accessors/BufferNode.js +63 -0
- package/src/nodes/accessors/BuiltinNode.js +38 -0
- package/src/nodes/accessors/Camera.js +49 -0
- package/src/nodes/accessors/ClippingNode.js +71 -2
- package/src/nodes/accessors/CubeTextureNode.js +64 -0
- package/src/nodes/accessors/InstanceNode.js +85 -2
- package/src/nodes/accessors/InstancedMeshNode.js +28 -3
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +13 -0
- package/src/nodes/accessors/Lights.js +50 -1
- package/src/nodes/accessors/MaterialNode.js +302 -8
- package/src/nodes/accessors/MaterialProperties.js +7 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +53 -13
- package/src/nodes/accessors/ModelNode.js +100 -5
- package/src/nodes/accessors/ModelViewProjectionNode.js +10 -38
- package/src/nodes/accessors/MorphNode.js +48 -4
- package/src/nodes/accessors/Normal.js +59 -3
- package/src/nodes/accessors/Object3DNode.js +102 -1
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +53 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +188 -0
- package/src/nodes/accessors/ReferenceNode.js +202 -2
- package/src/nodes/accessors/ReflectVector.js +24 -0
- package/src/nodes/accessors/RendererReferenceNode.js +46 -1
- package/src/nodes/accessors/SceneNode.js +54 -0
- package/src/nodes/accessors/SkinningNode.js +127 -1
- package/src/nodes/accessors/StorageBufferNode.js +168 -4
- package/src/nodes/accessors/StorageTextureNode.js +118 -0
- package/src/nodes/accessors/Tangent.js +36 -0
- package/src/nodes/accessors/Texture3DNode.js +89 -5
- package/src/nodes/accessors/TextureBicubic.js +12 -2
- package/src/nodes/accessors/TextureNode.js +309 -10
- package/src/nodes/accessors/TextureSizeNode.js +42 -0
- package/src/nodes/accessors/UV.js +10 -1
- package/src/nodes/accessors/UniformArrayNode.js +223 -23
- package/src/nodes/accessors/UserDataNode.js +46 -0
- package/src/nodes/accessors/VelocityNode.js +82 -0
- package/src/nodes/accessors/VertexColorNode.js +39 -2
- package/src/nodes/code/CodeNode.js +95 -1
- package/src/nodes/code/ExpressionNode.js +28 -0
- package/src/nodes/code/FunctionCallNode.js +37 -0
- package/src/nodes/code/FunctionNode.js +45 -0
- package/src/nodes/code/ScriptableNode.js +223 -1
- package/src/nodes/code/ScriptableValueNode.js +85 -1
- package/src/nodes/core/AssignNode.js +48 -2
- package/src/nodes/core/AttributeNode.js +43 -0
- package/src/nodes/core/BypassNode.js +47 -2
- package/src/nodes/core/CacheNode.js +53 -2
- package/src/nodes/core/ConstNode.js +24 -0
- package/src/nodes/core/ContextNode.js +65 -0
- package/src/nodes/core/IndexNode.js +68 -7
- package/src/nodes/core/InputNode.js +48 -0
- package/src/nodes/core/LightingModel.js +60 -0
- package/src/nodes/core/MRTNode.js +66 -0
- package/src/nodes/core/Node.js +337 -12
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +945 -15
- package/src/nodes/core/NodeCache.js +41 -2
- package/src/nodes/core/NodeCode.js +31 -0
- package/src/nodes/core/NodeFrame.js +123 -2
- package/src/nodes/core/NodeFunction.js +46 -0
- package/src/nodes/core/NodeFunctionInput.js +44 -0
- package/src/nodes/core/NodeParser.js +11 -0
- package/src/nodes/core/NodeUniform.js +52 -0
- package/src/nodes/core/NodeUtils.js +141 -0
- package/src/nodes/core/NodeVar.js +30 -0
- package/src/nodes/core/NodeVarying.js +28 -0
- package/src/nodes/core/OutputStructNode.js +33 -2
- package/src/nodes/core/ParameterNode.js +28 -0
- package/src/nodes/core/PropertyNode.js +232 -0
- package/src/nodes/core/StackNode.js +78 -0
- package/src/nodes/core/StructTypeNode.js +39 -1
- package/src/nodes/core/TempNode.js +30 -4
- package/src/nodes/core/UniformGroupNode.js +82 -7
- package/src/nodes/core/UniformNode.js +66 -0
- package/src/nodes/core/VarNode.js +52 -0
- package/src/nodes/core/VaryingNode.js +83 -2
- package/src/nodes/core/constants.js +36 -0
- package/src/nodes/display/BumpMapNode.js +37 -0
- package/src/nodes/display/ColorAdjustment.js +53 -11
- package/src/nodes/display/ColorSpaceFunctions.js +16 -0
- package/src/nodes/display/ColorSpaceNode.js +82 -0
- package/src/nodes/display/FrontFacingNode.js +29 -0
- package/src/nodes/display/NormalMapNode.js +43 -0
- package/src/nodes/display/PassNode.js +298 -7
- package/src/nodes/display/PosterizeNode.js +33 -0
- package/src/nodes/display/RenderOutputNode.js +66 -1
- package/src/nodes/display/ScreenNode.js +87 -0
- package/src/nodes/display/ToneMappingFunctions.js +58 -10
- package/src/nodes/display/ToneMappingNode.js +55 -2
- package/src/nodes/display/ToonOutlinePassNode.js +73 -0
- package/src/nodes/display/ViewportDepthNode.js +122 -8
- package/src/nodes/display/ViewportDepthTextureNode.js +23 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +23 -0
- package/src/nodes/display/ViewportTextureNode.js +57 -0
- package/src/nodes/fog/Fog.js +93 -0
- package/src/nodes/functions/BasicLightingModel.js +24 -0
- package/src/nodes/functions/PhongLightingModel.js +34 -2
- package/src/nodes/functions/PhysicalLightingModel.js +167 -8
- package/src/nodes/functions/ShadowMaskModel.js +23 -0
- package/src/nodes/functions/ToonLightingModel.js +20 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +1 -3
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +16 -1
- package/src/nodes/geometry/RangeNode.js +54 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +157 -1
- package/src/nodes/gpgpu/BarrierNode.js +47 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +126 -0
- package/src/nodes/gpgpu/ComputeNode.js +106 -2
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +115 -6
- package/src/nodes/lighting/AONode.js +18 -0
- package/src/nodes/lighting/AmbientLightNode.js +10 -0
- package/src/nodes/lighting/AnalyticLightNode.js +97 -2
- package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
- package/src/nodes/lighting/BasicLightMapNode.js +17 -0
- package/src/nodes/lighting/DirectionalLightNode.js +10 -0
- package/src/nodes/lighting/EnvironmentNode.js +18 -0
- package/src/nodes/lighting/HemisphereLightNode.js +31 -0
- package/src/nodes/lighting/IESSpotLightNode.js +11 -0
- package/src/nodes/lighting/IrradianceNode.js +17 -0
- package/src/nodes/lighting/LightProbeNode.js +20 -0
- package/src/nodes/lighting/LightUtils.js +12 -0
- package/src/nodes/lighting/LightingContextNode.js +48 -0
- package/src/nodes/lighting/LightingNode.js +15 -6
- package/src/nodes/lighting/LightsNode.js +132 -1
- package/src/nodes/lighting/PointLightNode.js +32 -1
- package/src/nodes/lighting/PointShadowNode.js +54 -1
- package/src/nodes/lighting/RectAreaLightNode.js +44 -6
- package/src/nodes/lighting/ShadowBaseNode.js +93 -0
- package/src/nodes/lighting/ShadowNode.js +240 -34
- package/src/nodes/lighting/SpotLightNode.js +43 -0
- package/src/nodes/math/ConditionalNode.js +70 -3
- package/src/nodes/math/Hash.js +9 -0
- package/src/nodes/math/MathNode.js +614 -11
- package/src/nodes/math/MathUtils.js +45 -1
- package/src/nodes/math/OperatorNode.js +233 -0
- package/src/nodes/math/TriNoise3D.js +18 -7
- package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
- package/src/nodes/parsers/GLSLNodeParser.js +11 -0
- package/src/nodes/pmrem/PMREMNode.js +133 -0
- package/src/nodes/pmrem/PMREMUtils.js +1 -1
- package/src/nodes/procedural/Checker.js +9 -0
- package/src/nodes/tsl/TSLBase.js +2 -2
- package/src/nodes/utils/ArrayElementNode.js +38 -2
- package/src/nodes/utils/ConvertNode.js +31 -0
- package/src/nodes/utils/CubeMapNode.js +78 -0
- package/src/nodes/utils/Discard.js +16 -0
- package/src/nodes/utils/EquirectUVNode.js +31 -1
- package/src/nodes/utils/FlipNode.js +38 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +53 -1
- package/src/nodes/utils/JoinNode.js +25 -0
- package/src/nodes/utils/LoopNode.js +74 -1
- package/src/nodes/utils/MatcapUVNode.js +17 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -0
- package/src/nodes/utils/Oscillators.js +33 -0
- package/src/nodes/utils/Packing.js +17 -0
- package/src/nodes/utils/PostProcessingUtils.js +28 -23
- package/src/nodes/utils/RTTNode.js +123 -2
- package/src/nodes/utils/ReflectorNode.js +174 -4
- package/src/nodes/utils/RemapNode.js +79 -0
- package/src/nodes/utils/RotateNode.js +41 -0
- package/src/nodes/utils/SetNode.js +44 -1
- package/src/nodes/utils/SplitNode.js +55 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +46 -0
- package/src/nodes/utils/SpriteUtils.js +17 -0
- package/src/nodes/utils/StorageArrayElementNode.js +40 -0
- package/src/nodes/utils/Timer.js +19 -0
- package/src/nodes/utils/TriplanarTexturesNode.js +84 -0
- package/src/nodes/utils/UVUtils.js +20 -0
- package/src/nodes/utils/ViewportUtils.js +13 -0
- package/src/objects/BatchedMesh.js +1 -2
- package/src/objects/ClippingGroup.js +49 -0
- package/src/renderers/WebGLRenderer.js +23 -4
- package/src/renderers/common/Animation.js +63 -0
- package/src/renderers/common/Attributes.js +36 -0
- package/src/renderers/common/Backend.js +467 -52
- package/src/renderers/common/Background.js +34 -1
- package/src/renderers/common/BindGroup.js +43 -0
- package/src/renderers/common/Binding.js +35 -0
- package/src/renderers/common/Bindings.js +93 -1
- package/src/renderers/common/Buffer.js +49 -0
- package/src/renderers/common/BufferUtils.js +27 -0
- package/src/renderers/common/BundleGroup.js +57 -0
- package/src/renderers/common/ChainMap.js +38 -1
- package/src/renderers/common/ClippingContext.js +107 -14
- package/src/renderers/common/Color4.js +36 -0
- package/src/renderers/common/ComputePipeline.js +24 -0
- package/src/renderers/common/CubeRenderTarget.js +13 -0
- package/src/renderers/common/DataMap.js +37 -1
- package/src/renderers/common/Geometries.js +98 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +25 -2
- package/src/renderers/common/Info.js +87 -0
- package/src/renderers/common/Lighting.js +26 -0
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +148 -5
- package/src/renderers/common/PostProcessing.js +75 -3
- package/src/renderers/common/ProgrammableStage.js +60 -2
- package/src/renderers/common/QuadMesh.js +54 -5
- package/src/renderers/common/RenderBundle.js +14 -8
- package/src/renderers/common/RenderBundles.js +33 -10
- package/src/renderers/common/RenderContext.js +169 -4
- package/src/renderers/common/RenderContexts.js +42 -2
- package/src/renderers/common/RenderList.js +178 -0
- package/src/renderers/common/RenderLists.js +31 -0
- package/src/renderers/common/RenderObject.js +328 -4
- package/src/renderers/common/RenderObjects.js +101 -7
- package/src/renderers/common/RenderPipeline.js +24 -0
- package/src/renderers/common/Renderer.js +1096 -31
- package/src/renderers/common/RendererUtils.js +193 -0
- package/src/renderers/common/SampledTexture.js +121 -0
- package/src/renderers/common/Sampler.js +30 -0
- package/src/renderers/common/StorageBuffer.js +24 -0
- package/src/renderers/common/StorageBufferAttribute.js +31 -2
- package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
- package/src/renderers/common/StorageTexture.js +38 -0
- package/src/renderers/common/Textures.js +83 -0
- package/src/renderers/common/Uniform.js +188 -2
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +139 -2
- package/src/renderers/common/extras/PMREMGenerator.js +24 -3
- package/src/renderers/common/nodes/NodeBuilderState.js +95 -1
- package/src/renderers/common/nodes/NodeLibrary.js +89 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +91 -2
- package/src/renderers/common/nodes/NodeSampler.js +28 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +35 -0
- package/src/renderers/common/nodes/NodeUniform.js +189 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +29 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
- package/src/renderers/common/nodes/Nodes.js +327 -60
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +547 -29
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +0 -1
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +480 -49
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +34 -0
- package/src/renderers/webgpu/WebGPURenderer.js +35 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +20 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +21 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +59 -11
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +17 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +10 -8
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +5 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +30 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +7 -1
- package/src/textures/Data3DTexture.js +2 -2
- package/src/textures/Texture.js +4 -0
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1209
- package/examples/jsm/animation/MMDPhysics.js +0 -1408
- package/examples/jsm/exporters/MMDExporter.js +0 -223
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/MMDLoader.js +0 -2298
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/nodes/core/UniformGroup.js +0 -13
- package/src/nodes/fog/FogExp2Node.js +0 -35
- package/src/nodes/fog/FogNode.js +0 -50
- package/src/nodes/fog/FogRangeNode.js +0 -36
- package/src/renderers/common/PostProcessingUtils.js +0 -86
|
@@ -4,6 +4,16 @@ import { PointsMaterial } from '../PointsMaterial.js';
|
|
|
4
4
|
|
|
5
5
|
const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Node material version of `PointsMaterial`.
|
|
9
|
+
*
|
|
10
|
+
* Since WebGPU can render point primitives only with a size of one pixel,
|
|
11
|
+
* this material type does not evaluate the `size` and `sizeAttenuation`
|
|
12
|
+
* property of `PointsMaterial`. Use {@link InstancedPointsNodeMaterial}
|
|
13
|
+
* instead if you need points with a size larger than one pixel.
|
|
14
|
+
*
|
|
15
|
+
* @augments NodeMaterial
|
|
16
|
+
*/
|
|
7
17
|
class PointsNodeMaterial extends NodeMaterial {
|
|
8
18
|
|
|
9
19
|
static get type() {
|
|
@@ -12,31 +22,30 @@ class PointsNodeMaterial extends NodeMaterial {
|
|
|
12
22
|
|
|
13
23
|
}
|
|
14
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a new points node material.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object?} parameters - The configuration parameter.
|
|
29
|
+
*/
|
|
15
30
|
constructor( parameters ) {
|
|
16
31
|
|
|
17
32
|
super();
|
|
18
33
|
|
|
34
|
+
/**
|
|
35
|
+
* This flag can be used for type testing.
|
|
36
|
+
*
|
|
37
|
+
* @type {Boolean}
|
|
38
|
+
* @readonly
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
19
41
|
this.isPointsNodeMaterial = true;
|
|
20
42
|
|
|
21
|
-
this.lights = false;
|
|
22
|
-
this.transparent = true;
|
|
23
|
-
|
|
24
|
-
this.sizeNode = null;
|
|
25
|
-
|
|
26
43
|
this.setDefaultValues( _defaultValues );
|
|
27
44
|
|
|
28
45
|
this.setValues( parameters );
|
|
29
46
|
|
|
30
47
|
}
|
|
31
48
|
|
|
32
|
-
copy( source ) {
|
|
33
|
-
|
|
34
|
-
this.sizeNode = source.sizeNode;
|
|
35
|
-
|
|
36
|
-
return super.copy( source );
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
export default PointsNodeMaterial;
|
|
@@ -5,6 +5,11 @@ import { ShadowMaterial } from '../ShadowMaterial.js';
|
|
|
5
5
|
|
|
6
6
|
const _defaultValues = /*@__PURE__*/ new ShadowMaterial();
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Node material version of `ShadowMaterial`.
|
|
10
|
+
*
|
|
11
|
+
* @augments NodeMaterial
|
|
12
|
+
*/
|
|
8
13
|
class ShadowNodeMaterial extends NodeMaterial {
|
|
9
14
|
|
|
10
15
|
static get type() {
|
|
@@ -13,12 +18,31 @@ class ShadowNodeMaterial extends NodeMaterial {
|
|
|
13
18
|
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new shadow node material.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object?} parameters - The configuration parameter.
|
|
25
|
+
*/
|
|
16
26
|
constructor( parameters ) {
|
|
17
27
|
|
|
18
28
|
super();
|
|
19
29
|
|
|
30
|
+
/**
|
|
31
|
+
* This flag can be used for type testing.
|
|
32
|
+
*
|
|
33
|
+
* @type {Boolean}
|
|
34
|
+
* @readonly
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
20
37
|
this.isShadowNodeMaterial = true;
|
|
21
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Set to `true` because so it's possible to implement
|
|
41
|
+
* the shadow mask effect.
|
|
42
|
+
*
|
|
43
|
+
* @type {Boolean}
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
22
46
|
this.lights = true;
|
|
23
47
|
|
|
24
48
|
this.setDefaultValues( _defaultValues );
|
|
@@ -27,6 +51,11 @@ class ShadowNodeMaterial extends NodeMaterial {
|
|
|
27
51
|
|
|
28
52
|
}
|
|
29
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Setups the lighting model.
|
|
56
|
+
*
|
|
57
|
+
* @return {ShadowMaskModel} The lighting model.
|
|
58
|
+
*/
|
|
30
59
|
setupLightingModel( /*builder*/ ) {
|
|
31
60
|
|
|
32
61
|
return new ShadowMaskModel();
|
|
@@ -2,7 +2,7 @@ import NodeMaterial from './NodeMaterial.js';
|
|
|
2
2
|
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
3
3
|
import { materialRotation } from '../../nodes/accessors/MaterialNode.js';
|
|
4
4
|
import { modelViewMatrix, modelWorldMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
5
|
-
import {
|
|
5
|
+
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
6
6
|
import { rotate } from '../../nodes/utils/RotateNode.js';
|
|
7
7
|
import { float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
8
|
|
|
@@ -11,6 +11,11 @@ import { reference } from '../../nodes/accessors/ReferenceBaseNode.js';
|
|
|
11
11
|
|
|
12
12
|
const _defaultValues = /*@__PURE__*/ new SpriteMaterial();
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Node material version of `SpriteMaterial`.
|
|
16
|
+
*
|
|
17
|
+
* @augments NodeMaterial
|
|
18
|
+
*/
|
|
14
19
|
class SpriteNodeMaterial extends NodeMaterial {
|
|
15
20
|
|
|
16
21
|
static get type() {
|
|
@@ -19,17 +24,66 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
19
24
|
|
|
20
25
|
}
|
|
21
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new sprite node material.
|
|
29
|
+
*
|
|
30
|
+
* @param {Object?} parameters - The configuration parameter.
|
|
31
|
+
*/
|
|
22
32
|
constructor( parameters ) {
|
|
23
33
|
|
|
24
34
|
super();
|
|
25
35
|
|
|
36
|
+
/**
|
|
37
|
+
* This flag can be used for type testing.
|
|
38
|
+
*
|
|
39
|
+
* @type {Boolean}
|
|
40
|
+
* @readonly
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
26
43
|
this.isSpriteNodeMaterial = true;
|
|
27
44
|
|
|
28
|
-
this.lights = false;
|
|
29
45
|
this._useSizeAttenuation = true;
|
|
30
46
|
|
|
47
|
+
/**
|
|
48
|
+
* This property makes it possible to define the position of the sprite with a
|
|
49
|
+
* node. That can be useful when the material is used with instanced rendering
|
|
50
|
+
* and node data are defined with an instanced attribute node:
|
|
51
|
+
* ```js
|
|
52
|
+
* const positionAttribute = new InstancedBufferAttribute( new Float32Array( positions ), 3 );
|
|
53
|
+
* material.positionNode = instancedBufferAttribute( positionAttribute );
|
|
54
|
+
* ```
|
|
55
|
+
* Another possibility is to compute the instanced data with a compute shader:
|
|
56
|
+
* ```js
|
|
57
|
+
* const positionBuffer = instancedArray( particleCount, 'vec3' );
|
|
58
|
+
* particleMaterial.positionNode = positionBuffer.toAttribute();
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @type {Node<vec2>?}
|
|
62
|
+
* @default null
|
|
63
|
+
*/
|
|
31
64
|
this.positionNode = null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The rotation of sprite materials is by default inferred from the `rotation`,
|
|
68
|
+
* property. This node property allows to overwrite the default and define
|
|
69
|
+
* the rotation with a node instead.
|
|
70
|
+
*
|
|
71
|
+
* If you don't want to overwrite the rotation but modify the existing
|
|
72
|
+
* value instead, use {@link module:MaterialNode.materialRotation}.
|
|
73
|
+
*
|
|
74
|
+
* @type {Node<float>?}
|
|
75
|
+
* @default null
|
|
76
|
+
*/
|
|
32
77
|
this.rotationNode = null;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* This node property provides an additional way to scale sprites next to
|
|
81
|
+
* `Object3D.scale`. The scale transformation based in `Object3D.scale`
|
|
82
|
+
* is multiplied with the scale value of this node in the vertex shader.
|
|
83
|
+
*
|
|
84
|
+
* @type {Node<vec2>?}
|
|
85
|
+
* @default null
|
|
86
|
+
*/
|
|
33
87
|
this.scaleNode = null;
|
|
34
88
|
|
|
35
89
|
this.setDefaultValues( _defaultValues );
|
|
@@ -38,17 +92,22 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
38
92
|
|
|
39
93
|
}
|
|
40
94
|
|
|
41
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Setups the position node in view space. This method implements
|
|
97
|
+
* the sprite specific vertex shader.
|
|
98
|
+
*
|
|
99
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
100
|
+
* @return {Node<vec3>} The position in view space.
|
|
101
|
+
*/
|
|
102
|
+
setupPositionView( builder ) {
|
|
42
103
|
|
|
43
|
-
const
|
|
104
|
+
const { object, camera } = builder;
|
|
44
105
|
|
|
45
|
-
|
|
106
|
+
const sizeAttenuation = this.sizeAttenuation;
|
|
46
107
|
|
|
47
108
|
const { positionNode, rotationNode, scaleNode } = this;
|
|
48
109
|
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
let mvPosition = modelViewMatrix.mul( vec3( positionNode || 0 ) );
|
|
110
|
+
const mvPosition = modelViewMatrix.mul( vec3( positionNode || 0 ) );
|
|
52
111
|
|
|
53
112
|
let scale = vec2( modelWorldMatrix[ 0 ].xyz.length(), modelWorldMatrix[ 1 ].xyz.length() );
|
|
54
113
|
|
|
@@ -58,8 +117,7 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
58
117
|
|
|
59
118
|
}
|
|
60
119
|
|
|
61
|
-
|
|
62
|
-
if ( ! sizeAttenuation ) {
|
|
120
|
+
if ( sizeAttenuation === false ) {
|
|
63
121
|
|
|
64
122
|
if ( camera.isPerspectiveCamera ) {
|
|
65
123
|
|
|
@@ -74,11 +132,11 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
74
132
|
|
|
75
133
|
}
|
|
76
134
|
|
|
77
|
-
let alignedPosition =
|
|
135
|
+
let alignedPosition = positionGeometry.xy;
|
|
78
136
|
|
|
79
137
|
if ( object.center && object.center.isVector2 === true ) {
|
|
80
138
|
|
|
81
|
-
const center = reference( 'center', 'vec2' );
|
|
139
|
+
const center = reference( 'center', 'vec2', object );
|
|
82
140
|
|
|
83
141
|
alignedPosition = alignedPosition.sub( center.sub( 0.5 ) );
|
|
84
142
|
|
|
@@ -90,13 +148,7 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
90
148
|
|
|
91
149
|
const rotatedPosition = rotate( alignedPosition, rotation );
|
|
92
150
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const modelViewProjection = cameraProjectionMatrix.mul( mvPosition );
|
|
96
|
-
|
|
97
|
-
context.vertex = vertex;
|
|
98
|
-
|
|
99
|
-
return modelViewProjection;
|
|
151
|
+
return vec4( mvPosition.xy.add( rotatedPosition ), mvPosition.zw );
|
|
100
152
|
|
|
101
153
|
}
|
|
102
154
|
|
|
@@ -110,6 +162,12 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
110
162
|
|
|
111
163
|
}
|
|
112
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Whether to use size attenuation or not.
|
|
167
|
+
*
|
|
168
|
+
* @type {Boolean}
|
|
169
|
+
* @default true
|
|
170
|
+
*/
|
|
113
171
|
get sizeAttenuation() {
|
|
114
172
|
|
|
115
173
|
return this._useSizeAttenuation;
|
|
@@ -8,7 +8,16 @@ import { Fn, varying, float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js
|
|
|
8
8
|
import { min, max } from '../../nodes/math/MathNode.js';
|
|
9
9
|
import { Loop, Break } from '../../nodes/utils/LoopNode.js';
|
|
10
10
|
import { texture3D } from '../../nodes/accessors/Texture3DNode.js';
|
|
11
|
+
import { Color } from '../../math/Color.js';
|
|
11
12
|
|
|
13
|
+
/** @module VolumeNodeMaterial **/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Node material intended for volume rendering. The volumetic data are
|
|
17
|
+
* defined with an instance of {@link Data3DTexture}.
|
|
18
|
+
*
|
|
19
|
+
* @augments NodeMaterial
|
|
20
|
+
*/
|
|
12
21
|
class VolumeNodeMaterial extends NodeMaterial {
|
|
13
22
|
|
|
14
23
|
static get type() {
|
|
@@ -17,18 +26,85 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
17
26
|
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Constructs a new volume node material.
|
|
31
|
+
*
|
|
32
|
+
* @param {Object?} parameters - The configuration parameter.
|
|
33
|
+
*/
|
|
34
|
+
constructor( parameters ) {
|
|
21
35
|
|
|
22
36
|
super();
|
|
23
37
|
|
|
24
|
-
|
|
38
|
+
/**
|
|
39
|
+
* This flag can be used for type testing.
|
|
40
|
+
*
|
|
41
|
+
* @type {Boolean}
|
|
42
|
+
* @readonly
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
25
45
|
this.isVolumeNodeMaterial = true;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The base color of the volume.
|
|
49
|
+
*
|
|
50
|
+
* @type {Color}
|
|
51
|
+
* @default 100
|
|
52
|
+
*/
|
|
53
|
+
this.base = new Color( 0xffffff );
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A 3D data texture holding the volumetric data.
|
|
57
|
+
*
|
|
58
|
+
* @type {Data3DTexture?}
|
|
59
|
+
* @default null
|
|
60
|
+
*/
|
|
61
|
+
this.map = null;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This number of samples for each ray that hits the mesh's surface
|
|
65
|
+
* and travels through the volume.
|
|
66
|
+
*
|
|
67
|
+
* @type {Number}
|
|
68
|
+
* @default 100
|
|
69
|
+
*/
|
|
70
|
+
this.steps = 100;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Callback for {@link VolumeNodeMaterial#testNode}.
|
|
74
|
+
*
|
|
75
|
+
* @callback testNodeCallback
|
|
76
|
+
* @param {Data3DTexture<float>} map - The 3D texture.
|
|
77
|
+
* @param {Node<float>} mapValue - The sampled value inside the volume.
|
|
78
|
+
* @param {Node<vec3>} probe - The probe which is the entry point of the ray on the mesh's surface.
|
|
79
|
+
* @param {Node<vec4>} finalColor - The final color.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The volume rendering of this material works by shooting rays
|
|
84
|
+
* from the camera position through each fragment of the mesh's
|
|
85
|
+
* surface and sample the inner volume in a raymarching fashion
|
|
86
|
+
* mutiple times.
|
|
87
|
+
*
|
|
88
|
+
* This node can be used to assign a callback function of type `Fn`
|
|
89
|
+
* that will be exexuted per sample. The callback receives the
|
|
90
|
+
* texture, the sampled texture value as well as position on the surface
|
|
91
|
+
* where the rays enters the volume. The last parameter is a color
|
|
92
|
+
* that allows the callback to determine the final color.
|
|
93
|
+
*
|
|
94
|
+
* @type {testNodeCallback?}
|
|
95
|
+
* @default null
|
|
96
|
+
*/
|
|
26
97
|
this.testNode = null;
|
|
27
98
|
|
|
28
|
-
this.setValues(
|
|
99
|
+
this.setValues( parameters );
|
|
29
100
|
|
|
30
101
|
}
|
|
31
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Setups the vertex and fragment stage of this node material.
|
|
105
|
+
*
|
|
106
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
107
|
+
*/
|
|
32
108
|
setup( builder ) {
|
|
33
109
|
|
|
34
110
|
const map = texture3D( this.map, null, 0 );
|
|
@@ -75,7 +151,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
75
151
|
|
|
76
152
|
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
|
|
77
153
|
|
|
78
|
-
const d = property( 'float', 'd' ).assign( map.
|
|
154
|
+
const d = property( 'float', 'd' ).assign( map.sample( p.add( 0.5 ) ).r );
|
|
79
155
|
|
|
80
156
|
if ( this.testNode !== null ) {
|
|
81
157
|
|
|
@@ -51,18 +51,65 @@ const refreshUniforms = [
|
|
|
51
51
|
'transmissionMap'
|
|
52
52
|
];
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* This class is used by {@link WebGPURenderer} as management component.
|
|
56
|
+
* It's primary purpose is to determine whether render objects require a
|
|
57
|
+
* refresh right before they are going to be rendered or not.
|
|
58
|
+
*/
|
|
54
59
|
class NodeMaterialObserver {
|
|
55
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Constructs a new node material observer.
|
|
63
|
+
*
|
|
64
|
+
* @param {NodeBuilder} builder - The node builder.
|
|
65
|
+
*/
|
|
56
66
|
constructor( builder ) {
|
|
57
67
|
|
|
68
|
+
/**
|
|
69
|
+
* A node material can be used by more than one render object so the
|
|
70
|
+
* monitor must maintain a list of render objects.
|
|
71
|
+
*
|
|
72
|
+
* @type {WeakMap<RenderObject,Object>}
|
|
73
|
+
*/
|
|
58
74
|
this.renderObjects = new WeakMap();
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether the material uses node objects or not.
|
|
78
|
+
*
|
|
79
|
+
* @type {Boolean}
|
|
80
|
+
*/
|
|
59
81
|
this.hasNode = this.containsNode( builder );
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Whether the node builder's 3D object is animated or not.
|
|
85
|
+
*
|
|
86
|
+
* @type {Boolean}
|
|
87
|
+
*/
|
|
60
88
|
this.hasAnimation = builder.object.isSkinnedMesh === true;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A list of all possible material uniforms
|
|
92
|
+
*
|
|
93
|
+
* @type {Array<String>}
|
|
94
|
+
*/
|
|
61
95
|
this.refreshUniforms = refreshUniforms;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Holds the current render ID from the node frame.
|
|
99
|
+
*
|
|
100
|
+
* @type {Number}
|
|
101
|
+
* @default 0
|
|
102
|
+
*/
|
|
62
103
|
this.renderId = 0;
|
|
63
104
|
|
|
64
105
|
}
|
|
65
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Returns `true` if the given render object is verified for the first time of this observer.
|
|
109
|
+
*
|
|
110
|
+
* @param {RenderObject} renderObject - The render object.
|
|
111
|
+
* @return {Boolean} Whether the given render object is verified for the first time of this observer.
|
|
112
|
+
*/
|
|
66
113
|
firstInitialization( renderObject ) {
|
|
67
114
|
|
|
68
115
|
const hasInitialized = this.renderObjects.has( renderObject );
|
|
@@ -79,6 +126,12 @@ class NodeMaterialObserver {
|
|
|
79
126
|
|
|
80
127
|
}
|
|
81
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Returns monitoring data for the given render object.
|
|
131
|
+
*
|
|
132
|
+
* @param {RenderObject} renderObject - The render object.
|
|
133
|
+
* @return {Object} The monitoring data.
|
|
134
|
+
*/
|
|
82
135
|
getRenderObjectData( renderObject ) {
|
|
83
136
|
|
|
84
137
|
let data = this.renderObjects.get( renderObject );
|
|
@@ -132,6 +185,13 @@ class NodeMaterialObserver {
|
|
|
132
185
|
|
|
133
186
|
}
|
|
134
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Returns an attribute data structure holding the attributes versions for
|
|
190
|
+
* monitoring.
|
|
191
|
+
*
|
|
192
|
+
* @param {Object} attributes - The geometry attributes.
|
|
193
|
+
* @return {Object} An object for monitoring the versions of attributes.
|
|
194
|
+
*/
|
|
135
195
|
getAttributesData( attributes ) {
|
|
136
196
|
|
|
137
197
|
const attributesData = {};
|
|
@@ -150,6 +210,13 @@ class NodeMaterialObserver {
|
|
|
150
210
|
|
|
151
211
|
}
|
|
152
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Returns `true` if the node builder's material uses
|
|
215
|
+
* node properties.
|
|
216
|
+
*
|
|
217
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
218
|
+
* @return {Boolean} Whether the node builder's material uses node properties or not.
|
|
219
|
+
*/
|
|
153
220
|
containsNode( builder ) {
|
|
154
221
|
|
|
155
222
|
const material = builder.material;
|
|
@@ -168,6 +235,13 @@ class NodeMaterialObserver {
|
|
|
168
235
|
|
|
169
236
|
}
|
|
170
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Returns a material data structure holding the material property values for
|
|
240
|
+
* monitoring.
|
|
241
|
+
*
|
|
242
|
+
* @param {Material} material - The material.
|
|
243
|
+
* @return {Object} An object for monitoring material properties.
|
|
244
|
+
*/
|
|
171
245
|
getMaterialData( material ) {
|
|
172
246
|
|
|
173
247
|
const data = {};
|
|
@@ -202,6 +276,12 @@ class NodeMaterialObserver {
|
|
|
202
276
|
|
|
203
277
|
}
|
|
204
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Returns `true` if the given render object has not changed its state.
|
|
281
|
+
*
|
|
282
|
+
* @param {RenderObject} renderObject - The render object.
|
|
283
|
+
* @return {Boolean} Whether the given render object has changed its state or not.
|
|
284
|
+
*/
|
|
205
285
|
equals( renderObject ) {
|
|
206
286
|
|
|
207
287
|
const { object, material, geometry } = renderObject;
|
|
@@ -382,6 +462,13 @@ class NodeMaterialObserver {
|
|
|
382
462
|
|
|
383
463
|
}
|
|
384
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Checks if the given render object requires a refresh.
|
|
467
|
+
*
|
|
468
|
+
* @param {RenderObject} renderObject - The render object.
|
|
469
|
+
* @param {NodeFrame} nodeFrame - The current node frame.
|
|
470
|
+
* @return {Boolean} Whether the given render object requires a refresh or not.
|
|
471
|
+
*/
|
|
385
472
|
needsRefresh( renderObject, nodeFrame ) {
|
|
386
473
|
|
|
387
474
|
if ( this.hasNode || this.hasAnimation || this.firstInitialization( renderObject ) )
|
package/src/nodes/Nodes.js
CHANGED
|
@@ -67,7 +67,6 @@ export { default as MaterialReferenceNode } from './accessors/MaterialReferenceN
|
|
|
67
67
|
export { default as RendererReferenceNode } from './accessors/RendererReferenceNode.js';
|
|
68
68
|
export { default as MorphNode } from './accessors/MorphNode.js';
|
|
69
69
|
export { default as ModelNode } from './accessors/ModelNode.js';
|
|
70
|
-
export { default as ModelViewProjectionNode } from './accessors/ModelViewProjectionNode.js';
|
|
71
70
|
export { default as Object3DNode } from './accessors/Object3DNode.js';
|
|
72
71
|
export { default as PointUVNode } from './accessors/PointUVNode.js';
|
|
73
72
|
export { default as ReferenceNode } from './accessors/ReferenceNode.js';
|
|
@@ -104,11 +103,6 @@ export { default as FunctionNode } from './code/FunctionNode.js';
|
|
|
104
103
|
export { default as ScriptableNode } from './code/ScriptableNode.js';
|
|
105
104
|
export { default as ScriptableValueNode } from './code/ScriptableValueNode.js';
|
|
106
105
|
|
|
107
|
-
// fog
|
|
108
|
-
export { default as FogNode } from './fog/FogNode.js';
|
|
109
|
-
export { default as FogRangeNode } from './fog/FogRangeNode.js';
|
|
110
|
-
export { default as FogExp2Node } from './fog/FogExp2Node.js';
|
|
111
|
-
|
|
112
106
|
// geometry
|
|
113
107
|
export { default as RangeNode } from './geometry/RangeNode.js';
|
|
114
108
|
|
|
@@ -132,6 +126,7 @@ export { default as BasicEnvironmentNode } from './lighting/BasicEnvironmentNode
|
|
|
132
126
|
export { default as IrradianceNode } from './lighting/IrradianceNode.js';
|
|
133
127
|
export { default as AONode } from './lighting/AONode.js';
|
|
134
128
|
export { default as AnalyticLightNode } from './lighting/AnalyticLightNode.js';
|
|
129
|
+
export { default as ShadowBaseNode } from './lighting/ShadowBaseNode.js';
|
|
135
130
|
export { default as ShadowNode } from './lighting/ShadowNode.js';
|
|
136
131
|
|
|
137
132
|
// pmrem
|
package/src/nodes/TSL.js
CHANGED
|
@@ -115,9 +115,7 @@ export * from './code/ScriptableNode.js';
|
|
|
115
115
|
export * from './code/ScriptableValueNode.js';
|
|
116
116
|
|
|
117
117
|
// fog
|
|
118
|
-
export * from './fog/
|
|
119
|
-
export * from './fog/FogRangeNode.js';
|
|
120
|
-
export * from './fog/FogExp2Node.js';
|
|
118
|
+
export * from './fog/Fog.js';
|
|
121
119
|
|
|
122
120
|
// geometry
|
|
123
121
|
export * from './geometry/RangeNode.js';
|
|
@@ -133,6 +131,7 @@ export * from './gpgpu/AtomicFunctionNode.js';
|
|
|
133
131
|
export * from './accessors/Lights.js';
|
|
134
132
|
export * from './lighting/LightsNode.js';
|
|
135
133
|
export * from './lighting/LightingContextNode.js';
|
|
134
|
+
export * from './lighting/ShadowBaseNode.js';
|
|
136
135
|
export * from './lighting/ShadowNode.js';
|
|
137
136
|
export * from './lighting/PointLightNode.js';
|
|
138
137
|
|
|
@@ -6,11 +6,38 @@ import { mix } from '../math/MathNode.js';
|
|
|
6
6
|
import { anisotropy, anisotropyB, roughness } from '../core/PropertyNode.js';
|
|
7
7
|
import { positionViewDirection } from './Position.js';
|
|
8
8
|
|
|
9
|
+
/** @module AccessorsUtils **/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* TSL object that represents the TBN matrix in view space.
|
|
13
|
+
*
|
|
14
|
+
* @type {Node<mat3>}
|
|
15
|
+
*/
|
|
9
16
|
export const TBNViewMatrix = /*@__PURE__*/ mat3( tangentView, bitangentView, normalView );
|
|
10
17
|
|
|
18
|
+
/**
|
|
19
|
+
* TSL object that represents the parallax direction.
|
|
20
|
+
*
|
|
21
|
+
* @type {Node<mat3>}
|
|
22
|
+
*/
|
|
11
23
|
export const parallaxDirection = /*@__PURE__*/ positionViewDirection.mul( TBNViewMatrix )/*.normalize()*/;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* TSL function for computing parallax uv coordinates.
|
|
27
|
+
*
|
|
28
|
+
* @function
|
|
29
|
+
* @param {Node<vec2>} uv - A uv node.
|
|
30
|
+
* @param {Node<vec2>} scale - A scale node.
|
|
31
|
+
* @returns {Node<vec2>} Parallax uv coordinates.
|
|
32
|
+
*/
|
|
12
33
|
export const parallaxUV = ( uv, scale ) => uv.sub( parallaxDirection.mul( scale ) );
|
|
13
34
|
|
|
35
|
+
/**
|
|
36
|
+
* TSL function for computing bent normals.
|
|
37
|
+
*
|
|
38
|
+
* @function
|
|
39
|
+
* @returns {Node<vec3>} Bent normals.
|
|
40
|
+
*/
|
|
14
41
|
export const transformedBentNormalView = /*@__PURE__*/ ( () => {
|
|
15
42
|
|
|
16
43
|
// https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy
|
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
import StorageInstancedBufferAttribute from '../../renderers/common/StorageInstancedBufferAttribute.js';
|
|
2
2
|
import StorageBufferAttribute from '../../renderers/common/StorageBufferAttribute.js';
|
|
3
3
|
import { storage } from './StorageBufferNode.js';
|
|
4
|
-
import { getLengthFromType } from '../core/NodeUtils.js';
|
|
5
|
-
|
|
4
|
+
import { getLengthFromType, getTypedArrayFromType } from '../core/NodeUtils.js';
|
|
5
|
+
|
|
6
|
+
/** @module Arrays **/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* TSL function for creating a storage buffer node with a configured `StorageBufferAttribute`.
|
|
10
|
+
*
|
|
11
|
+
* @function
|
|
12
|
+
* @param {Number} count - The data count.
|
|
13
|
+
* @param {String} [type='float'] - The data type.
|
|
14
|
+
* @returns {StorageBufferNode}
|
|
15
|
+
*/
|
|
6
16
|
export const attributeArray = ( count, type = 'float' ) => {
|
|
7
17
|
|
|
8
18
|
const itemSize = getLengthFromType( type );
|
|
19
|
+
const typedArray = getTypedArrayFromType( type );
|
|
9
20
|
|
|
10
|
-
const buffer = new StorageBufferAttribute( count, itemSize );
|
|
21
|
+
const buffer = new StorageBufferAttribute( count, itemSize, typedArray );
|
|
11
22
|
const node = storage( buffer, type, count );
|
|
12
23
|
|
|
13
24
|
return node;
|
|
14
25
|
|
|
15
26
|
};
|
|
16
27
|
|
|
17
|
-
|
|
28
|
+
/**
|
|
29
|
+
* TSL function for creating a storage buffer node with a configured `StorageInstancedBufferAttribute`.
|
|
30
|
+
*
|
|
31
|
+
* @function
|
|
32
|
+
* @param {Number} count - The data count.
|
|
33
|
+
* @param {String} [type='float'] - The data type.
|
|
34
|
+
* @returns {StorageBufferNode}
|
|
35
|
+
*/
|
|
18
36
|
export const instancedArray = ( count, type = 'float' ) => {
|
|
19
37
|
|
|
20
38
|
const itemSize = getLengthFromType( type );
|
|
39
|
+
const typedArray = getTypedArrayFromType( type );
|
|
21
40
|
|
|
22
|
-
const buffer = new StorageInstancedBufferAttribute( count, itemSize );
|
|
41
|
+
const buffer = new StorageInstancedBufferAttribute( count, itemSize, typedArray );
|
|
23
42
|
const node = storage( buffer, type, count );
|
|
24
43
|
|
|
25
44
|
return node;
|