super-three 0.165.0 → 0.168.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 +854 -410
- package/build/three.module.js +849 -411
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +77755 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/jsm/Addons.js +5 -2
- 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 +453 -452
- package/examples/jsm/csm/CSMShader.js +4 -4
- 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/GLTFExporter.js +13 -4
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/helpers/ViewHelper.js +51 -2
- package/examples/jsm/libs/tween.module.js +64 -75
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/FBXLoader.js +23 -45
- package/examples/jsm/loaders/GLTFLoader.js +10 -4
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +10 -10
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VTKLoader.js +76 -3
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -19
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/RenderTransitionPass.js +13 -38
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/postprocessing/SSAOPass.js +6 -9
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +46 -4
- package/examples/jsm/transpiler/TSLEncoder.js +24 -22
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +8 -6
- package/src/Three.WebGPU.js +200 -0
- package/src/Three.js +3 -0
- package/src/constants.js +4 -1
- package/src/core/Object3D.js +22 -22
- package/src/extras/Controls.js +32 -0
- package/src/extras/TextureUtils.js +210 -0
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/ObjectLoader.js +33 -2
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeLoader.js +6 -4
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeMaterialLoader.js +2 -2
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeObjectLoader.js +2 -1
- package/src/materials/Material.js +7 -1
- package/{examples/jsm/nodes/materials → src/materials/nodes}/InstancedPointsNodeMaterial.js +36 -27
- package/{examples/jsm/nodes/materials → src/materials/nodes}/Line2NodeMaterial.js +37 -40
- package/src/materials/nodes/LineBasicNodeMaterial.js +27 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/LineDashedNodeMaterial.js +10 -11
- package/src/materials/nodes/MeshBasicNodeMaterial.js +73 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +43 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +53 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +74 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshPhysicalNodeMaterial.js +22 -20
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshStandardNodeMaterial.js +28 -11
- package/src/materials/nodes/MeshToonNodeMaterial.js +34 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/NodeMaterial.js +142 -96
- package/{examples/jsm/nodes/materials/Materials.js → src/materials/nodes/NodeMaterials.js} +1 -1
- package/{examples/jsm/nodes/materials → src/materials/nodes}/PointsNodeMaterial.js +5 -6
- package/src/materials/nodes/ShadowNodeMaterial.js +34 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/SpriteNodeMaterial.js +13 -13
- package/{examples/jsm/nodes/materials → src/materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Vector4.js +13 -0
- package/src/nodes/Nodes.js +164 -0
- package/src/nodes/TSL.js +176 -0
- package/{examples/jsm → src}/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +124 -0
- package/{examples/jsm/nodes/accessors/BitangentNode.js → src/nodes/accessors/Bitangent.js} +9 -9
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +41 -6
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/Camera.js +19 -0
- package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +76 -0
- package/src/nodes/accessors/InstanceNode.js +144 -0
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +66 -49
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +37 -0
- package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +35 -31
- package/src/nodes/accessors/Normal.js +62 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +11 -11
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +14 -8
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +6 -6
- package/{examples/jsm → src}/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +187 -0
- package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +54 -6
- package/{examples/jsm → src}/nodes/accessors/StorageTextureNode.js +16 -7
- package/src/nodes/accessors/Tangent.js +22 -0
- package/{examples/jsm → src}/nodes/accessors/Texture3DNode.js +11 -11
- package/{examples/jsm/nodes/accessors/TextureBicubicNode.js → src/nodes/accessors/TextureBicubic.js} +3 -32
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +69 -37
- package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +4 -6
- package/{examples/jsm/nodes/accessors/UniformsNode.js → src/nodes/accessors/UniformArrayNode.js} +24 -9
- package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +6 -5
- package/{examples/jsm → src}/nodes/code/CodeNode.js +5 -5
- package/{examples/jsm → src}/nodes/code/ExpressionNode.js +4 -4
- package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +5 -5
- package/{examples/jsm → src}/nodes/code/FunctionNode.js +5 -23
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +18 -6
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +6 -7
- package/{examples/jsm → src}/nodes/core/AssignNode.js +5 -5
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +22 -21
- package/{examples/jsm → src}/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +46 -0
- package/{examples/jsm → src}/nodes/core/ConstNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/ContextNode.js +17 -11
- package/{examples/jsm → src}/nodes/core/IndexNode.js +17 -6
- package/{examples/jsm → src}/nodes/core/InputNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +82 -0
- package/{examples/jsm → src}/nodes/core/Node.js +57 -31
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +216 -65
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +42 -0
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +7 -1
- package/{examples/jsm → src}/nodes/core/OutputStructNode.js +4 -4
- package/{examples/jsm → src}/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +84 -0
- package/{examples/jsm → src}/nodes/core/StackNode.js +26 -10
- package/{examples/jsm → src}/nodes/core/StructTypeNode.js +2 -2
- package/{examples/jsm → src}/nodes/core/TempNode.js +4 -4
- package/src/nodes/core/UniformGroupNode.js +55 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +14 -5
- package/{examples/jsm → src}/nodes/core/VarNode.js +8 -12
- package/{examples/jsm → src}/nodes/core/VaryingNode.js +13 -5
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +27 -35
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +27 -30
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +335 -0
- package/{examples/jsm → src}/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +85 -0
- package/src/nodes/display/DenoiseNode.js +201 -0
- package/src/nodes/display/DepthOfFieldNode.js +121 -0
- package/src/nodes/display/DotScreenNode.js +63 -0
- package/src/nodes/display/FXAANode.js +329 -0
- package/src/nodes/display/FilmNode.js +53 -0
- package/src/nodes/display/FrontFacingNode.js +41 -0
- package/src/nodes/display/GTAONode.js +328 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +44 -24
- package/src/nodes/display/Lut3DNode.js +54 -0
- package/src/nodes/display/MotionBlur.js +25 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +9 -11
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +367 -0
- package/src/nodes/display/PixelationPassNode.js +206 -0
- package/{examples/jsm → src}/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +50 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +123 -0
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +66 -0
- package/src/nodes/display/TransitionNode.js +77 -0
- package/src/nodes/display/ViewportDepthNode.js +121 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +30 -0
- package/{examples/jsm → src}/nodes/display/ViewportNode.js +28 -26
- package/src/nodes/display/ViewportSharedTextureNode.js +36 -0
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +12 -12
- package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +4 -6
- package/{examples/jsm → src}/nodes/fog/FogNode.js +5 -7
- package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +4 -6
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +10 -8
- package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +73 -31
- package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +1 -1
- package/{examples/jsm → src}/nodes/functions/ToonLightingModel.js +6 -4
- package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
- package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +2 -2
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +23 -10
- package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +24 -0
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +354 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +27 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +3 -9
- package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +23 -21
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +4 -7
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +3 -8
- package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +2 -2
- package/{examples/jsm → src}/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/{examples/jsm → src}/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +64 -0
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +4 -2
- package/src/nodes/lighting/LightsNode.js +231 -0
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +4 -10
- package/src/nodes/lighting/RectAreaLightNode.js +93 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +4 -10
- package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +2 -2
- package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +43 -46
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +500 -603
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +3 -9
- package/{examples/jsm/nodes/math/CondNode.js → src/nodes/math/ConditionalNode.js} +31 -13
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +404 -0
- package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -7
- package/{examples/jsm → src}/nodes/math/OperatorNode.js +100 -58
- package/{examples/jsm → src}/nodes/math/TriNoise3D.js +19 -29
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +60 -16
- package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/{examples/jsm/nodes/shadernode/ShaderNode.js → src/nodes/tsl/TSLCore.js} +106 -96
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +7 -5
- package/{examples/jsm → src}/nodes/utils/JoinNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +19 -12
- package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +6 -6
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +12 -6
- package/{examples/jsm → src}/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +130 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +17 -4
- package/{examples/jsm → src}/nodes/utils/RemapNode.js +7 -7
- package/{examples/jsm → src}/nodes/utils/RotateNode.js +4 -12
- package/{examples/jsm → src}/nodes/utils/SetNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/SplitNode.js +2 -2
- package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +4 -6
- package/{examples/jsm → src}/nodes/utils/TimerNode.js +5 -5
- package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +169 -190
- package/src/objects/InstancedMesh.js +1 -1
- package/src/renderers/WebGLRenderer.js +60 -23
- package/{examples/jsm → src}/renderers/common/Attributes.js +2 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +12 -4
- package/src/renderers/common/BindGroup.js +18 -0
- package/{examples/jsm → src}/renderers/common/Bindings.js +45 -32
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +18 -7
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +16 -4
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +34 -6
- package/src/renderers/common/PostProcessing.js +90 -0
- package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +8 -3
- package/{examples/jsm → src}/renderers/common/RenderContext.js +25 -1
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderList.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderObject.js +45 -12
- package/{examples/jsm → src}/renderers/common/Renderer.js +151 -73
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +14 -5
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +14 -14
- package/{examples/jsm → src}/renderers/common/Uniform.js +9 -4
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/{examples/jsm → src}/renderers/common/extras/PMREMGenerator.js +25 -25
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +8 -7
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +69 -21
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +16 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +2 -2
- package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
- package/src/renderers/webgl/WebGLLights.js +6 -0
- package/src/renderers/webgl/WebGLProgram.js +27 -1
- package/src/renderers/webgl/WebGLPrograms.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +75 -57
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +7 -7
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +242 -120
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +227 -44
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +2 -2
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +1 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +22 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +62 -23
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +242 -136
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +9 -9
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +281 -107
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +64 -33
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +4 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -36
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +76 -44
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +42 -4
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -0
- package/src/renderers/webxr/WebXRManager.js +37 -24
- package/src/textures/CompressedArrayTexture.js +1 -1
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/nodes/Nodes.js +0 -202
- package/examples/jsm/nodes/accessors/BatchNode.js +0 -78
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -12
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -61
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +0 -21
- package/examples/jsm/nodes/accessors/ModelNode.js +0 -36
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -14
- package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -10
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -6
- package/examples/jsm/nodes/accessors/SkinningNode.js +0 -124
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -23
- package/examples/jsm/nodes/core/CacheNode.js +0 -49
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
- package/examples/jsm/nodes/core/PropertyNode.js +0 -83
- package/examples/jsm/nodes/core/UniformGroupNode.js +0 -36
- package/examples/jsm/nodes/display/BlendModeNode.js +0 -128
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -99
- package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
- package/examples/jsm/nodes/display/FrontFacingNode.js +0 -40
- package/examples/jsm/nodes/display/PassNode.js +0 -201
- package/examples/jsm/nodes/display/ToneMappingNode.js +0 -188
- package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -97
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -31
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -37
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
- package/examples/jsm/nodes/lighting/AONode.js +0 -27
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -256
- package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -66
- package/examples/jsm/nodes/lighting/LightsNode.js +0 -215
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.js +0 -52
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -38
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
- package/examples/jsm/nodes/materials/MeshToonNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +0 -34
- package/examples/jsm/nodes/math/HashNode.js +0 -34
- package/examples/jsm/nodes/math/MathNode.js +0 -391
- package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
- package/examples/jsm/nodes/utils/DiscardNode.js +0 -27
- package/examples/jsm/nodes/utils/PackingNode.js +0 -55
- package/examples/jsm/nodes/utils/RotateUVNode.js +0 -35
- package/examples/jsm/renderers/common/PostProcessing.js +0 -33
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- /package/{examples/jsm/nodes/accessors/UVNode.js → src/nodes/accessors/UV.js} +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Animation.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ChainMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipelines.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderBundle.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderBundles.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderObjects.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBufferRenderer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { Material } from '
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { mix } from '
|
|
18
|
-
import { float, vec3, vec4 } from '
|
|
19
|
-
import AONode from '
|
|
20
|
-
import { lightingContext } from '
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { clipping, clippingAlpha } from '../accessors/ClippingNode.js';
|
|
26
|
-
import { faceDirection } from '../display/FrontFacingNode.js';
|
|
1
|
+
import { Material } from '../Material.js';
|
|
2
|
+
import { NormalBlending } from '../../constants.js';
|
|
3
|
+
|
|
4
|
+
import { getNodeChildren, getCacheKey } from '../../nodes/core/NodeUtils.js';
|
|
5
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
6
|
+
import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js';
|
|
7
|
+
import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAOMap } from '../../nodes/accessors/MaterialNode.js';
|
|
8
|
+
import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
|
|
9
|
+
import { normalLocal } from '../../nodes/accessors/Normal.js';
|
|
10
|
+
import { instance } from '../../nodes/accessors/InstanceNode.js';
|
|
11
|
+
import { batch } from '../../nodes/accessors/BatchNode.js';
|
|
12
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
13
|
+
import { positionLocal } from '../../nodes/accessors/Position.js';
|
|
14
|
+
import { skinningReference } from '../../nodes/accessors/SkinningNode.js';
|
|
15
|
+
import { morphReference } from '../../nodes/accessors/MorphNode.js';
|
|
16
|
+
import { lights } from '../../nodes/lighting/LightsNode.js';
|
|
17
|
+
import { mix } from '../../nodes/math/MathNode.js';
|
|
18
|
+
import { float, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
19
|
+
import AONode from '../../nodes/lighting/AONode.js';
|
|
20
|
+
import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
|
|
21
|
+
import IrradianceNode from '../../nodes/lighting/IrradianceNode.js';
|
|
22
|
+
import { depth } from '../../nodes/display/ViewportDepthNode.js';
|
|
23
|
+
import { cameraLogDepth } from '../../nodes/accessors/Camera.js';
|
|
24
|
+
import { clipping, clippingAlpha } from '../../nodes/accessors/ClippingNode.js';
|
|
27
25
|
|
|
28
26
|
const NodeMaterials = new Map();
|
|
29
27
|
|
|
@@ -40,8 +38,7 @@ class NodeMaterial extends Material {
|
|
|
40
38
|
this.forceSinglePass = false;
|
|
41
39
|
|
|
42
40
|
this.fog = true;
|
|
43
|
-
this.lights =
|
|
44
|
-
this.normals = true;
|
|
41
|
+
this.lights = false;
|
|
45
42
|
|
|
46
43
|
this.lightsNode = null;
|
|
47
44
|
this.envNode = null;
|
|
@@ -61,6 +58,7 @@ class NodeMaterial extends Material {
|
|
|
61
58
|
this.shadowPositionNode = null;
|
|
62
59
|
|
|
63
60
|
this.outputNode = null;
|
|
61
|
+
this.mrtNode = null;
|
|
64
62
|
|
|
65
63
|
this.fragmentNode = null;
|
|
66
64
|
this.vertexNode = null;
|
|
@@ -81,6 +79,8 @@ class NodeMaterial extends Material {
|
|
|
81
79
|
|
|
82
80
|
setup( builder ) {
|
|
83
81
|
|
|
82
|
+
builder.context.setupNormal = () => this.setupNormal( builder );
|
|
83
|
+
|
|
84
84
|
// < VERTEX STAGE >
|
|
85
85
|
|
|
86
86
|
builder.addStack();
|
|
@@ -101,8 +101,6 @@ class NodeMaterial extends Material {
|
|
|
101
101
|
|
|
102
102
|
if ( this.fragmentNode === null ) {
|
|
103
103
|
|
|
104
|
-
if ( this.normals === true ) this.setupNormal( builder );
|
|
105
|
-
|
|
106
104
|
this.setupDiffuseColor( builder );
|
|
107
105
|
this.setupVariants( builder );
|
|
108
106
|
|
|
@@ -124,6 +122,33 @@ class NodeMaterial extends Material {
|
|
|
124
122
|
|
|
125
123
|
if ( this.outputNode !== null ) resultNode = this.outputNode;
|
|
126
124
|
|
|
125
|
+
// MRT
|
|
126
|
+
|
|
127
|
+
const renderTarget = builder.renderer.getRenderTarget();
|
|
128
|
+
|
|
129
|
+
if ( renderTarget !== null ) {
|
|
130
|
+
|
|
131
|
+
const mrt = builder.renderer.getMRT();
|
|
132
|
+
const materialMRT = this.mrtNode;
|
|
133
|
+
|
|
134
|
+
if ( mrt !== null ) {
|
|
135
|
+
|
|
136
|
+
resultNode = mrt;
|
|
137
|
+
|
|
138
|
+
if ( materialMRT !== null ) {
|
|
139
|
+
|
|
140
|
+
resultNode = mrt.merge( materialMRT );
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
} else if ( materialMRT !== null ) {
|
|
145
|
+
|
|
146
|
+
resultNode = materialMRT;
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
127
152
|
} else {
|
|
128
153
|
|
|
129
154
|
let fragmentNode = this.fragmentNode;
|
|
@@ -179,17 +204,27 @@ class NodeMaterial extends Material {
|
|
|
179
204
|
|
|
180
205
|
let depthNode = this.depthNode;
|
|
181
206
|
|
|
182
|
-
if ( depthNode === null
|
|
207
|
+
if ( depthNode === null ) {
|
|
208
|
+
|
|
209
|
+
const mrt = renderer.getMRT();
|
|
210
|
+
|
|
211
|
+
if ( mrt && mrt.has( 'depth' ) ) {
|
|
212
|
+
|
|
213
|
+
depthNode = mrt.get( 'depth' );
|
|
214
|
+
|
|
215
|
+
} else if ( renderer.logarithmicDepthBuffer === true ) {
|
|
183
216
|
|
|
184
|
-
|
|
217
|
+
const fragDepth = modelViewProjection().w.add( 1 );
|
|
185
218
|
|
|
186
|
-
|
|
219
|
+
depthNode = fragDepth.log2().mul( cameraLogDepth ).mul( 0.5 );
|
|
220
|
+
|
|
221
|
+
}
|
|
187
222
|
|
|
188
223
|
}
|
|
189
224
|
|
|
190
225
|
if ( depthNode !== null ) {
|
|
191
226
|
|
|
192
|
-
|
|
227
|
+
depth.assign( depthNode ).append();
|
|
193
228
|
|
|
194
229
|
}
|
|
195
230
|
|
|
@@ -232,7 +267,7 @@ class NodeMaterial extends Material {
|
|
|
232
267
|
|
|
233
268
|
}
|
|
234
269
|
|
|
235
|
-
if ( ( object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true )
|
|
270
|
+
if ( ( object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true ) ) {
|
|
236
271
|
|
|
237
272
|
instance( object ).append();
|
|
238
273
|
|
|
@@ -275,6 +310,15 @@ class NodeMaterial extends Material {
|
|
|
275
310
|
|
|
276
311
|
}
|
|
277
312
|
|
|
313
|
+
if ( object.isBatchedMesh && object._colorsTexture ) {
|
|
314
|
+
|
|
315
|
+
const batchColor = varyingProperty( 'vec3', 'vBatchColor' );
|
|
316
|
+
|
|
317
|
+
colorNode = batchColor.mul( colorNode );
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
278
322
|
// COLOR
|
|
279
323
|
|
|
280
324
|
diffuseColor.assign( colorNode );
|
|
@@ -294,35 +338,33 @@ class NodeMaterial extends Material {
|
|
|
294
338
|
|
|
295
339
|
}
|
|
296
340
|
|
|
297
|
-
|
|
341
|
+
if ( this.transparent === false && this.blending === NormalBlending && this.alphaToCoverage === false ) {
|
|
298
342
|
|
|
299
|
-
|
|
343
|
+
diffuseColor.a.assign( 1.0 );
|
|
300
344
|
|
|
301
|
-
|
|
345
|
+
}
|
|
302
346
|
|
|
303
347
|
}
|
|
304
348
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
// NORMAL VIEW
|
|
349
|
+
setupVariants( /*builder*/ ) {
|
|
308
350
|
|
|
309
|
-
|
|
351
|
+
// Interface function.
|
|
310
352
|
|
|
311
|
-
|
|
353
|
+
}
|
|
312
354
|
|
|
313
|
-
|
|
355
|
+
setupOutgoingLight() {
|
|
314
356
|
|
|
315
|
-
|
|
357
|
+
return ( this.lights === true ) ? vec3( 0 ) : diffuseColor.rgb;
|
|
316
358
|
|
|
317
|
-
|
|
359
|
+
}
|
|
318
360
|
|
|
319
|
-
|
|
361
|
+
setupNormal() {
|
|
320
362
|
|
|
321
|
-
|
|
363
|
+
return this.normalNode ? vec3( this.normalNode ) : materialNormal;
|
|
322
364
|
|
|
323
365
|
}
|
|
324
366
|
|
|
325
|
-
|
|
367
|
+
setupEnvironment( /*builder*/ ) {
|
|
326
368
|
|
|
327
369
|
let node = null;
|
|
328
370
|
|
|
@@ -332,11 +374,21 @@ class NodeMaterial extends Material {
|
|
|
332
374
|
|
|
333
375
|
} else if ( this.envMap ) {
|
|
334
376
|
|
|
335
|
-
node = this.envMap.isCubeTexture ?
|
|
377
|
+
node = this.envMap.isCubeTexture ? materialReference( 'envMap', 'cubeTexture' ) : materialReference( 'envMap', 'texture' );
|
|
378
|
+
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return node;
|
|
336
382
|
|
|
337
|
-
|
|
383
|
+
}
|
|
338
384
|
|
|
339
|
-
|
|
385
|
+
setupLightMap( builder ) {
|
|
386
|
+
|
|
387
|
+
let node = null;
|
|
388
|
+
|
|
389
|
+
if ( builder.material.lightMap ) {
|
|
390
|
+
|
|
391
|
+
node = new IrradianceNode( materialLightMap );
|
|
340
392
|
|
|
341
393
|
}
|
|
342
394
|
|
|
@@ -346,27 +398,29 @@ class NodeMaterial extends Material {
|
|
|
346
398
|
|
|
347
399
|
setupLights( builder ) {
|
|
348
400
|
|
|
349
|
-
const
|
|
401
|
+
const materialLightsNode = [];
|
|
350
402
|
|
|
351
403
|
//
|
|
352
404
|
|
|
353
|
-
const
|
|
405
|
+
const envNode = this.setupEnvironment( builder );
|
|
354
406
|
|
|
355
|
-
if ( envNode ) {
|
|
407
|
+
if ( envNode && envNode.isLightingNode ) {
|
|
356
408
|
|
|
357
|
-
materialLightsNode.push(
|
|
409
|
+
materialLightsNode.push( envNode );
|
|
358
410
|
|
|
359
411
|
}
|
|
360
412
|
|
|
361
|
-
|
|
413
|
+
const lightMapNode = this.setupLightMap( builder );
|
|
362
414
|
|
|
363
|
-
|
|
415
|
+
if ( lightMapNode && lightMapNode.isLightingNode ) {
|
|
416
|
+
|
|
417
|
+
materialLightsNode.push( lightMapNode );
|
|
364
418
|
|
|
365
419
|
}
|
|
366
420
|
|
|
367
421
|
if ( this.aoNode !== null || builder.material.aoMap ) {
|
|
368
422
|
|
|
369
|
-
const aoNode = this.aoNode !== null ? this.aoNode :
|
|
423
|
+
const aoNode = this.aoNode !== null ? this.aoNode : materialAOMap;
|
|
370
424
|
|
|
371
425
|
materialLightsNode.push( new AONode( aoNode ) );
|
|
372
426
|
|
|
@@ -376,7 +430,7 @@ class NodeMaterial extends Material {
|
|
|
376
430
|
|
|
377
431
|
if ( materialLightsNode.length > 0 ) {
|
|
378
432
|
|
|
379
|
-
lightsN =
|
|
433
|
+
lightsN = lights( [ ...lightsN.getLights(), ...materialLightsNode ] );
|
|
380
434
|
|
|
381
435
|
}
|
|
382
436
|
|
|
@@ -401,9 +455,9 @@ class NodeMaterial extends Material {
|
|
|
401
455
|
|
|
402
456
|
const lightsNode = lights ? this.setupLights( builder ) : null;
|
|
403
457
|
|
|
404
|
-
let outgoingLightNode =
|
|
458
|
+
let outgoingLightNode = this.setupOutgoingLight( builder );
|
|
405
459
|
|
|
406
|
-
if ( lightsNode && lightsNode.
|
|
460
|
+
if ( lightsNode && lightsNode.getScope().getLights().length > 0 ) {
|
|
407
461
|
|
|
408
462
|
const lightingModel = this.setupLightingModel( builder );
|
|
409
463
|
|
|
@@ -419,7 +473,9 @@ class NodeMaterial extends Material {
|
|
|
419
473
|
|
|
420
474
|
if ( ( emissiveNode && emissiveNode.isNode === true ) || ( material.emissive && material.emissive.isColor === true ) ) {
|
|
421
475
|
|
|
422
|
-
|
|
476
|
+
emissive.assign( vec3( emissiveNode ? emissiveNode : materialEmissive ) );
|
|
477
|
+
|
|
478
|
+
outgoingLightNode = outgoingLightNode.add( emissive );
|
|
423
479
|
|
|
424
480
|
}
|
|
425
481
|
|
|
@@ -431,9 +487,13 @@ class NodeMaterial extends Material {
|
|
|
431
487
|
|
|
432
488
|
// FOG
|
|
433
489
|
|
|
434
|
-
|
|
490
|
+
if ( this.fog === true ) {
|
|
491
|
+
|
|
492
|
+
const fogNode = builder.fogNode;
|
|
493
|
+
|
|
494
|
+
if ( fogNode ) outputNode = vec4( fogNode.mix( outputNode.rgb, fogNode.colorNode ), outputNode.a );
|
|
435
495
|
|
|
436
|
-
|
|
496
|
+
}
|
|
437
497
|
|
|
438
498
|
return outputNode;
|
|
439
499
|
|
|
@@ -551,6 +611,7 @@ class NodeMaterial extends Material {
|
|
|
551
611
|
this.shadowPositionNode = source.shadowPositionNode;
|
|
552
612
|
|
|
553
613
|
this.outputNode = source.outputNode;
|
|
614
|
+
this.mrtNode = source.mrtNode;
|
|
554
615
|
|
|
555
616
|
this.fragmentNode = source.fragmentNode;
|
|
556
617
|
this.vertexNode = source.vertexNode;
|
|
@@ -559,50 +620,37 @@ class NodeMaterial extends Material {
|
|
|
559
620
|
|
|
560
621
|
}
|
|
561
622
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if ( material.isNodeMaterial === true ) { // is already a node material
|
|
565
|
-
|
|
566
|
-
return material;
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
const type = material.type.replace( 'Material', 'NodeMaterial' );
|
|
623
|
+
}
|
|
571
624
|
|
|
572
|
-
|
|
625
|
+
export default NodeMaterial;
|
|
573
626
|
|
|
574
|
-
|
|
627
|
+
NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( '', NodeMaterial );
|
|
575
628
|
|
|
576
|
-
|
|
629
|
+
export function registerNodeMaterial( type, nodeMaterialClass ) {
|
|
577
630
|
|
|
578
|
-
|
|
631
|
+
const suffix = 'NodeMaterial';
|
|
632
|
+
const nodeMaterialType = type + suffix;
|
|
579
633
|
|
|
580
|
-
|
|
634
|
+
if ( typeof nodeMaterialClass !== 'function' ) throw new Error( `THREE.Node: NodeMaterial class "${ type }" is not a class.` );
|
|
581
635
|
|
|
582
|
-
|
|
636
|
+
if ( NodeMaterials.has( nodeMaterialType ) ) {
|
|
583
637
|
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
return nodeMaterial;
|
|
638
|
+
console.warn( `THREE.Node: Redefinition of NodeMaterial class "${ nodeMaterialType }".` );
|
|
639
|
+
return;
|
|
587
640
|
|
|
588
641
|
}
|
|
589
642
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
export default NodeMaterial;
|
|
643
|
+
if ( type.slice( - suffix.length ) === suffix ) {
|
|
593
644
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
if ( typeof nodeMaterial !== 'function' || ! type ) throw new Error( `Node material ${ type } is not a class` );
|
|
597
|
-
if ( NodeMaterials.has( type ) ) {
|
|
598
|
-
|
|
599
|
-
console.warn( `Redefinition of node material ${ type }` );
|
|
645
|
+
console.warn( `THREE.NodeMaterial: NodeMaterial class ${ nodeMaterialType } should not have '${ suffix }' suffix.` );
|
|
600
646
|
return;
|
|
601
647
|
|
|
602
648
|
}
|
|
603
649
|
|
|
604
|
-
NodeMaterials.set(
|
|
605
|
-
|
|
650
|
+
NodeMaterials.set( nodeMaterialType, nodeMaterialClass );
|
|
651
|
+
nodeMaterialClass.type = nodeMaterialType;
|
|
652
|
+
|
|
653
|
+
return nodeMaterialType;
|
|
606
654
|
|
|
607
655
|
}
|
|
608
656
|
|
|
@@ -617,5 +665,3 @@ export function createNodeMaterialFromType( type ) {
|
|
|
617
665
|
}
|
|
618
666
|
|
|
619
667
|
}
|
|
620
|
-
|
|
621
|
-
addNodeMaterial( 'NodeMaterial', NodeMaterial );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @TODO: We can simplify "export { default as SomeNode, other, exports } from '...'" to just "export * from '...'" if we will use only named exports
|
|
2
2
|
|
|
3
|
-
export { default as NodeMaterial
|
|
3
|
+
export { default as NodeMaterial } from './NodeMaterial.js';
|
|
4
4
|
export { default as InstancedPointsNodeMaterial } from './InstancedPointsNodeMaterial.js';
|
|
5
5
|
export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
|
|
6
6
|
export { default as LineDashedNodeMaterial } from './LineDashedNodeMaterial.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
2
|
|
|
3
|
-
import { PointsMaterial } from '
|
|
3
|
+
import { PointsMaterial } from '../PointsMaterial.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
6
6
|
|
|
7
7
|
class PointsNodeMaterial extends NodeMaterial {
|
|
8
8
|
|
|
@@ -13,12 +13,11 @@ class PointsNodeMaterial extends NodeMaterial {
|
|
|
13
13
|
this.isPointsNodeMaterial = true;
|
|
14
14
|
|
|
15
15
|
this.lights = false;
|
|
16
|
-
this.normals = false;
|
|
17
16
|
this.transparent = true;
|
|
18
17
|
|
|
19
18
|
this.sizeNode = null;
|
|
20
19
|
|
|
21
|
-
this.setDefaultValues(
|
|
20
|
+
this.setDefaultValues( _defaultValues );
|
|
22
21
|
|
|
23
22
|
this.setValues( parameters );
|
|
24
23
|
|
|
@@ -36,4 +35,4 @@ class PointsNodeMaterial extends NodeMaterial {
|
|
|
36
35
|
|
|
37
36
|
export default PointsNodeMaterial;
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
PointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Points', PointsNodeMaterial );
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js';
|
|
3
|
+
|
|
4
|
+
import { ShadowMaterial } from '../ShadowMaterial.js';
|
|
5
|
+
|
|
6
|
+
const _defaultValues = /*@__PURE__*/ new ShadowMaterial();
|
|
7
|
+
|
|
8
|
+
class ShadowNodeMaterial extends NodeMaterial {
|
|
9
|
+
|
|
10
|
+
constructor( parameters ) {
|
|
11
|
+
|
|
12
|
+
super();
|
|
13
|
+
|
|
14
|
+
this.isShadowNodeMaterial = true;
|
|
15
|
+
|
|
16
|
+
this.lights = true;
|
|
17
|
+
|
|
18
|
+
this.setDefaultValues( _defaultValues );
|
|
19
|
+
|
|
20
|
+
this.setValues( parameters );
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setupLightingModel( /*builder*/ ) {
|
|
25
|
+
|
|
26
|
+
return new ShadowMaskModel();
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default ShadowNodeMaterial;
|
|
33
|
+
|
|
34
|
+
ShadowNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Shadow', ShadowNodeMaterial );
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { uniform } from '
|
|
3
|
-
import { cameraProjectionMatrix } from '
|
|
4
|
-
import { materialRotation } from '
|
|
5
|
-
import { modelViewMatrix, modelWorldMatrix } from '
|
|
6
|
-
import { positionLocal } from '
|
|
7
|
-
import {
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { uniform } from '../../nodes/core/UniformNode.js';
|
|
3
|
+
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
4
|
+
import { materialRotation } from '../../nodes/accessors/MaterialNode.js';
|
|
5
|
+
import { modelViewMatrix, modelWorldMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
6
|
+
import { positionLocal } from '../../nodes/accessors/Position.js';
|
|
7
|
+
import { rotate } from '../../nodes/utils/RotateNode.js';
|
|
8
|
+
import { float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
9
|
|
|
9
|
-
import { SpriteMaterial } from '
|
|
10
|
+
import { SpriteMaterial } from '../SpriteMaterial.js';
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const _defaultValues = /*@__PURE__*/ new SpriteMaterial();
|
|
12
13
|
|
|
13
14
|
class SpriteNodeMaterial extends NodeMaterial {
|
|
14
15
|
|
|
@@ -19,13 +20,12 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
19
20
|
this.isSpriteNodeMaterial = true;
|
|
20
21
|
|
|
21
22
|
this.lights = false;
|
|
22
|
-
this.normals = false;
|
|
23
23
|
|
|
24
24
|
this.positionNode = null;
|
|
25
25
|
this.rotationNode = null;
|
|
26
26
|
this.scaleNode = null;
|
|
27
27
|
|
|
28
|
-
this.setDefaultValues(
|
|
28
|
+
this.setDefaultValues( _defaultValues );
|
|
29
29
|
|
|
30
30
|
this.setValues( parameters );
|
|
31
31
|
|
|
@@ -61,7 +61,7 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
61
61
|
|
|
62
62
|
const rotation = float( rotationNode || materialRotation );
|
|
63
63
|
|
|
64
|
-
const rotatedPosition =
|
|
64
|
+
const rotatedPosition = rotate( alignedPosition, rotation );
|
|
65
65
|
|
|
66
66
|
mvPosition = vec4( mvPosition.xy.add( rotatedPosition ), mvPosition.zw );
|
|
67
67
|
|
|
@@ -87,4 +87,4 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
87
87
|
|
|
88
88
|
export default SpriteNodeMaterial;
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
SpriteNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Sprite', SpriteNodeMaterial );
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { texture3D } from '../accessors/Texture3DNode.js';
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { property } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
4
|
+
import { modelWorldMatrixInverse } from '../../nodes/accessors/ModelNode.js';
|
|
5
|
+
import { cameraPosition } from '../../nodes/accessors/Camera.js';
|
|
6
|
+
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
7
|
+
import { Fn, varying, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
|
+
import { min, max } from '../../nodes/math/MathNode.js';
|
|
9
|
+
import { Loop, Break } from '../../nodes/utils/LoopNode.js';
|
|
10
|
+
import { texture3D } from '../../nodes/accessors/Texture3DNode.js';
|
|
12
11
|
|
|
13
12
|
class VolumeNodeMaterial extends NodeMaterial {
|
|
14
13
|
|
|
@@ -16,7 +15,6 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
16
15
|
|
|
17
16
|
super();
|
|
18
17
|
|
|
19
|
-
this.normals = false;
|
|
20
18
|
this.lights = false;
|
|
21
19
|
this.isVolumeNodeMaterial = true;
|
|
22
20
|
this.testNode = null;
|
|
@@ -29,7 +27,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
29
27
|
|
|
30
28
|
const map = texture3D( this.map, null, 0 );
|
|
31
29
|
|
|
32
|
-
const hitBox =
|
|
30
|
+
const hitBox = Fn( ( { orig, dir } ) => {
|
|
33
31
|
|
|
34
32
|
const box_min = vec3( - 0.5 );
|
|
35
33
|
const box_max = vec3( 0.5 );
|
|
@@ -49,7 +47,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
49
47
|
|
|
50
48
|
} );
|
|
51
49
|
|
|
52
|
-
this.fragmentNode =
|
|
50
|
+
this.fragmentNode = Fn( () => {
|
|
53
51
|
|
|
54
52
|
const vOrigin = varying( vec3( modelWorldMatrixInverse.mul( vec4( cameraPosition, 1.0 ) ) ) );
|
|
55
53
|
const vDirection = varying( positionGeometry.sub( vOrigin ) );
|
|
@@ -69,7 +67,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
69
67
|
|
|
70
68
|
const ac = property( 'vec4', 'ac' ).assign( vec4( materialReference( 'base', 'color' ), 0.0 ) );
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
|
|
73
71
|
|
|
74
72
|
const d = property( 'float', 'd' ).assign( map.uv( p.add( 0.5 ) ).r );
|
|
75
73
|
|
|
@@ -103,4 +101,4 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
103
101
|
|
|
104
102
|
export default VolumeNodeMaterial;
|
|
105
103
|
|
|
106
|
-
|
|
104
|
+
VolumeNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Volume', VolumeNodeMaterial );
|
package/src/math/Box2.js
CHANGED
|
@@ -119,8 +119,8 @@ class Box2 {
|
|
|
119
119
|
|
|
120
120
|
containsPoint( point ) {
|
|
121
121
|
|
|
122
|
-
return point.x
|
|
123
|
-
point.y
|
|
122
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
123
|
+
point.y >= this.min.y && point.y <= this.max.y;
|
|
124
124
|
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -147,8 +147,8 @@ class Box2 {
|
|
|
147
147
|
|
|
148
148
|
// using 4 splitting planes to rule out intersections
|
|
149
149
|
|
|
150
|
-
return box.max.x
|
|
151
|
-
box.max.y
|
|
150
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
151
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y;
|
|
152
152
|
|
|
153
153
|
}
|
|
154
154
|
|
package/src/math/Box3.js
CHANGED
|
@@ -238,9 +238,9 @@ class Box3 {
|
|
|
238
238
|
|
|
239
239
|
containsPoint( point ) {
|
|
240
240
|
|
|
241
|
-
return point.x
|
|
242
|
-
point.y
|
|
243
|
-
point.z
|
|
241
|
+
return point.x >= this.min.x && point.x <= this.max.x &&
|
|
242
|
+
point.y >= this.min.y && point.y <= this.max.y &&
|
|
243
|
+
point.z >= this.min.z && point.z <= this.max.z;
|
|
244
244
|
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -268,9 +268,9 @@ class Box3 {
|
|
|
268
268
|
intersectsBox( box ) {
|
|
269
269
|
|
|
270
270
|
// using 6 splitting planes to rule out intersections.
|
|
271
|
-
return box.max.x
|
|
272
|
-
box.max.y
|
|
273
|
-
box.max.z
|
|
271
|
+
return box.max.x >= this.min.x && box.min.x <= this.max.x &&
|
|
272
|
+
box.max.y >= this.min.y && box.min.y <= this.max.y &&
|
|
273
|
+
box.max.z >= this.min.z && box.min.z <= this.max.z;
|
|
274
274
|
|
|
275
275
|
}
|
|
276
276
|
|