@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
|
@@ -9,14 +9,22 @@
|
|
|
9
9
|
* __gnsx_profiler.downloadTrace() // download gnsx-trace.json for Speedscope / Perfetto
|
|
10
10
|
* __gnsx_profiler.reset() // clear samples and trace
|
|
11
11
|
* __gnsx_profiler.disable()
|
|
12
|
+
*
|
|
13
|
+
* Chrome trace: `tid=1` is synchronous work; `@profile` on async methods records the
|
|
14
|
+
* promise lifetime on `tid=2` so long async does not flatten the main row. For manual
|
|
15
|
+
* spans, use `beginSpan` / `endSpan` with `{ asyncTimeline: true }` in a `.finally()`.
|
|
12
16
|
*/
|
|
13
17
|
|
|
14
18
|
const RING_SIZE = 120;
|
|
15
19
|
const FRAME_BUDGET_MS = 1000 / 60;
|
|
16
|
-
|
|
17
|
-
const
|
|
20
|
+
const TRACE_TID_MAIN = 1;
|
|
21
|
+
const TRACE_TID_ASYNC = 2;
|
|
18
22
|
const NOOP = () => {};
|
|
19
23
|
|
|
24
|
+
const DUMMY_SPAN = Object.freeze( { label: '', t0: 0, _seq: 0 } );
|
|
25
|
+
const NOOP_BEGIN_SPAN = () => DUMMY_SPAN;
|
|
26
|
+
const NOOP_END_SPAN = () => {};
|
|
27
|
+
|
|
20
28
|
class ProfilerServiceClass {
|
|
21
29
|
|
|
22
30
|
constructor() {
|
|
@@ -30,7 +38,7 @@ class ProfilerServiceClass {
|
|
|
30
38
|
this.cursors = new Map();
|
|
31
39
|
/** @type {Map<string, number>} */
|
|
32
40
|
this.counts = new Map();
|
|
33
|
-
/** @type {Map<string, Array<{ startTime: number, startMark: string
|
|
41
|
+
/** @type {Map<string, Array<{ startTime: number, startMark: string }>>} */
|
|
34
42
|
this.marks = new Map();
|
|
35
43
|
/** @type {ChromeTraceEvent[]} */
|
|
36
44
|
this.traceEvents = [];
|
|
@@ -56,6 +64,8 @@ class ProfilerServiceClass {
|
|
|
56
64
|
this.traceStartTime = performance.now();
|
|
57
65
|
this.begin = this._beginImpl.bind( this );
|
|
58
66
|
this.end = this._endImpl.bind( this );
|
|
67
|
+
this.beginSpan = this._beginSpanImpl.bind( this );
|
|
68
|
+
this.endSpan = this._endSpanImpl.bind( this );
|
|
59
69
|
this._exposeGlobal();
|
|
60
70
|
console.log( `[ProfilerService] auto-started from env (profile: ${this._profile})` );
|
|
61
71
|
|
|
@@ -63,6 +73,8 @@ class ProfilerServiceClass {
|
|
|
63
73
|
|
|
64
74
|
this.begin = NOOP;
|
|
65
75
|
this.end = NOOP;
|
|
76
|
+
this.beginSpan = NOOP_BEGIN_SPAN;
|
|
77
|
+
this.endSpan = NOOP_END_SPAN;
|
|
66
78
|
|
|
67
79
|
}
|
|
68
80
|
|
|
@@ -94,6 +106,8 @@ class ProfilerServiceClass {
|
|
|
94
106
|
this._enabled = true;
|
|
95
107
|
this.begin = this._beginImpl.bind( this );
|
|
96
108
|
this.end = this._endImpl.bind( this );
|
|
109
|
+
this.beginSpan = this._beginSpanImpl.bind( this );
|
|
110
|
+
this.endSpan = this._endSpanImpl.bind( this );
|
|
97
111
|
this._exposeGlobal();
|
|
98
112
|
console.log( `[ProfilerService] enabled (profile: ${this._profile}) — call __gnsx_profiler.report() or downloadTrace() from the console` );
|
|
99
113
|
|
|
@@ -105,6 +119,8 @@ class ProfilerServiceClass {
|
|
|
105
119
|
this._enabled = false;
|
|
106
120
|
this.begin = NOOP;
|
|
107
121
|
this.end = NOOP;
|
|
122
|
+
this.beginSpan = NOOP_BEGIN_SPAN;
|
|
123
|
+
this.endSpan = NOOP_END_SPAN;
|
|
108
124
|
console.log( '[ProfilerService] disabled' );
|
|
109
125
|
|
|
110
126
|
}
|
|
@@ -140,22 +156,8 @@ class ProfilerServiceClass {
|
|
|
140
156
|
|
|
141
157
|
}
|
|
142
158
|
|
|
143
|
-
const traced = this._profile === 'full' && this.traceEvents.length < MAX_TRACE_EVENTS;
|
|
144
|
-
if ( traced ) {
|
|
145
|
-
|
|
146
|
-
this.traceEvents.push( {
|
|
147
|
-
name: label,
|
|
148
|
-
ph: 'B',
|
|
149
|
-
ts: this._getTraceTimestamp( startTime ),
|
|
150
|
-
pid: 1,
|
|
151
|
-
tid: 1,
|
|
152
|
-
cat: 'gnsx',
|
|
153
|
-
} );
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
159
|
performance.mark( startMark );
|
|
158
|
-
stack.push( { startTime, startMark
|
|
160
|
+
stack.push( { startTime, startMark } );
|
|
159
161
|
|
|
160
162
|
// Push onto the global call stack for exclusive-time tracking.
|
|
161
163
|
this.callStack.push( { label, childTime: 0 } );
|
|
@@ -173,13 +175,61 @@ class ProfilerServiceClass {
|
|
|
173
175
|
if ( stack.length === 0 ) this.marks.delete( label );
|
|
174
176
|
|
|
175
177
|
const now = performance.now();
|
|
176
|
-
const { startTime, startMark
|
|
178
|
+
const { startTime, startMark } = mark;
|
|
177
179
|
const duration = now - startTime;
|
|
178
180
|
const endMark = `gnsx:${label}:end:${++ this._markId}`;
|
|
179
181
|
|
|
180
182
|
performance.mark( endMark );
|
|
181
183
|
performance.measure( `gnsx:${label}`, startMark, endMark );
|
|
182
184
|
|
|
185
|
+
this._commitDurationSample( label, startTime, duration, TRACE_TID_MAIN );
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Per-invocation span start (pair with {@link ProfilerServiceClass#endSpan}).
|
|
191
|
+
* Safe for concurrent async with the same label.
|
|
192
|
+
*
|
|
193
|
+
* @param {string} label
|
|
194
|
+
* @return {import('./ProfilerService.js').SpanHandle}
|
|
195
|
+
*/
|
|
196
|
+
_beginSpanImpl( label ) {
|
|
197
|
+
|
|
198
|
+
const seq = ++ this._markId;
|
|
199
|
+
const t0 = performance.now();
|
|
200
|
+
const startMark = `gnsx:${label}:s${seq}:start`;
|
|
201
|
+
performance.mark( startMark );
|
|
202
|
+
return { label, t0, _seq: seq, _startMark: startMark };
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @param {import('./ProfilerService.js').SpanHandle} handle
|
|
208
|
+
* @param {import('./ProfilerService.js').EndSpanOptions} [opts]
|
|
209
|
+
*/
|
|
210
|
+
_endSpanImpl( handle, opts ) {
|
|
211
|
+
|
|
212
|
+
if ( handle._seq === 0 ) return;
|
|
213
|
+
|
|
214
|
+
const now = performance.now();
|
|
215
|
+
const duration = now - handle.t0;
|
|
216
|
+
const endMark = `gnsx:${handle.label}:s${handle._seq}:end`;
|
|
217
|
+
performance.mark( endMark );
|
|
218
|
+
performance.measure( `gnsx:${handle.label}#${handle._seq}`, handle._startMark, endMark );
|
|
219
|
+
|
|
220
|
+
const traceTid = opts?.asyncTimeline === true ? TRACE_TID_ASYNC : TRACE_TID_MAIN;
|
|
221
|
+
this._commitDurationSample( handle.label, handle.t0, duration, traceTid );
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @param {string} label
|
|
227
|
+
* @param {number} startTime
|
|
228
|
+
* @param {number} durationMs
|
|
229
|
+
* @param {typeof TRACE_TID_MAIN|typeof TRACE_TID_ASYNC} traceTid
|
|
230
|
+
*/
|
|
231
|
+
_commitDurationSample( label, startTime, durationMs, traceTid ) {
|
|
232
|
+
|
|
183
233
|
let buffer = this.buffers.get( label );
|
|
184
234
|
if ( ! buffer ) {
|
|
185
235
|
|
|
@@ -191,7 +241,7 @@ class ProfilerServiceClass {
|
|
|
191
241
|
}
|
|
192
242
|
|
|
193
243
|
const cursor = this.cursors.get( label );
|
|
194
|
-
buffer[ cursor ] =
|
|
244
|
+
buffer[ cursor ] = durationMs;
|
|
195
245
|
this.cursors.set( label, ( cursor + 1 ) % RING_SIZE );
|
|
196
246
|
this.counts.set( label, Math.min( ( this.counts.get( label ) + 1 ), RING_SIZE ) );
|
|
197
247
|
|
|
@@ -203,7 +253,7 @@ class ProfilerServiceClass {
|
|
|
203
253
|
if ( top !== undefined && top.label === label ) {
|
|
204
254
|
|
|
205
255
|
this.callStack.pop();
|
|
206
|
-
const selfTime = Math.max( 0,
|
|
256
|
+
const selfTime = Math.max( 0, durationMs - top.childTime );
|
|
207
257
|
|
|
208
258
|
let selfBuffer = this.selfBuffers.get( label );
|
|
209
259
|
if ( ! selfBuffer ) {
|
|
@@ -222,7 +272,7 @@ class ProfilerServiceClass {
|
|
|
222
272
|
|
|
223
273
|
// Propagate inclusive duration to the parent scope's child accumulator.
|
|
224
274
|
const parent = this.callStack.length > 0 ? this.callStack[ this.callStack.length - 1 ] : undefined;
|
|
225
|
-
if ( parent !== undefined ) parent.childTime +=
|
|
275
|
+
if ( parent !== undefined ) parent.childTime += durationMs;
|
|
226
276
|
|
|
227
277
|
} else {
|
|
228
278
|
|
|
@@ -231,14 +281,16 @@ class ProfilerServiceClass {
|
|
|
231
281
|
|
|
232
282
|
}
|
|
233
283
|
|
|
234
|
-
if (
|
|
284
|
+
if ( traceTid ) {
|
|
235
285
|
|
|
286
|
+
const traceName = traceTid === TRACE_TID_ASYNC ? `${label} (promise)` : label;
|
|
236
287
|
this.traceEvents.push( {
|
|
237
|
-
name:
|
|
238
|
-
ph: '
|
|
239
|
-
ts: this._getTraceTimestamp(
|
|
288
|
+
name: traceName,
|
|
289
|
+
ph: 'X',
|
|
290
|
+
ts: Math.round( this._getTraceTimestamp( startTime ) ),
|
|
291
|
+
dur: Math.max( 1, Math.round( durationMs * 1000 ) ),
|
|
240
292
|
pid: 1,
|
|
241
|
-
tid:
|
|
293
|
+
tid: traceTid,
|
|
242
294
|
cat: 'gnsx',
|
|
243
295
|
} );
|
|
244
296
|
|
|
@@ -349,13 +401,53 @@ class ProfilerServiceClass {
|
|
|
349
401
|
*/
|
|
350
402
|
exportChromeTrace() {
|
|
351
403
|
|
|
404
|
+
const slices = [ ...this.traceEvents ];
|
|
405
|
+
slices.sort( ( a, b ) => {
|
|
406
|
+
|
|
407
|
+
if ( a.ts !== b.ts ) return a.ts - b.ts;
|
|
408
|
+
if ( a.tid !== b.tid ) return a.tid - b.tid;
|
|
409
|
+
return a.name.localeCompare( b.name );
|
|
410
|
+
|
|
411
|
+
} );
|
|
412
|
+
const hasAsync = slices.some( e => e.tid === TRACE_TID_ASYNC );
|
|
413
|
+
/** @type {import('./ProfilerService.js').ChromeTraceMetadataEvent[]} */
|
|
414
|
+
const prefix = [
|
|
415
|
+
{
|
|
416
|
+
cat: '__metadata',
|
|
417
|
+
name: 'process_name',
|
|
418
|
+
ph: 'M',
|
|
419
|
+
pid: 1,
|
|
420
|
+
tid: 0,
|
|
421
|
+
ts: 0,
|
|
422
|
+
args: { name: 'Genesys Profiler' },
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
cat: '__metadata',
|
|
426
|
+
name: 'thread_name',
|
|
427
|
+
ph: 'M',
|
|
428
|
+
pid: 1,
|
|
429
|
+
tid: TRACE_TID_MAIN,
|
|
430
|
+
ts: 0,
|
|
431
|
+
args: { name: 'Main thread' },
|
|
432
|
+
},
|
|
433
|
+
];
|
|
434
|
+
if ( hasAsync ) {
|
|
435
|
+
|
|
436
|
+
prefix.push( {
|
|
437
|
+
cat: '__metadata',
|
|
438
|
+
name: 'thread_name',
|
|
439
|
+
ph: 'M',
|
|
440
|
+
pid: 1,
|
|
441
|
+
tid: TRACE_TID_ASYNC,
|
|
442
|
+
ts: 0,
|
|
443
|
+
args: { name: 'Async (promise lifetime)' },
|
|
444
|
+
} );
|
|
445
|
+
|
|
446
|
+
}
|
|
447
|
+
|
|
352
448
|
return {
|
|
353
449
|
displayTimeUnit: 'ms',
|
|
354
|
-
traceEvents: [
|
|
355
|
-
{ name: 'process_name', ph: 'M', pid: 1, args: { name: 'Genesys Profiler' } },
|
|
356
|
-
{ name: 'thread_name', ph: 'M', pid: 1, tid: 1, args: { name: 'Main Thread' } },
|
|
357
|
-
...this.traceEvents,
|
|
358
|
-
],
|
|
450
|
+
traceEvents: [ ...prefix, ...slices ],
|
|
359
451
|
};
|
|
360
452
|
|
|
361
453
|
}
|
|
@@ -460,22 +552,38 @@ class ProfilerServiceClass {
|
|
|
460
552
|
* @property {number|undefined} selfFrameBudget Exclusive time as percentage of a 60 fps frame budget.
|
|
461
553
|
*/
|
|
462
554
|
|
|
555
|
+
/**
|
|
556
|
+
* @typedef {Object} SpanHandle
|
|
557
|
+
* @property {string} label
|
|
558
|
+
* @property {number} t0
|
|
559
|
+
* @property {number} _seq
|
|
560
|
+
* @property {string} _startMark
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @typedef {Object} EndSpanOptions
|
|
565
|
+
* @property {boolean} [asyncTimeline] When true, trace slice uses `tid=2` (virtual async row).
|
|
566
|
+
*/
|
|
567
|
+
|
|
463
568
|
/**
|
|
464
569
|
* @typedef {Object} ChromeTraceEvent
|
|
465
570
|
* @property {string} name
|
|
466
|
-
* @property {'
|
|
571
|
+
* @property {'X'} ph
|
|
467
572
|
* @property {number} ts
|
|
573
|
+
* @property {number} dur
|
|
468
574
|
* @property {1} pid
|
|
469
|
-
* @property {
|
|
575
|
+
* @property {number} tid
|
|
470
576
|
* @property {'gnsx'} cat
|
|
471
577
|
*/
|
|
472
578
|
|
|
473
579
|
/**
|
|
474
580
|
* @typedef {Object} ChromeTraceMetadataEvent
|
|
581
|
+
* @property {'__metadata'} cat
|
|
475
582
|
* @property {'process_name'|'thread_name'} name
|
|
476
583
|
* @property {'M'} ph
|
|
477
584
|
* @property {1} pid
|
|
478
|
-
* @property {
|
|
585
|
+
* @property {number} [tid]
|
|
586
|
+
* @property {0} ts
|
|
479
587
|
* @property {{ name: string }} args
|
|
480
588
|
*/
|
|
481
589
|
|
|
@@ -491,28 +599,38 @@ class ProfilerServiceClass {
|
|
|
491
599
|
|
|
492
600
|
const ProfilerService = new ProfilerServiceClass();
|
|
493
601
|
|
|
602
|
+
function isThenable( x ) {
|
|
603
|
+
|
|
604
|
+
return (
|
|
605
|
+
( typeof x === 'object' || typeof x === 'function' ) &&
|
|
606
|
+
x !== null &&
|
|
607
|
+
typeof x.then === 'function'
|
|
608
|
+
);
|
|
609
|
+
|
|
610
|
+
}
|
|
611
|
+
|
|
494
612
|
function applyProfileToMethod( label, descriptor ) {
|
|
495
613
|
|
|
496
614
|
const original = descriptor.value;
|
|
497
615
|
|
|
498
616
|
function profiled( ...args ) {
|
|
499
617
|
|
|
500
|
-
ProfilerService.
|
|
618
|
+
const span = ProfilerService.beginSpan( label );
|
|
501
619
|
try {
|
|
502
620
|
|
|
503
621
|
const result = original.apply( this, args );
|
|
504
|
-
if ( result
|
|
622
|
+
if ( isThenable( result ) ) {
|
|
505
623
|
|
|
506
|
-
return result.finally( () => ProfilerService.
|
|
624
|
+
return Promise.resolve( result ).finally( () => ProfilerService.endSpan( span, { asyncTimeline: true } ) );
|
|
507
625
|
|
|
508
626
|
}
|
|
509
627
|
|
|
510
|
-
ProfilerService.
|
|
628
|
+
ProfilerService.endSpan( span );
|
|
511
629
|
return result;
|
|
512
630
|
|
|
513
631
|
} catch ( error ) {
|
|
514
632
|
|
|
515
|
-
ProfilerService.
|
|
633
|
+
ProfilerService.endSpan( span );
|
|
516
634
|
throw error;
|
|
517
635
|
|
|
518
636
|
}
|
|
@@ -526,14 +644,39 @@ function applyProfileToMethod( label, descriptor ) {
|
|
|
526
644
|
|
|
527
645
|
/**
|
|
528
646
|
* Method decorator that profiles the decorated method.
|
|
529
|
-
*
|
|
647
|
+
* Default label: `ClassName.methodName`. Pass a custom tag via `@profile('My tag')`.
|
|
530
648
|
*
|
|
649
|
+
* @param {Object|string} [targetOrTag]
|
|
650
|
+
* @param {string|symbol} [propertyKey]
|
|
651
|
+
* @param {PropertyDescriptor} [descriptor]
|
|
652
|
+
* @return {PropertyDescriptor|function(Object, string|symbol, PropertyDescriptor): PropertyDescriptor}
|
|
653
|
+
*/
|
|
654
|
+
function profile( targetOrTag, propertyKey, descriptor ) {
|
|
655
|
+
|
|
656
|
+
if ( arguments.length === 0 ) {
|
|
657
|
+
|
|
658
|
+
return defaultProfileDecorator;
|
|
659
|
+
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if ( arguments.length === 1 && typeof targetOrTag === 'string' ) {
|
|
663
|
+
|
|
664
|
+
const customTag = targetOrTag;
|
|
665
|
+
return ( target, key, desc ) => applyProfileToMethod( customTag, desc );
|
|
666
|
+
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return defaultProfileDecorator( targetOrTag, propertyKey, descriptor );
|
|
670
|
+
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
531
674
|
* @param {Object} target
|
|
532
675
|
* @param {string|symbol} propertyKey
|
|
533
676
|
* @param {PropertyDescriptor} descriptor
|
|
534
677
|
* @return {PropertyDescriptor}
|
|
535
678
|
*/
|
|
536
|
-
function
|
|
679
|
+
function defaultProfileDecorator( target, propertyKey, descriptor ) {
|
|
537
680
|
|
|
538
681
|
const className = target.constructor?.name ?? 'Unknown';
|
|
539
682
|
return applyProfileToMethod( `${className}.${String( propertyKey )}`, descriptor );
|
|
@@ -298,6 +298,10 @@ class WebGLRenderer {
|
|
|
298
298
|
let _isContextLost = false;
|
|
299
299
|
let _nodesHandler = null;
|
|
300
300
|
|
|
301
|
+
let _scratchFramebuffer = null;
|
|
302
|
+
let _srcFramebuffer = null;
|
|
303
|
+
let _dstFramebuffer = null;
|
|
304
|
+
|
|
301
305
|
// internal state cache
|
|
302
306
|
|
|
303
307
|
this._outputColorSpace = SRGBColorSpace;
|
|
@@ -397,11 +401,11 @@ class WebGLRenderer {
|
|
|
397
401
|
|
|
398
402
|
if ( getContext( contextName ) ) {
|
|
399
403
|
|
|
400
|
-
throw new Error( 'Error creating WebGL context with your selected attributes.' );
|
|
404
|
+
throw new Error( 'THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.' );
|
|
401
405
|
|
|
402
406
|
} else {
|
|
403
407
|
|
|
404
|
-
throw new Error( 'Error creating WebGL context.' );
|
|
408
|
+
throw new Error( 'THREE.WebGLRenderer: Error creating WebGL context.' );
|
|
405
409
|
|
|
406
410
|
}
|
|
407
411
|
|
|
@@ -441,6 +445,10 @@ class WebGLRenderer {
|
|
|
441
445
|
|
|
442
446
|
}
|
|
443
447
|
|
|
448
|
+
_scratchFramebuffer = _gl.createFramebuffer();
|
|
449
|
+
_srcFramebuffer = _gl.createFramebuffer();
|
|
450
|
+
_dstFramebuffer = _gl.createFramebuffer();
|
|
451
|
+
|
|
444
452
|
info = new WebGLInfo( _gl );
|
|
445
453
|
properties = new WebGLProperties();
|
|
446
454
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
@@ -547,7 +555,7 @@ class WebGLRenderer {
|
|
|
547
555
|
|
|
548
556
|
if ( _outputBufferType !== UnsignedByteType ) {
|
|
549
557
|
|
|
550
|
-
output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, depth, stencil );
|
|
558
|
+
output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, antialias, depth, stencil );
|
|
551
559
|
|
|
552
560
|
}
|
|
553
561
|
|
|
@@ -731,7 +739,7 @@ class WebGLRenderer {
|
|
|
731
739
|
|
|
732
740
|
if ( _outputBufferType === UnsignedByteType ) {
|
|
733
741
|
|
|
734
|
-
error( '
|
|
742
|
+
error( 'WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );
|
|
735
743
|
return;
|
|
736
744
|
|
|
737
745
|
}
|
|
@@ -742,7 +750,7 @@ class WebGLRenderer {
|
|
|
742
750
|
|
|
743
751
|
if ( effects[ i ].isOutputPass === true ) {
|
|
744
752
|
|
|
745
|
-
warn( '
|
|
753
|
+
warn( 'WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );
|
|
746
754
|
break;
|
|
747
755
|
|
|
748
756
|
}
|
|
@@ -1180,7 +1188,7 @@ class WebGLRenderer {
|
|
|
1180
1188
|
|
|
1181
1189
|
if ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
|
|
1182
1190
|
|
|
1183
|
-
const frontFaceCW = ( object.isMesh && object.matrixWorld.
|
|
1191
|
+
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
|
|
1184
1192
|
|
|
1185
1193
|
const program = setProgram( camera, scene, geometry, material, object );
|
|
1186
1194
|
|
|
@@ -1714,7 +1722,9 @@ class WebGLRenderer {
|
|
|
1714
1722
|
// WITH_GENESYS
|
|
1715
1723
|
ProfilerService.begin( 'sortRenderList' );
|
|
1716
1724
|
// !WITH_GENESYS
|
|
1717
|
-
|
|
1725
|
+
|
|
1726
|
+
currentRenderList.sort( _opaqueSort, _transparentSort, camera.reversedDepth );
|
|
1727
|
+
|
|
1718
1728
|
// WITH_GENESYS
|
|
1719
1729
|
ProfilerService.end( 'sortRenderList' );
|
|
1720
1730
|
// !WITH_GENESYS
|
|
@@ -1736,6 +1746,8 @@ class WebGLRenderer {
|
|
|
1736
1746
|
|
|
1737
1747
|
this.info.render.frame ++;
|
|
1738
1748
|
|
|
1749
|
+
if ( this.info.autoReset === true ) this.info.reset();
|
|
1750
|
+
|
|
1739
1751
|
if ( _clippingEnabled === true ) clipping.beginShadows();
|
|
1740
1752
|
|
|
1741
1753
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
@@ -1752,8 +1764,6 @@ class WebGLRenderer {
|
|
|
1752
1764
|
|
|
1753
1765
|
//
|
|
1754
1766
|
|
|
1755
|
-
if ( this.info.autoReset === true ) this.info.reset();
|
|
1756
|
-
|
|
1757
1767
|
// render scene (skip if first effect is a render pass - it will render the scene itself)
|
|
1758
1768
|
|
|
1759
1769
|
const skipSceneRender = useOutput && output.hasRenderPass();
|
|
@@ -2959,8 +2969,6 @@ class WebGLRenderer {
|
|
|
2959
2969
|
|
|
2960
2970
|
};
|
|
2961
2971
|
|
|
2962
|
-
const _scratchFrameBuffer = _gl.createFramebuffer();
|
|
2963
|
-
|
|
2964
2972
|
/**
|
|
2965
2973
|
* Sets the active rendertarget.
|
|
2966
2974
|
*
|
|
@@ -3024,7 +3032,7 @@ class WebGLRenderer {
|
|
|
3024
3032
|
( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )
|
|
3025
3033
|
) {
|
|
3026
3034
|
|
|
3027
|
-
throw new Error( '
|
|
3035
|
+
throw new Error( 'THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.' );
|
|
3028
3036
|
|
|
3029
3037
|
}
|
|
3030
3038
|
|
|
@@ -3093,7 +3101,7 @@ class WebGLRenderer {
|
|
|
3093
3101
|
// being bound that are different sizes.
|
|
3094
3102
|
if ( activeMipmapLevel !== 0 ) {
|
|
3095
3103
|
|
|
3096
|
-
framebuffer =
|
|
3104
|
+
framebuffer = _scratchFramebuffer;
|
|
3097
3105
|
|
|
3098
3106
|
}
|
|
3099
3107
|
|
|
@@ -3336,8 +3344,6 @@ class WebGLRenderer {
|
|
|
3336
3344
|
|
|
3337
3345
|
};
|
|
3338
3346
|
|
|
3339
|
-
const _srcFramebuffer = _gl.createFramebuffer();
|
|
3340
|
-
const _dstFramebuffer = _gl.createFramebuffer();
|
|
3341
3347
|
|
|
3342
3348
|
/**
|
|
3343
3349
|
* Copies data of the given source texture into a destination texture.
|
|
@@ -16,7 +16,6 @@ import { REVISION, TimestampQuery } from '../../constants.js';
|
|
|
16
16
|
* implement the interface.
|
|
17
17
|
*
|
|
18
18
|
* @abstract
|
|
19
|
-
* @private
|
|
20
19
|
*/
|
|
21
20
|
class Backend {
|
|
22
21
|
|
|
@@ -124,6 +123,15 @@ class Backend {
|
|
|
124
123
|
*/
|
|
125
124
|
finishRender( /*renderContext*/ ) {}
|
|
126
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Sets the XR rendering destination.
|
|
128
|
+
*
|
|
129
|
+
* Backends that render directly into XR framebuffers can override this hook.
|
|
130
|
+
*
|
|
131
|
+
* @param {?Object} xrTarget - The XR rendering destination.
|
|
132
|
+
*/
|
|
133
|
+
setXRTarget( /*xrTarget*/ ) {}
|
|
134
|
+
|
|
127
135
|
/**
|
|
128
136
|
* This method is executed at the beginning of a compute call and
|
|
129
137
|
* can be used by the backend to prepare the state for upcoming
|
|
@@ -276,10 +284,18 @@ class Backend {
|
|
|
276
284
|
* Updates a GPU sampler for the given texture.
|
|
277
285
|
*
|
|
278
286
|
* @abstract
|
|
279
|
-
* @param {
|
|
287
|
+
* @param {Sampler} binding - The sampler binding to update.
|
|
280
288
|
* @return {string} The current sampler key.
|
|
281
289
|
*/
|
|
282
|
-
updateSampler( /*
|
|
290
|
+
updateSampler( /*binding*/ ) { }
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Frees the GPU sampler for the given sampler binding.
|
|
294
|
+
*
|
|
295
|
+
* @abstract
|
|
296
|
+
* @param {Sampler} binding - The sampler binding to free.
|
|
297
|
+
*/
|
|
298
|
+
destroySampler( /*binding*/ ) { }
|
|
283
299
|
|
|
284
300
|
/**
|
|
285
301
|
* Creates a default texture for the given texture that can be used
|
|
@@ -389,6 +405,22 @@ class Backend {
|
|
|
389
405
|
*/
|
|
390
406
|
createStorageAttribute( /*attribute*/ ) { }
|
|
391
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Creates a uniform buffer.
|
|
410
|
+
*
|
|
411
|
+
* @abstract
|
|
412
|
+
* @param {Buffer} uniformBuffer - The uniform buffer.
|
|
413
|
+
*/
|
|
414
|
+
createUniformBuffer( /*uniformBuffer*/ ) { }
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Destroys a uniform buffer.
|
|
418
|
+
*
|
|
419
|
+
* @abstract
|
|
420
|
+
* @param {Buffer} uniformBuffer - The uniform buffer.
|
|
421
|
+
*/
|
|
422
|
+
destroyUniformBuffer( /*uniformBuffer*/ ) { }
|
|
423
|
+
|
|
392
424
|
/**
|
|
393
425
|
* Updates the GPU buffer of a shader attribute.
|
|
394
426
|
*
|
|
@@ -516,17 +548,29 @@ class Backend {
|
|
|
516
548
|
|
|
517
549
|
}
|
|
518
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Whether the backend supports query timestamps or not.
|
|
553
|
+
*
|
|
554
|
+
* @type {boolean}
|
|
555
|
+
* @readonly
|
|
556
|
+
*/
|
|
557
|
+
get hasTimestamp() {
|
|
558
|
+
|
|
559
|
+
return false;
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
|
|
519
563
|
/**
|
|
520
564
|
* Returns `true` if a timestamp for the given uid is available.
|
|
521
565
|
*
|
|
522
566
|
* @param {string} uid - The unique identifier.
|
|
523
567
|
* @return {boolean} Whether the timestamp is available or not.
|
|
524
568
|
*/
|
|
525
|
-
|
|
569
|
+
hasTimestampQuery( uid ) {
|
|
526
570
|
|
|
527
571
|
const queryPool = this._getQueryPool( uid );
|
|
528
572
|
|
|
529
|
-
return queryPool.
|
|
573
|
+
return queryPool.hasTimestampQuery( uid );
|
|
530
574
|
|
|
531
575
|
}
|
|
532
576
|
|