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
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BufferGeometry,
|
|
3
|
+
Float32BufferAttribute,
|
|
4
|
+
ShapeUtils,
|
|
5
|
+
Vector2,
|
|
6
|
+
Vector3
|
|
7
|
+
} from 'three';
|
|
8
|
+
|
|
9
|
+
const _vector = /*@__PURE__*/ new Vector3();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This class can be used to generate a geometry by lofting (skinning) a surface
|
|
13
|
+
* through a series of cross sections. Each section is an array of points in 3D
|
|
14
|
+
* space and all sections must have the same number of points.
|
|
15
|
+
*
|
|
16
|
+
* `LoftGeometry` is the general case of geometries like {@link LatheGeometry}
|
|
17
|
+
* (which revolves a fixed profile around an axis) or {@link TubeGeometry}
|
|
18
|
+
* (which sweeps a circular section along a path): the sections can have any
|
|
19
|
+
* shape, and can change shape, size, position and orientation from one
|
|
20
|
+
* section to the next.
|
|
21
|
+
*
|
|
22
|
+
* Sections wind around the loft so the resulting face normals point outwards
|
|
23
|
+
* when each section is ordered counterclockwise as seen from the end of the
|
|
24
|
+
* loft, looking back towards the start. If the surface appears inside out,
|
|
25
|
+
* reverse the point order of each section.
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* const sections = [];
|
|
29
|
+
*
|
|
30
|
+
* for ( let i = 0; i <= 10; i ++ ) {
|
|
31
|
+
*
|
|
32
|
+
* const points = [];
|
|
33
|
+
* const radius = 2 + Math.sin( i * 0.8 );
|
|
34
|
+
*
|
|
35
|
+
* for ( let j = 0; j < 32; j ++ ) {
|
|
36
|
+
*
|
|
37
|
+
* const angle = j / 32 * Math.PI * 2;
|
|
38
|
+
* points.push( new THREE.Vector3( Math.sin( angle ) * radius, i, Math.cos( angle ) * radius ) );
|
|
39
|
+
*
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* sections.push( points );
|
|
43
|
+
*
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* const geometry = new LoftGeometry( sections, { capStart: true, capEnd: true } );
|
|
47
|
+
* const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } );
|
|
48
|
+
* const mesh = new THREE.Mesh( geometry, material );
|
|
49
|
+
* scene.add( mesh );
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @augments BufferGeometry
|
|
53
|
+
* @three_import import { LoftGeometry } from 'three/addons/geometries/LoftGeometry.js';
|
|
54
|
+
*/
|
|
55
|
+
class LoftGeometry extends BufferGeometry {
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Constructs a new loft geometry.
|
|
59
|
+
*
|
|
60
|
+
* @param {Array<Array<Vector3>>} sections - The cross sections to skin. At least
|
|
61
|
+
* two sections are required and all sections must have the same number of points.
|
|
62
|
+
* @param {Object} [options={}] - The loft options.
|
|
63
|
+
* @param {boolean} [options.closed=true] - Whether each section is treated as a
|
|
64
|
+
* closed ring (e.g. a fuselage) or an open strip (e.g. a ribbon).
|
|
65
|
+
* @param {boolean} [options.capStart=false] - Whether the first section is closed
|
|
66
|
+
* with a cap or not.
|
|
67
|
+
* @param {boolean} [options.capEnd=false] - Whether the last section is closed
|
|
68
|
+
* with a cap or not.
|
|
69
|
+
*/
|
|
70
|
+
constructor( sections = [], options = {} ) {
|
|
71
|
+
|
|
72
|
+
super();
|
|
73
|
+
|
|
74
|
+
this.type = 'LoftGeometry';
|
|
75
|
+
|
|
76
|
+
const { closed = true, capStart = false, capEnd = false } = options;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Holds the constructor parameters that have been
|
|
80
|
+
* used to generate the geometry. Any modification
|
|
81
|
+
* after instantiation does not change the geometry.
|
|
82
|
+
*
|
|
83
|
+
* @type {Object}
|
|
84
|
+
*/
|
|
85
|
+
this.parameters = {
|
|
86
|
+
sections: sections,
|
|
87
|
+
closed: closed,
|
|
88
|
+
capStart: capStart,
|
|
89
|
+
capEnd: capEnd
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const rows = sections.length;
|
|
93
|
+
|
|
94
|
+
if ( rows < 2 ) {
|
|
95
|
+
|
|
96
|
+
console.error( 'THREE.LoftGeometry: At least two sections are required.' );
|
|
97
|
+
return;
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const columns = sections[ 0 ].length;
|
|
102
|
+
|
|
103
|
+
for ( let i = 1; i < rows; i ++ ) {
|
|
104
|
+
|
|
105
|
+
if ( sections[ i ].length !== columns ) {
|
|
106
|
+
|
|
107
|
+
console.error( 'THREE.LoftGeometry: All sections must have the same number of points.' );
|
|
108
|
+
return;
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// closed sections repeat their first point so the surface can wrap
|
|
115
|
+
// around with continuous uvs
|
|
116
|
+
|
|
117
|
+
const pointsPerRow = closed ? columns + 1 : columns;
|
|
118
|
+
|
|
119
|
+
// buffers
|
|
120
|
+
|
|
121
|
+
const indices = [];
|
|
122
|
+
const vertices = [];
|
|
123
|
+
const uvs = [];
|
|
124
|
+
|
|
125
|
+
// uvs follow arc length so uneven sections and points map evenly
|
|
126
|
+
|
|
127
|
+
const rowU = [ 0 ];
|
|
128
|
+
|
|
129
|
+
for ( let i = 1; i < rows; i ++ ) {
|
|
130
|
+
|
|
131
|
+
let distance = 0;
|
|
132
|
+
|
|
133
|
+
for ( let j = 0; j < columns; j ++ ) {
|
|
134
|
+
|
|
135
|
+
distance += sections[ i ][ j ].distanceTo( sections[ i - 1 ][ j ] );
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
rowU.push( rowU[ i - 1 ] + distance / columns );
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const totalU = rowU[ rows - 1 ];
|
|
144
|
+
|
|
145
|
+
// generate vertices and uvs
|
|
146
|
+
|
|
147
|
+
for ( let i = 0; i < rows; i ++ ) {
|
|
148
|
+
|
|
149
|
+
const section = sections[ i ];
|
|
150
|
+
|
|
151
|
+
// distance around the section
|
|
152
|
+
|
|
153
|
+
const colV = [ 0 ];
|
|
154
|
+
|
|
155
|
+
for ( let j = 1; j < pointsPerRow; j ++ ) {
|
|
156
|
+
|
|
157
|
+
colV.push( colV[ j - 1 ] + section[ j % columns ].distanceTo( section[ ( j - 1 ) % columns ] ) );
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const totalV = colV[ pointsPerRow - 1 ];
|
|
162
|
+
|
|
163
|
+
for ( let j = 0; j < pointsPerRow; j ++ ) {
|
|
164
|
+
|
|
165
|
+
const point = section[ j % columns ];
|
|
166
|
+
|
|
167
|
+
vertices.push( point.x, point.y, point.z );
|
|
168
|
+
uvs.push(
|
|
169
|
+
totalU > 0 ? rowU[ i ] / totalU : i / ( rows - 1 ),
|
|
170
|
+
totalV > 0 ? colV[ j ] / totalV : j / ( pointsPerRow - 1 )
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// generate indices
|
|
178
|
+
|
|
179
|
+
for ( let i = 0; i < rows - 1; i ++ ) {
|
|
180
|
+
|
|
181
|
+
for ( let j = 0; j < pointsPerRow - 1; j ++ ) {
|
|
182
|
+
|
|
183
|
+
const a = i * pointsPerRow + j;
|
|
184
|
+
const b = i * pointsPerRow + j + 1;
|
|
185
|
+
const c = ( i + 1 ) * pointsPerRow + j + 1;
|
|
186
|
+
const d = ( i + 1 ) * pointsPerRow + j;
|
|
187
|
+
|
|
188
|
+
// faces one and two
|
|
189
|
+
|
|
190
|
+
indices.push( a, b, d );
|
|
191
|
+
indices.push( b, c, d );
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// generate caps
|
|
198
|
+
|
|
199
|
+
if ( capStart === true ) generateCap( 0 );
|
|
200
|
+
if ( capEnd === true ) generateCap( rows - 1 );
|
|
201
|
+
|
|
202
|
+
// build geometry
|
|
203
|
+
|
|
204
|
+
this.setIndex( indices );
|
|
205
|
+
this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
|
|
206
|
+
this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
|
|
207
|
+
this.computeVertexNormals();
|
|
208
|
+
|
|
209
|
+
// the seam vertices of closed sections are duplicated so their computed
|
|
210
|
+
// normals must be averaged to achieve smooth shading across the seam
|
|
211
|
+
|
|
212
|
+
if ( closed === true ) {
|
|
213
|
+
|
|
214
|
+
const normals = this.getAttribute( 'normal' );
|
|
215
|
+
|
|
216
|
+
for ( let i = 0; i < rows; i ++ ) {
|
|
217
|
+
|
|
218
|
+
const a = i * pointsPerRow;
|
|
219
|
+
const b = i * pointsPerRow + ( pointsPerRow - 1 );
|
|
220
|
+
|
|
221
|
+
_vector.set(
|
|
222
|
+
normals.getX( a ) + normals.getX( b ),
|
|
223
|
+
normals.getY( a ) + normals.getY( b ),
|
|
224
|
+
normals.getZ( a ) + normals.getZ( b )
|
|
225
|
+
).normalize();
|
|
226
|
+
|
|
227
|
+
normals.setXYZ( a, _vector.x, _vector.y, _vector.z );
|
|
228
|
+
normals.setXYZ( b, _vector.x, _vector.y, _vector.z );
|
|
229
|
+
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function generateCap( sectionIndex ) {
|
|
235
|
+
|
|
236
|
+
const section = sections[ sectionIndex ];
|
|
237
|
+
|
|
238
|
+
// compute the centroid of the section and the normal of its plane
|
|
239
|
+
// via Newell's method
|
|
240
|
+
|
|
241
|
+
const centroid = new Vector3();
|
|
242
|
+
const normal = new Vector3();
|
|
243
|
+
|
|
244
|
+
for ( let i = 0; i < columns; i ++ ) {
|
|
245
|
+
|
|
246
|
+
const p = section[ i ];
|
|
247
|
+
const q = section[ ( i + 1 ) % columns ];
|
|
248
|
+
|
|
249
|
+
centroid.add( p );
|
|
250
|
+
|
|
251
|
+
normal.x += ( p.y - q.y ) * ( p.z + q.z );
|
|
252
|
+
normal.y += ( p.z - q.z ) * ( p.x + q.x );
|
|
253
|
+
normal.z += ( p.x - q.x ) * ( p.y + q.y );
|
|
254
|
+
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
centroid.divideScalar( columns );
|
|
258
|
+
normal.normalize();
|
|
259
|
+
|
|
260
|
+
// make sure the cap faces away from the rest of the surface
|
|
261
|
+
|
|
262
|
+
const neighbor = sections[ sectionIndex === 0 ? 1 : rows - 2 ];
|
|
263
|
+
|
|
264
|
+
_vector.set( 0, 0, 0 );
|
|
265
|
+
|
|
266
|
+
for ( let i = 0; i < columns; i ++ ) _vector.add( neighbor[ i ] );
|
|
267
|
+
|
|
268
|
+
_vector.divideScalar( columns ).sub( centroid );
|
|
269
|
+
|
|
270
|
+
if ( normal.dot( _vector ) > 0 ) normal.negate();
|
|
271
|
+
|
|
272
|
+
// project the section onto the cap plane
|
|
273
|
+
|
|
274
|
+
const tangent = new Vector3( 1, 0, 0 );
|
|
275
|
+
|
|
276
|
+
if ( Math.abs( normal.x ) > 0.9 ) tangent.set( 0, 1, 0 );
|
|
277
|
+
|
|
278
|
+
const bitangent = new Vector3().crossVectors( normal, tangent ).normalize();
|
|
279
|
+
tangent.crossVectors( bitangent, normal );
|
|
280
|
+
|
|
281
|
+
const contour = [];
|
|
282
|
+
const points = section.slice();
|
|
283
|
+
|
|
284
|
+
for ( let i = 0; i < columns; i ++ ) {
|
|
285
|
+
|
|
286
|
+
_vector.subVectors( points[ i ], centroid );
|
|
287
|
+
contour.push( new Vector2( _vector.dot( tangent ), _vector.dot( bitangent ) ) );
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// triangulateShape() expects contours in counterclockwise order
|
|
292
|
+
|
|
293
|
+
if ( ShapeUtils.isClockWise( contour ) === true ) {
|
|
294
|
+
|
|
295
|
+
contour.reverse();
|
|
296
|
+
points.reverse();
|
|
297
|
+
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const faces = ShapeUtils.triangulateShape( contour, [] );
|
|
301
|
+
|
|
302
|
+
// compute the bounding box of the contour for uv generation
|
|
303
|
+
|
|
304
|
+
const min = new Vector2( Infinity, Infinity );
|
|
305
|
+
const max = new Vector2( - Infinity, - Infinity );
|
|
306
|
+
|
|
307
|
+
for ( let i = 0; i < columns; i ++ ) {
|
|
308
|
+
|
|
309
|
+
min.min( contour[ i ] );
|
|
310
|
+
max.max( contour[ i ] );
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const width = Math.max( max.x - min.x, Number.EPSILON );
|
|
315
|
+
const height = Math.max( max.y - min.y, Number.EPSILON );
|
|
316
|
+
|
|
317
|
+
// generate vertices, uvs and indices; cap vertices are not shared
|
|
318
|
+
// with the wall so the cap is flat shaded with a hard edge
|
|
319
|
+
|
|
320
|
+
const indexOffset = vertices.length / 3;
|
|
321
|
+
|
|
322
|
+
for ( let i = 0; i < columns; i ++ ) {
|
|
323
|
+
|
|
324
|
+
const point = points[ i ];
|
|
325
|
+
|
|
326
|
+
vertices.push( point.x, point.y, point.z );
|
|
327
|
+
uvs.push( ( contour[ i ].x - min.x ) / width, ( contour[ i ].y - min.y ) / height );
|
|
328
|
+
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
for ( let i = 0; i < faces.length; i ++ ) {
|
|
332
|
+
|
|
333
|
+
const face = faces[ i ];
|
|
334
|
+
|
|
335
|
+
indices.push( indexOffset + face[ 0 ], indexOffset + face[ 1 ], indexOffset + face[ 2 ] );
|
|
336
|
+
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
copy( source ) {
|
|
344
|
+
|
|
345
|
+
super.copy( source );
|
|
346
|
+
|
|
347
|
+
this.parameters = Object.assign( {}, source.parameters );
|
|
348
|
+
|
|
349
|
+
return this;
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export { LoftGeometry };
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Visualizes an {@link LightProbeGrid} by rendering a sphere at each
|
|
12
|
-
* probe position, shaded with the probe's
|
|
12
|
+
* probe position, shaded with the probe's L2 spherical harmonics.
|
|
13
13
|
*
|
|
14
14
|
* Uses a single `InstancedMesh` draw call for all probes.
|
|
15
15
|
*
|
|
@@ -58,11 +58,12 @@ class LightProbeHelper extends Mesh {
|
|
|
58
58
|
|
|
59
59
|
#define RECIPROCAL_PI 0.318309886
|
|
60
60
|
|
|
61
|
-
vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
// upper-left 3x3 of view matrix is assumed to be orthogonal
|
|
65
|
+
|
|
66
|
+
return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
|
|
66
67
|
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -101,7 +102,7 @@ class LightProbeHelper extends Mesh {
|
|
|
101
102
|
|
|
102
103
|
vec3 normal = normalize( vNormal );
|
|
103
104
|
|
|
104
|
-
vec3 worldNormal =
|
|
105
|
+
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
105
106
|
|
|
106
107
|
vec3 irradiance = shGetIrradianceAt( worldNormal, sh );
|
|
107
108
|
|
|
@@ -49,6 +49,14 @@ class ViewHelper extends Object3D {
|
|
|
49
49
|
*/
|
|
50
50
|
this.isViewHelper = true;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* The camera whose transformation is visualized. It can be reassigned at
|
|
54
|
+
* any time to rebind the helper to a different camera.
|
|
55
|
+
*
|
|
56
|
+
* @type {Camera}
|
|
57
|
+
*/
|
|
58
|
+
this.camera = camera;
|
|
59
|
+
|
|
52
60
|
/**
|
|
53
61
|
* Whether the helper is currently animating or not.
|
|
54
62
|
*
|
|
@@ -86,6 +94,8 @@ class ViewHelper extends Object3D {
|
|
|
86
94
|
|
|
87
95
|
const options = {};
|
|
88
96
|
|
|
97
|
+
const scope = this;
|
|
98
|
+
|
|
89
99
|
const interactiveObjects = [];
|
|
90
100
|
const raycaster = new Raycaster();
|
|
91
101
|
const mouse = new Vector2();
|
|
@@ -163,11 +173,11 @@ class ViewHelper extends Object3D {
|
|
|
163
173
|
*/
|
|
164
174
|
this.render = function ( renderer ) {
|
|
165
175
|
|
|
166
|
-
this.quaternion.copy( camera.quaternion ).invert();
|
|
176
|
+
this.quaternion.copy( this.camera.quaternion ).invert();
|
|
167
177
|
this.updateMatrixWorld();
|
|
168
178
|
|
|
169
179
|
point.set( 0, 0, 1 );
|
|
170
|
-
point.applyQuaternion( camera.quaternion );
|
|
180
|
+
point.applyQuaternion( this.camera.quaternion );
|
|
171
181
|
|
|
172
182
|
//
|
|
173
183
|
|
|
@@ -325,11 +335,11 @@ class ViewHelper extends Object3D {
|
|
|
325
335
|
// animate position by doing a slerp and then scaling the position on the unit sphere
|
|
326
336
|
|
|
327
337
|
q1.rotateTowards( q2, step );
|
|
328
|
-
camera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius ).add( this.center );
|
|
338
|
+
this.camera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius ).add( this.center );
|
|
329
339
|
|
|
330
340
|
// animate orientation
|
|
331
341
|
|
|
332
|
-
camera.quaternion.rotateTowards( targetQuaternion, step );
|
|
342
|
+
this.camera.quaternion.rotateTowards( targetQuaternion, step );
|
|
333
343
|
|
|
334
344
|
if ( q1.angleTo( q2 ) === 0 ) {
|
|
335
345
|
|
|
@@ -408,12 +418,12 @@ class ViewHelper extends Object3D {
|
|
|
408
418
|
|
|
409
419
|
//
|
|
410
420
|
|
|
411
|
-
radius = camera.position.distanceTo( focusPoint );
|
|
421
|
+
radius = scope.camera.position.distanceTo( focusPoint );
|
|
412
422
|
targetPosition.multiplyScalar( radius ).add( focusPoint );
|
|
413
423
|
|
|
414
424
|
dummy.position.copy( focusPoint );
|
|
415
425
|
|
|
416
|
-
dummy.lookAt( camera.position );
|
|
426
|
+
dummy.lookAt( scope.camera.position );
|
|
417
427
|
q1.copy( dummy.quaternion );
|
|
418
428
|
|
|
419
429
|
dummy.lookAt( targetPosition );
|
|
@@ -79,6 +79,11 @@ class Inspector extends RendererInspector {
|
|
|
79
79
|
needsUpdate: false,
|
|
80
80
|
duration: .02,
|
|
81
81
|
time: 0
|
|
82
|
+
},
|
|
83
|
+
toggleGraph: {
|
|
84
|
+
needsUpdate: false,
|
|
85
|
+
duration: .02,
|
|
86
|
+
time: 0
|
|
82
87
|
}
|
|
83
88
|
};
|
|
84
89
|
|
|
@@ -251,9 +256,28 @@ class Inspector extends RendererInspector {
|
|
|
251
256
|
|
|
252
257
|
//
|
|
253
258
|
|
|
254
|
-
if ( renderer.inspector.domElement.parentElement === null
|
|
259
|
+
if ( renderer.inspector.domElement.parentElement === null ) {
|
|
260
|
+
|
|
261
|
+
if ( renderer.domElement.parentElement !== null ) {
|
|
262
|
+
|
|
263
|
+
renderer.domElement.parentElement.appendChild( renderer.inspector.domElement );
|
|
264
|
+
|
|
265
|
+
} else {
|
|
266
|
+
|
|
267
|
+
const observer = new MutationObserver( () => {
|
|
268
|
+
|
|
269
|
+
if ( renderer.domElement.parentElement !== null ) {
|
|
255
270
|
|
|
256
|
-
|
|
271
|
+
renderer.domElement.parentElement.appendChild( renderer.inspector.domElement );
|
|
272
|
+
observer.disconnect();
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
} );
|
|
277
|
+
|
|
278
|
+
observer.observe( document.body || document.documentElement, { childList: true, subtree: true } );
|
|
279
|
+
|
|
280
|
+
}
|
|
257
281
|
|
|
258
282
|
}
|
|
259
283
|
|
|
@@ -463,16 +487,28 @@ class Inspector extends RendererInspector {
|
|
|
463
487
|
|
|
464
488
|
this.updateCycle( this.displayCycle.text );
|
|
465
489
|
this.updateCycle( this.displayCycle.graph );
|
|
490
|
+
this.updateCycle( this.displayCycle.toggleGraph );
|
|
466
491
|
|
|
467
492
|
if ( this.displayCycle.text.needsUpdate ) {
|
|
468
493
|
|
|
469
|
-
setText( 'fps-counter', this.fps.toFixed() );
|
|
494
|
+
setText( this.profiler.toggleButton.querySelector( '.fps-counter' ), this.fps.toFixed() );
|
|
470
495
|
|
|
471
496
|
this.performance.updateText( this, frame );
|
|
472
497
|
this.memory.updateText( this );
|
|
473
498
|
|
|
474
499
|
}
|
|
475
500
|
|
|
501
|
+
if ( this.displayCycle.toggleGraph.needsUpdate ) {
|
|
502
|
+
|
|
503
|
+
if ( this.profiler.toggleGraph ) {
|
|
504
|
+
|
|
505
|
+
this.profiler.toggleGraph.addPoint( 'fps', this.fps );
|
|
506
|
+
this.profiler.toggleGraph.update();
|
|
507
|
+
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
}
|
|
511
|
+
|
|
476
512
|
if ( this.displayCycle.graph.needsUpdate ) {
|
|
477
513
|
|
|
478
514
|
this.performance.updateGraph( this, frame );
|
|
@@ -482,6 +518,7 @@ class Inspector extends RendererInspector {
|
|
|
482
518
|
|
|
483
519
|
this.displayCycle.text.needsUpdate = false;
|
|
484
520
|
this.displayCycle.graph.needsUpdate = false;
|
|
521
|
+
this.displayCycle.toggleGraph.needsUpdate = false;
|
|
485
522
|
|
|
486
523
|
}
|
|
487
524
|
|
|
@@ -498,25 +535,21 @@ class Inspector extends RendererInspector {
|
|
|
498
535
|
|
|
499
536
|
}
|
|
500
537
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
console.warn( 'Inspector.getItem is deprecated. Use getItem directly instead.' );
|
|
504
|
-
return getItem( id );
|
|
538
|
+
}
|
|
505
539
|
|
|
506
|
-
|
|
540
|
+
function getItem( id ) {
|
|
507
541
|
|
|
508
|
-
|
|
542
|
+
const data = JSON.parse( localStorage.getItem( 'threejs-inspector' ) || '{}' );
|
|
509
543
|
|
|
510
|
-
|
|
511
|
-
|
|
544
|
+
if ( data.version !== REVISION ||
|
|
545
|
+
data.settings && ( data.settings.storage === 'url' && data.settings.url !== location.href ) ) {
|
|
512
546
|
|
|
513
|
-
|
|
547
|
+
localStorage.removeItem( 'threejs-inspector' );
|
|
514
548
|
|
|
515
|
-
}
|
|
549
|
+
return {};
|
|
516
550
|
|
|
517
|
-
|
|
551
|
+
}
|
|
518
552
|
|
|
519
|
-
const data = JSON.parse( localStorage.getItem( 'threejs-inspector' ) || '{}' );
|
|
520
553
|
return data[ id ] || {};
|
|
521
554
|
|
|
522
555
|
}
|
|
@@ -535,6 +568,11 @@ function setItem( id, state ) {
|
|
|
535
568
|
|
|
536
569
|
}
|
|
537
570
|
|
|
571
|
+
data.settings = data.settings || {};
|
|
572
|
+
data.settings.url = data.settings.url || location.href;
|
|
573
|
+
data.settings.storage = data.settings.storage || 'url';
|
|
574
|
+
data.version = REVISION;
|
|
575
|
+
|
|
538
576
|
localStorage.setItem( 'threejs-inspector', JSON.stringify( data ) );
|
|
539
577
|
|
|
540
578
|
}
|