super-three 0.184.0 → 0.185.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 +1260 -927
- package/build/three.core.js +1104 -829
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +156 -98
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +11 -4
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +7538 -3367
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +7538 -3366
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -0
- package/examples/jsm/controls/ArcballControls.js +6 -2
- package/examples/jsm/controls/FirstPersonControls.js +79 -42
- package/examples/jsm/controls/TransformControls.js +68 -15
- package/examples/jsm/csm/CSMFrustum.js +31 -6
- package/examples/jsm/csm/CSMShadowNode.js +4 -1
- package/examples/jsm/effects/AsciiEffect.js +14 -1
- package/examples/jsm/exporters/DRACOExporter.js +27 -6
- package/examples/jsm/exporters/GLTFExporter.js +114 -12
- package/examples/jsm/exporters/PLYExporter.js +286 -73
- package/examples/jsm/exporters/USDZExporter.js +347 -112
- package/examples/jsm/generators/CityGenerator.js +346 -0
- package/examples/jsm/generators/ForestGenerator.js +347 -0
- package/examples/jsm/generators/TerrainGenerator.js +504 -0
- package/examples/jsm/generators/TreeGenerator.js +377 -0
- package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
- package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
- package/examples/jsm/geometries/LoftGeometry.js +355 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +5 -4
- package/examples/jsm/helpers/ViewHelper.js +16 -6
- package/examples/jsm/inspector/Inspector.js +53 -15
- package/examples/jsm/inspector/RendererInspector.js +152 -36
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
- package/examples/jsm/inspector/tabs/Console.js +200 -18
- package/examples/jsm/inspector/tabs/Memory.js +8 -0
- package/examples/jsm/inspector/tabs/Parameters.js +64 -4
- package/examples/jsm/inspector/tabs/Performance.js +21 -6
- package/examples/jsm/inspector/tabs/Settings.js +51 -9
- package/examples/jsm/inspector/tabs/Timeline.js +178 -93
- package/examples/jsm/inspector/tabs/Viewer.js +628 -16
- package/examples/jsm/inspector/ui/Graph.js +162 -25
- package/examples/jsm/inspector/ui/Item.js +92 -13
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +90 -45
- package/examples/jsm/inspector/ui/Style.js +1788 -1401
- package/examples/jsm/inspector/ui/Tab.js +5 -3
- package/examples/jsm/inspector/ui/Values.js +71 -6
- package/examples/jsm/inspector/ui/utils.js +130 -10
- package/examples/jsm/libs/basis/README.md +0 -1
- package/examples/jsm/libs/demuxer_mp4.js +3 -3
- package/examples/jsm/libs/draco/README.md +0 -1
- package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
- package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
- package/examples/jsm/libs/mikktspace.module.js +34 -9
- package/examples/jsm/lighting/ClusteredLighting.js +55 -0
- package/examples/jsm/lighting/LightProbeGrid.js +106 -76
- package/examples/jsm/lines/LineMaterial.js +38 -15
- package/examples/jsm/lines/LineSegments2.js +8 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +46 -13
- package/examples/jsm/loaders/EXRLoader.js +27 -55
- package/examples/jsm/loaders/HDRLoader.js +6 -28
- package/examples/jsm/loaders/KTX2Loader.js +31 -12
- package/examples/jsm/loaders/LDrawLoader.js +8 -8
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
- package/examples/jsm/loaders/LWOLoader.js +4 -0
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MaterialXLoader.js +31 -9
- package/examples/jsm/loaders/NRRDLoader.js +3 -3
- package/examples/jsm/loaders/PCDLoader.js +7 -7
- package/examples/jsm/loaders/PLYLoader.js +218 -55
- package/examples/jsm/loaders/SVGLoader.js +547 -495
- package/examples/jsm/loaders/TTFLoader.js +1 -1
- package/examples/jsm/loaders/USDLoader.js +33 -9
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +93 -20
- package/examples/jsm/loaders/usd/USDCParser.js +1 -1
- package/examples/jsm/loaders/usd/USDComposer.js +52 -19
- package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
- package/examples/jsm/misc/Volume.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +1 -1
- package/examples/jsm/objects/Reflector.js +2 -3
- package/examples/jsm/objects/Water2Mesh.js +1 -1
- package/examples/jsm/physics/AmmoPhysics.js +15 -8
- package/examples/jsm/physics/RapierPhysics.js +27 -2
- package/examples/jsm/shaders/VolumeShader.js +31 -44
- package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
- package/examples/jsm/transpiler/Linker.js +1 -1
- package/examples/jsm/tsl/display/BloomNode.js +59 -19
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
- package/examples/jsm/tsl/display/FXAANode.js +11 -12
- package/examples/jsm/tsl/display/GTAONode.js +34 -13
- package/examples/jsm/tsl/display/GodraysNode.js +1 -1
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
- package/examples/jsm/tsl/display/SSGINode.js +89 -39
- package/examples/jsm/tsl/display/SSRNode.js +829 -132
- package/examples/jsm/tsl/display/SSSNode.js +2 -2
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
- package/examples/jsm/tsl/math/curlNoise.js +107 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
- package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
- package/examples/jsm/tsl/utils/RNoise.js +51 -0
- package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
- package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
- package/examples/jsm/utils/SceneOptimizer.js +1 -1
- package/examples/jsm/webxr/ARButton.js +1 -1
- package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
- package/package.json +7 -7
- package/src/Three.TSL.js +10 -3
- package/src/Three.WebGPU.js +4 -0
- package/src/animation/AnimationAction.js +15 -11
- package/src/animation/AnimationClip.js +0 -139
- package/src/animation/KeyframeTrack.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/Camera.js +2 -2
- package/src/cameras/StereoCamera.js +5 -2
- package/src/constants.js +1 -1
- package/src/core/BufferGeometry.js +29 -7
- package/src/core/Object3D.js +17 -7
- package/src/core/Raycaster.js +1 -1
- package/src/core/RenderTarget.js +15 -2
- package/src/extras/PMREMGenerator.js +6 -4
- package/src/extras/TextureUtils.js +1 -1
- package/src/extras/core/ShapePath.js +149 -160
- package/src/geometries/SphereGeometry.js +8 -3
- package/src/helpers/DirectionalLightHelper.js +2 -0
- package/src/helpers/HemisphereLightHelper.js +2 -0
- package/src/helpers/PointLightHelper.js +2 -0
- package/src/helpers/SpotLightHelper.js +1 -1
- package/src/loaders/DataTextureLoader.js +69 -38
- package/src/loaders/LoadingManager.js +5 -0
- package/src/loaders/MaterialLoader.js +36 -266
- package/src/loaders/ObjectLoader.js +3 -1
- package/src/materials/LineBasicMaterial.js +4 -0
- package/src/materials/Material.js +196 -1
- package/src/materials/MeshBasicMaterial.js +24 -0
- package/src/materials/MeshDepthMaterial.js +10 -0
- package/src/materials/MeshDistanceMaterial.js +10 -0
- package/src/materials/MeshLambertMaterial.js +40 -1
- package/src/materials/MeshMatcapMaterial.js +25 -1
- package/src/materials/MeshNormalMaterial.js +9 -1
- package/src/materials/MeshPhongMaterial.js +40 -1
- package/src/materials/MeshPhysicalMaterial.js +38 -0
- package/src/materials/MeshStandardMaterial.js +42 -1
- package/src/materials/MeshToonMaterial.js +34 -1
- package/src/materials/PointsMaterial.js +7 -0
- package/src/materials/ShaderMaterial.js +86 -0
- package/src/materials/SpriteMaterial.js +7 -0
- package/src/materials/nodes/Line2NodeMaterial.js +378 -322
- package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
- package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
- package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
- package/src/materials/nodes/NodeMaterial.js +115 -71
- package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
- package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
- package/src/math/Box3.js +5 -0
- package/src/math/FrustumArray.js +103 -133
- package/src/math/Interpolant.js +1 -1
- package/src/math/MathUtils.js +2 -2
- package/src/math/Matrix3.js +11 -0
- package/src/math/Matrix4.js +28 -3
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +2 -2
- package/src/math/Vector4.js +2 -2
- package/src/math/interpolants/BezierInterpolant.js +4 -6
- package/src/nodes/Nodes.js +2 -5
- package/src/nodes/TSL.js +8 -6
- package/src/nodes/accessors/Arrays.js +4 -4
- package/src/nodes/accessors/Batch.js +108 -0
- package/src/nodes/accessors/Bitangent.js +2 -2
- package/src/nodes/accessors/BufferAttributeNode.js +13 -2
- package/src/nodes/accessors/Camera.js +7 -7
- package/src/nodes/accessors/ClippingNode.js +1 -1
- package/src/nodes/accessors/Instance.js +264 -0
- package/src/nodes/accessors/MaterialNode.js +18 -2
- package/src/nodes/accessors/MaterialProperties.js +4 -3
- package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
- package/src/nodes/accessors/Normal.js +13 -13
- package/src/nodes/accessors/Position.js +5 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -0
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneProperties.js +1 -1
- package/src/nodes/accessors/Skinning.js +263 -0
- package/src/nodes/accessors/StorageBufferNode.js +2 -2
- package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
- package/src/nodes/accessors/StorageTextureNode.js +39 -7
- package/src/nodes/accessors/Tangent.js +4 -4
- package/src/nodes/accessors/TextureNode.js +60 -5
- package/src/nodes/code/FunctionNode.js +2 -16
- package/src/nodes/core/MRTNode.js +7 -2
- package/src/nodes/core/Node.js +39 -2
- package/src/nodes/core/NodeBuilder.js +201 -41
- package/src/nodes/core/NodeUtils.js +13 -13
- package/src/nodes/core/OutputStructNode.js +1 -1
- package/src/nodes/core/OverrideContextNode.js +153 -0
- package/src/nodes/core/PropertyNode.js +51 -5
- package/src/nodes/core/StackNode.js +56 -34
- package/src/nodes/core/StructNode.js +4 -6
- package/src/nodes/core/StructTypeNode.js +6 -6
- package/src/nodes/core/VarNode.js +8 -0
- package/src/nodes/core/VaryingNode.js +12 -2
- package/src/nodes/display/BlendModes.js +1 -41
- package/src/nodes/display/BumpMapNode.js +6 -1
- package/src/nodes/display/ColorAdjustment.js +10 -9
- package/src/nodes/display/FrontFacingNode.js +38 -9
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +35 -43
- package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
- package/src/nodes/display/RenderOutputNode.js +12 -3
- package/src/nodes/functions/VolumetricLightingModel.js +40 -7
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
- package/src/nodes/lighting/EnvironmentNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +40 -2
- package/src/nodes/lighting/LightingContextNode.js +10 -2
- package/src/nodes/lighting/LightsNode.js +90 -37
- package/src/nodes/lighting/PointShadowNode.js +6 -1
- package/src/nodes/lighting/ShadowFilterNode.js +21 -52
- package/src/nodes/lighting/ShadowNode.js +34 -14
- package/src/nodes/materialx/lib/mx_noise.js +2 -2
- package/src/nodes/math/ConditionalNode.js +3 -3
- package/src/nodes/math/MathNode.js +39 -11
- package/src/nodes/math/OperatorNode.js +23 -23
- package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
- package/src/nodes/pmrem/PMREMNode.js +33 -2
- package/src/nodes/tsl/TSLCore.js +63 -18
- package/src/nodes/utils/EquirectUV.js +30 -5
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/Packing.js +35 -4
- package/src/nodes/utils/RTTNode.js +40 -24
- package/src/nodes/utils/ReflectorNode.js +1 -0
- package/src/nodes/utils/StorageArrayElementNode.js +1 -1
- package/src/objects/BatchedMesh.js +22 -14
- package/src/objects/InstancedMesh.js +0 -11
- package/src/objects/Skeleton.js +0 -9
- package/src/renderers/WebGLRenderer.js +19 -15
- package/src/renderers/common/Backend.js +49 -5
- package/src/renderers/common/Bindings.js +114 -45
- package/src/renderers/common/Buffer.js +9 -0
- package/src/renderers/common/ClippingContext.js +10 -2
- package/src/renderers/common/Info.js +63 -22
- package/src/renderers/common/Lighting.js +53 -5
- package/src/renderers/common/RenderList.js +41 -4
- package/src/renderers/common/RenderObject.js +73 -13
- package/src/renderers/common/Renderer.js +281 -108
- package/src/renderers/common/Sampler.js +16 -48
- package/src/renderers/common/Textures.js +32 -5
- package/src/renderers/common/TimestampQueryPool.js +1 -1
- package/src/renderers/common/UniformsGroup.js +31 -9
- package/src/renderers/common/XRManager.js +340 -22
- package/src/renderers/common/extras/PMREMGenerator.js +15 -38
- package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
- package/src/renderers/common/nodes/NodeLibrary.js +4 -4
- package/src/renderers/common/nodes/NodeManager.js +63 -14
- package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
- package/src/renderers/webgl/WebGLOutput.js +2 -1
- package/src/renderers/webgl/WebGLProgram.js +5 -4
- package/src/renderers/webgl/WebGLPrograms.js +12 -5
- package/src/renderers/webgl/WebGLRenderLists.js +9 -1
- package/src/renderers/webgl/WebGLShaderCache.js +5 -11
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
- package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
- package/src/renderers/webgpu/WebGPUBackend.js +480 -169
- package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
- package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
- package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
- package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
- package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
- package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
- package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
- package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
- package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
- package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
- package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
- package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
- package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
- package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
- package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
- package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
- package/src/textures/DepthTexture.js +1 -1
- package/src/textures/ExternalTexture.js +0 -3
- package/examples/fonts/LICENSE +0 -13
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
- package/examples/fonts/README.md +0 -11
- package/examples/fonts/droid/NOTICE +0 -190
- package/examples/fonts/droid/README.txt +0 -18
- package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
- package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
- package/examples/fonts/gentilis_bold.typeface.json +0 -1
- package/examples/fonts/gentilis_regular.typeface.json +0 -1
- package/examples/fonts/helvetiker_bold.typeface.json +0 -1
- package/examples/fonts/helvetiker_regular.typeface.json +0 -1
- package/examples/fonts/optimer_bold.typeface.json +0 -1
- package/examples/fonts/optimer_regular.typeface.json +0 -1
- package/examples/fonts/ttf/README.md +0 -9
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/inspector/extensions/extensions.json +0 -6
- package/examples/jsm/libs/ammo.wasm.js +0 -822
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +0 -33
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
- package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
- package/examples/jsm/libs/opentype.module.js +0 -14506
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lighting/TiledLighting.js +0 -42
- package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
- package/src/nodes/accessors/BatchNode.js +0 -163
- package/src/nodes/accessors/InstanceNode.js +0 -349
- package/src/nodes/accessors/InstancedMeshNode.js +0 -50
- package/src/nodes/accessors/SkinningNode.js +0 -328
|
@@ -5,7 +5,7 @@ import BasicLightMapNode from '../../nodes/lighting/BasicLightMapNode.js';
|
|
|
5
5
|
import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js';
|
|
6
6
|
import { normalViewGeometry } from '../../nodes/accessors/Normal.js';
|
|
7
7
|
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
8
|
-
import {
|
|
8
|
+
import { negateOnBackSide } from '../../nodes/display/FrontFacingNode.js';
|
|
9
9
|
|
|
10
10
|
import { MeshBasicMaterial } from '../MeshBasicMaterial.js';
|
|
11
11
|
|
|
@@ -66,7 +66,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
66
66
|
*/
|
|
67
67
|
setupNormal() {
|
|
68
68
|
|
|
69
|
-
return
|
|
69
|
+
return negateOnBackSide( normalViewGeometry ); // see #28839
|
|
70
70
|
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import NodeMaterial from './NodeMaterial.js';
|
|
2
2
|
import { diffuseColor } from '../../nodes/core/PropertyNode.js';
|
|
3
|
-
import {
|
|
3
|
+
import { packNormalToRGB } from '../../nodes/utils/Packing.js';
|
|
4
4
|
import { materialOpacity } from '../../nodes/accessors/MaterialNode.js';
|
|
5
5
|
import { normalView } from '../../nodes/accessors/Normal.js';
|
|
6
6
|
import { colorSpaceToWorking } from '../../nodes/display/ColorSpaceNode.js';
|
|
@@ -58,7 +58,7 @@ class MeshNormalNodeMaterial extends NodeMaterial {
|
|
|
58
58
|
|
|
59
59
|
// By convention, a normal packed to RGB is in sRGB color space. Convert it to working color space.
|
|
60
60
|
|
|
61
|
-
diffuseColor.assign( colorSpaceToWorking( vec4(
|
|
61
|
+
diffuseColor.assign( colorSpaceToWorking( vec4( packNormalToRGB( normalView ), opacityNode ), SRGBColorSpace ) );
|
|
62
62
|
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -127,15 +127,6 @@ class MeshPhongNodeMaterial extends NodeMaterial {
|
|
|
127
127
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
copy( source ) {
|
|
131
|
-
|
|
132
|
-
this.shininessNode = source.shininessNode;
|
|
133
|
-
this.specularNode = source.specularNode;
|
|
134
|
-
|
|
135
|
-
return super.copy( source );
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
130
|
}
|
|
140
131
|
|
|
141
132
|
export default MeshPhongNodeMaterial;
|
|
@@ -486,36 +486,6 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
486
486
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
copy( source ) {
|
|
490
|
-
|
|
491
|
-
this.clearcoatNode = source.clearcoatNode;
|
|
492
|
-
this.clearcoatRoughnessNode = source.clearcoatRoughnessNode;
|
|
493
|
-
this.clearcoatNormalNode = source.clearcoatNormalNode;
|
|
494
|
-
|
|
495
|
-
this.sheenNode = source.sheenNode;
|
|
496
|
-
this.sheenRoughnessNode = source.sheenRoughnessNode;
|
|
497
|
-
|
|
498
|
-
this.iridescenceNode = source.iridescenceNode;
|
|
499
|
-
this.iridescenceIORNode = source.iridescenceIORNode;
|
|
500
|
-
this.iridescenceThicknessNode = source.iridescenceThicknessNode;
|
|
501
|
-
|
|
502
|
-
this.specularIntensityNode = source.specularIntensityNode;
|
|
503
|
-
this.specularColorNode = source.specularColorNode;
|
|
504
|
-
|
|
505
|
-
this.iorNode = source.iorNode;
|
|
506
|
-
|
|
507
|
-
this.transmissionNode = source.transmissionNode;
|
|
508
|
-
this.thicknessNode = source.thicknessNode;
|
|
509
|
-
this.attenuationDistanceNode = source.attenuationDistanceNode;
|
|
510
|
-
this.attenuationColorNode = source.attenuationColorNode;
|
|
511
|
-
this.dispersionNode = source.dispersionNode;
|
|
512
|
-
|
|
513
|
-
this.anisotropyNode = source.anisotropyNode;
|
|
514
|
-
|
|
515
|
-
return super.copy( source );
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
489
|
}
|
|
520
490
|
|
|
521
491
|
export default MeshPhysicalNodeMaterial;
|
|
@@ -157,19 +157,6 @@ class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
|
|
|
157
157
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
copy( source ) {
|
|
161
|
-
|
|
162
|
-
this.thicknessColorNode = source.thicknessColorNode;
|
|
163
|
-
this.thicknessDistortionNode = source.thicknessDistortionNode;
|
|
164
|
-
this.thicknessAmbientNode = source.thicknessAmbientNode;
|
|
165
|
-
this.thicknessAttenuationNode = source.thicknessAttenuationNode;
|
|
166
|
-
this.thicknessPowerNode = source.thicknessPowerNode;
|
|
167
|
-
this.thicknessScaleNode = source.thicknessScaleNode;
|
|
168
|
-
|
|
169
|
-
return super.copy( source );
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
160
|
}
|
|
174
161
|
|
|
175
162
|
export default MeshSSSNodeMaterial;
|
|
@@ -171,17 +171,6 @@ class MeshStandardNodeMaterial extends NodeMaterial {
|
|
|
171
171
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
copy( source ) {
|
|
175
|
-
|
|
176
|
-
this.emissiveNode = source.emissiveNode;
|
|
177
|
-
|
|
178
|
-
this.metalnessNode = source.metalnessNode;
|
|
179
|
-
this.roughnessNode = source.roughnessNode;
|
|
180
|
-
|
|
181
|
-
return super.copy( source );
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
174
|
}
|
|
186
175
|
|
|
187
176
|
export default MeshStandardNodeMaterial;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Material } from '../Material.js';
|
|
2
2
|
|
|
3
3
|
import { hashArray, hashString } from '../../nodes/core/NodeUtils.js';
|
|
4
|
-
import { output, diffuseColor,
|
|
4
|
+
import { output, diffuseColor, ambientOcclusion, emissive } from '../../nodes/core/PropertyNode.js';
|
|
5
5
|
import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAO } from '../../nodes/accessors/MaterialNode.js';
|
|
6
6
|
import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
|
|
7
7
|
import { normalLocal } from '../../nodes/accessors/Normal.js';
|
|
8
|
-
import { instancedMesh } from '../../nodes/accessors/
|
|
9
|
-
import { batch } from '../../nodes/accessors/
|
|
8
|
+
import { instancedMesh, instanceColor } from '../../nodes/accessors/Instance.js';
|
|
9
|
+
import { batch, batchColor } from '../../nodes/accessors/Batch.js';
|
|
10
10
|
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
11
11
|
import { positionLocal, positionView } from '../../nodes/accessors/Position.js';
|
|
12
|
-
import { skinning } from '../../nodes/accessors/
|
|
13
|
-
import { morphReference } from '../../nodes/accessors/
|
|
12
|
+
import { skinning } from '../../nodes/accessors/Skinning.js';
|
|
13
|
+
import { morphReference } from '../../nodes/accessors/Morph.js';
|
|
14
14
|
import { fwidth, mix, smoothstep } from '../../nodes/math/MathNode.js';
|
|
15
15
|
import { float, vec3, vec4, bool } from '../../nodes/tsl/TSLBase.js';
|
|
16
16
|
import AONode from '../../nodes/lighting/AONode.js';
|
|
@@ -23,7 +23,7 @@ import NodeMaterialObserver from './manager/NodeMaterialObserver.js';
|
|
|
23
23
|
import getAlphaHashThreshold from '../../nodes/functions/material/getAlphaHashThreshold.js';
|
|
24
24
|
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
25
25
|
import { vertexColor } from '../../nodes/accessors/VertexColorNode.js';
|
|
26
|
-
import { premultiplyAlpha } from '../../nodes/display/
|
|
26
|
+
import { premultiplyAlpha } from '../../nodes/display/PremultiplyAlphaFunctions.js';
|
|
27
27
|
import { subBuild } from '../../nodes/core/SubBuildNode.js';
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -84,16 +84,6 @@ class NodeMaterial extends Material {
|
|
|
84
84
|
*/
|
|
85
85
|
this.lights = false;
|
|
86
86
|
|
|
87
|
-
/**
|
|
88
|
-
* Whether this material uses hardware clipping or not.
|
|
89
|
-
* This property is managed by the engine and should not be
|
|
90
|
-
* modified by apps.
|
|
91
|
-
*
|
|
92
|
-
* @type {boolean}
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
this.hardwareClipping = false;
|
|
96
|
-
|
|
97
87
|
/**
|
|
98
88
|
* Node materials which set their `lights` property to `true`
|
|
99
89
|
* are affected by all lights of the scene. Sometimes selective
|
|
@@ -533,6 +523,7 @@ class NodeMaterial extends Material {
|
|
|
533
523
|
if ( this.fragmentNode === null ) {
|
|
534
524
|
|
|
535
525
|
this.setupDiffuseColor( builder );
|
|
526
|
+
this.setupAmbientOcclusion( builder );
|
|
536
527
|
this.setupVariants( builder );
|
|
537
528
|
|
|
538
529
|
const outgoingLightNode = this.setupLighting( builder );
|
|
@@ -596,7 +587,7 @@ class NodeMaterial extends Material {
|
|
|
596
587
|
|
|
597
588
|
if ( fragmentNode.isOutputStructNode !== true ) {
|
|
598
589
|
|
|
599
|
-
fragmentNode =
|
|
590
|
+
fragmentNode = fragmentNode.convert( builder.getOutputType() );
|
|
600
591
|
|
|
601
592
|
}
|
|
602
593
|
|
|
@@ -656,7 +647,7 @@ class NodeMaterial extends Material {
|
|
|
656
647
|
*/
|
|
657
648
|
setupHardwareClipping( builder ) {
|
|
658
649
|
|
|
659
|
-
|
|
650
|
+
builder.hardwareClipping = false;
|
|
660
651
|
|
|
661
652
|
if ( builder.clippingContext === null ) return;
|
|
662
653
|
|
|
@@ -668,7 +659,7 @@ class NodeMaterial extends Material {
|
|
|
668
659
|
|
|
669
660
|
builder.stack.addToStack( hardwareClipping() );
|
|
670
661
|
|
|
671
|
-
|
|
662
|
+
builder.hardwareClipping = true;
|
|
672
663
|
|
|
673
664
|
}
|
|
674
665
|
|
|
@@ -776,13 +767,13 @@ class NodeMaterial extends Material {
|
|
|
776
767
|
|
|
777
768
|
if ( geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color ) {
|
|
778
769
|
|
|
779
|
-
morphReference( object )
|
|
770
|
+
morphReference( object );
|
|
780
771
|
|
|
781
772
|
}
|
|
782
773
|
|
|
783
774
|
if ( object.isSkinnedMesh === true ) {
|
|
784
775
|
|
|
785
|
-
skinning( object )
|
|
776
|
+
skinning( object );
|
|
786
777
|
|
|
787
778
|
}
|
|
788
779
|
|
|
@@ -798,13 +789,13 @@ class NodeMaterial extends Material {
|
|
|
798
789
|
|
|
799
790
|
if ( object.isBatchedMesh ) {
|
|
800
791
|
|
|
801
|
-
batch( object )
|
|
792
|
+
batch( object );
|
|
802
793
|
|
|
803
794
|
}
|
|
804
795
|
|
|
805
796
|
if ( ( object.isInstancedMesh && object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true ) ) {
|
|
806
797
|
|
|
807
|
-
instancedMesh( object )
|
|
798
|
+
instancedMesh( object );
|
|
808
799
|
|
|
809
800
|
}
|
|
810
801
|
|
|
@@ -854,16 +845,12 @@ class NodeMaterial extends Material {
|
|
|
854
845
|
|
|
855
846
|
if ( object.instanceColor ) {
|
|
856
847
|
|
|
857
|
-
const instanceColor = varyingProperty( 'vec3', 'vInstanceColor' );
|
|
858
|
-
|
|
859
848
|
colorNode = instanceColor.mul( colorNode );
|
|
860
849
|
|
|
861
850
|
}
|
|
862
851
|
|
|
863
852
|
if ( object.isBatchedMesh && object._colorsTexture ) {
|
|
864
853
|
|
|
865
|
-
const batchColor = varyingProperty( 'vec3', 'vBatchColor' );
|
|
866
|
-
|
|
867
854
|
colorNode = batchColor.mul( colorNode );
|
|
868
855
|
|
|
869
856
|
}
|
|
@@ -999,12 +986,18 @@ class NodeMaterial extends Material {
|
|
|
999
986
|
* Setups the lights node based on the scene, environment and material.
|
|
1000
987
|
*
|
|
1001
988
|
* @param {NodeBuilder} builder - The current node builder.
|
|
1002
|
-
* @return {
|
|
989
|
+
* @return {LightingNode<Array>} The lights node.
|
|
1003
990
|
*/
|
|
1004
|
-
|
|
991
|
+
setupMaterialLightings( builder ) {
|
|
1005
992
|
|
|
1006
993
|
const materialLightsNode = [];
|
|
1007
994
|
|
|
995
|
+
if ( builder.renderer.lighting.enabled === false ) {
|
|
996
|
+
|
|
997
|
+
return materialLightsNode;
|
|
998
|
+
|
|
999
|
+
}
|
|
1000
|
+
|
|
1008
1001
|
//
|
|
1009
1002
|
|
|
1010
1003
|
const envNode = this.setupEnvironment( builder );
|
|
@@ -1023,6 +1016,24 @@ class NodeMaterial extends Material {
|
|
|
1023
1016
|
|
|
1024
1017
|
}
|
|
1025
1018
|
|
|
1019
|
+
if ( builder.context.ambientOcclusion ) {
|
|
1020
|
+
|
|
1021
|
+
materialLightsNode.push( new AONode( builder.context.ambientOcclusion ) );
|
|
1022
|
+
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
return materialLightsNode;
|
|
1026
|
+
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Setups the ambient occlusion node from the material.
|
|
1031
|
+
*
|
|
1032
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
1033
|
+
* @return {Node} The ambient occlusion node.
|
|
1034
|
+
*/
|
|
1035
|
+
setupAmbientOcclusion( builder ) {
|
|
1036
|
+
|
|
1026
1037
|
let aoNode = this.aoNode;
|
|
1027
1038
|
|
|
1028
1039
|
if ( aoNode === null && builder.material.aoMap ) {
|
|
@@ -1037,22 +1048,14 @@ class NodeMaterial extends Material {
|
|
|
1037
1048
|
|
|
1038
1049
|
}
|
|
1039
1050
|
|
|
1040
|
-
if ( aoNode ) {
|
|
1051
|
+
if ( aoNode !== null ) {
|
|
1041
1052
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1053
|
+
ambientOcclusion.assign( aoNode );
|
|
1045
1054
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
if ( materialLightsNode.length > 0 ) {
|
|
1049
|
-
|
|
1050
|
-
lightsN = builder.renderer.lighting.createNode( [ ...lightsN.getLights(), ...materialLightsNode ] );
|
|
1055
|
+
builder.context.ambientOcclusion = ambientOcclusion;
|
|
1051
1056
|
|
|
1052
1057
|
}
|
|
1053
1058
|
|
|
1054
|
-
return lightsN;
|
|
1055
|
-
|
|
1056
1059
|
}
|
|
1057
1060
|
|
|
1058
1061
|
/**
|
|
@@ -1084,15 +1087,16 @@ class NodeMaterial extends Material {
|
|
|
1084
1087
|
|
|
1085
1088
|
const lights = this.lights === true || this.lightsNode !== null;
|
|
1086
1089
|
|
|
1087
|
-
const
|
|
1090
|
+
const materialLightings = this.lights === true ? this.setupMaterialLightings( builder ) : [];
|
|
1091
|
+
const lightsNode = lights ? ( this.lightsNode || builder.lightsNode ) : null;
|
|
1088
1092
|
|
|
1089
1093
|
let outgoingLightNode = this.setupOutgoingLight( builder );
|
|
1090
1094
|
|
|
1091
|
-
if ( lightsNode && lightsNode.getScope().hasLights ) {
|
|
1095
|
+
if ( lightsNode && ( materialLightings.length > 0 || lightsNode.getScope().hasLights ) ) {
|
|
1092
1096
|
|
|
1093
1097
|
const lightingModel = this.setupLightingModel( builder ) || null;
|
|
1094
1098
|
|
|
1095
|
-
outgoingLightNode = lightingContext( lightsNode, lightingModel, backdropNode, backdropAlphaNode );
|
|
1099
|
+
outgoingLightNode = lightingContext( lightsNode, lightingModel, materialLightings, backdropNode, backdropAlphaNode );
|
|
1096
1100
|
|
|
1097
1101
|
} else if ( backdropNode !== null ) {
|
|
1098
1102
|
|
|
@@ -1153,6 +1157,26 @@ class NodeMaterial extends Material {
|
|
|
1153
1157
|
/**
|
|
1154
1158
|
* Setups the output node.
|
|
1155
1159
|
*
|
|
1160
|
+
* This method can be implemented by derived materials to extend the functionality
|
|
1161
|
+
* of the material's output or replace it altogether.
|
|
1162
|
+
*
|
|
1163
|
+
* ```js
|
|
1164
|
+
* class ColoredShadowMaterial extends MeshPhongNodeMaterial {
|
|
1165
|
+
* constructor( parameters ) {
|
|
1166
|
+
* super( parameters );
|
|
1167
|
+
* this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) );
|
|
1168
|
+
* }
|
|
1169
|
+
*
|
|
1170
|
+
* setupOutput( builder, outputNode ) {
|
|
1171
|
+
* // Modify the native output of the MeshPhongNodeMaterial fragment shader
|
|
1172
|
+
* const brightness = min( outputNode.r, 1.0 );
|
|
1173
|
+
* const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness );
|
|
1174
|
+
* // Return new output back into NodeMaterial flow
|
|
1175
|
+
* return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) );
|
|
1176
|
+
* }
|
|
1177
|
+
* }
|
|
1178
|
+
* ```
|
|
1179
|
+
*
|
|
1156
1180
|
* @param {NodeBuilder} builder - The current node builder.
|
|
1157
1181
|
* @param {Node<vec4>} outputNode - The existing output node.
|
|
1158
1182
|
* @return {Node<vec4>} The output node.
|
|
@@ -1209,8 +1233,7 @@ class NodeMaterial extends Material {
|
|
|
1209
1233
|
|
|
1210
1234
|
for ( const key in descriptors ) {
|
|
1211
1235
|
|
|
1212
|
-
if ( Object.getOwnPropertyDescriptor( this.constructor.prototype, key ) === undefined &&
|
|
1213
|
-
descriptors[ key ].get !== undefined ) {
|
|
1236
|
+
if ( Object.getOwnPropertyDescriptor( this.constructor.prototype, key ) === undefined && descriptors[ key ].get !== undefined ) {
|
|
1214
1237
|
|
|
1215
1238
|
Object.defineProperty( this.constructor.prototype, key, descriptors[ key ] );
|
|
1216
1239
|
|
|
@@ -1284,44 +1307,65 @@ class NodeMaterial extends Material {
|
|
|
1284
1307
|
}
|
|
1285
1308
|
|
|
1286
1309
|
/**
|
|
1287
|
-
* Copies the properties of the given
|
|
1310
|
+
* Copies the common properties of the given material to this instance.
|
|
1288
1311
|
*
|
|
1289
|
-
* @param {
|
|
1312
|
+
* @param {Material} source - The material to copy.
|
|
1290
1313
|
* @return {NodeMaterial} A reference to this node material.
|
|
1291
1314
|
*/
|
|
1292
1315
|
copy( source ) {
|
|
1293
1316
|
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1317
|
+
const descriptors = Object.getOwnPropertyDescriptors( this.constructor.prototype );
|
|
1318
|
+
|
|
1319
|
+
for ( const property in descriptors ) {
|
|
1297
1320
|
|
|
1298
|
-
|
|
1299
|
-
this.normalNode = source.normalNode;
|
|
1300
|
-
this.opacityNode = source.opacityNode;
|
|
1301
|
-
this.backdropNode = source.backdropNode;
|
|
1302
|
-
this.backdropAlphaNode = source.backdropAlphaNode;
|
|
1303
|
-
this.alphaTestNode = source.alphaTestNode;
|
|
1304
|
-
this.maskNode = source.maskNode;
|
|
1305
|
-
this.maskShadowNode = source.maskShadowNode;
|
|
1321
|
+
if ( descriptors[ property ].set !== undefined && source[ property ] !== undefined ) {
|
|
1306
1322
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1323
|
+
const value = source[ property ];
|
|
1324
|
+
|
|
1325
|
+
if ( this[ property ] && this[ property ].copy !== undefined ) {
|
|
1326
|
+
|
|
1327
|
+
this[ property ].copy( value );
|
|
1328
|
+
|
|
1329
|
+
} else {
|
|
1330
|
+
|
|
1331
|
+
this[ property ] = value;
|
|
1332
|
+
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
}
|
|
1309
1338
|
|
|
1310
|
-
this
|
|
1311
|
-
this.receivedShadowPositionNode = source.receivedShadowPositionNode;
|
|
1312
|
-
this.castShadowPositionNode = source.castShadowPositionNode;
|
|
1313
|
-
this.receivedShadowNode = source.receivedShadowNode;
|
|
1314
|
-
this.castShadowNode = source.castShadowNode;
|
|
1339
|
+
for ( const property in this ) {
|
|
1315
1340
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1341
|
+
// Skip internal/private properties (starting with '_'), flags (starting with 'is' + uppercase),
|
|
1342
|
+
// and properties that are handled separately or should not be copied (id, uuid, version, type, userData, clippingPlanes).
|
|
1343
|
+
|
|
1344
|
+
if ( /^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test( property ) ) continue;
|
|
1345
|
+
|
|
1346
|
+
if ( this[ property ] !== undefined && source[ property ] !== undefined ) {
|
|
1347
|
+
|
|
1348
|
+
const value = source[ property ];
|
|
1349
|
+
|
|
1350
|
+
if ( this[ property ] && this[ property ].copy !== undefined ) {
|
|
1351
|
+
|
|
1352
|
+
this[ property ].copy( value );
|
|
1353
|
+
|
|
1354
|
+
} else {
|
|
1355
|
+
|
|
1356
|
+
this[ property ] = value;
|
|
1357
|
+
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
}
|
|
1318
1363
|
|
|
1319
|
-
this.
|
|
1320
|
-
this.vertexNode = source.vertexNode;
|
|
1364
|
+
this.clippingPlanes = source.clippingPlanes ? source.clippingPlanes.map( ( plane ) => plane.clone() ) : null;
|
|
1321
1365
|
|
|
1322
|
-
this.
|
|
1366
|
+
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
1323
1367
|
|
|
1324
|
-
return
|
|
1368
|
+
return this;
|
|
1325
1369
|
|
|
1326
1370
|
}
|
|
1327
1371
|
|
|
@@ -148,16 +148,6 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
148
148
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
copy( source ) {
|
|
152
|
-
|
|
153
|
-
this.positionNode = source.positionNode;
|
|
154
|
-
this.rotationNode = source.rotationNode;
|
|
155
|
-
this.scaleNode = source.scaleNode;
|
|
156
|
-
|
|
157
|
-
return super.copy( source );
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
151
|
/**
|
|
162
152
|
* Whether to use size attenuation or not.
|
|
163
153
|
*
|
|
@@ -22,6 +22,7 @@ const refreshUniforms = [
|
|
|
22
22
|
'emissiveMap',
|
|
23
23
|
'envMap',
|
|
24
24
|
'envMapIntensity',
|
|
25
|
+
'envMapRotation',
|
|
25
26
|
'gradientMap',
|
|
26
27
|
'ior',
|
|
27
28
|
'iridescence',
|
|
@@ -216,7 +217,12 @@ class NodeMaterialObserver {
|
|
|
216
217
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
const { environmentIntensity, environmentRotation } = renderObject.scene;
|
|
221
|
+
|
|
222
|
+
data.environmentIntensity = environmentIntensity;
|
|
223
|
+
data.environmentRotation = environmentRotation.clone();
|
|
224
|
+
|
|
225
|
+
data.lights = this.getLightsData( renderObject.lightsNode.getLights(), [] );
|
|
220
226
|
|
|
221
227
|
this.renderObjects.set( renderObject, data );
|
|
222
228
|
|
|
@@ -242,8 +248,8 @@ class NodeMaterialObserver {
|
|
|
242
248
|
const attribute = attributes[ name ];
|
|
243
249
|
|
|
244
250
|
attributesData[ name ] = {
|
|
245
|
-
id: attribute.id,
|
|
246
|
-
version: attribute.version,
|
|
251
|
+
id: attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id,
|
|
252
|
+
version: attribute.isInterleavedBufferAttribute ? attribute.data.version : attribute.version,
|
|
247
253
|
};
|
|
248
254
|
|
|
249
255
|
}
|
|
@@ -333,7 +339,7 @@ class NodeMaterialObserver {
|
|
|
333
339
|
|
|
334
340
|
if ( value.isTexture === true ) {
|
|
335
341
|
|
|
336
|
-
data[ property ] = { id: value.id, version:
|
|
342
|
+
data[ property ] = { id: value.id, version: 0 };
|
|
337
343
|
|
|
338
344
|
} else {
|
|
339
345
|
|
|
@@ -363,7 +369,7 @@ class NodeMaterialObserver {
|
|
|
363
369
|
* @param {RenderObject} renderObject - The render object.
|
|
364
370
|
* @param {Array<Light>} lightsData - The current material lights.
|
|
365
371
|
* @param {number} renderId - The current render ID.
|
|
366
|
-
* @return {boolean} Whether the given render object
|
|
372
|
+
* @return {boolean} Whether the given render object is equal to its cached state or not.
|
|
367
373
|
*/
|
|
368
374
|
equals( renderObject, lightsData, renderId ) {
|
|
369
375
|
|
|
@@ -501,10 +507,13 @@ class NodeMaterialObserver {
|
|
|
501
507
|
|
|
502
508
|
}
|
|
503
509
|
|
|
504
|
-
|
|
510
|
+
const id = attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id;
|
|
511
|
+
const version = attribute.isInterleavedBufferAttribute ? attribute.data.version : attribute.version;
|
|
512
|
+
|
|
513
|
+
if ( storedAttributeData.id !== id || storedAttributeData.version !== version ) {
|
|
505
514
|
|
|
506
|
-
storedAttributeData.id =
|
|
507
|
-
storedAttributeData.version =
|
|
515
|
+
storedAttributeData.id = id;
|
|
516
|
+
storedAttributeData.version = version;
|
|
508
517
|
|
|
509
518
|
geometryData._equal = false;
|
|
510
519
|
return false;
|
|
@@ -597,6 +606,24 @@ class NodeMaterialObserver {
|
|
|
597
606
|
|
|
598
607
|
}
|
|
599
608
|
|
|
609
|
+
// scene
|
|
610
|
+
|
|
611
|
+
const scene = renderObject.scene;
|
|
612
|
+
|
|
613
|
+
if ( scene.environment !== null && material.envMap === null ) {
|
|
614
|
+
|
|
615
|
+
if ( renderObjectData.environmentIntensity !== scene.environmentIntensity ||
|
|
616
|
+
renderObjectData.environmentRotation.equals( scene.environmentRotation ) === false ) {
|
|
617
|
+
|
|
618
|
+
renderObjectData.environmentIntensity = scene.environmentIntensity;
|
|
619
|
+
renderObjectData.environmentRotation.copy( scene.environmentRotation );
|
|
620
|
+
|
|
621
|
+
return false;
|
|
622
|
+
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
}
|
|
626
|
+
|
|
600
627
|
// center
|
|
601
628
|
|
|
602
629
|
if ( renderObjectData.center ) {
|
|
@@ -605,7 +632,7 @@ class NodeMaterialObserver {
|
|
|
605
632
|
|
|
606
633
|
renderObjectData.center.copy( object.center );
|
|
607
634
|
|
|
608
|
-
return
|
|
635
|
+
return false;
|
|
609
636
|
|
|
610
637
|
}
|
|
611
638
|
|
|
@@ -629,9 +656,9 @@ class NodeMaterialObserver {
|
|
|
629
656
|
* @param {Array<Light>} materialLights - The material lights.
|
|
630
657
|
* @return {Array<Object>} The lights data for the given material lights.
|
|
631
658
|
*/
|
|
632
|
-
getLightsData( materialLights ) {
|
|
659
|
+
getLightsData( materialLights, lights ) {
|
|
633
660
|
|
|
634
|
-
|
|
661
|
+
lights.length = 0;
|
|
635
662
|
|
|
636
663
|
for ( const light of materialLights ) {
|
|
637
664
|
|
|
@@ -658,23 +685,25 @@ class NodeMaterialObserver {
|
|
|
658
685
|
*/
|
|
659
686
|
getLights( lightsNode, renderId ) {
|
|
660
687
|
|
|
661
|
-
|
|
688
|
+
let cached = _lightsCache.get( lightsNode );
|
|
662
689
|
|
|
663
|
-
|
|
690
|
+
if ( cached === undefined ) {
|
|
664
691
|
|
|
665
|
-
|
|
692
|
+
cached = { renderId: - 1, lightsData: [] };
|
|
693
|
+
_lightsCache.set( lightsNode, cached );
|
|
666
694
|
|
|
667
|
-
|
|
695
|
+
}
|
|
668
696
|
|
|
669
|
-
|
|
697
|
+
if ( cached.renderId === renderId ) {
|
|
670
698
|
|
|
671
|
-
|
|
699
|
+
return cached.lightsData;
|
|
672
700
|
|
|
673
|
-
|
|
701
|
+
}
|
|
674
702
|
|
|
675
|
-
|
|
703
|
+
cached.renderId = renderId;
|
|
704
|
+
this.getLightsData( lightsNode.getLights(), cached.lightsData );
|
|
676
705
|
|
|
677
|
-
return lightsData;
|
|
706
|
+
return cached.lightsData;
|
|
678
707
|
|
|
679
708
|
}
|
|
680
709
|
|
package/src/math/Box3.js
CHANGED
|
@@ -142,6 +142,11 @@ class Box3 {
|
|
|
142
142
|
* (including its children), accounting for the object's, and children's,
|
|
143
143
|
* world transforms. The function may result in a larger box than strictly necessary.
|
|
144
144
|
*
|
|
145
|
+
* Note: To compute the correct bounding box, make sure the given 3D object
|
|
146
|
+
* has an up-to-date world matrix that reflects the current transformation of its
|
|
147
|
+
* ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if
|
|
148
|
+
* you're unsure.
|
|
149
|
+
*
|
|
145
150
|
* @param {Object3D} object - The 3D object to compute the bounding box for.
|
|
146
151
|
* @param {boolean} [precise=false] - If set to `true`, the method computes the smallest
|
|
147
152
|
* world-axis-aligned bounding box at the expense of more computation.
|