super-three 0.171.0 → 0.173.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/LICENSE +1 -1
- package/README.md +1 -1
- package/build/three.cjs +594 -427
- package/build/three.core.js +515 -81
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +79 -350
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +20 -7
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +29362 -3427
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +29361 -3427
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/jsm/Addons.js +0 -5
- package/examples/jsm/animation/CCDIKSolver.js +9 -7
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +48 -37
- 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 +34 -29
- package/examples/jsm/exporters/KTX2Exporter.js +1 -1
- package/examples/jsm/exporters/PLYExporter.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +1 -12
- package/examples/jsm/helpers/TextureHelperGPU.js +15 -5
- package/examples/jsm/helpers/VertexNormalsHelper.js +2 -0
- package/examples/jsm/interactive/InteractiveGroup.js +108 -51
- package/examples/jsm/libs/demuxer_mp4.js +109 -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 +4 -2
- package/examples/jsm/loaders/GLTFLoader.js +22 -4
- 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 -2
- 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/materials/MeshGouraudMaterial.js +2 -0
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/OBB.js +17 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +6 -7
- package/examples/jsm/misc/ProgressiveLightMap.js +4 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +14 -13
- package/examples/jsm/misc/Volume.js +27 -17
- package/examples/jsm/misc/VolumeSlice.js +7 -5
- 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 +29 -24
- package/examples/jsm/physics/JoltPhysics.js +7 -7
- package/examples/jsm/physics/RapierPhysics.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/OutputPass.js +2 -0
- 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/OutputShader.js +5 -1
- package/examples/jsm/shaders/SobelOperatorShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +2 -0
- 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 +4 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +18 -5
- 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/ArrayCamera.js +1 -0
- package/src/cameras/PerspectiveCamera.js +18 -2
- package/src/constants.js +6 -1
- package/src/core/BufferAttribute.js +4 -0
- package/src/core/EventDispatcher.js +8 -6
- 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/ImageUtils.js +1 -11
- 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/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 +476 -23
- package/src/materials/nodes/NodeMaterials.js +0 -1
- package/src/materials/nodes/PointsNodeMaterial.js +121 -10
- package/src/materials/nodes/ShadowNodeMaterial.js +29 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +78 -20
- package/src/materials/nodes/VolumeNodeMaterial.js +80 -4
- package/src/materials/nodes/manager/NodeMaterialObserver.js +95 -0
- package/src/nodes/Nodes.js +5 -6
- package/src/nodes/TSL.js +6 -3
- package/src/nodes/accessors/AccessorsUtils.js +27 -0
- package/src/nodes/accessors/Arrays.js +47 -6
- package/src/nodes/accessors/BatchNode.js +42 -6
- 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 +113 -3
- 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/Lights.js +50 -1
- package/src/nodes/accessors/MaterialNode.js +306 -12
- 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 +65 -5
- package/src/nodes/accessors/Object3DNode.js +101 -1
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +56 -7
- package/src/nodes/accessors/ReferenceBaseNode.js +186 -0
- package/src/nodes/accessors/ReferenceNode.js +201 -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 +209 -8
- package/src/nodes/accessors/StorageTextureNode.js +118 -0
- package/src/nodes/accessors/Tangent.js +38 -2
- package/src/nodes/accessors/Texture3DNode.js +91 -7
- package/src/nodes/accessors/TextureBicubic.js +12 -2
- package/src/nodes/accessors/TextureNode.js +316 -10
- package/src/nodes/accessors/TextureSizeNode.js +42 -0
- package/src/nodes/accessors/UV.js +10 -1
- package/src/nodes/accessors/UniformArrayNode.js +231 -25
- package/src/nodes/accessors/UserDataNode.js +46 -0
- package/src/nodes/accessors/VelocityNode.js +80 -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/ArrayNode.js +125 -0
- 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 +32 -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 +350 -12
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +1166 -26
- 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 +152 -1
- package/src/nodes/core/NodeVar.js +47 -1
- package/src/nodes/core/NodeVarying.js +28 -0
- package/src/nodes/core/OutputStructNode.js +51 -10
- package/src/nodes/core/ParameterNode.js +28 -0
- package/src/nodes/core/PropertyNode.js +232 -0
- package/src/nodes/core/StackNode.js +98 -1
- package/src/nodes/core/StructNode.js +121 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +105 -6
- package/src/nodes/core/TempNode.js +31 -5
- package/src/nodes/core/UniformGroupNode.js +82 -7
- package/src/nodes/core/UniformNode.js +66 -0
- package/src/nodes/core/VarNode.js +146 -7
- package/src/nodes/core/VaryingNode.js +100 -3
- package/src/nodes/core/constants.js +36 -0
- package/src/nodes/display/BlendModes.js +88 -1
- 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 +300 -7
- package/src/nodes/display/PosterizeNode.js +33 -0
- package/src/nodes/display/RenderOutputNode.js +66 -1
- package/src/nodes/display/ScreenNode.js +96 -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 +110 -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 +174 -2
- package/src/nodes/gpgpu/BarrierNode.js +47 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +134 -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 +241 -35
- package/src/nodes/lighting/SpotLightNode.js +43 -0
- package/src/nodes/math/ConditionalNode.js +78 -4
- package/src/nodes/math/Hash.js +9 -0
- package/src/nodes/math/MathNode.js +627 -11
- package/src/nodes/math/MathUtils.js +45 -1
- package/src/nodes/math/OperatorNode.js +329 -18
- 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 +2 -2
- package/src/nodes/procedural/Checker.js +9 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +3 -2
- package/src/nodes/tsl/TSLCore.js +22 -2
- package/src/nodes/utils/ArrayElementNode.js +39 -3
- 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 +82 -2
- package/src/nodes/utils/MatcapUVNode.js +17 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -0
- package/src/nodes/utils/MemberNode.js +68 -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 +54 -0
- package/src/nodes/utils/Timer.js +40 -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 +2 -3
- package/src/objects/ClippingGroup.js +49 -0
- package/src/objects/Line.js +6 -6
- package/src/renderers/WebGLRenderer.js +30 -4
- package/src/renderers/common/Animation.js +85 -0
- package/src/renderers/common/Attributes.js +36 -0
- package/src/renderers/common/Backend.js +502 -44
- package/src/renderers/common/Background.js +48 -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 +45 -6
- package/src/renderers/common/ClippingContext.js +108 -15
- package/src/renderers/common/Color4.js +40 -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 +91 -14
- package/src/renderers/common/IndirectStorageBufferAttribute.js +25 -2
- package/src/renderers/common/Info.js +78 -35
- package/src/renderers/common/Lighting.js +34 -6
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +148 -5
- package/src/renderers/common/PostProcessing.js +99 -11
- 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 +39 -10
- package/src/renderers/common/RenderContext.js +201 -2
- package/src/renderers/common/RenderContexts.js +59 -6
- package/src/renderers/common/RenderList.js +178 -0
- package/src/renderers/common/RenderLists.js +40 -3
- package/src/renderers/common/RenderObject.js +400 -17
- package/src/renderers/common/RenderObjects.js +103 -7
- package/src/renderers/common/RenderPipeline.js +24 -0
- package/src/renderers/common/Renderer.js +1170 -86
- package/src/renderers/common/RendererUtils.js +193 -0
- package/src/renderers/common/SampledTexture.js +120 -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 +97 -7
- package/src/renderers/common/TimestampQueryPool.js +39 -0
- package/src/renderers/common/Uniform.js +225 -3
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +141 -2
- package/src/renderers/common/XRManager.js +1193 -0
- package/src/renderers/common/XRRenderTarget.js +74 -0
- package/src/renderers/common/extras/PMREMGenerator.js +76 -10
- package/src/renderers/common/nodes/NodeBuilderState.js +99 -5
- package/src/renderers/common/nodes/NodeLibrary.js +89 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +90 -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 +243 -2
- 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 +352 -78
- 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/WebGLBackground.js +4 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +819 -116
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +347 -18
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +58 -1
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +323 -11
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +168 -22
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +43 -0
- package/src/renderers/webgpu/WebGPUBackend.js +578 -164
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +36 -0
- package/src/renderers/webgpu/WebGPURenderer.js +36 -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 +674 -52
- 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 +95 -14
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +94 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +102 -3
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +98 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +262 -18
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +274 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +116 -4
- package/src/renderers/webxr/WebXRDepthSensing.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +19 -2
- package/src/textures/Data3DTexture.js +2 -2
- package/src/textures/Texture.js +4 -0
- package/src/textures/VideoFrameTexture.js +35 -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/geometries/InstancedPointsGeometry.js +0 -176
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/MMDLoader.js +0 -2298
- package/examples/jsm/objects/InstancedPoints.js +0 -19
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -156
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -24
- 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,8 @@ import { Vector3 } from '../../math/Vector3.js';
|
|
|
4
4
|
import { cameraViewMatrix } from './Camera.js';
|
|
5
5
|
import { positionWorld } from './Position.js';
|
|
6
6
|
|
|
7
|
+
/** @module Lights **/
|
|
8
|
+
|
|
7
9
|
let uniformsLib;
|
|
8
10
|
|
|
9
11
|
function getLightData( light ) {
|
|
@@ -18,13 +20,24 @@ function getLightData( light ) {
|
|
|
18
20
|
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
/**
|
|
24
|
+
* TSL function for getting a shadow matrix uniform node for the given light.
|
|
25
|
+
*
|
|
26
|
+
* @function
|
|
27
|
+
* @param {Light} light -The light source.
|
|
28
|
+
* @returns {UniformNode<mat4>} The shadow matrix uniform node.
|
|
29
|
+
*/
|
|
21
30
|
export function lightShadowMatrix( light ) {
|
|
22
31
|
|
|
23
32
|
const data = getLightData( light );
|
|
24
33
|
|
|
25
34
|
return data.shadowMatrix || ( data.shadowMatrix = uniform( 'mat4' ).setGroup( renderGroup ).onRenderUpdate( () => {
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
if ( light.castShadow !== true ) {
|
|
37
|
+
|
|
38
|
+
light.shadow.updateMatrices( light );
|
|
39
|
+
|
|
40
|
+
}
|
|
28
41
|
|
|
29
42
|
return light.shadow.matrix;
|
|
30
43
|
|
|
@@ -32,6 +45,14 @@ export function lightShadowMatrix( light ) {
|
|
|
32
45
|
|
|
33
46
|
}
|
|
34
47
|
|
|
48
|
+
/**
|
|
49
|
+
* TSL function for getting projected uv coordinates for the given light.
|
|
50
|
+
* Relevant when using maps with spot lights.
|
|
51
|
+
*
|
|
52
|
+
* @function
|
|
53
|
+
* @param {Light} light -The light source.
|
|
54
|
+
* @returns {Node<vec3>} The projected uvs.
|
|
55
|
+
*/
|
|
35
56
|
export function lightProjectionUV( light ) {
|
|
36
57
|
|
|
37
58
|
const data = getLightData( light );
|
|
@@ -49,6 +70,13 @@ export function lightProjectionUV( light ) {
|
|
|
49
70
|
|
|
50
71
|
}
|
|
51
72
|
|
|
73
|
+
/**
|
|
74
|
+
* TSL function for getting the position in world space for the given light.
|
|
75
|
+
*
|
|
76
|
+
* @function
|
|
77
|
+
* @param {Light} light -The light source.
|
|
78
|
+
* @returns {UniformNode<vec3>} The light's position in world space.
|
|
79
|
+
*/
|
|
52
80
|
export function lightPosition( light ) {
|
|
53
81
|
|
|
54
82
|
const data = getLightData( light );
|
|
@@ -57,6 +85,13 @@ export function lightPosition( light ) {
|
|
|
57
85
|
|
|
58
86
|
}
|
|
59
87
|
|
|
88
|
+
/**
|
|
89
|
+
* TSL function for getting the light target position in world space for the given light.
|
|
90
|
+
*
|
|
91
|
+
* @function
|
|
92
|
+
* @param {Light} light -The light source.
|
|
93
|
+
* @returns {UniformNode<vec3>} The light target position in world space.
|
|
94
|
+
*/
|
|
60
95
|
export function lightTargetPosition( light ) {
|
|
61
96
|
|
|
62
97
|
const data = getLightData( light );
|
|
@@ -65,6 +100,13 @@ export function lightTargetPosition( light ) {
|
|
|
65
100
|
|
|
66
101
|
}
|
|
67
102
|
|
|
103
|
+
/**
|
|
104
|
+
* TSL function for getting the position in view space for the given light.
|
|
105
|
+
*
|
|
106
|
+
* @function
|
|
107
|
+
* @param {Light} light -The light source.
|
|
108
|
+
* @returns {UniformNode<vec3>} The light's position in view space.
|
|
109
|
+
*/
|
|
68
110
|
export function lightViewPosition( light ) {
|
|
69
111
|
|
|
70
112
|
const data = getLightData( light );
|
|
@@ -80,4 +122,11 @@ export function lightViewPosition( light ) {
|
|
|
80
122
|
|
|
81
123
|
}
|
|
82
124
|
|
|
125
|
+
/**
|
|
126
|
+
* TSL function for getting the light target direction for the given light.
|
|
127
|
+
*
|
|
128
|
+
* @function
|
|
129
|
+
* @param {Light} light -The light source.
|
|
130
|
+
* @returns {Node<vec3>} The light's target direction.
|
|
131
|
+
*/
|
|
83
132
|
export const lightTargetDirection = ( light ) => cameraViewMatrix.transformDirection( lightPosition( light ).sub( lightTargetPosition( light ) ) );
|
|
@@ -6,11 +6,20 @@ import { nodeImmutable, float, vec2, vec3, mat2 } from '../tsl/TSLBase.js';
|
|
|
6
6
|
import { uniform } from '../core/UniformNode.js';
|
|
7
7
|
import { normalMap } from '../display/NormalMapNode.js';
|
|
8
8
|
import { bumpMap } from '../display/BumpMapNode.js';
|
|
9
|
-
|
|
10
9
|
import { Vector2 } from '../../math/Vector2.js';
|
|
11
10
|
|
|
11
|
+
/** @module MaterialNode **/
|
|
12
|
+
|
|
12
13
|
const _propertyCache = new Map();
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* This class should simplify the node access to material properties.
|
|
17
|
+
* It internal uses reference nodes to make sure changes to material
|
|
18
|
+
* properties are automatically reflected to predefined TSL objects
|
|
19
|
+
* like e.g. `materialColor`.
|
|
20
|
+
*
|
|
21
|
+
* @augments Node
|
|
22
|
+
*/
|
|
14
23
|
class MaterialNode extends Node {
|
|
15
24
|
|
|
16
25
|
static get type() {
|
|
@@ -19,14 +28,31 @@ class MaterialNode extends Node {
|
|
|
19
28
|
|
|
20
29
|
}
|
|
21
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new material node.
|
|
33
|
+
*
|
|
34
|
+
* @param {String} scope - The scope defines what kind of material property is referred by the node.
|
|
35
|
+
*/
|
|
22
36
|
constructor( scope ) {
|
|
23
37
|
|
|
24
38
|
super();
|
|
25
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The scope defines what material property is referred by the node.
|
|
42
|
+
*
|
|
43
|
+
* @type {String}
|
|
44
|
+
*/
|
|
26
45
|
this.scope = scope;
|
|
27
46
|
|
|
28
47
|
}
|
|
29
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Returns a cached reference node for the given property and type.
|
|
51
|
+
*
|
|
52
|
+
* @param {String} property - The name of the material property.
|
|
53
|
+
* @param {String} type - The uniform type of the property.
|
|
54
|
+
* @return {MaterialReferenceNode} A material reference node representing the property access.
|
|
55
|
+
*/
|
|
30
56
|
getCache( property, type ) {
|
|
31
57
|
|
|
32
58
|
let node = _propertyCache.get( property );
|
|
@@ -43,24 +69,49 @@ class MaterialNode extends Node {
|
|
|
43
69
|
|
|
44
70
|
}
|
|
45
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Returns a float-typed material reference node for the given property name.
|
|
74
|
+
*
|
|
75
|
+
* @param {String} property - The name of the material property.
|
|
76
|
+
* @return {MaterialReferenceNode<float>} A material reference node representing the property access.
|
|
77
|
+
*/
|
|
46
78
|
getFloat( property ) {
|
|
47
79
|
|
|
48
80
|
return this.getCache( property, 'float' );
|
|
49
81
|
|
|
50
82
|
}
|
|
51
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Returns a color-typed material reference node for the given property name.
|
|
86
|
+
*
|
|
87
|
+
* @param {String} property - The name of the material property.
|
|
88
|
+
* @return {MaterialReferenceNode<color>} A material reference node representing the property access.
|
|
89
|
+
*/
|
|
52
90
|
getColor( property ) {
|
|
53
91
|
|
|
54
92
|
return this.getCache( property, 'color' );
|
|
55
93
|
|
|
56
94
|
}
|
|
57
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Returns a texture-typed material reference node for the given property name.
|
|
98
|
+
*
|
|
99
|
+
* @param {String} property - The name of the material property.
|
|
100
|
+
* @return {MaterialReferenceNode} A material reference node representing the property access.
|
|
101
|
+
*/
|
|
58
102
|
getTexture( property ) {
|
|
59
103
|
|
|
60
104
|
return this.getCache( property === 'map' ? 'map' : property + 'Map', 'texture' );
|
|
61
105
|
|
|
62
106
|
}
|
|
63
107
|
|
|
108
|
+
/**
|
|
109
|
+
* The node setup is done depending on the selected scope. Multiple material properties
|
|
110
|
+
* might be grouped into a single node composition if they logically belong together.
|
|
111
|
+
*
|
|
112
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
113
|
+
* @return {Node} The node representing the selected scope.
|
|
114
|
+
*/
|
|
64
115
|
setup( builder ) {
|
|
65
116
|
|
|
66
117
|
const material = builder.context.material;
|
|
@@ -110,15 +161,15 @@ class MaterialNode extends Node {
|
|
|
110
161
|
|
|
111
162
|
} else if ( scope === MaterialNode.SPECULAR_INTENSITY ) {
|
|
112
163
|
|
|
113
|
-
const
|
|
164
|
+
const specularIntensityNode = this.getFloat( scope );
|
|
114
165
|
|
|
115
|
-
if ( material.
|
|
166
|
+
if ( material.specularIntensityMap && material.specularIntensityMap.isTexture === true ) {
|
|
116
167
|
|
|
117
|
-
node =
|
|
168
|
+
node = specularIntensityNode.mul( this.getTexture( scope ).a );
|
|
118
169
|
|
|
119
170
|
} else {
|
|
120
171
|
|
|
121
|
-
node =
|
|
172
|
+
node = specularIntensityNode;
|
|
122
173
|
|
|
123
174
|
}
|
|
124
175
|
|
|
@@ -333,7 +384,7 @@ class MaterialNode extends Node {
|
|
|
333
384
|
|
|
334
385
|
node = this.getTexture( scope ).rgb.mul( this.getFloat( 'lightMapIntensity' ) );
|
|
335
386
|
|
|
336
|
-
} else if ( scope === MaterialNode.
|
|
387
|
+
} else if ( scope === MaterialNode.AO ) {
|
|
337
388
|
|
|
338
389
|
node = this.getTexture( scope ).r.sub( 1.0 ).mul( this.getFloat( 'aoMapIntensity' ) ).add( 1.0 );
|
|
339
390
|
|
|
@@ -384,52 +435,295 @@ MaterialNode.LINE_DASH_SIZE = 'dashSize';
|
|
|
384
435
|
MaterialNode.LINE_GAP_SIZE = 'gapSize';
|
|
385
436
|
MaterialNode.LINE_WIDTH = 'linewidth';
|
|
386
437
|
MaterialNode.LINE_DASH_OFFSET = 'dashOffset';
|
|
387
|
-
MaterialNode.
|
|
438
|
+
MaterialNode.POINT_SIZE = 'size';
|
|
388
439
|
MaterialNode.DISPERSION = 'dispersion';
|
|
389
440
|
MaterialNode.LIGHT_MAP = 'light';
|
|
390
|
-
MaterialNode.
|
|
441
|
+
MaterialNode.AO = 'ao';
|
|
391
442
|
|
|
392
443
|
export default MaterialNode;
|
|
393
444
|
|
|
445
|
+
/**
|
|
446
|
+
* TSL object that represents alpha test of the current material.
|
|
447
|
+
*
|
|
448
|
+
* @type {Node<float>}
|
|
449
|
+
*/
|
|
394
450
|
export const materialAlphaTest = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ALPHA_TEST );
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* TSL object that represents the diffuse color of the current material.
|
|
454
|
+
* The value is composed via `color` * `map`.
|
|
455
|
+
*
|
|
456
|
+
* @type {Node<vec3>}
|
|
457
|
+
*/
|
|
395
458
|
export const materialColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.COLOR );
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* TSL object that represents the shininess of the current material.
|
|
462
|
+
*
|
|
463
|
+
* @type {Node<float>}
|
|
464
|
+
*/
|
|
396
465
|
export const materialShininess = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHININESS );
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* TSL object that represents the emissive color of the current material.
|
|
469
|
+
* The value is composed via `emissive` * `emissiveIntensity` * `emissiveMap`.
|
|
470
|
+
*
|
|
471
|
+
* @type {Node<vec3>}
|
|
472
|
+
*/
|
|
397
473
|
export const materialEmissive = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.EMISSIVE );
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* TSL object that represents the opacity of the current material.
|
|
477
|
+
* The value is composed via `opacity` * `alphaMap`.
|
|
478
|
+
*
|
|
479
|
+
* @type {Node<float>}
|
|
480
|
+
*/
|
|
398
481
|
export const materialOpacity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.OPACITY );
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* TSL object that represents the specular of the current material.
|
|
485
|
+
*
|
|
486
|
+
* @type {Node<vec3>}
|
|
487
|
+
*/
|
|
399
488
|
export const materialSpecular = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR );
|
|
400
489
|
|
|
490
|
+
/**
|
|
491
|
+
* TSL object that represents the specular intensity of the current material.
|
|
492
|
+
* The value is composed via `specularIntensity` * `specularMap.a`.
|
|
493
|
+
*
|
|
494
|
+
* @type {Node<float>}
|
|
495
|
+
*/
|
|
401
496
|
export const materialSpecularIntensity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_INTENSITY );
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* TSL object that represents the specular color of the current material.
|
|
500
|
+
* The value is composed via `specularColor` * `specularMap.rgb`.
|
|
501
|
+
*
|
|
502
|
+
* @type {Node<vec3>}
|
|
503
|
+
*/
|
|
402
504
|
export const materialSpecularColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_COLOR );
|
|
403
505
|
|
|
506
|
+
/**
|
|
507
|
+
* TSL object that represents the specular strength of the current material.
|
|
508
|
+
* The value is composed via `specularMap.r`.
|
|
509
|
+
*
|
|
510
|
+
* @type {Node<float>}
|
|
511
|
+
*/
|
|
404
512
|
export const materialSpecularStrength = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SPECULAR_STRENGTH );
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* TSL object that represents the reflectivity of the current material.
|
|
516
|
+
*
|
|
517
|
+
* @type {Node<float>}
|
|
518
|
+
*/
|
|
405
519
|
export const materialReflectivity = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.REFLECTIVITY );
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* TSL object that represents the roughness of the current material.
|
|
523
|
+
* The value is composed via `roughness` * `roughnessMap.g`.
|
|
524
|
+
*
|
|
525
|
+
* @type {Node<float>}
|
|
526
|
+
*/
|
|
406
527
|
export const materialRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ROUGHNESS );
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* TSL object that represents the metalness of the current material.
|
|
531
|
+
* The value is composed via `metalness` * `metalnessMap.b`.
|
|
532
|
+
*
|
|
533
|
+
* @type {Node<float>}
|
|
534
|
+
*/
|
|
407
535
|
export const materialMetalness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.METALNESS );
|
|
408
|
-
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* TSL object that represents the normal of the current material.
|
|
539
|
+
* The value will be either `normalMap` * `normalScale`, `bumpMap` * `bumpScale` or `normalView`.
|
|
540
|
+
*
|
|
541
|
+
* @type {Node<vec3>}
|
|
542
|
+
*/
|
|
543
|
+
export const materialNormal = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.NORMAL );
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* TSL object that represents the clearcoat of the current material.
|
|
547
|
+
* The value is composed via `clearcoat` * `clearcoatMap.r`
|
|
548
|
+
*
|
|
549
|
+
* @type {Node<float>}
|
|
550
|
+
*/
|
|
409
551
|
export const materialClearcoat = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT );
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* TSL object that represents the clearcoat roughness of the current material.
|
|
555
|
+
* The value is composed via `clearcoatRoughness` * `clearcoatRoughnessMap.r`.
|
|
556
|
+
*
|
|
557
|
+
* @type {Node<float>}
|
|
558
|
+
*/
|
|
410
559
|
export const materialClearcoatRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS );
|
|
411
|
-
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* TSL object that represents the clearcoat normal of the current material.
|
|
563
|
+
* The value will be either `clearcoatNormalMap` or `normalView`.
|
|
564
|
+
*
|
|
565
|
+
* @type {Node<vec3>}
|
|
566
|
+
*/
|
|
567
|
+
export const materialClearcoatNormal = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_NORMAL );
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* TSL object that represents the rotation of the current sprite material.
|
|
571
|
+
*
|
|
572
|
+
* @type {Node<float>}
|
|
573
|
+
*/
|
|
412
574
|
export const materialRotation = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ROTATION );
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* TSL object that represents the sheen color of the current material.
|
|
578
|
+
* The value is composed via `sheen` * `sheenColor` * `sheenColorMap`.
|
|
579
|
+
*
|
|
580
|
+
* @type {Node<vec3>}
|
|
581
|
+
*/
|
|
413
582
|
export const materialSheen = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHEEN );
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* TSL object that represents the sheen roughness of the current material.
|
|
586
|
+
* The value is composed via `sheenRoughness` * `sheenRoughnessMap.a`.
|
|
587
|
+
*
|
|
588
|
+
* @type {Node<float>}
|
|
589
|
+
*/
|
|
414
590
|
export const materialSheenRoughness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.SHEEN_ROUGHNESS );
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* TSL object that represents the anisotropy of the current material.
|
|
594
|
+
*
|
|
595
|
+
* @type {Node<vec2>}
|
|
596
|
+
*/
|
|
415
597
|
export const materialAnisotropy = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ANISOTROPY );
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* TSL object that represents the iridescence of the current material.
|
|
601
|
+
*
|
|
602
|
+
* @type {Node<float>}
|
|
603
|
+
*/
|
|
416
604
|
export const materialIridescence = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE );
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* TSL object that represents the iridescence IOR of the current material.
|
|
608
|
+
*
|
|
609
|
+
* @type {Node<float>}
|
|
610
|
+
*/
|
|
417
611
|
export const materialIridescenceIOR = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_IOR );
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* TSL object that represents the iridescence thickness of the current material.
|
|
615
|
+
*
|
|
616
|
+
* @type {Node<float>}
|
|
617
|
+
*/
|
|
418
618
|
export const materialIridescenceThickness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS );
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* TSL object that represents the transmission of the current material.
|
|
622
|
+
* The value is composed via `transmission` * `transmissionMap.r`.
|
|
623
|
+
*
|
|
624
|
+
* @type {Node<float>}
|
|
625
|
+
*/
|
|
419
626
|
export const materialTransmission = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.TRANSMISSION );
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* TSL object that represents the thickness of the current material.
|
|
630
|
+
* The value is composed via `thickness` * `thicknessMap.g`.
|
|
631
|
+
*
|
|
632
|
+
* @type {Node<float>}
|
|
633
|
+
*/
|
|
420
634
|
export const materialThickness = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.THICKNESS );
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* TSL object that represents the IOR of the current material.
|
|
638
|
+
*
|
|
639
|
+
* @type {Node<float>}
|
|
640
|
+
*/
|
|
421
641
|
export const materialIOR = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.IOR );
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* TSL object that represents the attenuation distance of the current material.
|
|
645
|
+
*
|
|
646
|
+
* @type {Node<float>}
|
|
647
|
+
*/
|
|
422
648
|
export const materialAttenuationDistance = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_DISTANCE );
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* TSL object that represents the attenuation color of the current material.
|
|
652
|
+
*
|
|
653
|
+
* @type {Node<vec3>}
|
|
654
|
+
*/
|
|
423
655
|
export const materialAttenuationColor = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.ATTENUATION_COLOR );
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* TSL object that represents the scale of the current dashed line material.
|
|
659
|
+
*
|
|
660
|
+
* @type {Node<float>}
|
|
661
|
+
*/
|
|
424
662
|
export const materialLineScale = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_SCALE );
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* TSL object that represents the dash size of the current dashed line material.
|
|
666
|
+
*
|
|
667
|
+
* @type {Node<float>}
|
|
668
|
+
*/
|
|
425
669
|
export const materialLineDashSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_SIZE );
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* TSL object that represents the gap size of the current dashed line material.
|
|
673
|
+
*
|
|
674
|
+
* @type {Node<float>}
|
|
675
|
+
*/
|
|
426
676
|
export const materialLineGapSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_GAP_SIZE );
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* TSL object that represents the line width of the current line material.
|
|
680
|
+
*
|
|
681
|
+
* @type {Node<float>}
|
|
682
|
+
*/
|
|
427
683
|
export const materialLineWidth = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_WIDTH );
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* TSL object that represents the dash offset of the current line material.
|
|
687
|
+
*
|
|
688
|
+
* @type {Node<float>}
|
|
689
|
+
*/
|
|
428
690
|
export const materialLineDashOffset = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LINE_DASH_OFFSET );
|
|
429
|
-
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* TSL object that represents the point size of the current points material.
|
|
694
|
+
*
|
|
695
|
+
* @type {Node<float>}
|
|
696
|
+
*/
|
|
697
|
+
export const materialPointSize = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.POINT_SIZE );
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* TSL object that represents the dispersion of the current material.
|
|
701
|
+
*
|
|
702
|
+
* @type {Node<float>}
|
|
703
|
+
*/
|
|
430
704
|
export const materialDispersion = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.DISPERSION );
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* TSL object that represents the light map of the current material.
|
|
708
|
+
* The value is composed via `lightMapIntensity` * `lightMap.rgb`.
|
|
709
|
+
*
|
|
710
|
+
* @type {Node<vec3>}
|
|
711
|
+
*/
|
|
431
712
|
export const materialLightMap = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.LIGHT_MAP );
|
|
432
|
-
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* TSL object that represents the ambient occlusion map of the current material.
|
|
716
|
+
* The value is composed via `aoMap.r` - 1 * `aoMapIntensity` + 1.
|
|
717
|
+
*
|
|
718
|
+
* @type {Node<float>}
|
|
719
|
+
*/
|
|
720
|
+
export const materialAO = /*@__PURE__*/ nodeImmutable( MaterialNode, MaterialNode.AO );
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* TSL object that represents the anisotropy vector of the current material.
|
|
724
|
+
*
|
|
725
|
+
* @type {Node<vec2>}
|
|
726
|
+
*/
|
|
433
727
|
export const materialAnisotropyVector = /*@__PURE__*/ uniform( new Vector2() ).onReference( function ( frame ) {
|
|
434
728
|
|
|
435
729
|
return frame.material;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { uniform } from '../core/UniformNode.js';
|
|
2
2
|
|
|
3
|
+
/** @module MaterialProperties **/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TSL object that represents the refraction ratio of the material used for rendering the current object.
|
|
7
|
+
*
|
|
8
|
+
* @type {UniformNode<float>}
|
|
9
|
+
*/
|
|
3
10
|
export const materialRefractionRatio = /*@__PURE__*/ uniform( 0 ).onReference( ( { material } ) => material ).onRenderUpdate( ( { material } ) => material.refractionRatio );
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import ReferenceNode from './ReferenceNode.js';
|
|
2
|
-
//import { renderGroup } from '../core/UniformGroupNode.js';
|
|
3
|
-
//import { NodeUpdateType } from '../core/constants.js';
|
|
4
2
|
import { nodeObject } from '../tsl/TSLBase.js';
|
|
5
3
|
|
|
4
|
+
/** @module MaterialReferenceNode **/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This node is a special type of reference node which is intended
|
|
8
|
+
* for linking material properties with node values.
|
|
9
|
+
* ```js
|
|
10
|
+
* const opacityNode = materialReference( 'opacity', 'float', material );
|
|
11
|
+
* ```
|
|
12
|
+
* When changing `material.opacity`, the node value of `opacityNode` will
|
|
13
|
+
* automatically be updated.
|
|
14
|
+
*
|
|
15
|
+
* @augments module:ReferenceNode~ReferenceNode
|
|
16
|
+
*/
|
|
6
17
|
class MaterialReferenceNode extends ReferenceNode {
|
|
7
18
|
|
|
8
19
|
static get type() {
|
|
@@ -11,26 +22,45 @@ class MaterialReferenceNode extends ReferenceNode {
|
|
|
11
22
|
|
|
12
23
|
}
|
|
13
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a new material reference node.
|
|
27
|
+
*
|
|
28
|
+
* @param {String} property - The name of the property the node refers to.
|
|
29
|
+
* @param {String} inputType - The uniform type that should be used to represent the property value.
|
|
30
|
+
* @param {Material?} [material=null] - The material the property belongs to. When no material is set,
|
|
31
|
+
* the node refers to the material of the current rendered object.
|
|
32
|
+
*/
|
|
14
33
|
constructor( property, inputType, material = null ) {
|
|
15
34
|
|
|
16
35
|
super( property, inputType, material );
|
|
17
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The material the property belongs to. When no material is set,
|
|
39
|
+
* the node refers to the material of the current rendered object.
|
|
40
|
+
*
|
|
41
|
+
* @type {Material?}
|
|
42
|
+
* @default null
|
|
43
|
+
*/
|
|
18
44
|
this.material = material;
|
|
19
45
|
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
/**
|
|
47
|
+
* This flag can be used for type testing.
|
|
48
|
+
*
|
|
49
|
+
* @type {Boolean}
|
|
50
|
+
* @readonly
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
22
53
|
this.isMaterialReferenceNode = true;
|
|
23
54
|
|
|
24
55
|
}
|
|
25
56
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Updates the reference based on the given state. The state is only evaluated
|
|
59
|
+
* {@link module:MaterialReferenceNode~MaterialReferenceNode#material} is not set.
|
|
60
|
+
*
|
|
61
|
+
* @param {(NodeFrame|NodeBuilder)} state - The current state.
|
|
62
|
+
* @return {Object} The updated reference.
|
|
63
|
+
*/
|
|
34
64
|
updateReference( state ) {
|
|
35
65
|
|
|
36
66
|
this.reference = this.material !== null ? this.material : state.material;
|
|
@@ -43,4 +73,14 @@ class MaterialReferenceNode extends ReferenceNode {
|
|
|
43
73
|
|
|
44
74
|
export default MaterialReferenceNode;
|
|
45
75
|
|
|
46
|
-
|
|
76
|
+
/**
|
|
77
|
+
* TSL function for creating a material reference node.
|
|
78
|
+
*
|
|
79
|
+
* @function
|
|
80
|
+
* @param {String} name - The name of the property the node refers to.
|
|
81
|
+
* @param {String} type - The uniform type that should be used to represent the property value.
|
|
82
|
+
* @param {Material?} [material=null] - The material the property belongs to.
|
|
83
|
+
* When no material is set, the node refers to the material of the current rendered object.
|
|
84
|
+
* @returns {MaterialReferenceNode}
|
|
85
|
+
*/
|
|
86
|
+
export const materialReference = ( name, type, material = null ) => nodeObject( new MaterialReferenceNode( name, type, material ) );
|