@gnsx/three 0.184.19 → 0.185.2
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 +1667 -1189
- package/build/three.core.js +1289 -871
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +157 -97
- 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 +7542 -3371
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +7542 -3370
- 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 +57 -64
- 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 +124 -91
- 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 -74
- 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 +92 -37
- package/src/nodes/lighting/PointShadowNode.js +7 -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/profiler/ProfilerService.js +185 -42
- package/src/renderers/WebGLRenderer.js +21 -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 +42 -4
- package/src/renderers/common/RenderObject.js +73 -13
- package/src/renderers/common/Renderer.js +282 -109
- 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 +11 -4
- 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
|
@@ -79,21 +79,15 @@ class Bindings extends DataMap {
|
|
|
79
79
|
|
|
80
80
|
const bindings = renderObject.getBindings();
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const groupData = this.get( bindGroup );
|
|
85
|
-
|
|
86
|
-
if ( groupData.bindGroup === undefined ) {
|
|
87
|
-
|
|
88
|
-
// each object defines an array of bindings (ubos, textures, samplers etc.)
|
|
82
|
+
const renderObjectData = this.get( renderObject );
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
if ( renderObjectData.initialized !== true ) {
|
|
91
85
|
|
|
92
|
-
|
|
86
|
+
// bind groups are created once per object
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
this._createBindings( bindings );
|
|
95
89
|
|
|
96
|
-
|
|
90
|
+
renderObjectData.initialized = true;
|
|
97
91
|
|
|
98
92
|
}
|
|
99
93
|
|
|
@@ -110,20 +104,22 @@ class Bindings extends DataMap {
|
|
|
110
104
|
getForCompute( computeNode ) {
|
|
111
105
|
|
|
112
106
|
const bindings = this.nodes.getForCompute( computeNode ).bindings;
|
|
107
|
+
const computeNodeData = this.get( computeNode );
|
|
113
108
|
|
|
114
|
-
|
|
109
|
+
if ( computeNodeData.initialized !== true || computeNodeData.bindings !== bindings ) {
|
|
115
110
|
|
|
116
|
-
|
|
111
|
+
// bind groups are created once per compute node version
|
|
117
112
|
|
|
118
|
-
if (
|
|
113
|
+
if ( computeNodeData.bindings !== undefined ) {
|
|
119
114
|
|
|
120
|
-
this.
|
|
115
|
+
this._destroyBindings( computeNodeData.bindings );
|
|
121
116
|
|
|
122
|
-
|
|
117
|
+
}
|
|
123
118
|
|
|
124
|
-
|
|
119
|
+
this._createBindings( bindings );
|
|
125
120
|
|
|
126
|
-
|
|
121
|
+
computeNodeData.initialized = true;
|
|
122
|
+
computeNodeData.bindings = bindings;
|
|
127
123
|
|
|
128
124
|
}
|
|
129
125
|
|
|
@@ -160,14 +156,12 @@ class Bindings extends DataMap {
|
|
|
160
156
|
*/
|
|
161
157
|
deleteForCompute( computeNode ) {
|
|
162
158
|
|
|
163
|
-
const
|
|
159
|
+
const computeNodeData = this.get( computeNode );
|
|
160
|
+
const bindings = computeNodeData.bindings || this.nodes.getForCompute( computeNode ).bindings;
|
|
164
161
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.backend.deleteBindGroupData( bindGroup );
|
|
168
|
-
this.delete( bindGroup );
|
|
162
|
+
this._destroyBindings( bindings );
|
|
169
163
|
|
|
170
|
-
|
|
164
|
+
this.delete( computeNode );
|
|
171
165
|
|
|
172
166
|
}
|
|
173
167
|
|
|
@@ -180,53 +174,113 @@ class Bindings extends DataMap {
|
|
|
180
174
|
|
|
181
175
|
const bindings = renderObject.getBindings();
|
|
182
176
|
|
|
183
|
-
|
|
177
|
+
this._destroyBindings( bindings );
|
|
184
178
|
|
|
185
|
-
|
|
186
|
-
this.delete( bindGroup );
|
|
187
|
-
|
|
188
|
-
}
|
|
179
|
+
this.delete( renderObject );
|
|
189
180
|
|
|
190
181
|
}
|
|
191
182
|
|
|
192
183
|
/**
|
|
193
|
-
*
|
|
184
|
+
* Creates the bindings for the given array of bindings.
|
|
194
185
|
*
|
|
195
186
|
* @param {Array<BindGroup>} bindings - The bind groups.
|
|
196
187
|
*/
|
|
197
|
-
|
|
188
|
+
_createBindings( bindings ) {
|
|
198
189
|
|
|
199
190
|
for ( const bindGroup of bindings ) {
|
|
200
191
|
|
|
201
|
-
|
|
192
|
+
// binding group
|
|
193
|
+
|
|
194
|
+
const groupData = this.get( bindGroup );
|
|
195
|
+
|
|
196
|
+
if ( groupData.bindGroup === undefined ) {
|
|
197
|
+
|
|
198
|
+
// initialize
|
|
199
|
+
|
|
200
|
+
for ( const binding of bindGroup.bindings ) {
|
|
201
|
+
|
|
202
|
+
if ( binding.isUniformBuffer ) {
|
|
203
|
+
|
|
204
|
+
this.backend.createUniformBuffer( binding );
|
|
205
|
+
this.info.createUniformBuffer( binding );
|
|
206
|
+
|
|
207
|
+
} else if ( binding.isSampledTexture ) {
|
|
208
|
+
|
|
209
|
+
this.textures.updateTexture( binding.texture );
|
|
210
|
+
|
|
211
|
+
} else if ( binding.isSampler ) {
|
|
212
|
+
|
|
213
|
+
this.textures.updateSampler( binding );
|
|
214
|
+
|
|
215
|
+
} else if ( binding.isStorageBuffer ) {
|
|
216
|
+
|
|
217
|
+
const attribute = binding.attribute;
|
|
218
|
+
const attributeType = attribute.isIndirectStorageBufferAttribute ? AttributeType.INDIRECT : AttributeType.STORAGE;
|
|
219
|
+
|
|
220
|
+
this.attributes.update( attribute, attributeType );
|
|
221
|
+
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// each object defines an array of bindings (ubos, textures, samplers etc.)
|
|
227
|
+
|
|
228
|
+
this.backend.createBindings( bindGroup, bindings, 0 );
|
|
229
|
+
|
|
230
|
+
groupData.bindGroup = bindGroup;
|
|
231
|
+
groupData.usedTimes = 1;
|
|
232
|
+
|
|
233
|
+
} else {
|
|
234
|
+
|
|
235
|
+
groupData.usedTimes ++;
|
|
236
|
+
|
|
237
|
+
}
|
|
202
238
|
|
|
203
239
|
}
|
|
204
240
|
|
|
205
241
|
}
|
|
206
242
|
|
|
207
243
|
/**
|
|
208
|
-
*
|
|
244
|
+
* Deletes the given array of bindings.
|
|
209
245
|
*
|
|
210
|
-
* @param {BindGroup}
|
|
246
|
+
* @param {Array<BindGroup>} bindings - The bind groups.
|
|
211
247
|
*/
|
|
212
|
-
|
|
248
|
+
_destroyBindings( bindings ) {
|
|
213
249
|
|
|
214
|
-
for ( const
|
|
250
|
+
for ( const bindGroup of bindings ) {
|
|
215
251
|
|
|
216
|
-
|
|
252
|
+
const groupData = this.get( bindGroup );
|
|
253
|
+
groupData.usedTimes --;
|
|
217
254
|
|
|
218
|
-
|
|
255
|
+
if ( groupData.usedTimes === 0 ) {
|
|
219
256
|
|
|
220
|
-
|
|
257
|
+
for ( const binding of bindGroup.bindings ) {
|
|
221
258
|
|
|
222
|
-
|
|
259
|
+
if ( binding.isUniformBuffer ) {
|
|
223
260
|
|
|
224
|
-
|
|
261
|
+
this.backend.destroyUniformBuffer( binding );
|
|
262
|
+
this.info.destroyUniformBuffer( binding );
|
|
225
263
|
|
|
226
|
-
|
|
227
|
-
const attributeType = attribute.isIndirectStorageBufferAttribute ? AttributeType.INDIRECT : AttributeType.STORAGE;
|
|
264
|
+
// release arrays
|
|
228
265
|
|
|
229
|
-
|
|
266
|
+
binding.release();
|
|
267
|
+
|
|
268
|
+
} else if ( binding.isSampler ) {
|
|
269
|
+
|
|
270
|
+
if ( binding.isSampledTexture !== true ) {
|
|
271
|
+
|
|
272
|
+
this.backend.destroySampler( binding );
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
binding.release();
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
this.backend.deleteBindGroupData( bindGroup );
|
|
283
|
+
this.delete( bindGroup );
|
|
230
284
|
|
|
231
285
|
}
|
|
232
286
|
|
|
@@ -234,6 +288,21 @@ class Bindings extends DataMap {
|
|
|
234
288
|
|
|
235
289
|
}
|
|
236
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Updates the given array of bindings.
|
|
293
|
+
*
|
|
294
|
+
* @param {Array<BindGroup>} bindings - The bind groups.
|
|
295
|
+
*/
|
|
296
|
+
_updateBindings( bindings ) {
|
|
297
|
+
|
|
298
|
+
for ( const bindGroup of bindings ) {
|
|
299
|
+
|
|
300
|
+
this._update( bindGroup, bindings );
|
|
301
|
+
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
}
|
|
305
|
+
|
|
237
306
|
/**
|
|
238
307
|
* Updates the given bind group.
|
|
239
308
|
*
|
|
@@ -359,7 +428,7 @@ class Bindings extends DataMap {
|
|
|
359
428
|
|
|
360
429
|
if ( updated ) {
|
|
361
430
|
|
|
362
|
-
const samplerKey = this.textures.updateSampler( binding
|
|
431
|
+
const samplerKey = this.textures.updateSampler( binding );
|
|
363
432
|
|
|
364
433
|
if ( binding.samplerKey !== samplerKey ) {
|
|
365
434
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Matrix3 } from '../../math/Matrix3.js';
|
|
2
|
+
import { Matrix4 } from '../../math/Matrix4.js';
|
|
2
3
|
import { Plane } from '../../math/Plane.js';
|
|
3
4
|
import { Vector4 } from '../../math/Vector4.js';
|
|
4
5
|
|
|
@@ -52,6 +53,13 @@ class ClippingContext {
|
|
|
52
53
|
*/
|
|
53
54
|
this.shadowPass = false;
|
|
54
55
|
|
|
56
|
+
/**
|
|
57
|
+
* The view matrix.
|
|
58
|
+
*
|
|
59
|
+
* @type {Matrix4}
|
|
60
|
+
*/
|
|
61
|
+
this.viewMatrix = new Matrix4();
|
|
62
|
+
|
|
55
63
|
/**
|
|
56
64
|
* The view normal matrix.
|
|
57
65
|
*
|
|
@@ -90,11 +98,11 @@ class ClippingContext {
|
|
|
90
98
|
|
|
91
99
|
if ( parentContext !== null ) {
|
|
92
100
|
|
|
101
|
+
this.viewMatrix = parentContext.viewMatrix;
|
|
93
102
|
this.viewNormalMatrix = parentContext.viewNormalMatrix;
|
|
94
103
|
this.clippingGroupContexts = parentContext.clippingGroupContexts;
|
|
95
104
|
|
|
96
105
|
this.shadowPass = parentContext.shadowPass;
|
|
97
|
-
this.viewMatrix = parentContext.viewMatrix;
|
|
98
106
|
|
|
99
107
|
}
|
|
100
108
|
|
|
@@ -137,8 +145,8 @@ class ClippingContext {
|
|
|
137
145
|
updateGlobal( scene, camera ) {
|
|
138
146
|
|
|
139
147
|
this.shadowPass = ( scene.overrideMaterial !== null && scene.overrideMaterial.isShadowPassMaterial );
|
|
140
|
-
this.viewMatrix = camera.matrixWorldInverse;
|
|
141
148
|
|
|
149
|
+
this.viewMatrix.copy( camera.matrixWorldInverse );
|
|
142
150
|
this.viewNormalMatrix.getNormalMatrix( this.viewMatrix );
|
|
143
151
|
|
|
144
152
|
}
|
|
@@ -94,42 +94,46 @@ class Info {
|
|
|
94
94
|
*
|
|
95
95
|
* @type {Object}
|
|
96
96
|
* @readonly
|
|
97
|
-
* @property {number} geometries - The number of active geometries.
|
|
98
|
-
* @property {number} textures - The number of active textures.
|
|
99
97
|
* @property {number} attributes - The number of active attributes.
|
|
98
|
+
* @property {number} attributesSize - The memory size of active attributes in bytes.
|
|
99
|
+
* @property {number} geometries - The number of active geometries.
|
|
100
100
|
* @property {number} indexAttributes - The number of active index attributes.
|
|
101
|
-
* @property {number}
|
|
101
|
+
* @property {number} indexAttributesSize - The memory size of active index attributes in bytes.
|
|
102
102
|
* @property {number} indirectStorageAttributes - The number of active indirect storage attributes.
|
|
103
|
-
* @property {number}
|
|
103
|
+
* @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes.
|
|
104
104
|
* @property {number} programs - The number of active programs.
|
|
105
|
+
* @property {number} programsSize - The memory size of active programs in bytes.
|
|
106
|
+
* @property {number} readbackBuffers - The number of active readback buffers.
|
|
107
|
+
* @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes.
|
|
105
108
|
* @property {number} renderTargets - The number of active renderTargets.
|
|
106
|
-
* @property {number}
|
|
107
|
-
* @property {number} texturesSize - The memory size of active textures in bytes.
|
|
108
|
-
* @property {number} attributesSize - The memory size of active attributes in bytes.
|
|
109
|
-
* @property {number} indexAttributesSize - The memory size of active index attributes in bytes.
|
|
109
|
+
* @property {number} storageAttributes - The number of active storage attributes.
|
|
110
110
|
* @property {number} storageAttributesSize - The memory size of active storage attributes in bytes.
|
|
111
|
-
* @property {number}
|
|
112
|
-
* @property {number}
|
|
113
|
-
* @property {number}
|
|
111
|
+
* @property {number} textures - The number of active textures.
|
|
112
|
+
* @property {number} texturesSize - The memory size of active textures in bytes.
|
|
113
|
+
* @property {number} uniformBuffers - The number of active uniform buffers.
|
|
114
|
+
* @property {number} uniformBuffersSize - The memory size of active uniform buffers in bytes.
|
|
115
|
+
* @property {number} total - The total memory size in bytes.
|
|
114
116
|
*/
|
|
115
117
|
this.memory = {
|
|
116
|
-
geometries: 0,
|
|
117
|
-
textures: 0,
|
|
118
118
|
attributes: 0,
|
|
119
|
+
attributesSize: 0,
|
|
120
|
+
geometries: 0,
|
|
119
121
|
indexAttributes: 0,
|
|
120
|
-
|
|
122
|
+
indexAttributesSize: 0,
|
|
121
123
|
indirectStorageAttributes: 0,
|
|
122
|
-
|
|
124
|
+
indirectStorageAttributesSize: 0,
|
|
123
125
|
programs: 0,
|
|
126
|
+
programsSize: 0,
|
|
127
|
+
readbackBuffers: 0,
|
|
128
|
+
readbackBuffersSize: 0,
|
|
124
129
|
renderTargets: 0,
|
|
125
|
-
|
|
126
|
-
texturesSize: 0,
|
|
127
|
-
attributesSize: 0,
|
|
128
|
-
indexAttributesSize: 0,
|
|
130
|
+
storageAttributes: 0,
|
|
129
131
|
storageAttributesSize: 0,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
textures: 0,
|
|
133
|
+
texturesSize: 0,
|
|
134
|
+
uniformBuffers: 0,
|
|
135
|
+
uniformBuffersSize: 0,
|
|
136
|
+
total: 0
|
|
133
137
|
};
|
|
134
138
|
|
|
135
139
|
/**
|
|
@@ -365,6 +369,43 @@ class Info {
|
|
|
365
369
|
|
|
366
370
|
}
|
|
367
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Tracks a uniform buffer memory explicitly.
|
|
374
|
+
*
|
|
375
|
+
* @param {UniformBuffer} uniformBuffer - The uniform buffer to track.
|
|
376
|
+
*/
|
|
377
|
+
createUniformBuffer( uniformBuffer ) {
|
|
378
|
+
|
|
379
|
+
const size = uniformBuffer.byteLength;
|
|
380
|
+
this.memoryMap.set( uniformBuffer, { size, type: 'uniformBuffers' } );
|
|
381
|
+
|
|
382
|
+
this.memory.uniformBuffers ++;
|
|
383
|
+
this.memory.total += size;
|
|
384
|
+
this.memory.uniformBuffersSize += size;
|
|
385
|
+
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Tracks a uniform buffer memory explicitly.
|
|
390
|
+
*
|
|
391
|
+
* @param {UniformBuffer} uniformBuffer - The uniform buffer to track.
|
|
392
|
+
*/
|
|
393
|
+
destroyUniformBuffer( uniformBuffer ) {
|
|
394
|
+
|
|
395
|
+
const data = this.memoryMap.get( uniformBuffer );
|
|
396
|
+
|
|
397
|
+
if ( data ) {
|
|
398
|
+
|
|
399
|
+
this.memoryMap.delete( uniformBuffer );
|
|
400
|
+
|
|
401
|
+
this.memory.uniformBuffers --;
|
|
402
|
+
this.memory.total -= data.size;
|
|
403
|
+
this.memory.uniformBuffersSize -= data.size;
|
|
404
|
+
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
368
409
|
/**
|
|
369
410
|
* Tracks program memory explicitly, updating counts and byte tracking.
|
|
370
411
|
*
|
|
@@ -19,6 +19,29 @@ const _weakMap = /*@__PURE__*/ new WeakMap();
|
|
|
19
19
|
*/
|
|
20
20
|
class Lighting {
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new lighting manager.
|
|
24
|
+
*/
|
|
25
|
+
constructor() {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Whether this lighting manager is enabled or not.
|
|
29
|
+
*
|
|
30
|
+
* @type {boolean}
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
this.enabled = true;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A stack of light arrays saved per render via {@link Lighting#beginRender}.
|
|
37
|
+
*
|
|
38
|
+
* @private
|
|
39
|
+
* @type {Array<Array<Light>>}
|
|
40
|
+
*/
|
|
41
|
+
this._cache = [];
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
22
45
|
/**
|
|
23
46
|
* Creates a new lights node for the given array of lights.
|
|
24
47
|
*
|
|
@@ -48,17 +71,15 @@ class Lighting {
|
|
|
48
71
|
// !WITH_GENESYS
|
|
49
72
|
|
|
50
73
|
/**
|
|
51
|
-
* Returns a lights node for the given scene
|
|
74
|
+
* Returns a lights node for the given scene.
|
|
52
75
|
*
|
|
53
76
|
* @param {Scene} scene - The scene.
|
|
54
|
-
* @param {Camera} camera - The camera.
|
|
55
77
|
* @return {LightsNode} The lights node.
|
|
56
78
|
*/
|
|
57
79
|
getNode( scene ) {
|
|
58
80
|
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
if ( scene.isQuadMesh ) return _defaultLights;
|
|
81
|
+
// Ignore renderable objects, e.g: Mesh, Sprite, etc.
|
|
82
|
+
if ( scene.isScene !== true && scene.isGroup !== true ) return _defaultLights;
|
|
62
83
|
|
|
63
84
|
let node = _weakMap.get( scene );
|
|
64
85
|
|
|
@@ -73,6 +94,33 @@ class Lighting {
|
|
|
73
94
|
|
|
74
95
|
}
|
|
75
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Saves the current lights of the scene's lights node so they can be restored
|
|
99
|
+
* in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call
|
|
100
|
+
* to avoid memory leaks.
|
|
101
|
+
*
|
|
102
|
+
* Nested render calls might mutate the lights array so a save/restore is required
|
|
103
|
+
* for each render call.
|
|
104
|
+
*
|
|
105
|
+
* @param {Scene} scene - The scene.
|
|
106
|
+
*/
|
|
107
|
+
beginRender( scene ) {
|
|
108
|
+
|
|
109
|
+
this._cache.push( this.getNode( scene ).getLights() );
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Restores the lights saved by the matching {@link Lighting#beginRender} call.
|
|
115
|
+
*
|
|
116
|
+
* @param {Scene} scene - The scene.
|
|
117
|
+
*/
|
|
118
|
+
finishRender( scene ) {
|
|
119
|
+
|
|
120
|
+
this.getNode( scene ).setLights( this._cache.pop() );
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
76
124
|
}
|
|
77
125
|
|
|
78
126
|
export default Lighting;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DoubleSide } from '../../constants.js';
|
|
2
2
|
|
|
3
|
+
const _emptyArray = /*@__PURE__*/ Object.freeze( [] );
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Default sorting function for opaque render items.
|
|
5
7
|
*
|
|
@@ -144,6 +146,13 @@ class RenderList {
|
|
|
144
146
|
*/
|
|
145
147
|
this.bundles = [];
|
|
146
148
|
|
|
149
|
+
/**
|
|
150
|
+
* The lighting management component.
|
|
151
|
+
*
|
|
152
|
+
* @type {Lighting}
|
|
153
|
+
*/
|
|
154
|
+
this.lighting = lighting;
|
|
155
|
+
|
|
147
156
|
/**
|
|
148
157
|
* The render list's lights node. This node is later
|
|
149
158
|
* relevant for the actual analytical light nodes which
|
|
@@ -151,7 +160,7 @@ class RenderList {
|
|
|
151
160
|
*
|
|
152
161
|
* @type {LightsNode}
|
|
153
162
|
*/
|
|
154
|
-
this.lightsNode = lighting.getNode( scene
|
|
163
|
+
this.lightsNode = lighting.getNode( scene );
|
|
155
164
|
|
|
156
165
|
/**
|
|
157
166
|
* The scene's lights stored in an array. This array
|
|
@@ -192,6 +201,18 @@ class RenderList {
|
|
|
192
201
|
*/
|
|
193
202
|
this.occlusionQueryCount = 0;
|
|
194
203
|
|
|
204
|
+
/**
|
|
205
|
+
* The last object that was counted for occlusion query testing. Used to
|
|
206
|
+
* avoid counting an object more than once when it produces multiple render
|
|
207
|
+
* items (e.g. a mesh with multiple material groups), since such an object
|
|
208
|
+
* is covered by a single occlusion query.
|
|
209
|
+
*
|
|
210
|
+
* @private
|
|
211
|
+
* @type {?Object3D}
|
|
212
|
+
* @default null
|
|
213
|
+
*/
|
|
214
|
+
this._lastOcclusionObject = null;
|
|
215
|
+
|
|
195
216
|
}
|
|
196
217
|
|
|
197
218
|
/**
|
|
@@ -293,7 +314,12 @@ class RenderList {
|
|
|
293
314
|
|
|
294
315
|
const renderItem = this.getNextRenderItem( object, geometry, material, groupOrder, z, group, clippingContext );
|
|
295
316
|
|
|
296
|
-
if ( object.occlusionTest === true
|
|
317
|
+
if ( object.occlusionTest === true && this._lastOcclusionObject !== object ) {
|
|
318
|
+
|
|
319
|
+
this.occlusionQueryCount ++;
|
|
320
|
+
this._lastOcclusionObject = object;
|
|
321
|
+
|
|
322
|
+
}
|
|
297
323
|
|
|
298
324
|
if ( material.transparent === true || material.transmission > 0 ||
|
|
299
325
|
( material.transmissionNode && material.transmissionNode.isNode ) ||
|
|
@@ -383,13 +409,22 @@ class RenderList {
|
|
|
383
409
|
*
|
|
384
410
|
* @param {?function(any, any): number} customOpaqueSort - A custom sort function for opaque objects.
|
|
385
411
|
* @param {?function(any, any): number} customTransparentSort - A custom sort function for transparent objects.
|
|
412
|
+
* @param {boolean} reversedDepth - Whether a reversed depth buffer is used or not.
|
|
386
413
|
*/
|
|
387
|
-
sort( customOpaqueSort, customTransparentSort ) {
|
|
414
|
+
sort( customOpaqueSort, customTransparentSort, reversedDepth ) {
|
|
388
415
|
|
|
389
416
|
if ( this.opaque.length > 1 ) this.opaque.sort( customOpaqueSort || painterSortStable );
|
|
390
417
|
if ( this.transparentDoublePass.length > 1 ) this.transparentDoublePass.sort( customTransparentSort || reversePainterSortStable );
|
|
391
418
|
if ( this.transparent.length > 1 ) this.transparent.sort( customTransparentSort || reversePainterSortStable );
|
|
392
419
|
|
|
420
|
+
if ( reversedDepth ) {
|
|
421
|
+
|
|
422
|
+
this.opaque.reverse();
|
|
423
|
+
this.transparentDoublePass.reverse();
|
|
424
|
+
this.transparent.reverse();
|
|
425
|
+
|
|
426
|
+
}
|
|
427
|
+
|
|
393
428
|
}
|
|
394
429
|
|
|
395
430
|
/**
|
|
@@ -400,7 +435,8 @@ class RenderList {
|
|
|
400
435
|
|
|
401
436
|
// update lights
|
|
402
437
|
|
|
403
|
-
this.lightsNode.setLights( this.lightsArray );
|
|
438
|
+
this.lightsNode.setLights( this.lighting.enabled ? this.lightsArray : _emptyArray );
|
|
439
|
+
|
|
404
440
|
// WITH_GENESYS
|
|
405
441
|
this.lightsNode.setLightProbeGrids( this.lightProbeGridsArray );
|
|
406
442
|
// !WITH_GENESYS
|
|
@@ -425,6 +461,8 @@ class RenderList {
|
|
|
425
461
|
|
|
426
462
|
}
|
|
427
463
|
|
|
464
|
+
this._lastOcclusionObject = null;
|
|
465
|
+
|
|
428
466
|
}
|
|
429
467
|
|
|
430
468
|
}
|