super-three 0.167.0 → 0.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +532 -173
- package/build/three.module.js +532 -174
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +18173 -14266
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -4
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +27 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +40 -14
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +21 -1
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +2 -1
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +3 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +7 -0
- package/src/Three.js +1 -0
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +32 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +25 -5
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +21 -18
- package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +19 -0
- package/src/materials/Material.js +4 -7
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +56 -59
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +12 -10
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +16 -12
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +10 -6
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshNormalNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +14 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +22 -18
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +22 -12
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +71 -115
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +3 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +47 -14
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +24 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +53 -21
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +8 -5
- package/src/nodes/accessors/BufferNode.js +7 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/src/nodes/accessors/ClippingNode.js +19 -13
- package/src/nodes/accessors/CubeTextureNode.js +9 -8
- package/src/nodes/accessors/InstanceNode.js +19 -15
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +8 -5
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +56 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +9 -4
- package/src/nodes/accessors/ModelNode.js +47 -12
- package/src/nodes/accessors/ModelViewProjectionNode.js +12 -9
- package/src/nodes/accessors/MorphNode.js +17 -13
- package/src/nodes/accessors/Normal.js +88 -0
- package/src/nodes/accessors/Object3DNode.js +17 -33
- package/src/nodes/accessors/PointUVNode.js +9 -5
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/src/nodes/accessors/ReferenceNode.js +50 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +12 -6
- package/src/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +88 -21
- package/src/nodes/accessors/StorageBufferNode.js +22 -5
- package/src/nodes/accessors/StorageTextureNode.js +9 -6
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +16 -13
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +29 -23
- package/src/nodes/accessors/TextureSizeNode.js +10 -9
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +26 -14
- package/src/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/src/nodes/accessors/VertexColorNode.js +7 -4
- package/src/nodes/code/CodeNode.js +9 -5
- package/src/nodes/code/ExpressionNode.js +10 -6
- package/src/nodes/code/FunctionCallNode.js +8 -5
- package/src/nodes/code/FunctionNode.js +8 -23
- package/src/nodes/code/ScriptableNode.js +13 -10
- package/src/nodes/code/ScriptableValueNode.js +9 -7
- package/src/nodes/core/AssignNode.js +12 -9
- package/src/nodes/core/AttributeNode.js +12 -21
- package/src/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +10 -6
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +21 -11
- package/src/nodes/core/IndexNode.js +35 -8
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +16 -7
- package/src/nodes/core/Node.js +19 -40
- package/src/nodes/core/NodeBuilder.js +117 -38
- package/src/nodes/core/NodeUtils.js +49 -6
- package/src/nodes/core/OutputStructNode.js +10 -6
- package/src/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +36 -32
- package/src/nodes/core/StackNode.js +31 -11
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +14 -11
- package/src/nodes/core/UniformNode.js +7 -4
- package/src/nodes/core/VarNode.js +12 -8
- package/src/nodes/core/VaryingNode.js +10 -6
- package/src/nodes/display/AfterImageNode.js +15 -9
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/src/nodes/display/AnamorphicNode.js +17 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +27 -19
- package/src/nodes/display/BumpMapNode.js +13 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +67 -61
- package/src/nodes/display/DenoiseNode.js +23 -17
- package/src/nodes/display/DepthOfFieldNode.js +12 -7
- package/src/nodes/display/DotScreenNode.js +13 -22
- package/src/nodes/display/FXAANode.js +21 -16
- package/src/nodes/display/FilmNode.js +11 -7
- package/src/nodes/display/FrontFacingNode.js +10 -6
- package/src/nodes/display/GTAONode.js +22 -15
- package/src/nodes/display/GaussianBlurNode.js +14 -8
- package/src/nodes/display/Lut3DNode.js +10 -6
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +13 -13
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +95 -8
- package/src/nodes/display/PixelationPassNode.js +20 -8
- package/src/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +11 -7
- package/src/nodes/display/RenderOutputNode.js +15 -11
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +13 -8
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +15 -175
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +12 -8
- package/src/nodes/display/ViewportDepthNode.js +34 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +10 -9
- package/src/nodes/display/ViewportSharedTextureNode.js +10 -9
- package/src/nodes/display/ViewportTextureNode.js +11 -11
- package/src/nodes/fog/FogExp2Node.js +8 -7
- package/src/nodes/fog/FogNode.js +10 -8
- package/src/nodes/fog/FogRangeNode.js +8 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +34 -33
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +9 -5
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +225 -36
- package/src/nodes/lighting/BasicEnvironmentNode.js +8 -4
- package/src/nodes/lighting/BasicLightMapNode.js +7 -4
- package/src/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +23 -19
- package/src/nodes/lighting/HemisphereLightNode.js +11 -11
- package/src/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +19 -18
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +112 -75
- package/src/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +11 -11
- package/src/nodes/lighting/SpotLightNode.js +14 -16
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +38 -10
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +127 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +97 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +61 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +9 -6
- package/src/nodes/utils/FlipNode.js +68 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +9 -5
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +16 -6
- package/src/nodes/utils/MatcapUVNode.js +10 -7
- package/src/nodes/utils/MaxMipLevelNode.js +8 -5
- package/src/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +11 -8
- package/src/nodes/utils/ReflectorNode.js +12 -4
- package/src/nodes/utils/RemapNode.js +12 -8
- package/src/nodes/utils/RotateNode.js +8 -13
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +11 -12
- package/src/nodes/utils/TimerNode.js +8 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +78 -13
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +88 -41
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +15 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +23 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +117 -6
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +128 -94
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +19 -22
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +65 -19
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +3 -1
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +83 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +135 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +60 -12
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +20 -2
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +89 -37
- package/src/renderers/webgpu/WebGPUBackend.js +112 -86
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +9 -6
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +189 -73
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +7 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +43 -26
- package/src/renderers/webgpu/utils/WebGPUUtils.js +19 -2
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/accessors/CameraNode.js +0 -19
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/display/ViewportNode.js +0 -137
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { LineDashedMaterial } from '../../materials/LineDashedMaterial.js';
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { varyingProperty } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
4
|
+
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
5
|
+
import { materialColor, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth } from '../../nodes/accessors/MaterialNode.js';
|
|
6
|
+
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
7
|
+
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
8
|
+
import { mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
9
|
+
import { Fn, varying, float, vec2, vec3, vec4, If } from '../../nodes/tsl/TSLBase.js';
|
|
10
|
+
import { uv } from '../../nodes/accessors/UV.js';
|
|
11
|
+
import { viewport } from '../../nodes/display/ScreenNode.js';
|
|
12
|
+
import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
|
|
13
|
+
|
|
14
|
+
import { LineDashedMaterial } from '../LineDashedMaterial.js';
|
|
17
15
|
|
|
18
16
|
const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
|
|
19
17
|
|
|
20
18
|
class Line2NodeMaterial extends NodeMaterial {
|
|
21
19
|
|
|
20
|
+
static get type() {
|
|
21
|
+
|
|
22
|
+
return 'Line2NodeMaterial';
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
constructor( params = {} ) {
|
|
23
27
|
|
|
24
28
|
super();
|
|
25
29
|
|
|
26
|
-
this.normals = false;
|
|
27
30
|
this.lights = false;
|
|
28
31
|
|
|
29
32
|
this.setDefaultValues( _defaultValues );
|
|
@@ -49,20 +52,20 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
49
52
|
|
|
50
53
|
setup( builder ) {
|
|
51
54
|
|
|
52
|
-
this.setupShaders();
|
|
55
|
+
this.setupShaders( builder );
|
|
53
56
|
|
|
54
57
|
super.setup( builder );
|
|
55
58
|
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
setupShaders() {
|
|
61
|
+
setupShaders( { renderer } ) {
|
|
59
62
|
|
|
60
63
|
const useAlphaToCoverage = this.alphaToCoverage;
|
|
61
64
|
const useColor = this.useColor;
|
|
62
65
|
const useDash = this.dashed;
|
|
63
66
|
const useWorldUnits = this.worldUnits;
|
|
64
67
|
|
|
65
|
-
const trimSegment =
|
|
68
|
+
const trimSegment = Fn( ( { start, end } ) => {
|
|
66
69
|
|
|
67
70
|
const a = cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column
|
|
68
71
|
const b = cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column
|
|
@@ -72,22 +75,24 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
72
75
|
|
|
73
76
|
return vec4( mix( start.xyz, end.xyz, alpha ), end.w );
|
|
74
77
|
|
|
78
|
+
} ).setLayout( {
|
|
79
|
+
name: 'trimSegment',
|
|
80
|
+
type: 'vec4',
|
|
81
|
+
inputs: [
|
|
82
|
+
{ name: 'start', type: 'vec4' },
|
|
83
|
+
{ name: 'end', type: 'vec4' }
|
|
84
|
+
]
|
|
75
85
|
} );
|
|
76
86
|
|
|
77
|
-
this.vertexNode =
|
|
78
|
-
|
|
79
|
-
varyingProperty( 'vec2', 'vUv' ).assign( uv() );
|
|
87
|
+
this.vertexNode = Fn( () => {
|
|
80
88
|
|
|
81
89
|
const instanceStart = attribute( 'instanceStart' );
|
|
82
90
|
const instanceEnd = attribute( 'instanceEnd' );
|
|
83
91
|
|
|
84
92
|
// camera space
|
|
85
93
|
|
|
86
|
-
const start =
|
|
87
|
-
const end =
|
|
88
|
-
|
|
89
|
-
start.assign( modelViewMatrix.mul( vec4( instanceStart, 1.0 ) ) ); // force assignment into correct place in flow
|
|
90
|
-
end.assign( modelViewMatrix.mul( vec4( instanceEnd, 1.0 ) ) );
|
|
94
|
+
const start = vec4( modelViewMatrix.mul( vec4( instanceStart, 1.0 ) ) ).toVar( 'start' );
|
|
95
|
+
const end = vec4( modelViewMatrix.mul( vec4( instanceEnd, 1.0 ) ) ).toVar( 'end' );
|
|
91
96
|
|
|
92
97
|
if ( useWorldUnits ) {
|
|
93
98
|
|
|
@@ -111,7 +116,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
111
116
|
|
|
112
117
|
end.assign( trimSegment( { start: start, end: end } ) );
|
|
113
118
|
|
|
114
|
-
} ).
|
|
119
|
+
} ).ElseIf( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {
|
|
115
120
|
|
|
116
121
|
start.assign( trimSegment( { start: end, end: start } ) );
|
|
117
122
|
|
|
@@ -128,13 +133,13 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
128
133
|
const ndcEnd = clipEnd.xyz.div( clipEnd.w );
|
|
129
134
|
|
|
130
135
|
// direction
|
|
131
|
-
const dir = ndcEnd.xy.sub( ndcStart.xy ).
|
|
136
|
+
const dir = ndcEnd.xy.sub( ndcStart.xy ).toVar();
|
|
132
137
|
|
|
133
138
|
// account for clip-space aspect ratio
|
|
134
139
|
dir.x.assign( dir.x.mul( aspect ) );
|
|
135
140
|
dir.assign( dir.normalize() );
|
|
136
141
|
|
|
137
|
-
const clip =
|
|
142
|
+
const clip = vec4().toVar();
|
|
138
143
|
|
|
139
144
|
if ( useWorldUnits ) {
|
|
140
145
|
|
|
@@ -147,18 +152,18 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
147
152
|
|
|
148
153
|
const worldPos = varyingProperty( 'vec4', 'worldPos' );
|
|
149
154
|
|
|
150
|
-
worldPos.assign( positionGeometry.y.lessThan( 0.5 ).
|
|
155
|
+
worldPos.assign( positionGeometry.y.lessThan( 0.5 ).select( start, end ) );
|
|
151
156
|
|
|
152
157
|
// height offset
|
|
153
158
|
const hw = materialLineWidth.mul( 0.5 );
|
|
154
|
-
worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).
|
|
159
|
+
worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).select( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );
|
|
155
160
|
|
|
156
161
|
// don't extend the line if we're rendering dashes because we
|
|
157
162
|
// won't be rendering the endcaps
|
|
158
163
|
if ( ! useDash ) {
|
|
159
164
|
|
|
160
165
|
// cap extension
|
|
161
|
-
worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).
|
|
166
|
+
worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).select( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );
|
|
162
167
|
|
|
163
168
|
// add width to the box
|
|
164
169
|
worldPos.addAssign( vec4( worldFwd.mul( hw ), 0 ) );
|
|
@@ -177,30 +182,28 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
177
182
|
|
|
178
183
|
// shift the depth of the projected points so the line
|
|
179
184
|
// segments overlap neatly
|
|
180
|
-
const clipPose =
|
|
185
|
+
const clipPose = vec3().toVar();
|
|
181
186
|
|
|
182
|
-
clipPose.assign( positionGeometry.y.lessThan( 0.5 ).
|
|
187
|
+
clipPose.assign( positionGeometry.y.lessThan( 0.5 ).select( ndcStart, ndcEnd ) );
|
|
183
188
|
clip.z.assign( clipPose.z.mul( clip.w ) );
|
|
184
189
|
|
|
185
190
|
} else {
|
|
186
191
|
|
|
187
|
-
const offset =
|
|
188
|
-
|
|
189
|
-
offset.assign( vec2( dir.y, dir.x.negate() ) );
|
|
192
|
+
const offset = vec2( dir.y, dir.x.negate() ).toVar( 'offset' );
|
|
190
193
|
|
|
191
194
|
// undo aspect ratio adjustment
|
|
192
195
|
dir.x.assign( dir.x.div( aspect ) );
|
|
193
196
|
offset.x.assign( offset.x.div( aspect ) );
|
|
194
197
|
|
|
195
198
|
// sign flip
|
|
196
|
-
offset.assign( positionGeometry.x.lessThan( 0.0 ).
|
|
199
|
+
offset.assign( positionGeometry.x.lessThan( 0.0 ).select( offset.negate(), offset ) );
|
|
197
200
|
|
|
198
201
|
// endcaps
|
|
199
202
|
If( positionGeometry.y.lessThan( 0.0 ), () => {
|
|
200
203
|
|
|
201
204
|
offset.assign( offset.sub( dir ) );
|
|
202
205
|
|
|
203
|
-
} ).
|
|
206
|
+
} ).ElseIf( positionGeometry.y.greaterThan( 1.0 ), () => {
|
|
204
207
|
|
|
205
208
|
offset.assign( offset.add( dir ) );
|
|
206
209
|
|
|
@@ -213,7 +216,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
213
216
|
offset.assign( offset.div( viewport.w ) );
|
|
214
217
|
|
|
215
218
|
// select end
|
|
216
|
-
clip.assign( positionGeometry.y.lessThan( 0.5 ).
|
|
219
|
+
clip.assign( positionGeometry.y.lessThan( 0.5 ).select( clipStart, clipEnd ) );
|
|
217
220
|
|
|
218
221
|
// back to clip space
|
|
219
222
|
offset.assign( offset.mul( clip.w ) );
|
|
@@ -226,7 +229,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
226
229
|
|
|
227
230
|
} )();
|
|
228
231
|
|
|
229
|
-
const closestLineToLine =
|
|
232
|
+
const closestLineToLine = Fn( ( { p1, p2, p3, p4 } ) => {
|
|
230
233
|
|
|
231
234
|
const p13 = p1.sub( p3 );
|
|
232
235
|
const p43 = p4.sub( p3 );
|
|
@@ -249,9 +252,9 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
249
252
|
|
|
250
253
|
} );
|
|
251
254
|
|
|
252
|
-
this.fragmentNode =
|
|
255
|
+
this.fragmentNode = Fn( () => {
|
|
253
256
|
|
|
254
|
-
const vUv =
|
|
257
|
+
const vUv = uv();
|
|
255
258
|
|
|
256
259
|
if ( useDash ) {
|
|
257
260
|
|
|
@@ -266,7 +269,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
266
269
|
const instanceDistanceStart = attribute( 'instanceDistanceStart' );
|
|
267
270
|
const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
|
|
268
271
|
|
|
269
|
-
const lineDistance = positionGeometry.y.lessThan( 0.5 ).
|
|
272
|
+
const lineDistance = positionGeometry.y.lessThan( 0.5 ).select( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
|
|
270
273
|
|
|
271
274
|
const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
|
|
272
275
|
const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
|
|
@@ -276,9 +279,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
276
279
|
|
|
277
280
|
}
|
|
278
281
|
|
|
279
|
-
|
|
280
|
-
const alpha = property( 'float', 'alpha' );
|
|
281
|
-
alpha.assign( 1 );
|
|
282
|
+
const alpha = float( 1 ).toVar( 'alpha' );
|
|
282
283
|
|
|
283
284
|
if ( useWorldUnits ) {
|
|
284
285
|
|
|
@@ -298,7 +299,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
298
299
|
|
|
299
300
|
if ( ! useDash ) {
|
|
300
301
|
|
|
301
|
-
if ( useAlphaToCoverage ) {
|
|
302
|
+
if ( useAlphaToCoverage && renderer.samples > 1 ) {
|
|
302
303
|
|
|
303
304
|
const dnorm = norm.fwidth();
|
|
304
305
|
alpha.assign( smoothstep( dnorm.negate().add( 0.5 ), dnorm.add( 0.5 ), norm ).oneMinus() );
|
|
@@ -315,16 +316,14 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
315
316
|
|
|
316
317
|
// round endcaps
|
|
317
318
|
|
|
318
|
-
if ( useAlphaToCoverage ) {
|
|
319
|
+
if ( useAlphaToCoverage && renderer.samples > 1 ) {
|
|
319
320
|
|
|
320
321
|
const a = vUv.x;
|
|
321
|
-
const b = vUv.y.greaterThan( 0.0 ).
|
|
322
|
+
const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
322
323
|
|
|
323
324
|
const len2 = a.mul( a ).add( b.mul( b ) );
|
|
324
325
|
|
|
325
|
-
|
|
326
|
-
const dlen = property( 'float', 'dlen' );
|
|
327
|
-
dlen.assign( len2.fwidth() );
|
|
326
|
+
const dlen = float( len2.fwidth() ).toVar( 'dlen' );
|
|
328
327
|
|
|
329
328
|
If( vUv.y.abs().greaterThan( 1.0 ), () => {
|
|
330
329
|
|
|
@@ -337,7 +336,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
337
336
|
If( vUv.y.abs().greaterThan( 1.0 ), () => {
|
|
338
337
|
|
|
339
338
|
const a = vUv.x;
|
|
340
|
-
const b = vUv.y.greaterThan( 0.0 ).
|
|
339
|
+
const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
|
|
341
340
|
const len2 = a.mul( a ).add( b.mul( b ) );
|
|
342
341
|
|
|
343
342
|
len2.greaterThan( 1.0 ).discard();
|
|
@@ -361,7 +360,7 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
361
360
|
const instanceColorStart = attribute( 'instanceColorStart' );
|
|
362
361
|
const instanceColorEnd = attribute( 'instanceColorEnd' );
|
|
363
362
|
|
|
364
|
-
const instanceColor = positionGeometry.y.lessThan( 0.5 ).
|
|
363
|
+
const instanceColor = positionGeometry.y.lessThan( 0.5 ).select( instanceColorStart, instanceColorEnd );
|
|
365
364
|
|
|
366
365
|
lineColorNode = instanceColor.mul( materialColor );
|
|
367
366
|
|
|
@@ -436,5 +435,3 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
436
435
|
}
|
|
437
436
|
|
|
438
437
|
export default Line2NodeMaterial;
|
|
439
|
-
|
|
440
|
-
addNodeMaterial( 'Line2NodeMaterial', Line2NodeMaterial );
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import NodeMaterial
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
|
|
3
|
-
import { LineBasicMaterial } from '
|
|
3
|
+
import { LineBasicMaterial } from '../LineBasicMaterial.js';
|
|
4
4
|
|
|
5
5
|
const _defaultValues = /*@__PURE__*/ new LineBasicMaterial();
|
|
6
6
|
|
|
7
7
|
class LineBasicNodeMaterial extends NodeMaterial {
|
|
8
8
|
|
|
9
|
+
static get type() {
|
|
10
|
+
|
|
11
|
+
return 'LineBasicNodeMaterial';
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
constructor( parameters ) {
|
|
10
16
|
|
|
11
17
|
super();
|
|
@@ -13,7 +19,6 @@ class LineBasicNodeMaterial extends NodeMaterial {
|
|
|
13
19
|
this.isLineBasicNodeMaterial = true;
|
|
14
20
|
|
|
15
21
|
this.lights = false;
|
|
16
|
-
this.normals = false;
|
|
17
22
|
|
|
18
23
|
this.setDefaultValues( _defaultValues );
|
|
19
24
|
|
|
@@ -24,5 +29,3 @@ class LineBasicNodeMaterial extends NodeMaterial {
|
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export default LineBasicNodeMaterial;
|
|
27
|
-
|
|
28
|
-
addNodeMaterial( 'LineBasicNodeMaterial', LineBasicNodeMaterial );
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import { attribute } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { float } from '../shadernode/ShaderNode.js';
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
3
|
+
import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../../nodes/accessors/MaterialNode.js';
|
|
4
|
+
import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
|
|
5
|
+
import { varying, float } from '../../nodes/tsl/TSLBase.js';
|
|
7
6
|
|
|
8
|
-
import { LineDashedMaterial } from '
|
|
7
|
+
import { LineDashedMaterial } from '../LineDashedMaterial.js';
|
|
9
8
|
|
|
10
9
|
const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
|
|
11
10
|
|
|
12
11
|
class LineDashedNodeMaterial extends NodeMaterial {
|
|
13
12
|
|
|
13
|
+
static get type() {
|
|
14
|
+
|
|
15
|
+
return 'LineDashedNodeMaterial';
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
constructor( parameters ) {
|
|
15
20
|
|
|
16
21
|
super();
|
|
@@ -18,7 +23,6 @@ class LineDashedNodeMaterial extends NodeMaterial {
|
|
|
18
23
|
this.isLineDashedNodeMaterial = true;
|
|
19
24
|
|
|
20
25
|
this.lights = false;
|
|
21
|
-
this.normals = false;
|
|
22
26
|
|
|
23
27
|
this.setDefaultValues( _defaultValues );
|
|
24
28
|
|
|
@@ -51,5 +55,3 @@ class LineDashedNodeMaterial extends NodeMaterial {
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
export default LineDashedNodeMaterial;
|
|
54
|
-
|
|
55
|
-
addNodeMaterial( 'LineDashedNodeMaterial', LineDashedNodeMaterial );
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import { materialLightMap } from '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { materialLightMap } from '../../nodes/accessors/MaterialNode.js';
|
|
3
|
+
import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
|
|
4
|
+
import BasicLightMapNode from '../../nodes/lighting/BasicLightMapNode.js';
|
|
5
|
+
import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js';
|
|
6
|
+
import { normalView } from '../../nodes/accessors/Normal.js';
|
|
7
|
+
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
8
|
+
|
|
9
|
+
import { MeshBasicMaterial } from '../MeshBasicMaterial.js';
|
|
9
10
|
|
|
10
11
|
const _defaultValues = /*@__PURE__*/ new MeshBasicMaterial();
|
|
11
12
|
|
|
12
13
|
class MeshBasicNodeMaterial extends NodeMaterial {
|
|
13
14
|
|
|
15
|
+
static get type() {
|
|
16
|
+
|
|
17
|
+
return 'MeshBasicNodeMaterial';
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
constructor( parameters ) {
|
|
15
22
|
|
|
16
23
|
super();
|
|
@@ -18,7 +25,6 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
18
25
|
this.isMeshBasicNodeMaterial = true;
|
|
19
26
|
|
|
20
27
|
this.lights = true;
|
|
21
|
-
//this.normals = false; @TODO: normals usage by context
|
|
22
28
|
|
|
23
29
|
this.setDefaultValues( _defaultValues );
|
|
24
30
|
|
|
@@ -28,7 +34,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
28
34
|
|
|
29
35
|
setupNormal() {
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
return normalView; // see #28839
|
|
32
38
|
|
|
33
39
|
}
|
|
34
40
|
|
|
@@ -69,5 +75,3 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
export default MeshBasicNodeMaterial;
|
|
72
|
-
|
|
73
|
-
addNodeMaterial( 'MeshBasicNodeMaterial', MeshBasicNodeMaterial );
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import BasicEnvironmentNode from '
|
|
3
|
-
import PhongLightingModel from '
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
|
|
3
|
+
import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js';
|
|
4
4
|
|
|
5
|
-
import { MeshLambertMaterial } from '
|
|
5
|
+
import { MeshLambertMaterial } from '../MeshLambertMaterial.js';
|
|
6
6
|
|
|
7
7
|
const _defaultValues = /*@__PURE__*/ new MeshLambertMaterial();
|
|
8
8
|
|
|
9
9
|
class MeshLambertNodeMaterial extends NodeMaterial {
|
|
10
10
|
|
|
11
|
+
static get type() {
|
|
12
|
+
|
|
13
|
+
return 'MeshLambertNodeMaterial';
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
constructor( parameters ) {
|
|
12
18
|
|
|
13
19
|
super();
|
|
@@ -39,5 +45,3 @@ class MeshLambertNodeMaterial extends NodeMaterial {
|
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
export default MeshLambertNodeMaterial;
|
|
42
|
-
|
|
43
|
-
addNodeMaterial( 'MeshLambertNodeMaterial', MeshLambertNodeMaterial );
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import { materialReference } from '
|
|
3
|
-
import { diffuseColor } from '
|
|
4
|
-
import { vec3 } from '
|
|
5
|
-
import { mix } from '
|
|
6
|
-
import { matcapUV } from '
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
3
|
+
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
4
|
+
import { vec3 } from '../../nodes/tsl/TSLBase.js';
|
|
5
|
+
import { mix } from '../../nodes/math/MathNode.js';
|
|
6
|
+
import { matcapUV } from '../../nodes/utils/MatcapUVNode.js';
|
|
7
7
|
|
|
8
|
-
import { MeshMatcapMaterial } from '
|
|
8
|
+
import { MeshMatcapMaterial } from '../MeshMatcapMaterial.js';
|
|
9
9
|
|
|
10
10
|
const _defaultValues = /*@__PURE__*/ new MeshMatcapMaterial();
|
|
11
11
|
|
|
12
12
|
class MeshMatcapNodeMaterial extends NodeMaterial {
|
|
13
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'MeshMatcapNodeMaterial';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
constructor( parameters ) {
|
|
15
21
|
|
|
16
22
|
super();
|
|
@@ -49,5 +55,3 @@ class MeshMatcapNodeMaterial extends NodeMaterial {
|
|
|
49
55
|
|
|
50
56
|
|
|
51
57
|
export default MeshMatcapNodeMaterial;
|
|
52
|
-
|
|
53
|
-
addNodeMaterial( 'MeshMatcapNodeMaterial', MeshMatcapNodeMaterial );
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import { diffuseColor } from '
|
|
3
|
-
import { directionToColor } from '
|
|
4
|
-
import { materialOpacity } from '
|
|
5
|
-
import { transformedNormalView } from '
|
|
6
|
-
import { float, vec4 } from '
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { directionToColor } from '../../nodes/utils/Packing.js';
|
|
4
|
+
import { materialOpacity } from '../../nodes/accessors/MaterialNode.js';
|
|
5
|
+
import { transformedNormalView } from '../../nodes/accessors/Normal.js';
|
|
6
|
+
import { float, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
7
7
|
|
|
8
|
-
import { MeshNormalMaterial } from '
|
|
8
|
+
import { MeshNormalMaterial } from '../MeshNormalMaterial.js';
|
|
9
9
|
|
|
10
10
|
const _defaultValues = /*@__PURE__*/ new MeshNormalMaterial();
|
|
11
11
|
|
|
12
12
|
class MeshNormalNodeMaterial extends NodeMaterial {
|
|
13
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'MeshNormalNodeMaterial';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
constructor( parameters ) {
|
|
15
21
|
|
|
16
22
|
super();
|
|
@@ -36,5 +42,3 @@ class MeshNormalNodeMaterial extends NodeMaterial {
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
export default MeshNormalNodeMaterial;
|
|
39
|
-
|
|
40
|
-
addNodeMaterial( 'MeshNormalNodeMaterial', MeshNormalNodeMaterial );
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import NodeMaterial
|
|
2
|
-
import { shininess, specularColor } from '
|
|
3
|
-
import { materialShininess, materialSpecular } from '
|
|
4
|
-
import { float } from '
|
|
5
|
-
import BasicEnvironmentNode from '
|
|
6
|
-
import PhongLightingModel from '
|
|
1
|
+
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
+
import { shininess, specularColor } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { materialShininess, materialSpecular } from '../../nodes/accessors/MaterialNode.js';
|
|
4
|
+
import { float } from '../../nodes/tsl/TSLBase.js';
|
|
5
|
+
import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
|
|
6
|
+
import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js';
|
|
7
7
|
|
|
8
|
-
import { MeshPhongMaterial } from '
|
|
8
|
+
import { MeshPhongMaterial } from '../MeshPhongMaterial.js';
|
|
9
9
|
|
|
10
10
|
const _defaultValues = /*@__PURE__*/ new MeshPhongMaterial();
|
|
11
11
|
|
|
12
12
|
class MeshPhongNodeMaterial extends NodeMaterial {
|
|
13
13
|
|
|
14
|
+
static get type() {
|
|
15
|
+
|
|
16
|
+
return 'MeshPhongNodeMaterial';
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
constructor( parameters ) {
|
|
15
21
|
|
|
16
22
|
super();
|
|
@@ -35,6 +41,7 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
35
41
|
return envNode ? new BasicEnvironmentNode( envNode ) : null;
|
|
36
42
|
|
|
37
43
|
}
|
|
44
|
+
|
|
38
45
|
setupLightingModel( /*builder*/ ) {
|
|
39
46
|
|
|
40
47
|
return new PhongLightingModel();
|
|
@@ -69,5 +76,3 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
export default MeshPhongNodeMaterial;
|
|
72
|
-
|
|
73
|
-
addNodeMaterial( 'MeshPhongNodeMaterial', MeshPhongNodeMaterial );
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
|
|
8
|
-
import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
|
|
1
|
+
import { clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, specularF90, diffuseColor, metalness, roughness, anisotropy, alphaT, anisotropyT, anisotropyB, ior, transmission, thickness, attenuationDistance, attenuationColor, dispersion } from '../../nodes/core/PropertyNode.js';
|
|
2
|
+
import { materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialSpecularIntensity, materialSpecularColor, materialAnisotropy, materialIOR, materialTransmission, materialThickness, materialAttenuationDistance, materialAttenuationColor, materialDispersion } from '../../nodes/accessors/MaterialNode.js';
|
|
3
|
+
import { float, vec2, vec3, If } from '../../nodes/tsl/TSLBase.js';
|
|
4
|
+
import getRoughness from '../../nodes/functions/material/getRoughness.js';
|
|
5
|
+
import { TBNViewMatrix } from '../../nodes/accessors/AccessorsUtils.js';
|
|
6
|
+
import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
|
|
9
7
|
import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
|
|
10
|
-
import { mix, pow2, min } from '
|
|
8
|
+
import { mix, pow2, min } from '../../nodes/math/MathNode.js';
|
|
11
9
|
|
|
12
|
-
import { MeshPhysicalMaterial } from '
|
|
10
|
+
import { MeshPhysicalMaterial } from '../MeshPhysicalMaterial.js';
|
|
13
11
|
|
|
14
12
|
const _defaultValues = /*@__PURE__*/ new MeshPhysicalMaterial();
|
|
15
13
|
|
|
16
14
|
class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
17
15
|
|
|
16
|
+
static get type() {
|
|
17
|
+
|
|
18
|
+
return 'MeshPhysicalNodeMaterial';
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
constructor( parameters ) {
|
|
19
23
|
|
|
20
24
|
super();
|
|
@@ -156,7 +160,7 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
156
160
|
|
|
157
161
|
anisotropyV.assign( vec2( 1.0, 0.0 ) );
|
|
158
162
|
|
|
159
|
-
} ).
|
|
163
|
+
} ).Else( () => {
|
|
160
164
|
|
|
161
165
|
anisotropyV.divAssign( vec2( anisotropy ) );
|
|
162
166
|
anisotropy.assign( anisotropy.saturate() );
|
|
@@ -197,15 +201,17 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
197
201
|
|
|
198
202
|
}
|
|
199
203
|
|
|
200
|
-
|
|
204
|
+
setupClearcoatNormal() {
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
return this.clearcoatNormalNode ? vec3( this.clearcoatNormalNode ) : materialClearcoatNormal;
|
|
203
207
|
|
|
204
|
-
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
setup( builder ) {
|
|
205
211
|
|
|
206
|
-
|
|
212
|
+
builder.context.setupClearcoatNormal = () => this.setupClearcoatNormal( builder );
|
|
207
213
|
|
|
208
|
-
|
|
214
|
+
super.setup( builder );
|
|
209
215
|
|
|
210
216
|
}
|
|
211
217
|
|
|
@@ -240,5 +246,3 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
240
246
|
}
|
|
241
247
|
|
|
242
248
|
export default MeshPhysicalNodeMaterial;
|
|
243
|
-
|
|
244
|
-
addNodeMaterial( 'MeshPhysicalNodeMaterial', MeshPhysicalNodeMaterial );
|