@aura3d/rendering 3.0.1 → 4.0.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/dist/BlendModes.d.ts +34 -0
- package/dist/BlendModes.d.ts.map +1 -0
- package/dist/BlendModes.js +42 -0
- package/dist/BlendModes.js.map +1 -0
- package/dist/DepthPass.d.ts +18 -0
- package/dist/DepthPass.d.ts.map +1 -1
- package/dist/DepthPass.js +103 -20
- package/dist/DepthPass.js.map +1 -1
- package/dist/EnvironmentBackgroundPass.d.ts +7 -0
- package/dist/EnvironmentBackgroundPass.d.ts.map +1 -1
- package/dist/EnvironmentBackgroundPass.js +39 -14
- package/dist/EnvironmentBackgroundPass.js.map +1 -1
- package/dist/EnvironmentMapResources.d.ts +1 -1
- package/dist/EnvironmentMapResources.d.ts.map +1 -1
- package/dist/EnvironmentMapResources.js +19 -8
- package/dist/EnvironmentMapResources.js.map +1 -1
- package/dist/EnvironmentPlatform.d.ts +6 -0
- package/dist/EnvironmentPlatform.d.ts.map +1 -1
- package/dist/EnvironmentPlatform.js +3 -1
- package/dist/EnvironmentPlatform.js.map +1 -1
- package/dist/EnvironmentPreset.d.ts +7 -0
- package/dist/EnvironmentPreset.d.ts.map +1 -1
- package/dist/EnvironmentPreset.js +11 -11
- package/dist/EnvironmentPreset.js.map +1 -1
- package/dist/EnvironmentPresetPack.d.ts +16 -0
- package/dist/EnvironmentPresetPack.d.ts.map +1 -1
- package/dist/EnvironmentPresetPack.js +28 -0
- package/dist/EnvironmentPresetPack.js.map +1 -1
- package/dist/ExternalParityRenderPreset.d.ts +15 -1
- package/dist/ExternalParityRenderPreset.d.ts.map +1 -1
- package/dist/ExternalParityRenderPreset.js +52 -7
- package/dist/ExternalParityRenderPreset.js.map +1 -1
- package/dist/ForwardPass.d.ts +240 -50
- package/dist/ForwardPass.d.ts.map +1 -1
- package/dist/ForwardPass.js +845 -866
- package/dist/ForwardPass.js.map +1 -1
- package/dist/Geometry.d.ts +44 -1
- package/dist/Geometry.d.ts.map +1 -1
- package/dist/Geometry.js +174 -24
- package/dist/Geometry.js.map +1 -1
- package/dist/InstancedPBRMaterial.d.ts +5 -0
- package/dist/InstancedPBRMaterial.d.ts.map +1 -1
- package/dist/InstancedPBRMaterial.js +7 -0
- package/dist/InstancedPBRMaterial.js.map +1 -1
- package/dist/LightCollector.d.ts +8 -0
- package/dist/LightCollector.d.ts.map +1 -1
- package/dist/LightCollector.js +1 -1
- package/dist/LightCollector.js.map +1 -1
- package/dist/LightUniforms.d.ts +78 -0
- package/dist/LightUniforms.d.ts.map +1 -1
- package/dist/LightUniforms.js +100 -0
- package/dist/LightUniforms.js.map +1 -1
- package/dist/Material.d.ts +15 -0
- package/dist/Material.d.ts.map +1 -1
- package/dist/Material.js +19 -2
- package/dist/Material.js.map +1 -1
- package/dist/MaterialBinding.d.ts +10 -0
- package/dist/MaterialBinding.d.ts.map +1 -1
- package/dist/MaterialBinding.js +91 -1
- package/dist/MaterialBinding.js.map +1 -1
- package/dist/MaterialPresets.d.ts +60 -0
- package/dist/MaterialPresets.d.ts.map +1 -1
- package/dist/MaterialPresets.js +212 -0
- package/dist/MaterialPresets.js.map +1 -1
- package/dist/NormalMappedPBRMaterial.d.ts +5 -0
- package/dist/NormalMappedPBRMaterial.d.ts.map +1 -1
- package/dist/NormalMappedPBRMaterial.js +7 -0
- package/dist/NormalMappedPBRMaterial.js.map +1 -1
- package/dist/OceanSurface.d.ts +8 -0
- package/dist/OceanSurface.d.ts.map +1 -1
- package/dist/OceanSurface.js +10 -79
- package/dist/OceanSurface.js.map +1 -1
- package/dist/PBRLightingDefaults.d.ts +8 -0
- package/dist/PBRLightingDefaults.d.ts.map +1 -1
- package/dist/PBRLightingDefaults.js +8 -0
- package/dist/PBRLightingDefaults.js.map +1 -1
- package/dist/PBRMaterial.d.ts +5 -0
- package/dist/PBRMaterial.d.ts.map +1 -1
- package/dist/PBRMaterial.js +7 -0
- package/dist/PBRMaterial.js.map +1 -1
- package/dist/PostProcessPass.d.ts +6 -490
- package/dist/PostProcessPass.d.ts.map +1 -1
- package/dist/PostProcessPass.js +6 -2016
- package/dist/PostProcessPass.js.map +1 -1
- package/dist/ProceduralMaterialTextures.d.ts +28 -0
- package/dist/ProceduralMaterialTextures.d.ts.map +1 -0
- package/dist/ProceduralMaterialTextures.js +217 -0
- package/dist/ProceduralMaterialTextures.js.map +1 -0
- package/dist/ReflectionProbe.d.ts.map +1 -1
- package/dist/ReflectionProbe.js +4 -1
- package/dist/ReflectionProbe.js.map +1 -1
- package/dist/RenderBackend.d.ts +2 -0
- package/dist/RenderBackend.d.ts.map +1 -1
- package/dist/RenderBackend.js +3 -0
- package/dist/RenderBackend.js.map +1 -1
- package/dist/RenderDevice.d.ts +92 -5
- package/dist/RenderDevice.d.ts.map +1 -1
- package/dist/RenderDevice.js +166 -9
- package/dist/RenderDevice.js.map +1 -1
- package/dist/RenderGraph.d.ts.map +1 -1
- package/dist/RenderGraph.js +17 -0
- package/dist/RenderGraph.js.map +1 -1
- package/dist/RenderPass.d.ts +7 -0
- package/dist/RenderPass.d.ts.map +1 -1
- package/dist/RenderPass.js.map +1 -1
- package/dist/RenderPipeline.d.ts +5 -0
- package/dist/RenderPipeline.d.ts.map +1 -1
- package/dist/RenderPipeline.js +6 -0
- package/dist/RenderPipeline.js.map +1 -1
- package/dist/Renderer.d.ts +261 -66
- package/dist/Renderer.d.ts.map +1 -1
- package/dist/Renderer.js +902 -1256
- package/dist/Renderer.js.map +1 -1
- package/dist/RendererPostprocessPlan.d.ts +4 -0
- package/dist/RendererPostprocessPlan.d.ts.map +1 -1
- package/dist/RendererPostprocessPlan.js +16 -2
- package/dist/RendererPostprocessPlan.js.map +1 -1
- package/dist/RendererTiming.d.ts +27 -0
- package/dist/RendererTiming.d.ts.map +1 -1
- package/dist/RendererTiming.js +179 -12
- package/dist/RendererTiming.js.map +1 -1
- package/dist/ResolutionGovernor.d.ts +56 -0
- package/dist/ResolutionGovernor.d.ts.map +1 -0
- package/dist/ResolutionGovernor.js +87 -0
- package/dist/ResolutionGovernor.js.map +1 -0
- package/dist/Sampler.d.ts +34 -1
- package/dist/Sampler.d.ts.map +1 -1
- package/dist/Sampler.js +55 -2
- package/dist/Sampler.js.map +1 -1
- package/dist/ShaderLibrary.d.ts.map +1 -1
- package/dist/ShaderLibrary.js +15 -10
- package/dist/ShaderLibrary.js.map +1 -1
- package/dist/ShaderLibraryCore.d.ts.map +1 -1
- package/dist/ShaderLibraryCore.js +3 -2
- package/dist/ShaderLibraryCore.js.map +1 -1
- package/dist/ShaderModule.d.ts +7 -1
- package/dist/ShaderModule.d.ts.map +1 -1
- package/dist/ShaderModule.js +20 -5
- package/dist/ShaderModule.js.map +1 -1
- package/dist/ShadowPass.d.ts.map +1 -1
- package/dist/ShadowPass.js +14 -7
- package/dist/ShadowPass.js.map +1 -1
- package/dist/SkinnedLitMaterial.d.ts +5 -0
- package/dist/SkinnedLitMaterial.d.ts.map +1 -1
- package/dist/SkinnedLitMaterial.js +13 -0
- package/dist/SkinnedLitMaterial.js.map +1 -1
- package/dist/SkinningBounds.d.ts +18 -0
- package/dist/SkinningBounds.d.ts.map +1 -1
- package/dist/SkinningBounds.js +78 -0
- package/dist/SkinningBounds.js.map +1 -1
- package/dist/SkinningPaletteTextureCache.d.ts +117 -0
- package/dist/SkinningPaletteTextureCache.d.ts.map +1 -0
- package/dist/SkinningPaletteTextureCache.js +205 -0
- package/dist/SkinningPaletteTextureCache.js.map +1 -0
- package/dist/SkinningUniforms.d.ts +56 -0
- package/dist/SkinningUniforms.d.ts.map +1 -0
- package/dist/SkinningUniforms.js +262 -0
- package/dist/SkinningUniforms.js.map +1 -0
- package/dist/TemporalHistory.d.ts +33 -0
- package/dist/TemporalHistory.d.ts.map +1 -1
- package/dist/TemporalHistory.js +84 -1
- package/dist/TemporalHistory.js.map +1 -1
- package/dist/TerrainHeightfield.d.ts +12 -0
- package/dist/TerrainHeightfield.d.ts.map +1 -1
- package/dist/TerrainHeightfield.js +29 -6
- package/dist/TerrainHeightfield.js.map +1 -1
- package/dist/TerrainTiles.d.ts +40 -10
- package/dist/TerrainTiles.d.ts.map +1 -1
- package/dist/TerrainTiles.js +18 -57
- package/dist/TerrainTiles.js.map +1 -1
- package/dist/Texture.d.ts +47 -2
- package/dist/Texture.d.ts.map +1 -1
- package/dist/Texture.js +119 -3
- package/dist/Texture.js.map +1 -1
- package/dist/TexturedPBRMaterial.d.ts +24 -0
- package/dist/TexturedPBRMaterial.d.ts.map +1 -1
- package/dist/TexturedPBRMaterial.js +72 -20
- package/dist/TexturedPBRMaterial.js.map +1 -1
- package/dist/TransmissionRenderTarget.d.ts +33 -0
- package/dist/TransmissionRenderTarget.d.ts.map +1 -0
- package/dist/TransmissionRenderTarget.js +61 -0
- package/dist/TransmissionRenderTarget.js.map +1 -0
- package/dist/VegetationScatter.js +1 -1
- package/dist/VegetationScatter.js.map +1 -1
- package/dist/VolumetricFog.d.ts +42 -0
- package/dist/VolumetricFog.d.ts.map +1 -1
- package/dist/VolumetricFog.js +52 -1
- package/dist/VolumetricFog.js.map +1 -1
- package/dist/WaterSurface.d.ts +5 -0
- package/dist/WaterSurface.d.ts.map +1 -1
- package/dist/WaterSurface.js +5 -0
- package/dist/WaterSurface.js.map +1 -1
- package/dist/WebGL2Device.d.ts +154 -207
- package/dist/WebGL2Device.d.ts.map +1 -1
- package/dist/WebGL2Device.js +831 -3703
- package/dist/WebGL2Device.js.map +1 -1
- package/dist/WebGL2StateCache.d.ts +15 -1
- package/dist/WebGL2StateCache.d.ts.map +1 -1
- package/dist/WebGL2StateCache.js +31 -2
- package/dist/WebGL2StateCache.js.map +1 -1
- package/dist/WebGPUDevice.d.ts +0 -4
- package/dist/WebGPUDevice.d.ts.map +1 -1
- package/dist/WebGPUDevice.js +31 -605
- package/dist/WebGPUDevice.js.map +1 -1
- package/dist/WebGPUSkinningLimits.d.ts +10 -1
- package/dist/WebGPUSkinningLimits.d.ts.map +1 -1
- package/dist/WebGPUSkinningLimits.js +15 -1
- package/dist/WebGPUSkinningLimits.js.map +1 -1
- package/dist/advanced-runtime/index.d.ts +6 -2
- package/dist/advanced-runtime/index.d.ts.map +1 -1
- package/dist/advanced-runtime/index.js +0 -1
- package/dist/advanced-runtime/index.js.map +1 -1
- package/dist/animation/AnimationRenderPreset.d.ts +1 -1
- package/dist/animation/AnimationRenderPreset.d.ts.map +1 -1
- package/dist/animation/AnimationRenderPreset.js +1 -1
- package/dist/animation/AnimationRenderPreset.js.map +1 -1
- package/dist/animation/applyAnimationRenderPreset.d.ts +1 -1
- package/dist/animation/applyAnimationRenderPreset.d.ts.map +1 -1
- package/dist/animation/index.d.ts +2 -1
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +1 -1
- package/dist/animation/index.js.map +1 -1
- package/dist/atmosphere/CloudLayer.d.ts +24 -0
- package/dist/atmosphere/CloudLayer.d.ts.map +1 -0
- package/dist/atmosphere/CloudLayer.js +30 -0
- package/dist/atmosphere/CloudLayer.js.map +1 -0
- package/dist/atmosphere/FogVolumes.d.ts +30 -0
- package/dist/atmosphere/FogVolumes.d.ts.map +1 -0
- package/dist/atmosphere/FogVolumes.js +96 -0
- package/dist/atmosphere/FogVolumes.js.map +1 -0
- package/dist/atmosphere/GradientSky.d.ts +40 -0
- package/dist/atmosphere/GradientSky.d.ts.map +1 -0
- package/dist/atmosphere/GradientSky.js +75 -0
- package/dist/atmosphere/GradientSky.js.map +1 -0
- package/dist/atmosphere/HeightFog.d.ts +154 -0
- package/dist/atmosphere/HeightFog.d.ts.map +1 -0
- package/dist/atmosphere/HeightFog.js +379 -0
- package/dist/atmosphere/HeightFog.js.map +1 -0
- package/dist/atmosphere/PreethamSky.d.ts +38 -0
- package/dist/atmosphere/PreethamSky.d.ts.map +1 -0
- package/dist/atmosphere/PreethamSky.js +150 -0
- package/dist/atmosphere/PreethamSky.js.map +1 -0
- package/dist/atmosphere/SkyBackgroundPass.d.ts +63 -0
- package/dist/atmosphere/SkyBackgroundPass.d.ts.map +1 -0
- package/dist/atmosphere/SkyBackgroundPass.js +233 -0
- package/dist/atmosphere/SkyBackgroundPass.js.map +1 -0
- package/dist/atmosphere/SkyCaptureAdapter.d.ts +45 -0
- package/dist/atmosphere/SkyCaptureAdapter.d.ts.map +1 -0
- package/dist/atmosphere/SkyCaptureAdapter.js +65 -0
- package/dist/atmosphere/SkyCaptureAdapter.js.map +1 -0
- package/dist/atmosphere/SkyEval.d.ts +56 -0
- package/dist/atmosphere/SkyEval.d.ts.map +1 -0
- package/dist/atmosphere/SkyEval.js +99 -0
- package/dist/atmosphere/SkyEval.js.map +1 -0
- package/dist/atmosphere/StarField.d.ts +26 -0
- package/dist/atmosphere/StarField.d.ts.map +1 -0
- package/dist/atmosphere/StarField.js +31 -0
- package/dist/atmosphere/StarField.js.map +1 -0
- package/dist/atmosphere/VolumetricFogPass.d.ts +69 -0
- package/dist/atmosphere/VolumetricFogPass.d.ts.map +1 -0
- package/dist/atmosphere/VolumetricFogPass.js +265 -0
- package/dist/atmosphere/VolumetricFogPass.js.map +1 -0
- package/dist/atmosphere/fogChunks.d.ts +8 -0
- package/dist/atmosphere/fogChunks.d.ts.map +1 -0
- package/dist/atmosphere/fogChunks.js +39 -0
- package/dist/atmosphere/fogChunks.js.map +1 -0
- package/dist/atmosphere/fogUniformStore.d.ts +20 -0
- package/dist/atmosphere/fogUniformStore.d.ts.map +1 -0
- package/dist/atmosphere/fogUniformStore.js +45 -0
- package/dist/atmosphere/fogUniformStore.js.map +1 -0
- package/dist/atmosphere/shaders/fog.glsl.d.ts +10 -0
- package/dist/atmosphere/shaders/fog.glsl.d.ts.map +1 -0
- package/dist/atmosphere/shaders/fog.glsl.js +161 -0
- package/dist/atmosphere/shaders/fog.glsl.js.map +1 -0
- package/dist/atmosphere/shaders/volumetric-apply.glsl.d.ts +3 -0
- package/dist/atmosphere/shaders/volumetric-apply.glsl.d.ts.map +1 -0
- package/dist/atmosphere/shaders/volumetric-apply.glsl.js +61 -0
- package/dist/atmosphere/shaders/volumetric-apply.glsl.js.map +1 -0
- package/dist/atmosphere/shaders/volumetric-inject.glsl.d.ts +4 -0
- package/dist/atmosphere/shaders/volumetric-inject.glsl.d.ts.map +1 -0
- package/dist/atmosphere/shaders/volumetric-inject.glsl.js +129 -0
- package/dist/atmosphere/shaders/volumetric-inject.glsl.js.map +1 -0
- package/dist/atmosphere/shaders/volumetric-integrate.glsl.d.ts +3 -0
- package/dist/atmosphere/shaders/volumetric-integrate.glsl.d.ts.map +1 -0
- package/dist/atmosphere/shaders/volumetric-integrate.glsl.js +55 -0
- package/dist/atmosphere/shaders/volumetric-integrate.glsl.js.map +1 -0
- package/dist/atmosphere/shaders/wetness.glsl.d.ts +34 -0
- package/dist/atmosphere/shaders/wetness.glsl.d.ts.map +1 -0
- package/dist/atmosphere/shaders/wetness.glsl.js +101 -0
- package/dist/atmosphere/shaders/wetness.glsl.js.map +1 -0
- package/dist/atmosphere/sky.glsl.d.ts +8 -0
- package/dist/atmosphere/sky.glsl.d.ts.map +1 -0
- package/dist/atmosphere/sky.glsl.js +249 -0
- package/dist/atmosphere/sky.glsl.js.map +1 -0
- package/dist/batching/BatchedGeometryPool.d.ts +72 -0
- package/dist/batching/BatchedGeometryPool.d.ts.map +1 -0
- package/dist/batching/BatchedGeometryPool.js +138 -0
- package/dist/batching/BatchedGeometryPool.js.map +1 -0
- package/dist/batching/ContentKeys.d.ts +29 -0
- package/dist/batching/ContentKeys.d.ts.map +1 -0
- package/dist/batching/ContentKeys.js +220 -0
- package/dist/batching/ContentKeys.js.map +1 -0
- package/dist/batching/DrawDataTexture.d.ts +51 -0
- package/dist/batching/DrawDataTexture.d.ts.map +1 -0
- package/dist/batching/DrawDataTexture.js +99 -0
- package/dist/batching/DrawDataTexture.js.map +1 -0
- package/dist/batching/MultiDrawBatch.d.ts +64 -0
- package/dist/batching/MultiDrawBatch.d.ts.map +1 -0
- package/dist/batching/MultiDrawBatch.js +103 -0
- package/dist/batching/MultiDrawBatch.js.map +1 -0
- package/dist/batching/StaticMergePlanner.d.ts +80 -0
- package/dist/batching/StaticMergePlanner.d.ts.map +1 -0
- package/dist/batching/StaticMergePlanner.js +323 -0
- package/dist/batching/StaticMergePlanner.js.map +1 -0
- package/dist/batching/index.d.ts +8 -0
- package/dist/batching/index.d.ts.map +1 -0
- package/dist/batching/index.js +8 -0
- package/dist/batching/index.js.map +1 -0
- package/dist/batching/shaders/drawId.glsl.d.ts +29 -0
- package/dist/batching/shaders/drawId.glsl.d.ts.map +1 -0
- package/dist/batching/shaders/drawId.glsl.js +93 -0
- package/dist/batching/shaders/drawId.glsl.js.map +1 -0
- package/dist/batching/shaders/instanceEmissive.glsl.d.ts +16 -0
- package/dist/batching/shaders/instanceEmissive.glsl.d.ts.map +1 -0
- package/dist/batching/shaders/instanceEmissive.glsl.js +63 -0
- package/dist/batching/shaders/instanceEmissive.glsl.js.map +1 -0
- package/dist/cinematic/BloomPass.d.ts +5 -9
- package/dist/cinematic/BloomPass.d.ts.map +1 -1
- package/dist/cinematic/BloomPass.js +5 -17
- package/dist/cinematic/BloomPass.js.map +1 -1
- package/dist/cinematic/DepthHazePass.d.ts +5 -11
- package/dist/cinematic/DepthHazePass.d.ts.map +1 -1
- package/dist/cinematic/DepthHazePass.js +5 -19
- package/dist/cinematic/DepthHazePass.js.map +1 -1
- package/dist/cinematic/FilmGrainPass.d.ts +5 -8
- package/dist/cinematic/FilmGrainPass.d.ts.map +1 -1
- package/dist/cinematic/FilmGrainPass.js +5 -16
- package/dist/cinematic/FilmGrainPass.js.map +1 -1
- package/dist/cinematic/VignettePass.d.ts +5 -9
- package/dist/cinematic/VignettePass.d.ts.map +1 -1
- package/dist/cinematic/VignettePass.js +5 -16
- package/dist/cinematic/VignettePass.js.map +1 -1
- package/dist/cinematic/index.d.ts +2 -1
- package/dist/cinematic/index.d.ts.map +1 -1
- package/dist/cinematic/index.js +1 -1
- package/dist/cinematic/index.js.map +1 -1
- package/dist/contracts/atmosphere.d.ts +30 -0
- package/dist/contracts/atmosphere.d.ts.map +1 -0
- package/dist/contracts/atmosphere.js +42 -0
- package/dist/contracts/atmosphere.js.map +1 -0
- package/dist/contracts/blend.d.ts +28 -0
- package/dist/contracts/blend.d.ts.map +1 -0
- package/dist/contracts/blend.js +73 -0
- package/dist/contracts/blend.js.map +1 -0
- package/dist/contracts/core.d.ts +47 -0
- package/dist/contracts/core.d.ts.map +1 -0
- package/dist/contracts/core.js +70 -0
- package/dist/contracts/core.js.map +1 -0
- package/dist/contracts/deform.d.ts +38 -0
- package/dist/contracts/deform.d.ts.map +1 -0
- package/dist/contracts/deform.js +14 -0
- package/dist/contracts/deform.js.map +1 -0
- package/dist/contracts/device.d.ts +71 -0
- package/dist/contracts/device.d.ts.map +1 -0
- package/dist/contracts/device.js +97 -0
- package/dist/contracts/device.js.map +1 -0
- package/dist/contracts/environment.d.ts +55 -0
- package/dist/contracts/environment.d.ts.map +1 -0
- package/dist/contracts/environment.js +115 -0
- package/dist/contracts/environment.js.map +1 -0
- package/dist/contracts/flags.state.d.ts +15 -0
- package/dist/contracts/flags.state.d.ts.map +1 -0
- package/dist/contracts/flags.state.js +45 -0
- package/dist/contracts/flags.state.js.map +1 -0
- package/dist/contracts/frameGraph.d.ts +78 -0
- package/dist/contracts/frameGraph.d.ts.map +1 -0
- package/dist/contracts/frameGraph.js +32 -0
- package/dist/contracts/frameGraph.js.map +1 -0
- package/dist/contracts/frameUniforms.d.ts +43 -0
- package/dist/contracts/frameUniforms.d.ts.map +1 -0
- package/dist/contracts/frameUniforms.js +35 -0
- package/dist/contracts/frameUniforms.js.map +1 -0
- package/dist/contracts/geometry.d.ts +33 -0
- package/dist/contracts/geometry.d.ts.map +1 -0
- package/dist/contracts/geometry.js +59 -0
- package/dist/contracts/geometry.js.map +1 -0
- package/dist/contracts/index.d.ts +27 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +27 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/materialLobes.d.ts +41 -0
- package/dist/contracts/materialLobes.d.ts.map +1 -0
- package/dist/contracts/materialLobes.js +14 -0
- package/dist/contracts/materialLobes.js.map +1 -0
- package/dist/contracts/output.d.ts +35 -0
- package/dist/contracts/output.d.ts.map +1 -0
- package/dist/contracts/output.js +18 -0
- package/dist/contracts/output.js.map +1 -0
- package/dist/contracts/particles.d.ts +41 -0
- package/dist/contracts/particles.d.ts.map +1 -0
- package/dist/contracts/particles.js +15 -0
- package/dist/contracts/particles.js.map +1 -0
- package/dist/contracts/post.d.ts +71 -0
- package/dist/contracts/post.d.ts.map +1 -0
- package/dist/contracts/post.js +28 -0
- package/dist/contracts/post.js.map +1 -0
- package/dist/contracts/program.d.ts +158 -0
- package/dist/contracts/program.d.ts.map +1 -0
- package/dist/contracts/program.js +128 -0
- package/dist/contracts/program.js.map +1 -0
- package/dist/contracts/quality.d.ts +93 -0
- package/dist/contracts/quality.d.ts.map +1 -0
- package/dist/contracts/quality.js +149 -0
- package/dist/contracts/quality.js.map +1 -0
- package/dist/contracts/renderItem.d.ts +58 -0
- package/dist/contracts/renderItem.d.ts.map +1 -0
- package/dist/contracts/renderItem.js +8 -0
- package/dist/contracts/renderItem.js.map +1 -0
- package/dist/contracts/renderSource.d.ts +63 -0
- package/dist/contracts/renderSource.d.ts.map +1 -0
- package/dist/contracts/renderSource.js +7 -0
- package/dist/contracts/renderSource.js.map +1 -0
- package/dist/contracts/rendererFactory.d.ts +42 -0
- package/dist/contracts/rendererFactory.d.ts.map +1 -0
- package/dist/contracts/rendererFactory.js +32 -0
- package/dist/contracts/rendererFactory.js.map +1 -0
- package/dist/contracts/sampling.d.ts +23 -0
- package/dist/contracts/sampling.d.ts.map +1 -0
- package/dist/contracts/sampling.js +17 -0
- package/dist/contracts/sampling.js.map +1 -0
- package/dist/contracts/shadows.d.ts +53 -0
- package/dist/contracts/shadows.d.ts.map +1 -0
- package/dist/contracts/shadows.js +66 -0
- package/dist/contracts/shadows.js.map +1 -0
- package/dist/contracts/testing/ChunkHarness.d.ts +18 -0
- package/dist/contracts/testing/ChunkHarness.d.ts.map +1 -0
- package/dist/contracts/testing/ChunkHarness.js +68 -0
- package/dist/contracts/testing/ChunkHarness.js.map +1 -0
- package/dist/contracts/textureFormats.d.ts +18 -0
- package/dist/contracts/textureFormats.d.ts.map +1 -0
- package/dist/contracts/textureFormats.js +13 -0
- package/dist/contracts/textureFormats.js.map +1 -0
- package/dist/contracts/velocity.d.ts +37 -0
- package/dist/contracts/velocity.d.ts.map +1 -0
- package/dist/contracts/velocity.js +22 -0
- package/dist/contracts/velocity.js.map +1 -0
- package/dist/effects/ResidentGPUParticleRenderer.d.ts.map +1 -1
- package/dist/effects/ResidentGPUParticleRenderer.js +10 -5
- package/dist/effects/ResidentGPUParticleRenderer.js.map +1 -1
- package/dist/environment/EnvUniforms.d.ts +42 -0
- package/dist/environment/EnvUniforms.d.ts.map +1 -0
- package/dist/environment/EnvUniforms.js +54 -0
- package/dist/environment/EnvUniforms.js.map +1 -0
- package/dist/environment/EnvironmentCache.d.ts +83 -0
- package/dist/environment/EnvironmentCache.d.ts.map +1 -0
- package/dist/environment/EnvironmentCache.js +205 -0
- package/dist/environment/EnvironmentCache.js.map +1 -0
- package/dist/environment/EnvironmentProbeFactory.d.ts +41 -0
- package/dist/environment/EnvironmentProbeFactory.d.ts.map +1 -0
- package/dist/environment/EnvironmentProbeFactory.js +52 -0
- package/dist/environment/EnvironmentProbeFactory.js.map +1 -0
- package/dist/environment/GPUPMREMGenerator.d.ts +44 -0
- package/dist/environment/GPUPMREMGenerator.d.ts.map +1 -0
- package/dist/environment/GPUPMREMGenerator.js +98 -0
- package/dist/environment/GPUPMREMGenerator.js.map +1 -0
- package/dist/environment/HdrEquirect.d.ts +28 -0
- package/dist/environment/HdrEquirect.d.ts.map +1 -0
- package/dist/environment/HdrEquirect.js +205 -0
- package/dist/environment/HdrEquirect.js.map +1 -0
- package/dist/environment/LightingSamplerBudget.d.ts +20 -0
- package/dist/environment/LightingSamplerBudget.d.ts.map +1 -0
- package/dist/environment/LightingSamplerBudget.js +94 -0
- package/dist/environment/LightingSamplerBudget.js.map +1 -0
- package/dist/environment/Prd02BackgroundShaderLibrary.d.ts +10 -0
- package/dist/environment/Prd02BackgroundShaderLibrary.d.ts.map +1 -0
- package/dist/environment/Prd02BackgroundShaderLibrary.js +100 -0
- package/dist/environment/Prd02BackgroundShaderLibrary.js.map +1 -0
- package/dist/environment/Rgb9e5Cube.d.ts +25 -0
- package/dist/environment/Rgb9e5Cube.d.ts.map +1 -0
- package/dist/environment/Rgb9e5Cube.js +103 -0
- package/dist/environment/Rgb9e5Cube.js.map +1 -0
- package/dist/environment/RoomEnvironmentScene.d.ts +57 -0
- package/dist/environment/RoomEnvironmentScene.d.ts.map +1 -0
- package/dist/environment/RoomEnvironmentScene.js +165 -0
- package/dist/environment/RoomEnvironmentScene.js.map +1 -0
- package/dist/environment/SphericalHarmonics.d.ts +32 -0
- package/dist/environment/SphericalHarmonics.d.ts.map +1 -0
- package/dist/environment/SphericalHarmonics.js +155 -0
- package/dist/environment/SphericalHarmonics.js.map +1 -0
- package/dist/environment/probeBuild.d.ts +97 -0
- package/dist/environment/probeBuild.d.ts.map +1 -0
- package/dist/environment/probeBuild.js +406 -0
- package/dist/environment/probeBuild.js.map +1 -0
- package/dist/environment/workers/cpuPrefilter.d.ts +58 -0
- package/dist/environment/workers/cpuPrefilter.d.ts.map +1 -0
- package/dist/environment/workers/cpuPrefilter.js +288 -0
- package/dist/environment/workers/cpuPrefilter.js.map +1 -0
- package/dist/forward/Deform.d.ts +56 -0
- package/dist/forward/Deform.d.ts.map +1 -0
- package/dist/forward/Deform.js +517 -0
- package/dist/forward/Deform.js.map +1 -0
- package/dist/forward/DrawSubmit.d.ts +32 -0
- package/dist/forward/DrawSubmit.d.ts.map +1 -0
- package/dist/forward/DrawSubmit.js +75 -0
- package/dist/forward/DrawSubmit.js.map +1 -0
- package/dist/forward/Lighting.d.ts +35 -0
- package/dist/forward/Lighting.d.ts.map +1 -0
- package/dist/forward/Lighting.js +477 -0
- package/dist/forward/Lighting.js.map +1 -0
- package/dist/forward/Transmission.d.ts +62 -0
- package/dist/forward/Transmission.d.ts.map +1 -0
- package/dist/forward/Transmission.js +299 -0
- package/dist/forward/Transmission.js.map +1 -0
- package/dist/forward/Velocity.d.ts +47 -0
- package/dist/forward/Velocity.d.ts.map +1 -0
- package/dist/forward/Velocity.js +153 -0
- package/dist/forward/Velocity.js.map +1 -0
- package/dist/forward/transmissionTargetStore.d.ts +21 -0
- package/dist/forward/transmissionTargetStore.d.ts.map +1 -0
- package/dist/forward/transmissionTargetStore.js +8 -0
- package/dist/forward/transmissionTargetStore.js.map +1 -0
- package/dist/geometry/Primitives.d.ts +28 -0
- package/dist/geometry/Primitives.d.ts.map +1 -0
- package/dist/geometry/Primitives.js +110 -0
- package/dist/geometry/Primitives.js.map +1 -0
- package/dist/index.d.ts +140 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +102 -52
- package/dist/index.js.map +1 -1
- package/dist/lanes/index.d.ts +17 -0
- package/dist/lanes/index.d.ts.map +1 -0
- package/dist/lanes/index.js +17 -0
- package/dist/lanes/index.js.map +1 -0
- package/dist/lanes/prd01.d.ts +6 -0
- package/dist/lanes/prd01.d.ts.map +1 -0
- package/dist/lanes/prd01.js +19 -0
- package/dist/lanes/prd01.js.map +1 -0
- package/dist/lanes/prd02.d.ts +62 -0
- package/dist/lanes/prd02.d.ts.map +1 -0
- package/dist/lanes/prd02.js +117 -0
- package/dist/lanes/prd02.js.map +1 -0
- package/dist/lanes/prd03.d.ts +19 -0
- package/dist/lanes/prd03.d.ts.map +1 -0
- package/dist/lanes/prd03.js +55 -0
- package/dist/lanes/prd03.js.map +1 -0
- package/dist/lanes/prd04.d.ts +22 -0
- package/dist/lanes/prd04.d.ts.map +1 -0
- package/dist/lanes/prd04.js +35 -0
- package/dist/lanes/prd04.js.map +1 -0
- package/dist/lanes/prd05.d.ts +4 -0
- package/dist/lanes/prd05.d.ts.map +1 -0
- package/dist/lanes/prd05.js +31 -0
- package/dist/lanes/prd05.js.map +1 -0
- package/dist/lanes/prd06.d.ts +33 -0
- package/dist/lanes/prd06.d.ts.map +1 -0
- package/dist/lanes/prd06.js +217 -0
- package/dist/lanes/prd06.js.map +1 -0
- package/dist/lanes/prd07.d.ts +49 -0
- package/dist/lanes/prd07.d.ts.map +1 -0
- package/dist/lanes/prd07.js +112 -0
- package/dist/lanes/prd07.js.map +1 -0
- package/dist/lanes/prd08.d.ts +2 -0
- package/dist/lanes/prd08.d.ts.map +1 -0
- package/dist/lanes/prd08.js +17 -0
- package/dist/lanes/prd08.js.map +1 -0
- package/dist/lanes/prd09.d.ts +6 -0
- package/dist/lanes/prd09.d.ts.map +1 -0
- package/dist/lanes/prd09.js +6 -0
- package/dist/lanes/prd09.js.map +1 -0
- package/dist/lanes/prd10.d.ts +2 -0
- package/dist/lanes/prd10.d.ts.map +1 -0
- package/dist/lanes/prd10.js +10 -0
- package/dist/lanes/prd10.js.map +1 -0
- package/dist/lanes/prd11.d.ts +61 -0
- package/dist/lanes/prd11.d.ts.map +1 -0
- package/dist/lanes/prd11.js +244 -0
- package/dist/lanes/prd11.js.map +1 -0
- package/dist/lanes/prd12.d.ts +6 -0
- package/dist/lanes/prd12.d.ts.map +1 -0
- package/dist/lanes/prd12.js +6 -0
- package/dist/lanes/prd12.js.map +1 -0
- package/dist/lanes/prd13.d.ts +6 -0
- package/dist/lanes/prd13.d.ts.map +1 -0
- package/dist/lanes/prd13.js +6 -0
- package/dist/lanes/prd13.js.map +1 -0
- package/dist/lanes/prd14.d.ts +6 -0
- package/dist/lanes/prd14.d.ts.map +1 -0
- package/dist/lanes/prd14.js +6 -0
- package/dist/lanes/prd14.js.map +1 -0
- package/dist/lanes/prd15.d.ts +6 -0
- package/dist/lanes/prd15.d.ts.map +1 -0
- package/dist/lanes/prd15.js +6 -0
- package/dist/lanes/prd15.js.map +1 -0
- package/dist/materials/PhysicalFeatures.d.ts +71 -0
- package/dist/materials/PhysicalFeatures.d.ts.map +1 -0
- package/dist/materials/PhysicalFeatures.js +255 -0
- package/dist/materials/PhysicalFeatures.js.map +1 -0
- package/dist/materials/PhysicalMaterial.d.ts +85 -0
- package/dist/materials/PhysicalMaterial.d.ts.map +1 -1
- package/dist/materials/PhysicalMaterial.js +21 -0
- package/dist/materials/PhysicalMaterial.js.map +1 -1
- package/dist/materials/features.d.ts +47 -0
- package/dist/materials/features.d.ts.map +1 -0
- package/dist/materials/features.js +282 -0
- package/dist/materials/features.js.map +1 -0
- package/dist/materials/lobes.d.ts +3 -0
- package/dist/materials/lobes.d.ts.map +1 -0
- package/dist/materials/lobes.js +225 -0
- package/dist/materials/lobes.js.map +1 -0
- package/dist/output/HdrTarget.d.ts +27 -0
- package/dist/output/HdrTarget.d.ts.map +1 -0
- package/dist/output/HdrTarget.js +48 -0
- package/dist/output/HdrTarget.js.map +1 -0
- package/dist/output/OutputPass.d.ts +28 -0
- package/dist/output/OutputPass.d.ts.map +1 -0
- package/dist/output/OutputPass.js +142 -0
- package/dist/output/OutputPass.js.map +1 -0
- package/dist/output/ToneMappingOperators.glsl.d.ts +22 -0
- package/dist/output/ToneMappingOperators.glsl.d.ts.map +1 -0
- package/dist/output/ToneMappingOperators.glsl.js +217 -0
- package/dist/output/ToneMappingOperators.glsl.js.map +1 -0
- package/dist/passes/ContactShadowPass.d.ts +57 -0
- package/dist/passes/ContactShadowPass.d.ts.map +1 -0
- package/dist/passes/ContactShadowPass.js +151 -0
- package/dist/passes/ContactShadowPass.js.map +1 -0
- package/dist/passes/Prd02ContactShadowsContributor.d.ts +16 -0
- package/dist/passes/Prd02ContactShadowsContributor.d.ts.map +1 -0
- package/dist/passes/Prd02ContactShadowsContributor.js +133 -0
- package/dist/passes/Prd02ContactShadowsContributor.js.map +1 -0
- package/dist/passes/Prd02SubFlags.d.ts +22 -0
- package/dist/passes/Prd02SubFlags.d.ts.map +1 -0
- package/dist/passes/Prd02SubFlags.js +32 -0
- package/dist/passes/Prd02SubFlags.js.map +1 -0
- package/dist/performance/BVH.d.ts +46 -0
- package/dist/performance/BVH.d.ts.map +1 -1
- package/dist/performance/BVH.js +212 -0
- package/dist/performance/BVH.js.map +1 -1
- package/dist/performance/Batcher.d.ts +11 -0
- package/dist/performance/Batcher.d.ts.map +1 -1
- package/dist/performance/Batcher.js +10 -0
- package/dist/performance/Batcher.js.map +1 -1
- package/dist/performance/FrustumCuller.d.ts +29 -0
- package/dist/performance/FrustumCuller.d.ts.map +1 -1
- package/dist/performance/FrustumCuller.js +78 -1
- package/dist/performance/FrustumCuller.js.map +1 -1
- package/dist/performance/LOD.d.ts +6 -0
- package/dist/performance/LOD.d.ts.map +1 -1
- package/dist/performance/LOD.js +12 -0
- package/dist/performance/LOD.js.map +1 -1
- package/dist/performance/RenderItemSorting.d.ts +2 -0
- package/dist/performance/RenderItemSorting.d.ts.map +1 -1
- package/dist/performance/RenderItemSorting.js +5 -1
- package/dist/performance/RenderItemSorting.js.map +1 -1
- package/dist/post/CubeLut.d.ts +15 -0
- package/dist/post/CubeLut.d.ts.map +1 -0
- package/dist/post/CubeLut.js +86 -0
- package/dist/post/CubeLut.js.map +1 -0
- package/dist/post/DisplayLutCache.d.ts +31 -0
- package/dist/post/DisplayLutCache.d.ts.map +1 -0
- package/dist/post/DisplayLutCache.js +44 -0
- package/dist/post/DisplayLutCache.js.map +1 -0
- package/dist/post/PostAntiAlias.d.ts +49 -0
- package/dist/post/PostAntiAlias.d.ts.map +1 -0
- package/dist/post/PostAntiAlias.js +75 -0
- package/dist/post/PostAntiAlias.js.map +1 -0
- package/dist/post/PostGraph.d.ts +206 -0
- package/dist/post/PostGraph.d.ts.map +1 -0
- package/dist/post/PostGraph.js +234 -0
- package/dist/post/PostGraph.js.map +1 -0
- package/dist/post/PostQualityTiers.d.ts +95 -0
- package/dist/post/PostQualityTiers.d.ts.map +1 -0
- package/dist/post/PostQualityTiers.js +62 -0
- package/dist/post/PostQualityTiers.js.map +1 -0
- package/dist/post/PostResources.d.ts +49 -0
- package/dist/post/PostResources.d.ts.map +1 -0
- package/dist/post/PostResources.js +124 -0
- package/dist/post/PostResources.js.map +1 -0
- package/dist/post/PostTimer.d.ts +37 -0
- package/dist/post/PostTimer.d.ts.map +1 -0
- package/dist/post/PostTimer.js +88 -0
- package/dist/post/PostTimer.js.map +1 -0
- package/dist/post/ScreenFeelPass.d.ts +83 -0
- package/dist/post/ScreenFeelPass.d.ts.map +1 -0
- package/dist/post/ScreenFeelPass.js +197 -0
- package/dist/post/ScreenFeelPass.js.map +1 -0
- package/dist/post/ToneOperators.d.ts +42 -0
- package/dist/post/ToneOperators.d.ts.map +1 -0
- package/dist/post/ToneOperators.js +179 -0
- package/dist/post/ToneOperators.js.map +1 -0
- package/dist/post/chunks/indirectFraction.glsl.d.ts +50 -0
- package/dist/post/chunks/indirectFraction.glsl.d.ts.map +1 -0
- package/dist/post/chunks/indirectFraction.glsl.js +82 -0
- package/dist/post/chunks/indirectFraction.glsl.js.map +1 -0
- package/dist/post/chunks/velocity.glsl.d.ts +35 -0
- package/dist/post/chunks/velocity.glsl.d.ts.map +1 -0
- package/dist/post/chunks/velocity.glsl.js +86 -0
- package/dist/post/chunks/velocity.glsl.js.map +1 -0
- package/dist/post/shaders/bloom.glsl.d.ts +21 -0
- package/dist/post/shaders/bloom.glsl.d.ts.map +1 -0
- package/dist/post/shaders/bloom.glsl.js +120 -0
- package/dist/post/shaders/bloom.glsl.js.map +1 -0
- package/dist/post/shaders/bloom.wgsl.d.ts +10 -0
- package/dist/post/shaders/bloom.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/bloom.wgsl.js +121 -0
- package/dist/post/shaders/bloom.wgsl.js.map +1 -0
- package/dist/post/shaders/common.glsl.d.ts +11 -0
- package/dist/post/shaders/common.glsl.d.ts.map +1 -0
- package/dist/post/shaders/common.glsl.js +34 -0
- package/dist/post/shaders/common.glsl.js.map +1 -0
- package/dist/post/shaders/common.wgsl.d.ts +25 -0
- package/dist/post/shaders/common.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/common.wgsl.js +48 -0
- package/dist/post/shaders/common.wgsl.js.map +1 -0
- package/dist/post/shaders/composite.glsl.d.ts +25 -0
- package/dist/post/shaders/composite.glsl.d.ts.map +1 -0
- package/dist/post/shaders/composite.glsl.js +96 -0
- package/dist/post/shaders/composite.glsl.js.map +1 -0
- package/dist/post/shaders/composite.wgsl.d.ts +10 -0
- package/dist/post/shaders/composite.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/composite.wgsl.js +92 -0
- package/dist/post/shaders/composite.wgsl.js.map +1 -0
- package/dist/post/shaders/depthDownsample.glsl.d.ts +20 -0
- package/dist/post/shaders/depthDownsample.glsl.d.ts.map +1 -0
- package/dist/post/shaders/depthDownsample.glsl.js +78 -0
- package/dist/post/shaders/depthDownsample.glsl.js.map +1 -0
- package/dist/post/shaders/depthDownsample.wgsl.d.ts +17 -0
- package/dist/post/shaders/depthDownsample.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/depthDownsample.wgsl.js +87 -0
- package/dist/post/shaders/depthDownsample.wgsl.js.map +1 -0
- package/dist/post/shaders/displayGrade.glsl.d.ts +18 -0
- package/dist/post/shaders/displayGrade.glsl.d.ts.map +1 -0
- package/dist/post/shaders/displayGrade.glsl.js +80 -0
- package/dist/post/shaders/displayGrade.glsl.js.map +1 -0
- package/dist/post/shaders/displayGrade.wgsl.d.ts +9 -0
- package/dist/post/shaders/displayGrade.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/displayGrade.wgsl.js +75 -0
- package/dist/post/shaders/displayGrade.wgsl.js.map +1 -0
- package/dist/post/shaders/dof.glsl.d.ts +25 -0
- package/dist/post/shaders/dof.glsl.d.ts.map +1 -0
- package/dist/post/shaders/dof.glsl.js +129 -0
- package/dist/post/shaders/dof.glsl.js.map +1 -0
- package/dist/post/shaders/dof.wgsl.d.ts +11 -0
- package/dist/post/shaders/dof.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/dof.wgsl.js +119 -0
- package/dist/post/shaders/dof.wgsl.js.map +1 -0
- package/dist/post/shaders/exposure.glsl.d.ts +43 -0
- package/dist/post/shaders/exposure.glsl.d.ts.map +1 -0
- package/dist/post/shaders/exposure.glsl.js +115 -0
- package/dist/post/shaders/exposure.glsl.js.map +1 -0
- package/dist/post/shaders/exposure.wgsl.d.ts +16 -0
- package/dist/post/shaders/exposure.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/exposure.wgsl.js +97 -0
- package/dist/post/shaders/exposure.wgsl.js.map +1 -0
- package/dist/post/shaders/finalize.glsl.d.ts +17 -0
- package/dist/post/shaders/finalize.glsl.d.ts.map +1 -0
- package/dist/post/shaders/finalize.glsl.js +120 -0
- package/dist/post/shaders/finalize.glsl.js.map +1 -0
- package/dist/post/shaders/finalize.wgsl.d.ts +13 -0
- package/dist/post/shaders/finalize.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/finalize.wgsl.js +124 -0
- package/dist/post/shaders/finalize.wgsl.js.map +1 -0
- package/dist/post/shaders/fxaa.glsl.d.ts +26 -0
- package/dist/post/shaders/fxaa.glsl.d.ts.map +1 -0
- package/dist/post/shaders/fxaa.glsl.js +246 -0
- package/dist/post/shaders/fxaa.glsl.js.map +1 -0
- package/dist/post/shaders/fxaa.wgsl.d.ts +17 -0
- package/dist/post/shaders/fxaa.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/fxaa.wgsl.js +268 -0
- package/dist/post/shaders/fxaa.wgsl.js.map +1 -0
- package/dist/post/shaders/godrays.glsl.d.ts +16 -0
- package/dist/post/shaders/godrays.glsl.d.ts.map +1 -0
- package/dist/post/shaders/godrays.glsl.js +70 -0
- package/dist/post/shaders/godrays.glsl.js.map +1 -0
- package/dist/post/shaders/godrays.wgsl.d.ts +8 -0
- package/dist/post/shaders/godrays.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/godrays.wgsl.js +60 -0
- package/dist/post/shaders/godrays.wgsl.js.map +1 -0
- package/dist/post/shaders/gtao.glsl.d.ts +29 -0
- package/dist/post/shaders/gtao.glsl.d.ts.map +1 -0
- package/dist/post/shaders/gtao.glsl.js +190 -0
- package/dist/post/shaders/gtao.glsl.js.map +1 -0
- package/dist/post/shaders/gtao.wgsl.d.ts +13 -0
- package/dist/post/shaders/gtao.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/gtao.wgsl.js +163 -0
- package/dist/post/shaders/gtao.wgsl.js.map +1 -0
- package/dist/post/shaders/gtaoDenoise.glsl.d.ts +22 -0
- package/dist/post/shaders/gtaoDenoise.glsl.d.ts.map +1 -0
- package/dist/post/shaders/gtaoDenoise.glsl.js +121 -0
- package/dist/post/shaders/gtaoDenoise.glsl.js.map +1 -0
- package/dist/post/shaders/gtaoDenoise.wgsl.d.ts +11 -0
- package/dist/post/shaders/gtaoDenoise.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/gtaoDenoise.wgsl.js +117 -0
- package/dist/post/shaders/gtaoDenoise.wgsl.js.map +1 -0
- package/dist/post/shaders/motionBlur.glsl.d.ts +21 -0
- package/dist/post/shaders/motionBlur.glsl.d.ts.map +1 -0
- package/dist/post/shaders/motionBlur.glsl.js +110 -0
- package/dist/post/shaders/motionBlur.glsl.js.map +1 -0
- package/dist/post/shaders/motionBlur.wgsl.d.ts +10 -0
- package/dist/post/shaders/motionBlur.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/motionBlur.wgsl.js +102 -0
- package/dist/post/shaders/motionBlur.wgsl.js.map +1 -0
- package/dist/post/shaders/smaa.glsl.d.ts +28 -0
- package/dist/post/shaders/smaa.glsl.d.ts.map +1 -0
- package/dist/post/shaders/smaa.glsl.js +354 -0
- package/dist/post/shaders/smaa.glsl.js.map +1 -0
- package/dist/post/shaders/smaa.wgsl.d.ts +20 -0
- package/dist/post/shaders/smaa.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/smaa.wgsl.js +375 -0
- package/dist/post/shaders/smaa.wgsl.js.map +1 -0
- package/dist/post/shaders/taa.glsl.d.ts +23 -0
- package/dist/post/shaders/taa.glsl.d.ts.map +1 -0
- package/dist/post/shaders/taa.glsl.js +169 -0
- package/dist/post/shaders/taa.glsl.js.map +1 -0
- package/dist/post/shaders/taa.wgsl.d.ts +10 -0
- package/dist/post/shaders/taa.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/taa.wgsl.js +185 -0
- package/dist/post/shaders/taa.wgsl.js.map +1 -0
- package/dist/post/shaders/velocityDilate.glsl.d.ts +16 -0
- package/dist/post/shaders/velocityDilate.glsl.d.ts.map +1 -0
- package/dist/post/shaders/velocityDilate.glsl.js +45 -0
- package/dist/post/shaders/velocityDilate.glsl.js.map +1 -0
- package/dist/post/shaders/velocityDilate.wgsl.d.ts +8 -0
- package/dist/post/shaders/velocityDilate.wgsl.d.ts.map +1 -0
- package/dist/post/shaders/velocityDilate.wgsl.js +30 -0
- package/dist/post/shaders/velocityDilate.wgsl.js.map +1 -0
- package/dist/post/smaa/textures.d.ts +17 -0
- package/dist/post/smaa/textures.d.ts.map +1 -0
- package/dist/post/smaa/textures.js +17 -0
- package/dist/post/smaa/textures.js.map +1 -0
- package/dist/post/v2Entry.d.ts +25 -0
- package/dist/post/v2Entry.d.ts.map +1 -0
- package/dist/post/v2Entry.js +28 -0
- package/dist/post/v2Entry.js.map +1 -0
- package/dist/post/v2Stages.d.ts +156 -0
- package/dist/post/v2Stages.d.ts.map +1 -0
- package/dist/post/v2Stages.js +1189 -0
- package/dist/post/v2Stages.js.map +1 -0
- package/dist/postprocess/EffectComposer.d.ts +6 -109
- package/dist/postprocess/EffectComposer.d.ts.map +1 -1
- package/dist/postprocess/EffectComposer.js +6 -246
- package/dist/postprocess/EffectComposer.js.map +1 -1
- package/dist/postprocess/NativeBloomPyramid.d.ts +34 -0
- package/dist/postprocess/NativeBloomPyramid.d.ts.map +1 -1
- package/dist/postprocess/NativeBloomPyramid.js +57 -0
- package/dist/postprocess/NativeBloomPyramid.js.map +1 -1
- package/dist/postprocess/SSAOPass.d.ts +5 -5
- package/dist/postprocess/SSAOPass.d.ts.map +1 -1
- package/dist/postprocess/SSAOPass.js +5 -17
- package/dist/postprocess/SSAOPass.js.map +1 -1
- package/dist/probes/IrradianceVolume.d.ts +45 -0
- package/dist/probes/IrradianceVolume.d.ts.map +1 -0
- package/dist/probes/IrradianceVolume.js +230 -0
- package/dist/probes/IrradianceVolume.js.map +1 -0
- package/dist/probes/LtcLuts.d.ts +30 -0
- package/dist/probes/LtcLuts.d.ts.map +1 -0
- package/dist/probes/LtcLuts.js +120 -0
- package/dist/probes/LtcLuts.js.map +1 -0
- package/dist/probes/Prd02ProbesContributor.d.ts +53 -0
- package/dist/probes/Prd02ProbesContributor.d.ts.map +1 -0
- package/dist/probes/Prd02ProbesContributor.js +241 -0
- package/dist/probes/Prd02ProbesContributor.js.map +1 -0
- package/dist/probes/ProbeBoxProjection.d.ts +53 -0
- package/dist/probes/ProbeBoxProjection.d.ts.map +1 -0
- package/dist/probes/ProbeBoxProjection.js +99 -0
- package/dist/probes/ProbeBoxProjection.js.map +1 -0
- package/dist/probes/ReflectionProbeSystem.d.ts +64 -0
- package/dist/probes/ReflectionProbeSystem.d.ts.map +1 -0
- package/dist/probes/ReflectionProbeSystem.js +157 -0
- package/dist/probes/ReflectionProbeSystem.js.map +1 -0
- package/dist/production-runtime/PBRHDRPipeline.d.ts.map +1 -1
- package/dist/production-runtime/PBRHDRPipeline.js +23 -9
- package/dist/production-runtime/PBRHDRPipeline.js.map +1 -1
- package/dist/production-runtime/ProductionRendererTypes.d.ts +16 -6
- package/dist/production-runtime/ProductionRendererTypes.d.ts.map +1 -1
- package/dist/production-runtime/ProductionRendererTypes.js.map +1 -1
- package/dist/production-runtime/ProductionWebGPURenderer.d.ts +4 -4
- package/dist/production-runtime/ProductionWebGPURenderer.d.ts.map +1 -1
- package/dist/production-runtime/ProductionWebGPURenderer.js +10 -45
- package/dist/production-runtime/ProductionWebGPURenderer.js.map +1 -1
- package/dist/production-runtime/backendSelection.d.ts +26 -0
- package/dist/production-runtime/backendSelection.d.ts.map +1 -0
- package/dist/production-runtime/backendSelection.js +46 -0
- package/dist/production-runtime/backendSelection.js.map +1 -0
- package/dist/production-runtime/backends/WebGL2RendererBackend.d.ts +1 -1
- package/dist/production-runtime/backends/WebGL2RendererBackend.d.ts.map +1 -1
- package/dist/production-runtime/backends/WebGL2RendererBackend.js +8 -4
- package/dist/production-runtime/backends/WebGL2RendererBackend.js.map +1 -1
- package/dist/production-runtime/backends/WebGPURendererBackend.d.ts +2 -19
- package/dist/production-runtime/backends/WebGPURendererBackend.d.ts.map +1 -1
- package/dist/production-runtime/backends/WebGPURendererBackend.js +2 -18
- package/dist/production-runtime/backends/WebGPURendererBackend.js.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Buffer.d.ts +2 -10
- package/dist/production-runtime/backends/webgl2/WebGL2Buffer.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Buffer.js +2 -7
- package/dist/production-runtime/backends/webgl2/WebGL2Buffer.js.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.d.ts +2 -10
- package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.js +2 -7
- package/dist/production-runtime/backends/webgl2/WebGL2Capabilities.js.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.d.ts +2 -10
- package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.js +2 -7
- package/dist/production-runtime/backends/webgl2/WebGL2RenderTarget.js.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Shader.d.ts +2 -10
- package/dist/production-runtime/backends/webgl2/WebGL2Shader.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Shader.js +2 -7
- package/dist/production-runtime/backends/webgl2/WebGL2Shader.js.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2StateCache.d.ts +1 -0
- package/dist/production-runtime/backends/webgl2/WebGL2StateCache.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2StateCache.js +1 -0
- package/dist/production-runtime/backends/webgl2/WebGL2StateCache.js.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Texture.d.ts +2 -10
- package/dist/production-runtime/backends/webgl2/WebGL2Texture.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgl2/WebGL2Texture.js +2 -7
- package/dist/production-runtime/backends/webgl2/WebGL2Texture.js.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUBuffer.d.ts +2 -10
- package/dist/production-runtime/backends/webgpu/WebGPUBuffer.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUBuffer.js +2 -7
- package/dist/production-runtime/backends/webgpu/WebGPUBuffer.js.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.d.ts +2 -10
- package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.js +2 -7
- package/dist/production-runtime/backends/webgpu/WebGPUCapabilities.js.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.d.ts +2 -10
- package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.js +2 -7
- package/dist/production-runtime/backends/webgpu/WebGPURenderTarget.js.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUShader.d.ts +2 -10
- package/dist/production-runtime/backends/webgpu/WebGPUShader.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUShader.js +2 -7
- package/dist/production-runtime/backends/webgpu/WebGPUShader.js.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUTexture.d.ts +2 -10
- package/dist/production-runtime/backends/webgpu/WebGPUTexture.d.ts.map +1 -1
- package/dist/production-runtime/backends/webgpu/WebGPUTexture.js +2 -7
- package/dist/production-runtime/backends/webgpu/WebGPUTexture.js.map +1 -1
- package/dist/production-runtime/index.d.ts +6 -6
- package/dist/production-runtime/index.d.ts.map +1 -1
- package/dist/production-runtime/index.js +9 -3
- package/dist/production-runtime/index.js.map +1 -1
- package/dist/production-runtime/materials/GLTFMaterialAdapter.d.ts +12 -13
- package/dist/production-runtime/materials/GLTFMaterialAdapter.d.ts.map +1 -1
- package/dist/production-runtime/materials/GLTFMaterialAdapter.js +10 -4
- package/dist/production-runtime/materials/GLTFMaterialAdapter.js.map +1 -1
- package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.d.ts +9 -2
- package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.d.ts.map +1 -1
- package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.js +7 -1
- package/dist/production-runtime/materials/GLTFPBRMaterialAdapter.js.map +1 -1
- package/dist/production-runtime/materials/MaterialCompiler.d.ts +10 -8
- package/dist/production-runtime/materials/MaterialCompiler.d.ts.map +1 -1
- package/dist/production-runtime/materials/MaterialCompiler.js +9 -4
- package/dist/production-runtime/materials/MaterialCompiler.js.map +1 -1
- package/dist/production-runtime/materials/PBRShaderFeatures.d.ts.map +1 -1
- package/dist/production-runtime/materials/PBRShaderFeatures.js +30 -1
- package/dist/production-runtime/materials/PBRShaderFeatures.js.map +1 -1
- package/dist/production-runtime/passes/ContactShadowPass.d.ts.map +1 -1
- package/dist/production-runtime/passes/ContactShadowPass.js +14 -13
- package/dist/production-runtime/passes/ContactShadowPass.js.map +1 -1
- package/dist/production-runtime/renderProofs.d.ts +54 -0
- package/dist/production-runtime/renderProofs.d.ts.map +1 -0
- package/dist/production-runtime/renderProofs.js +245 -0
- package/dist/production-runtime/renderProofs.js.map +1 -0
- package/dist/program/DFGLut.d.ts +23 -0
- package/dist/program/DFGLut.d.ts.map +1 -0
- package/dist/program/DFGLut.js +58 -0
- package/dist/program/DFGLut.js.map +1 -0
- package/dist/program/DFGLutData.d.ts +35 -0
- package/dist/program/DFGLutData.d.ts.map +1 -0
- package/dist/program/DFGLutData.js +52 -0
- package/dist/program/DFGLutData.js.map +1 -0
- package/dist/program/FeatureSelect.d.ts +35 -0
- package/dist/program/FeatureSelect.d.ts.map +1 -0
- package/dist/program/FeatureSelect.js +88 -0
- package/dist/program/FeatureSelect.js.map +1 -0
- package/dist/program/MaterialFeatures.d.ts +66 -0
- package/dist/program/MaterialFeatures.d.ts.map +1 -0
- package/dist/program/MaterialFeatures.js +242 -0
- package/dist/program/MaterialFeatures.js.map +1 -0
- package/dist/program/ProgramCache.d.ts +83 -0
- package/dist/program/ProgramCache.d.ts.map +1 -0
- package/dist/program/ProgramCache.js +194 -0
- package/dist/program/ProgramCache.js.map +1 -0
- package/dist/program/ProgramFeatures.d.ts +21 -0
- package/dist/program/ProgramFeatures.d.ts.map +1 -0
- package/dist/program/ProgramFeatures.js +95 -0
- package/dist/program/ProgramFeatures.js.map +1 -0
- package/dist/program/ProgramGenerator.d.ts +60 -0
- package/dist/program/ProgramGenerator.d.ts.map +1 -0
- package/dist/program/ProgramGenerator.js +760 -0
- package/dist/program/ProgramGenerator.js.map +1 -0
- package/dist/program/ProgramKey.d.ts +10 -0
- package/dist/program/ProgramKey.d.ts.map +1 -0
- package/dist/program/ProgramKey.js +13 -0
- package/dist/program/ProgramKey.js.map +1 -0
- package/dist/program/ProgramWarmup.d.ts +37 -0
- package/dist/program/ProgramWarmup.d.ts.map +1 -0
- package/dist/program/ProgramWarmup.js +68 -0
- package/dist/program/ProgramWarmup.js.map +1 -0
- package/dist/program/UniformLayout.d.ts +40 -0
- package/dist/program/UniformLayout.d.ts.map +1 -0
- package/dist/program/UniformLayout.js +105 -0
- package/dist/program/UniformLayout.js.map +1 -0
- package/dist/program/chunks/alpha.glsl.d.ts +7 -0
- package/dist/program/chunks/alpha.glsl.d.ts.map +1 -0
- package/dist/program/chunks/alpha.glsl.js +17 -0
- package/dist/program/chunks/alpha.glsl.js.map +1 -0
- package/dist/program/chunks/brdf.glsl.d.ts +12 -0
- package/dist/program/chunks/brdf.glsl.d.ts.map +1 -0
- package/dist/program/chunks/brdf.glsl.js +144 -0
- package/dist/program/chunks/brdf.glsl.js.map +1 -0
- package/dist/program/chunks/colorspace.glsl.d.ts +8 -0
- package/dist/program/chunks/colorspace.glsl.d.ts.map +1 -0
- package/dist/program/chunks/colorspace.glsl.js +16 -0
- package/dist/program/chunks/colorspace.glsl.js.map +1 -0
- package/dist/program/chunks/common.glsl.d.ts +7 -0
- package/dist/program/chunks/common.glsl.d.ts.map +1 -0
- package/dist/program/chunks/common.glsl.js +25 -0
- package/dist/program/chunks/common.glsl.js.map +1 -0
- package/dist/program/chunks/depth.glsl.d.ts +9 -0
- package/dist/program/chunks/depth.glsl.d.ts.map +1 -0
- package/dist/program/chunks/depth.glsl.js +18 -0
- package/dist/program/chunks/depth.glsl.js.map +1 -0
- package/dist/program/chunks/drawId.wgsl.d.ts +9 -0
- package/dist/program/chunks/drawId.wgsl.d.ts.map +1 -0
- package/dist/program/chunks/drawId.wgsl.js +29 -0
- package/dist/program/chunks/drawId.wgsl.js.map +1 -0
- package/dist/program/chunks/fog_default.glsl.d.ts +8 -0
- package/dist/program/chunks/fog_default.glsl.d.ts.map +1 -0
- package/dist/program/chunks/fog_default.glsl.js +31 -0
- package/dist/program/chunks/fog_default.glsl.js.map +1 -0
- package/dist/program/chunks/indirect_default.glsl.d.ts +29 -0
- package/dist/program/chunks/indirect_default.glsl.d.ts.map +1 -0
- package/dist/program/chunks/indirect_default.glsl.js +113 -0
- package/dist/program/chunks/indirect_default.glsl.js.map +1 -0
- package/dist/program/chunks/instanceEmissive.wgsl.d.ts +10 -0
- package/dist/program/chunks/instanceEmissive.wgsl.d.ts.map +1 -0
- package/dist/program/chunks/instanceEmissive.wgsl.js +21 -0
- package/dist/program/chunks/instanceEmissive.wgsl.js.map +1 -0
- package/dist/program/chunks/instancing.glsl.d.ts +8 -0
- package/dist/program/chunks/instancing.glsl.d.ts.map +1 -0
- package/dist/program/chunks/instancing.glsl.js +25 -0
- package/dist/program/chunks/instancing.glsl.js.map +1 -0
- package/dist/program/chunks/lights_legacy.glsl.d.ts +15 -0
- package/dist/program/chunks/lights_legacy.glsl.d.ts.map +1 -0
- package/dist/program/chunks/lights_legacy.glsl.js +95 -0
- package/dist/program/chunks/lights_legacy.glsl.js.map +1 -0
- package/dist/program/chunks/manifest.d.ts +42 -0
- package/dist/program/chunks/manifest.d.ts.map +1 -0
- package/dist/program/chunks/manifest.js +48 -0
- package/dist/program/chunks/manifest.js.map +1 -0
- package/dist/program/chunks/normal.glsl.d.ts +8 -0
- package/dist/program/chunks/normal.glsl.d.ts.map +1 -0
- package/dist/program/chunks/normal.glsl.js +34 -0
- package/dist/program/chunks/normal.glsl.js.map +1 -0
- package/dist/program/chunks/shadow_forward.glsl.d.ts +23 -0
- package/dist/program/chunks/shadow_forward.glsl.d.ts.map +1 -0
- package/dist/program/chunks/shadow_forward.glsl.js +73 -0
- package/dist/program/chunks/shadow_forward.glsl.js.map +1 -0
- package/dist/quality/DeviceClasses.d.ts +31 -0
- package/dist/quality/DeviceClasses.d.ts.map +1 -0
- package/dist/quality/DeviceClasses.js +83 -0
- package/dist/quality/DeviceClasses.js.map +1 -0
- package/dist/quality/DeviceProbe.d.ts +42 -0
- package/dist/quality/DeviceProbe.d.ts.map +1 -0
- package/dist/quality/DeviceProbe.js +83 -0
- package/dist/quality/DeviceProbe.js.map +1 -0
- package/dist/quality/FrameStats.d.ts +62 -0
- package/dist/quality/FrameStats.d.ts.map +1 -0
- package/dist/quality/FrameStats.js +220 -0
- package/dist/quality/FrameStats.js.map +1 -0
- package/dist/quality/PostprocessGuard.d.ts +49 -0
- package/dist/quality/PostprocessGuard.d.ts.map +1 -0
- package/dist/quality/PostprocessGuard.js +92 -0
- package/dist/quality/PostprocessGuard.js.map +1 -0
- package/dist/quality/QualityController.d.ts +93 -0
- package/dist/quality/QualityController.d.ts.map +1 -0
- package/dist/quality/QualityController.js +248 -0
- package/dist/quality/QualityController.js.map +1 -0
- package/dist/quality/QualityGovernor.d.ts +78 -0
- package/dist/quality/QualityGovernor.d.ts.map +1 -0
- package/dist/quality/QualityGovernor.js +170 -0
- package/dist/quality/QualityGovernor.js.map +1 -0
- package/dist/quality/QualityTier.d.ts +17 -0
- package/dist/quality/QualityTier.d.ts.map +1 -0
- package/dist/quality/QualityTier.js +23 -0
- package/dist/quality/QualityTier.js.map +1 -0
- package/dist/quality/RenderScaleController.d.ts +35 -0
- package/dist/quality/RenderScaleController.d.ts.map +1 -0
- package/dist/quality/RenderScaleController.js +57 -0
- package/dist/quality/RenderScaleController.js.map +1 -0
- package/dist/quality/RetentionPolicy.d.ts +11 -0
- package/dist/quality/RetentionPolicy.d.ts.map +1 -0
- package/dist/quality/RetentionPolicy.js +12 -0
- package/dist/quality/RetentionPolicy.js.map +1 -0
- package/dist/quality/TierResolver.d.ts +52 -0
- package/dist/quality/TierResolver.d.ts.map +1 -0
- package/dist/quality/TierResolver.js +155 -0
- package/dist/quality/TierResolver.js.map +1 -0
- package/dist/quality/liveTier.d.ts +23 -0
- package/dist/quality/liveTier.d.ts.map +1 -0
- package/dist/quality/liveTier.js +16 -0
- package/dist/quality/liveTier.js.map +1 -0
- package/dist/reference/BloomPass.d.ts +10 -0
- package/dist/reference/BloomPass.d.ts.map +1 -0
- package/dist/reference/BloomPass.js +18 -0
- package/dist/reference/BloomPass.js.map +1 -0
- package/dist/reference/DepthHazePass.d.ts +12 -0
- package/dist/reference/DepthHazePass.d.ts.map +1 -0
- package/dist/reference/DepthHazePass.js +20 -0
- package/dist/reference/DepthHazePass.js.map +1 -0
- package/dist/reference/EffectComposer.d.ts +110 -0
- package/dist/reference/EffectComposer.d.ts.map +1 -0
- package/dist/reference/EffectComposer.js +247 -0
- package/dist/reference/EffectComposer.js.map +1 -0
- package/dist/reference/FilmGrainPass.d.ts +9 -0
- package/dist/reference/FilmGrainPass.d.ts.map +1 -0
- package/dist/reference/FilmGrainPass.js +17 -0
- package/dist/reference/FilmGrainPass.js.map +1 -0
- package/dist/reference/PostProcessPass.d.ts +511 -0
- package/dist/reference/PostProcessPass.d.ts.map +1 -0
- package/dist/reference/PostProcessPass.js +2023 -0
- package/dist/reference/PostProcessPass.js.map +1 -0
- package/dist/reference/SSAOPass.d.ts +6 -0
- package/dist/reference/SSAOPass.d.ts.map +1 -0
- package/dist/reference/SSAOPass.js +18 -0
- package/dist/reference/SSAOPass.js.map +1 -0
- package/dist/reference/VignettePass.d.ts +10 -0
- package/dist/reference/VignettePass.d.ts.map +1 -0
- package/dist/reference/VignettePass.js +17 -0
- package/dist/reference/VignettePass.js.map +1 -0
- package/dist/reference/index.d.ts +15 -0
- package/dist/reference/index.d.ts.map +1 -0
- package/dist/reference/index.js +15 -0
- package/dist/reference/index.js.map +1 -0
- package/dist/renderer/Background.d.ts +49 -0
- package/dist/renderer/Background.d.ts.map +1 -0
- package/dist/renderer/Background.js +259 -0
- package/dist/renderer/Background.js.map +1 -0
- package/dist/renderer/CullingBatching.d.ts +55 -0
- package/dist/renderer/CullingBatching.d.ts.map +1 -0
- package/dist/renderer/CullingBatching.js +362 -0
- package/dist/renderer/CullingBatching.js.map +1 -0
- package/dist/renderer/DeviceLifecycle.d.ts +29 -0
- package/dist/renderer/DeviceLifecycle.d.ts.map +1 -0
- package/dist/renderer/DeviceLifecycle.js +48 -0
- package/dist/renderer/DeviceLifecycle.js.map +1 -0
- package/dist/renderer/FrameGraph.d.ts +96 -0
- package/dist/renderer/FrameGraph.d.ts.map +1 -0
- package/dist/renderer/FrameGraph.js +301 -0
- package/dist/renderer/FrameGraph.js.map +1 -0
- package/dist/renderer/InterleavedTransparentPass.d.ts +31 -0
- package/dist/renderer/InterleavedTransparentPass.d.ts.map +1 -0
- package/dist/renderer/InterleavedTransparentPass.js +65 -0
- package/dist/renderer/InterleavedTransparentPass.js.map +1 -0
- package/dist/renderer/PixelRatio.d.ts +64 -0
- package/dist/renderer/PixelRatio.d.ts.map +1 -0
- package/dist/renderer/PixelRatio.js +81 -0
- package/dist/renderer/PixelRatio.js.map +1 -0
- package/dist/renderer/PostprocessExecution.d.ts +82 -0
- package/dist/renderer/PostprocessExecution.d.ts.map +1 -0
- package/dist/renderer/PostprocessExecution.js +745 -0
- package/dist/renderer/PostprocessExecution.js.map +1 -0
- package/dist/renderer/Prd06ShaderWarmup.d.ts +32 -0
- package/dist/renderer/Prd06ShaderWarmup.d.ts.map +1 -0
- package/dist/renderer/Prd06ShaderWarmup.js +45 -0
- package/dist/renderer/Prd06ShaderWarmup.js.map +1 -0
- package/dist/renderer/RenderShared.d.ts +11 -0
- package/dist/renderer/RenderShared.d.ts.map +1 -0
- package/dist/renderer/RenderShared.js +47 -0
- package/dist/renderer/RenderShared.js.map +1 -0
- package/dist/renderer/RendererFactory.d.ts +3 -0
- package/dist/renderer/RendererFactory.d.ts.map +1 -0
- package/dist/renderer/RendererFactory.js +19 -0
- package/dist/renderer/RendererFactory.js.map +1 -0
- package/dist/renderer/RendererHost.d.ts +25 -0
- package/dist/renderer/RendererHost.d.ts.map +1 -0
- package/dist/renderer/RendererHost.js +4 -0
- package/dist/renderer/RendererHost.js.map +1 -0
- package/dist/renderer/SceneDepthCopyPass.d.ts +50 -0
- package/dist/renderer/SceneDepthCopyPass.d.ts.map +1 -0
- package/dist/renderer/SceneDepthCopyPass.js +124 -0
- package/dist/renderer/SceneDepthCopyPass.js.map +1 -0
- package/dist/renderer/ShadowOrchestration.d.ts +32 -0
- package/dist/renderer/ShadowOrchestration.d.ts.map +1 -0
- package/dist/renderer/ShadowOrchestration.js +491 -0
- package/dist/renderer/ShadowOrchestration.js.map +1 -0
- package/dist/renderer/SkinnedBounds.d.ts +6 -0
- package/dist/renderer/SkinnedBounds.d.ts.map +1 -0
- package/dist/renderer/SkinnedBounds.js +74 -0
- package/dist/renderer/SkinnedBounds.js.map +1 -0
- package/dist/renderer/coreOutputPostRoute.d.ts +40 -0
- package/dist/renderer/coreOutputPostRoute.d.ts.map +1 -0
- package/dist/renderer/coreOutputPostRoute.js +46 -0
- package/dist/renderer/coreOutputPostRoute.js.map +1 -0
- package/dist/renderer/postSkipped.d.ts +12 -0
- package/dist/renderer/postSkipped.d.ts.map +1 -0
- package/dist/renderer/postSkipped.js +54 -0
- package/dist/renderer/postSkipped.js.map +1 -0
- package/dist/renderer/qrSubFlags.d.ts +45 -0
- package/dist/renderer/qrSubFlags.d.ts.map +1 -0
- package/dist/renderer/qrSubFlags.js +130 -0
- package/dist/renderer/qrSubFlags.js.map +1 -0
- package/dist/resources/InstanceBuffer.d.ts +34 -0
- package/dist/resources/InstanceBuffer.d.ts.map +1 -0
- package/dist/resources/InstanceBuffer.js +96 -0
- package/dist/resources/InstanceBuffer.js.map +1 -0
- package/dist/resources/MorphTargetTexture.d.ts +53 -0
- package/dist/resources/MorphTargetTexture.d.ts.map +1 -0
- package/dist/resources/MorphTargetTexture.js +135 -0
- package/dist/resources/MorphTargetTexture.js.map +1 -0
- package/dist/resources/RenderTargetPool.d.ts +47 -0
- package/dist/resources/RenderTargetPool.d.ts.map +1 -0
- package/dist/resources/RenderTargetPool.js +122 -0
- package/dist/resources/RenderTargetPool.js.map +1 -0
- package/dist/resources/ResourceRegistry.d.ts +48 -0
- package/dist/resources/ResourceRegistry.d.ts.map +1 -0
- package/dist/resources/ResourceRegistry.js +95 -0
- package/dist/resources/ResourceRegistry.js.map +1 -0
- package/dist/resources/UniformBlock.d.ts +90 -0
- package/dist/resources/UniformBlock.d.ts.map +1 -0
- package/dist/resources/UniformBlock.js +184 -0
- package/dist/resources/UniformBlock.js.map +1 -0
- package/dist/shaders/camera-fade.glsl.d.ts +26 -0
- package/dist/shaders/camera-fade.glsl.d.ts.map +1 -0
- package/dist/shaders/camera-fade.glsl.js +109 -0
- package/dist/shaders/camera-fade.glsl.js.map +1 -0
- package/dist/shaders/chunks/contact_shadow.glsl.d.ts +12 -0
- package/dist/shaders/chunks/contact_shadow.glsl.d.ts.map +1 -0
- package/dist/shaders/chunks/contact_shadow.glsl.js +53 -0
- package/dist/shaders/chunks/contact_shadow.glsl.js.map +1 -0
- package/dist/shaders/chunks/lighting_ibl.glsl.d.ts +29 -0
- package/dist/shaders/chunks/lighting_ibl.glsl.d.ts.map +1 -0
- package/dist/shaders/chunks/lighting_ibl.glsl.js +122 -0
- package/dist/shaders/chunks/lighting_ibl.glsl.js.map +1 -0
- package/dist/shaders/chunks/lighting_mirrors.d.ts +18 -0
- package/dist/shaders/chunks/lighting_mirrors.d.ts.map +1 -0
- package/dist/shaders/chunks/lighting_mirrors.js +35 -0
- package/dist/shaders/chunks/lighting_mirrors.js.map +1 -0
- package/dist/shaders/chunks/lighting_punctual.glsl.d.ts +17 -0
- package/dist/shaders/chunks/lighting_punctual.glsl.d.ts.map +1 -0
- package/dist/shaders/chunks/lighting_punctual.glsl.js +197 -0
- package/dist/shaders/chunks/lighting_punctual.glsl.js.map +1 -0
- package/dist/shaders/chunks/sh9.glsl.d.ts +9 -0
- package/dist/shaders/chunks/sh9.glsl.d.ts.map +1 -0
- package/dist/shaders/chunks/sh9.glsl.js +41 -0
- package/dist/shaders/chunks/sh9.glsl.js.map +1 -0
- package/dist/shaders/chunks/shadow_caster.glsl.d.ts +10 -0
- package/dist/shaders/chunks/shadow_caster.glsl.d.ts.map +1 -0
- package/dist/shaders/chunks/shadow_caster.glsl.js +32 -0
- package/dist/shaders/chunks/shadow_caster.glsl.js.map +1 -0
- package/dist/shaders/chunks/shadow_receive.glsl.d.ts +13 -0
- package/dist/shaders/chunks/shadow_receive.glsl.d.ts.map +1 -0
- package/dist/shaders/chunks/shadow_receive.glsl.js +136 -0
- package/dist/shaders/chunks/shadow_receive.glsl.js.map +1 -0
- package/dist/shaders/debug-view.glsl.d.ts +18 -0
- package/dist/shaders/debug-view.glsl.d.ts.map +1 -0
- package/dist/shaders/debug-view.glsl.js +153 -0
- package/dist/shaders/debug-view.glsl.js.map +1 -0
- package/dist/shaders/deform/deform.glsl.d.ts +17 -0
- package/dist/shaders/deform/deform.glsl.d.ts.map +1 -0
- package/dist/shaders/deform/deform.glsl.js +99 -0
- package/dist/shaders/deform/deform.glsl.js.map +1 -0
- package/dist/shaders/deform/deform.wgsl.d.ts +15 -0
- package/dist/shaders/deform/deform.wgsl.d.ts.map +1 -0
- package/dist/shaders/deform/deform.wgsl.js +89 -0
- package/dist/shaders/deform/deform.wgsl.js.map +1 -0
- package/dist/shaders/deform/depthFeature.d.ts +22 -0
- package/dist/shaders/deform/depthFeature.d.ts.map +1 -0
- package/dist/shaders/deform/depthFeature.js +44 -0
- package/dist/shaders/deform/depthFeature.js.map +1 -0
- package/dist/shaders/deform/forwardFeature.d.ts +114 -0
- package/dist/shaders/deform/forwardFeature.d.ts.map +1 -0
- package/dist/shaders/deform/forwardFeature.js +300 -0
- package/dist/shaders/deform/forwardFeature.js.map +1 -0
- package/dist/shaders/deform/morph.glsl.d.ts +14 -0
- package/dist/shaders/deform/morph.glsl.d.ts.map +1 -0
- package/dist/shaders/deform/morph.glsl.js +45 -0
- package/dist/shaders/deform/morph.glsl.js.map +1 -0
- package/dist/shaders/deform/morph.wgsl.d.ts +21 -0
- package/dist/shaders/deform/morph.wgsl.d.ts.map +1 -0
- package/dist/shaders/deform/morph.wgsl.js +73 -0
- package/dist/shaders/deform/morph.wgsl.js.map +1 -0
- package/dist/shaders/deform/skinning.glsl.d.ts +8 -0
- package/dist/shaders/deform/skinning.glsl.d.ts.map +1 -0
- package/dist/shaders/deform/skinning.glsl.js +37 -0
- package/dist/shaders/deform/skinning.glsl.js.map +1 -0
- package/dist/shaders/deform/skinning.wgsl.d.ts +26 -0
- package/dist/shaders/deform/skinning.wgsl.d.ts.map +1 -0
- package/dist/shaders/deform/skinning.wgsl.js +58 -0
- package/dist/shaders/deform/skinning.wgsl.js.map +1 -0
- package/dist/shaders/deform/twins.d.ts +8 -0
- package/dist/shaders/deform/twins.d.ts.map +1 -0
- package/dist/shaders/deform/twins.js +20 -0
- package/dist/shaders/deform/twins.js.map +1 -0
- package/dist/shaders/lod-dither.glsl.d.ts +12 -0
- package/dist/shaders/lod-dither.glsl.d.ts.map +1 -0
- package/dist/shaders/lod-dither.glsl.js +101 -0
- package/dist/shaders/lod-dither.glsl.js.map +1 -0
- package/dist/shaders/physical/alpha_a2c.glsl.d.ts +19 -0
- package/dist/shaders/physical/alpha_a2c.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/alpha_a2c.glsl.js +29 -0
- package/dist/shaders/physical/alpha_a2c.glsl.js.map +1 -0
- package/dist/shaders/physical/anisotropy.glsl.d.ts +23 -0
- package/dist/shaders/physical/anisotropy.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/anisotropy.glsl.js +116 -0
- package/dist/shaders/physical/anisotropy.glsl.js.map +1 -0
- package/dist/shaders/physical/bsdf_lobes_common.glsl.d.ts +25 -0
- package/dist/shaders/physical/bsdf_lobes_common.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/bsdf_lobes_common.glsl.js +95 -0
- package/dist/shaders/physical/bsdf_lobes_common.glsl.js.map +1 -0
- package/dist/shaders/physical/clearcoat.glsl.d.ts +23 -0
- package/dist/shaders/physical/clearcoat.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/clearcoat.glsl.js +70 -0
- package/dist/shaders/physical/clearcoat.glsl.js.map +1 -0
- package/dist/shaders/physical/debug_view.glsl.d.ts +19 -0
- package/dist/shaders/physical/debug_view.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/debug_view.glsl.js +76 -0
- package/dist/shaders/physical/debug_view.glsl.js.map +1 -0
- package/dist/shaders/physical/dispersion.glsl.d.ts +18 -0
- package/dist/shaders/physical/dispersion.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/dispersion.glsl.js +67 -0
- package/dist/shaders/physical/dispersion.glsl.js.map +1 -0
- package/dist/shaders/physical/emissive_strength.glsl.d.ts +18 -0
- package/dist/shaders/physical/emissive_strength.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/emissive_strength.glsl.js +20 -0
- package/dist/shaders/physical/emissive_strength.glsl.js.map +1 -0
- package/dist/shaders/physical/index.d.ts +27 -0
- package/dist/shaders/physical/index.d.ts.map +1 -0
- package/dist/shaders/physical/index.js +69 -0
- package/dist/shaders/physical/index.js.map +1 -0
- package/dist/shaders/physical/iridescence.glsl.d.ts +25 -0
- package/dist/shaders/physical/iridescence.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/iridescence.glsl.js +186 -0
- package/dist/shaders/physical/iridescence.glsl.js.map +1 -0
- package/dist/shaders/physical/lobe_calls.glsl.d.ts +83 -0
- package/dist/shaders/physical/lobe_calls.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/lobe_calls.glsl.js +397 -0
- package/dist/shaders/physical/lobe_calls.glsl.js.map +1 -0
- package/dist/shaders/physical/sheen.glsl.d.ts +24 -0
- package/dist/shaders/physical/sheen.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/sheen.glsl.js +108 -0
- package/dist/shaders/physical/sheen.glsl.js.map +1 -0
- package/dist/shaders/physical/specular_ior.glsl.d.ts +20 -0
- package/dist/shaders/physical/specular_ior.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/specular_ior.glsl.js +64 -0
- package/dist/shaders/physical/specular_ior.glsl.js.map +1 -0
- package/dist/shaders/physical/tangent_frame.glsl.d.ts +27 -0
- package/dist/shaders/physical/tangent_frame.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/tangent_frame.glsl.js +71 -0
- package/dist/shaders/physical/tangent_frame.glsl.js.map +1 -0
- package/dist/shaders/physical/transmission.glsl.d.ts +25 -0
- package/dist/shaders/physical/transmission.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/transmission.glsl.js +204 -0
- package/dist/shaders/physical/transmission.glsl.js.map +1 -0
- package/dist/shaders/physical/transmission_copy.glsl.d.ts +15 -0
- package/dist/shaders/physical/transmission_copy.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/transmission_copy.glsl.js +33 -0
- package/dist/shaders/physical/transmission_copy.glsl.js.map +1 -0
- package/dist/shaders/physical/unlit.glsl.d.ts +17 -0
- package/dist/shaders/physical/unlit.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/unlit.glsl.js +19 -0
- package/dist/shaders/physical/unlit.glsl.js.map +1 -0
- package/dist/shaders/physical/uv_transform.glsl.d.ts +18 -0
- package/dist/shaders/physical/uv_transform.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/uv_transform.glsl.js +30 -0
- package/dist/shaders/physical/uv_transform.glsl.js.map +1 -0
- package/dist/shaders/physical/volume.glsl.d.ts +19 -0
- package/dist/shaders/physical/volume.glsl.d.ts.map +1 -0
- package/dist/shaders/physical/volume.glsl.js +47 -0
- package/dist/shaders/physical/volume.glsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.d.ts +8 -0
- package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.js +26 -0
- package/dist/shaders/physical-wgsl/alpha_a2c.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/anisotropy.wgsl.d.ts +10 -0
- package/dist/shaders/physical-wgsl/anisotropy.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/anisotropy.wgsl.js +97 -0
- package/dist/shaders/physical-wgsl/anisotropy.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.d.ts +11 -0
- package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.js +76 -0
- package/dist/shaders/physical-wgsl/bsdf_lobes_common.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/clearcoat.wgsl.d.ts +9 -0
- package/dist/shaders/physical-wgsl/clearcoat.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/clearcoat.wgsl.js +56 -0
- package/dist/shaders/physical-wgsl/clearcoat.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/debug_view.wgsl.d.ts +10 -0
- package/dist/shaders/physical-wgsl/debug_view.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/debug_view.wgsl.js +71 -0
- package/dist/shaders/physical-wgsl/debug_view.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/dispersion.wgsl.d.ts +10 -0
- package/dist/shaders/physical-wgsl/dispersion.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/dispersion.wgsl.js +51 -0
- package/dist/shaders/physical-wgsl/dispersion.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/emissive_strength.wgsl.d.ts +9 -0
- package/dist/shaders/physical-wgsl/emissive_strength.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/emissive_strength.wgsl.js +15 -0
- package/dist/shaders/physical-wgsl/emissive_strength.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/index.d.ts +35 -0
- package/dist/shaders/physical-wgsl/index.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/index.js +51 -0
- package/dist/shaders/physical-wgsl/index.js.map +1 -0
- package/dist/shaders/physical-wgsl/iridescence.wgsl.d.ts +9 -0
- package/dist/shaders/physical-wgsl/iridescence.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/iridescence.wgsl.js +162 -0
- package/dist/shaders/physical-wgsl/iridescence.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/sheen.wgsl.d.ts +9 -0
- package/dist/shaders/physical-wgsl/sheen.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/sheen.wgsl.js +85 -0
- package/dist/shaders/physical-wgsl/sheen.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/specular_ior.wgsl.d.ts +10 -0
- package/dist/shaders/physical-wgsl/specular_ior.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/specular_ior.wgsl.js +47 -0
- package/dist/shaders/physical-wgsl/specular_ior.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/tangent_frame.wgsl.d.ts +11 -0
- package/dist/shaders/physical-wgsl/tangent_frame.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/tangent_frame.wgsl.js +57 -0
- package/dist/shaders/physical-wgsl/tangent_frame.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/transmission.wgsl.d.ts +14 -0
- package/dist/shaders/physical-wgsl/transmission.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/transmission.wgsl.js +159 -0
- package/dist/shaders/physical-wgsl/transmission.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/unlit.wgsl.d.ts +8 -0
- package/dist/shaders/physical-wgsl/unlit.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/unlit.wgsl.js +13 -0
- package/dist/shaders/physical-wgsl/unlit.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/uv_transform.wgsl.d.ts +10 -0
- package/dist/shaders/physical-wgsl/uv_transform.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/uv_transform.wgsl.js +24 -0
- package/dist/shaders/physical-wgsl/uv_transform.wgsl.js.map +1 -0
- package/dist/shaders/physical-wgsl/volume.wgsl.d.ts +10 -0
- package/dist/shaders/physical-wgsl/volume.wgsl.d.ts.map +1 -0
- package/dist/shaders/physical-wgsl/volume.wgsl.js +35 -0
- package/dist/shaders/physical-wgsl/volume.wgsl.js.map +1 -0
- package/dist/shadows/DirectionalCascadeFitter.d.ts +97 -0
- package/dist/shadows/DirectionalCascadeFitter.d.ts.map +1 -0
- package/dist/shadows/DirectionalCascadeFitter.js +372 -0
- package/dist/shadows/DirectionalCascadeFitter.js.map +1 -0
- package/dist/shadows/Prd02DepthShaderLibrary.d.ts +77 -0
- package/dist/shadows/Prd02DepthShaderLibrary.d.ts.map +1 -0
- package/dist/shadows/Prd02DepthShaderLibrary.js +381 -0
- package/dist/shadows/Prd02DepthShaderLibrary.js.map +1 -0
- package/dist/shadows/Prd02ReceiveShadowContributor.d.ts +20 -0
- package/dist/shadows/Prd02ReceiveShadowContributor.d.ts.map +1 -0
- package/dist/shadows/Prd02ReceiveShadowContributor.js +20 -0
- package/dist/shadows/Prd02ReceiveShadowContributor.js.map +1 -0
- package/dist/shadows/Prd02ShadowBridge.d.ts +111 -0
- package/dist/shadows/Prd02ShadowBridge.d.ts.map +1 -0
- package/dist/shadows/Prd02ShadowBridge.js +267 -0
- package/dist/shadows/Prd02ShadowBridge.js.map +1 -0
- package/dist/shadows/Prd02ShadowFilter.d.ts +29 -0
- package/dist/shadows/Prd02ShadowFilter.d.ts.map +1 -0
- package/dist/shadows/Prd02ShadowFilter.js +35 -0
- package/dist/shadows/Prd02ShadowFilter.js.map +1 -0
- package/dist/shadows/Prd02ShadowsContributor.d.ts +44 -0
- package/dist/shadows/Prd02ShadowsContributor.d.ts.map +1 -0
- package/dist/shadows/Prd02ShadowsContributor.js +197 -0
- package/dist/shadows/Prd02ShadowsContributor.js.map +1 -0
- package/dist/shadows/ShadowAtlas.d.ts +59 -0
- package/dist/shadows/ShadowAtlas.d.ts.map +1 -0
- package/dist/shadows/ShadowAtlas.js +137 -0
- package/dist/shadows/ShadowAtlas.js.map +1 -0
- package/dist/shadows/ShadowDebugViews.d.ts +5 -0
- package/dist/shadows/ShadowDebugViews.d.ts.map +1 -1
- package/dist/shadows/ShadowDebugViews.js +15 -10
- package/dist/shadows/ShadowDebugViews.js.map +1 -1
- package/dist/shadows/ShadowFrameBinding.d.ts +18 -0
- package/dist/shadows/ShadowFrameBinding.d.ts.map +1 -0
- package/dist/shadows/ShadowFrameBinding.js +52 -0
- package/dist/shadows/ShadowFrameBinding.js.map +1 -0
- package/dist/shadows/ShadowSystem.d.ts +125 -0
- package/dist/shadows/ShadowSystem.d.ts.map +1 -0
- package/dist/shadows/ShadowSystem.js +293 -0
- package/dist/shadows/ShadowSystem.js.map +1 -0
- package/dist/textures/TextureBudget.d.ts +42 -0
- package/dist/textures/TextureBudget.d.ts.map +1 -0
- package/dist/textures/TextureBudget.js +180 -0
- package/dist/textures/TextureBudget.js.map +1 -0
- package/dist/vfx/BeamPass.d.ts +42 -0
- package/dist/vfx/BeamPass.d.ts.map +1 -0
- package/dist/vfx/BeamPass.js +249 -0
- package/dist/vfx/BeamPass.js.map +1 -0
- package/dist/vfx/BlendFallback.d.ts +19 -0
- package/dist/vfx/BlendFallback.d.ts.map +1 -0
- package/dist/vfx/BlendFallback.js +73 -0
- package/dist/vfx/BlendFallback.js.map +1 -0
- package/dist/vfx/DecalBatch.d.ts +120 -0
- package/dist/vfx/DecalBatch.d.ts.map +1 -0
- package/dist/vfx/DecalBatch.js +234 -0
- package/dist/vfx/DecalBatch.js.map +1 -0
- package/dist/vfx/DecalPass.d.ts +63 -0
- package/dist/vfx/DecalPass.d.ts.map +1 -0
- package/dist/vfx/DecalPass.js +159 -0
- package/dist/vfx/DecalPass.js.map +1 -0
- package/dist/vfx/LowResParticles.d.ts +31 -0
- package/dist/vfx/LowResParticles.d.ts.map +1 -0
- package/dist/vfx/LowResParticles.js +151 -0
- package/dist/vfx/LowResParticles.js.map +1 -0
- package/dist/vfx/MeshParticleBatch.d.ts +49 -0
- package/dist/vfx/MeshParticleBatch.d.ts.map +1 -0
- package/dist/vfx/MeshParticleBatch.js +184 -0
- package/dist/vfx/MeshParticleBatch.js.map +1 -0
- package/dist/vfx/MeshParticlePass.d.ts +28 -0
- package/dist/vfx/MeshParticlePass.d.ts.map +1 -0
- package/dist/vfx/MeshParticlePass.js +150 -0
- package/dist/vfx/MeshParticlePass.js.map +1 -0
- package/dist/vfx/ParticleBatchPass.d.ts +61 -0
- package/dist/vfx/ParticleBatchPass.d.ts.map +1 -0
- package/dist/vfx/ParticleBatchPass.js +320 -0
- package/dist/vfx/ParticleBatchPass.js.map +1 -0
- package/dist/vfx/ParticleGpuSim.d.ts +85 -0
- package/dist/vfx/ParticleGpuSim.d.ts.map +1 -0
- package/dist/vfx/ParticleGpuSim.js +301 -0
- package/dist/vfx/ParticleGpuSim.js.map +1 -0
- package/dist/vfx/ParticleInstanceLayout.d.ts +38 -0
- package/dist/vfx/ParticleInstanceLayout.d.ts.map +1 -0
- package/dist/vfx/ParticleInstanceLayout.js +105 -0
- package/dist/vfx/ParticleInstanceLayout.js.map +1 -0
- package/dist/vfx/ParticleSort.d.ts +21 -0
- package/dist/vfx/ParticleSort.d.ts.map +1 -0
- package/dist/vfx/ParticleSort.js +80 -0
- package/dist/vfx/ParticleSort.js.map +1 -0
- package/dist/vfx/ProceduralVolumeEmitter.d.ts +90 -0
- package/dist/vfx/ProceduralVolumeEmitter.d.ts.map +1 -0
- package/dist/vfx/ProceduralVolumeEmitter.js +155 -0
- package/dist/vfx/ProceduralVolumeEmitter.js.map +1 -0
- package/dist/vfx/RibbonBatch.d.ts +71 -0
- package/dist/vfx/RibbonBatch.d.ts.map +1 -0
- package/dist/vfx/RibbonBatch.js +234 -0
- package/dist/vfx/RibbonBatch.js.map +1 -0
- package/dist/vfx/RibbonPass.d.ts +21 -0
- package/dist/vfx/RibbonPass.d.ts.map +1 -0
- package/dist/vfx/RibbonPass.js +108 -0
- package/dist/vfx/RibbonPass.js.map +1 -0
- package/dist/vfx/SceneDepthAdapter.d.ts +28 -0
- package/dist/vfx/SceneDepthAdapter.d.ts.map +1 -0
- package/dist/vfx/SceneDepthAdapter.js +70 -0
- package/dist/vfx/SceneDepthAdapter.js.map +1 -0
- package/dist/vfx/VfxAtlas.d.ts +68 -0
- package/dist/vfx/VfxAtlas.d.ts.map +1 -0
- package/dist/vfx/VfxAtlas.js +106 -0
- package/dist/vfx/VfxAtlas.js.map +1 -0
- package/dist/vfx/contributors.d.ts +73 -0
- package/dist/vfx/contributors.d.ts.map +1 -0
- package/dist/vfx/contributors.js +615 -0
- package/dist/vfx/contributors.js.map +1 -0
- package/dist/vfx/decalLighting.d.ts +8 -0
- package/dist/vfx/decalLighting.d.ts.map +1 -0
- package/dist/vfx/decalLighting.js +53 -0
- package/dist/vfx/decalLighting.js.map +1 -0
- package/dist/vfx/depthSampler.d.ts +3 -0
- package/dist/vfx/depthSampler.d.ts.map +1 -0
- package/dist/vfx/depthSampler.js +10 -0
- package/dist/vfx/depthSampler.js.map +1 -0
- package/dist/vfx/prd07FeaturePars.d.ts +12 -0
- package/dist/vfx/prd07FeaturePars.d.ts.map +1 -0
- package/dist/vfx/prd07FeaturePars.js +54 -0
- package/dist/vfx/prd07FeaturePars.js.map +1 -0
- package/dist/vfx/shaders/beam.glsl.d.ts +11 -0
- package/dist/vfx/shaders/beam.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/beam.glsl.js +89 -0
- package/dist/vfx/shaders/beam.glsl.js.map +1 -0
- package/dist/vfx/shaders/decal.glsl.d.ts +14 -0
- package/dist/vfx/shaders/decal.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/decal.glsl.js +157 -0
- package/dist/vfx/shaders/decal.glsl.js.map +1 -0
- package/dist/vfx/shaders/gpu-sim.glsl.d.ts +5 -0
- package/dist/vfx/shaders/gpu-sim.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/gpu-sim.glsl.js +177 -0
- package/dist/vfx/shaders/gpu-sim.glsl.js.map +1 -0
- package/dist/vfx/shaders/lowresComposite.glsl.d.ts +9 -0
- package/dist/vfx/shaders/lowresComposite.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/lowresComposite.glsl.js +64 -0
- package/dist/vfx/shaders/lowresComposite.glsl.js.map +1 -0
- package/dist/vfx/shaders/mesh-particle.glsl.d.ts +4 -0
- package/dist/vfx/shaders/mesh-particle.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/mesh-particle.glsl.js +55 -0
- package/dist/vfx/shaders/mesh-particle.glsl.js.map +1 -0
- package/dist/vfx/shaders/particle.glsl.d.ts +24 -0
- package/dist/vfx/shaders/particle.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/particle.glsl.js +215 -0
- package/dist/vfx/shaders/particle.glsl.js.map +1 -0
- package/dist/vfx/shaders/ribbon.glsl.d.ts +9 -0
- package/dist/vfx/shaders/ribbon.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/ribbon.glsl.js +60 -0
- package/dist/vfx/shaders/ribbon.glsl.js.map +1 -0
- package/dist/vfx/shaders/volume.glsl.d.ts +5 -0
- package/dist/vfx/shaders/volume.glsl.d.ts.map +1 -0
- package/dist/vfx/shaders/volume.glsl.js +52 -0
- package/dist/vfx/shaders/volume.glsl.js.map +1 -0
- package/dist/webgl2/ContextLifecycle.d.ts +43 -0
- package/dist/webgl2/ContextLifecycle.d.ts.map +1 -0
- package/dist/webgl2/ContextLifecycle.js +189 -0
- package/dist/webgl2/ContextLifecycle.js.map +1 -0
- package/dist/webgl2/Counters.d.ts +58 -0
- package/dist/webgl2/Counters.d.ts.map +1 -0
- package/dist/webgl2/Counters.js +207 -0
- package/dist/webgl2/Counters.js.map +1 -0
- package/dist/webgl2/DeviceHost.d.ts +41 -0
- package/dist/webgl2/DeviceHost.d.ts.map +1 -0
- package/dist/webgl2/DeviceHost.js +3 -0
- package/dist/webgl2/DeviceHost.js.map +1 -0
- package/dist/webgl2/LegacyPost.d.ts +279 -0
- package/dist/webgl2/LegacyPost.d.ts.map +1 -0
- package/dist/webgl2/LegacyPost.js +2480 -0
- package/dist/webgl2/LegacyPost.js.map +1 -0
- package/dist/webgl2/MultiDraw.d.ts +96 -0
- package/dist/webgl2/MultiDraw.d.ts.map +1 -0
- package/dist/webgl2/MultiDraw.js +716 -0
- package/dist/webgl2/MultiDraw.js.map +1 -0
- package/dist/webgl2/Probe.d.ts +27 -0
- package/dist/webgl2/Probe.d.ts.map +1 -0
- package/dist/webgl2/Probe.js +329 -0
- package/dist/webgl2/Probe.js.map +1 -0
- package/dist/webgl2/Samplers.d.ts +20 -0
- package/dist/webgl2/Samplers.d.ts.map +1 -0
- package/dist/webgl2/Samplers.js +179 -0
- package/dist/webgl2/Samplers.js.map +1 -0
- package/dist/webgl2/TextureFormats.d.ts +48 -0
- package/dist/webgl2/TextureFormats.d.ts.map +1 -0
- package/dist/webgl2/TextureFormats.js +185 -0
- package/dist/webgl2/TextureFormats.js.map +1 -0
- package/dist/webgl2/TextureUpload.d.ts +38 -0
- package/dist/webgl2/TextureUpload.d.ts.map +1 -0
- package/dist/webgl2/TextureUpload.js +346 -0
- package/dist/webgl2/TextureUpload.js.map +1 -0
- package/dist/webgpu/WebGPUBuffer.d.ts +1 -0
- package/dist/webgpu/WebGPUBuffer.d.ts.map +1 -1
- package/dist/webgpu/WebGPUCompute.d.ts +1 -0
- package/dist/webgpu/WebGPUCompute.d.ts.map +1 -1
- package/dist/webgpu/WebGPUCompute.js +1 -0
- package/dist/webgpu/WebGPUCompute.js.map +1 -1
- package/dist/webgpu/WebGPUPipelineCache.d.ts +4 -0
- package/dist/webgpu/WebGPUPipelineCache.d.ts.map +1 -1
- package/dist/webgpu/WebGPUPipelineCache.js +4 -0
- package/dist/webgpu/WebGPUPipelineCache.js.map +1 -1
- package/dist/webgpu/WebGPUPostShaders.d.ts.map +1 -1
- package/dist/webgpu/WebGPUPostShaders.js +33 -2
- package/dist/webgpu/WebGPUPostShaders.js.map +1 -1
- package/dist/webgpu/WebGPUTexture.d.ts +1 -0
- package/dist/webgpu/WebGPUTexture.d.ts.map +1 -1
- package/dist/webgpu/WebGPUTexture.js.map +1 -1
- package/dist/world/chunks.d.ts +15 -0
- package/dist/world/chunks.d.ts.map +1 -0
- package/dist/world/chunks.js +56 -0
- package/dist/world/chunks.js.map +1 -0
- package/dist/world/index.d.ts +38 -0
- package/dist/world/index.d.ts.map +1 -0
- package/dist/world/index.js +39 -0
- package/dist/world/index.js.map +1 -0
- package/dist/world/shared/shaders/worldLightFallback.d.ts +12 -0
- package/dist/world/shared/shaders/worldLightFallback.d.ts.map +1 -0
- package/dist/world/shared/shaders/worldLightFallback.js +82 -0
- package/dist/world/shared/shaders/worldLightFallback.js.map +1 -0
- package/dist/world/space/PlanetMaterial.d.ts +24 -0
- package/dist/world/space/PlanetMaterial.d.ts.map +1 -0
- package/dist/world/space/PlanetMaterial.js +82 -0
- package/dist/world/space/PlanetMaterial.js.map +1 -0
- package/dist/world/space/SpaceSkyBake.d.ts +46 -0
- package/dist/world/space/SpaceSkyBake.d.ts.map +1 -0
- package/dist/world/space/SpaceSkyBake.js +145 -0
- package/dist/world/space/SpaceSkyBake.js.map +1 -0
- package/dist/world/space/shaders/planet.d.ts +8 -0
- package/dist/world/space/shaders/planet.d.ts.map +1 -0
- package/dist/world/space/shaders/planet.js +55 -0
- package/dist/world/space/shaders/planet.js.map +1 -0
- package/dist/world/space/shaders/spaceBake.d.ts +9 -0
- package/dist/world/space/shaders/spaceBake.d.ts.map +1 -0
- package/dist/world/space/shaders/spaceBake.js +102 -0
- package/dist/world/space/shaders/spaceBake.js.map +1 -0
- package/dist/world/terrain/SplatBake.d.ts +76 -0
- package/dist/world/terrain/SplatBake.d.ts.map +1 -0
- package/dist/world/terrain/SplatBake.js +308 -0
- package/dist/world/terrain/SplatBake.js.map +1 -0
- package/dist/world/terrain/TerrainCdlod.d.ts +67 -0
- package/dist/world/terrain/TerrainCdlod.d.ts.map +1 -0
- package/dist/world/terrain/TerrainCdlod.js +115 -0
- package/dist/world/terrain/TerrainCdlod.js.map +1 -0
- package/dist/world/terrain/TerrainHeightTexture.d.ts +44 -0
- package/dist/world/terrain/TerrainHeightTexture.d.ts.map +1 -0
- package/dist/world/terrain/TerrainHeightTexture.js +173 -0
- package/dist/world/terrain/TerrainHeightTexture.js.map +1 -0
- package/dist/world/terrain/TerrainPatchGeometry.d.ts +18 -0
- package/dist/world/terrain/TerrainPatchGeometry.d.ts.map +1 -0
- package/dist/world/terrain/TerrainPatchGeometry.js +40 -0
- package/dist/world/terrain/TerrainPatchGeometry.js.map +1 -0
- package/dist/world/terrain/shaders/terrain.vert.glsl.d.ts +19 -0
- package/dist/world/terrain/shaders/terrain.vert.glsl.d.ts.map +1 -0
- package/dist/world/terrain/shaders/terrain.vert.glsl.js +162 -0
- package/dist/world/terrain/shaders/terrain.vert.glsl.js.map +1 -0
- package/dist/world/terrain/shaders/terrainCdlod.d.ts +23 -0
- package/dist/world/terrain/shaders/terrainCdlod.d.ts.map +1 -0
- package/dist/world/terrain/shaders/terrainCdlod.js +110 -0
- package/dist/world/terrain/shaders/terrainCdlod.js.map +1 -0
- package/dist/world/terrain/shaders/terrainSplat.d.ts +26 -0
- package/dist/world/terrain/shaders/terrainSplat.d.ts.map +1 -0
- package/dist/world/terrain/shaders/terrainSplat.js +181 -0
- package/dist/world/terrain/shaders/terrainSplat.js.map +1 -0
- package/dist/world/vegetation/FoliageMaterial.d.ts +14 -0
- package/dist/world/vegetation/FoliageMaterial.d.ts.map +1 -0
- package/dist/world/vegetation/FoliageMaterial.js +107 -0
- package/dist/world/vegetation/FoliageMaterial.js.map +1 -0
- package/dist/world/vegetation/GrassField.d.ts +43 -0
- package/dist/world/vegetation/GrassField.d.ts.map +1 -0
- package/dist/world/vegetation/GrassField.js +68 -0
- package/dist/world/vegetation/GrassField.js.map +1 -0
- package/dist/world/vegetation/ImpostorMaterial.d.ts +20 -0
- package/dist/world/vegetation/ImpostorMaterial.d.ts.map +1 -0
- package/dist/world/vegetation/ImpostorMaterial.js +80 -0
- package/dist/world/vegetation/ImpostorMaterial.js.map +1 -0
- package/dist/world/vegetation/InstanceChunkGrid.d.ts +67 -0
- package/dist/world/vegetation/InstanceChunkGrid.d.ts.map +1 -0
- package/dist/world/vegetation/InstanceChunkGrid.js +150 -0
- package/dist/world/vegetation/InstanceChunkGrid.js.map +1 -0
- package/dist/world/vegetation/WindCpu.d.ts +19 -0
- package/dist/world/vegetation/WindCpu.d.ts.map +1 -0
- package/dist/world/vegetation/WindCpu.js +43 -0
- package/dist/world/vegetation/WindCpu.js.map +1 -0
- package/dist/world/vegetation/WindField.d.ts +42 -0
- package/dist/world/vegetation/WindField.d.ts.map +1 -0
- package/dist/world/vegetation/WindField.js +154 -0
- package/dist/world/vegetation/WindField.js.map +1 -0
- package/dist/world/vegetation/shaders/foliage.d.ts +8 -0
- package/dist/world/vegetation/shaders/foliage.d.ts.map +1 -0
- package/dist/world/vegetation/shaders/foliage.js +104 -0
- package/dist/world/vegetation/shaders/foliage.js.map +1 -0
- package/dist/world/vegetation/shaders/grass.d.ts +10 -0
- package/dist/world/vegetation/shaders/grass.d.ts.map +1 -0
- package/dist/world/vegetation/shaders/grass.js +79 -0
- package/dist/world/vegetation/shaders/grass.js.map +1 -0
- package/dist/world/vegetation/shaders/impostor.d.ts +9 -0
- package/dist/world/vegetation/shaders/impostor.d.ts.map +1 -0
- package/dist/world/vegetation/shaders/impostor.js +97 -0
- package/dist/world/vegetation/shaders/impostor.js.map +1 -0
- package/dist/world/vegetation/shaders/wind.d.ts +9 -0
- package/dist/world/vegetation/shaders/wind.d.ts.map +1 -0
- package/dist/world/vegetation/shaders/wind.js +103 -0
- package/dist/world/vegetation/shaders/wind.js.map +1 -0
- package/dist/world/water/GerstnerWaves.d.ts +65 -0
- package/dist/world/water/GerstnerWaves.d.ts.map +1 -0
- package/dist/world/water/GerstnerWaves.js +182 -0
- package/dist/world/water/GerstnerWaves.js.map +1 -0
- package/dist/world/water/ReflectionViewPass.d.ts +46 -0
- package/dist/world/water/ReflectionViewPass.d.ts.map +1 -0
- package/dist/world/water/ReflectionViewPass.js +85 -0
- package/dist/world/water/ReflectionViewPass.js.map +1 -0
- package/dist/world/water/SceneCopyFallback.d.ts +21 -0
- package/dist/world/water/SceneCopyFallback.d.ts.map +1 -0
- package/dist/world/water/SceneCopyFallback.js +150 -0
- package/dist/world/water/SceneCopyFallback.js.map +1 -0
- package/dist/world/water/UnderwaterState.d.ts +25 -0
- package/dist/world/water/UnderwaterState.d.ts.map +1 -0
- package/dist/world/water/UnderwaterState.js +134 -0
- package/dist/world/water/UnderwaterState.js.map +1 -0
- package/dist/world/water/WaterMaterial.d.ts +23 -0
- package/dist/world/water/WaterMaterial.d.ts.map +1 -0
- package/dist/world/water/WaterMaterial.js +129 -0
- package/dist/world/water/WaterMaterial.js.map +1 -0
- package/dist/world/water/shaders/caustics.d.ts +13 -0
- package/dist/world/water/shaders/caustics.d.ts.map +1 -0
- package/dist/world/water/shaders/caustics.js +103 -0
- package/dist/world/water/shaders/caustics.js.map +1 -0
- package/dist/world/water/shaders/gerstner.d.ts +9 -0
- package/dist/world/water/shaders/gerstner.d.ts.map +1 -0
- package/dist/world/water/shaders/gerstner.js +100 -0
- package/dist/world/water/shaders/gerstner.js.map +1 -0
- package/dist/world/water/shaders/water.d.ts +12 -0
- package/dist/world/water/shaders/water.d.ts.map +1 -0
- package/dist/world/water/shaders/water.js +112 -0
- package/dist/world/water/shaders/water.js.map +1 -0
- package/package.json +32 -11
- package/dist/ArchitecturalMaterialCatalog.d.ts +0 -30
- package/dist/ArchitecturalMaterialCatalog.d.ts.map +0 -1
- package/dist/ArchitecturalMaterialCatalog.js +0 -90
- package/dist/ArchitecturalMaterialCatalog.js.map +0 -1
- package/dist/LeanWebGL2Device.d.ts +0 -265
- package/dist/LeanWebGL2Device.d.ts.map +0 -1
- package/dist/LeanWebGL2Device.js +0 -4001
- package/dist/LeanWebGL2Device.js.map +0 -1
- package/dist/advanced-runtime/AdvancedRenderer.d.ts +0 -23
- package/dist/advanced-runtime/AdvancedRenderer.d.ts.map +0 -1
- package/dist/advanced-runtime/AdvancedRenderer.js +0 -45
- package/dist/advanced-runtime/AdvancedRenderer.js.map +0 -1
- package/dist/animation/AnimationMaterialStyle.d.ts +0 -19
- package/dist/animation/AnimationMaterialStyle.d.ts.map +0 -1
- package/dist/animation/AnimationMaterialStyle.js +0 -13
- package/dist/animation/AnimationMaterialStyle.js.map +0 -1
- package/dist/cinematic/CinematicMaterialPresets.d.ts +0 -16
- package/dist/cinematic/CinematicMaterialPresets.d.ts.map +0 -1
- package/dist/cinematic/CinematicMaterialPresets.js +0 -114
- package/dist/cinematic/CinematicMaterialPresets.js.map +0 -1
- package/dist/lean/LeanProductRenderer.d.ts +0 -29
- package/dist/lean/LeanProductRenderer.d.ts.map +0 -1
- package/dist/lean/LeanProductRenderer.js +0 -38
- package/dist/lean/LeanProductRenderer.js.map +0 -1
- package/dist/lean/LeanProductionRenderer.d.ts +0 -38
- package/dist/lean/LeanProductionRenderer.d.ts.map +0 -1
- package/dist/lean/LeanProductionRenderer.js +0 -88
- package/dist/lean/LeanProductionRenderer.js.map +0 -1
- package/dist/lean-core-runtime.d.ts +0 -13
- package/dist/lean-core-runtime.d.ts.map +0 -1
- package/dist/lean-core-runtime.js +0 -10
- package/dist/lean-core-runtime.js.map +0 -1
- package/dist/lean-runtime.d.ts +0 -18
- package/dist/lean-runtime.d.ts.map +0 -1
- package/dist/lean-runtime.js +0 -13
- package/dist/lean-runtime.js.map +0 -1
- package/dist/materials/TransmissionPass.d.ts +0 -16
- package/dist/materials/TransmissionPass.d.ts.map +0 -1
- package/dist/materials/TransmissionPass.js +0 -30
- package/dist/materials/TransmissionPass.js.map +0 -1
- package/dist/production-runtime/ProductionEffectsPipeline.d.ts +0 -20
- package/dist/production-runtime/ProductionEffectsPipeline.d.ts.map +0 -1
- package/dist/production-runtime/ProductionEffectsPipeline.js +0 -65
- package/dist/production-runtime/ProductionEffectsPipeline.js.map +0 -1
- package/dist/production-runtime/ProductionRuntimeRenderer.d.ts +0 -44
- package/dist/production-runtime/ProductionRuntimeRenderer.d.ts.map +0 -1
- package/dist/production-runtime/ProductionRuntimeRenderer.js +0 -179
- package/dist/production-runtime/ProductionRuntimeRenderer.js.map +0 -1
- package/dist/production-runtime/ProductionWebGL2Renderer.d.ts +0 -65
- package/dist/production-runtime/ProductionWebGL2Renderer.d.ts.map +0 -1
- package/dist/production-runtime/ProductionWebGL2Renderer.js +0 -305
- package/dist/production-runtime/ProductionWebGL2Renderer.js.map +0 -1
- package/dist/threejs-example-parity/index.d.ts +0 -57
- package/dist/threejs-example-parity/index.d.ts.map +0 -1
- package/dist/threejs-example-parity/index.js +0 -139
- package/dist/threejs-example-parity/index.js.map +0 -1
|
@@ -0,0 +1,2480 @@
|
|
|
1
|
+
// PR 0b-2 carve-out (CONTRACTS.md §3.3) — verbatim move from WebGL2Device.ts; 0 changed logic lines.
|
|
2
|
+
import { invertSsrProjection } from "../ProjectionMath.js";
|
|
3
|
+
import { RenderDeviceError, resolveGpuTargetOwner } from "../RenderDevice.js";
|
|
4
|
+
import { temporalAccumulationWeight } from "../TemporalMath.js";
|
|
5
|
+
import { WebGL2RenderTarget } from "../WebGL2Device.js";
|
|
6
|
+
import { normalizeBloomQualityPreset, resolveBloomPyramidBlurRadii, resolveBloomPyramidPlan, resolveBloomPyramidResponseGain, resolveBloomPyramidV2Response } from "../postprocess/NativeBloomPyramid.js";
|
|
7
|
+
import { BLOOM_BRIGHT_LUT_HEIGHT, BLOOM_BRIGHT_LUT_WIDTH, BLOOM_COMPOSITE_LUT_SIZE, OUTLINE_BLEND_LUT_WIDTH, OUTLINE_LIMB_RADIX, createBloomBrightThresholdLut, createBloomCompositeLut, createOutlineBlendLut, createOutlineGradientBound } from "../postprocess/NativeLdrEffectLuts.js";
|
|
8
|
+
// PRD-03 Phase 1 — the r185 FXAA finalize (post/shaders/fxaa.glsl.ts). The
|
|
9
|
+
// split is opt-in via `fxaa: { variant: "r185" }`; the legacy in-shader
|
|
10
|
+
// `u_hasFxaa` taps stay the default path.
|
|
11
|
+
import { FXAA_185_FRAGMENT_GLSL } from "../post/shaders/fxaa.glsl.js";
|
|
12
|
+
import { recordPostSkipped } from "../renderer/postSkipped.js";
|
|
13
|
+
export class WebGL2LegacyPostPipeline {
|
|
14
|
+
host;
|
|
15
|
+
constructor(host) {
|
|
16
|
+
this.host = host;
|
|
17
|
+
}
|
|
18
|
+
bloomAccumulateProgram = null;
|
|
19
|
+
bloomBlurProgram = null;
|
|
20
|
+
bloomBrightExtractProgram = null;
|
|
21
|
+
bloomBrightLutTexture = null;
|
|
22
|
+
bloomBrightLutThreshold = null;
|
|
23
|
+
bloomCompositeLutIntensity = null;
|
|
24
|
+
bloomCompositeLutShoulder = null;
|
|
25
|
+
bloomCompositeLutTexture = null;
|
|
26
|
+
bloomCompositeProgram = null;
|
|
27
|
+
bloomDownsampleProgram = null;
|
|
28
|
+
bloomPingPongResources = null;
|
|
29
|
+
bloomPyramidResources = null;
|
|
30
|
+
depthOfFieldProgram = null;
|
|
31
|
+
lastBloomDiagnostics = null;
|
|
32
|
+
ldrPostprocessProgram = null;
|
|
33
|
+
motionBlurProgram = null;
|
|
34
|
+
nativeFxaaFinalizeProgram = null;
|
|
35
|
+
motionBlurVelocitySize = null;
|
|
36
|
+
motionBlurVelocityTexture = null;
|
|
37
|
+
outlineBlendLutKey = null;
|
|
38
|
+
outlineBlendLutTexture = null;
|
|
39
|
+
outlineProgram = null;
|
|
40
|
+
presentationProgram = null;
|
|
41
|
+
presentationVertexArray = null;
|
|
42
|
+
ssaoProgram = null;
|
|
43
|
+
ssrProgram = null;
|
|
44
|
+
taaHistorySize = null;
|
|
45
|
+
taaHistoryTexture = null;
|
|
46
|
+
taaPresentationProgram = null;
|
|
47
|
+
taaProgram = null;
|
|
48
|
+
presentRenderTarget(source) {
|
|
49
|
+
this.host.lifecycle.assertAlive();
|
|
50
|
+
if (!(source instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(source) || source.disposed) {
|
|
51
|
+
throw new RenderDeviceError("Render target is not a live WebGL2 resource owned by this device", "INVALID_RESOURCE", {
|
|
52
|
+
targetId: source.id
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
this.host.resolveMultisampleTarget(source);
|
|
56
|
+
const outputWidth = this.host.lifecycle.viewportWidth || this.host.gl.drawingBufferWidth;
|
|
57
|
+
const outputHeight = this.host.lifecycle.viewportHeight || this.host.gl.drawingBufferHeight;
|
|
58
|
+
this.drawRenderTargetToBackbuffer(source, outputWidth, outputHeight);
|
|
59
|
+
this.host.activeRenderTarget = null;
|
|
60
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, null);
|
|
61
|
+
this.host.lifecycle.lastError = this.host.lifecycle.readError();
|
|
62
|
+
if (this.host.lifecycle.lastError) {
|
|
63
|
+
throw new RenderDeviceError(`WebGL2 render-target presentation failed: ${this.host.lifecycle.lastError}`, "WEBGL_PRESENT_FAILED", {
|
|
64
|
+
targetId: source.id,
|
|
65
|
+
error: this.host.lifecycle.lastError
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
executeReflectionSurfaceSsr(source, normalMask, output, options) {
|
|
70
|
+
this.host.lifecycle.assertAlive();
|
|
71
|
+
for (const target of [source, normalMask, output]) {
|
|
72
|
+
if (!(target instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(target) || target.disposed) {
|
|
73
|
+
throw new RenderDeviceError("SSR inputs must be live targets owned by this device", "INVALID_RESOURCE");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const color = source, normals = normalMask, destination = output;
|
|
77
|
+
if (!color.depthTextureHandle || color === destination || normals === destination
|
|
78
|
+
|| color.width !== normals.width || color.height !== normals.height) {
|
|
79
|
+
throw new RenderDeviceError("SSR requires sampleable scene depth, matching normal-mask input, and a separate output", "INVALID_RESOURCE");
|
|
80
|
+
}
|
|
81
|
+
this.host.resolveMultisampleTarget(color);
|
|
82
|
+
this.host.resolveMultisampleTarget(normals);
|
|
83
|
+
const state = this.prepareFullscreenPresentation(destination.framebuffer, destination.width, destination.height);
|
|
84
|
+
try {
|
|
85
|
+
this.drawSsrKernel(color.colorHandle, color.depthTextureHandle, destination.width, destination.height, { ...options, normalMask: normals.colorHandle }, this.ensurePresentationVertexArray(), { near: 0.1, far: 1000 });
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
this.restoreFullscreenPresentationState(state, destination.width, destination.height);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
presentLdrPostprocess(source, options) {
|
|
92
|
+
this.host.lifecycle.assertAlive();
|
|
93
|
+
if (!(source instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(source) || source.disposed) {
|
|
94
|
+
throw new RenderDeviceError("Render target is not a live WebGL2 resource owned by this device", "INVALID_RESOURCE", {
|
|
95
|
+
targetId: source.id
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
this.host.resolveMultisampleTarget(source);
|
|
99
|
+
const tonePass = options.passes.find((pass) => pass.name === "tone-mapping");
|
|
100
|
+
const bloomPass = options.passes.find((pass) => pass.name === "bloom");
|
|
101
|
+
const depthOfFieldPass = options.passes.find((pass) => pass.name === "depth-of-field");
|
|
102
|
+
const motionBlurPass = options.passes.find((pass) => pass.name === "motion-blur");
|
|
103
|
+
const ssaoPass = options.passes.find((pass) => pass.name === "ssao");
|
|
104
|
+
const ssrPass = options.passes.find((pass) => pass.name === "ssr");
|
|
105
|
+
const taaPass = options.passes.find((pass) => pass.name === "taa");
|
|
106
|
+
const outlinePass = options.passes.find((pass) => pass.name === "outline");
|
|
107
|
+
if (source.colorTexture.format !== "rgba8" && !tonePass) {
|
|
108
|
+
throw new RenderDeviceError("WebGL2 HDR postprocess presentation requires a tone-mapping pass before LDR output.", "WEBGL_LDR_POSTPROCESS_FORMAT_UNSUPPORTED", {
|
|
109
|
+
targetId: source.id,
|
|
110
|
+
format: source.colorTexture.format
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (source.colorTexture.format !== "rgba8" && (depthOfFieldPass || motionBlurPass || ssaoPass || ssrPass || taaPass || outlinePass) && !tonePass) {
|
|
114
|
+
throw new RenderDeviceError("WebGL2 byte-kernel postprocess requires rgba8 input or a preceding tone-mapping pass.", "WEBGL_LDR_POSTPROCESS_FORMAT_UNSUPPORTED", {
|
|
115
|
+
targetId: source.id,
|
|
116
|
+
format: source.colorTexture.format,
|
|
117
|
+
pass: depthOfFieldPass ? "depth-of-field" : motionBlurPass ? "motion-blur" : ssaoPass ? "ssao" : ssrPass ? "ssr" : taaPass ? "taa" : "outline"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if ((depthOfFieldPass || ssaoPass || ssrPass) && !source.depthTextureHandle) {
|
|
121
|
+
throw new RenderDeviceError("WebGL2 native depth postprocess requires a renderer-owned sampleable depth texture.", "WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED", {
|
|
122
|
+
targetId: source.id,
|
|
123
|
+
pass: depthOfFieldPass ? "depth-of-field" : ssaoPass ? "ssao" : "ssr"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// Raw GL depth is nonlinear (0.1/1000 defaults park the play area past
|
|
127
|
+
// 0.97), which blinded every depth-gated native pass. SSR and DOF compare
|
|
128
|
+
// linearized depth; SSAO keeps its legacy response (documented partial).
|
|
129
|
+
const depthRange = normalizeLdrDepthRange(options.depthRange);
|
|
130
|
+
const outputTarget = options.outputTarget;
|
|
131
|
+
if (outputTarget && (!(outputTarget instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(outputTarget) || outputTarget.disposed)) {
|
|
132
|
+
throw new RenderDeviceError("Output render target is not a live WebGL2 resource owned by this device", "INVALID_RESOURCE", {
|
|
133
|
+
targetId: outputTarget.id
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (outputTarget && outputTarget.colorTexture.format !== "rgba8") {
|
|
137
|
+
throw new RenderDeviceError("WebGL2 LDR postprocess output target must be rgba8.", "WEBGL_LDR_POSTPROCESS_OUTPUT_FORMAT_UNSUPPORTED", {
|
|
138
|
+
targetId: outputTarget.id,
|
|
139
|
+
format: outputTarget.colorTexture.format
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (outputTarget && (outputTarget.width !== source.width || outputTarget.height !== source.height)) {
|
|
143
|
+
throw new RenderDeviceError("WebGL2 LDR postprocess source and output dimensions must match.", "WEBGL_LDR_POSTPROCESS_SIZE_MISMATCH", {
|
|
144
|
+
sourceWidth: source.width,
|
|
145
|
+
sourceHeight: source.height,
|
|
146
|
+
targetWidth: outputTarget.width,
|
|
147
|
+
targetHeight: outputTarget.height
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const webglOutputTarget = outputTarget;
|
|
151
|
+
const colorPass = options.passes.find((pass) => pass.name === "color-grade");
|
|
152
|
+
const fxaaPass = options.passes.find((pass) => pass.name === "fxaa");
|
|
153
|
+
const bloomOptions = bloomPass ? normalizeNativeBloomOptions(bloomPass.options) : undefined;
|
|
154
|
+
const depthOfFieldOptions = depthOfFieldPass ? normalizeNativeDepthOfFieldOptions(depthOfFieldPass.options) : undefined;
|
|
155
|
+
const motionBlurOptions = motionBlurPass
|
|
156
|
+
? normalizeNativeMotionBlurOptions(motionBlurPass.options, source.width, source.height)
|
|
157
|
+
: undefined;
|
|
158
|
+
const ssaoOptions = ssaoPass ? normalizeNativeSsaoOptions(ssaoPass.options) : undefined;
|
|
159
|
+
const ssrOptions = ssrPass ? normalizeNativeSsrOptions(ssrPass.options) : undefined;
|
|
160
|
+
const taaOptions = taaPass ? normalizeNativeTaaOptions(taaPass.options, source.width, source.height) : undefined;
|
|
161
|
+
const outlineOptions = outlinePass ? normalizeNativeOutlineOptions(outlinePass.options) : undefined;
|
|
162
|
+
const program = this.ensureLdrPostprocessProgram();
|
|
163
|
+
const vertexArray = this.ensurePresentationVertexArray();
|
|
164
|
+
const sourceIsHdr = source.colorTexture.format !== "rgba8";
|
|
165
|
+
// PRD-03 Phase 1: `fxaa.variant === "r185"` splits the finalize — the
|
|
166
|
+
// legacy stage presents tone/grade into an RGBA8 intermediate and the
|
|
167
|
+
// dedicated r185 FXAA + triangular-dither program writes the output, so
|
|
168
|
+
// the FXAA taps no longer re-run `finalColorAt` per tap.
|
|
169
|
+
const fxaaSplit = fxaaPass?.options?.variant === "r185";
|
|
170
|
+
const bloomResources = bloomOptions || depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions || fxaaSplit
|
|
171
|
+
? this.ensureBloomPingPongResources(source.width, source.height, sourceIsHdr && Boolean(bloomOptions))
|
|
172
|
+
: undefined;
|
|
173
|
+
if (bloomOptions && !sourceIsHdr) {
|
|
174
|
+
this.ensureBloomLutTextures(bloomOptions);
|
|
175
|
+
}
|
|
176
|
+
if (outlineOptions) {
|
|
177
|
+
this.ensureOutlineBlendLutTexture(outlineOptions);
|
|
178
|
+
}
|
|
179
|
+
if (motionBlurOptions?.velocity) {
|
|
180
|
+
this.ensureMotionBlurVelocityTexture(source.width, source.height, motionBlurOptions.velocity);
|
|
181
|
+
}
|
|
182
|
+
if (taaOptions?.history) {
|
|
183
|
+
this.ensureTaaHistoryTexture(source.width, source.height, taaOptions.history);
|
|
184
|
+
}
|
|
185
|
+
const outputWidth = webglOutputTarget?.width ?? (this.host.lifecycle.viewportWidth || this.host.gl.drawingBufferWidth);
|
|
186
|
+
const outputHeight = webglOutputTarget?.height ?? (this.host.lifecycle.viewportHeight || this.host.gl.drawingBufferHeight);
|
|
187
|
+
const previousState = this.prepareFullscreenPresentation(webglOutputTarget?.framebuffer ?? null, outputWidth, outputHeight);
|
|
188
|
+
try {
|
|
189
|
+
let ldrSourceHandle = source.colorHandle;
|
|
190
|
+
let temporarySourceIndex = -1;
|
|
191
|
+
if (bloomOptions && bloomResources) {
|
|
192
|
+
if (bloomOptions.quality === "performance") {
|
|
193
|
+
ldrSourceHandle = this.executeNativeBloomPasses(ldrSourceHandle, bloomResources, bloomOptions, vertexArray, sourceIsHdr);
|
|
194
|
+
temporarySourceIndex = 1;
|
|
195
|
+
this.recordBloomDiagnostics(bloomOptions, source.width, source.height, sourceIsHdr, 1);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const plan = resolveBloomPyramidPlan(source.width, source.height, bloomOptions.quality, sourceIsHdr);
|
|
199
|
+
const pyramid = this.ensureBloomPyramidResources(plan, sourceIsHdr);
|
|
200
|
+
const pyramidResult = this.executeNativeBloomPyramidPasses(ldrSourceHandle, source.width, source.height, pyramid, {
|
|
201
|
+
textureA: bloomResources.textures[0],
|
|
202
|
+
framebufferA: bloomResources.framebuffers[0],
|
|
203
|
+
textureB: bloomResources.textures[1],
|
|
204
|
+
framebufferB: bloomResources.framebuffers[1]
|
|
205
|
+
}, bloomOptions, vertexArray, sourceIsHdr);
|
|
206
|
+
// The pyramid sum lands in ping-pong texture A; composite it with the
|
|
207
|
+
// source through the proven single-scale composite program.
|
|
208
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, bloomResources.framebuffers[1]);
|
|
209
|
+
this.host.gl.viewport(0, 0, source.width, source.height);
|
|
210
|
+
const pyramidComposite = this.ensureBloomCompositeProgram();
|
|
211
|
+
this.host.gl.useProgram(pyramidComposite);
|
|
212
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
213
|
+
this.bindFullscreenTexture(0, ldrSourceHandle);
|
|
214
|
+
this.bindFullscreenTexture(1, pyramidResult);
|
|
215
|
+
if (this.bloomCompositeLutTexture)
|
|
216
|
+
this.bindFullscreenTexture(2, this.bloomCompositeLutTexture);
|
|
217
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_source"), 0);
|
|
218
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_blurred"), 1);
|
|
219
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_compositeLut"), 2);
|
|
220
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(pyramidComposite, "u_hdr"), sourceIsHdr ? 1 : 0);
|
|
221
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(pyramidComposite, "u_intensity"), bloomOptions.intensity * nativeBloomResponseGain(plan, bloomOptions));
|
|
222
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
223
|
+
ldrSourceHandle = bloomResources.textures[1];
|
|
224
|
+
// `temporarySourceIndex` names the ping-pong slot that HOLDS the
|
|
225
|
+
// current source (every later pass writes the other slot). The
|
|
226
|
+
// composite lives in texture B, so the index is 1. It was 0, which
|
|
227
|
+
// made the next pass (r185 FXAA split under A3D_QR_POST, ssao, ...)
|
|
228
|
+
// write framebuffer B while sampling texture B — a WebGL feedback
|
|
229
|
+
// loop (GL_INVALID_OPERATION 0x502, WEBGL_LDR_POSTPROCESS_FAILED).
|
|
230
|
+
temporarySourceIndex = 1;
|
|
231
|
+
this.recordBloomDiagnostics(bloomOptions, source.width, source.height, sourceIsHdr, plan.mipCount);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if ((depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions) && bloomResources) {
|
|
235
|
+
if (tonePass || colorPass) {
|
|
236
|
+
const baseTargetIndex = 0;
|
|
237
|
+
this.drawNativeLdrStage(ldrSourceHandle, bloomResources.framebuffers[baseTargetIndex], source.width, source.height, program, vertexArray, tonePass, colorPass, undefined, options.toneMappingDefaults);
|
|
238
|
+
ldrSourceHandle = bloomResources.textures[baseTargetIndex];
|
|
239
|
+
temporarySourceIndex = baseTargetIndex;
|
|
240
|
+
}
|
|
241
|
+
if (depthOfFieldOptions && source.depthTextureHandle) {
|
|
242
|
+
const depthOfFieldTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
243
|
+
ldrSourceHandle = this.executeNativeDepthOfFieldPass(ldrSourceHandle, source.depthTextureHandle, bloomResources, depthOfFieldOptions, vertexArray, depthOfFieldTargetIndex, depthRange);
|
|
244
|
+
temporarySourceIndex = depthOfFieldTargetIndex;
|
|
245
|
+
}
|
|
246
|
+
if (motionBlurOptions) {
|
|
247
|
+
const motionBlurTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
248
|
+
ldrSourceHandle = this.executeNativeMotionBlurPass(ldrSourceHandle, bloomResources, motionBlurOptions, vertexArray, motionBlurTargetIndex);
|
|
249
|
+
temporarySourceIndex = motionBlurTargetIndex;
|
|
250
|
+
}
|
|
251
|
+
if (ssaoOptions && source.depthTextureHandle) {
|
|
252
|
+
const ssaoTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
253
|
+
ldrSourceHandle = this.executeNativeSsaoPass(ldrSourceHandle, source.depthTextureHandle, bloomResources, ssaoOptions, vertexArray, ssaoTargetIndex);
|
|
254
|
+
temporarySourceIndex = ssaoTargetIndex;
|
|
255
|
+
}
|
|
256
|
+
if (ssrOptions && source.depthTextureHandle) {
|
|
257
|
+
const ssrTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
258
|
+
ldrSourceHandle = this.executeNativeSsrPass(ldrSourceHandle, source.depthTextureHandle, bloomResources, ssrOptions, vertexArray, ssrTargetIndex, depthRange);
|
|
259
|
+
temporarySourceIndex = ssrTargetIndex;
|
|
260
|
+
}
|
|
261
|
+
if (taaOptions) {
|
|
262
|
+
const taaTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
263
|
+
ldrSourceHandle = this.executeNativeTaaPass(ldrSourceHandle, bloomResources, taaOptions, vertexArray, taaTargetIndex);
|
|
264
|
+
temporarySourceIndex = taaTargetIndex;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (outlineOptions && bloomResources) {
|
|
268
|
+
const outlineTargetIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
269
|
+
ldrSourceHandle = this.executeNativeOutlinePasses(ldrSourceHandle, bloomResources, outlineOptions, vertexArray, outlineTargetIndex);
|
|
270
|
+
temporarySourceIndex = outlineTargetIndex;
|
|
271
|
+
}
|
|
272
|
+
if (fxaaSplit && bloomResources) {
|
|
273
|
+
const fxaaScratchIndex = temporarySourceIndex === 0 ? 1 : 0;
|
|
274
|
+
this.drawNativeLdrStage(ldrSourceHandle, bloomResources.framebuffers[fxaaScratchIndex], source.width, source.height, program, vertexArray, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : tonePass, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : colorPass, undefined, options.toneMappingDefaults);
|
|
275
|
+
this.executeNativeFxaaFinalize(bloomResources.textures[fxaaScratchIndex], webglOutputTarget?.framebuffer ?? null, outputWidth, outputHeight, source.width, source.height, vertexArray);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
this.drawNativeLdrStage(ldrSourceHandle, webglOutputTarget?.framebuffer ?? null, outputWidth, outputHeight, program, vertexArray, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : tonePass, depthOfFieldOptions || motionBlurOptions || ssaoOptions || ssrOptions || taaOptions || outlineOptions ? undefined : colorPass, fxaaPass, options.toneMappingDefaults);
|
|
279
|
+
}
|
|
280
|
+
this.host.gl.flush();
|
|
281
|
+
}
|
|
282
|
+
finally {
|
|
283
|
+
this.restoreFullscreenPresentationState(previousState, outputWidth, outputHeight);
|
|
284
|
+
}
|
|
285
|
+
this.host.lifecycle.lastError = this.host.lifecycle.readError();
|
|
286
|
+
if (this.host.lifecycle.lastError) {
|
|
287
|
+
throw new RenderDeviceError(`WebGL2 LDR postprocess presentation failed: ${this.host.lifecycle.lastError}`, "WEBGL_LDR_POSTPROCESS_FAILED", {
|
|
288
|
+
targetId: source.id,
|
|
289
|
+
error: this.host.lifecycle.lastError
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
this.host.device.setRenderTarget(webglOutputTarget ?? null);
|
|
293
|
+
}
|
|
294
|
+
drawRenderTargetToBackbuffer(source, outputWidth, outputHeight) {
|
|
295
|
+
const program = this.ensurePresentationProgram();
|
|
296
|
+
const vertexArray = this.ensurePresentationVertexArray();
|
|
297
|
+
const previousState = this.prepareFullscreenPresentation(null, outputWidth, outputHeight);
|
|
298
|
+
this.host.gl.useProgram(program);
|
|
299
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
300
|
+
this.host.gl.activeTexture(this.host.gl.TEXTURE0);
|
|
301
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, source.colorHandle);
|
|
302
|
+
this.host.gl.bindSampler(0, null);
|
|
303
|
+
try {
|
|
304
|
+
const uniformLocation = this.host.gl.getUniformLocation(program, "u_source");
|
|
305
|
+
this.host.gl.uniform1i(uniformLocation, 0);
|
|
306
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
307
|
+
this.host.gl.flush();
|
|
308
|
+
}
|
|
309
|
+
finally {
|
|
310
|
+
this.restoreFullscreenPresentationState(previousState, outputWidth, outputHeight);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
ensureBloomPingPongResources(width, height, hdr = false) {
|
|
314
|
+
const current = this.bloomPingPongResources;
|
|
315
|
+
if (current && current.width === width && current.height === height && current.hdr === hdr) {
|
|
316
|
+
return current;
|
|
317
|
+
}
|
|
318
|
+
this.disposeBloomPingPongResources();
|
|
319
|
+
this.disposeBloomPyramidResources();
|
|
320
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
321
|
+
const previousFramebuffer = this.host.gl.getParameter(this.host.gl.FRAMEBUFFER_BINDING);
|
|
322
|
+
const textures = [];
|
|
323
|
+
const framebuffers = [];
|
|
324
|
+
try {
|
|
325
|
+
for (let index = 0; index < 2; index += 1) {
|
|
326
|
+
const texture = this.host.gl.createTexture();
|
|
327
|
+
const framebuffer = this.host.gl.createFramebuffer();
|
|
328
|
+
if (!texture || !framebuffer) {
|
|
329
|
+
if (texture)
|
|
330
|
+
this.host.gl.deleteTexture(texture);
|
|
331
|
+
if (framebuffer)
|
|
332
|
+
this.host.gl.deleteFramebuffer(framebuffer);
|
|
333
|
+
throw new RenderDeviceError("Failed to allocate WebGL2 bloom ping-pong resources", "WEBGL_ALLOCATION_FAILED", {
|
|
334
|
+
width,
|
|
335
|
+
height,
|
|
336
|
+
index
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
textures.push(texture);
|
|
340
|
+
framebuffers.push(framebuffer);
|
|
341
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
|
|
342
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MIN_FILTER, this.host.gl.NEAREST);
|
|
343
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MAG_FILTER, this.host.gl.NEAREST);
|
|
344
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_S, this.host.gl.CLAMP_TO_EDGE);
|
|
345
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_T, this.host.gl.CLAMP_TO_EDGE);
|
|
346
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, hdr ? this.host.gl.RGBA16F : this.host.gl.RGBA8, width, height, 0, this.host.gl.RGBA, hdr ? this.host.gl.HALF_FLOAT : this.host.gl.UNSIGNED_BYTE, null);
|
|
347
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
|
|
348
|
+
this.host.gl.framebufferTexture2D(this.host.gl.FRAMEBUFFER, this.host.gl.COLOR_ATTACHMENT0, this.host.gl.TEXTURE_2D, texture, 0);
|
|
349
|
+
const status = this.host.gl.checkFramebufferStatus(this.host.gl.FRAMEBUFFER);
|
|
350
|
+
if (status !== this.host.gl.FRAMEBUFFER_COMPLETE) {
|
|
351
|
+
throw new RenderDeviceError("WebGL2 bloom ping-pong framebuffer status is invalid", "FRAMEBUFFER_INVALID", {
|
|
352
|
+
width,
|
|
353
|
+
height,
|
|
354
|
+
index,
|
|
355
|
+
status
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const resources = {
|
|
360
|
+
width,
|
|
361
|
+
height,
|
|
362
|
+
hdr,
|
|
363
|
+
textures: [textures[0], textures[1]],
|
|
364
|
+
framebuffers: [framebuffers[0], framebuffers[1]]
|
|
365
|
+
};
|
|
366
|
+
this.bloomPingPongResources = resources;
|
|
367
|
+
return resources;
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
for (const texture of textures)
|
|
371
|
+
this.host.gl.deleteTexture(texture);
|
|
372
|
+
for (const framebuffer of framebuffers)
|
|
373
|
+
this.host.gl.deleteFramebuffer(framebuffer);
|
|
374
|
+
throw error;
|
|
375
|
+
}
|
|
376
|
+
finally {
|
|
377
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, previousFramebuffer);
|
|
378
|
+
this.host.lifecycle.restoreTextureUnit0(textureUnit0);
|
|
379
|
+
this.host.stateCache.invalidate();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
ensureBloomLutTextures(options) {
|
|
383
|
+
const updateBright = this.bloomBrightLutThreshold !== options.threshold;
|
|
384
|
+
const updateComposite = this.bloomCompositeLutIntensity !== options.intensity ||
|
|
385
|
+
this.bloomCompositeLutShoulder !== options.shoulder;
|
|
386
|
+
if (this.bloomBrightLutTexture && this.bloomCompositeLutTexture && !updateBright && !updateComposite) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
390
|
+
try {
|
|
391
|
+
if (!this.bloomBrightLutTexture) {
|
|
392
|
+
this.bloomBrightLutTexture = this.createNativeBloomDataTexture();
|
|
393
|
+
}
|
|
394
|
+
if (updateBright) {
|
|
395
|
+
const pixels = createBloomBrightThresholdLut(options.threshold);
|
|
396
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.bloomBrightLutTexture);
|
|
397
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, BLOOM_BRIGHT_LUT_WIDTH, BLOOM_BRIGHT_LUT_HEIGHT, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, pixels);
|
|
398
|
+
this.bloomBrightLutThreshold = options.threshold;
|
|
399
|
+
}
|
|
400
|
+
if (!this.bloomCompositeLutTexture) {
|
|
401
|
+
this.bloomCompositeLutTexture = this.createNativeBloomDataTexture();
|
|
402
|
+
}
|
|
403
|
+
if (updateComposite) {
|
|
404
|
+
const pixels = createBloomCompositeLut(options.intensity, { shoulder: options.shoulder });
|
|
405
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.bloomCompositeLutTexture);
|
|
406
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, BLOOM_COMPOSITE_LUT_SIZE, BLOOM_COMPOSITE_LUT_SIZE, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, pixels);
|
|
407
|
+
this.bloomCompositeLutIntensity = options.intensity;
|
|
408
|
+
this.bloomCompositeLutShoulder = options.shoulder;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
finally {
|
|
412
|
+
this.host.lifecycle.restoreTextureUnit0(textureUnit0);
|
|
413
|
+
this.host.stateCache.invalidate();
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
createNativeBloomDataTexture() {
|
|
417
|
+
const texture = this.host.gl.createTexture();
|
|
418
|
+
if (!texture) {
|
|
419
|
+
throw new RenderDeviceError("Failed to allocate WebGL2 bloom lookup texture", "WEBGL_ALLOCATION_FAILED");
|
|
420
|
+
}
|
|
421
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
|
|
422
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MIN_FILTER, this.host.gl.NEAREST);
|
|
423
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MAG_FILTER, this.host.gl.NEAREST);
|
|
424
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_S, this.host.gl.CLAMP_TO_EDGE);
|
|
425
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_T, this.host.gl.CLAMP_TO_EDGE);
|
|
426
|
+
return texture;
|
|
427
|
+
}
|
|
428
|
+
ensureOutlineBlendLutTexture(options) {
|
|
429
|
+
const combinedAlpha = options.opacity * (options.color[3] / 255);
|
|
430
|
+
const key = `${options.color.join(",")}|${combinedAlpha}`;
|
|
431
|
+
if (this.outlineBlendLutTexture && this.outlineBlendLutKey === key)
|
|
432
|
+
return;
|
|
433
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
434
|
+
try {
|
|
435
|
+
if (!this.outlineBlendLutTexture) {
|
|
436
|
+
this.outlineBlendLutTexture = this.createNativeBloomDataTexture();
|
|
437
|
+
}
|
|
438
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.outlineBlendLutTexture);
|
|
439
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, OUTLINE_BLEND_LUT_WIDTH, 1, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, createOutlineBlendLut(options.color, combinedAlpha));
|
|
440
|
+
this.outlineBlendLutKey = key;
|
|
441
|
+
}
|
|
442
|
+
finally {
|
|
443
|
+
this.host.lifecycle.restoreTextureUnit0(textureUnit0);
|
|
444
|
+
this.host.stateCache.invalidate();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
ensureMotionBlurVelocityTexture(width, height, velocity) {
|
|
448
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
449
|
+
try {
|
|
450
|
+
if (!this.motionBlurVelocityTexture) {
|
|
451
|
+
this.motionBlurVelocityTexture = this.createNativeBloomDataTexture();
|
|
452
|
+
}
|
|
453
|
+
this.motionBlurVelocitySize = { width, height };
|
|
454
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.motionBlurVelocityTexture);
|
|
455
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RG32F, width, height, 0, this.host.gl.RG, this.host.gl.FLOAT, velocity);
|
|
456
|
+
}
|
|
457
|
+
finally {
|
|
458
|
+
this.host.lifecycle.restoreTextureUnit0(textureUnit0);
|
|
459
|
+
this.host.stateCache.invalidate();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
ensureTaaHistoryTexture(width, height, history) {
|
|
463
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
464
|
+
try {
|
|
465
|
+
if (!this.taaHistoryTexture) {
|
|
466
|
+
this.taaHistoryTexture = this.createNativeBloomDataTexture();
|
|
467
|
+
}
|
|
468
|
+
this.taaHistorySize = { width, height };
|
|
469
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, this.taaHistoryTexture);
|
|
470
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, this.host.gl.RGBA8, width, height, 0, this.host.gl.RGBA, this.host.gl.UNSIGNED_BYTE, history);
|
|
471
|
+
}
|
|
472
|
+
finally {
|
|
473
|
+
this.host.lifecycle.restoreTextureUnit0(textureUnit0);
|
|
474
|
+
this.host.stateCache.invalidate();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
drawNativeLdrStage(sourceTexture, framebuffer, width, height, program, vertexArray, tonePass, colorPass, fxaaPass, toneMappingDefaults) {
|
|
478
|
+
const toneOptions = { ...(toneMappingDefaults ?? {}), ...(tonePass?.options ?? {}) };
|
|
479
|
+
const colorOptions = colorPass?.options ?? {};
|
|
480
|
+
const fxaaOptions = fxaaPass?.options ?? {};
|
|
481
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
|
|
482
|
+
this.host.gl.viewport(0, 0, width, height);
|
|
483
|
+
this.host.gl.useProgram(program);
|
|
484
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
485
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
486
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
487
|
+
this.host.gl.uniform2f(this.host.gl.getUniformLocation(program, "u_texelSize"), 1 / width, 1 / height);
|
|
488
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasToneMapping"), tonePass ? 1 : 0);
|
|
489
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_toneOperator"), toneMappingOperatorId(stringOption(toneOptions, "operator", "reinhard")));
|
|
490
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_inputColorSpace"), colorSpaceId(stringOption(toneOptions, "inputColorSpace", "linear")));
|
|
491
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_outputColorSpace"), colorSpaceId(stringOption(toneOptions, "outputColorSpace", "linear")));
|
|
492
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_exposure"), numberOption(toneOptions, "exposure", 1));
|
|
493
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_whitePoint"), Math.max(0.0001, numberOption(toneOptions, "whitePoint", 1)));
|
|
494
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_gamma"), Math.max(0.0001, numberOption(toneOptions, "gamma", 2.2)));
|
|
495
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasColorGrade"), colorPass ? 1 : 0);
|
|
496
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_contrast"), numberOption(colorOptions, "contrast", 1));
|
|
497
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_temperature"), numberOption(colorOptions, "temperature", 0));
|
|
498
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_tint"), numberOption(colorOptions, "tint", 0));
|
|
499
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_saturation"), numberOption(colorOptions, "saturation", 1));
|
|
500
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_vibrance"), numberOption(colorOptions, "vibrance", 0));
|
|
501
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_vignette"), numberOption(colorOptions, "vignette", 0));
|
|
502
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_sharpening"), numberOption(colorOptions, "sharpening", 0));
|
|
503
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasFxaa"), fxaaPass ? 1 : 0);
|
|
504
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_edgeThreshold"), numberOption(fxaaOptions, "edgeThreshold", 0.125));
|
|
505
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_subpixelBlend"), numberOption(fxaaOptions, "subpixelBlend", 0.75));
|
|
506
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
507
|
+
}
|
|
508
|
+
executeNativeBloomPasses(sourceTexture, resources, options, vertexArray, hdr) {
|
|
509
|
+
const brightLut = this.bloomBrightLutTexture;
|
|
510
|
+
const compositeLut = this.bloomCompositeLutTexture;
|
|
511
|
+
if (!hdr && (!brightLut || !compositeLut)) {
|
|
512
|
+
throw new RenderDeviceError("WebGL2 bloom lookup textures were not initialized", "WEBGL_ALLOCATION_FAILED");
|
|
513
|
+
}
|
|
514
|
+
const [textureA, textureB] = resources.textures;
|
|
515
|
+
const [framebufferA, framebufferB] = resources.framebuffers;
|
|
516
|
+
const brightProgram = this.ensureBloomBrightExtractProgram();
|
|
517
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferA);
|
|
518
|
+
this.host.gl.viewport(0, 0, resources.width, resources.height);
|
|
519
|
+
this.host.gl.useProgram(brightProgram);
|
|
520
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
521
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
522
|
+
if (brightLut)
|
|
523
|
+
this.bindFullscreenTexture(1, brightLut);
|
|
524
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_source"), 0);
|
|
525
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_brightLut"), 1);
|
|
526
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_hdr"), hdr ? 1 : 0);
|
|
527
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_threshold"), options.threshold);
|
|
528
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_softKnee"), options.softKnee);
|
|
529
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_excess"), options.excess === true ? 1 : 0);
|
|
530
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
531
|
+
const blurProgram = this.ensureBloomBlurProgram();
|
|
532
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferB);
|
|
533
|
+
this.host.gl.useProgram(blurProgram);
|
|
534
|
+
this.bindFullscreenTexture(0, textureA);
|
|
535
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_source"), 0);
|
|
536
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(blurProgram, "u_size"), resources.width, resources.height);
|
|
537
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_radius"), options.radius);
|
|
538
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 1);
|
|
539
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_hdr"), hdr ? 1 : 0);
|
|
540
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
541
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferA);
|
|
542
|
+
this.bindFullscreenTexture(0, textureB);
|
|
543
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 0);
|
|
544
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
545
|
+
const compositeProgram = this.ensureBloomCompositeProgram();
|
|
546
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebufferB);
|
|
547
|
+
this.host.gl.useProgram(compositeProgram);
|
|
548
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
549
|
+
this.bindFullscreenTexture(1, textureA);
|
|
550
|
+
if (compositeLut)
|
|
551
|
+
this.bindFullscreenTexture(2, compositeLut);
|
|
552
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_source"), 0);
|
|
553
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_blurred"), 1);
|
|
554
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_compositeLut"), 2);
|
|
555
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(compositeProgram, "u_hdr"), hdr ? 1 : 0);
|
|
556
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(compositeProgram, "u_intensity"), options.intensity);
|
|
557
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
558
|
+
return textureB;
|
|
559
|
+
}
|
|
560
|
+
executeNativeBloomPyramidPasses(sourceTexture, sourceWidth, sourceHeight, resources, fullResStaging, options, vertexArray, hdr) {
|
|
561
|
+
const plan = resources.plan;
|
|
562
|
+
const mipCount = plan.mips.length;
|
|
563
|
+
// Flag-on (§6.6): fixed widening kernels + spread-weighted mips; flag-off
|
|
564
|
+
// keeps the radius-scaled kernels and the legacy preset weights.
|
|
565
|
+
const v2Response = options.excess === true ? resolveBloomPyramidV2Response(plan, options.spread ?? 0.7) : undefined;
|
|
566
|
+
const blurRadii = v2Response ? v2Response.blurRadii : resolveBloomPyramidBlurRadii(plan, options.radius);
|
|
567
|
+
const downsampleProgram = this.ensureBloomDownsampleProgram();
|
|
568
|
+
const brightProgram = this.ensureBloomBrightExtractProgram();
|
|
569
|
+
const blurProgram = this.ensureBloomBlurProgram();
|
|
570
|
+
const accumulateProgram = this.ensureBloomAccumulateProgram();
|
|
571
|
+
const brightLut = this.bloomBrightLutTexture;
|
|
572
|
+
const mipTexture = (level, slot) => resources.textures[level * 2 + slot];
|
|
573
|
+
const mipFramebuffer = (level, slot) => resources.framebuffers[level * 2 + slot];
|
|
574
|
+
const mipSize = (level) => plan.mips[level];
|
|
575
|
+
// Every level settles in slot 0 after the vertical blur.
|
|
576
|
+
const blurredSlot = (_level) => 0;
|
|
577
|
+
const drawDownsample = (fromTexture, fromWidth, fromHeight, toFramebuffer, toWidth, toHeight) => {
|
|
578
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, toFramebuffer);
|
|
579
|
+
this.host.gl.viewport(0, 0, toWidth, toHeight);
|
|
580
|
+
this.host.gl.useProgram(downsampleProgram);
|
|
581
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
582
|
+
this.bindFullscreenTexture(0, fromTexture);
|
|
583
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(downsampleProgram, "u_source"), 0);
|
|
584
|
+
this.host.gl.uniform2f(this.host.gl.getUniformLocation(downsampleProgram, "u_texelSize"), 1 / fromWidth, 1 / fromHeight);
|
|
585
|
+
this.host.gl.uniform2f(this.host.gl.getUniformLocation(downsampleProgram, "u_targetSize"), toWidth, toHeight);
|
|
586
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
587
|
+
};
|
|
588
|
+
const drawBrightExtract = (fromTexture, toFramebuffer, size) => {
|
|
589
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, toFramebuffer);
|
|
590
|
+
this.host.gl.viewport(0, 0, size.width, size.height);
|
|
591
|
+
this.host.gl.useProgram(brightProgram);
|
|
592
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
593
|
+
this.bindFullscreenTexture(0, fromTexture);
|
|
594
|
+
if (brightLut)
|
|
595
|
+
this.bindFullscreenTexture(1, brightLut);
|
|
596
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_source"), 0);
|
|
597
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_brightLut"), 1);
|
|
598
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_hdr"), hdr ? 1 : 0);
|
|
599
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_threshold"), options.threshold);
|
|
600
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_softKnee"), options.softKnee);
|
|
601
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_excess"), options.excess === true ? 1 : 0);
|
|
602
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
603
|
+
};
|
|
604
|
+
const drawSeparableBlur = (readTexture, tmpTexture, tmpFramebuffer, outFramebuffer, size, radius) => {
|
|
605
|
+
// Horizontal into the temp target, vertical back into the output target.
|
|
606
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, tmpFramebuffer);
|
|
607
|
+
this.host.gl.viewport(0, 0, size.width, size.height);
|
|
608
|
+
this.host.gl.useProgram(blurProgram);
|
|
609
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
610
|
+
this.bindFullscreenTexture(0, readTexture);
|
|
611
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_source"), 0);
|
|
612
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(blurProgram, "u_size"), size.width, size.height);
|
|
613
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_radius"), radius);
|
|
614
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 1);
|
|
615
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_hdr"), hdr ? 1 : 0);
|
|
616
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
617
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, outFramebuffer);
|
|
618
|
+
this.bindFullscreenTexture(0, tmpTexture);
|
|
619
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(blurProgram, "u_horizontal"), 0);
|
|
620
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
621
|
+
};
|
|
622
|
+
// Extract highlights at the source resolution before the first downsample.
|
|
623
|
+
// Downsampling the complete scene first averaged narrow emissive sources
|
|
624
|
+
// below the authored threshold, so balanced/cinematic bloom could execute
|
|
625
|
+
// all native passes yet remain pixel-identical to disabled output.
|
|
626
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, fullResStaging.framebufferA);
|
|
627
|
+
this.host.gl.viewport(0, 0, sourceWidth, sourceHeight);
|
|
628
|
+
this.host.gl.useProgram(brightProgram);
|
|
629
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
630
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
631
|
+
if (brightLut)
|
|
632
|
+
this.bindFullscreenTexture(1, brightLut);
|
|
633
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_source"), 0);
|
|
634
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_brightLut"), 1);
|
|
635
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_hdr"), hdr ? 1 : 0);
|
|
636
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_threshold"), options.threshold);
|
|
637
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(brightProgram, "u_softKnee"), options.softKnee);
|
|
638
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(brightProgram, "u_excess"), options.excess === true ? 1 : 0);
|
|
639
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
640
|
+
// Level 0 downsamples the extracted highlight field, then blurs H into
|
|
641
|
+
// slot 1 and V back into slot 0. The result therefore settles in slot 0.
|
|
642
|
+
const level0 = mipSize(0);
|
|
643
|
+
drawDownsample(fullResStaging.textureA, sourceWidth, sourceHeight, mipFramebuffer(0, 0), level0.width, level0.height);
|
|
644
|
+
drawSeparableBlur(mipTexture(0, 0), mipTexture(0, 1), mipFramebuffer(0, 1), mipFramebuffer(0, 0), level0, blurRadii[0]);
|
|
645
|
+
for (let level = 1; level < mipCount; level += 1) {
|
|
646
|
+
const size = mipSize(level);
|
|
647
|
+
const previous = mipSize(level - 1);
|
|
648
|
+
drawDownsample(mipTexture(level - 1, blurredSlot(level - 1)), previous.width, previous.height, mipFramebuffer(level, 0), size.width, size.height);
|
|
649
|
+
// H into slot 1, V back into slot 0: blurred result settles in slot 0.
|
|
650
|
+
drawSeparableBlur(mipTexture(level, 0), mipTexture(level, 1), mipFramebuffer(level, 1), mipFramebuffer(level, 0), size, blurRadii[level]);
|
|
651
|
+
}
|
|
652
|
+
// Accumulate smallest-to-largest, ping-ponging between the two
|
|
653
|
+
// accumulators (a pass must never sample its own bound target).
|
|
654
|
+
const weights = v2Response ? v2Response.weights : plan.weights;
|
|
655
|
+
let readAccumulator = { texture: resources.accumulatorTextureA, framebuffer: resources.accumulatorFramebufferA };
|
|
656
|
+
let writeAccumulator = { texture: resources.accumulatorTextureB, framebuffer: resources.accumulatorFramebufferB };
|
|
657
|
+
// Clear both accumulators; the seed reads the cleared sibling, never the
|
|
658
|
+
// bound target (feedback loop).
|
|
659
|
+
for (const acc of [readAccumulator, writeAccumulator]) {
|
|
660
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, acc.framebuffer);
|
|
661
|
+
this.host.gl.viewport(0, 0, level0.width, level0.height);
|
|
662
|
+
this.host.gl.clearColor(0, 0, 0, 0);
|
|
663
|
+
this.host.gl.clear(this.host.gl.COLOR_BUFFER_BIT);
|
|
664
|
+
}
|
|
665
|
+
// Seed: smallest mip onto the cleared sibling accumulator.
|
|
666
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, writeAccumulator.framebuffer);
|
|
667
|
+
this.host.gl.viewport(0, 0, level0.width, level0.height);
|
|
668
|
+
this.host.gl.useProgram(accumulateProgram);
|
|
669
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
670
|
+
this.bindFullscreenTexture(0, readAccumulator.texture);
|
|
671
|
+
this.bindFullscreenTexture(1, mipTexture(mipCount - 1, blurredSlot(mipCount - 1)));
|
|
672
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_base"), 0);
|
|
673
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_bloom"), 1);
|
|
674
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulateProgram, "u_weight"), weights[mipCount - 1]);
|
|
675
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
676
|
+
for (let level = mipCount - 2; level >= 0; level -= 1) {
|
|
677
|
+
const nextRead = writeAccumulator;
|
|
678
|
+
const nextWrite = readAccumulator;
|
|
679
|
+
readAccumulator = nextRead;
|
|
680
|
+
writeAccumulator = nextWrite;
|
|
681
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, writeAccumulator.framebuffer);
|
|
682
|
+
this.host.gl.viewport(0, 0, level0.width, level0.height);
|
|
683
|
+
this.host.gl.useProgram(accumulateProgram);
|
|
684
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
685
|
+
this.bindFullscreenTexture(0, readAccumulator.texture);
|
|
686
|
+
this.bindFullscreenTexture(1, mipTexture(level, blurredSlot(level)));
|
|
687
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_base"), 0);
|
|
688
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_bloom"), 1);
|
|
689
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulateProgram, "u_weight"), weights[level]);
|
|
690
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
691
|
+
}
|
|
692
|
+
// Upsample the weighted sum onto full-resolution staging target A, using
|
|
693
|
+
// the cleared staging target B as the zero base (never sample A while
|
|
694
|
+
// rendering into it).
|
|
695
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, fullResStaging.framebufferB);
|
|
696
|
+
this.host.gl.viewport(0, 0, sourceWidth, sourceHeight);
|
|
697
|
+
this.host.gl.clearColor(0, 0, 0, 0);
|
|
698
|
+
this.host.gl.clear(this.host.gl.COLOR_BUFFER_BIT);
|
|
699
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, fullResStaging.framebufferA);
|
|
700
|
+
this.host.gl.viewport(0, 0, sourceWidth, sourceHeight);
|
|
701
|
+
this.host.gl.useProgram(accumulateProgram);
|
|
702
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
703
|
+
this.bindFullscreenTexture(0, fullResStaging.textureB);
|
|
704
|
+
this.bindFullscreenTexture(1, writeAccumulator.texture);
|
|
705
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_base"), 0);
|
|
706
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulateProgram, "u_bloom"), 1);
|
|
707
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulateProgram, "u_weight"), 1);
|
|
708
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
709
|
+
return fullResStaging.textureA;
|
|
710
|
+
}
|
|
711
|
+
executeNativeOutlinePasses(sourceTexture, resources, options, vertexArray, targetIndex) {
|
|
712
|
+
const blendLut = this.outlineBlendLutTexture;
|
|
713
|
+
if (!blendLut) {
|
|
714
|
+
throw new RenderDeviceError("WebGL2 outline lookup texture was not initialized", "WEBGL_ALLOCATION_FAILED");
|
|
715
|
+
}
|
|
716
|
+
const program = this.ensureOutlineProgram();
|
|
717
|
+
const targetTexture = resources.textures[targetIndex];
|
|
718
|
+
const targetFramebuffer = resources.framebuffers[targetIndex];
|
|
719
|
+
const bound = createOutlineGradientBound(options.threshold);
|
|
720
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, targetFramebuffer);
|
|
721
|
+
this.host.gl.viewport(0, 0, resources.width, resources.height);
|
|
722
|
+
this.host.gl.useProgram(program);
|
|
723
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
724
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
725
|
+
this.bindFullscreenTexture(1, blendLut);
|
|
726
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
727
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_blendLut"), 1);
|
|
728
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
|
|
729
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_width"), options.width);
|
|
730
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_boundHigh"), bound.highWord);
|
|
731
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_boundLow"), bound.lowWord);
|
|
732
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
733
|
+
return targetTexture;
|
|
734
|
+
}
|
|
735
|
+
executeNativeSsaoPass(sourceTexture, depthTexture, resources, options, vertexArray, targetIndex) {
|
|
736
|
+
const program = this.ensureSsaoProgram();
|
|
737
|
+
const targetTexture = resources.textures[targetIndex];
|
|
738
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
|
|
739
|
+
this.host.gl.viewport(0, 0, resources.width, resources.height);
|
|
740
|
+
this.host.gl.useProgram(program);
|
|
741
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
742
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
743
|
+
this.bindFullscreenTexture(1, depthTexture);
|
|
744
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
745
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_depth"), 1);
|
|
746
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
|
|
747
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_radius"), options.radius);
|
|
748
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_intensity"), options.intensity);
|
|
749
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_bias"), options.bias);
|
|
750
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
751
|
+
return targetTexture;
|
|
752
|
+
}
|
|
753
|
+
executeNativeSsrPass(sourceTexture, depthTexture, resources, options, vertexArray, targetIndex, depthRange) {
|
|
754
|
+
const targetTexture = resources.textures[targetIndex];
|
|
755
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
|
|
756
|
+
this.drawSsrKernel(sourceTexture, depthTexture, resources.width, resources.height, options, vertexArray, depthRange);
|
|
757
|
+
return targetTexture;
|
|
758
|
+
}
|
|
759
|
+
drawSsrKernel(sourceTexture, depthTexture, width, height, options, vertexArray, depthRange) {
|
|
760
|
+
const program = this.ensureSsrProgram();
|
|
761
|
+
this.host.gl.viewport(0, 0, width, height);
|
|
762
|
+
this.host.gl.useProgram(program);
|
|
763
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
764
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
765
|
+
this.bindFullscreenTexture(1, depthTexture);
|
|
766
|
+
this.bindFullscreenTexture(2, options.normalMask ?? sourceTexture);
|
|
767
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
768
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_depth"), 1);
|
|
769
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_normalMask"), 2);
|
|
770
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_hasNormalMask"), options.normalMask ? 1 : 0);
|
|
771
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), width, height);
|
|
772
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_intensity"), options.intensity);
|
|
773
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_maxDistance"), options.maxDistance);
|
|
774
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_maxSteps"), options.maxSteps ?? 32);
|
|
775
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_thickness"), options.thickness ?? 0.2);
|
|
776
|
+
if (options.projection && options.inverseProjection) {
|
|
777
|
+
this.host.gl.uniformMatrix4fv(this.host.gl.getUniformLocation(program, "u_projection"), false, options.projection);
|
|
778
|
+
this.host.gl.uniformMatrix4fv(this.host.gl.getUniformLocation(program, "u_inverseProjection"), false, options.inverseProjection);
|
|
779
|
+
}
|
|
780
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthNear"), depthRange.near);
|
|
781
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthFar"), depthRange.far);
|
|
782
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
783
|
+
}
|
|
784
|
+
executeNativeDepthOfFieldPass(sourceTexture, depthTexture, resources, options, vertexArray, targetIndex, depthRange) {
|
|
785
|
+
const program = this.ensureDepthOfFieldProgram();
|
|
786
|
+
const targetTexture = resources.textures[targetIndex];
|
|
787
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
|
|
788
|
+
this.host.gl.viewport(0, 0, resources.width, resources.height);
|
|
789
|
+
this.host.gl.useProgram(program);
|
|
790
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
791
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
792
|
+
this.bindFullscreenTexture(1, depthTexture);
|
|
793
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
794
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_depth"), 1);
|
|
795
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
|
|
796
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_focusDepth"), options.focusDepth);
|
|
797
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_focusRange"), options.focusRange);
|
|
798
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_maxRadius"), options.maxRadius);
|
|
799
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthNear"), depthRange.near);
|
|
800
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_depthFar"), depthRange.far);
|
|
801
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
802
|
+
return targetTexture;
|
|
803
|
+
}
|
|
804
|
+
executeNativeMotionBlurPass(sourceTexture, resources, options, vertexArray, targetIndex) {
|
|
805
|
+
const velocityTexture = options.temporal ? this.requireTemporalTarget(options.temporal.velocity, resources.width, resources.height).colorHandle : this.motionBlurVelocityTexture;
|
|
806
|
+
if (!velocityTexture) {
|
|
807
|
+
throw new RenderDeviceError("WebGL2 motion-blur velocity texture was not initialized", "WEBGL_ALLOCATION_FAILED");
|
|
808
|
+
}
|
|
809
|
+
const program = this.ensureMotionBlurProgram();
|
|
810
|
+
const targetTexture = resources.textures[targetIndex];
|
|
811
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
|
|
812
|
+
this.host.gl.viewport(0, 0, resources.width, resources.height);
|
|
813
|
+
this.host.gl.useProgram(program);
|
|
814
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
815
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
816
|
+
this.bindFullscreenTexture(1, velocityTexture);
|
|
817
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
818
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_velocity"), 1);
|
|
819
|
+
this.host.gl.uniform2i(this.host.gl.getUniformLocation(program, "u_size"), resources.width, resources.height);
|
|
820
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_samples"), options.samples);
|
|
821
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(program, "u_scale"), options.scale);
|
|
822
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_velocityUv"), options.temporal ? 1 : 0);
|
|
823
|
+
if (options.temporal) {
|
|
824
|
+
this.host.counters.nativeTemporalPasses++;
|
|
825
|
+
this.host.counters.nativeTemporalBindings++;
|
|
826
|
+
}
|
|
827
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
828
|
+
return targetTexture;
|
|
829
|
+
}
|
|
830
|
+
executeNativeTaaPass(sourceTexture, resources, options, vertexArray, targetIndex) {
|
|
831
|
+
const temporal = options.temporal;
|
|
832
|
+
const historyTarget = temporal ? this.requireTemporalTarget(temporal.history, resources.width, resources.height) : undefined;
|
|
833
|
+
const historyTexture = historyTarget?.colorHandle ?? this.taaHistoryTexture;
|
|
834
|
+
if (!historyTexture) {
|
|
835
|
+
throw new RenderDeviceError("WebGL2 TAA history texture was not initialized", "WEBGL_ALLOCATION_FAILED");
|
|
836
|
+
}
|
|
837
|
+
const accumulationProgram = this.ensureTaaProgram();
|
|
838
|
+
const targetTexture = resources.textures[targetIndex];
|
|
839
|
+
this.host.gl.viewport(0, 0, resources.width, resources.height);
|
|
840
|
+
this.host.gl.useProgram(accumulationProgram);
|
|
841
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
842
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
843
|
+
this.bindFullscreenTexture(1, historyTexture);
|
|
844
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_source"), 0);
|
|
845
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_history"), 1);
|
|
846
|
+
this.host.gl.uniform1f(this.host.gl.getUniformLocation(accumulationProgram, "u_blend"), temporal && !temporal.historyValid ? 0 : temporalAccumulationWeight(options.blend, temporal?.historyFrames));
|
|
847
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_temporal"), temporal ? 1 : 0);
|
|
848
|
+
if (temporal) {
|
|
849
|
+
const velocity = this.requireTemporalTarget(temporal.velocity, resources.width, resources.height);
|
|
850
|
+
const destination = this.requireTemporalTarget(temporal.historyOutput, resources.width, resources.height);
|
|
851
|
+
if (destination === historyTarget || destination === velocity || historyTarget === velocity)
|
|
852
|
+
throw new RenderDeviceError("Temporal targets must not alias", "TEMPORAL_TARGET_ALIAS");
|
|
853
|
+
this.bindFullscreenTexture(2, velocity.colorHandle);
|
|
854
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(accumulationProgram, "u_velocity"), 2);
|
|
855
|
+
// Resolve exactly once into the next history target. Presentation reads
|
|
856
|
+
// this immutable result through a separate program, so display tuning
|
|
857
|
+
// cannot alter the accumulated history shader or its stored bytes.
|
|
858
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, destination.framebuffer);
|
|
859
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
860
|
+
const presentationProgram = this.ensureTaaPresentationProgram();
|
|
861
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
|
|
862
|
+
this.host.gl.useProgram(presentationProgram);
|
|
863
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
864
|
+
this.bindFullscreenTexture(1, destination.colorHandle);
|
|
865
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(presentationProgram, "u_source"), 0);
|
|
866
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(presentationProgram, "u_accumulated"), 1);
|
|
867
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
868
|
+
this.host.counters.nativeTemporalPasses++;
|
|
869
|
+
this.host.counters.nativeTemporalBindings += 3;
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, resources.framebuffers[targetIndex]);
|
|
873
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
874
|
+
}
|
|
875
|
+
return targetTexture;
|
|
876
|
+
}
|
|
877
|
+
requireTemporalTarget(target, width, height) {
|
|
878
|
+
if (!(target instanceof WebGL2RenderTarget) || !this.host.renderTargets.has(target) || target.disposed || target.width !== width || target.height !== height || target.colorTexture.format !== "rgba16f")
|
|
879
|
+
throw new RenderDeviceError("Temporal input must be a live same-device same-size RGBA16F target", "TEMPORAL_TARGET_INVALID");
|
|
880
|
+
return target;
|
|
881
|
+
}
|
|
882
|
+
bindFullscreenTexture(unit, texture) {
|
|
883
|
+
this.host.gl.activeTexture(this.host.gl.TEXTURE0 + unit);
|
|
884
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
|
|
885
|
+
this.host.gl.bindSampler(unit, null);
|
|
886
|
+
}
|
|
887
|
+
disposeBloomPingPongResources() {
|
|
888
|
+
if (!this.bloomPingPongResources)
|
|
889
|
+
return;
|
|
890
|
+
for (const texture of this.bloomPingPongResources.textures)
|
|
891
|
+
this.host.gl.deleteTexture(texture);
|
|
892
|
+
for (const framebuffer of this.bloomPingPongResources.framebuffers)
|
|
893
|
+
this.host.gl.deleteFramebuffer(framebuffer);
|
|
894
|
+
this.bloomPingPongResources = null;
|
|
895
|
+
}
|
|
896
|
+
getBloomDiagnostics() {
|
|
897
|
+
return this.lastBloomDiagnostics;
|
|
898
|
+
}
|
|
899
|
+
recordBloomDiagnostics(options, sourceWidth, sourceHeight, hdr, mipCount) {
|
|
900
|
+
const plan = resolveBloomPyramidPlan(sourceWidth, sourceHeight, options.quality, hdr);
|
|
901
|
+
const pingPongBytes = sourceWidth * sourceHeight * 4 * (hdr ? 2 : 1) * 2;
|
|
902
|
+
const bytesPerChannel = plan.halfFloat ? 2 : 1;
|
|
903
|
+
const level0 = plan.mips[0];
|
|
904
|
+
const accumulatorBytes = level0.width * level0.height * 4 * bytesPerChannel;
|
|
905
|
+
this.lastBloomDiagnostics = {
|
|
906
|
+
quality: options.quality,
|
|
907
|
+
mipCount,
|
|
908
|
+
targetCount: options.quality === "performance" ? 2 : plan.mips.length * 2 + 1,
|
|
909
|
+
targetBytes: (options.quality === "performance" ? pingPongBytes : plan.targetBytes + accumulatorBytes + pingPongBytes),
|
|
910
|
+
compositeGain: options.intensity * nativeBloomResponseGain(plan, options),
|
|
911
|
+
threshold: options.threshold,
|
|
912
|
+
intensity: options.intensity,
|
|
913
|
+
softKnee: options.softKnee,
|
|
914
|
+
shoulder: options.shoulder,
|
|
915
|
+
halfFloat: hdr || plan.halfFloat,
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
describeGpuTargetInventory(liveRenderTargets) {
|
|
919
|
+
const entries = liveRenderTargets.map((target) => ({
|
|
920
|
+
label: target.label,
|
|
921
|
+
kind: "render-target",
|
|
922
|
+
bytes: target.colorTexture.byteLength + (target.depthTexture?.byteLength ?? 0),
|
|
923
|
+
owner: resolveGpuTargetOwner(target.label)
|
|
924
|
+
}));
|
|
925
|
+
const pyramid = this.bloomPyramidResources;
|
|
926
|
+
if (pyramid) {
|
|
927
|
+
const bytesPerPixel = pyramid.hdr ? 8 : 4;
|
|
928
|
+
pyramid.plan.mips.forEach((mip, index) => {
|
|
929
|
+
for (const side of ["a", "b"]) {
|
|
930
|
+
entries.push({
|
|
931
|
+
label: `bloom-pyramid-mip${index}${side}`,
|
|
932
|
+
kind: "pyramid-mip",
|
|
933
|
+
bytes: mip.width * mip.height * bytesPerPixel,
|
|
934
|
+
owner: "a1-bloom"
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
const level0 = pyramid.plan.mips[0];
|
|
939
|
+
if (level0) {
|
|
940
|
+
for (const side of ["a", "b"]) {
|
|
941
|
+
entries.push({
|
|
942
|
+
label: `bloom-pyramid-accumulator-${side}`,
|
|
943
|
+
kind: "pyramid-accumulator",
|
|
944
|
+
bytes: level0.width * level0.height * bytesPerPixel,
|
|
945
|
+
owner: "a1-bloom"
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
const pingPong = this.bloomPingPongResources;
|
|
951
|
+
if (pingPong) {
|
|
952
|
+
const bytesPerPixel = pingPong.hdr ? 8 : 4;
|
|
953
|
+
for (const side of ["a", "b"]) {
|
|
954
|
+
entries.push({
|
|
955
|
+
label: `bloom-ping-pong-${side}`,
|
|
956
|
+
kind: "ping-pong",
|
|
957
|
+
bytes: pingPong.width * pingPong.height * bytesPerPixel,
|
|
958
|
+
owner: "a1-bloom"
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (this.bloomBrightLutTexture) {
|
|
963
|
+
entries.push({
|
|
964
|
+
label: "bloom-bright-lut",
|
|
965
|
+
kind: "lut",
|
|
966
|
+
bytes: BLOOM_BRIGHT_LUT_WIDTH * BLOOM_BRIGHT_LUT_HEIGHT * 4,
|
|
967
|
+
owner: "a1-bloom"
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
if (this.bloomCompositeLutTexture) {
|
|
971
|
+
entries.push({
|
|
972
|
+
label: "bloom-composite-lut",
|
|
973
|
+
kind: "lut",
|
|
974
|
+
bytes: BLOOM_COMPOSITE_LUT_SIZE * BLOOM_COMPOSITE_LUT_SIZE * 4,
|
|
975
|
+
owner: "a1-bloom"
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
if (this.outlineBlendLutTexture) {
|
|
979
|
+
entries.push({ label: "outline-blend-lut", kind: "lut", bytes: OUTLINE_BLEND_LUT_WIDTH * 4, owner: "post" });
|
|
980
|
+
}
|
|
981
|
+
if (this.motionBlurVelocityTexture && this.motionBlurVelocitySize) {
|
|
982
|
+
entries.push({
|
|
983
|
+
label: "motion-blur-velocity",
|
|
984
|
+
kind: "history",
|
|
985
|
+
bytes: this.motionBlurVelocitySize.width * this.motionBlurVelocitySize.height * 8,
|
|
986
|
+
owner: "post"
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
if (this.taaHistoryTexture && this.taaHistorySize) {
|
|
990
|
+
entries.push({
|
|
991
|
+
label: "taa-history",
|
|
992
|
+
kind: "history",
|
|
993
|
+
bytes: this.taaHistorySize.width * this.taaHistorySize.height * 4,
|
|
994
|
+
owner: "post"
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
return entries;
|
|
998
|
+
}
|
|
999
|
+
disposeBloomPyramidResources() {
|
|
1000
|
+
if (!this.bloomPyramidResources)
|
|
1001
|
+
return;
|
|
1002
|
+
for (const texture of this.bloomPyramidResources.textures)
|
|
1003
|
+
this.host.gl.deleteTexture(texture);
|
|
1004
|
+
for (const framebuffer of this.bloomPyramidResources.framebuffers)
|
|
1005
|
+
this.host.gl.deleteFramebuffer(framebuffer);
|
|
1006
|
+
this.host.gl.deleteTexture(this.bloomPyramidResources.accumulatorTextureA);
|
|
1007
|
+
this.host.gl.deleteFramebuffer(this.bloomPyramidResources.accumulatorFramebufferA);
|
|
1008
|
+
this.host.gl.deleteTexture(this.bloomPyramidResources.accumulatorTextureB);
|
|
1009
|
+
this.host.gl.deleteFramebuffer(this.bloomPyramidResources.accumulatorFramebufferB);
|
|
1010
|
+
this.bloomPyramidResources = null;
|
|
1011
|
+
}
|
|
1012
|
+
ensureBloomPyramidResources(plan, hdr) {
|
|
1013
|
+
const current = this.bloomPyramidResources;
|
|
1014
|
+
if (current && current.plan.quality === plan.quality && current.hdr === (hdr || plan.halfFloat) &&
|
|
1015
|
+
current.plan.mips.length === plan.mips.length &&
|
|
1016
|
+
current.plan.mips.every((mip, index) => mip.width === plan.mips[index].width && mip.height === plan.mips[index].height)) {
|
|
1017
|
+
return current;
|
|
1018
|
+
}
|
|
1019
|
+
this.disposeBloomPyramidResources();
|
|
1020
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
1021
|
+
const previousFramebuffer = this.host.gl.getParameter(this.host.gl.FRAMEBUFFER_BINDING);
|
|
1022
|
+
const textures = [];
|
|
1023
|
+
const framebuffers = [];
|
|
1024
|
+
const useHalfFloat = hdr || plan.halfFloat;
|
|
1025
|
+
const allocateTarget = (width, height, label) => {
|
|
1026
|
+
const texture = this.host.gl.createTexture();
|
|
1027
|
+
const framebuffer = this.host.gl.createFramebuffer();
|
|
1028
|
+
if (!texture || !framebuffer) {
|
|
1029
|
+
if (texture)
|
|
1030
|
+
this.host.gl.deleteTexture(texture);
|
|
1031
|
+
if (framebuffer)
|
|
1032
|
+
this.host.gl.deleteFramebuffer(framebuffer);
|
|
1033
|
+
throw new RenderDeviceError(`Failed to allocate WebGL2 bloom pyramid ${label}`, "WEBGL_ALLOCATION_FAILED", { width, height });
|
|
1034
|
+
}
|
|
1035
|
+
textures.push(texture);
|
|
1036
|
+
framebuffers.push(framebuffer);
|
|
1037
|
+
this.host.gl.bindTexture(this.host.gl.TEXTURE_2D, texture);
|
|
1038
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MIN_FILTER, this.host.gl.LINEAR);
|
|
1039
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_MAG_FILTER, this.host.gl.LINEAR);
|
|
1040
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_S, this.host.gl.CLAMP_TO_EDGE);
|
|
1041
|
+
this.host.gl.texParameteri(this.host.gl.TEXTURE_2D, this.host.gl.TEXTURE_WRAP_T, this.host.gl.CLAMP_TO_EDGE);
|
|
1042
|
+
this.host.gl.texImage2D(this.host.gl.TEXTURE_2D, 0, useHalfFloat ? this.host.gl.RGBA16F : this.host.gl.RGBA8, width, height, 0, this.host.gl.RGBA, useHalfFloat ? this.host.gl.HALF_FLOAT : this.host.gl.UNSIGNED_BYTE, null);
|
|
1043
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
|
|
1044
|
+
this.host.gl.framebufferTexture2D(this.host.gl.FRAMEBUFFER, this.host.gl.COLOR_ATTACHMENT0, this.host.gl.TEXTURE_2D, texture, 0);
|
|
1045
|
+
const status = this.host.gl.checkFramebufferStatus(this.host.gl.FRAMEBUFFER);
|
|
1046
|
+
if (status !== this.host.gl.FRAMEBUFFER_COMPLETE) {
|
|
1047
|
+
throw new RenderDeviceError("WebGL2 bloom pyramid framebuffer status is invalid", "FRAMEBUFFER_INVALID", { width, height, status });
|
|
1048
|
+
}
|
|
1049
|
+
return { texture, framebuffer };
|
|
1050
|
+
};
|
|
1051
|
+
try {
|
|
1052
|
+
// Two ping-pong targets per mip (separable blur needs distinct read/write
|
|
1053
|
+
// targets at the same size), plus two level-0-sized accumulators: the
|
|
1054
|
+
// weighted sum ping-pongs between them so no pass ever samples the
|
|
1055
|
+
// texture of its own bound framebuffer (feedback loop).
|
|
1056
|
+
for (const mip of plan.mips) {
|
|
1057
|
+
allocateTarget(mip.width, mip.height, "mip");
|
|
1058
|
+
allocateTarget(mip.width, mip.height, "mip");
|
|
1059
|
+
}
|
|
1060
|
+
const level0 = plan.mips[0];
|
|
1061
|
+
const accumulatorA = allocateTarget(level0.width, level0.height, "accumulator-a");
|
|
1062
|
+
const accumulatorB = allocateTarget(level0.width, level0.height, "accumulator-b");
|
|
1063
|
+
const finalResources = {
|
|
1064
|
+
plan,
|
|
1065
|
+
hdr: useHalfFloat,
|
|
1066
|
+
textures,
|
|
1067
|
+
framebuffers,
|
|
1068
|
+
accumulatorTextureA: accumulatorA.texture,
|
|
1069
|
+
accumulatorFramebufferA: accumulatorA.framebuffer,
|
|
1070
|
+
accumulatorTextureB: accumulatorB.texture,
|
|
1071
|
+
accumulatorFramebufferB: accumulatorB.framebuffer
|
|
1072
|
+
};
|
|
1073
|
+
this.bloomPyramidResources = finalResources;
|
|
1074
|
+
return finalResources;
|
|
1075
|
+
}
|
|
1076
|
+
catch (error) {
|
|
1077
|
+
for (const texture of textures)
|
|
1078
|
+
this.host.gl.deleteTexture(texture);
|
|
1079
|
+
for (const framebuffer of framebuffers)
|
|
1080
|
+
this.host.gl.deleteFramebuffer(framebuffer);
|
|
1081
|
+
throw error;
|
|
1082
|
+
}
|
|
1083
|
+
finally {
|
|
1084
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, previousFramebuffer);
|
|
1085
|
+
this.host.lifecycle.restoreTextureUnit0(textureUnit0);
|
|
1086
|
+
this.host.stateCache.invalidate();
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
prepareFullscreenPresentation(framebuffer, outputWidth, outputHeight) {
|
|
1090
|
+
const textureUnit0 = this.host.lifecycle.captureTextureUnit0();
|
|
1091
|
+
const textureUnit1 = this.host.lifecycle.captureTextureUnitBinding(1);
|
|
1092
|
+
const textureUnit2 = this.host.lifecycle.captureTextureUnitBinding(2);
|
|
1093
|
+
this.host.gl.activeTexture(textureUnit0.activeTexture);
|
|
1094
|
+
const snapshot = {
|
|
1095
|
+
framebuffer: this.host.gl.getParameter(this.host.gl.FRAMEBUFFER_BINDING),
|
|
1096
|
+
program: this.host.gl.getParameter(this.host.gl.CURRENT_PROGRAM),
|
|
1097
|
+
textureUnit0,
|
|
1098
|
+
textureUnit1,
|
|
1099
|
+
textureUnit2,
|
|
1100
|
+
vertexArray: this.host.gl.getParameter(this.host.gl.VERTEX_ARRAY_BINDING),
|
|
1101
|
+
viewport: this.host.gl.getParameter(this.host.gl.VIEWPORT),
|
|
1102
|
+
colorMask: this.host.gl.getParameter(this.host.gl.COLOR_WRITEMASK),
|
|
1103
|
+
depthTestEnabled: this.host.gl.isEnabled(this.host.gl.DEPTH_TEST),
|
|
1104
|
+
cullFaceEnabled: this.host.gl.isEnabled(this.host.gl.CULL_FACE),
|
|
1105
|
+
blendEnabled: this.host.gl.isEnabled(this.host.gl.BLEND),
|
|
1106
|
+
scissorTestEnabled: this.host.gl.isEnabled(this.host.gl.SCISSOR_TEST),
|
|
1107
|
+
stencilTestEnabled: this.host.gl.isEnabled(this.host.gl.STENCIL_TEST),
|
|
1108
|
+
polygonOffsetFillEnabled: this.host.gl.isEnabled(this.host.gl.POLYGON_OFFSET_FILL),
|
|
1109
|
+
depthMask: this.host.gl.getParameter(this.host.gl.DEPTH_WRITEMASK)
|
|
1110
|
+
};
|
|
1111
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
|
|
1112
|
+
this.host.gl.viewport(0, 0, outputWidth, outputHeight);
|
|
1113
|
+
this.host.gl.colorMask(true, true, true, true);
|
|
1114
|
+
this.host.gl.disable(this.host.gl.SCISSOR_TEST);
|
|
1115
|
+
this.host.gl.disable(this.host.gl.STENCIL_TEST);
|
|
1116
|
+
this.host.gl.disable(this.host.gl.POLYGON_OFFSET_FILL);
|
|
1117
|
+
this.host.gl.disable(this.host.gl.DEPTH_TEST);
|
|
1118
|
+
this.host.gl.disable(this.host.gl.CULL_FACE);
|
|
1119
|
+
this.host.gl.disable(this.host.gl.BLEND);
|
|
1120
|
+
this.host.gl.depthMask(false);
|
|
1121
|
+
return snapshot;
|
|
1122
|
+
}
|
|
1123
|
+
restoreFullscreenPresentationState(snapshot, fallbackWidth, fallbackHeight) {
|
|
1124
|
+
this.host.gl.bindVertexArray(snapshot.vertexArray);
|
|
1125
|
+
this.host.lifecycle.restoreTextureUnitBinding(2, snapshot.textureUnit2);
|
|
1126
|
+
this.host.lifecycle.restoreTextureUnitBinding(1, snapshot.textureUnit1);
|
|
1127
|
+
this.host.lifecycle.restoreTextureUnit0(snapshot.textureUnit0);
|
|
1128
|
+
this.host.gl.useProgram(snapshot.program);
|
|
1129
|
+
if (snapshot.depthTestEnabled)
|
|
1130
|
+
this.host.gl.enable(this.host.gl.DEPTH_TEST);
|
|
1131
|
+
else
|
|
1132
|
+
this.host.gl.disable(this.host.gl.DEPTH_TEST);
|
|
1133
|
+
if (snapshot.cullFaceEnabled)
|
|
1134
|
+
this.host.gl.enable(this.host.gl.CULL_FACE);
|
|
1135
|
+
else
|
|
1136
|
+
this.host.gl.disable(this.host.gl.CULL_FACE);
|
|
1137
|
+
if (snapshot.blendEnabled)
|
|
1138
|
+
this.host.gl.enable(this.host.gl.BLEND);
|
|
1139
|
+
else
|
|
1140
|
+
this.host.gl.disable(this.host.gl.BLEND);
|
|
1141
|
+
if (snapshot.scissorTestEnabled)
|
|
1142
|
+
this.host.gl.enable(this.host.gl.SCISSOR_TEST);
|
|
1143
|
+
else
|
|
1144
|
+
this.host.gl.disable(this.host.gl.SCISSOR_TEST);
|
|
1145
|
+
if (snapshot.stencilTestEnabled)
|
|
1146
|
+
this.host.gl.enable(this.host.gl.STENCIL_TEST);
|
|
1147
|
+
else
|
|
1148
|
+
this.host.gl.disable(this.host.gl.STENCIL_TEST);
|
|
1149
|
+
if (snapshot.polygonOffsetFillEnabled)
|
|
1150
|
+
this.host.gl.enable(this.host.gl.POLYGON_OFFSET_FILL);
|
|
1151
|
+
else
|
|
1152
|
+
this.host.gl.disable(this.host.gl.POLYGON_OFFSET_FILL);
|
|
1153
|
+
const colorMask = snapshot.colorMask ?? [true, true, true, true];
|
|
1154
|
+
this.host.gl.colorMask(colorMask[0] ?? true, colorMask[1] ?? true, colorMask[2] ?? true, colorMask[3] ?? true);
|
|
1155
|
+
this.host.gl.depthMask(snapshot.depthMask);
|
|
1156
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, snapshot.framebuffer);
|
|
1157
|
+
const viewport = snapshot.viewport ?? [0, 0, fallbackWidth, fallbackHeight];
|
|
1158
|
+
this.host.gl.viewport(viewport[0] ?? 0, viewport[1] ?? 0, viewport[2] ?? fallbackWidth, viewport[3] ?? fallbackHeight);
|
|
1159
|
+
this.host.stateCache.invalidate();
|
|
1160
|
+
}
|
|
1161
|
+
ensurePresentationVertexArray() {
|
|
1162
|
+
if (this.presentationVertexArray)
|
|
1163
|
+
return this.presentationVertexArray;
|
|
1164
|
+
const vertexArray = this.host.gl.createVertexArray();
|
|
1165
|
+
if (!vertexArray) {
|
|
1166
|
+
throw new RenderDeviceError("Failed to allocate WebGL presentation vertex array", "WEBGL_ALLOCATION_FAILED");
|
|
1167
|
+
}
|
|
1168
|
+
this.presentationVertexArray = vertexArray;
|
|
1169
|
+
return vertexArray;
|
|
1170
|
+
}
|
|
1171
|
+
ensurePresentationProgram() {
|
|
1172
|
+
if (this.presentationProgram) {
|
|
1173
|
+
return this.presentationProgram;
|
|
1174
|
+
}
|
|
1175
|
+
const vertex = this.host.device.compileShader(this.host.gl.VERTEX_SHADER, `#version 300 es
|
|
1176
|
+
precision highp float;
|
|
1177
|
+
out vec2 v_uv;
|
|
1178
|
+
void main() {
|
|
1179
|
+
vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
1180
|
+
v_uv = position;
|
|
1181
|
+
gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
|
|
1182
|
+
}
|
|
1183
|
+
`, "webgl2-present-render-target");
|
|
1184
|
+
const fragment = this.host.device.compileShader(this.host.gl.FRAGMENT_SHADER, `#version 300 es
|
|
1185
|
+
precision highp float;
|
|
1186
|
+
uniform sampler2D u_source;
|
|
1187
|
+
in vec2 v_uv;
|
|
1188
|
+
out vec4 outColor;
|
|
1189
|
+
void main() {
|
|
1190
|
+
outColor = texture(u_source, v_uv);
|
|
1191
|
+
}
|
|
1192
|
+
`, "webgl2-present-render-target");
|
|
1193
|
+
const program = this.host.gl.createProgram();
|
|
1194
|
+
if (!program) {
|
|
1195
|
+
this.host.gl.deleteShader(vertex);
|
|
1196
|
+
this.host.gl.deleteShader(fragment);
|
|
1197
|
+
throw new RenderDeviceError("Failed to allocate WebGL presentation shader", "WEBGL_ALLOCATION_FAILED");
|
|
1198
|
+
}
|
|
1199
|
+
this.host.gl.attachShader(program, vertex);
|
|
1200
|
+
this.host.gl.attachShader(program, fragment);
|
|
1201
|
+
this.host.gl.linkProgram(program);
|
|
1202
|
+
this.host.counters.programCompiles += 1;
|
|
1203
|
+
this.host.gl.deleteShader(vertex);
|
|
1204
|
+
this.host.gl.deleteShader(fragment);
|
|
1205
|
+
if (!this.host.gl.getProgramParameter(program, this.host.gl.LINK_STATUS)) {
|
|
1206
|
+
const log = this.host.gl.getProgramInfoLog(program) ?? "Unknown presentation shader link error";
|
|
1207
|
+
this.host.gl.deleteProgram(program);
|
|
1208
|
+
throw new RenderDeviceError("WebGL presentation shader link failed", "SHADER_LINK_FAILED", { log });
|
|
1209
|
+
}
|
|
1210
|
+
this.presentationProgram = program;
|
|
1211
|
+
return program;
|
|
1212
|
+
}
|
|
1213
|
+
ensureBloomBrightExtractProgram() {
|
|
1214
|
+
if (this.bloomBrightExtractProgram) {
|
|
1215
|
+
return this.bloomBrightExtractProgram;
|
|
1216
|
+
}
|
|
1217
|
+
this.bloomBrightExtractProgram = this.createFullscreenProgram(BLOOM_BRIGHT_EXTRACT_GLSL, "webgl2-bloom-bright-extract");
|
|
1218
|
+
return this.bloomBrightExtractProgram;
|
|
1219
|
+
}
|
|
1220
|
+
ensureBloomBlurProgram() {
|
|
1221
|
+
if (this.bloomBlurProgram) {
|
|
1222
|
+
return this.bloomBlurProgram;
|
|
1223
|
+
}
|
|
1224
|
+
this.bloomBlurProgram = this.createFullscreenProgram(`#version 300 es
|
|
1225
|
+
precision highp float;
|
|
1226
|
+
precision highp int;
|
|
1227
|
+
uniform sampler2D u_source;
|
|
1228
|
+
uniform ivec2 u_size;
|
|
1229
|
+
uniform int u_radius;
|
|
1230
|
+
uniform int u_horizontal;
|
|
1231
|
+
uniform int u_hdr;
|
|
1232
|
+
out vec4 outColor;
|
|
1233
|
+
|
|
1234
|
+
vec4 sourcePixel(ivec2 coordinate) {
|
|
1235
|
+
return texelFetch(u_source, clamp(coordinate, ivec2(0), u_size - ivec2(1)), 0);
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
void main() {
|
|
1239
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1240
|
+
float sigma = max(float(u_radius) / 3.0, 0.5);
|
|
1241
|
+
float coefficient = 0.39894 / sigma;
|
|
1242
|
+
vec4 sum = sourcePixel(pixel) * coefficient;
|
|
1243
|
+
float weightSum = coefficient;
|
|
1244
|
+
// 24 covers the flag-on §6.6 kernels (≤ 22); flag-off radii stay ≤ 16.
|
|
1245
|
+
for (int offset = 1; offset <= 24; offset += 1) {
|
|
1246
|
+
if (offset > u_radius) continue;
|
|
1247
|
+
float distance = float(offset);
|
|
1248
|
+
float weight = coefficient * exp(-0.5 * distance * distance / (sigma * sigma));
|
|
1249
|
+
ivec2 delta = u_horizontal == 1 ? ivec2(offset, 0) : ivec2(0, offset);
|
|
1250
|
+
sum += (sourcePixel(pixel + delta) + sourcePixel(pixel - delta)) * weight;
|
|
1251
|
+
weightSum += 2.0 * weight;
|
|
1252
|
+
}
|
|
1253
|
+
outColor = sum / max(weightSum, 0.000001);
|
|
1254
|
+
}
|
|
1255
|
+
`, "webgl2-bloom-blur");
|
|
1256
|
+
return this.bloomBlurProgram;
|
|
1257
|
+
}
|
|
1258
|
+
ensureBloomCompositeProgram() {
|
|
1259
|
+
if (this.bloomCompositeProgram) {
|
|
1260
|
+
return this.bloomCompositeProgram;
|
|
1261
|
+
}
|
|
1262
|
+
this.bloomCompositeProgram = this.createFullscreenProgram(`#version 300 es
|
|
1263
|
+
precision highp float;
|
|
1264
|
+
precision highp int;
|
|
1265
|
+
uniform sampler2D u_source;
|
|
1266
|
+
uniform sampler2D u_blurred;
|
|
1267
|
+
uniform sampler2D u_compositeLut;
|
|
1268
|
+
uniform int u_hdr;
|
|
1269
|
+
uniform float u_intensity;
|
|
1270
|
+
out vec4 outColor;
|
|
1271
|
+
|
|
1272
|
+
uvec4 byteTexel(sampler2D source, ivec2 coordinate) {
|
|
1273
|
+
return uvec4(texelFetch(source, coordinate, 0) * 255.0 + 0.5);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
float compositeChannel(uint source, uint blurred) {
|
|
1277
|
+
return texelFetch(u_compositeLut, ivec2(int(source), int(blurred)), 0).r;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
void main() {
|
|
1281
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1282
|
+
if (u_hdr == 1) {
|
|
1283
|
+
vec4 source = texelFetch(u_source, pixel, 0);
|
|
1284
|
+
vec3 blurred = texelFetch(u_blurred, pixel, 0).rgb;
|
|
1285
|
+
outColor = vec4(source.rgb + blurred * u_intensity, source.a);
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
uvec4 source = byteTexel(u_source, pixel);
|
|
1289
|
+
uvec4 blurred = byteTexel(u_blurred, pixel);
|
|
1290
|
+
outColor = vec4(
|
|
1291
|
+
compositeChannel(source.r, blurred.r),
|
|
1292
|
+
compositeChannel(source.g, blurred.g),
|
|
1293
|
+
compositeChannel(source.b, blurred.b),
|
|
1294
|
+
float(source.a) / 255.0
|
|
1295
|
+
);
|
|
1296
|
+
}
|
|
1297
|
+
`, "webgl2-bloom-composite");
|
|
1298
|
+
return this.bloomCompositeProgram;
|
|
1299
|
+
}
|
|
1300
|
+
ensureBloomDownsampleProgram() {
|
|
1301
|
+
if (this.bloomDownsampleProgram)
|
|
1302
|
+
return this.bloomDownsampleProgram;
|
|
1303
|
+
this.bloomDownsampleProgram = this.createFullscreenProgram(`#version 300 es
|
|
1304
|
+
precision highp float;
|
|
1305
|
+
uniform sampler2D u_source;
|
|
1306
|
+
uniform vec2 u_texelSize;
|
|
1307
|
+
uniform vec2 u_targetSize;
|
|
1308
|
+
out vec4 outColor;
|
|
1309
|
+
void main() {
|
|
1310
|
+
// gl_FragCoord is expressed in destination pixels. Normalize by the
|
|
1311
|
+
// destination size so every downsample covers the complete source image;
|
|
1312
|
+
// multiplying by source texel size cropped a half-size target to the
|
|
1313
|
+
// lower-left quarter of the preceding level.
|
|
1314
|
+
vec2 uv = gl_FragCoord.xy / u_targetSize;
|
|
1315
|
+
vec2 e = u_texelSize * 0.5;
|
|
1316
|
+
vec4 sum = texture(u_source, uv - e) + texture(u_source, uv + vec2(e.x, -e.y))
|
|
1317
|
+
+ texture(u_source, uv + vec2(-e.x, e.y)) + texture(u_source, uv + e);
|
|
1318
|
+
outColor = sum * 0.25;
|
|
1319
|
+
}
|
|
1320
|
+
`, "webgl2-bloom-downsample");
|
|
1321
|
+
return this.bloomDownsampleProgram;
|
|
1322
|
+
}
|
|
1323
|
+
ensureBloomAccumulateProgram() {
|
|
1324
|
+
if (this.bloomAccumulateProgram)
|
|
1325
|
+
return this.bloomAccumulateProgram;
|
|
1326
|
+
this.bloomAccumulateProgram = this.createFullscreenProgram(`#version 300 es
|
|
1327
|
+
precision highp float;
|
|
1328
|
+
uniform sampler2D u_base;
|
|
1329
|
+
uniform sampler2D u_bloom;
|
|
1330
|
+
uniform float u_weight;
|
|
1331
|
+
out vec4 outColor;
|
|
1332
|
+
void main() {
|
|
1333
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1334
|
+
vec4 base = texelFetch(u_base, pixel, 0);
|
|
1335
|
+
vec2 uv = (vec2(pixel) + 0.5) / vec2(textureSize(u_base, 0));
|
|
1336
|
+
vec3 bloom = texture(u_bloom, uv).rgb;
|
|
1337
|
+
outColor = vec4(base.rgb + bloom * u_weight, base.a);
|
|
1338
|
+
}
|
|
1339
|
+
`, "webgl2-bloom-accumulate");
|
|
1340
|
+
return this.bloomAccumulateProgram;
|
|
1341
|
+
}
|
|
1342
|
+
ensureOutlineProgram() {
|
|
1343
|
+
if (this.outlineProgram)
|
|
1344
|
+
return this.outlineProgram;
|
|
1345
|
+
this.outlineProgram = this.createFullscreenProgram(`#version 300 es
|
|
1346
|
+
precision highp float;
|
|
1347
|
+
precision highp int;
|
|
1348
|
+
uniform sampler2D u_source;
|
|
1349
|
+
uniform sampler2D u_blendLut;
|
|
1350
|
+
uniform ivec2 u_size;
|
|
1351
|
+
uniform int u_width;
|
|
1352
|
+
uniform float u_boundHigh;
|
|
1353
|
+
uniform float u_boundLow;
|
|
1354
|
+
out vec4 outColor;
|
|
1355
|
+
|
|
1356
|
+
uvec4 sourceByte(ivec2 coordinate) {
|
|
1357
|
+
ivec2 bounded = clamp(coordinate, ivec2(0), u_size - ivec2(1));
|
|
1358
|
+
return uvec4(texelFetch(u_source, bounded, 0) * 255.0 + 0.5);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
uint lumaNumerator(ivec2 coordinate) {
|
|
1362
|
+
uvec3 source = sourceByte(coordinate).rgb;
|
|
1363
|
+
return 2126u * source.r + 7152u * source.g + 722u * source.b;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
uvec2 squareWords(int signedValue) {
|
|
1367
|
+
uint value = uint(abs(signedValue));
|
|
1368
|
+
uint high = value >> 12u;
|
|
1369
|
+
uint low = value & 4095u;
|
|
1370
|
+
uint middle = 2u * high * low;
|
|
1371
|
+
uint lowWord = low * low + (middle & 4095u) * 4096u;
|
|
1372
|
+
uint highWord = high * high + (middle >> 12u);
|
|
1373
|
+
highWord += lowWord / ${OUTLINE_LIMB_RADIX}u;
|
|
1374
|
+
lowWord %= ${OUTLINE_LIMB_RADIX}u;
|
|
1375
|
+
return uvec2(highWord, lowWord);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
bool edgeAt(ivec2 pixel) {
|
|
1379
|
+
int nw = int(lumaNumerator(pixel + ivec2(-1, -1)));
|
|
1380
|
+
int n = int(lumaNumerator(pixel + ivec2(0, -1)));
|
|
1381
|
+
int ne = int(lumaNumerator(pixel + ivec2(1, -1)));
|
|
1382
|
+
int w = int(lumaNumerator(pixel + ivec2(-1, 0)));
|
|
1383
|
+
int e = int(lumaNumerator(pixel + ivec2(1, 0)));
|
|
1384
|
+
int sw = int(lumaNumerator(pixel + ivec2(-1, 1)));
|
|
1385
|
+
int s = int(lumaNumerator(pixel + ivec2(0, 1)));
|
|
1386
|
+
int se = int(lumaNumerator(pixel + ivec2(1, 1)));
|
|
1387
|
+
int gx = -nw - 2 * w - sw + ne + 2 * e + se;
|
|
1388
|
+
int gy = -nw - 2 * n - ne + sw + 2 * s + se;
|
|
1389
|
+
uvec2 x = squareWords(gx);
|
|
1390
|
+
uvec2 y = squareWords(gy);
|
|
1391
|
+
uint low = x.y + y.y;
|
|
1392
|
+
uint high = x.x + y.x;
|
|
1393
|
+
if (low >= ${OUTLINE_LIMB_RADIX}u) {
|
|
1394
|
+
low -= ${OUTLINE_LIMB_RADIX}u;
|
|
1395
|
+
high += 1u;
|
|
1396
|
+
}
|
|
1397
|
+
uint boundHigh = uint(u_boundHigh);
|
|
1398
|
+
uint boundLow = uint(u_boundLow);
|
|
1399
|
+
return high != boundHigh ? high > boundHigh : low >= boundLow;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
void main() {
|
|
1403
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1404
|
+
bool outlined = false;
|
|
1405
|
+
for (int offsetY = -6; offsetY <= 6 && !outlined; offsetY += 1) {
|
|
1406
|
+
for (int offsetX = -6; offsetX <= 6; offsetX += 1) {
|
|
1407
|
+
if (abs(offsetX) > u_width || abs(offsetY) > u_width) continue;
|
|
1408
|
+
if (offsetX * offsetX + offsetY * offsetY > u_width * u_width) continue;
|
|
1409
|
+
ivec2 candidate = clamp(pixel + ivec2(offsetX, offsetY), ivec2(0), u_size - ivec2(1));
|
|
1410
|
+
if (edgeAt(candidate)) {
|
|
1411
|
+
outlined = true;
|
|
1412
|
+
break;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
uvec4 source = sourceByte(pixel);
|
|
1417
|
+
if (!outlined) {
|
|
1418
|
+
outColor = vec4(source) / 255.0;
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
outColor = vec4(
|
|
1422
|
+
texelFetch(u_blendLut, ivec2(int(source.r), 0), 0).r,
|
|
1423
|
+
texelFetch(u_blendLut, ivec2(int(source.g), 0), 0).g,
|
|
1424
|
+
texelFetch(u_blendLut, ivec2(int(source.b), 0), 0).b,
|
|
1425
|
+
float(source.a) / 255.0
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
`, "webgl2-outline");
|
|
1429
|
+
return this.outlineProgram;
|
|
1430
|
+
}
|
|
1431
|
+
ensureSsaoProgram() {
|
|
1432
|
+
if (this.ssaoProgram)
|
|
1433
|
+
return this.ssaoProgram;
|
|
1434
|
+
this.ssaoProgram = this.createFullscreenProgram(`#version 300 es
|
|
1435
|
+
precision highp float;
|
|
1436
|
+
precision highp int;
|
|
1437
|
+
uniform sampler2D u_source;
|
|
1438
|
+
uniform sampler2D u_depth;
|
|
1439
|
+
uniform ivec2 u_size;
|
|
1440
|
+
uniform int u_radius;
|
|
1441
|
+
uniform float u_intensity;
|
|
1442
|
+
uniform float u_bias;
|
|
1443
|
+
out vec4 outColor;
|
|
1444
|
+
|
|
1445
|
+
float depthAt(ivec2 coordinate) {
|
|
1446
|
+
return texelFetch(u_depth, clamp(coordinate, ivec2(0), u_size - ivec2(1)), 0).r;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
void main() {
|
|
1450
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1451
|
+
float centerDepth = depthAt(pixel);
|
|
1452
|
+
float occlusion = 0.0;
|
|
1453
|
+
float samples = 0.0;
|
|
1454
|
+
for (int stepY = -1; stepY <= 1; stepY += 1) {
|
|
1455
|
+
for (int stepX = -1; stepX <= 1; stepX += 1) {
|
|
1456
|
+
if (stepX == 0 && stepY == 0) continue;
|
|
1457
|
+
float sampleDepth = depthAt(pixel + ivec2(stepX * u_radius, stepY * u_radius));
|
|
1458
|
+
occlusion += clamp(
|
|
1459
|
+
(centerDepth - sampleDepth - u_bias) / (0.14 + float(u_radius) * 0.04),
|
|
1460
|
+
0.0,
|
|
1461
|
+
1.0
|
|
1462
|
+
);
|
|
1463
|
+
samples += 1.0;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
float factor = max(0.18, 1.0 - (occlusion / max(1.0, samples)) * u_intensity * 0.72);
|
|
1467
|
+
vec4 source = texelFetch(u_source, pixel, 0);
|
|
1468
|
+
outColor = vec4(source.rgb * factor, source.a);
|
|
1469
|
+
}
|
|
1470
|
+
`, "webgl2-ssao");
|
|
1471
|
+
return this.ssaoProgram;
|
|
1472
|
+
}
|
|
1473
|
+
ensureSsrProgram() {
|
|
1474
|
+
if (this.ssrProgram)
|
|
1475
|
+
return this.ssrProgram;
|
|
1476
|
+
this.ssrProgram = this.createFullscreenProgram(`#version 300 es
|
|
1477
|
+
precision highp float;
|
|
1478
|
+
precision highp int;
|
|
1479
|
+
uniform sampler2D u_source;
|
|
1480
|
+
uniform sampler2D u_depth;
|
|
1481
|
+
uniform sampler2D u_normalMask;
|
|
1482
|
+
uniform ivec2 u_size;
|
|
1483
|
+
uniform float u_intensity;
|
|
1484
|
+
uniform float u_maxDistance;
|
|
1485
|
+
uniform int u_maxSteps;
|
|
1486
|
+
uniform float u_thickness;
|
|
1487
|
+
uniform int u_hasNormalMask;
|
|
1488
|
+
uniform mat4 u_projection;
|
|
1489
|
+
uniform mat4 u_inverseProjection;
|
|
1490
|
+
out vec4 outColor;
|
|
1491
|
+
vec3 positionAtDepth(vec2 uv, float depth) {
|
|
1492
|
+
vec4 p = u_inverseProjection * vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
|
1493
|
+
return p.xyz / p.w;
|
|
1494
|
+
}
|
|
1495
|
+
vec3 positionAt(vec2 uv) {
|
|
1496
|
+
return positionAtDepth(uv, texture(u_depth, uv).r);
|
|
1497
|
+
}
|
|
1498
|
+
vec3 viewDirection(vec2 uv) {
|
|
1499
|
+
return normalize(positionAtDepth(uv, 0.999) - positionAtDepth(uv, 0.0));
|
|
1500
|
+
}
|
|
1501
|
+
vec2 projectPosition(vec3 p) {
|
|
1502
|
+
vec4 clip = u_projection * vec4(p, 1.0);
|
|
1503
|
+
return clip.xy / clip.w * 0.5 + 0.5;
|
|
1504
|
+
}
|
|
1505
|
+
float depthDifference(vec3 p, vec2 uv) {
|
|
1506
|
+
return dot(p - positionAt(uv), viewDirection(uv));
|
|
1507
|
+
}
|
|
1508
|
+
void main() {
|
|
1509
|
+
vec2 uv = gl_FragCoord.xy / vec2(u_size);
|
|
1510
|
+
vec4 base = texture(u_source, uv);
|
|
1511
|
+
outColor = base;
|
|
1512
|
+
vec3 origin = positionAt(uv);
|
|
1513
|
+
vec4 normalMask = texture(u_normalMask, uv);
|
|
1514
|
+
vec3 normal = u_hasNormalMask == 1 ? normalize(normalMask.xyz * 2.0 - 1.0) : normalize(cross(dFdx(origin), dFdy(origin)));
|
|
1515
|
+
float roughness = u_hasNormalMask == 1 ? normalMask.a : 0.25;
|
|
1516
|
+
if (texture(u_depth, uv).r >= 0.999999 || (u_hasNormalMask == 1 && normalMask.a == 0.0) || roughness >= 1.0) return;
|
|
1517
|
+
vec3 ray = normalize(reflect(viewDirection(uv), normal));
|
|
1518
|
+
float stepSize = u_maxDistance / float(u_maxSteps);
|
|
1519
|
+
vec3 start = origin + normal * u_thickness;
|
|
1520
|
+
float previous = 0.0;
|
|
1521
|
+
for (int i = 1; i <= 64; ++i) {
|
|
1522
|
+
if (i > u_maxSteps) break;
|
|
1523
|
+
float distanceAlong = float(i) * stepSize;
|
|
1524
|
+
vec3 candidate = start + ray * distanceAlong;
|
|
1525
|
+
vec4 candidateClip = u_projection * vec4(candidate, 1.0);
|
|
1526
|
+
if (candidateClip.w <= 0.0 || abs(candidateClip.z) >= candidateClip.w) break;
|
|
1527
|
+
vec2 hitUV = projectPosition(candidate);
|
|
1528
|
+
if (any(lessThanEqual(hitUV, vec2(0.0))) || any(greaterThanEqual(hitUV, vec2(1.0)))) break;
|
|
1529
|
+
float difference = depthDifference(candidate, hitUV);
|
|
1530
|
+
if (difference >= 0.0 && previous < 0.0) {
|
|
1531
|
+
float lo = distanceAlong - stepSize, hi = distanceAlong;
|
|
1532
|
+
for (int j = 0; j < 5; ++j) {
|
|
1533
|
+
float mid = (lo + hi) * 0.5;
|
|
1534
|
+
vec3 point = start + ray * mid;
|
|
1535
|
+
if (depthDifference(point, projectPosition(point)) >= 0.0) hi = mid; else lo = mid;
|
|
1536
|
+
}
|
|
1537
|
+
candidate = start + ray * hi;
|
|
1538
|
+
hitUV = projectPosition(candidate);
|
|
1539
|
+
difference = depthDifference(candidate, hitUV);
|
|
1540
|
+
if (difference > u_thickness || texture(u_depth, hitUV).r >= 0.999999) break;
|
|
1541
|
+
float edge = smoothstep(0.0, 0.08, min(min(hitUV.x, hitUV.y), min(1.0 - hitUV.x, 1.0 - hitUV.y)));
|
|
1542
|
+
float response = clamp(u_intensity * edge * (1.0 - roughness) * (1.0 - hi / u_maxDistance), 0.0, 1.0);
|
|
1543
|
+
outColor = vec4(mix(base.rgb, texture(u_source, hitUV).rgb, response), base.a);
|
|
1544
|
+
break;
|
|
1545
|
+
}
|
|
1546
|
+
previous = difference;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
`, "webgl2-ssr");
|
|
1550
|
+
return this.ssrProgram;
|
|
1551
|
+
}
|
|
1552
|
+
ensureDepthOfFieldProgram() {
|
|
1553
|
+
if (this.depthOfFieldProgram)
|
|
1554
|
+
return this.depthOfFieldProgram;
|
|
1555
|
+
this.depthOfFieldProgram = this.createFullscreenProgram(`#version 300 es
|
|
1556
|
+
precision highp float;
|
|
1557
|
+
precision highp int;
|
|
1558
|
+
uniform sampler2D u_source;
|
|
1559
|
+
uniform sampler2D u_depth;
|
|
1560
|
+
uniform ivec2 u_size;
|
|
1561
|
+
uniform float u_focusDepth;
|
|
1562
|
+
uniform float u_focusRange;
|
|
1563
|
+
uniform int u_maxRadius;
|
|
1564
|
+
uniform float u_depthNear;
|
|
1565
|
+
uniform float u_depthFar;
|
|
1566
|
+
out vec4 outColor;
|
|
1567
|
+
|
|
1568
|
+
// Same linearization contract as the SSR program, except focus is authored
|
|
1569
|
+
// directly as a linear-distance fraction (0 = near plane, 1 = far plane):
|
|
1570
|
+
// buffer-unit focus values are unusable once depth is linearized, because the
|
|
1571
|
+
// projection curve parks the whole play area inside a sliver of buffer units.
|
|
1572
|
+
// The CPU byte kernel keeps buffer-unit semantics; the divergence is
|
|
1573
|
+
// documented at normalizeLdrDepthRange.
|
|
1574
|
+
float a3dDofLinearDepth(float depth) {
|
|
1575
|
+
float viewZ = u_depthNear * u_depthFar / max(u_depthFar - depth * (u_depthFar - u_depthNear), 0.0001);
|
|
1576
|
+
return clamp((viewZ - u_depthNear) / max(u_depthFar - u_depthNear, 0.0001), 0.0, 1.0);
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
void main() {
|
|
1580
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1581
|
+
vec4 source = texelFetch(u_source, pixel, 0);
|
|
1582
|
+
float linearDepth = a3dDofLinearDepth(texelFetch(u_depth, pixel, 0).r);
|
|
1583
|
+
float normalizedBlur = max(0.0, abs(linearDepth - u_focusDepth) - u_focusRange)
|
|
1584
|
+
/ max(u_focusRange, 0.001) * float(u_maxRadius);
|
|
1585
|
+
int radius = min(u_maxRadius, int(round(normalizedBlur)));
|
|
1586
|
+
if (radius == 0) {
|
|
1587
|
+
outColor = source;
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
vec3 sum = vec3(0.0);
|
|
1591
|
+
float samples = 0.0;
|
|
1592
|
+
for (int offsetY = -8; offsetY <= 8; offsetY += 1) {
|
|
1593
|
+
for (int offsetX = -8; offsetX <= 8; offsetX += 1) {
|
|
1594
|
+
if (abs(offsetX) > radius || abs(offsetY) > radius) continue;
|
|
1595
|
+
if (offsetX * offsetX + offsetY * offsetY > radius * radius) continue;
|
|
1596
|
+
ivec2 samplePixel = clamp(pixel + ivec2(offsetX, offsetY), ivec2(0), u_size - ivec2(1));
|
|
1597
|
+
sum += texelFetch(u_source, samplePixel, 0).rgb;
|
|
1598
|
+
samples += 1.0;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
outColor = vec4(sum / max(1.0, samples), source.a);
|
|
1602
|
+
}
|
|
1603
|
+
`, "webgl2-depth-of-field");
|
|
1604
|
+
return this.depthOfFieldProgram;
|
|
1605
|
+
}
|
|
1606
|
+
ensureMotionBlurProgram() {
|
|
1607
|
+
if (this.motionBlurProgram)
|
|
1608
|
+
return this.motionBlurProgram;
|
|
1609
|
+
this.motionBlurProgram = this.createFullscreenProgram(`#version 300 es
|
|
1610
|
+
precision highp float;
|
|
1611
|
+
precision highp int;
|
|
1612
|
+
uniform sampler2D u_source;
|
|
1613
|
+
uniform sampler2D u_velocity;
|
|
1614
|
+
uniform bool u_velocityUv;
|
|
1615
|
+
uniform ivec2 u_size;
|
|
1616
|
+
uniform int u_samples;
|
|
1617
|
+
uniform float u_scale;
|
|
1618
|
+
out vec4 outColor;
|
|
1619
|
+
|
|
1620
|
+
void main() {
|
|
1621
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1622
|
+
vec4 source = texelFetch(u_source, pixel, 0);
|
|
1623
|
+
vec2 velocity = texelFetch(u_velocity, pixel, 0).rg * u_scale;
|
|
1624
|
+
if (u_velocityUv) velocity *= vec2(u_size);
|
|
1625
|
+
velocity = clamp(velocity, vec2(-64.0), vec2(64.0));
|
|
1626
|
+
if (length(velocity) < 0.01) {
|
|
1627
|
+
outColor = source;
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
vec3 sum = vec3(0.0);
|
|
1631
|
+
for (int sampleIndex = 0; sampleIndex < 16; sampleIndex += 1) {
|
|
1632
|
+
if (sampleIndex >= u_samples) continue;
|
|
1633
|
+
float t = float(sampleIndex) / float(u_samples - 1) - 0.5;
|
|
1634
|
+
ivec2 samplePixel = ivec2(floor(vec2(pixel) - velocity * t + vec2(0.5)));
|
|
1635
|
+
samplePixel = clamp(samplePixel, ivec2(0), u_size - ivec2(1));
|
|
1636
|
+
sum += texelFetch(u_source, samplePixel, 0).rgb;
|
|
1637
|
+
}
|
|
1638
|
+
outColor = vec4(sum / float(u_samples), source.a);
|
|
1639
|
+
}
|
|
1640
|
+
`, "webgl2-motion-blur");
|
|
1641
|
+
return this.motionBlurProgram;
|
|
1642
|
+
}
|
|
1643
|
+
ensureTaaProgram() {
|
|
1644
|
+
if (this.taaProgram)
|
|
1645
|
+
return this.taaProgram;
|
|
1646
|
+
this.taaProgram = this.createFullscreenProgram(`#version 300 es
|
|
1647
|
+
precision highp float;
|
|
1648
|
+
uniform sampler2D u_source;
|
|
1649
|
+
uniform sampler2D u_history;
|
|
1650
|
+
uniform sampler2D u_velocity;
|
|
1651
|
+
uniform float u_blend;
|
|
1652
|
+
uniform bool u_temporal;
|
|
1653
|
+
out vec4 outColor;
|
|
1654
|
+
vec4 cubicWeights(float f) {
|
|
1655
|
+
float f2=f*f, f3=f2*f;
|
|
1656
|
+
return vec4(-0.5*f+f2-0.5*f3,1.0-2.5*f2+1.5*f3,0.5*f+2.0*f2-1.5*f3,-0.5*f2+0.5*f3);
|
|
1657
|
+
}
|
|
1658
|
+
vec4 historyAt(vec2 uv) {
|
|
1659
|
+
ivec2 size=textureSize(u_history,0);
|
|
1660
|
+
vec2 position=uv*vec2(size)-0.5;
|
|
1661
|
+
ivec2 base=ivec2(floor(position));
|
|
1662
|
+
vec4 wx=cubicWeights(fract(position.x)), wy=cubicWeights(fract(position.y));
|
|
1663
|
+
vec4 result=vec4(0.0);
|
|
1664
|
+
// Repeated bilinear history reconstruction diffuses a moving edge every
|
|
1665
|
+
// frame. Cubic reconstruction preserves it; the resolve's current-neighbor
|
|
1666
|
+
// clipping below bounds ringing before accumulation.
|
|
1667
|
+
for(int y=0;y<4;y++) for(int x=0;x<4;x++) {
|
|
1668
|
+
result+=texelFetch(u_history,clamp(base+ivec2(x-1,y-1),ivec2(0),size-1),0)*wx[x]*wy[y];
|
|
1669
|
+
}
|
|
1670
|
+
return result;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
void main() {
|
|
1674
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
1675
|
+
ivec2 size = textureSize(u_source, 0);
|
|
1676
|
+
vec2 outputUV=(vec2(pixel)+0.5)/vec2(size);
|
|
1677
|
+
// Raster jitter supplies quadrature samples inside the output pixel.
|
|
1678
|
+
// Keep that sample on its pixel's accumulation grid; undoing the jitter
|
|
1679
|
+
// spatially filters it and defeats temporal coverage integration.
|
|
1680
|
+
vec2 sourceUV=outputUV;
|
|
1681
|
+
ivec2 sourcePixel=clamp(ivec2(floor(sourceUV*vec2(size))),ivec2(0),size-1);
|
|
1682
|
+
// Reconstruct current color on the stable output grid before accumulation.
|
|
1683
|
+
vec4 source = texelFetch(u_source, pixel, 0);
|
|
1684
|
+
vec4 motion = u_temporal ? texelFetch(u_velocity, sourcePixel, 0) : vec4(0.0);
|
|
1685
|
+
// A currently uncovered sample may still carry integrated foreground
|
|
1686
|
+
// coverage in history. Track nearby foreground motion for that coverage,
|
|
1687
|
+
// but retain this pixel's own current/previous depth tags: copying RGBA
|
|
1688
|
+
// wholesale falsely labels background color as a foreground surface.
|
|
1689
|
+
if (u_temporal) {
|
|
1690
|
+
float nearestDepth=motion.b;
|
|
1691
|
+
for(int y=-1;y<=1;y++) for(int x=-1;x<=1;x++) {
|
|
1692
|
+
vec4 candidate=texelFetch(u_velocity,clamp(pixel+ivec2(x,y),ivec2(0),size-1),0);
|
|
1693
|
+
if(candidate.b<nearestDepth) {nearestDepth=candidate.b;motion.xy=candidate.xy;}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
vec2 previousUV = outputUV-motion.xy;
|
|
1697
|
+
vec4 history = u_temporal ? historyAt(previousUV) : texture(u_history, previousUV);
|
|
1698
|
+
float weight = u_blend;
|
|
1699
|
+
if (u_temporal) {
|
|
1700
|
+
// Reprojected history incurs reconstruction error as the footprint moves
|
|
1701
|
+
// across the pixel grid. Reduce its confidence with displacement instead
|
|
1702
|
+
// of repeatedly giving a softened moving edge the stationary .9 weight.
|
|
1703
|
+
// Physical motion itself remains fully represented in previousUV.
|
|
1704
|
+
weight /= 1.0 + length(motion.xy * vec2(size));
|
|
1705
|
+
// Depth is categorical at a silhouette: bilinear alpha interpolation creates
|
|
1706
|
+
// nonexistent surfaces and rejects valid history on every jittered edge.
|
|
1707
|
+
// Test surface presence in the central history footprint. RGB remains
|
|
1708
|
+
// an integrated coverage value reconstructed from the wider cubic kernel.
|
|
1709
|
+
ivec2 previousBase=ivec2(floor(previousUV*vec2(size)-vec2(0.5)));
|
|
1710
|
+
float depthError=1.0;
|
|
1711
|
+
for(int y=0;y<2;y++) for(int x=0;x<2;x++) {
|
|
1712
|
+
float previousDepth=texelFetch(u_history,clamp(previousBase+ivec2(x,y),ivec2(0),size-1),0).a;
|
|
1713
|
+
depthError=min(depthError,abs(previousDepth-motion.a));
|
|
1714
|
+
}
|
|
1715
|
+
if (any(lessThan(previousUV,vec2(0.0))) || any(greaterThanEqual(previousUV,vec2(1.0))) || depthError>0.002) weight=0.0;
|
|
1716
|
+
vec3 lo=source.rgb, hi=source.rgb;
|
|
1717
|
+
for(int y=-1;y<=1;y++) for(int x=-1;x<=1;x++) { vec3 tap=texelFetch(u_source,clamp(pixel+ivec2(x,y),ivec2(0),size-1),0).rgb; lo=min(lo,tap); hi=max(hi,tap); }
|
|
1718
|
+
history.rgb=clamp(history.rgb,lo,hi);
|
|
1719
|
+
}
|
|
1720
|
+
vec3 resolved=mix(source.rgb,history.rgb,weight);
|
|
1721
|
+
outColor=vec4(resolved,u_temporal?motion.b:source.a);
|
|
1722
|
+
}
|
|
1723
|
+
`, "webgl2-taa-accumulation");
|
|
1724
|
+
return this.taaProgram;
|
|
1725
|
+
}
|
|
1726
|
+
ensureTaaPresentationProgram() {
|
|
1727
|
+
if (this.taaPresentationProgram)
|
|
1728
|
+
return this.taaPresentationProgram;
|
|
1729
|
+
this.taaPresentationProgram = this.createFullscreenProgram(`#version 300 es
|
|
1730
|
+
precision highp float;
|
|
1731
|
+
uniform sampler2D u_source;
|
|
1732
|
+
uniform sampler2D u_accumulated;
|
|
1733
|
+
out vec4 outColor;
|
|
1734
|
+
void main() {
|
|
1735
|
+
ivec2 pixel=ivec2(gl_FragCoord.xy);
|
|
1736
|
+
ivec2 size=textureSize(u_source,0);
|
|
1737
|
+
vec4 source=texelFetch(u_source,pixel,0);
|
|
1738
|
+
vec3 accumulated=texelFetch(u_accumulated,pixel,0).rgb;
|
|
1739
|
+
// Retained native pixels isolate the remaining spatial excess to the
|
|
1740
|
+
// horizontally moving silhouette. Apply a bounded three-tap unsharp resolve
|
|
1741
|
+
// to presentation only; accumulated history remains immutable.
|
|
1742
|
+
vec3 center=mix(source.rgb,accumulated,0.90);
|
|
1743
|
+
ivec2 leftPixel=clamp(pixel+ivec2(-1,0),ivec2(0),size-1);
|
|
1744
|
+
ivec2 rightPixel=clamp(pixel+ivec2(1,0),ivec2(0),size-1);
|
|
1745
|
+
vec3 left=mix(texelFetch(u_source,leftPixel,0).rgb,texelFetch(u_accumulated,leftPixel,0).rgb,0.90);
|
|
1746
|
+
vec3 right=mix(texelFetch(u_source,rightPixel,0).rgb,texelFetch(u_accumulated,rightPixel,0).rgb,0.90);
|
|
1747
|
+
outColor=vec4(clamp(center*1.04-(left+right)*0.02,0.0,1.0),source.a);
|
|
1748
|
+
}
|
|
1749
|
+
`, "webgl2-taa-presentation");
|
|
1750
|
+
return this.taaPresentationProgram;
|
|
1751
|
+
}
|
|
1752
|
+
ensureNativeFxaaFinalizeProgram() {
|
|
1753
|
+
if (this.nativeFxaaFinalizeProgram) {
|
|
1754
|
+
return this.nativeFxaaFinalizeProgram;
|
|
1755
|
+
}
|
|
1756
|
+
this.nativeFxaaFinalizeProgram = this.createFullscreenProgram(FXAA_185_FRAGMENT_GLSL, "webgl2-fxaa-185-finalize");
|
|
1757
|
+
return this.nativeFxaaFinalizeProgram;
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* PRD-03 Phase 1 — the split finalize for `fxaa.variant === "r185"`: samples
|
|
1761
|
+
* the completed LDR intermediate (source resolution) and writes the r185
|
|
1762
|
+
* FXAA blend plus the ±1-LSB triangular dither to the output.
|
|
1763
|
+
*/
|
|
1764
|
+
executeNativeFxaaFinalize(sourceTexture, framebuffer, outputWidth, outputHeight, sourceWidth, sourceHeight, vertexArray) {
|
|
1765
|
+
const program = this.ensureNativeFxaaFinalizeProgram();
|
|
1766
|
+
this.host.gl.bindFramebuffer(this.host.gl.FRAMEBUFFER, framebuffer);
|
|
1767
|
+
this.host.gl.viewport(0, 0, outputWidth, outputHeight);
|
|
1768
|
+
this.host.gl.useProgram(program);
|
|
1769
|
+
this.host.gl.bindVertexArray(vertexArray);
|
|
1770
|
+
this.bindFullscreenTexture(0, sourceTexture);
|
|
1771
|
+
this.host.gl.uniform1i(this.host.gl.getUniformLocation(program, "u_source"), 0);
|
|
1772
|
+
this.host.gl.uniform2f(this.host.gl.getUniformLocation(program, "u_texelSize"), 1 / sourceWidth, 1 / sourceHeight);
|
|
1773
|
+
this.host.gl.uniform2f(this.host.gl.getUniformLocation(program, "u_outputTexel"), 1 / outputWidth, 1 / outputHeight);
|
|
1774
|
+
this.host.gl.drawArrays(this.host.gl.TRIANGLES, 0, 3);
|
|
1775
|
+
}
|
|
1776
|
+
createFullscreenProgram(fragmentSource, label) {
|
|
1777
|
+
const vertex = this.host.device.compileShader(this.host.gl.VERTEX_SHADER, `#version 300 es
|
|
1778
|
+
precision highp float;
|
|
1779
|
+
void main() {
|
|
1780
|
+
vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
1781
|
+
gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
|
|
1782
|
+
}
|
|
1783
|
+
`, label);
|
|
1784
|
+
const fragment = this.host.device.compileShader(this.host.gl.FRAGMENT_SHADER, fragmentSource, label);
|
|
1785
|
+
const program = this.host.gl.createProgram();
|
|
1786
|
+
if (!program) {
|
|
1787
|
+
this.host.gl.deleteShader(vertex);
|
|
1788
|
+
this.host.gl.deleteShader(fragment);
|
|
1789
|
+
throw new RenderDeviceError("Failed to allocate WebGL2 fullscreen shader program", "WEBGL_ALLOCATION_FAILED", { label });
|
|
1790
|
+
}
|
|
1791
|
+
this.host.gl.attachShader(program, vertex);
|
|
1792
|
+
this.host.gl.attachShader(program, fragment);
|
|
1793
|
+
this.host.gl.linkProgram(program);
|
|
1794
|
+
this.host.counters.programCompiles += 1;
|
|
1795
|
+
this.host.gl.deleteShader(vertex);
|
|
1796
|
+
this.host.gl.deleteShader(fragment);
|
|
1797
|
+
if (!this.host.gl.getProgramParameter(program, this.host.gl.LINK_STATUS)) {
|
|
1798
|
+
const log = this.host.gl.getProgramInfoLog(program) ?? "Unknown fullscreen shader link error";
|
|
1799
|
+
this.host.gl.deleteProgram(program);
|
|
1800
|
+
throw new RenderDeviceError("WebGL2 fullscreen shader link failed", "SHADER_LINK_FAILED", { label, log });
|
|
1801
|
+
}
|
|
1802
|
+
return program;
|
|
1803
|
+
}
|
|
1804
|
+
ensureLdrPostprocessProgram() {
|
|
1805
|
+
if (this.ldrPostprocessProgram) {
|
|
1806
|
+
return this.ldrPostprocessProgram;
|
|
1807
|
+
}
|
|
1808
|
+
const vertex = this.host.device.compileShader(this.host.gl.VERTEX_SHADER, `#version 300 es
|
|
1809
|
+
precision highp float;
|
|
1810
|
+
out vec2 v_uv;
|
|
1811
|
+
void main() {
|
|
1812
|
+
vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
1813
|
+
v_uv = position;
|
|
1814
|
+
gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
|
|
1815
|
+
}
|
|
1816
|
+
`, "webgl2-ldr-postprocess");
|
|
1817
|
+
const fragment = this.host.device.compileShader(this.host.gl.FRAGMENT_SHADER, `#version 300 es
|
|
1818
|
+
precision highp float;
|
|
1819
|
+
uniform sampler2D u_source;
|
|
1820
|
+
uniform vec2 u_texelSize;
|
|
1821
|
+
uniform int u_hasToneMapping;
|
|
1822
|
+
uniform int u_toneOperator;
|
|
1823
|
+
uniform int u_inputColorSpace;
|
|
1824
|
+
uniform int u_outputColorSpace;
|
|
1825
|
+
uniform float u_exposure;
|
|
1826
|
+
uniform float u_whitePoint;
|
|
1827
|
+
uniform float u_gamma;
|
|
1828
|
+
uniform int u_hasColorGrade;
|
|
1829
|
+
uniform float u_contrast;
|
|
1830
|
+
uniform float u_temperature;
|
|
1831
|
+
uniform float u_tint;
|
|
1832
|
+
uniform float u_saturation;
|
|
1833
|
+
uniform float u_vibrance;
|
|
1834
|
+
uniform float u_vignette;
|
|
1835
|
+
uniform float u_sharpening;
|
|
1836
|
+
uniform int u_hasFxaa;
|
|
1837
|
+
uniform float u_edgeThreshold;
|
|
1838
|
+
uniform float u_subpixelBlend;
|
|
1839
|
+
in vec2 v_uv;
|
|
1840
|
+
out vec4 outColor;
|
|
1841
|
+
|
|
1842
|
+
float srgbToLinear(float value) {
|
|
1843
|
+
return value <= 0.04045 ? value / 12.92 : pow((value + 0.055) / 1.055, 2.4);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
float linearToSrgb(float value) {
|
|
1847
|
+
return value <= 0.0031308 ? value * 12.92 : 1.055 * pow(value, 1.0 / 2.4) - 0.055;
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
vec3 decodeColor(vec3 color) {
|
|
1851
|
+
return u_inputColorSpace == 1 ? vec3(srgbToLinear(color.r), srgbToLinear(color.g), srgbToLinear(color.b)) : color;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
vec3 encodeColor(vec3 color) {
|
|
1855
|
+
vec3 linear = clamp(color, 0.0, 1.0);
|
|
1856
|
+
return u_outputColorSpace == 1 ? vec3(linearToSrgb(linear.r), linearToSrgb(linear.g), linearToSrgb(linear.b)) : linear;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
vec3 acesRrtAndOdtFit(vec3 value) {
|
|
1860
|
+
vec3 numerator = value * (value + 0.0245786) - 0.000090537;
|
|
1861
|
+
vec3 denominator = value * (0.983729 * value + 0.4329510) + 0.238081;
|
|
1862
|
+
return numerator / denominator;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
vec3 acesFilmic(vec3 color) {
|
|
1866
|
+
// Match current Three.js ACESFilmicToneMapping. ACES is a coupled RGB
|
|
1867
|
+
// transform; a scalar approximation shifts hue and washes saturated colors.
|
|
1868
|
+
const mat3 acesInput = mat3(
|
|
1869
|
+
vec3(0.59719, 0.07600, 0.02840),
|
|
1870
|
+
vec3(0.35458, 0.90834, 0.13383),
|
|
1871
|
+
vec3(0.04823, 0.01566, 0.83777)
|
|
1872
|
+
);
|
|
1873
|
+
const mat3 acesOutput = mat3(
|
|
1874
|
+
vec3(1.60475, -0.10208, -0.00327),
|
|
1875
|
+
vec3(-0.53108, 1.10813, -0.07276),
|
|
1876
|
+
vec3(-0.07367, -0.00605, 1.07602)
|
|
1877
|
+
);
|
|
1878
|
+
vec3 acesColor = acesInput * (color / 0.6);
|
|
1879
|
+
acesColor = acesRrtAndOdtFit(acesColor);
|
|
1880
|
+
return clamp(acesOutput * acesColor, 0.0, 1.0);
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
float filmic(float value) {
|
|
1884
|
+
float x = max(0.0, value);
|
|
1885
|
+
float toe = max(0.0, x - 0.004);
|
|
1886
|
+
float curve = (toe * (6.2 * toe + 0.5)) / (toe * (6.2 * toe + 1.7) + 0.06);
|
|
1887
|
+
return min(curve, x * 1.08);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
float uncharted2(float value) {
|
|
1891
|
+
float a = 0.15;
|
|
1892
|
+
float b = 0.5;
|
|
1893
|
+
float c = 0.1;
|
|
1894
|
+
float d = 0.2;
|
|
1895
|
+
float e = 0.02;
|
|
1896
|
+
float f = 0.3;
|
|
1897
|
+
float w = 11.2;
|
|
1898
|
+
float x = value * 2.0;
|
|
1899
|
+
float curve = ((x * (a * x + c * b) + d * e) / (x * (a * x + b) + d * f)) - e / f;
|
|
1900
|
+
float wx = w;
|
|
1901
|
+
float white = ((wx * (a * wx + c * b) + d * e) / (wx * (a * wx + b) + d * f)) - e / f;
|
|
1902
|
+
return clamp(curve / white, 0.0, 1.0);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
float agx(float value) {
|
|
1906
|
+
float x = max(0.0, value);
|
|
1907
|
+
float encoded = log2(1.0 + x) / log2(17.0);
|
|
1908
|
+
return clamp(encoded * encoded * (3.0 - 2.0 * encoded), 0.0, 1.0);
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
float neutral(float value) {
|
|
1912
|
+
float x = max(0.0, value);
|
|
1913
|
+
return min(1.0, (x * (1.0 + x / 7.5)) / (1.0 + x));
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
float toneMapChannel(float value) {
|
|
1917
|
+
float exposed = max(0.0, value * u_exposure) / max(0.0001, u_whitePoint);
|
|
1918
|
+
if (u_toneOperator == 0) return min(1.0, exposed);
|
|
1919
|
+
if (u_toneOperator == 1) return exposed / (1.0 + exposed);
|
|
1920
|
+
if (u_toneOperator == 2) return exposed;
|
|
1921
|
+
if (u_toneOperator == 3) return filmic(exposed);
|
|
1922
|
+
if (u_toneOperator == 4) return uncharted2(exposed);
|
|
1923
|
+
if (u_toneOperator == 5) return agx(exposed);
|
|
1924
|
+
return neutral(exposed);
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
vec3 applyToneMapping(vec3 color) {
|
|
1928
|
+
if (u_hasToneMapping == 0) return color;
|
|
1929
|
+
vec3 decoded = decodeColor(color);
|
|
1930
|
+
vec3 mapped = u_toneOperator == 2
|
|
1931
|
+
? acesFilmic(max(vec3(0.0), decoded * u_exposure) / max(0.0001, u_whitePoint))
|
|
1932
|
+
: vec3(toneMapChannel(decoded.r), toneMapChannel(decoded.g), toneMapChannel(decoded.b));
|
|
1933
|
+
return encodeColor(mapped);
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
vec3 applyColorGrade(vec3 color, vec2 uv) {
|
|
1937
|
+
if (u_hasColorGrade == 0) return color;
|
|
1938
|
+
float contrastOffset = 0.5 - 0.5 * u_contrast;
|
|
1939
|
+
float redShift = u_temperature * 0.08 - u_tint * 0.02;
|
|
1940
|
+
float greenShift = u_tint * 0.06;
|
|
1941
|
+
float blueShift = -u_temperature * 0.08 - u_tint * 0.02;
|
|
1942
|
+
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
|
1943
|
+
vec3 graded = color * u_contrast + vec3(contrastOffset + redShift, contrastOffset + greenShift, contrastOffset + blueShift);
|
|
1944
|
+
float distanceFromLuma = min(1.0, abs(graded.r - luma) + abs(graded.g - luma) + abs(graded.b - luma));
|
|
1945
|
+
float vibranceBoost = u_vibrance == 0.0 ? 0.0 : u_vibrance * (1.0 - distanceFromLuma);
|
|
1946
|
+
float saturation = u_saturation + vibranceBoost;
|
|
1947
|
+
graded = vec3(luma) + (graded - vec3(luma)) * saturation;
|
|
1948
|
+
vec2 centered = uv * 2.0 - 1.0;
|
|
1949
|
+
float vignette = 1.0 - u_vignette * clamp((length(centered) - 0.28) / 1.12, 0.0, 1.0);
|
|
1950
|
+
return clamp(graded * vignette, 0.0, 1.0);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
vec3 baseColorAt(vec2 uv) {
|
|
1954
|
+
vec2 clampedUv = clamp(uv, vec2(0.0), vec2(1.0));
|
|
1955
|
+
vec3 color = texture(u_source, clampedUv).rgb;
|
|
1956
|
+
return applyColorGrade(applyToneMapping(color), clampedUv);
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
vec3 finalColorAt(vec2 uv) {
|
|
1960
|
+
vec3 center = baseColorAt(uv);
|
|
1961
|
+
if (u_hasColorGrade == 0 || u_sharpening <= 0.0) return center;
|
|
1962
|
+
vec3 blur = (
|
|
1963
|
+
baseColorAt(uv + vec2(-u_texelSize.x, 0.0)) +
|
|
1964
|
+
baseColorAt(uv + vec2(u_texelSize.x, 0.0)) +
|
|
1965
|
+
baseColorAt(uv + vec2(0.0, -u_texelSize.y)) +
|
|
1966
|
+
baseColorAt(uv + vec2(0.0, u_texelSize.y))
|
|
1967
|
+
) * 0.25;
|
|
1968
|
+
return clamp(center + (center - blur) * u_sharpening, 0.0, 1.0);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
float luma(vec3 color) {
|
|
1972
|
+
return dot(color, vec3(0.2126, 0.7152, 0.0722));
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
void main() {
|
|
1976
|
+
vec3 center = finalColorAt(v_uv);
|
|
1977
|
+
float alpha = texture(u_source, clamp(v_uv, vec2(0.0), vec2(1.0))).a;
|
|
1978
|
+
if (u_hasFxaa == 0) {
|
|
1979
|
+
outColor = vec4(center, alpha);
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
vec3 north = finalColorAt(v_uv + vec2(0.0, -u_texelSize.y));
|
|
1983
|
+
vec3 south = finalColorAt(v_uv + vec2(0.0, u_texelSize.y));
|
|
1984
|
+
vec3 west = finalColorAt(v_uv + vec2(-u_texelSize.x, 0.0));
|
|
1985
|
+
vec3 east = finalColorAt(v_uv + vec2(u_texelSize.x, 0.0));
|
|
1986
|
+
float centerLuma = luma(center);
|
|
1987
|
+
float minLuma = min(centerLuma, min(min(luma(north), luma(south)), min(luma(west), luma(east))));
|
|
1988
|
+
float maxLuma = max(centerLuma, max(max(luma(north), luma(south)), max(luma(west), luma(east))));
|
|
1989
|
+
if (maxLuma - minLuma < u_edgeThreshold) {
|
|
1990
|
+
outColor = vec4(center, alpha);
|
|
1991
|
+
return;
|
|
1992
|
+
}
|
|
1993
|
+
vec3 average = (north + south + west + east) * 0.25;
|
|
1994
|
+
outColor = vec4(mix(center, average, clamp(u_subpixelBlend, 0.0, 1.0)), alpha);
|
|
1995
|
+
}
|
|
1996
|
+
`, "webgl2-ldr-postprocess");
|
|
1997
|
+
const program = this.host.gl.createProgram();
|
|
1998
|
+
if (!program) {
|
|
1999
|
+
this.host.gl.deleteShader(vertex);
|
|
2000
|
+
this.host.gl.deleteShader(fragment);
|
|
2001
|
+
throw new RenderDeviceError("Failed to allocate WebGL2 LDR postprocess shader", "WEBGL_ALLOCATION_FAILED");
|
|
2002
|
+
}
|
|
2003
|
+
this.host.gl.attachShader(program, vertex);
|
|
2004
|
+
this.host.gl.attachShader(program, fragment);
|
|
2005
|
+
this.host.gl.linkProgram(program);
|
|
2006
|
+
this.host.counters.programCompiles += 1;
|
|
2007
|
+
this.host.gl.deleteShader(vertex);
|
|
2008
|
+
this.host.gl.deleteShader(fragment);
|
|
2009
|
+
if (!this.host.gl.getProgramParameter(program, this.host.gl.LINK_STATUS)) {
|
|
2010
|
+
const log = this.host.gl.getProgramInfoLog(program) ?? "Unknown LDR postprocess shader link error";
|
|
2011
|
+
this.host.gl.deleteProgram(program);
|
|
2012
|
+
throw new RenderDeviceError("WebGL2 LDR postprocess shader link failed", "SHADER_LINK_FAILED", { log });
|
|
2013
|
+
}
|
|
2014
|
+
this.ldrPostprocessProgram = program;
|
|
2015
|
+
return program;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
function bloomNumberOption(options, key, fallback) {
|
|
2019
|
+
const value = options[key];
|
|
2020
|
+
if (value === undefined)
|
|
2021
|
+
return fallback;
|
|
2022
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2023
|
+
throw new RenderDeviceError(`Bloom ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2024
|
+
}
|
|
2025
|
+
return value;
|
|
2026
|
+
}
|
|
2027
|
+
function colorSpaceId(value) {
|
|
2028
|
+
return value === "srgb" ? 1 : 0;
|
|
2029
|
+
}
|
|
2030
|
+
function depthOfFieldNumberOption(options, key, fallback) {
|
|
2031
|
+
const value = options[key];
|
|
2032
|
+
if (value === undefined)
|
|
2033
|
+
return fallback;
|
|
2034
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2035
|
+
throw new RenderDeviceError(`Depth-of-field ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2036
|
+
}
|
|
2037
|
+
return value;
|
|
2038
|
+
}
|
|
2039
|
+
function motionBlurNumberOption(options, key, fallback) {
|
|
2040
|
+
const value = options[key];
|
|
2041
|
+
if (value === undefined)
|
|
2042
|
+
return fallback;
|
|
2043
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2044
|
+
throw new RenderDeviceError(`Motion blur ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2045
|
+
}
|
|
2046
|
+
return value;
|
|
2047
|
+
}
|
|
2048
|
+
function normalizeLdrDepthRange(range) {
|
|
2049
|
+
const near = range && Number.isFinite(range.near) && range.near > 0 ? range.near : 0.1;
|
|
2050
|
+
const far = range && Number.isFinite(range.far) && range.far > near ? range.far : 1000;
|
|
2051
|
+
return { near, far };
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Composite response for the native bloom. Flag-on (`excess`, §6.6): the
|
|
2055
|
+
* normalized pyramid weights sum to 1 and nothing else scales the halo, so an
|
|
2056
|
+
* excess E composites as E · intensity ("no hidden gain"). Flag-off keeps the
|
|
2057
|
+
* legacy `resolveBloomPyramidResponseGain` heuristic (deleted in Phase 8).
|
|
2058
|
+
*/
|
|
2059
|
+
export function nativeBloomResponseGain(plan, options) {
|
|
2060
|
+
return options.excess === true ? 1 : resolveBloomPyramidResponseGain(plan);
|
|
2061
|
+
}
|
|
2062
|
+
export function normalizeNativeBloomOptions(options) {
|
|
2063
|
+
// PRD-03 §7.2 carve (0b-2): flag-on (`v2` stamp) accepts the HDR option
|
|
2064
|
+
// ranges — threshold [0,64], `knee` ratio [0,1] — and drops the
|
|
2065
|
+
// `softKnee ≤ 0.5` throw. §7.1 deprecated fields map while the
|
|
2066
|
+
// transitional legacy chain still executes: `knee` feeds the soft-knee
|
|
2067
|
+
// slot (§6.6 `threshold × kneeRatio` absolute width), authored
|
|
2068
|
+
// `scatter`/`radius` map onto the legacy `radius` integer, and
|
|
2069
|
+
// `maxIntensity`/`antiBlowout`/`clampLuminance`/`quality`/`shoulder` are
|
|
2070
|
+
// accepted and ignored (deprecation diagnostics live in the bridge).
|
|
2071
|
+
const v2 = options["v2"] === true;
|
|
2072
|
+
const threshold = bloomNumberOption(options, "threshold", 0.75);
|
|
2073
|
+
const intensity = bloomNumberOption(options, "intensity", 0.35);
|
|
2074
|
+
const knee = bloomNumberOption(options, "knee", NaN);
|
|
2075
|
+
const scatter = bloomNumberOption(options, "scatter", NaN);
|
|
2076
|
+
const radius = Number.isFinite(scatter)
|
|
2077
|
+
? Math.round(scatter)
|
|
2078
|
+
: bloomNumberOption(options, "radius", 1);
|
|
2079
|
+
if (threshold < 0 || threshold > (v2 ? 64 : 1)) {
|
|
2080
|
+
throw new RenderDeviceError(v2 ? "Bloom threshold must be finite and in [0, 64]." : "Bloom threshold must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { threshold });
|
|
2081
|
+
}
|
|
2082
|
+
if (intensity < 0) {
|
|
2083
|
+
throw new RenderDeviceError("Bloom intensity must be finite and non-negative.", "INVALID_POSTPROCESS_OPTIONS", { intensity });
|
|
2084
|
+
}
|
|
2085
|
+
if (!Number.isInteger(radius) || radius < 0 || radius > 16) {
|
|
2086
|
+
throw new RenderDeviceError("Bloom radius must be an integer in [0, 16].", "INVALID_POSTPROCESS_OPTIONS", { radius });
|
|
2087
|
+
}
|
|
2088
|
+
if (v2 && Number.isFinite(knee) && (knee < 0 || knee > 1)) {
|
|
2089
|
+
throw new RenderDeviceError("Bloom knee must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { knee });
|
|
2090
|
+
}
|
|
2091
|
+
const authoredSoftKnee = bloomNumberOption(options, "softKnee", 0);
|
|
2092
|
+
const softKnee = v2 && Number.isFinite(knee) ? Math.min(0.5, threshold * knee) : authoredSoftKnee;
|
|
2093
|
+
if (!v2 && (!(authoredSoftKnee >= 0) || authoredSoftKnee > 0.5)) {
|
|
2094
|
+
throw new RenderDeviceError("Bloom softKnee must be finite and in [0, 0.5].", "INVALID_POSTPROCESS_OPTIONS", { softKnee });
|
|
2095
|
+
}
|
|
2096
|
+
const shoulder = bloomNumberOption(options, "shoulder", 0);
|
|
2097
|
+
if (!(shoulder >= 0) || shoulder > 1) {
|
|
2098
|
+
throw new RenderDeviceError("Bloom shoulder must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { shoulder });
|
|
2099
|
+
}
|
|
2100
|
+
let quality;
|
|
2101
|
+
try {
|
|
2102
|
+
// Flag-on S9: an unauthored quality runs the 5-mip pyramid (the
|
|
2103
|
+
// UnrealBloomPass-class wide halo) instead of the single 1-scale blur,
|
|
2104
|
+
// whose few-pixel fringe left the halo below one display LSB.
|
|
2105
|
+
quality = v2 && options.quality === undefined ? "cinematic" : normalizeBloomQualityPreset(options.quality);
|
|
2106
|
+
}
|
|
2107
|
+
catch {
|
|
2108
|
+
throw new RenderDeviceError("Bloom quality must be one of performance|balanced|cinematic.", "INVALID_POSTPROCESS_OPTIONS", { quality: options.quality });
|
|
2109
|
+
}
|
|
2110
|
+
const spread = bloomNumberOption(options, "spread", 0.7);
|
|
2111
|
+
if (v2 && (!(spread >= 0) || spread > 1)) {
|
|
2112
|
+
throw new RenderDeviceError("Bloom spread must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { spread });
|
|
2113
|
+
}
|
|
2114
|
+
return { threshold, intensity, radius, quality, softKnee, shoulder, ...(v2 ? { excess: true, spread } : {}) };
|
|
2115
|
+
}
|
|
2116
|
+
function normalizeNativeDepthOfFieldOptions(options) {
|
|
2117
|
+
const focusDepth = depthOfFieldNumberOption(options, "focusDepth", 0.5);
|
|
2118
|
+
const focusRange = depthOfFieldNumberOption(options, "focusRange", 0.12);
|
|
2119
|
+
const maxRadius = depthOfFieldNumberOption(options, "maxRadius", 2);
|
|
2120
|
+
if (focusDepth < 0 || focusDepth > 1) {
|
|
2121
|
+
throw new RenderDeviceError("Depth-of-field focusDepth must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { focusDepth });
|
|
2122
|
+
}
|
|
2123
|
+
if (focusRange < 0.001 || focusRange > 1) {
|
|
2124
|
+
throw new RenderDeviceError("Depth-of-field focusRange must be finite and in [0.001, 1].", "INVALID_POSTPROCESS_OPTIONS", { focusRange });
|
|
2125
|
+
}
|
|
2126
|
+
if (!Number.isInteger(maxRadius) || maxRadius < 0 || maxRadius > 8) {
|
|
2127
|
+
throw new RenderDeviceError("Depth-of-field maxRadius must be an integer in [0, 8].", "INVALID_POSTPROCESS_OPTIONS", { maxRadius });
|
|
2128
|
+
}
|
|
2129
|
+
return { focusDepth, focusRange, maxRadius };
|
|
2130
|
+
}
|
|
2131
|
+
function normalizeNativeMotionBlurOptions(options, width, height) {
|
|
2132
|
+
const samples = motionBlurNumberOption(options, "samples", 5);
|
|
2133
|
+
const scale = motionBlurNumberOption(options, "scale", 1);
|
|
2134
|
+
if (options.temporal) {
|
|
2135
|
+
if (!Number.isInteger(samples) || samples < 2 || samples > 16 || scale < 0 || scale > 8)
|
|
2136
|
+
throw new RenderDeviceError("Invalid motion blur samples/scale", "INVALID_POSTPROCESS_OPTIONS");
|
|
2137
|
+
return { samples, scale, temporal: options.temporal };
|
|
2138
|
+
}
|
|
2139
|
+
const value = options.velocity;
|
|
2140
|
+
if (!(value instanceof Float32Array) && !Array.isArray(value)) {
|
|
2141
|
+
throw new RenderDeviceError("Motion blur requires a velocity Float32Array or number array.", "WEBGL_LDR_POSTPROCESS_VELOCITY_REQUIRED");
|
|
2142
|
+
}
|
|
2143
|
+
const velocity = value instanceof Float32Array ? value : new Float32Array(value);
|
|
2144
|
+
if (velocity.length !== width * height * 2) {
|
|
2145
|
+
throw new RenderDeviceError("Motion blur velocity must contain width * height * 2 float samples.", "INVALID_POSTPROCESS_OPTIONS", {
|
|
2146
|
+
expectedLength: width * height * 2,
|
|
2147
|
+
actualLength: velocity.length
|
|
2148
|
+
});
|
|
2149
|
+
}
|
|
2150
|
+
if (!Number.isInteger(samples) || samples < 2 || samples > 16) {
|
|
2151
|
+
throw new RenderDeviceError("Motion blur samples must be an integer in [2, 16].", "INVALID_POSTPROCESS_OPTIONS", { samples });
|
|
2152
|
+
}
|
|
2153
|
+
if (scale < 0 || scale > 8) {
|
|
2154
|
+
throw new RenderDeviceError("Motion blur scale must be finite and in [0, 8].", "INVALID_POSTPROCESS_OPTIONS", { scale });
|
|
2155
|
+
}
|
|
2156
|
+
return { samples, scale, velocity };
|
|
2157
|
+
}
|
|
2158
|
+
function normalizeNativeOutlineOptions(options) {
|
|
2159
|
+
const width = outlineNumberOption(options, "width", 1);
|
|
2160
|
+
const threshold = outlineNumberOption(options, "threshold", 0.22);
|
|
2161
|
+
const opacity = outlineNumberOption(options, "opacity", 0.85);
|
|
2162
|
+
const value = options.color;
|
|
2163
|
+
const sourceColor = value === undefined ? [255, 188, 64, 255] : value;
|
|
2164
|
+
if (!Array.isArray(sourceColor)
|
|
2165
|
+
|| (sourceColor.length !== 3 && sourceColor.length !== 4)
|
|
2166
|
+
|| sourceColor.some((channel) => typeof channel !== "number" || !Number.isFinite(channel) || channel < 0 || channel > 255)) {
|
|
2167
|
+
throw new RenderDeviceError("Outline color must contain three or four finite channels in [0, 255].", "INVALID_POSTPROCESS_OPTIONS", { color: value });
|
|
2168
|
+
}
|
|
2169
|
+
if (!Number.isInteger(width) || width < 1 || width > 6) {
|
|
2170
|
+
throw new RenderDeviceError("Outline width must be an integer in [1, 6].", "INVALID_POSTPROCESS_OPTIONS", { width });
|
|
2171
|
+
}
|
|
2172
|
+
if (threshold < 0 || threshold > 4) {
|
|
2173
|
+
throw new RenderDeviceError("Outline threshold must be finite and in [0, 4].", "INVALID_POSTPROCESS_OPTIONS", { threshold });
|
|
2174
|
+
}
|
|
2175
|
+
if (opacity < 0 || opacity > 1) {
|
|
2176
|
+
throw new RenderDeviceError("Outline opacity must be finite and in [0, 1].", "INVALID_POSTPROCESS_OPTIONS", { opacity });
|
|
2177
|
+
}
|
|
2178
|
+
const color = [
|
|
2179
|
+
sourceColor[0],
|
|
2180
|
+
sourceColor[1],
|
|
2181
|
+
sourceColor[2],
|
|
2182
|
+
(sourceColor[3] ?? 255)
|
|
2183
|
+
];
|
|
2184
|
+
return { width, threshold, opacity, color };
|
|
2185
|
+
}
|
|
2186
|
+
function normalizeNativeSsaoOptions(options) {
|
|
2187
|
+
const rawRadius = ssaoNumberOption(options, "radius", 2);
|
|
2188
|
+
const radius = rawRadius > 0 && rawRadius < 1
|
|
2189
|
+
? Math.max(1, Math.min(8, Math.round(rawRadius * 8)))
|
|
2190
|
+
: rawRadius;
|
|
2191
|
+
const intensity = ssaoNumberOption(options, "intensity", 0.38);
|
|
2192
|
+
const bias = ssaoNumberOption(options, "bias", 0.015);
|
|
2193
|
+
if (!Number.isInteger(radius) || radius < 1 || radius > 8) {
|
|
2194
|
+
throw new RenderDeviceError("SSAO radius must be an integer in [1, 8].", "INVALID_POSTPROCESS_OPTIONS", { radius: rawRadius });
|
|
2195
|
+
}
|
|
2196
|
+
if (intensity < 0 || intensity > 2) {
|
|
2197
|
+
throw new RenderDeviceError("SSAO intensity must be finite and in [0, 2].", "INVALID_POSTPROCESS_OPTIONS", { intensity });
|
|
2198
|
+
}
|
|
2199
|
+
if (bias < 0 || bias > 0.25) {
|
|
2200
|
+
throw new RenderDeviceError("SSAO bias must be finite and in [0, 0.25].", "INVALID_POSTPROCESS_OPTIONS", { bias });
|
|
2201
|
+
}
|
|
2202
|
+
return { radius, intensity, bias };
|
|
2203
|
+
}
|
|
2204
|
+
function normalizeNativeSsrOptions(options) {
|
|
2205
|
+
const intensity = ssrNumberOption(options, "intensity", 0.32);
|
|
2206
|
+
const maxDistance = ssrNumberOption(options, "maxDistance", 16);
|
|
2207
|
+
if (intensity < 0 || intensity > 2) {
|
|
2208
|
+
throw new RenderDeviceError("SSR intensity must be finite and in [0, 2].", "INVALID_POSTPROCESS_OPTIONS", { intensity });
|
|
2209
|
+
}
|
|
2210
|
+
if (!Number.isInteger(maxDistance) || maxDistance < 1 || maxDistance > 64) {
|
|
2211
|
+
throw new RenderDeviceError("SSR maxDistance must be an integer in [1, 64].", "INVALID_POSTPROCESS_OPTIONS", { maxDistance });
|
|
2212
|
+
}
|
|
2213
|
+
const projection = options["projection"];
|
|
2214
|
+
if (!(projection instanceof Float32Array))
|
|
2215
|
+
throw new RenderDeviceError("Native SSR requires the actual frame projection or view-projection matrix.", "INVALID_POSTPROCESS_OPTIONS");
|
|
2216
|
+
const inverseProjection = invertSsrProjection(projection);
|
|
2217
|
+
return { intensity, maxDistance, projection, inverseProjection };
|
|
2218
|
+
}
|
|
2219
|
+
function normalizeNativeTaaOptions(options, width, height) {
|
|
2220
|
+
const blend = taaNumberOption(options, "blend", 0.18);
|
|
2221
|
+
if (options.temporal) {
|
|
2222
|
+
if (blend < 0 || blend > .95)
|
|
2223
|
+
throw new RenderDeviceError("Invalid TAA blend", "INVALID_POSTPROCESS_OPTIONS");
|
|
2224
|
+
return { blend, temporal: options.temporal };
|
|
2225
|
+
}
|
|
2226
|
+
const history = options.history;
|
|
2227
|
+
if (!(history instanceof Uint8Array)) {
|
|
2228
|
+
throw new RenderDeviceError("TAA requires a Uint8Array history buffer.", "WEBGL_LDR_POSTPROCESS_HISTORY_REQUIRED");
|
|
2229
|
+
}
|
|
2230
|
+
if (history.byteLength !== width * height * 4) {
|
|
2231
|
+
throw new RenderDeviceError("TAA history must contain width * height * 4 RGBA bytes.", "INVALID_POSTPROCESS_OPTIONS", {
|
|
2232
|
+
expectedLength: width * height * 4,
|
|
2233
|
+
actualLength: history.byteLength
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
if (blend < 0 || blend > 0.95) {
|
|
2237
|
+
throw new RenderDeviceError("TAA blend must be finite and in [0, 0.95].", "INVALID_POSTPROCESS_OPTIONS", { blend });
|
|
2238
|
+
}
|
|
2239
|
+
return { blend, history };
|
|
2240
|
+
}
|
|
2241
|
+
function numberOption(options, key, fallback) {
|
|
2242
|
+
const value = options[key];
|
|
2243
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
2244
|
+
}
|
|
2245
|
+
function outlineNumberOption(options, key, fallback) {
|
|
2246
|
+
const value = options[key];
|
|
2247
|
+
if (value === undefined)
|
|
2248
|
+
return fallback;
|
|
2249
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2250
|
+
throw new RenderDeviceError(`Outline ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2251
|
+
}
|
|
2252
|
+
return value;
|
|
2253
|
+
}
|
|
2254
|
+
function ssaoNumberOption(options, key, fallback) {
|
|
2255
|
+
const value = options[key];
|
|
2256
|
+
if (value === undefined)
|
|
2257
|
+
return fallback;
|
|
2258
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2259
|
+
throw new RenderDeviceError(`SSAO ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2260
|
+
}
|
|
2261
|
+
return value;
|
|
2262
|
+
}
|
|
2263
|
+
function ssrNumberOption(options, key, fallback) {
|
|
2264
|
+
const value = options[key];
|
|
2265
|
+
if (value === undefined)
|
|
2266
|
+
return fallback;
|
|
2267
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2268
|
+
throw new RenderDeviceError(`SSR ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2269
|
+
}
|
|
2270
|
+
return value;
|
|
2271
|
+
}
|
|
2272
|
+
function stringOption(options, key, fallback) {
|
|
2273
|
+
const value = options[key];
|
|
2274
|
+
return typeof value === "string" ? value : fallback;
|
|
2275
|
+
}
|
|
2276
|
+
function taaNumberOption(options, key, fallback) {
|
|
2277
|
+
const value = options[key];
|
|
2278
|
+
if (value === undefined)
|
|
2279
|
+
return fallback;
|
|
2280
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2281
|
+
throw new RenderDeviceError(`TAA ${key} must be a finite number.`, "INVALID_POSTPROCESS_OPTIONS", { key, value });
|
|
2282
|
+
}
|
|
2283
|
+
return value;
|
|
2284
|
+
}
|
|
2285
|
+
function toneMappingOperatorId(value) {
|
|
2286
|
+
if (value === "linear")
|
|
2287
|
+
return 0;
|
|
2288
|
+
if (value === "reinhard")
|
|
2289
|
+
return 1;
|
|
2290
|
+
if (value === "aces")
|
|
2291
|
+
return 2;
|
|
2292
|
+
if (value === "filmic")
|
|
2293
|
+
return 3;
|
|
2294
|
+
if (value === "uncharted2")
|
|
2295
|
+
return 4;
|
|
2296
|
+
if (value === "agx")
|
|
2297
|
+
return 5;
|
|
2298
|
+
return 6;
|
|
2299
|
+
}
|
|
2300
|
+
/* ------------------------------------------------------------------------- */
|
|
2301
|
+
/* C-13 v2 seam (PRD-03 Phase 2, CCR-03-5) */
|
|
2302
|
+
/* ------------------------------------------------------------------------- */
|
|
2303
|
+
/**
|
|
2304
|
+
* The §6.1 OUT stage adapted onto the proven native tone program (C-05
|
|
2305
|
+
* OutputPass stub): single tonemap operator + sRGB encode. `exposure`
|
|
2306
|
+
* defaults to the pipeline bag's §6.4 product — while the transitional
|
|
2307
|
+
* chain applies exposure here, the final graph applies it in S10 composite
|
|
2308
|
+
* and this pass receives `1`.
|
|
2309
|
+
*/
|
|
2310
|
+
export function createLegacyOutputPass(pipeline, base) {
|
|
2311
|
+
const operator = pipeline.toneMapping === "none" ? "linear" : pipeline.toneMapping;
|
|
2312
|
+
return {
|
|
2313
|
+
name: "tone-mapping",
|
|
2314
|
+
options: {
|
|
2315
|
+
...(base ?? {}),
|
|
2316
|
+
operator,
|
|
2317
|
+
exposure: pipeline.exposure,
|
|
2318
|
+
inputColorSpace: "srgb-linear",
|
|
2319
|
+
outputColorSpace: "srgb",
|
|
2320
|
+
// §6.1 OUT.dithering: false — the S12 finalize owns the triangular
|
|
2321
|
+
// dither; a second dither here would double-dither.
|
|
2322
|
+
...(pipeline.dither === false ? { dithering: false } : {})
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* `executePostGraphWebGL2` — the C-13 device carve (CONTRACTS §3.1 /
|
|
2328
|
+
* PRD-03 §7.2). It receives the device's GL internals (the registered
|
|
2329
|
+
* `WebGL2DeviceHost`) plus the already-planned LDR descriptors, replaces
|
|
2330
|
+
* the legacy `tone-mapping` descriptor with `createLegacyOutputPass`,
|
|
2331
|
+
* stamps `v2` on bloom options (the §7.2 field-range carve), and runs the
|
|
2332
|
+
* proven native fused path. Phases 3–6 grow this seam stage-by-stage into
|
|
2333
|
+
* the real v2 GPU loop (S1–S12) without touching `WebGL2Device.ts`.
|
|
2334
|
+
*/
|
|
2335
|
+
export function executePostGraphWebGL2(host, source, request) {
|
|
2336
|
+
if (!host) {
|
|
2337
|
+
throw new RenderDeviceError("PostGraph v2 requires a WebGL2 device host.", "POST_GRAPH_V2_UNSUPPORTED");
|
|
2338
|
+
}
|
|
2339
|
+
const v2 = request.v2;
|
|
2340
|
+
const pipeline = request.pipeline;
|
|
2341
|
+
// Phase 3: real S1/S2/S4 + CA run on the HDR target before the fused
|
|
2342
|
+
// present; S10b/S11/S12 run as the LDR tail after it.
|
|
2343
|
+
let workSource = source;
|
|
2344
|
+
if (v2) {
|
|
2345
|
+
workSource = v2.runV2HdrStages(host, source, pipeline, request.cameraFrame, request.temporal, request.frameContext).target;
|
|
2346
|
+
}
|
|
2347
|
+
const needsTail = Boolean(v2 && v2.v2NeedsLdrTail(pipeline));
|
|
2348
|
+
const ldrTailTarget = needsTail && v2
|
|
2349
|
+
? v2.acquireV2Target(host, { width: source.width, height: source.height, format: "rgba8" })
|
|
2350
|
+
: undefined;
|
|
2351
|
+
// With a real S12 the fused OUT must not emit the legacy dither — the
|
|
2352
|
+
// finalize pass owns the single triangular dither for the frame.
|
|
2353
|
+
const pipelineForOut = needsTail && pipeline.dither !== false
|
|
2354
|
+
? { ...pipeline, dither: false }
|
|
2355
|
+
: pipeline;
|
|
2356
|
+
const mappedPasses = request.passes
|
|
2357
|
+
// §6.9/T0-17 (FLAG-ON-4): on the v2 chain the HDR stages own their
|
|
2358
|
+
// effects — S2 GTAO (ssao), S6 (depth-of-field), S7 (motion-blur),
|
|
2359
|
+
// S5 (taa). The legacy twin must not double-run, and its native depth
|
|
2360
|
+
// read would throw WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED per frame on
|
|
2361
|
+
// the pooled depth-less stage output.
|
|
2362
|
+
.filter((pass) => !(v2 && ((pipeline.ao && pass.name === "ssao")
|
|
2363
|
+
|| (pipeline.dof && pass.name === "depth-of-field")
|
|
2364
|
+
|| (pipeline.motionBlur && pass.name === "motion-blur")
|
|
2365
|
+
|| ((pipeline.antiAliasing === "taa" || Boolean(pipeline.taa)) && pass.name === "taa"))))
|
|
2366
|
+
.map((pass) => {
|
|
2367
|
+
if (pass.name === "tone-mapping") {
|
|
2368
|
+
return createLegacyOutputPass(pipelineForOut, pass.options);
|
|
2369
|
+
}
|
|
2370
|
+
if (pass.name === "bloom") {
|
|
2371
|
+
return { name: pass.name, options: { ...pass.options, v2: true } };
|
|
2372
|
+
}
|
|
2373
|
+
return pass;
|
|
2374
|
+
});
|
|
2375
|
+
// T0-17/FLAG-ON-4: the pooled HDR-stage output carries no depth texture —
|
|
2376
|
+
// any remaining native depth pass would throw
|
|
2377
|
+
// WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED per frame; degrade it to a
|
|
2378
|
+
// recorded skip instead.
|
|
2379
|
+
const workSourceDepthless = workSource !== source && !workSource.depthTextureHandle;
|
|
2380
|
+
const depthSkippedPasses = workSourceDepthless
|
|
2381
|
+
? mappedPasses.filter((pass) => {
|
|
2382
|
+
if (pass.name === "depth-of-field" || pass.name === "ssao" || pass.name === "ssr") {
|
|
2383
|
+
recordPostSkipped(`WEBGL_LDR_POSTPROCESS_DEPTH_REQUIRED:${pass.name}`);
|
|
2384
|
+
return false;
|
|
2385
|
+
}
|
|
2386
|
+
return true;
|
|
2387
|
+
})
|
|
2388
|
+
: mappedPasses;
|
|
2389
|
+
// T0-17/FLAG-ON-3: `output.toneMapping:'none'` drops the legacy tone pass,
|
|
2390
|
+
// but an HDR workSource (HDR stages ran, or an rgba16f forward target)
|
|
2391
|
+
// still needs the §6.1 OUT stage to reach LDR — inject the linear
|
|
2392
|
+
// OutputPass (createLegacyOutputPass maps 'none' to the linear operator)
|
|
2393
|
+
// instead of throwing WEBGL_LDR_POSTPROCESS_FORMAT_UNSUPPORTED per frame.
|
|
2394
|
+
const passes = pipeline.toneMapping === "none" && !depthSkippedPasses.some((pass) => pass.name === "tone-mapping")
|
|
2395
|
+
? [...depthSkippedPasses, createLegacyOutputPass(pipelineForOut)]
|
|
2396
|
+
: depthSkippedPasses;
|
|
2397
|
+
host.post.presentLdrPostprocess(workSource, {
|
|
2398
|
+
passes,
|
|
2399
|
+
...(ldrTailTarget ?? request.outputTarget ? { outputTarget: ldrTailTarget ?? request.outputTarget } : {}),
|
|
2400
|
+
toneMappingDefaults: { outputColorSpace: "srgb" },
|
|
2401
|
+
depthRange: {
|
|
2402
|
+
near: request.depthRange?.near ?? request.pipeline.depthRange.near,
|
|
2403
|
+
far: request.depthRange?.far ?? request.pipeline.depthRange.far
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2406
|
+
if (workSource !== source && v2)
|
|
2407
|
+
v2.releaseV2Target(host, workSource);
|
|
2408
|
+
if (ldrTailTarget && v2) {
|
|
2409
|
+
v2.runV2LdrTail(host, ldrTailTarget, pipeline, request.outputTarget, request.frameContext);
|
|
2410
|
+
v2.releaseV2Target(host, ldrTailTarget);
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Native bloom bright-extract fragment (exported for the glslang unit gate).
|
|
2415
|
+
* HDR sources: flag-on (`u_excess`) keeps the §6.6 soft-knee excess over
|
|
2416
|
+
* threshold; flag-off keeps the legacy full-colour gate. LDR sources use the
|
|
2417
|
+
* packed bright LUT.
|
|
2418
|
+
*/
|
|
2419
|
+
export const BLOOM_BRIGHT_EXTRACT_GLSL = `#version 300 es
|
|
2420
|
+
precision highp float;
|
|
2421
|
+
precision highp int;
|
|
2422
|
+
uniform sampler2D u_source;
|
|
2423
|
+
uniform sampler2D u_brightLut;
|
|
2424
|
+
uniform int u_hdr;
|
|
2425
|
+
uniform float u_threshold;
|
|
2426
|
+
uniform float u_softKnee;
|
|
2427
|
+
uniform int u_excess;
|
|
2428
|
+
out vec4 outColor;
|
|
2429
|
+
|
|
2430
|
+
uvec4 byteTexel(sampler2D source, ivec2 coordinate) {
|
|
2431
|
+
return uvec4(texelFetch(source, coordinate, 0) * 255.0 + 0.5);
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
void main() {
|
|
2435
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
2436
|
+
if (u_hdr == 1) {
|
|
2437
|
+
vec4 source = texelFetch(u_source, pixel, 0);
|
|
2438
|
+
float luma = dot(source.rgb, vec3(0.2126, 0.7152, 0.0722));
|
|
2439
|
+
if (u_excess == 1) {
|
|
2440
|
+
// PRD-03 §6.6 soft-knee threshold weight (bloom.glsl prefilter twin):
|
|
2441
|
+
// keep only the excess over threshold — quadratic inside the knee,
|
|
2442
|
+
// linear above it — so bloom energy is proportional to the excess.
|
|
2443
|
+
// u_softKnee is the absolute knee width (threshold × knee ratio).
|
|
2444
|
+
float knee = max(u_softKnee, 0.0);
|
|
2445
|
+
float soft = clamp(luma - u_threshold + knee, 0.0, 2.0 * knee);
|
|
2446
|
+
soft = soft * soft / (4.0 * knee + 1e-5);
|
|
2447
|
+
float excessWeight = max(soft, luma - u_threshold) / max(luma, 1e-5);
|
|
2448
|
+
outColor = vec4(source.rgb * excessWeight, source.a);
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
float kneeLow = max(u_threshold - u_softKnee, 0.0);
|
|
2452
|
+
float kneeHigh = min(u_threshold + u_softKnee, 1.0);
|
|
2453
|
+
float weight = u_softKnee <= 0.0
|
|
2454
|
+
? (luma >= u_threshold ? 1.0 : 0.0)
|
|
2455
|
+
: smoothstep(kneeLow, kneeHigh, luma);
|
|
2456
|
+
outColor = source * weight;
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
uvec4 source = byteTexel(u_source, pixel);
|
|
2460
|
+
uint colorIndex = (source.r << 16u) | (source.g << 8u) | source.b;
|
|
2461
|
+
uint byteIndex = colorIndex >> 3u;
|
|
2462
|
+
uint texelIndex = byteIndex >> 2u;
|
|
2463
|
+
ivec2 lutCoordinate = ivec2(
|
|
2464
|
+
int(texelIndex % ${BLOOM_BRIGHT_LUT_WIDTH}u),
|
|
2465
|
+
int(texelIndex / ${BLOOM_BRIGHT_LUT_WIDTH}u)
|
|
2466
|
+
);
|
|
2467
|
+
uvec4 packed = byteTexel(u_brightLut, lutCoordinate);
|
|
2468
|
+
uint component = byteIndex & 3u;
|
|
2469
|
+
uint packedByte = component == 0u
|
|
2470
|
+
? packed.r
|
|
2471
|
+
: component == 1u
|
|
2472
|
+
? packed.g
|
|
2473
|
+
: component == 2u
|
|
2474
|
+
? packed.b
|
|
2475
|
+
: packed.a;
|
|
2476
|
+
bool bright = ((packedByte >> (colorIndex & 7u)) & 1u) == 1u;
|
|
2477
|
+
outColor = bright ? vec4(source) / 255.0 : vec4(0.0);
|
|
2478
|
+
}
|
|
2479
|
+
`;
|
|
2480
|
+
//# sourceMappingURL=LegacyPost.js.map
|