@onerjs/core 9.0.2 → 9.0.3
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/Buffers/buffer.pure.js +4 -0
- package/Buffers/buffer.pure.js.map +1 -1
- package/Cameras/camera.pure.d.ts +14 -0
- package/Cameras/camera.pure.js +15 -0
- package/Cameras/camera.pure.js.map +1 -1
- package/Compute/computeShader.pure.d.ts +2 -1
- package/Compute/computeShader.pure.js +29 -10
- package/Compute/computeShader.pure.js.map +1 -1
- package/Culling/ray.core.js +22 -9
- package/Culling/ray.core.js.map +1 -1
- package/Engines/IDrawContext.d.ts +2 -0
- package/Engines/IDrawContext.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +55 -4
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +1 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +5 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.d.ts +2 -0
- package/Engines/Processors/shaderCodeInliner.js +251 -6
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +10 -1
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.pure.js +12 -0
- package/Engines/WebGPU/Extensions/engine.debugging.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js +0 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.pure.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.pure.js +5 -0
- package/Engines/WebGPU/Extensions/engine.query.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +7 -0
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.d.ts +1 -1
- package/Engines/WebGPU/webgpuCacheTextureView.js +20 -8
- package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +2 -0
- package/Engines/WebGPU/webgpuDrawContext.js +6 -0
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.d.ts +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js +23 -9
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuRenderPassCommandStream.d.ts +156 -0
- package/Engines/WebGPU/webgpuRenderPassCommandStream.js +323 -0
- package/Engines/WebGPU/webgpuRenderPassCommandStream.js.map +1 -0
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +4 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.d.ts +3 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +9 -6
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +2 -0
- package/Engines/abstractEngine.pure.js +14 -5
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/constants.d.ts +6 -0
- package/Engines/constants.js +6 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +198 -24
- package/Engines/pure.d.ts +1 -0
- package/Engines/pure.js +1 -0
- package/Engines/pure.js.map +1 -1
- package/Engines/renderCommandBatcher.pure.d.ts +16 -0
- package/Engines/renderCommandBatcher.pure.js +24 -0
- package/Engines/renderCommandBatcher.pure.js.map +1 -0
- package/Engines/thinEngine.functions.js +3 -2
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.pure.js +18 -2
- package/Engines/thinEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +10 -7
- package/Engines/thinNativeEngine.pure.js +117 -46
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +8 -0
- package/Engines/thinWebGPUEngine.js +11 -0
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +60 -1
- package/Engines/webgpuEngine.pure.js +238 -42
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphGetSoundVolumeBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Data/Audio/flowGraphIsSoundPlayingBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.d.ts +5 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js +8 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.d.ts +77 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js +141 -0
- package/FlowGraph/Blocks/Event/flowGraphMeshIntersectionEventBlock.pure.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.d.ts +5 -3
- package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js +38 -7
- package/FlowGraph/Blocks/Event/flowGraphSoundEndedEventBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Event/index.d.ts +1 -0
- package/FlowGraph/Blocks/Event/index.js +1 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
- package/FlowGraph/Blocks/Event/pure.js +1 -0
- package/FlowGraph/Blocks/Event/pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPauseSoundBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlaySoundBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphSetSoundVolumeBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.d.ts +3 -3
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js +2 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopSoundBlock.pure.js.map +1 -1
- package/FlowGraph/Blocks/allBlocks.pure.js +2 -0
- package/FlowGraph/Blocks/allBlocks.pure.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +2 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +12 -1
- package/FlowGraph/flowGraph.js +38 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +44 -0
- package/FlowGraph/flowGraphCoordinator.js +141 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.js +41 -14
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/flowGraphParser.js +105 -5
- package/FlowGraph/flowGraphParser.js.map +1 -1
- package/FlowGraph/flowGraphSoundAssets.d.ts +40 -0
- package/FlowGraph/flowGraphSoundAssets.js +33 -0
- package/FlowGraph/flowGraphSoundAssets.js.map +1 -0
- package/FlowGraph/index.d.ts +1 -0
- package/FlowGraph/index.js +1 -0
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/pure.d.ts +1 -0
- package/FlowGraph/pure.js +1 -0
- package/FlowGraph/pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +8 -0
- package/FlowGraph/serialization.js +31 -12
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +25 -0
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.js +2 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
- package/Instrumentation/engineInstrumentation.d.ts +1 -0
- package/Instrumentation/engineInstrumentation.js +25 -6
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +2 -0
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.pure.d.ts +36 -1
- package/Lights/Shadows/cascadedShadowGenerator.pure.js +202 -27
- package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
- package/Lights/directionalLight.pure.d.ts +24 -10
- package/Lights/directionalLight.pure.js +29 -11
- package/Lights/directionalLight.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +4 -4
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.pure.js +4 -0
- package/Materials/Node/Blocks/Input/inputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.d.ts +9 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +23 -3
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.js +1 -1
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +9 -0
- package/Materials/PBR/pbrBaseMaterial.pure.js +60 -1
- package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +11 -0
- package/Materials/PBR/pbrBaseSimpleMaterial.js +21 -2
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.pure.d.ts +12 -0
- package/Materials/PBR/pbrMaterial.pure.js +23 -3
- package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +1 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +10 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +5 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +7 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -1
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +9 -3
- package/Materials/Textures/HTML/htmlInteractionManager.js +64 -5
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -1
- package/Materials/Textures/HTML/htmlTexture.d.ts +11 -11
- package/Materials/Textures/HTML/htmlTexture.js +106 -65
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -1
- package/Materials/Textures/Loaders/internalTextureLoader.d.ts +2 -1
- package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +2 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +4 -50
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js +10 -0
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
- package/Materials/Textures/dynamicTexture.pure.js +6 -0
- package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
- package/Materials/Textures/ktx2encoderTypes.d.ts +51 -0
- package/Materials/Textures/ktx2encoderTypes.js +2 -0
- package/Materials/Textures/ktx2encoderTypes.js.map +1 -0
- package/Materials/Textures/renderTargetTexture.pure.js +10 -2
- package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
- package/Materials/Textures/textureMerger.d.ts +11 -0
- package/Materials/Textures/textureMerger.js +34 -19
- package/Materials/Textures/textureMerger.js.map +1 -1
- package/Materials/Textures/textureProcessor.d.ts +145 -0
- package/Materials/Textures/textureProcessor.js +445 -45
- package/Materials/Textures/textureProcessor.js.map +1 -1
- package/Materials/Textures/textureSampling.functions.d.ts +41 -0
- package/Materials/Textures/textureSampling.functions.js +82 -0
- package/Materials/Textures/textureSampling.functions.js.map +1 -0
- package/Materials/drawWrapper.d.ts +8 -0
- package/Materials/drawWrapper.js +19 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.pure.d.ts +6 -0
- package/Materials/effect.pure.js +28 -6
- package/Materials/effect.pure.js.map +1 -1
- package/Materials/effect.webgl.functions.pure.js +1 -1
- package/Materials/effect.webgl.functions.pure.js.map +1 -1
- package/Materials/material.pure.d.ts +5 -0
- package/Materials/material.pure.js +9 -2
- package/Materials/material.pure.js.map +1 -1
- package/Materials/materialFlags.d.ts +6 -0
- package/Materials/materialFlags.js +14 -0
- package/Materials/materialFlags.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -1
- package/Materials/materialHelper.functions.js +36 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.js +19 -16
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Materials/materialPluginManager.pure.js +12 -8
- package/Materials/materialPluginManager.pure.js.map +1 -1
- package/Materials/prePassConfiguration.js +19 -16
- package/Materials/prePassConfiguration.js.map +1 -1
- package/Materials/shaderMaterial.pure.js +19 -6
- package/Materials/shaderMaterial.pure.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +6 -0
- package/Materials/shadowDepthWrapper.js +17 -0
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Meshes/Compression/dracoCodec.d.ts +14 -0
- package/Meshes/Compression/dracoCodec.js +22 -0
- package/Meshes/Compression/dracoCodec.js.map +1 -1
- package/Meshes/Compression/dracoDecoder.d.ts +1 -0
- package/Meshes/Compression/dracoDecoder.js +27 -0
- package/Meshes/Compression/dracoDecoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.d.ts +1 -0
- package/Meshes/Compression/dracoEncoder.js +8 -0
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.d.ts +1 -0
- package/Meshes/Compression/meshoptCompression.js +9 -0
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.d.ts +415 -0
- package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js +912 -0
- package/Meshes/GaussianSplatting/gaussianSplattingGpuSorter.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +3 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +40 -9
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +112 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +696 -74
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +12 -4
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/geometry.d.ts +5 -0
- package/Meshes/geometry.js +25 -0
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/mesh.pure.d.ts +7 -0
- package/Meshes/mesh.pure.js +18 -13
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/pure.d.ts +1 -0
- package/Meshes/pure.js +1 -0
- package/Meshes/pure.js.map +1 -1
- package/Meshes/subMesh.pure.d.ts +3 -0
- package/Meshes/subMesh.pure.js +26 -0
- package/Meshes/subMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +5 -3
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/khronosTextureContainer2.d.ts +3 -2
- package/Misc/khronosTextureContainer2.js +24 -6
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/khronosTextureContainer2Encoder.d.ts +166 -0
- package/Misc/khronosTextureContainer2Encoder.js +556 -0
- package/Misc/khronosTextureContainer2Encoder.js.map +1 -0
- package/Misc/khronosTextureContainer2EncoderWorker.d.ts +61 -0
- package/Misc/khronosTextureContainer2EncoderWorker.js +55 -0
- package/Misc/khronosTextureContainer2EncoderWorker.js.map +1 -0
- package/Misc/pure.d.ts +1 -0
- package/Misc/pure.js +1 -0
- package/Misc/pure.js.map +1 -1
- package/Misc/textureFormat.functions.d.ts +6 -0
- package/Misc/textureFormat.functions.js +54 -0
- package/Misc/textureFormat.functions.js.map +1 -0
- package/Misc/textureTools.d.ts +6 -2
- package/Misc/textureTools.js +100 -42
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.pure.d.ts +1 -1
- package/Particles/Node/Blocks/systemBlock.pure.js +6 -3
- package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
- package/Particles/computeShaderParticleSystem.pure.js +5 -0
- package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +2 -0
- package/Particles/gpuParticleSystem.pure.js +25 -1
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Particles/solidParticle.d.ts +5 -0
- package/Particles/solidParticle.js +5 -0
- package/Particles/solidParticle.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +10 -0
- package/Particles/solidParticleSystem.js +72 -13
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.pure.js +4 -0
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.d.ts +27 -6
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js +60 -5
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.pure.js.map +1 -1
- package/PostProcesses/thinTAAPostProcess.d.ts +1 -0
- package/PostProcesses/thinTAAPostProcess.js +17 -1
- package/PostProcesses/thinTAAPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.d.ts +2 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +6 -5
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
- package/Rendering/boundingBoxRenderer.pure.js +2 -3
- package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.js +8 -2
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +1 -0
- package/Rendering/objectRenderer.js +14 -0
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/bumpVertex.js +1 -1
- package/Shaders/ShadersInclude/bumpVertex.js.map +1 -1
- package/Shaders/ShadersInclude/bumpVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +5 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +2 -2
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
- package/Shaders/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrVertexDeclaration.js +6 -0
- package/Shaders/ShadersInclude/openpbrVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockNormalFinal.js +9 -0
- package/Shaders/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflectance.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +7 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrIBLFunctions.js +12 -0
- package/Shaders/ShadersInclude/pbrIBLFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
- package/Shaders/geometry.vertex.js +6 -6
- package/Shaders/geometry.vertex.js.map +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
- package/Shaders/lod.fragment.js +15 -2
- package/Shaders/lod.fragment.js.map +1 -1
- package/Shaders/lod3D.fragment.js +15 -2
- package/Shaders/lod3D.fragment.js.map +1 -1
- package/Shaders/lodCube.fragment.js +15 -2
- package/Shaders/lodCube.fragment.js.map +1 -1
- package/Shaders/openpbr.vertex.js +2 -0
- package/Shaders/openpbr.vertex.js.map +1 -1
- package/Shaders/pbr.fragment.js +12 -1
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +2 -0
- package/Shaders/pbr.vertex.js.map +1 -1
- package/Shaders/textureMerger.fragment.js +28 -0
- package/Shaders/textureMerger.fragment.js.map +1 -1
- package/Shaders/textureProcessor.fragment.js +26 -4
- package/Shaders/textureProcessor.fragment.js.map +1 -1
- package/Shaders/volumetricLightScattering.fragment.js +1 -1
- package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertex.js +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bumpVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +44 -2
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +17 -3
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +12 -1
- package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBackgroundTransmission.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +11 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +9 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +1 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +8 -0
- package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertex.js +2 -2
- package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js +3 -1
- package/ShadersWGSL/ShadersInclude/sceneUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js +16 -0
- package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +4 -4
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/default.vertex.js +1 -1
- package/ShadersWGSL/default.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/ShadersWGSL/gsSortCount.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortCount.compute.js +19 -0
- package/ShadersWGSL/gsSortCount.compute.js.map +1 -0
- package/ShadersWGSL/gsSortKeys.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortKeys.compute.js +49 -0
- package/ShadersWGSL/gsSortKeys.compute.js.map +1 -0
- package/ShadersWGSL/gsSortOutput.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortOutput.compute.js +28 -0
- package/ShadersWGSL/gsSortOutput.compute.js.map +1 -0
- package/ShadersWGSL/gsSortScanLocal.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortScanLocal.compute.js +23 -0
- package/ShadersWGSL/gsSortScanLocal.compute.js.map +1 -0
- package/ShadersWGSL/gsSortScanSums.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortScanSums.compute.js +19 -0
- package/ShadersWGSL/gsSortScanSums.compute.js.map +1 -0
- package/ShadersWGSL/gsSortScatter.compute.d.ts +5 -0
- package/ShadersWGSL/gsSortScatter.compute.js +33 -0
- package/ShadersWGSL/gsSortScatter.compute.js.map +1 -0
- package/ShadersWGSL/lod.fragment.js +14 -2
- package/ShadersWGSL/lod.fragment.js.map +1 -1
- package/ShadersWGSL/lod3D.fragment.js +14 -2
- package/ShadersWGSL/lod3D.fragment.js.map +1 -1
- package/ShadersWGSL/lodCube.fragment.js +14 -2
- package/ShadersWGSL/lodCube.fragment.js.map +1 -1
- package/ShadersWGSL/openpbr.vertex.js +3 -1
- package/ShadersWGSL/openpbr.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +11 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.js +3 -1
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/textureMerger.fragment.js +40 -4
- package/ShadersWGSL/textureMerger.fragment.js.map +1 -1
- package/ShadersWGSL/textureProcessor.fragment.js +26 -4
- package/ShadersWGSL/textureProcessor.fragment.js.map +1 -1
- package/Sprites/spriteRenderer.js +15 -5
- package/Sprites/spriteRenderer.js.map +1 -1
- package/package.json +1 -1
- package/scene.pure.d.ts +23 -1
- package/scene.pure.js +83 -1
- package/scene.pure.js.map +1 -1
|
@@ -13,11 +13,11 @@ import { type AbstractEngineOptions, type ISceneLike } from "./abstractEngine.pu
|
|
|
13
13
|
import { ThinEngine } from "./thinEngine.pure.js";
|
|
14
14
|
import { type IMaterialContext } from "./IMaterialContext.js";
|
|
15
15
|
import { type IDrawContext } from "./IDrawContext.js";
|
|
16
|
-
import { type
|
|
16
|
+
import { type IImage, type IPath2D } from "./ICanvas.js";
|
|
17
17
|
import { type IStencilState } from "../States/IStencilState.js";
|
|
18
18
|
import { type RenderTargetWrapper } from "./renderTargetWrapper.js";
|
|
19
19
|
import { type NativeData, NativeDataStream } from "./Native/nativeDataStream.js";
|
|
20
|
-
import { type INative, type INativeEngine, type NativeFramebuffer, type NativeTexture } from "./Native/nativeInterfaces.js";
|
|
20
|
+
import { type INative, type INativeCanvas, type INativeEngine, type NativeFramebuffer, type NativeTexture } from "./Native/nativeInterfaces.js";
|
|
21
21
|
import { NativeRenderTargetWrapper } from "./Native/nativeRenderTargetWrapper.js";
|
|
22
22
|
import { type IHardwareTextureWrapper } from "../Materials/Textures/hardwareTextureWrapper.js";
|
|
23
23
|
import { type _IShaderProcessingContext } from "./Processors/shaderProcessingOptions.js";
|
|
@@ -66,6 +66,8 @@ export declare class ThinNativeEngine extends ThinEngine {
|
|
|
66
66
|
private _commandBufferEncoder;
|
|
67
67
|
private _frameStats;
|
|
68
68
|
private _boundBuffersVertexArray;
|
|
69
|
+
private _fontMeasureCanvas?;
|
|
70
|
+
private _fontMeasureContext?;
|
|
69
71
|
private _transformFeedbackBuffer;
|
|
70
72
|
private _transformFeedbackActive;
|
|
71
73
|
/**
|
|
@@ -589,9 +591,9 @@ export declare class ThinNativeEngine extends ThinEngine {
|
|
|
589
591
|
updateTextureComparisonFunction(texture: InternalTexture, comparisonFunction: number): void;
|
|
590
592
|
/**
|
|
591
593
|
* Generates mipmaps for the given texture.
|
|
592
|
-
* @param
|
|
594
|
+
* @param texture The texture to generate the mipmaps for.
|
|
593
595
|
*/
|
|
594
|
-
generateMipmaps(
|
|
596
|
+
generateMipmaps(texture: InternalTexture): void;
|
|
595
597
|
/**
|
|
596
598
|
* Creates one framebuffer per layer (or cube face) of a native texture.
|
|
597
599
|
* @internal
|
|
@@ -618,6 +620,7 @@ export declare class ThinNativeEngine extends ThinEngine {
|
|
|
618
620
|
* @internal
|
|
619
621
|
*/
|
|
620
622
|
_isFrameGraphFramebuffer(framebuffer: NativeFramebuffer): boolean;
|
|
623
|
+
private _getFrameGraphAutoGenerateMips;
|
|
621
624
|
/**
|
|
622
625
|
* Lazily builds (or reuses a shared) bgfx framebuffer for a frame graph render-target wrapper whose
|
|
623
626
|
* textures were attached after creation (dontCreateTextures). All wrappers that reference the same
|
|
@@ -683,7 +686,7 @@ export declare class ThinNativeEngine extends ThinEngine {
|
|
|
683
686
|
* color target (and its first requested layer) on older Babylon Native runtimes without createMultiFrameBuffer.
|
|
684
687
|
* @internal
|
|
685
688
|
*/
|
|
686
|
-
_createNativeMultiFrameBuffer(colorTextures: NativeTexture[], width: number, height: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean, samples: number, layers?: number[], explicitDepthTexture?: NativeTexture): NativeFramebuffer;
|
|
689
|
+
_createNativeMultiFrameBuffer(colorTextures: NativeTexture[], width: number, height: number, generateStencilBuffer: boolean, generateDepthBuffer: boolean, samples: number, layers?: number[], explicitDepthTexture?: NativeTexture, autoGenerateMips?: boolean[]): NativeFramebuffer;
|
|
687
690
|
generateMipMapsForCubemap(_texture: InternalTexture, _unbind?: boolean): void;
|
|
688
691
|
bindAttachments(attachments: number[]): void;
|
|
689
692
|
clearAttachments(color: Nullable<IColor4Like>, attachments: number[], clearColor: boolean, clearDepth: boolean, clearStencil?: boolean, stencilClearValue?: number): void;
|
|
@@ -733,9 +736,9 @@ export declare class ThinNativeEngine extends ThinEngine {
|
|
|
733
736
|
* Create a canvas
|
|
734
737
|
* @param width width
|
|
735
738
|
* @param height height
|
|
736
|
-
* @returns
|
|
739
|
+
* @returns INativeCanvas interface
|
|
737
740
|
*/
|
|
738
|
-
createCanvas(width: number, height: number):
|
|
741
|
+
createCanvas(width: number, height: number): INativeCanvas;
|
|
739
742
|
/**
|
|
740
743
|
* Create an image to use with canvas
|
|
741
744
|
* @returns IImage interface
|
|
@@ -412,6 +412,9 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
412
412
|
if (this._boundBuffersVertexArray) {
|
|
413
413
|
this._deleteVertexArray(this._boundBuffersVertexArray);
|
|
414
414
|
}
|
|
415
|
+
this._fontMeasureCanvas?.dispose();
|
|
416
|
+
this._fontMeasureCanvas = undefined;
|
|
417
|
+
this._fontMeasureContext = undefined;
|
|
415
418
|
this._engine.dispose();
|
|
416
419
|
}
|
|
417
420
|
/**
|
|
@@ -1638,11 +1641,16 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
1638
1641
|
const context = canvas.getContext();
|
|
1639
1642
|
// flush need to happen before getCanvasTexture: flush will create the render target synchronously (if it's not been created before)
|
|
1640
1643
|
context.flush();
|
|
1641
|
-
|
|
1644
|
+
// Older runtimes take no options and always copy with their legacy alpha handling.
|
|
1645
|
+
const supportsOptions = this._engine.supportsDynamicTextureMipMaps === true;
|
|
1646
|
+
const source = supportsOptions ? canvas.getCanvasTexture(premulAlpha, texture.generateMipMaps) : canvas.getCanvasTexture();
|
|
1642
1647
|
this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_COPYTEXTURE);
|
|
1643
1648
|
this._commandBufferEncoder.encodeCommandArgAsNativeData(source);
|
|
1644
1649
|
this._commandBufferEncoder.encodeCommandArgAsNativeData(destination);
|
|
1645
1650
|
this._commandBufferEncoder.finishEncodingCommand();
|
|
1651
|
+
if (supportsOptions) {
|
|
1652
|
+
texture._premulAlpha = premulAlpha;
|
|
1653
|
+
}
|
|
1646
1654
|
texture.isReady = true;
|
|
1647
1655
|
}
|
|
1648
1656
|
}
|
|
@@ -1651,7 +1659,9 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
1651
1659
|
// Keep at least 1x1 because many bgfx methods assume a non-zero texture size.
|
|
1652
1660
|
width = Math.max(Math.floor(width), 1);
|
|
1653
1661
|
height = Math.max(Math.floor(height), 1);
|
|
1654
|
-
|
|
1662
|
+
// Older runtimes cannot regenerate mips when the canvas contents are copied into the texture.
|
|
1663
|
+
generateMipMaps = generateMipMaps && this._engine.supportsDynamicTextureMipMaps === true;
|
|
1664
|
+
return this.createRawTexture(new Uint8Array(width * height * 4), width, height, 5, generateMipMaps, false, samplingMode);
|
|
1655
1665
|
}
|
|
1656
1666
|
createVideoElement(constraints) {
|
|
1657
1667
|
// create native object depending on stream. Only NativeCamera is supported for now.
|
|
@@ -2298,7 +2308,7 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
2298
2308
|
for (let layer = 0; layer < layerCount; layer++) {
|
|
2299
2309
|
// First call creates the multi-layer sampleable depth and aliases it into nativeDepth;
|
|
2300
2310
|
// subsequent calls borrow the same depth array and attach the matching layer.
|
|
2301
|
-
framebuffers.push(this._createNativeMultiFrameBuffer([nativeColor], width, height, generateStencil, true, samples, [layer], nativeDepth));
|
|
2311
|
+
framebuffers.push(this._createNativeMultiFrameBuffer([nativeColor], width, height, generateStencil, true, samples, [layer], nativeDepth, [colorTexture.generateMipMaps]));
|
|
2302
2312
|
}
|
|
2303
2313
|
// The _framebuffers setter releases the previous handles.
|
|
2304
2314
|
nativeRTWrapper._framebuffers = framebuffers;
|
|
@@ -2314,14 +2324,16 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
2314
2324
|
// point, which is how CreateFrameBufferImpl recognizes a request for a readable depth attachment that
|
|
2315
2325
|
// it aliases back into the supplied texture so it can be sampled afterwards.
|
|
2316
2326
|
const colorResources = [];
|
|
2327
|
+
const autoGenerateMips = [];
|
|
2317
2328
|
for (const colorTexture of nativeRTWrapper.textures ?? []) {
|
|
2318
2329
|
const colorResource = colorTexture?._hardwareTexture?.underlyingResource;
|
|
2319
2330
|
if (colorResource) {
|
|
2320
2331
|
colorResources.push(colorResource);
|
|
2332
|
+
autoGenerateMips.push(colorTexture.generateMipMaps);
|
|
2321
2333
|
}
|
|
2322
2334
|
}
|
|
2323
2335
|
const nativeDepth = texture._hardwareTexture.underlyingResource;
|
|
2324
|
-
const framebuffer = this._createNativeMultiFrameBuffer(colorResources, width, height, generateStencil, true, samples, undefined, nativeDepth);
|
|
2336
|
+
const framebuffer = this._createNativeMultiFrameBuffer(colorResources, width, height, generateStencil, true, samples, undefined, nativeDepth, autoGenerateMips);
|
|
2325
2337
|
nativeRTWrapper._framebufferDepthStencil = framebuffer;
|
|
2326
2338
|
this._setTextureSampling(nativeDepth, getNativeSamplingMode(texture.samplingMode));
|
|
2327
2339
|
this.updateTextureComparisonFunction(texture, texture._comparisonFunction);
|
|
@@ -2463,14 +2475,22 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
2463
2475
|
}
|
|
2464
2476
|
/**
|
|
2465
2477
|
* Generates mipmaps for the given texture.
|
|
2466
|
-
* @param
|
|
2478
|
+
* @param texture The texture to generate the mipmaps for.
|
|
2467
2479
|
*/
|
|
2468
|
-
generateMipmaps(
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2480
|
+
generateMipmaps(texture) {
|
|
2481
|
+
const command = _native.Engine.COMMAND_GENERATEMIPMAPS;
|
|
2482
|
+
if (!command) {
|
|
2483
|
+
// Older runtimes always regenerate MRT mips at resolve and lack an explicit generation command.
|
|
2484
|
+
Logger.Warn("NativeEngine: explicit mip generation is not supported by this runtime; relying on legacy framebuffer resolve.", 1);
|
|
2485
|
+
return;
|
|
2486
|
+
}
|
|
2487
|
+
const nativeTexture = texture._hardwareTexture?.underlyingResource;
|
|
2488
|
+
if (!nativeTexture || !this._hasMipStorage(texture)) {
|
|
2489
|
+
throw new Error("NativeEngine: explicit mip generation requires a hardware texture with mip storage.");
|
|
2490
|
+
}
|
|
2491
|
+
this._commandBufferEncoder.startEncodingCommand(command);
|
|
2492
|
+
this._commandBufferEncoder.encodeCommandArgAsNativeData(nativeTexture);
|
|
2493
|
+
this._commandBufferEncoder.finishEncodingCommand();
|
|
2474
2494
|
}
|
|
2475
2495
|
/**
|
|
2476
2496
|
* Creates one framebuffer per layer (or cube face) of a native texture.
|
|
@@ -2531,6 +2551,10 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
2531
2551
|
}
|
|
2532
2552
|
// Reference counts + metadata for framebuffers shared across frame graph render-target wrappers
|
|
2533
2553
|
// are stored in _frameGraphFramebufferRefCount (declared with the other engine fields).
|
|
2554
|
+
_getFrameGraphAutoGenerateMips(texture) {
|
|
2555
|
+
// Runtimes without explicit generation need legacy automatic resolves for allocated mips.
|
|
2556
|
+
return texture.generateMipMaps || (!_native.Engine.COMMAND_GENERATEMIPMAPS && this._hasMipStorage(texture));
|
|
2557
|
+
}
|
|
2534
2558
|
/**
|
|
2535
2559
|
* Lazily builds (or reuses a shared) bgfx framebuffer for a frame graph render-target wrapper whose
|
|
2536
2560
|
* textures were attached after creation (dontCreateTextures). All wrappers that reference the same
|
|
@@ -2572,42 +2596,56 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
2572
2596
|
// Like a GL framebuffer, an explicit depth-stencil texture is always attached as-is, so every pass that
|
|
2573
2597
|
// references it (clears, geometry, overlays, later samplers) sees the same real depth buffer.
|
|
2574
2598
|
const sharedDepthResource = depthStencilTexture?._hardwareTexture?.underlyingResource;
|
|
2575
|
-
|
|
2576
|
-
const cachedMeta = cached ? this._frameGraphFramebufferRefCount.get(cached) : undefined;
|
|
2599
|
+
let cached = nativeRTWrapper._framebuffer ?? hardwareTexture._frameGraphFramebuffer;
|
|
2577
2600
|
// Reuse the cached framebuffer when it is compatible: the same ordered color attachments (a swap of any
|
|
2578
|
-
// attachment, not only the primary one, needs a new framebuffer),
|
|
2601
|
+
// attachment, not only the primary one, needs a new framebuffer), mip policies, sample count, depth/stencil
|
|
2579
2602
|
// buffers when this pass needs them (a pass that does not need them can safely reuse a framebuffer that
|
|
2580
2603
|
// has them), and the same shared depth texture (so a shared-depth pass never reuses an auto-depth
|
|
2581
2604
|
// framebuffer, and vice versa). History-texture swaps invalidate these wrappers every frame, so this check
|
|
2582
2605
|
// runs in the render loop: compare in place and only allocate the color list for a new framebuffer.
|
|
2583
|
-
|
|
2584
|
-
for (let
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
(
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2606
|
+
// Rejecting a stale retained framebuffer must not hide a compatible shared replacement.
|
|
2607
|
+
for (let cacheAttempt = 0; cacheAttempt < 2; cacheAttempt++) {
|
|
2608
|
+
const cachedMeta = cached ? this._frameGraphFramebufferRefCount.get(cached) : undefined;
|
|
2609
|
+
let sameColors = !!cachedMeta && cachedMeta.colorResources.length === textureCount;
|
|
2610
|
+
for (let i = 0; sameColors && i < textureCount; i++) {
|
|
2611
|
+
sameColors =
|
|
2612
|
+
cachedMeta.colorResources[i] === textures[i]._hardwareTexture.underlyingResource &&
|
|
2613
|
+
cachedMeta.autoGenerateMips[i] === this._getFrameGraphAutoGenerateMips(textures[i]);
|
|
2614
|
+
}
|
|
2615
|
+
if (cached &&
|
|
2616
|
+
cachedMeta &&
|
|
2617
|
+
sameColors &&
|
|
2618
|
+
cachedMeta.samples === samples &&
|
|
2619
|
+
(cachedMeta.hasDepth || !generateDepthBuffer) &&
|
|
2620
|
+
(cachedMeta.hasStencil || !generateStencilBuffer) &&
|
|
2621
|
+
cachedMeta.sharedDepthResource === sharedDepthResource) {
|
|
2622
|
+
if (nativeRTWrapper._framebuffer !== cached) {
|
|
2623
|
+
cachedMeta.count++;
|
|
2624
|
+
nativeRTWrapper._framebuffer = cached;
|
|
2625
|
+
}
|
|
2626
|
+
return;
|
|
2627
|
+
}
|
|
2628
|
+
if (cached === hardwareTexture._frameGraphFramebuffer) {
|
|
2629
|
+
break;
|
|
2630
|
+
}
|
|
2631
|
+
cached = hardwareTexture._frameGraphFramebuffer;
|
|
2597
2632
|
}
|
|
2598
2633
|
const colorTextures = new Array(textureCount);
|
|
2634
|
+
const autoGenerateMips = new Array(textureCount);
|
|
2599
2635
|
for (let i = 0; i < textureCount; i++) {
|
|
2600
2636
|
colorTextures[i] = textures[i]._hardwareTexture.underlyingResource;
|
|
2637
|
+
autoGenerateMips[i] = this._getFrameGraphAutoGenerateMips(textures[i]);
|
|
2601
2638
|
}
|
|
2602
2639
|
const framebuffer = sharedDepthResource
|
|
2603
|
-
? this._createNativeMultiFrameBuffer(colorTextures, nativeRTWrapper.width, nativeRTWrapper.height, generateStencilBuffer, true, samples, undefined, sharedDepthResource)
|
|
2640
|
+
? this._createNativeMultiFrameBuffer(colorTextures, nativeRTWrapper.width, nativeRTWrapper.height, generateStencilBuffer, true, samples, undefined, sharedDepthResource, autoGenerateMips)
|
|
2604
2641
|
: colorTextures.length === 1
|
|
2605
|
-
? this._engine.createFrameBuffer(colorTextures[0], nativeRTWrapper.width, nativeRTWrapper.height, generateStencilBuffer, generateDepthBuffer, samples)
|
|
2606
|
-
: this._createNativeMultiFrameBuffer(colorTextures, nativeRTWrapper.width, nativeRTWrapper.height, generateStencilBuffer, generateDepthBuffer, samples);
|
|
2642
|
+
? this._engine.createFrameBuffer(colorTextures[0], nativeRTWrapper.width, nativeRTWrapper.height, generateStencilBuffer, generateDepthBuffer, samples, undefined, undefined, autoGenerateMips[0])
|
|
2643
|
+
: this._createNativeMultiFrameBuffer(colorTextures, nativeRTWrapper.width, nativeRTWrapper.height, generateStencilBuffer, generateDepthBuffer, samples, undefined, undefined, autoGenerateMips);
|
|
2607
2644
|
this._frameGraphFramebufferRefCount.set(framebuffer, {
|
|
2608
2645
|
count: 1,
|
|
2609
2646
|
hardwareTexture,
|
|
2610
2647
|
colorResources: colorTextures,
|
|
2648
|
+
autoGenerateMips,
|
|
2611
2649
|
hasDepth: generateDepthBuffer,
|
|
2612
2650
|
hasStencil: generateStencilBuffer,
|
|
2613
2651
|
samples,
|
|
@@ -3097,10 +3135,12 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3097
3135
|
return;
|
|
3098
3136
|
}
|
|
3099
3137
|
const colorHandles = [];
|
|
3138
|
+
const autoGenerateMips = [];
|
|
3100
3139
|
for (const texture of textures) {
|
|
3101
3140
|
const handle = texture?._hardwareTexture?.underlyingResource;
|
|
3102
3141
|
if (handle) {
|
|
3103
3142
|
colorHandles.push(handle);
|
|
3143
|
+
autoGenerateMips.push(texture.generateMipMaps);
|
|
3104
3144
|
}
|
|
3105
3145
|
}
|
|
3106
3146
|
// bgfx framebuffers use a dense, ordered attachment list, so only (re)build once every expected color
|
|
@@ -3118,7 +3158,7 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3118
3158
|
// attached after dontCreateTextures). Otherwise fall back to auto depth from _generateDepthBuffer.
|
|
3119
3159
|
const explicitDepth = rtWrapper._depthStencilTexture?._hardwareTexture?.underlyingResource;
|
|
3120
3160
|
const generateDepthBuffer = !!explicitDepth || rtWrapper._generateDepthBuffer;
|
|
3121
|
-
rtWrapper._framebuffer = this._createNativeMultiFrameBuffer(colorHandles, width, height, this._getDepthAttachmentStencil(rtWrapper), generateDepthBuffer, rtWrapper._samples, undefined, explicitDepth);
|
|
3161
|
+
rtWrapper._framebuffer = this._createNativeMultiFrameBuffer(colorHandles, width, height, this._getDepthAttachmentStencil(rtWrapper), generateDepthBuffer, rtWrapper._samples, undefined, explicitDepth, autoGenerateMips);
|
|
3122
3162
|
this._applyDepthTextureSampling(rtWrapper);
|
|
3123
3163
|
}
|
|
3124
3164
|
_applyDepthTextureSampling(rtWrapper) {
|
|
@@ -3135,13 +3175,13 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3135
3175
|
* color target (and its first requested layer) on older Babylon Native runtimes without createMultiFrameBuffer.
|
|
3136
3176
|
* @internal
|
|
3137
3177
|
*/
|
|
3138
|
-
_createNativeMultiFrameBuffer(colorTextures, width, height, generateStencilBuffer, generateDepthBuffer, samples, layers, explicitDepthTexture) {
|
|
3178
|
+
_createNativeMultiFrameBuffer(colorTextures, width, height, generateStencilBuffer, generateDepthBuffer, samples, layers, explicitDepthTexture, autoGenerateMips) {
|
|
3139
3179
|
if (this._engine.createMultiFrameBuffer) {
|
|
3140
|
-
return this._engine.createMultiFrameBuffer(colorTextures, width, height, generateStencilBuffer, generateDepthBuffer, samples, layers, explicitDepthTexture);
|
|
3180
|
+
return this._engine.createMultiFrameBuffer(colorTextures, width, height, generateStencilBuffer, generateDepthBuffer, samples, layers, explicitDepthTexture, autoGenerateMips);
|
|
3141
3181
|
}
|
|
3142
3182
|
// Warn once (limit 1): the framebuffer can be rebuilt many times during attachment setup/swaps.
|
|
3143
3183
|
Logger.Warn("createMultiFrameBuffer is not supported by this version of Babylon Native; multi render targets are unavailable. Falling back to a single-attachment framebuffer bound to the first color target.", 1);
|
|
3144
|
-
return this._engine.createFrameBuffer(colorTextures[0] ?? null, width, height, generateStencilBuffer, generateDepthBuffer, samples, layers?.[0]);
|
|
3184
|
+
return this._engine.createFrameBuffer(colorTextures[0] ?? null, width, height, generateStencilBuffer, generateDepthBuffer, samples, layers?.[0], undefined, autoGenerateMips?.[0]);
|
|
3145
3185
|
}
|
|
3146
3186
|
generateMipMapsForCubemap(_texture, _unbind = true) {
|
|
3147
3187
|
// The WebGL path rebinds gl.TEXTURE_CUBE_MAP and calls gl.generateMipmap; both deref _gl, which is
|
|
@@ -3368,7 +3408,9 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3368
3408
|
// first time the wrapper is bound. Several wrappers can reference the same underlying texture(s), so the
|
|
3369
3409
|
// framebuffer is cached on (and shared through) the first color texture's hardware wrapper to avoid each
|
|
3370
3410
|
// fresh framebuffer/view clearing the texture and clobbering earlier passes.
|
|
3371
|
-
if (!nativeRTWrapper._framebuffers &&
|
|
3411
|
+
if (!nativeRTWrapper._framebuffers &&
|
|
3412
|
+
!nativeRTWrapper._framebufferDepthStencil &&
|
|
3413
|
+
(!nativeRTWrapper._framebuffer || this._frameGraphFramebufferRefCount.has(nativeRTWrapper._framebuffer))) {
|
|
3372
3414
|
this._buildFrameGraphFramebuffer(nativeRTWrapper);
|
|
3373
3415
|
}
|
|
3374
3416
|
if (nativeRTWrapper._framebuffers) {
|
|
@@ -3438,12 +3480,12 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3438
3480
|
}
|
|
3439
3481
|
// generateDepth must be set so a depth texture without a native handle yet (created directly on this
|
|
3440
3482
|
// volume) is allocated and aliased by the first slice; later slices borrow the existing handle.
|
|
3441
|
-
framebuffer = this.
|
|
3483
|
+
framebuffer = this._createNativeMultiFrameBuffer([nativeTexture], width, height, HasStencilAspect(depthTexture.format), true, nativeRTWrapper.samples, [layer], nativeDepth, [nativeRTWrapper.texture.generateMipMaps]);
|
|
3442
3484
|
this._setTextureSampling(nativeDepth, getNativeSamplingMode(depthTexture.samplingMode));
|
|
3443
3485
|
this.updateTextureComparisonFunction(depthTexture, depthTexture._comparisonFunction);
|
|
3444
3486
|
}
|
|
3445
3487
|
else {
|
|
3446
|
-
framebuffer = this._engine.createFrameBuffer(nativeTexture, width, height, nativeRTWrapper._generateStencilBuffer, nativeRTWrapper._generateDepthBuffer, nativeRTWrapper.samples, layer, mip);
|
|
3488
|
+
framebuffer = this._engine.createFrameBuffer(nativeTexture, width, height, nativeRTWrapper._generateStencilBuffer, nativeRTWrapper._generateDepthBuffer, nativeRTWrapper.samples, layer, mip, nativeRTWrapper.texture.generateMipMaps);
|
|
3447
3489
|
}
|
|
3448
3490
|
nativeRTWrapper._layerFramebuffers.set(key, framebuffer);
|
|
3449
3491
|
}
|
|
@@ -3531,20 +3573,22 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3531
3573
|
throw new Error("NativeEngine: cannot bind a layered MRT until every color attachment is assigned.");
|
|
3532
3574
|
}
|
|
3533
3575
|
const attachmentLayer = tex.is3D ? (layerIndices?.[i] ?? i) : nativeRTWrapper.getBaseArrayLayer(i);
|
|
3534
|
-
if (upToDate && (key.colors[i] !== nativeTexture || key.layers[i] !== attachmentLayer)) {
|
|
3576
|
+
if (upToDate && (key.colors[i] !== nativeTexture || key.layers[i] !== attachmentLayer || key.autoGenerateMips[i] !== tex.generateMipMaps)) {
|
|
3535
3577
|
upToDate = false;
|
|
3536
3578
|
}
|
|
3537
3579
|
}
|
|
3538
3580
|
if (!upToDate) {
|
|
3539
3581
|
const colorTextures = new Array(expectedCount);
|
|
3540
3582
|
const layers = new Array(expectedCount);
|
|
3583
|
+
const autoGenerateMips = new Array(expectedCount);
|
|
3541
3584
|
for (let i = 0; i < expectedCount; i++) {
|
|
3542
3585
|
const tex = textures[i];
|
|
3543
3586
|
colorTextures[i] = tex._hardwareTexture.underlyingResource;
|
|
3544
3587
|
layers[i] = tex.is3D ? (layerIndices?.[i] ?? i) : nativeRTWrapper.getBaseArrayLayer(i);
|
|
3588
|
+
autoGenerateMips[i] = tex.generateMipMaps;
|
|
3545
3589
|
}
|
|
3546
|
-
nativeRTWrapper._framebuffer = this._createNativeMultiFrameBuffer(colorTextures, nativeRTWrapper.width, nativeRTWrapper.height, this._getDepthAttachmentStencil(nativeRTWrapper), !!depth || nativeRTWrapper._generateDepthBuffer, samples, layers, depth);
|
|
3547
|
-
nativeRTWrapper._layeredFramebufferKey = { colors: colorTextures, layers, depth, samples };
|
|
3590
|
+
nativeRTWrapper._framebuffer = this._createNativeMultiFrameBuffer(colorTextures, nativeRTWrapper.width, nativeRTWrapper.height, this._getDepthAttachmentStencil(nativeRTWrapper), !!depth || nativeRTWrapper._generateDepthBuffer, samples, layers, depth, autoGenerateMips);
|
|
3591
|
+
nativeRTWrapper._layeredFramebufferKey = { colors: colorTextures, layers, depth, samples, autoGenerateMips };
|
|
3548
3592
|
this._applyDepthTextureSampling(nativeRTWrapper);
|
|
3549
3593
|
}
|
|
3550
3594
|
this._bindUnboundFramebuffer(nativeRTWrapper._framebuffer);
|
|
@@ -3659,10 +3703,10 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3659
3703
|
// TODO: Rename to match naming in base implementation once refactoring allows different parameters.
|
|
3660
3704
|
_updateAnisotropicLevel(texture) {
|
|
3661
3705
|
const internalTexture = texture.getInternalTexture();
|
|
3662
|
-
const value = texture.anisotropicFilteringLevel;
|
|
3663
3706
|
if (!internalTexture || !internalTexture._hardwareTexture) {
|
|
3664
3707
|
return;
|
|
3665
3708
|
}
|
|
3709
|
+
const value = Math.min(texture.anisotropicFilteringLevel, this._caps.maxAnisotropy);
|
|
3666
3710
|
if (internalTexture._cachedAnisotropicFilteringLevel !== value) {
|
|
3667
3711
|
this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREANISOTROPICLEVEL);
|
|
3668
3712
|
this._commandBufferEncoder.encodeCommandArgAsNativeData(internalTexture._hardwareTexture.underlyingResource);
|
|
@@ -3720,7 +3764,7 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3720
3764
|
* Create a canvas
|
|
3721
3765
|
* @param width width
|
|
3722
3766
|
* @param height height
|
|
3723
|
-
* @returns
|
|
3767
|
+
* @returns INativeCanvas interface
|
|
3724
3768
|
*/
|
|
3725
3769
|
createCanvas(width, height) {
|
|
3726
3770
|
if (!_native.Canvas) {
|
|
@@ -3819,9 +3863,36 @@ export class ThinNativeEngine extends ThinEngine {
|
|
|
3819
3863
|
throw new Error("_uploadArrayBufferViewToTexture not implemented.");
|
|
3820
3864
|
}
|
|
3821
3865
|
getFontOffset(font) {
|
|
3822
|
-
//
|
|
3823
|
-
|
|
3824
|
-
|
|
3866
|
+
// Match the browser's font line box for GUI layout, not just the ink in "Hg".
|
|
3867
|
+
// Older Canvas runtimes may expose only glyph bounds.
|
|
3868
|
+
try {
|
|
3869
|
+
if (!this._fontMeasureContext) {
|
|
3870
|
+
// Keep a canvas whose context failed so retries never orphan it before engine disposal.
|
|
3871
|
+
this._fontMeasureCanvas ?? (this._fontMeasureCanvas = this.createCanvas(64, 64));
|
|
3872
|
+
this._fontMeasureContext = this._fontMeasureCanvas.getContext("2d") || undefined;
|
|
3873
|
+
}
|
|
3874
|
+
const context = this._fontMeasureContext;
|
|
3875
|
+
if (!context) {
|
|
3876
|
+
throw new Error("2D canvas context is unavailable");
|
|
3877
|
+
}
|
|
3878
|
+
context.font = font;
|
|
3879
|
+
const metrics = context.measureText("Hg");
|
|
3880
|
+
const ascent = Number(metrics.fontBoundingBoxAscent ?? metrics.actualBoundingBoxAscent);
|
|
3881
|
+
const descent = Number(metrics.fontBoundingBoxDescent ?? metrics.actualBoundingBoxDescent);
|
|
3882
|
+
if (isFinite(ascent) && isFinite(descent) && ascent + descent > 0) {
|
|
3883
|
+
return { ascent, height: ascent + descent, descent };
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
catch (error) {
|
|
3887
|
+
Logger.Warn(`Native font measurement failed; using an estimated line height: ${String(error)}`, 1);
|
|
3888
|
+
}
|
|
3889
|
+
// No canvas or an unmeasurable font: approximate from the CSS px size the same way the
|
|
3890
|
+
// shared GetFallbackFontOffset does, so text still gets a sane non-zero line height.
|
|
3891
|
+
const match = /(?:^|\s)([0-9]+(?:\.[0-9]+)?)px(?:\/|\s|$)/.exec(String(font || ""));
|
|
3892
|
+
const size = Math.max(1, match ? parseFloat(match[1]) : 12);
|
|
3893
|
+
const ascent = size * 0.8;
|
|
3894
|
+
const descent = size * 0.2;
|
|
3895
|
+
return { ascent, height: ascent + descent, descent };
|
|
3825
3896
|
}
|
|
3826
3897
|
/**
|
|
3827
3898
|
* No equivalent for native. Do nothing.
|