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
|
@@ -7,15 +7,16 @@ import { Vector2 } from '../../math/Vector2.js';
|
|
|
7
7
|
import { Vector3 } from '../../math/Vector3.js';
|
|
8
8
|
import { Vector4 } from '../../math/Vector4.js';
|
|
9
9
|
import { WebXRController } from '../webxr/WebXRController.js';
|
|
10
|
-
import { AddEquation, BackSide, CustomBlending, DepthFormat, DepthStencilFormat, FrontSide, RGBAFormat, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, ZeroFactor } from '../../constants.js';
|
|
10
|
+
import { AddEquation, BackSide, CustomBlending, DepthFormat, DepthStencilFormat, FrontSide, RGBAFormat, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, ZeroFactor, LinearFilter } from '../../constants.js';
|
|
11
11
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
12
12
|
import { XRRenderTarget } from './XRRenderTarget.js';
|
|
13
13
|
import { CylinderGeometry } from '../../geometries/CylinderGeometry.js';
|
|
14
14
|
import { PlaneGeometry } from '../../geometries/PlaneGeometry.js';
|
|
15
15
|
import { MeshBasicMaterial } from '../../materials/MeshBasicMaterial.js';
|
|
16
16
|
import { Mesh } from '../../objects/Mesh.js';
|
|
17
|
-
import { warn } from '../../utils.js';
|
|
17
|
+
import { warn, warnOnce } from '../../utils.js';
|
|
18
18
|
import { renderOutput } from '../../nodes/display/RenderOutputNode.js';
|
|
19
|
+
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
19
20
|
|
|
20
21
|
const _cameraLPos = /*@__PURE__*/ new Vector3();
|
|
21
22
|
const _cameraRPos = /*@__PURE__*/ new Vector3();
|
|
@@ -24,9 +25,7 @@ const _contextNodeLib = /*@__PURE__*/ new WeakMap();
|
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* The XR manager is built on top of the WebXR Device API to
|
|
27
|
-
* manage XR sessions with
|
|
28
|
-
*
|
|
29
|
-
* XR is currently only supported with a WebGL 2 backend.
|
|
28
|
+
* manage XR sessions with renderer backends.
|
|
30
29
|
*
|
|
31
30
|
* @augments EventDispatcher
|
|
32
31
|
*/
|
|
@@ -85,6 +84,7 @@ class XRManager extends EventDispatcher {
|
|
|
85
84
|
*/
|
|
86
85
|
this._cameraL = new PerspectiveCamera();
|
|
87
86
|
this._cameraL.viewport = new Vector4();
|
|
87
|
+
this._cameraL.matrixWorldAutoUpdate = false;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* Represents the camera for the right eye.
|
|
@@ -94,6 +94,7 @@ class XRManager extends EventDispatcher {
|
|
|
94
94
|
*/
|
|
95
95
|
this._cameraR = new PerspectiveCamera();
|
|
96
96
|
this._cameraR.viewport = new Vector4();
|
|
97
|
+
this._cameraR.matrixWorldAutoUpdate = false;
|
|
97
98
|
|
|
98
99
|
/**
|
|
99
100
|
* A list of cameras used for rendering the XR views.
|
|
@@ -182,6 +183,7 @@ class XRManager extends EventDispatcher {
|
|
|
182
183
|
* @readonly
|
|
183
184
|
*/
|
|
184
185
|
this._supportsGlBinding = typeof XRWebGLBinding !== 'undefined';
|
|
186
|
+
this._supportsWebGPUBinding = typeof globalThis.XRGPUBinding !== 'undefined';
|
|
185
187
|
|
|
186
188
|
/**
|
|
187
189
|
* Helper function to create native WebXR Layer.
|
|
@@ -227,6 +229,15 @@ class XRManager extends EventDispatcher {
|
|
|
227
229
|
*/
|
|
228
230
|
this._currentPixelRatio = null;
|
|
229
231
|
|
|
232
|
+
/**
|
|
233
|
+
* The renderer's sample count before XR temporarily overrides it.
|
|
234
|
+
*
|
|
235
|
+
* @private
|
|
236
|
+
* @type {?number}
|
|
237
|
+
* @default null
|
|
238
|
+
*/
|
|
239
|
+
this._currentSamples = null;
|
|
240
|
+
|
|
230
241
|
/**
|
|
231
242
|
* The current size of the renderer's canvas
|
|
232
243
|
* in logical pixel unit.
|
|
@@ -342,6 +353,16 @@ class XRManager extends EventDispatcher {
|
|
|
342
353
|
*/
|
|
343
354
|
this._glBinding = null;
|
|
344
355
|
|
|
356
|
+
/**
|
|
357
|
+
* A reference to the current XR WebGPU binding.
|
|
358
|
+
*
|
|
359
|
+
* @private
|
|
360
|
+
* @type {?XRGPUBinding}
|
|
361
|
+
* @default null
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
this._webgpuBinding = null;
|
|
365
|
+
|
|
345
366
|
/**
|
|
346
367
|
* A reference to the current XR projection layer.
|
|
347
368
|
*
|
|
@@ -445,16 +466,10 @@ class XRManager extends EventDispatcher {
|
|
|
445
466
|
/**
|
|
446
467
|
* Returns the foveation value.
|
|
447
468
|
*
|
|
448
|
-
* @return {number|undefined} The foveation value.
|
|
469
|
+
* @return {number|undefined} The foveation value.
|
|
449
470
|
*/
|
|
450
471
|
getFoveation() {
|
|
451
472
|
|
|
452
|
-
if ( this._glProjLayer === null && this._glBaseLayer === null ) {
|
|
453
|
-
|
|
454
|
-
return undefined;
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
|
|
458
473
|
return this._foveation;
|
|
459
474
|
|
|
460
475
|
}
|
|
@@ -591,6 +606,20 @@ class XRManager extends EventDispatcher {
|
|
|
591
606
|
|
|
592
607
|
}
|
|
593
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Returns the current base layer.
|
|
611
|
+
*
|
|
612
|
+
* This is an `XRProjectionLayer` when the targeted XR device supports the
|
|
613
|
+
* WebXR Layers API, or an `XRWebGLLayer` otherwise.
|
|
614
|
+
*
|
|
615
|
+
* @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
|
|
616
|
+
*/
|
|
617
|
+
getBaseLayer() {
|
|
618
|
+
|
|
619
|
+
return this._glProjLayer !== null ? this._glProjLayer : this._glBaseLayer;
|
|
620
|
+
|
|
621
|
+
}
|
|
622
|
+
|
|
594
623
|
|
|
595
624
|
/**
|
|
596
625
|
* Returns the current XR binding.
|
|
@@ -612,6 +641,258 @@ class XRManager extends EventDispatcher {
|
|
|
612
641
|
|
|
613
642
|
}
|
|
614
643
|
|
|
644
|
+
/**
|
|
645
|
+
* Applies WebXR fixed foveation to the internal post-processing render target
|
|
646
|
+
* used by the first XR render pass before compositing into a projection layer.
|
|
647
|
+
*
|
|
648
|
+
* Browser-side `XRWebGLBinding.foveateBoundTexture()` failures are treated as
|
|
649
|
+
* non-fatal so they do not interrupt rendering.
|
|
650
|
+
*
|
|
651
|
+
* @param {RenderTarget} renderTarget - The internal render target.
|
|
652
|
+
*/
|
|
653
|
+
foveateBoundTexture( renderTarget ) {
|
|
654
|
+
|
|
655
|
+
if ( renderTarget.isPostProcessingRenderTarget !== true ) return;
|
|
656
|
+
if ( this.isPresenting !== true ) return;
|
|
657
|
+
if ( this._glProjLayer === null ) return;
|
|
658
|
+
|
|
659
|
+
const backend = this._renderer.backend;
|
|
660
|
+
|
|
661
|
+
if ( backend === undefined || backend.isWebGLBackend !== true ) return;
|
|
662
|
+
if ( backend.state === null ) return;
|
|
663
|
+
|
|
664
|
+
const outputRenderTarget = this._renderer.getOutputRenderTarget();
|
|
665
|
+
|
|
666
|
+
if ( outputRenderTarget === null || outputRenderTarget.isXRRenderTarget !== true ) return;
|
|
667
|
+
|
|
668
|
+
const glBinding = this.getBinding();
|
|
669
|
+
|
|
670
|
+
if ( glBinding === null || typeof glBinding.foveateBoundTexture !== 'function' ) return;
|
|
671
|
+
|
|
672
|
+
this._renderer._textures.updateRenderTarget( renderTarget );
|
|
673
|
+
|
|
674
|
+
const { textureGPU, glTextureType } = backend.get( renderTarget.texture );
|
|
675
|
+
|
|
676
|
+
if ( textureGPU === undefined || glTextureType === undefined ) return;
|
|
677
|
+
if ( renderTarget._xrFoveationTextureGPU === textureGPU ) return;
|
|
678
|
+
|
|
679
|
+
renderTarget._xrFoveationTextureGPU = textureGPU;
|
|
680
|
+
|
|
681
|
+
backend.state.bindTexture( glTextureType, textureGPU );
|
|
682
|
+
|
|
683
|
+
try {
|
|
684
|
+
|
|
685
|
+
glBinding.foveateBoundTexture( glTextureType, this.getFoveation() );
|
|
686
|
+
|
|
687
|
+
} catch ( error ) {
|
|
688
|
+
|
|
689
|
+
warnOnce( `XRManager: Unable to foveate bound XR post-processing texture. ${error.name}: ${error.message}` );
|
|
690
|
+
|
|
691
|
+
} finally {
|
|
692
|
+
|
|
693
|
+
backend.state.unbindTexture();
|
|
694
|
+
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Returns the current XR WebGPU binding.
|
|
701
|
+
*
|
|
702
|
+
* Creates a new binding if needed and the browser is
|
|
703
|
+
* capable of doing so.
|
|
704
|
+
*
|
|
705
|
+
* @return {?XRGPUBinding} The XR WebGPU binding. Returns `null` if one cannot be created.
|
|
706
|
+
*/
|
|
707
|
+
getWebGPUBinding() {
|
|
708
|
+
|
|
709
|
+
if ( this._webgpuBinding === null && this._supportsWebGPUBinding ) {
|
|
710
|
+
|
|
711
|
+
this._webgpuBinding = new globalThis.XRGPUBinding( this._session, this._renderer.backend.device );
|
|
712
|
+
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
return this._webgpuBinding;
|
|
716
|
+
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Returns whether the current XR session is using WebGPU.
|
|
721
|
+
*
|
|
722
|
+
* @private
|
|
723
|
+
* @return {boolean} Whether the current session uses the WebGPU backend and the `webgpu` session feature.
|
|
724
|
+
*/
|
|
725
|
+
_isWebGPUSession() {
|
|
726
|
+
|
|
727
|
+
return this._renderer.backend.isWebGPUBackend === true &&
|
|
728
|
+
this._session !== null &&
|
|
729
|
+
this._session.enabledFeatures.includes( 'webgpu' );
|
|
730
|
+
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Validates the current WebGPU XR session requirements.
|
|
735
|
+
*
|
|
736
|
+
* @private
|
|
737
|
+
*/
|
|
738
|
+
_validateWebGPUSession() {
|
|
739
|
+
|
|
740
|
+
const renderer = this._renderer;
|
|
741
|
+
|
|
742
|
+
if ( renderer.backend.isWebGPUBackend !== true ) return;
|
|
743
|
+
|
|
744
|
+
if ( this._session.enabledFeatures.includes( 'webgpu' ) === false ) {
|
|
745
|
+
|
|
746
|
+
throw new Error( 'THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.' );
|
|
747
|
+
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if ( renderer.samples > 0 ) {
|
|
751
|
+
|
|
752
|
+
warnOnce( 'THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session.' );
|
|
753
|
+
|
|
754
|
+
if ( this._currentSamples === null ) this._currentSamples = renderer.samples;
|
|
755
|
+
renderer._samples = 0;
|
|
756
|
+
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Initializes the WebGPU XR projection layer and render target.
|
|
763
|
+
*
|
|
764
|
+
* @private
|
|
765
|
+
* @async
|
|
766
|
+
* @param {XRSession} session - The XR session.
|
|
767
|
+
* @return {Promise<void>}
|
|
768
|
+
*/
|
|
769
|
+
async _initWebGPUSession( session ) {
|
|
770
|
+
|
|
771
|
+
const webgpuBinding = this.getWebGPUBinding();
|
|
772
|
+
const glProjLayer = webgpuBinding.createProjectionLayer( {
|
|
773
|
+
colorFormat: webgpuBinding.getPreferredColorFormat(),
|
|
774
|
+
depthStencilFormat: 'depth24plus'
|
|
775
|
+
} );
|
|
776
|
+
|
|
777
|
+
this._glProjLayer = glProjLayer;
|
|
778
|
+
|
|
779
|
+
session.updateRenderState( { layers: [ glProjLayer ] } );
|
|
780
|
+
|
|
781
|
+
this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() );
|
|
782
|
+
|
|
783
|
+
this._xrRenderTarget = new RenderTarget( glProjLayer.textureWidth, glProjLayer.textureHeight, {
|
|
784
|
+
depth: 2,
|
|
785
|
+
minFilter: LinearFilter,
|
|
786
|
+
magFilter: LinearFilter,
|
|
787
|
+
depthBuffer: true,
|
|
788
|
+
multiview: false,
|
|
789
|
+
useArrayDepthTexture: true,
|
|
790
|
+
samples: 0
|
|
791
|
+
} );
|
|
792
|
+
|
|
793
|
+
this._xrRenderTarget.texture.isArrayTexture = true;
|
|
794
|
+
|
|
795
|
+
if ( this._useMultiviewIfPossible === true ) {
|
|
796
|
+
|
|
797
|
+
warnOnce( 'THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session.' );
|
|
798
|
+
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
this._useMultiview = false;
|
|
802
|
+
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Releases WebGPU XR resources associated with the current session.
|
|
807
|
+
*
|
|
808
|
+
* @private
|
|
809
|
+
*/
|
|
810
|
+
_disposeWebGPUSession() {
|
|
811
|
+
|
|
812
|
+
const renderer = this._renderer;
|
|
813
|
+
const xrRenderTarget = this._xrRenderTarget;
|
|
814
|
+
|
|
815
|
+
if ( xrRenderTarget === null || renderer.backend.isWebGPUBackend !== true ) return;
|
|
816
|
+
|
|
817
|
+
// XR textures are external (from XRGPUBinding), so clear cached state before disposal.
|
|
818
|
+
const backend = renderer.backend;
|
|
819
|
+
const texturesModule = renderer._textures;
|
|
820
|
+
|
|
821
|
+
const renderTargetData = backend.get ? backend.get( xrRenderTarget ) : null;
|
|
822
|
+
if ( renderTargetData ) {
|
|
823
|
+
|
|
824
|
+
renderTargetData.descriptors = undefined;
|
|
825
|
+
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const deleteResource = ( resource ) => {
|
|
829
|
+
|
|
830
|
+
if ( resource === null || resource === undefined ) return;
|
|
831
|
+
|
|
832
|
+
if ( backend.delete ) backend.delete( resource );
|
|
833
|
+
if ( texturesModule.delete ) texturesModule.delete( resource );
|
|
834
|
+
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
for ( let i = 0; i < xrRenderTarget.textures.length; i ++ ) {
|
|
838
|
+
|
|
839
|
+
deleteResource( xrRenderTarget.textures[ i ] );
|
|
840
|
+
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
deleteResource( xrRenderTarget.depthTexture );
|
|
844
|
+
deleteResource( xrRenderTarget );
|
|
845
|
+
|
|
846
|
+
if ( renderer._renderContexts && renderer._renderContexts.dispose ) {
|
|
847
|
+
|
|
848
|
+
renderer._renderContexts.dispose();
|
|
849
|
+
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
xrRenderTarget.dispose();
|
|
853
|
+
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Collects WebGPU XR sub-image data for the current frame.
|
|
858
|
+
*
|
|
859
|
+
* @private
|
|
860
|
+
* @param {Array<XRView>} views - The XR views for the current pose.
|
|
861
|
+
* @return {{colorTexture:?GPUTexture, viewDescriptors:Array<Object>, viewports:Array<XRViewport>}} The WebGPU XR view data.
|
|
862
|
+
*/
|
|
863
|
+
_getWebGPUViewData( views ) {
|
|
864
|
+
|
|
865
|
+
const webgpuBinding = this.getWebGPUBinding();
|
|
866
|
+
const viewData = {
|
|
867
|
+
colorTexture: null,
|
|
868
|
+
viewDescriptors: [],
|
|
869
|
+
viewports: []
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
873
|
+
|
|
874
|
+
const gpuSubImage = webgpuBinding.getViewSubImage( this._glProjLayer, views[ i ] );
|
|
875
|
+
|
|
876
|
+
if ( viewData.colorTexture === null ) {
|
|
877
|
+
|
|
878
|
+
viewData.colorTexture = gpuSubImage.colorTexture;
|
|
879
|
+
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
viewData.viewports.push( gpuSubImage.viewport );
|
|
883
|
+
|
|
884
|
+
if ( gpuSubImage.getViewDescriptor ) {
|
|
885
|
+
|
|
886
|
+
viewData.viewDescriptors.push( gpuSubImage.getViewDescriptor() );
|
|
887
|
+
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
return viewData;
|
|
893
|
+
|
|
894
|
+
}
|
|
895
|
+
|
|
615
896
|
/**
|
|
616
897
|
* Returns the current XR frame.
|
|
617
898
|
*
|
|
@@ -925,18 +1206,16 @@ class XRManager extends EventDispatcher {
|
|
|
925
1206
|
async setSession( session ) {
|
|
926
1207
|
|
|
927
1208
|
const renderer = this._renderer;
|
|
928
|
-
|
|
1209
|
+
|
|
1210
|
+
if ( renderer.initialized === false ) await renderer.init();
|
|
929
1211
|
|
|
930
1212
|
this._gl = renderer.getContext();
|
|
931
1213
|
const gl = this._gl;
|
|
932
|
-
const attributes = gl.getContextAttributes();
|
|
933
1214
|
|
|
934
1215
|
this._session = session;
|
|
935
1216
|
|
|
936
1217
|
if ( session !== null ) {
|
|
937
1218
|
|
|
938
|
-
if ( backend.isWebGPUBackend === true ) throw new Error( 'THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.' );
|
|
939
|
-
|
|
940
1219
|
session.addEventListener( 'select', this._onSessionEvent );
|
|
941
1220
|
session.addEventListener( 'selectstart', this._onSessionEvent );
|
|
942
1221
|
session.addEventListener( 'selectend', this._onSessionEvent );
|
|
@@ -946,7 +1225,7 @@ class XRManager extends EventDispatcher {
|
|
|
946
1225
|
session.addEventListener( 'end', this._onSessionEnd );
|
|
947
1226
|
session.addEventListener( 'inputsourceschange', this._onInputSourcesChange );
|
|
948
1227
|
|
|
949
|
-
|
|
1228
|
+
this._validateWebGPUSession();
|
|
950
1229
|
|
|
951
1230
|
this._currentPixelRatio = renderer.getPixelRatio();
|
|
952
1231
|
renderer.getSize( this._currentSize );
|
|
@@ -957,7 +1236,11 @@ class XRManager extends EventDispatcher {
|
|
|
957
1236
|
|
|
958
1237
|
//
|
|
959
1238
|
|
|
960
|
-
if ( this.
|
|
1239
|
+
if ( this._isWebGPUSession() ) {
|
|
1240
|
+
|
|
1241
|
+
await this._initWebGPUSession( session );
|
|
1242
|
+
|
|
1243
|
+
} else if ( this._supportsLayers === true ) {
|
|
961
1244
|
|
|
962
1245
|
// default path using XRProjectionLayer
|
|
963
1246
|
|
|
@@ -965,6 +1248,10 @@ class XRManager extends EventDispatcher {
|
|
|
965
1248
|
let depthType = null;
|
|
966
1249
|
let glDepthFormat = null;
|
|
967
1250
|
|
|
1251
|
+
const attributes = gl.getContextAttributes();
|
|
1252
|
+
await renderer.backend.makeXRCompatible();
|
|
1253
|
+
this.setFoveation( this.getFoveation() );
|
|
1254
|
+
|
|
968
1255
|
if ( renderer.depth ) {
|
|
969
1256
|
|
|
970
1257
|
glDepthFormat = renderer.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;
|
|
@@ -1047,6 +1334,8 @@ class XRManager extends EventDispatcher {
|
|
|
1047
1334
|
} else {
|
|
1048
1335
|
|
|
1049
1336
|
// fallback to XRWebGLLayer
|
|
1337
|
+
await renderer.backend.makeXRCompatible();
|
|
1338
|
+
this.setFoveation( this.getFoveation() );
|
|
1050
1339
|
|
|
1051
1340
|
const layerInit = {
|
|
1052
1341
|
antialias: renderer.currentSamples > 0,
|
|
@@ -1084,8 +1373,6 @@ class XRManager extends EventDispatcher {
|
|
|
1084
1373
|
|
|
1085
1374
|
//
|
|
1086
1375
|
|
|
1087
|
-
this.setFoveation( this.getFoveation() );
|
|
1088
|
-
|
|
1089
1376
|
renderer._animation.setAnimationLoop( this._onAnimationFrame );
|
|
1090
1377
|
renderer._animation.setContext( session );
|
|
1091
1378
|
renderer._animation.start();
|
|
@@ -1383,13 +1670,23 @@ function onSessionEnd() {
|
|
|
1383
1670
|
this._currentDepthNear = null;
|
|
1384
1671
|
this._currentDepthFar = null;
|
|
1385
1672
|
|
|
1673
|
+
if ( this._currentSamples !== null ) {
|
|
1674
|
+
|
|
1675
|
+
renderer._samples = this._currentSamples;
|
|
1676
|
+
this._currentSamples = null;
|
|
1677
|
+
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1386
1680
|
// restore framebuffer/rendering state
|
|
1387
1681
|
|
|
1388
1682
|
renderer._resetXRState();
|
|
1389
1683
|
|
|
1684
|
+
this._disposeWebGPUSession();
|
|
1685
|
+
|
|
1390
1686
|
this._session = null;
|
|
1391
1687
|
this._xrRenderTarget = null;
|
|
1392
1688
|
this._glBinding = null;
|
|
1689
|
+
this._webgpuBinding = null;
|
|
1393
1690
|
this._glBaseLayer = null;
|
|
1394
1691
|
this._glProjLayer = null;
|
|
1395
1692
|
|
|
@@ -1573,7 +1870,9 @@ function onAnimationFrame( time, frame ) {
|
|
|
1573
1870
|
|
|
1574
1871
|
const views = pose.views;
|
|
1575
1872
|
|
|
1576
|
-
|
|
1873
|
+
const webgpuViewData = this._isWebGPUSession() ? this._getWebGPUViewData( views ) : null;
|
|
1874
|
+
|
|
1875
|
+
if ( this._glBaseLayer !== null && webgpuViewData === null ) {
|
|
1577
1876
|
|
|
1578
1877
|
backend.setXRTarget( glBaseLayer.framebuffer );
|
|
1579
1878
|
|
|
@@ -1596,8 +1895,13 @@ function onAnimationFrame( time, frame ) {
|
|
|
1596
1895
|
|
|
1597
1896
|
let viewport;
|
|
1598
1897
|
|
|
1599
|
-
if (
|
|
1898
|
+
if ( webgpuViewData !== null ) {
|
|
1899
|
+
|
|
1900
|
+
viewport = webgpuViewData.viewports[ i ];
|
|
1901
|
+
|
|
1902
|
+
} else if ( this._supportsLayers === true ) {
|
|
1600
1903
|
|
|
1904
|
+
// WebGL path: Use XRWebGLBinding
|
|
1601
1905
|
const glSubImage = this._glBinding.getViewSubImage( this._glProjLayer, view );
|
|
1602
1906
|
viewport = glSubImage.viewport;
|
|
1603
1907
|
|
|
@@ -1625,6 +1929,7 @@ function onAnimationFrame( time, frame ) {
|
|
|
1625
1929
|
camera = new PerspectiveCamera();
|
|
1626
1930
|
camera.layers.enable( i );
|
|
1627
1931
|
camera.viewport = new Vector4();
|
|
1932
|
+
camera.matrixWorldAutoUpdate = false;
|
|
1628
1933
|
this._cameras[ i ] = camera;
|
|
1629
1934
|
|
|
1630
1935
|
}
|
|
@@ -1650,8 +1955,21 @@ function onAnimationFrame( time, frame ) {
|
|
|
1650
1955
|
|
|
1651
1956
|
}
|
|
1652
1957
|
|
|
1958
|
+
if ( webgpuViewData !== null && webgpuViewData.colorTexture !== null ) {
|
|
1959
|
+
|
|
1960
|
+
backend.setXRRenderTargetTextures(
|
|
1961
|
+
this._xrRenderTarget,
|
|
1962
|
+
webgpuViewData.colorTexture,
|
|
1963
|
+
webgpuViewData.viewDescriptors
|
|
1964
|
+
);
|
|
1965
|
+
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1653
1968
|
renderer.setOutputRenderTarget( this._xrRenderTarget );
|
|
1654
1969
|
|
|
1970
|
+
const frameBufferTarget = renderer._getFrameBufferTarget();
|
|
1971
|
+
renderer.xr.foveateBoundTexture( frameBufferTarget );
|
|
1972
|
+
|
|
1655
1973
|
}
|
|
1656
1974
|
|
|
1657
1975
|
//
|
|
@@ -146,15 +146,7 @@ class PMREMGenerator {
|
|
|
146
146
|
|
|
147
147
|
if ( this._hasInitialized === false ) {
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const cubeUVRenderTarget = renderTarget || this._allocateTarget();
|
|
152
|
-
|
|
153
|
-
options.renderTarget = cubeUVRenderTarget;
|
|
154
|
-
|
|
155
|
-
this.fromSceneAsync( scene, sigma, near, far, options );
|
|
156
|
-
|
|
157
|
-
return cubeUVRenderTarget;
|
|
149
|
+
throw new Error( 'THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.' );
|
|
158
150
|
|
|
159
151
|
}
|
|
160
152
|
|
|
@@ -162,8 +154,7 @@ class PMREMGenerator {
|
|
|
162
154
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
163
155
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
164
156
|
|
|
165
|
-
const cubeUVRenderTarget = renderTarget || this._allocateTarget();
|
|
166
|
-
cubeUVRenderTarget.depthBuffer = true;
|
|
157
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTarget( true );
|
|
167
158
|
|
|
168
159
|
this._init( cubeUVRenderTarget );
|
|
169
160
|
|
|
@@ -214,8 +205,9 @@ class PMREMGenerator {
|
|
|
214
205
|
|
|
215
206
|
/**
|
|
216
207
|
* Generates a PMREM from an equirectangular texture, which can be either LDR
|
|
217
|
-
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
218
|
-
*
|
|
208
|
+
* or HDR. The ideal input image size is 1k (1024 x 512), as this matches best
|
|
209
|
+
* with the 256 x 256 cubemap output. The minimum supported input image size
|
|
210
|
+
* is 64 x 32.
|
|
219
211
|
*
|
|
220
212
|
* @param {Texture} equirectangular - The equirectangular texture to be converted.
|
|
221
213
|
* @param {?RenderTarget} [renderTarget=null] - The render target to use.
|
|
@@ -226,15 +218,7 @@ class PMREMGenerator {
|
|
|
226
218
|
|
|
227
219
|
if ( this._hasInitialized === false ) {
|
|
228
220
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this._setSizeFromTexture( equirectangular );
|
|
232
|
-
|
|
233
|
-
const cubeUVRenderTarget = renderTarget || this._allocateTarget();
|
|
234
|
-
|
|
235
|
-
this.fromEquirectangularAsync( equirectangular, cubeUVRenderTarget );
|
|
236
|
-
|
|
237
|
-
return cubeUVRenderTarget;
|
|
221
|
+
throw new Error( 'THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.' );
|
|
238
222
|
|
|
239
223
|
}
|
|
240
224
|
|
|
@@ -265,8 +249,9 @@ class PMREMGenerator {
|
|
|
265
249
|
|
|
266
250
|
/**
|
|
267
251
|
* Generates a PMREM from an cubemap texture, which can be either LDR
|
|
268
|
-
* or HDR. The ideal input cube size is 256 x 256,
|
|
269
|
-
*
|
|
252
|
+
* or HDR. The ideal input cube size is 256 x 256, as this matches best
|
|
253
|
+
* with the 256 x 256 cubemap output. The minimum supported input cube
|
|
254
|
+
* size is 16 x 16 per face.
|
|
270
255
|
*
|
|
271
256
|
* @param {Texture} cubemap - The cubemap texture to be converted.
|
|
272
257
|
* @param {?RenderTarget} [renderTarget=null] - The render target to use.
|
|
@@ -277,15 +262,7 @@ class PMREMGenerator {
|
|
|
277
262
|
|
|
278
263
|
if ( this._hasInitialized === false ) {
|
|
279
264
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
this._setSizeFromTexture( cubemap );
|
|
283
|
-
|
|
284
|
-
const cubeUVRenderTarget = renderTarget || this._allocateTarget();
|
|
285
|
-
|
|
286
|
-
this.fromCubemapAsync( cubemap, renderTarget );
|
|
287
|
-
|
|
288
|
-
return cubeUVRenderTarget;
|
|
265
|
+
throw new Error( 'THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.' );
|
|
289
266
|
|
|
290
267
|
}
|
|
291
268
|
|
|
@@ -422,7 +399,7 @@ class PMREMGenerator {
|
|
|
422
399
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
423
400
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
424
401
|
|
|
425
|
-
const cubeUVRenderTarget = renderTarget || this._allocateTarget();
|
|
402
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTarget( false );
|
|
426
403
|
this._init( cubeUVRenderTarget );
|
|
427
404
|
this._textureToCubeUV( texture, cubeUVRenderTarget );
|
|
428
405
|
this._applyPMREM( cubeUVRenderTarget );
|
|
@@ -432,12 +409,12 @@ class PMREMGenerator {
|
|
|
432
409
|
|
|
433
410
|
}
|
|
434
411
|
|
|
435
|
-
_allocateTarget() {
|
|
412
|
+
_allocateTarget( depthBuffer ) {
|
|
436
413
|
|
|
437
414
|
const width = 3 * Math.max( this._cubeSize, 16 * 7 );
|
|
438
415
|
const height = 4 * this._cubeSize;
|
|
439
416
|
|
|
440
|
-
const cubeUVRenderTarget = _createRenderTarget( width, height );
|
|
417
|
+
const cubeUVRenderTarget = _createRenderTarget( width, height, depthBuffer );
|
|
441
418
|
|
|
442
419
|
return cubeUVRenderTarget;
|
|
443
420
|
|
|
@@ -919,7 +896,7 @@ function _createPlanes( lodMax ) {
|
|
|
919
896
|
|
|
920
897
|
}
|
|
921
898
|
|
|
922
|
-
function _createRenderTarget( width, height ) {
|
|
899
|
+
function _createRenderTarget( width, height, depthBuffer ) {
|
|
923
900
|
|
|
924
901
|
const params = {
|
|
925
902
|
magFilter: LinearFilter,
|
|
@@ -928,7 +905,7 @@ function _createRenderTarget( width, height ) {
|
|
|
928
905
|
type: HalfFloatType,
|
|
929
906
|
format: RGBAFormat,
|
|
930
907
|
colorSpace: LinearSRGBColorSpace,
|
|
931
|
-
|
|
908
|
+
depthBuffer
|
|
932
909
|
};
|
|
933
910
|
|
|
934
911
|
const cubeUVRenderTarget = new RenderTarget( width, height, params );
|
|
@@ -23,9 +23,10 @@ class NodeBuilderState {
|
|
|
23
23
|
* @param {Array<Node>} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method.
|
|
24
24
|
* @param {Array<Node>} updateAfterNodes - An array of nodes that implement their `updateAfter()` method.
|
|
25
25
|
* @param {NodeMaterialObserver} observer - A node material observer.
|
|
26
|
+
* @param {boolean} hardwareClipping - Whether the built material uses hardware clipping or not.
|
|
26
27
|
* @param {Array<Object>} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2.
|
|
27
28
|
*/
|
|
28
|
-
constructor( vertexShader, fragmentShader, computeShader, nodeAttributes, bindings, updateNodes, updateBeforeNodes, updateAfterNodes, observer, transforms = [] ) {
|
|
29
|
+
constructor( vertexShader, fragmentShader, computeShader, nodeAttributes, bindings, updateNodes, updateBeforeNodes, updateAfterNodes, observer, hardwareClipping, transforms = [] ) {
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* The native vertex shader code.
|
|
@@ -100,6 +101,13 @@ class NodeBuilderState {
|
|
|
100
101
|
*/
|
|
101
102
|
this.observer = observer;
|
|
102
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Whether the built material uses hardware clipping or not.
|
|
106
|
+
*
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
*/
|
|
109
|
+
this.hardwareClipping = hardwareClipping;
|
|
110
|
+
|
|
103
111
|
/**
|
|
104
112
|
* How often this state is used by render objects.
|
|
105
113
|
*
|
|
@@ -161,8 +161,8 @@ class NodeLibrary {
|
|
|
161
161
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
if ( typeof nodeClass !== 'function' ) throw new Error( `Node class ${ nodeClass.name } is not a class.` );
|
|
165
|
-
if ( typeof type === 'function' || typeof type === 'object' ) throw new Error( `Base class ${ type } is not a class.` );
|
|
164
|
+
if ( typeof nodeClass !== 'function' ) throw new Error( `THREE.NodeLibrary: Node class ${ nodeClass.name } is not a class.` );
|
|
165
|
+
if ( typeof type === 'function' || typeof type === 'object' ) throw new Error( `THREE.NodeLibrary: Base class ${ type } is not a class.` );
|
|
166
166
|
|
|
167
167
|
library.set( type, nodeClass );
|
|
168
168
|
|
|
@@ -184,8 +184,8 @@ class NodeLibrary {
|
|
|
184
184
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
if ( typeof nodeClass !== 'function' ) throw new Error( `Node class ${ nodeClass.name } is not a class.` );
|
|
188
|
-
if ( typeof baseClass !== 'function' ) throw new Error( `Base class ${ baseClass.name } is not a class.` );
|
|
187
|
+
if ( typeof nodeClass !== 'function' ) throw new Error( `THREE.NodeLibrary: Node class ${ nodeClass.name } is not a class.` );
|
|
188
|
+
if ( typeof baseClass !== 'function' ) throw new Error( `THREE.NodeLibrary: Base class ${ baseClass.name } is not a class.` );
|
|
189
189
|
|
|
190
190
|
library.set( baseClass, nodeClass );
|
|
191
191
|
|