@driftengine/core 3.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +9 -0
- package/dist/behavior/behaviorTree.d.ts +140 -0
- package/dist/behavior/behaviorTree.js +289 -0
- package/dist/build/shaderComments.d.ts +64 -0
- package/dist/build/shaderComments.js +0 -0
- package/dist/cinematic/player.d.ts +80 -0
- package/dist/cinematic/player.js +184 -0
- package/dist/cinematic/script.d.ts +63 -0
- package/dist/cinematic/script.js +141 -0
- package/dist/core/bootGate.d.ts +37 -0
- package/dist/core/bootGate.js +47 -0
- package/dist/core/loadTracker.d.ts +78 -0
- package/dist/core/loadTracker.js +106 -0
- package/dist/core/loop.d.ts +118 -0
- package/dist/core/loop.js +84 -0
- package/dist/core/messageQueue.d.ts +61 -0
- package/dist/core/messageQueue.js +104 -0
- package/dist/core/onceSet.d.ts +27 -0
- package/dist/core/onceSet.js +62 -0
- package/dist/core/preferences.d.ts +47 -0
- package/dist/core/preferences.js +140 -0
- package/dist/core/remoteSave.d.ts +154 -0
- package/dist/core/remoteSave.js +249 -0
- package/dist/core/rng.d.ts +64 -0
- package/dist/core/rng.js +72 -0
- package/dist/core/stepBudget.d.ts +91 -0
- package/dist/core/stepBudget.js +105 -0
- package/dist/core/storage.d.ts +52 -0
- package/dist/core/storage.js +85 -0
- package/dist/core/tickTrace.d.ts +72 -0
- package/dist/core/tickTrace.js +102 -0
- package/dist/core/timeCurve.d.ts +83 -0
- package/dist/core/timeCurve.js +107 -0
- package/dist/core/withDefaults.d.ts +21 -0
- package/dist/core/withDefaults.js +29 -0
- package/dist/dev/contactProbe.d.ts +41 -0
- package/dist/dev/contactProbe.js +58 -0
- package/dist/dev/fpsMeter.d.ts +45 -0
- package/dist/dev/fpsMeter.js +86 -0
- package/dist/environment/celestialClock.d.ts +141 -0
- package/dist/environment/celestialClock.js +262 -0
- package/dist/geometry/decal.d.ts +61 -0
- package/dist/geometry/decal.js +178 -0
- package/dist/geometry/filmPatch.d.ts +35 -0
- package/dist/geometry/filmPatch.js +112 -0
- package/dist/geometry/growable.d.ts +70 -0
- package/dist/geometry/growable.js +167 -0
- package/dist/geometry/lightVolume.d.ts +76 -0
- package/dist/geometry/lightVolume.js +65 -0
- package/dist/geometry/meshBuilder.d.ts +426 -0
- package/dist/geometry/meshBuilder.js +1184 -0
- package/dist/geometry/pixelFont.d.ts +59 -0
- package/dist/geometry/pixelFont.js +179 -0
- package/dist/geometry/ribbon.d.ts +101 -0
- package/dist/geometry/ribbon.js +546 -0
- package/dist/geometry/shellFill.d.ts +101 -0
- package/dist/geometry/shellFill.js +203 -0
- package/dist/geometry/spline.d.ts +162 -0
- package/dist/geometry/spline.js +527 -0
- package/dist/geometry/tangents.d.ts +30 -0
- package/dist/geometry/tangents.js +142 -0
- package/dist/geometry/textMesh.d.ts +51 -0
- package/dist/geometry/textMesh.js +57 -0
- package/dist/geometry/treeBuilder.d.ts +37 -0
- package/dist/geometry/treeBuilder.js +56 -0
- package/dist/host/display.d.ts +135 -0
- package/dist/host/display.js +114 -0
- package/dist/host/files.d.ts +25 -0
- package/dist/host/files.js +44 -0
- package/dist/host/lifecycle.d.ts +45 -0
- package/dist/host/lifecycle.js +28 -0
- package/dist/host/platformServices.d.ts +23 -0
- package/dist/host/platformServices.js +1 -0
- package/dist/host/screen.d.ts +49 -0
- package/dist/host/screen.js +90 -0
- package/dist/index.d.ts +289 -0
- package/dist/index.js +320 -0
- package/dist/input/actionMap.d.ts +181 -0
- package/dist/input/actionMap.js +314 -0
- package/dist/input/activeDevice.d.ts +55 -0
- package/dist/input/activeDevice.js +83 -0
- package/dist/input/gamepadIdentity.d.ts +43 -0
- package/dist/input/gamepadIdentity.js +108 -0
- package/dist/input/gamepadMapping.d.ts +56 -0
- package/dist/input/gamepadMapping.js +91 -0
- package/dist/input/input.d.ts +281 -0
- package/dist/input/input.js +703 -0
- package/dist/input/inputHarness.d.ts +42 -0
- package/dist/input/inputHarness.js +193 -0
- package/dist/input/rightGesture.d.ts +57 -0
- package/dist/input/rightGesture.js +49 -0
- package/dist/input/rumble.d.ts +71 -0
- package/dist/input/rumble.js +119 -0
- package/dist/input/touchControls.d.ts +138 -0
- package/dist/input/touchControls.js +352 -0
- package/dist/input/typingTarget.d.ts +6 -0
- package/dist/input/typingTarget.js +27 -0
- package/dist/math/bounds.d.ts +61 -0
- package/dist/math/bounds.js +121 -0
- package/dist/math/color.d.ts +8 -0
- package/dist/math/color.js +35 -0
- package/dist/math/exact.d.ts +66 -0
- package/dist/math/exact.js +262 -0
- package/dist/math/frustum.d.ts +44 -0
- package/dist/math/frustum.js +90 -0
- package/dist/math/intersect.d.ts +76 -0
- package/dist/math/intersect.js +185 -0
- package/dist/math/scalar.d.ts +51 -0
- package/dist/math/scalar.js +99 -0
- package/dist/math/spring.d.ts +59 -0
- package/dist/math/spring.js +88 -0
- package/dist/nav/navGraph.d.ts +71 -0
- package/dist/nav/navGraph.js +111 -0
- package/dist/nav/navPath.d.ts +93 -0
- package/dist/nav/navPath.js +162 -0
- package/dist/nav/navSearch.d.ts +74 -0
- package/dist/nav/navSearch.js +198 -0
- package/dist/physics/boxSurface.d.ts +48 -0
- package/dist/physics/boxSurface.js +73 -0
- package/dist/physics/colliderSurface.d.ts +46 -0
- package/dist/physics/colliderSurface.js +146 -0
- package/dist/physics/compositeSurface.d.ts +33 -0
- package/dist/physics/compositeSurface.js +108 -0
- package/dist/physics/heightSurface.d.ts +103 -0
- package/dist/physics/heightSurface.js +153 -0
- package/dist/physics/ribbonSurface.d.ts +239 -0
- package/dist/physics/ribbonSurface.js +522 -0
- package/dist/render/ambientOcclusionPass.d.ts +53 -0
- package/dist/render/ambientOcclusionPass.js +179 -0
- package/dist/render/areaLights.d.ts +116 -0
- package/dist/render/areaLights.js +91 -0
- package/dist/render/areaShadowSet.d.ts +184 -0
- package/dist/render/areaShadowSet.js +277 -0
- package/dist/render/atmosphere.d.ts +94 -0
- package/dist/render/atmosphere.js +91 -0
- package/dist/render/backend/api.d.ts +496 -0
- package/dist/render/backend/api.js +1 -0
- package/dist/render/backend/budget.d.ts +82 -0
- package/dist/render/backend/budget.js +99 -0
- package/dist/render/backend/createRenderer.d.ts +135 -0
- package/dist/render/backend/createRenderer.js +201 -0
- package/dist/render/backend/deadline.d.ts +24 -0
- package/dist/render/backend/deadline.js +38 -0
- package/dist/render/backend/probe.d.ts +30 -0
- package/dist/render/backend/probe.js +129 -0
- package/dist/render/backend/select.d.ts +70 -0
- package/dist/render/backend/select.js +249 -0
- package/dist/render/backend/timer.d.ts +50 -0
- package/dist/render/backend/timer.js +1 -0
- package/dist/render/backend/webgl2/instanced.d.ts +21 -0
- package/dist/render/backend/webgl2/instanced.js +42 -0
- package/dist/render/backend/webgl2/morphTexture.d.ts +21 -0
- package/dist/render/backend/webgl2/morphTexture.js +55 -0
- package/dist/render/backend/webgl2/renderer.d.ts +3027 -0
- package/dist/render/backend/webgl2/renderer.js +6041 -0
- package/dist/render/backend/webgl2/skinPaletteTexture.d.ts +32 -0
- package/dist/render/backend/webgl2/skinPaletteTexture.js +68 -0
- package/dist/render/backend/webgpu/boltPass.d.ts +42 -0
- package/dist/render/backend/webgpu/boltPass.js +160 -0
- package/dist/render/backend/webgpu/buffers.d.ts +159 -0
- package/dist/render/backend/webgpu/buffers.js +402 -0
- package/dist/render/backend/webgpu/causticsPass.d.ts +36 -0
- package/dist/render/backend/webgpu/causticsPass.js +138 -0
- package/dist/render/backend/webgpu/clusterBinner.d.ts +51 -0
- package/dist/render/backend/webgpu/clusterBinner.js +206 -0
- package/dist/render/backend/webgpu/depthPass.d.ts +114 -0
- package/dist/render/backend/webgpu/depthPass.js +228 -0
- package/dist/render/backend/webgpu/device.d.ts +52 -0
- package/dist/render/backend/webgpu/device.js +121 -0
- package/dist/render/backend/webgpu/drawCommand.d.ts +43 -0
- package/dist/render/backend/webgpu/drawCommand.js +54 -0
- package/dist/render/backend/webgpu/environmentTexels.d.ts +28 -0
- package/dist/render/backend/webgpu/environmentTexels.js +79 -0
- package/dist/render/backend/webgpu/filmPass.d.ts +29 -0
- package/dist/render/backend/webgpu/filmPass.js +97 -0
- package/dist/render/backend/webgpu/flatPass.d.ts +213 -0
- package/dist/render/backend/webgpu/flatPass.js +482 -0
- package/dist/render/backend/webgpu/flockPass.d.ts +34 -0
- package/dist/render/backend/webgpu/flockPass.js +129 -0
- package/dist/render/backend/webgpu/gpuTimestamps.d.ts +94 -0
- package/dist/render/backend/webgpu/gpuTimestamps.js +213 -0
- package/dist/render/backend/webgpu/insetPass.d.ts +19 -0
- package/dist/render/backend/webgpu/insetPass.js +108 -0
- package/dist/render/backend/webgpu/instanced.d.ts +27 -0
- package/dist/render/backend/webgpu/instanced.js +49 -0
- package/dist/render/backend/webgpu/lightVolumePass.d.ts +75 -0
- package/dist/render/backend/webgpu/lightVolumePass.js +154 -0
- package/dist/render/backend/webgpu/linePass.d.ts +90 -0
- package/dist/render/backend/webgpu/linePass.js +220 -0
- package/dist/render/backend/webgpu/morphTexture.d.ts +18 -0
- package/dist/render/backend/webgpu/morphTexture.js +51 -0
- package/dist/render/backend/webgpu/panelPass.d.ts +37 -0
- package/dist/render/backend/webgpu/panelPass.js +114 -0
- package/dist/render/backend/webgpu/particlePass.d.ts +89 -0
- package/dist/render/backend/webgpu/particlePass.js +280 -0
- package/dist/render/backend/webgpu/pipelineCache.d.ts +93 -0
- package/dist/render/backend/webgpu/pipelineCache.js +140 -0
- package/dist/render/backend/webgpu/plumePass.d.ts +69 -0
- package/dist/render/backend/webgpu/plumePass.js +213 -0
- package/dist/render/backend/webgpu/pointShadowPass.d.ts +88 -0
- package/dist/render/backend/webgpu/pointShadowPass.js +280 -0
- package/dist/render/backend/webgpu/postPass.d.ts +342 -0
- package/dist/render/backend/webgpu/postPass.js +366 -0
- package/dist/render/backend/webgpu/probePass.d.ts +108 -0
- package/dist/render/backend/webgpu/probePass.js +188 -0
- package/dist/render/backend/webgpu/reflectionPass.d.ts +29 -0
- package/dist/render/backend/webgpu/reflectionPass.js +87 -0
- package/dist/render/backend/webgpu/renderer.d.ts +3082 -0
- package/dist/render/backend/webgpu/renderer.js +10911 -0
- package/dist/render/backend/webgpu/scatterPass.d.ts +95 -0
- package/dist/render/backend/webgpu/scatterPass.js +266 -0
- package/dist/render/backend/webgpu/sdfTextPass.d.ts +86 -0
- package/dist/render/backend/webgpu/sdfTextPass.js +190 -0
- package/dist/render/backend/webgpu/shaderModules.d.ts +9 -0
- package/dist/render/backend/webgpu/shaderModules.js +45 -0
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +23 -0
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.js +208 -0
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +67 -0
- package/dist/render/backend/webgpu/skinPaletteRing.js +97 -0
- package/dist/render/backend/webgpu/skinPaletteTexture.d.ts +17 -0
- package/dist/render/backend/webgpu/skinPaletteTexture.js +68 -0
- package/dist/render/backend/webgpu/skyPass.d.ts +102 -0
- package/dist/render/backend/webgpu/skyPass.js +70 -0
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +41 -0
- package/dist/render/backend/webgpu/surfaceTexturePass.js +228 -0
- package/dist/render/backend/webgpu/textPass.d.ts +73 -0
- package/dist/render/backend/webgpu/textPass.js +190 -0
- package/dist/render/backend/webgpu/uniformRing.d.ts +133 -0
- package/dist/render/backend/webgpu/uniformRing.js +208 -0
- package/dist/render/backend/webgpu/waterPass.d.ts +73 -0
- package/dist/render/backend/webgpu/waterPass.js +160 -0
- package/dist/render/backend/webgpu/windStreakPass.d.ts +46 -0
- package/dist/render/backend/webgpu/windStreakPass.js +153 -0
- package/dist/render/billboard.d.ts +27 -0
- package/dist/render/billboard.js +79 -0
- package/dist/render/bloomChain.d.ts +66 -0
- package/dist/render/bloomChain.js +83 -0
- package/dist/render/bloomPass.d.ts +54 -0
- package/dist/render/bloomPass.js +219 -0
- package/dist/render/boltBatch.d.ts +39 -0
- package/dist/render/boltBatch.js +121 -0
- package/dist/render/boltPool.d.ts +135 -0
- package/dist/render/boltPool.js +259 -0
- package/dist/render/boom.d.ts +46 -0
- package/dist/render/boom.js +81 -0
- package/dist/render/camera.d.ts +119 -0
- package/dist/render/camera.js +304 -0
- package/dist/render/causticsRenderer.d.ts +63 -0
- package/dist/render/causticsRenderer.js +119 -0
- package/dist/render/cinematicCamera.d.ts +102 -0
- package/dist/render/cinematicCamera.js +227 -0
- package/dist/render/clusteredLights.d.ts +260 -0
- package/dist/render/clusteredLights.js +479 -0
- package/dist/render/colourGrade.d.ts +62 -0
- package/dist/render/colourGrade.js +91 -0
- package/dist/render/compute.d.ts +74 -0
- package/dist/render/compute.js +8 -0
- package/dist/render/contextLoss.d.ts +32 -0
- package/dist/render/contextLoss.js +46 -0
- package/dist/render/debugLines.d.ts +75 -0
- package/dist/render/debugLines.js +281 -0
- package/dist/render/decalPass.d.ts +34 -0
- package/dist/render/decalPass.js +103 -0
- package/dist/render/decalProjector.d.ts +140 -0
- package/dist/render/decalProjector.js +282 -0
- package/dist/render/decalQueue.d.ts +53 -0
- package/dist/render/decalQueue.js +87 -0
- package/dist/render/depthConvention.d.ts +314 -0
- package/dist/render/depthConvention.js +346 -0
- package/dist/render/drawingBuffer.d.ts +52 -0
- package/dist/render/drawingBuffer.js +67 -0
- package/dist/render/emptyTexture.d.ts +60 -0
- package/dist/render/emptyTexture.js +103 -0
- package/dist/render/envProbeArray.d.ts +85 -0
- package/dist/render/envProbeArray.js +164 -0
- package/dist/render/equirectToCube.d.ts +54 -0
- package/dist/render/equirectToCube.js +123 -0
- package/dist/render/flockGeometry.d.ts +23 -0
- package/dist/render/flockGeometry.js +43 -0
- package/dist/render/flockRenderer.d.ts +37 -0
- package/dist/render/flockRenderer.js +70 -0
- package/dist/render/frame/arena.d.ts +32 -0
- package/dist/render/frame/arena.js +65 -0
- package/dist/render/frame/index.d.ts +18 -0
- package/dist/render/frame/index.js +4 -0
- package/dist/render/frame/replay.d.ts +34 -0
- package/dist/render/frame/replay.js +48 -0
- package/dist/render/frame/resources.d.ts +25 -0
- package/dist/render/frame/resources.js +55 -0
- package/dist/render/frame/schedule.d.ts +37 -0
- package/dist/render/frame/schedule.js +61 -0
- package/dist/render/frameView.d.ts +19 -0
- package/dist/render/frameView.js +1 -0
- package/dist/render/gizmo.d.ts +236 -0
- package/dist/render/gizmo.js +727 -0
- package/dist/render/globalMedium.d.ts +124 -0
- package/dist/render/globalMedium.js +100 -0
- package/dist/render/globalMediumPass.d.ts +101 -0
- package/dist/render/globalMediumPass.js +250 -0
- package/dist/render/gpuCapability.d.ts +111 -0
- package/dist/render/gpuCapability.js +194 -0
- package/dist/render/gpuTimer.d.ts +87 -0
- package/dist/render/gpuTimer.js +145 -0
- package/dist/render/halfFloat.d.ts +4 -0
- package/dist/render/halfFloat.js +38 -0
- package/dist/render/handleRegistry.d.ts +54 -0
- package/dist/render/handleRegistry.js +84 -0
- package/dist/render/iesProfile.d.ts +64 -0
- package/dist/render/iesProfile.js +179 -0
- package/dist/render/imageTexels.d.ts +50 -0
- package/dist/render/imageTexels.js +91 -0
- package/dist/render/instancedMesh.d.ts +48 -0
- package/dist/render/instancedMesh.js +127 -0
- package/dist/render/instances.d.ts +69 -0
- package/dist/render/instances.js +52 -0
- package/dist/render/lightBudget.d.ts +397 -0
- package/dist/render/lightBudget.js +524 -0
- package/dist/render/lightMatrix.d.ts +3 -0
- package/dist/render/lightMatrix.js +45 -0
- package/dist/render/lightVolumeDraw.d.ts +132 -0
- package/dist/render/lightVolumeDraw.js +181 -0
- package/dist/render/lineBatch.d.ts +60 -0
- package/dist/render/lineBatch.js +160 -0
- package/dist/render/linePoints.d.ts +33 -0
- package/dist/render/linePoints.js +46 -0
- package/dist/render/livePointShadowSet.d.ts +72 -0
- package/dist/render/livePointShadowSet.js +258 -0
- package/dist/render/lod.d.ts +35 -0
- package/dist/render/lod.js +65 -0
- package/dist/render/mesh.d.ts +177 -0
- package/dist/render/mesh.js +466 -0
- package/dist/render/occlusion.d.ts +81 -0
- package/dist/render/occlusion.js +378 -0
- package/dist/render/oitPass.d.ts +67 -0
- package/dist/render/oitPass.js +213 -0
- package/dist/render/orderIndependent.d.ts +92 -0
- package/dist/render/orderIndependent.js +108 -0
- package/dist/render/particleBatch.d.ts +140 -0
- package/dist/render/particleBatch.js +186 -0
- package/dist/render/particleMaterial.d.ts +54 -0
- package/dist/render/particleMaterial.js +42 -0
- package/dist/render/particlePool.d.ts +124 -0
- package/dist/render/particlePool.js +182 -0
- package/dist/render/pass.d.ts +195 -0
- package/dist/render/pass.js +9 -0
- package/dist/render/passTarget.d.ts +86 -0
- package/dist/render/passTarget.js +121 -0
- package/dist/render/pickable.d.ts +31 -0
- package/dist/render/pickable.js +172 -0
- package/dist/render/planarReflection.d.ts +59 -0
- package/dist/render/planarReflection.js +194 -0
- package/dist/render/planarReflectionDraw.d.ts +31 -0
- package/dist/render/planarReflectionDraw.js +65 -0
- package/dist/render/plumeGeometry.d.ts +25 -0
- package/dist/render/plumeGeometry.js +61 -0
- package/dist/render/plumeMaterial.d.ts +31 -0
- package/dist/render/plumeMaterial.js +64 -0
- package/dist/render/plumeRenderer.d.ts +96 -0
- package/dist/render/plumeRenderer.js +185 -0
- package/dist/render/pointLightSelection.d.ts +175 -0
- package/dist/render/pointLightSelection.js +301 -0
- package/dist/render/pointShadowArray.d.ts +95 -0
- package/dist/render/pointShadowArray.js +219 -0
- package/dist/render/pointShadowBudget.d.ts +118 -0
- package/dist/render/pointShadowBudget.js +221 -0
- package/dist/render/pointShadowImage.d.ts +265 -0
- package/dist/render/pointShadowImage.js +339 -0
- package/dist/render/pointShadowMap.d.ts +93 -0
- package/dist/render/pointShadowMap.js +167 -0
- package/dist/render/pointShadowSystem.d.ts +195 -0
- package/dist/render/pointShadowSystem.js +336 -0
- package/dist/render/prefilterEnvMap.d.ts +124 -0
- package/dist/render/prefilterEnvMap.js +146 -0
- package/dist/render/prefilterPass.d.ts +44 -0
- package/dist/render/prefilterPass.js +98 -0
- package/dist/render/probeGrid.d.ts +122 -0
- package/dist/render/probeGrid.js +174 -0
- package/dist/render/rainField.d.ts +99 -0
- package/dist/render/rainField.js +168 -0
- package/dist/render/reflectionProbe.d.ts +188 -0
- package/dist/render/reflectionProbe.js +437 -0
- package/dist/render/renderQuality.d.ts +699 -0
- package/dist/render/renderQuality.js +293 -0
- package/dist/render/rendererHarness.d.ts +39 -0
- package/dist/render/rendererHarness.js +185 -0
- package/dist/render/resolutionGovernor.d.ts +107 -0
- package/dist/render/resolutionGovernor.js +144 -0
- package/dist/render/scatterDeform.d.ts +17 -0
- package/dist/render/scatterDeform.js +46 -0
- package/dist/render/sceneTarget.d.ts +288 -0
- package/dist/render/sceneTarget.js +856 -0
- package/dist/render/screenSpaceReflection.d.ts +233 -0
- package/dist/render/screenSpaceReflection.js +415 -0
- package/dist/render/sdfFont.d.ts +77 -0
- package/dist/render/sdfFont.js +86 -0
- package/dist/render/sdfTextLayout.d.ts +46 -0
- package/dist/render/sdfTextLayout.js +145 -0
- package/dist/render/sdfTextRenderer.d.ts +75 -0
- package/dist/render/sdfTextRenderer.js +194 -0
- package/dist/render/seaState.d.ts +25 -0
- package/dist/render/seaState.js +34 -0
- package/dist/render/segmentQuads.d.ts +29 -0
- package/dist/render/segmentQuads.js +75 -0
- package/dist/render/shader.d.ts +5 -0
- package/dist/render/shader.js +172 -0
- package/dist/render/shaders/ambientOcclusion.d.ts +45 -0
- package/dist/render/shaders/ambientOcclusion.js +352 -0
- package/dist/render/shaders/arcane.d.ts +19 -0
- package/dist/render/shaders/arcane.js +102 -0
- package/dist/render/shaders/bloom.d.ts +70 -0
- package/dist/render/shaders/bloom.js +227 -0
- package/dist/render/shaders/bolt.d.ts +17 -0
- package/dist/render/shaders/bolt.js +161 -0
- package/dist/render/shaders/caustics.d.ts +38 -0
- package/dist/render/shaders/caustics.js +167 -0
- package/dist/render/shaders/conditionals.d.ts +21 -0
- package/dist/render/shaders/conditionals.js +55 -0
- package/dist/render/shaders/decalProject.d.ts +25 -0
- package/dist/render/shaders/decalProject.js +125 -0
- package/dist/render/shaders/depth.d.ts +14 -0
- package/dist/render/shaders/depth.js +114 -0
- package/dist/render/shaders/depthOfField.d.ts +41 -0
- package/dist/render/shaders/depthOfField.js +139 -0
- package/dist/render/shaders/film.d.ts +15 -0
- package/dist/render/shaders/film.js +283 -0
- package/dist/render/shaders/fire.d.ts +12 -0
- package/dist/render/shaders/fire.js +178 -0
- package/dist/render/shaders/flat/directionalShadow.d.ts +1 -0
- package/dist/render/shaders/flat/directionalShadow.js +195 -0
- package/dist/render/shaders/flat/index.d.ts +135 -0
- package/dist/render/shaders/flat/index.js +387 -0
- package/dist/render/shaders/flat/lobes.d.ts +1 -0
- package/dist/render/shaders/flat/lobes.js +398 -0
- package/dist/render/shaders/flat/main.d.ts +2 -0
- package/dist/render/shaders/flat/main.js +1630 -0
- package/dist/render/shaders/flat/pointShadow.d.ts +1 -0
- package/dist/render/shaders/flat/pointShadow.js +322 -0
- package/dist/render/shaders/flat/preamble.d.ts +15 -0
- package/dist/render/shaders/flat/preamble.js +864 -0
- package/dist/render/shaders/flat/probeGrid.d.ts +21 -0
- package/dist/render/shaders/flat/probeGrid.js +151 -0
- package/dist/render/shaders/flat/surface.d.ts +2 -0
- package/dist/render/shaders/flat/surface.js +40 -0
- package/dist/render/shaders/flock.d.ts +11 -0
- package/dist/render/shaders/flock.js +102 -0
- package/dist/render/shaders/fog.d.ts +37 -0
- package/dist/render/shaders/fog.js +98 -0
- package/dist/render/shaders/fullscreen.d.ts +16 -0
- package/dist/render/shaders/fullscreen.js +27 -0
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.d.ts +65 -0
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.js +71 -0
- package/dist/render/shaders/generated/arcane.wgsl.d.ts +90 -0
- package/dist/render/shaders/generated/arcane.wgsl.js +96 -0
- package/dist/render/shaders/generated/bloom.wgsl.d.ts +69 -0
- package/dist/render/shaders/generated/bloom.wgsl.js +75 -0
- package/dist/render/shaders/generated/bolt.wgsl.d.ts +118 -0
- package/dist/render/shaders/generated/bolt.wgsl.js +124 -0
- package/dist/render/shaders/generated/caustics.wgsl.d.ts +118 -0
- package/dist/render/shaders/generated/caustics.wgsl.js +124 -0
- package/dist/render/shaders/generated/decalProject.wgsl.d.ts +61 -0
- package/dist/render/shaders/generated/decalProject.wgsl.js +67 -0
- package/dist/render/shaders/generated/depth.wgsl.d.ts +131 -0
- package/dist/render/shaders/generated/depth.wgsl.js +137 -0
- package/dist/render/shaders/generated/film.wgsl.d.ts +134 -0
- package/dist/render/shaders/generated/film.wgsl.js +140 -0
- package/dist/render/shaders/generated/fire.wgsl.d.ts +128 -0
- package/dist/render/shaders/generated/fire.wgsl.js +134 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +9163 -0
- package/dist/render/shaders/generated/flat.wgsl.js +9192 -0
- package/dist/render/shaders/generated/flock.wgsl.d.ts +73 -0
- package/dist/render/shaders/generated/flock.wgsl.js +79 -0
- package/dist/render/shaders/generated/fullscreen.wgsl.d.ts +12 -0
- package/dist/render/shaders/generated/fullscreen.wgsl.js +18 -0
- package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +130 -0
- package/dist/render/shaders/generated/globalMedium.wgsl.js +136 -0
- package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +230 -0
- package/dist/render/shaders/generated/lightVolume.wgsl.js +239 -0
- package/dist/render/shaders/generated/line.wgsl.d.ts +128 -0
- package/dist/render/shaders/generated/line.wgsl.js +134 -0
- package/dist/render/shaders/generated/octahedralResolve.wgsl.d.ts +51 -0
- package/dist/render/shaders/generated/octahedralResolve.wgsl.js +57 -0
- package/dist/render/shaders/generated/oitResolve.wgsl.d.ts +23 -0
- package/dist/render/shaders/generated/oitResolve.wgsl.js +29 -0
- package/dist/render/shaders/generated/panel.wgsl.d.ts +48 -0
- package/dist/render/shaders/generated/panel.wgsl.js +54 -0
- package/dist/render/shaders/generated/particle.wgsl.d.ts +332 -0
- package/dist/render/shaders/generated/particle.wgsl.js +338 -0
- package/dist/render/shaders/generated/prefilter.wgsl.d.ts +61 -0
- package/dist/render/shaders/generated/prefilter.wgsl.js +67 -0
- package/dist/render/shaders/generated/rush.wgsl.d.ts +131 -0
- package/dist/render/shaders/generated/rush.wgsl.js +137 -0
- package/dist/render/shaders/generated/scatter.wgsl.d.ts +195 -0
- package/dist/render/shaders/generated/scatter.wgsl.js +201 -0
- package/dist/render/shaders/generated/sdfText.wgsl.d.ts +69 -0
- package/dist/render/shaders/generated/sdfText.wgsl.js +75 -0
- package/dist/render/shaders/generated/sky.wgsl.d.ts +100 -0
- package/dist/render/shaders/generated/sky.wgsl.js +106 -0
- package/dist/render/shaders/generated/smoke.wgsl.d.ts +85 -0
- package/dist/render/shaders/generated/smoke.wgsl.js +91 -0
- package/dist/render/shaders/generated/ssrResolve.wgsl.d.ts +18 -0
- package/dist/render/shaders/generated/ssrResolve.wgsl.js +24 -0
- package/dist/render/shaders/generated/ssrTrace.wgsl.d.ts +86 -0
- package/dist/render/shaders/generated/ssrTrace.wgsl.js +92 -0
- package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +46 -0
- package/dist/render/shaders/generated/temporalResolve.wgsl.js +52 -0
- package/dist/render/shaders/generated/text.wgsl.d.ts +98 -0
- package/dist/render/shaders/generated/text.wgsl.js +104 -0
- package/dist/render/shaders/generated/water.wgsl.d.ts +247 -0
- package/dist/render/shaders/generated/water.wgsl.js +253 -0
- package/dist/render/shaders/generated/windStreaks.wgsl.d.ts +73 -0
- package/dist/render/shaders/generated/windStreaks.wgsl.js +79 -0
- package/dist/render/shaders/gerstner.d.ts +21 -0
- package/dist/render/shaders/gerstner.js +110 -0
- package/dist/render/shaders/globalMedium.d.ts +56 -0
- package/dist/render/shaders/globalMedium.js +393 -0
- package/dist/render/shaders/lightVolume.d.ts +61 -0
- package/dist/render/shaders/lightVolume.js +527 -0
- package/dist/render/shaders/line.d.ts +18 -0
- package/dist/render/shaders/line.js +122 -0
- package/dist/render/shaders/morph.d.ts +26 -0
- package/dist/render/shaders/morph.js +61 -0
- package/dist/render/shaders/octahedral.d.ts +76 -0
- package/dist/render/shaders/octahedral.js +161 -0
- package/dist/render/shaders/octahedralResolve.d.ts +25 -0
- package/dist/render/shaders/octahedralResolve.js +81 -0
- package/dist/render/shaders/oitResolve.d.ts +17 -0
- package/dist/render/shaders/oitResolve.js +42 -0
- package/dist/render/shaders/outputTransform.d.ts +37 -0
- package/dist/render/shaders/outputTransform.js +106 -0
- package/dist/render/shaders/panel.d.ts +17 -0
- package/dist/render/shaders/panel.js +50 -0
- package/dist/render/shaders/particle.d.ts +82 -0
- package/dist/render/shaders/particle.js +431 -0
- package/dist/render/shaders/prefilter.d.ts +37 -0
- package/dist/render/shaders/prefilter.js +276 -0
- package/dist/render/shaders/rush.d.ts +21 -0
- package/dist/render/shaders/rush.js +355 -0
- package/dist/render/shaders/scatter.d.ts +14 -0
- package/dist/render/shaders/scatter.js +206 -0
- package/dist/render/shaders/sdfText.d.ts +9 -0
- package/dist/render/shaders/sdfText.js +65 -0
- package/dist/render/shaders/skinning.d.ts +17 -0
- package/dist/render/shaders/skinning.js +59 -0
- package/dist/render/shaders/sky.d.ts +10 -0
- package/dist/render/shaders/sky.js +242 -0
- package/dist/render/shaders/smoke.d.ts +8 -0
- package/dist/render/shaders/smoke.js +88 -0
- package/dist/render/shaders/ssrResolve.d.ts +15 -0
- package/dist/render/shaders/ssrResolve.js +28 -0
- package/dist/render/shaders/ssrTrace.d.ts +22 -0
- package/dist/render/shaders/ssrTrace.js +230 -0
- package/dist/render/shaders/tangentFrame.d.ts +17 -0
- package/dist/render/shaders/tangentFrame.js +70 -0
- package/dist/render/shaders/temporalResolve.d.ts +1 -0
- package/dist/render/shaders/temporalResolve.js +150 -0
- package/dist/render/shaders/text.d.ts +17 -0
- package/dist/render/shaders/text.js +155 -0
- package/dist/render/shaders/vertexChannel.d.ts +39 -0
- package/dist/render/shaders/vertexChannel.js +69 -0
- package/dist/render/shaders/water.d.ts +18 -0
- package/dist/render/shaders/water.js +354 -0
- package/dist/render/shaders/windStreaks.d.ts +14 -0
- package/dist/render/shaders/windStreaks.js +129 -0
- package/dist/render/shadowCasters.d.ts +107 -0
- package/dist/render/shadowCasters.js +1 -0
- package/dist/render/shadowMap.d.ts +10 -0
- package/dist/render/shadowMap.js +80 -0
- package/dist/render/shotPlacement.d.ts +80 -0
- package/dist/render/shotPlacement.js +183 -0
- package/dist/render/skinPalette.d.ts +90 -0
- package/dist/render/skinPalette.js +136 -0
- package/dist/render/ssrPass.d.ts +59 -0
- package/dist/render/ssrPass.js +196 -0
- package/dist/render/surfaceSheet.d.ts +52 -0
- package/dist/render/surfaceSheet.js +99 -0
- package/dist/render/surfaceTexture.d.ts +197 -0
- package/dist/render/surfaceTexture.js +116 -0
- package/dist/render/temporalAa.d.ts +104 -0
- package/dist/render/temporalAa.js +194 -0
- package/dist/render/temporalPass.d.ts +54 -0
- package/dist/render/temporalPass.js +135 -0
- package/dist/render/textLayout.d.ts +88 -0
- package/dist/render/textLayout.js +201 -0
- package/dist/render/textRenderer.d.ts +32 -0
- package/dist/render/textRenderer.js +176 -0
- package/dist/render/thirdPersonCamera.d.ts +272 -0
- package/dist/render/thirdPersonCamera.js +479 -0
- package/dist/render/trample.d.ts +57 -0
- package/dist/render/trample.js +134 -0
- package/dist/render/translucentQueue.d.ts +76 -0
- package/dist/render/translucentQueue.js +90 -0
- package/dist/render/uniformVectorBudget.d.ts +105 -0
- package/dist/render/uniformVectorBudget.js +201 -0
- package/dist/render/uploadStep.d.ts +14 -0
- package/dist/render/uploadStep.js +14 -0
- package/dist/render/vertexDefaults.d.ts +48 -0
- package/dist/render/vertexDefaults.js +111 -0
- package/dist/render/visibility.d.ts +22 -0
- package/dist/render/visibility.js +47 -0
- package/dist/render/waterDraw.d.ts +57 -0
- package/dist/render/waterDraw.js +102 -0
- package/dist/render/waterGrid.d.ts +62 -0
- package/dist/render/waterGrid.js +151 -0
- package/dist/render/waterRenderer.d.ts +163 -0
- package/dist/render/waterRenderer.js +165 -0
- package/dist/render/wind.d.ts +45 -0
- package/dist/render/wind.js +32 -0
- package/dist/render/windField.d.ts +34 -0
- package/dist/render/windField.js +13 -0
- package/dist/render/windStreakDraw.d.ts +73 -0
- package/dist/render/windStreakDraw.js +86 -0
- package/dist/render/windStreakRenderer.d.ts +37 -0
- package/dist/render/windStreakRenderer.js +86 -0
- package/dist/scene/node.d.ts +128 -0
- package/dist/scene/node.js +319 -0
- package/dist/scene/visit.d.ts +38 -0
- package/dist/scene/visit.js +43 -0
- package/dist/ui/clipMime.d.ts +46 -0
- package/dist/ui/clipMime.js +88 -0
- package/dist/ui/exportTarget.d.ts +305 -0
- package/dist/ui/exportTarget.js +368 -0
- package/dist/ui/frameOverlay.d.ts +59 -0
- package/dist/ui/frameOverlay.js +76 -0
- package/dist/ui/framePacer.d.ts +142 -0
- package/dist/ui/framePacer.js +284 -0
- package/dist/ui/frameRecorder.d.ts +188 -0
- package/dist/ui/frameRecorder.js +221 -0
- package/dist/ui/fullscreen.d.ts +72 -0
- package/dist/ui/fullscreen.js +92 -0
- package/dist/ui/pixelCursor.d.ts +28 -0
- package/dist/ui/pixelCursor.js +66 -0
- package/dist/ui/splash.d.ts +86 -0
- package/dist/ui/splash.js +300 -0
- package/dist/ui/stillFrame.d.ts +22 -0
- package/dist/ui/stillFrame.js +40 -0
- package/package.json +60 -0
- package/src/behavior/behaviorTree.ts +346 -0
- package/src/build/shaderComments.ts +0 -0
- package/src/cinematic/player.ts +209 -0
- package/src/cinematic/script.ts +231 -0
- package/src/core/bootGate.ts +49 -0
- package/src/core/loadTracker.ts +144 -0
- package/src/core/loop.ts +211 -0
- package/src/core/messageQueue.ts +145 -0
- package/src/core/onceSet.ts +65 -0
- package/src/core/preferences.ts +177 -0
- package/src/core/remoteSave.ts +347 -0
- package/src/core/rng.ts +101 -0
- package/src/core/stepBudget.ts +136 -0
- package/src/core/storage.ts +114 -0
- package/src/core/tickTrace.ts +129 -0
- package/src/core/timeCurve.ts +175 -0
- package/src/core/withDefaults.ts +28 -0
- package/src/dev/contactProbe.ts +115 -0
- package/src/dev/fpsMeter.ts +101 -0
- package/src/environment/celestialClock.ts +385 -0
- package/src/geometry/decal.ts +260 -0
- package/src/geometry/filmPatch.ts +158 -0
- package/src/geometry/growable.ts +165 -0
- package/src/geometry/lightVolume.ts +161 -0
- package/src/geometry/meshBuilder.ts +1397 -0
- package/src/geometry/pixelFont.ts +189 -0
- package/src/geometry/ribbon.ts +790 -0
- package/src/geometry/shellFill.ts +265 -0
- package/src/geometry/spline.ts +659 -0
- package/src/geometry/tangents.ts +173 -0
- package/src/geometry/textMesh.ts +96 -0
- package/src/geometry/treeBuilder.ts +114 -0
- package/src/host/display.ts +180 -0
- package/src/host/files.ts +77 -0
- package/src/host/lifecycle.ts +63 -0
- package/src/host/platformServices.ts +23 -0
- package/src/host/screen.ts +134 -0
- package/src/index.ts +730 -0
- package/src/input/actionMap.ts +377 -0
- package/src/input/activeDevice.ts +86 -0
- package/src/input/gamepadIdentity.ts +131 -0
- package/src/input/gamepadMapping.ts +121 -0
- package/src/input/input.ts +872 -0
- package/src/input/inputHarness.ts +226 -0
- package/src/input/rightGesture.ts +76 -0
- package/src/input/rumble.ts +138 -0
- package/src/input/touchControls.ts +451 -0
- package/src/input/typingTarget.ts +26 -0
- package/src/math/bounds.ts +153 -0
- package/src/math/color.ts +37 -0
- package/src/math/exact.ts +274 -0
- package/src/math/frustum.ts +115 -0
- package/src/math/intersect.ts +228 -0
- package/src/math/scalar.ts +109 -0
- package/src/math/spring.ts +106 -0
- package/src/nav/navGraph.ts +168 -0
- package/src/nav/navPath.ts +217 -0
- package/src/nav/navSearch.ts +200 -0
- package/src/physics/boxSurface.ts +96 -0
- package/src/physics/colliderSurface.ts +213 -0
- package/src/physics/compositeSurface.ts +111 -0
- package/src/physics/heightSurface.ts +234 -0
- package/src/physics/ribbonSurface.ts +642 -0
- package/src/render/ambientOcclusionPass.ts +200 -0
- package/src/render/areaLights.ts +194 -0
- package/src/render/areaShadowSet.ts +405 -0
- package/src/render/atmosphere.ts +186 -0
- package/src/render/backend/api.ts +802 -0
- package/src/render/backend/budget.ts +139 -0
- package/src/render/backend/createRenderer.ts +343 -0
- package/src/render/backend/deadline.ts +37 -0
- package/src/render/backend/probe.ts +152 -0
- package/src/render/backend/select.ts +288 -0
- package/src/render/backend/timer.ts +59 -0
- package/src/render/backend/webgl2/instanced.ts +46 -0
- package/src/render/backend/webgl2/morphTexture.ts +58 -0
- package/src/render/backend/webgl2/renderer.ts +7484 -0
- package/src/render/backend/webgl2/skinPaletteTexture.ts +70 -0
- package/src/render/backend/webgpu/boltPass.ts +205 -0
- package/src/render/backend/webgpu/buffers.ts +553 -0
- package/src/render/backend/webgpu/causticsPass.ts +174 -0
- package/src/render/backend/webgpu/clusterBinner.ts +259 -0
- package/src/render/backend/webgpu/depthPass.ts +261 -0
- package/src/render/backend/webgpu/device.ts +148 -0
- package/src/render/backend/webgpu/drawCommand.ts +79 -0
- package/src/render/backend/webgpu/environmentTexels.ts +96 -0
- package/src/render/backend/webgpu/filmPass.ts +123 -0
- package/src/render/backend/webgpu/flatPass.ts +635 -0
- package/src/render/backend/webgpu/flockPass.ts +163 -0
- package/src/render/backend/webgpu/gpuTimestamps.ts +255 -0
- package/src/render/backend/webgpu/insetPass.ts +123 -0
- package/src/render/backend/webgpu/instanced.ts +55 -0
- package/src/render/backend/webgpu/lightVolumePass.ts +203 -0
- package/src/render/backend/webgpu/linePass.ts +270 -0
- package/src/render/backend/webgpu/morphTexture.ts +61 -0
- package/src/render/backend/webgpu/panelPass.ts +138 -0
- package/src/render/backend/webgpu/particlePass.ts +370 -0
- package/src/render/backend/webgpu/pipelineCache.ts +152 -0
- package/src/render/backend/webgpu/plumePass.ts +292 -0
- package/src/render/backend/webgpu/pointShadowPass.ts +368 -0
- package/src/render/backend/webgpu/postPass.ts +470 -0
- package/src/render/backend/webgpu/probePass.ts +218 -0
- package/src/render/backend/webgpu/reflectionPass.ts +137 -0
- package/src/render/backend/webgpu/renderer.ts +13004 -0
- package/src/render/backend/webgpu/scatterPass.ts +354 -0
- package/src/render/backend/webgpu/sdfTextPass.ts +220 -0
- package/src/render/backend/webgpu/shaderModules.ts +49 -0
- package/src/render/backend/webgpu/shaders/clusterBin.wgsl.ts +219 -0
- package/src/render/backend/webgpu/skinPaletteRing.ts +105 -0
- package/src/render/backend/webgpu/skinPaletteTexture.ts +79 -0
- package/src/render/backend/webgpu/skyPass.ts +85 -0
- package/src/render/backend/webgpu/surfaceTexturePass.ts +257 -0
- package/src/render/backend/webgpu/textPass.ts +224 -0
- package/src/render/backend/webgpu/uniformRing.ts +228 -0
- package/src/render/backend/webgpu/waterPass.ts +211 -0
- package/src/render/backend/webgpu/windStreakPass.ts +196 -0
- package/src/render/billboard.ts +108 -0
- package/src/render/bloomChain.ts +101 -0
- package/src/render/bloomPass.ts +256 -0
- package/src/render/boltBatch.ts +141 -0
- package/src/render/boltPool.ts +360 -0
- package/src/render/boom.ts +123 -0
- package/src/render/camera.ts +348 -0
- package/src/render/causticsRenderer.ts +171 -0
- package/src/render/cinematicCamera.ts +278 -0
- package/src/render/clusteredLights.ts +598 -0
- package/src/render/colourGrade.ts +109 -0
- package/src/render/compute.ts +83 -0
- package/src/render/contextLoss.ts +50 -0
- package/src/render/debugLines.ts +411 -0
- package/src/render/decalPass.ts +124 -0
- package/src/render/decalProjector.ts +390 -0
- package/src/render/decalQueue.ts +110 -0
- package/src/render/depthConvention.ts +383 -0
- package/src/render/drawingBuffer.ts +89 -0
- package/src/render/emptyTexture.ts +130 -0
- package/src/render/envProbeArray.ts +201 -0
- package/src/render/equirectToCube.ts +160 -0
- package/src/render/flockGeometry.ts +53 -0
- package/src/render/flockRenderer.ts +111 -0
- package/src/render/frame/arena.ts +93 -0
- package/src/render/frame/index.ts +29 -0
- package/src/render/frame/replay.ts +50 -0
- package/src/render/frame/resources.ts +61 -0
- package/src/render/frame/schedule.ts +85 -0
- package/src/render/frameView.ts +20 -0
- package/src/render/gizmo.ts +923 -0
- package/src/render/globalMedium.ts +154 -0
- package/src/render/globalMediumPass.ts +323 -0
- package/src/render/gpuCapability.ts +244 -0
- package/src/render/gpuTimer.ts +182 -0
- package/src/render/halfFloat.ts +39 -0
- package/src/render/handleRegistry.ts +96 -0
- package/src/render/iesProfile.ts +215 -0
- package/src/render/imageTexels.ts +109 -0
- package/src/render/instancedMesh.ts +187 -0
- package/src/render/instances.ts +92 -0
- package/src/render/lightBudget.ts +655 -0
- package/src/render/lightMatrix.ts +69 -0
- package/src/render/lightVolumeDraw.ts +216 -0
- package/src/render/lineBatch.ts +180 -0
- package/src/render/linePoints.ts +61 -0
- package/src/render/livePointShadowSet.ts +285 -0
- package/src/render/lod.ts +86 -0
- package/src/render/mesh.ts +536 -0
- package/src/render/occlusion.ts +406 -0
- package/src/render/oitPass.ts +230 -0
- package/src/render/orderIndependent.ts +136 -0
- package/src/render/particleBatch.ts +299 -0
- package/src/render/particleMaterial.ts +84 -0
- package/src/render/particlePool.ts +291 -0
- package/src/render/pass.ts +203 -0
- package/src/render/passTarget.ts +225 -0
- package/src/render/pickable.ts +222 -0
- package/src/render/planarReflection.ts +233 -0
- package/src/render/planarReflectionDraw.ts +87 -0
- package/src/render/plumeGeometry.ts +75 -0
- package/src/render/plumeMaterial.ts +99 -0
- package/src/render/plumeRenderer.ts +272 -0
- package/src/render/pointLightSelection.ts +447 -0
- package/src/render/pointShadowArray.ts +276 -0
- package/src/render/pointShadowBudget.ts +305 -0
- package/src/render/pointShadowImage.ts +470 -0
- package/src/render/pointShadowMap.ts +228 -0
- package/src/render/pointShadowSystem.ts +408 -0
- package/src/render/prefilterEnvMap.ts +162 -0
- package/src/render/prefilterPass.ts +115 -0
- package/src/render/probeGrid.ts +248 -0
- package/src/render/rainField.ts +240 -0
- package/src/render/reflectionProbe.ts +530 -0
- package/src/render/renderQuality.ts +1054 -0
- package/src/render/rendererHarness.ts +214 -0
- package/src/render/resolutionGovernor.ts +189 -0
- package/src/render/scatterDeform.ts +72 -0
- package/src/render/sceneTarget.ts +1032 -0
- package/src/render/screenSpaceReflection.ts +524 -0
- package/src/render/sdfFont.ts +157 -0
- package/src/render/sdfTextLayout.ts +206 -0
- package/src/render/sdfTextRenderer.ts +233 -0
- package/src/render/seaState.ts +55 -0
- package/src/render/segmentQuads.ts +92 -0
- package/src/render/shader.ts +190 -0
- package/src/render/shaders/ambientOcclusion.ts +354 -0
- package/src/render/shaders/arcane.ts +103 -0
- package/src/render/shaders/bloom.ts +232 -0
- package/src/render/shaders/bolt.ts +164 -0
- package/src/render/shaders/caustics.ts +169 -0
- package/src/render/shaders/conditionals.ts +58 -0
- package/src/render/shaders/decalProject.ts +127 -0
- package/src/render/shaders/depth.ts +131 -0
- package/src/render/shaders/depthOfField.ts +141 -0
- package/src/render/shaders/film.ts +285 -0
- package/src/render/shaders/fire.ts +180 -0
- package/src/render/shaders/flat/directionalShadow.ts +196 -0
- package/src/render/shaders/flat/index.ts +502 -0
- package/src/render/shaders/flat/lobes.ts +399 -0
- package/src/render/shaders/flat/main.ts +1631 -0
- package/src/render/shaders/flat/pointShadow.ts +323 -0
- package/src/render/shaders/flat/preamble.ts +875 -0
- package/src/render/shaders/flat/probeGrid.ts +152 -0
- package/src/render/shaders/flat/surface.ts +41 -0
- package/src/render/shaders/flock.ts +103 -0
- package/src/render/shaders/fog.ts +99 -0
- package/src/render/shaders/fullscreen.ts +28 -0
- package/src/render/shaders/generated/ambientOcclusion.wgsl.ts +74 -0
- package/src/render/shaders/generated/arcane.wgsl.ts +98 -0
- package/src/render/shaders/generated/bloom.wgsl.ts +79 -0
- package/src/render/shaders/generated/bolt.wgsl.ts +127 -0
- package/src/render/shaders/generated/caustics.wgsl.ts +127 -0
- package/src/render/shaders/generated/decalProject.wgsl.ts +69 -0
- package/src/render/shaders/generated/depth.wgsl.ts +142 -0
- package/src/render/shaders/generated/film.wgsl.ts +143 -0
- package/src/render/shaders/generated/fire.wgsl.ts +137 -0
- package/src/render/shaders/generated/flat.wgsl.ts +9195 -0
- package/src/render/shaders/generated/flock.wgsl.ts +82 -0
- package/src/render/shaders/generated/fullscreen.wgsl.ts +20 -0
- package/src/render/shaders/generated/globalMedium.wgsl.ts +139 -0
- package/src/render/shaders/generated/lightVolume.wgsl.ts +242 -0
- package/src/render/shaders/generated/line.wgsl.ts +137 -0
- package/src/render/shaders/generated/octahedralResolve.wgsl.ts +60 -0
- package/src/render/shaders/generated/oitResolve.wgsl.ts +31 -0
- package/src/render/shaders/generated/panel.wgsl.ts +57 -0
- package/src/render/shaders/generated/particle.wgsl.ts +343 -0
- package/src/render/shaders/generated/prefilter.wgsl.ts +69 -0
- package/src/render/shaders/generated/rush.wgsl.ts +139 -0
- package/src/render/shaders/generated/scatter.wgsl.ts +205 -0
- package/src/render/shaders/generated/sdfText.wgsl.ts +78 -0
- package/src/render/shaders/generated/sky.wgsl.ts +109 -0
- package/src/render/shaders/generated/smoke.wgsl.ts +93 -0
- package/src/render/shaders/generated/ssrResolve.wgsl.ts +26 -0
- package/src/render/shaders/generated/ssrTrace.wgsl.ts +94 -0
- package/src/render/shaders/generated/temporalResolve.wgsl.ts +54 -0
- package/src/render/shaders/generated/text.wgsl.ts +107 -0
- package/src/render/shaders/generated/water.wgsl.ts +256 -0
- package/src/render/shaders/generated/windStreaks.wgsl.ts +82 -0
- package/src/render/shaders/gerstner.ts +110 -0
- package/src/render/shaders/globalMedium.ts +396 -0
- package/src/render/shaders/lightVolume.ts +546 -0
- package/src/render/shaders/line.ts +125 -0
- package/src/render/shaders/morph.ts +62 -0
- package/src/render/shaders/octahedral.ts +170 -0
- package/src/render/shaders/octahedralResolve.ts +83 -0
- package/src/render/shaders/oitResolve.ts +42 -0
- package/src/render/shaders/outputTransform.ts +107 -0
- package/src/render/shaders/panel.ts +51 -0
- package/src/render/shaders/particle.ts +438 -0
- package/src/render/shaders/prefilter.ts +278 -0
- package/src/render/shaders/rush.ts +357 -0
- package/src/render/shaders/scatter.ts +211 -0
- package/src/render/shaders/sdfText.ts +68 -0
- package/src/render/shaders/skinning.ts +59 -0
- package/src/render/shaders/sky.ts +243 -0
- package/src/render/shaders/smoke.ts +89 -0
- package/src/render/shaders/ssrResolve.ts +28 -0
- package/src/render/shaders/ssrTrace.ts +233 -0
- package/src/render/shaders/tangentFrame.ts +70 -0
- package/src/render/shaders/temporalResolve.ts +151 -0
- package/src/render/shaders/text.ts +156 -0
- package/src/render/shaders/vertexChannel.ts +71 -0
- package/src/render/shaders/water.ts +356 -0
- package/src/render/shaders/windStreaks.ts +130 -0
- package/src/render/shadowCasters.ts +124 -0
- package/src/render/shadowMap.ts +89 -0
- package/src/render/shotPlacement.ts +266 -0
- package/src/render/skinPalette.ts +157 -0
- package/src/render/ssrPass.ts +241 -0
- package/src/render/surfaceSheet.ts +158 -0
- package/src/render/surfaceTexture.ts +310 -0
- package/src/render/temporalAa.ts +221 -0
- package/src/render/temporalPass.ts +153 -0
- package/src/render/textLayout.ts +239 -0
- package/src/render/textRenderer.ts +201 -0
- package/src/render/thirdPersonCamera.ts +578 -0
- package/src/render/trample.ts +140 -0
- package/src/render/translucentQueue.ts +161 -0
- package/src/render/uniformVectorBudget.ts +246 -0
- package/src/render/uploadStep.ts +14 -0
- package/src/render/vertexDefaults.ts +115 -0
- package/src/render/visibility.ts +56 -0
- package/src/render/waterDraw.ts +167 -0
- package/src/render/waterGrid.ts +180 -0
- package/src/render/waterRenderer.ts +352 -0
- package/src/render/wind.ts +79 -0
- package/src/render/windField.ts +50 -0
- package/src/render/windStreakDraw.ts +131 -0
- package/src/render/windStreakRenderer.ts +130 -0
- package/src/scene/node.ts +336 -0
- package/src/scene/visit.ts +82 -0
- package/src/ui/clipMime.ts +109 -0
- package/src/ui/exportTarget.ts +491 -0
- package/src/ui/frameOverlay.ts +159 -0
- package/src/ui/framePacer.ts +351 -0
- package/src/ui/frameRecorder.ts +333 -0
- package/src/ui/fullscreen.ts +113 -0
- package/src/ui/pixelCursor.ts +99 -0
- package/src/ui/splash.ts +347 -0
- package/src/ui/stillFrame.ts +44 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { FOG_GLSL } from './fog.js';
|
|
2
|
+
import { OUTPUT_TRANSFORM_GLSL } from './outputTransform.js';
|
|
3
|
+
/**
|
|
4
|
+
* A polyline: a flat colour with a clean edge, a real width, and fog.
|
|
5
|
+
*
|
|
6
|
+
* **The plain sibling of `bolt.ts`, and they share a vertex expansion for a reason.** Both
|
|
7
|
+
* turn a segment into a quad that faces the viewer, because a filament has no thickness to
|
|
8
|
+
* see around and a world-fixed cross would make half the segments vanish edge-on. What they
|
|
9
|
+
* do not share is everything after that: an arc is light arriving, so it is additive,
|
|
10
|
+
* unlit, unfogged and allowed past white; a line is a thing in the world, so it is alpha
|
|
11
|
+
* blended, fogged, and its edge is a clean one.
|
|
12
|
+
*
|
|
13
|
+
* **This exists because there is no portable wide line.** WebGL2's `lineWidth` is clamped to
|
|
14
|
+
* one pixel by nearly every driver, and WebGPU has no line width at all. A one-pixel
|
|
15
|
+
* hairline is also the wrong answer on a high-density display, where it reads as a scratch
|
|
16
|
+
* rather than as a stroke. So the only line worth having is a triangle, which is what this
|
|
17
|
+
* draws.
|
|
18
|
+
*/
|
|
19
|
+
export const LINE_VERT = `#version 300 es
|
|
20
|
+
layout(location = 0) in vec3 aFrom;
|
|
21
|
+
layout(location = 1) in vec3 aTo;
|
|
22
|
+
/** Along the segment (0 or 1), and which side of it (-1 or +1). */
|
|
23
|
+
layout(location = 2) in vec2 aCorner;
|
|
24
|
+
|
|
25
|
+
uniform mat4 uViewProj;
|
|
26
|
+
uniform mat4 uModel;
|
|
27
|
+
uniform vec3 uCameraPos;
|
|
28
|
+
/** Half-width in metres, and how much of a pixel a far line must still cover. */
|
|
29
|
+
uniform float uWidth;
|
|
30
|
+
uniform float uMinWidthPerMetre;
|
|
31
|
+
|
|
32
|
+
out float vSide;
|
|
33
|
+
out vec3 vWorldPos;
|
|
34
|
+
|
|
35
|
+
void main() {
|
|
36
|
+
/*
|
|
37
|
+
* Through the model matrix before anything else, unlike an arc, whose endpoints are
|
|
38
|
+
* world-space by nature. A line is usually attached to something that moves, and the
|
|
39
|
+
* alternative is making every caller transform its own points on the CPU each frame.
|
|
40
|
+
*
|
|
41
|
+
* The width is deliberately *not* scaled by the model. A stroke's weight is a property
|
|
42
|
+
* of how it is drawn rather than of the geometry it follows, so a card that shrinks
|
|
43
|
+
* keeps the same line weight, which is what a reader expects and what a designer means.
|
|
44
|
+
*/
|
|
45
|
+
vec3 from = (uModel * vec4(aFrom, 1.0)).xyz;
|
|
46
|
+
vec3 to = (uModel * vec4(aTo, 1.0)).xyz;
|
|
47
|
+
|
|
48
|
+
vec3 mid = mix(from, to, aCorner.x);
|
|
49
|
+
vec3 dir = to - from;
|
|
50
|
+
float len = length(dir);
|
|
51
|
+
dir = len > 1e-6 ? dir / len : vec3(0.0, 1.0, 0.0);
|
|
52
|
+
|
|
53
|
+
vec3 view = mid - uCameraPos;
|
|
54
|
+
float dist = length(view);
|
|
55
|
+
view = dist > 1e-6 ? view / dist : vec3(0.0, 0.0, 1.0);
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* Across the segment and across the line of sight. Degenerate exactly when the segment
|
|
59
|
+
* points at the viewer, where any perpendicular is as good as another, and where the
|
|
60
|
+
* segment covers almost no screen anyway.
|
|
61
|
+
*/
|
|
62
|
+
vec3 across = cross(dir, view);
|
|
63
|
+
float span = length(across);
|
|
64
|
+
across = span > 1e-4 ? across / span : normalize(cross(dir, vec3(0.0, 1.0, 0.0)) + vec3(1e-3));
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* A floor on the world-space width that grows with distance, so a stroke never thins
|
|
68
|
+
* below a pixel. Under a pixel a thin line does not get fainter, it *flickers*, because
|
|
69
|
+
* the rasteriser catches it on some frames and not others.
|
|
70
|
+
*/
|
|
71
|
+
float halfWidth = max(uWidth, dist * uMinWidthPerMetre);
|
|
72
|
+
vec3 world = mid + across * aCorner.y * halfWidth;
|
|
73
|
+
|
|
74
|
+
vSide = aCorner.y;
|
|
75
|
+
vWorldPos = world;
|
|
76
|
+
gl_Position = uViewProj * vec4(world, 1.0);
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
export const LINE_FRAG = `#version 300 es
|
|
80
|
+
precision highp float;
|
|
81
|
+
|
|
82
|
+
in float vSide;
|
|
83
|
+
in vec3 vWorldPos;
|
|
84
|
+
|
|
85
|
+
uniform vec3 uColor;
|
|
86
|
+
uniform float uOpacity;
|
|
87
|
+
uniform vec3 uCameraPos;
|
|
88
|
+
/**
|
|
89
|
+
* How far in from the edge the stroke fades, as a fraction of its half-width. Zero is a
|
|
90
|
+
* clean edge, one is a stroke that is soft all the way to its middle.
|
|
91
|
+
*/
|
|
92
|
+
uniform float uSoftness;
|
|
93
|
+
|
|
94
|
+
${FOG_GLSL}
|
|
95
|
+
|
|
96
|
+
out vec4 outColor;
|
|
97
|
+
${OUTPUT_TRANSFORM_GLSL}
|
|
98
|
+
|
|
99
|
+
void main() {
|
|
100
|
+
/*
|
|
101
|
+
* Coverage across the ribbon: one down the middle, falling to zero at both edges.
|
|
102
|
+
*
|
|
103
|
+
* The band is at least one pixel wide *in screen space*, which is what lets one shader
|
|
104
|
+
* draw a stroke of any width at any distance without either aliasing into a staircase or
|
|
105
|
+
* blurring into a smear. A constant band is tuned for one width and is wrong at the rest,
|
|
106
|
+
* which is the same argument \`SDF_TEXT_FRAG\` makes for the same reason.
|
|
107
|
+
*/
|
|
108
|
+
float edge = 1.0 - abs(vSide);
|
|
109
|
+
float band = max(fwidth(vSide), uSoftness);
|
|
110
|
+
float coverage = smoothstep(0.0, band, edge);
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
* Fogged like geometry, which is where this parts company with \`bolt.ts\`. That shader
|
|
114
|
+
* includes the same helpers and never calls them, because an arc is light arriving
|
|
115
|
+
* rather than a surface losing some of itself to the air on the way over. A drawn line
|
|
116
|
+
* is a thing in the world and recedes like one.
|
|
117
|
+
*/
|
|
118
|
+
float fog = mediumFog(distance(vWorldPos, uCameraPos), vWorldPos.y);
|
|
119
|
+
vec3 color = mix(uColor, mediumColor(), fog);
|
|
120
|
+
outColor = vec4(applyOutputTransform(color), coverage * uOpacity);
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vertex-stage morph prelude: the delta texture, the weights, and their weighted sum.
|
|
3
|
+
*
|
|
4
|
+
* Included by `flat/index.ts` inside `#if MORPHED`, so `resolveConditionals` cuts every line out of
|
|
5
|
+
* the variants that do not morph. **The same mechanism the joint palette established**, and that
|
|
6
|
+
* is why this row was affordable: eleven attribute locations were already spoken for and glTF
|
|
7
|
+
* morph wants up to twenty-four more, so an attribute per target was never going to fit. A vertex
|
|
8
|
+
* data texture has no such budget.
|
|
9
|
+
*
|
|
10
|
+
* Measured, which is what §3.2 of the plan asks for: the second vertex flag takes the shader from
|
|
11
|
+
* two variants to four for **1,674 gzipped bytes**, against 246,925 for one more *fragment* flag.
|
|
12
|
+
* The worry that four diverging variants would dedupe far worse than two was wrong — they cost
|
|
13
|
+
* about half again as much, not an order of magnitude.
|
|
14
|
+
*
|
|
15
|
+
* **Both pre-build estimates came in low, and by a similar factor.** The first flag was estimated
|
|
16
|
+
* at 357 and cost 1,118; this one was estimated at 230 and cost 1,674. Both estimates were made by
|
|
17
|
+
* splicing hand-written WGSL into a duplicated variant, which does not model what naga emits — its
|
|
18
|
+
* temporaries, its entry-point parameters, and the uniform block that grows with the flag. Simulate
|
|
19
|
+
* a permutation to learn its *order of magnitude* and regenerate to learn its cost.
|
|
20
|
+
*
|
|
21
|
+
* **Positions only.** A morph target that also moved normals would need a second delta set and a
|
|
22
|
+
* second fetch per target; what this gives up is correct shading on a strongly morphed surface,
|
|
23
|
+
* which shows as lighting that lags the shape. What would make it wrong is a face rig, where it
|
|
24
|
+
* would be the whole point — the fix is a second texture, not a different mechanism.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MORPH_GLSL = "\n/**\n * Every target's delta for every vertex, interleaved by vertex.\n *\n * A vertex's targets are adjacent because the shader reads all of them for one vertex and nothing\n * reads one target across many vertices \u2014 one cache line rather than `uMorphTargetCount` of them.\n * Wrapped onto rows, because a mesh times its targets passes WebGL2's guaranteed 2048 texels at\n * 256 vertices with eight targets, which is a small mesh.\n */\nuniform highp sampler2D uMorphDeltas;\nuniform float uMorphWeights[8];\nuniform int uMorphTargetCount;\n/** The texture's width, so the shader can turn a texel index into a row and a column. */\nuniform int uMorphTextureWidth;\n\n/**\n * The weighted sum of every active target's delta for this vertex.\n *\n * The loop bound is the compile-time maximum and the *break* is on the uniform, because GLSL ES\n * 3.00 requires a constant bound. A mesh with two targets still costs two iterations rather than\n * eight, which is the point of the break \u2014 and the branch is uniform across the draw, so nothing\n * here falls foul of the 2026-08-07 rule even before the observation that a vertex stage computes\n * no derivatives.\n */\nvec3 morphOffset() {\n vec3 offset = vec3(0.0);\n for (int t = 0; t < 8; t++) {\n if (t >= uMorphTargetCount) break;\n int texel = gl_VertexID * uMorphTargetCount + t;\n ivec2 at = ivec2(texel % uMorphTextureWidth, texel / uMorphTextureWidth);\n offset += texelFetch(uMorphDeltas, at, 0).xyz * uMorphWeights[t];\n }\n return offset;\n}\n";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { MAX_MORPH_TARGETS } from '../skinPalette.js';
|
|
2
|
+
/**
|
|
3
|
+
* The vertex-stage morph prelude: the delta texture, the weights, and their weighted sum.
|
|
4
|
+
*
|
|
5
|
+
* Included by `flat/index.ts` inside `#if MORPHED`, so `resolveConditionals` cuts every line out of
|
|
6
|
+
* the variants that do not morph. **The same mechanism the joint palette established**, and that
|
|
7
|
+
* is why this row was affordable: eleven attribute locations were already spoken for and glTF
|
|
8
|
+
* morph wants up to twenty-four more, so an attribute per target was never going to fit. A vertex
|
|
9
|
+
* data texture has no such budget.
|
|
10
|
+
*
|
|
11
|
+
* Measured, which is what §3.2 of the plan asks for: the second vertex flag takes the shader from
|
|
12
|
+
* two variants to four for **1,674 gzipped bytes**, against 246,925 for one more *fragment* flag.
|
|
13
|
+
* The worry that four diverging variants would dedupe far worse than two was wrong — they cost
|
|
14
|
+
* about half again as much, not an order of magnitude.
|
|
15
|
+
*
|
|
16
|
+
* **Both pre-build estimates came in low, and by a similar factor.** The first flag was estimated
|
|
17
|
+
* at 357 and cost 1,118; this one was estimated at 230 and cost 1,674. Both estimates were made by
|
|
18
|
+
* splicing hand-written WGSL into a duplicated variant, which does not model what naga emits — its
|
|
19
|
+
* temporaries, its entry-point parameters, and the uniform block that grows with the flag. Simulate
|
|
20
|
+
* a permutation to learn its *order of magnitude* and regenerate to learn its cost.
|
|
21
|
+
*
|
|
22
|
+
* **Positions only.** A morph target that also moved normals would need a second delta set and a
|
|
23
|
+
* second fetch per target; what this gives up is correct shading on a strongly morphed surface,
|
|
24
|
+
* which shows as lighting that lags the shape. What would make it wrong is a face rig, where it
|
|
25
|
+
* would be the whole point — the fix is a second texture, not a different mechanism.
|
|
26
|
+
*/
|
|
27
|
+
export const MORPH_GLSL = `
|
|
28
|
+
/**
|
|
29
|
+
* Every target's delta for every vertex, interleaved by vertex.
|
|
30
|
+
*
|
|
31
|
+
* A vertex's targets are adjacent because the shader reads all of them for one vertex and nothing
|
|
32
|
+
* reads one target across many vertices — one cache line rather than \`uMorphTargetCount\` of them.
|
|
33
|
+
* Wrapped onto rows, because a mesh times its targets passes WebGL2's guaranteed 2048 texels at
|
|
34
|
+
* 256 vertices with eight targets, which is a small mesh.
|
|
35
|
+
*/
|
|
36
|
+
uniform highp sampler2D uMorphDeltas;
|
|
37
|
+
uniform float uMorphWeights[${MAX_MORPH_TARGETS}];
|
|
38
|
+
uniform int uMorphTargetCount;
|
|
39
|
+
/** The texture's width, so the shader can turn a texel index into a row and a column. */
|
|
40
|
+
uniform int uMorphTextureWidth;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The weighted sum of every active target's delta for this vertex.
|
|
44
|
+
*
|
|
45
|
+
* The loop bound is the compile-time maximum and the *break* is on the uniform, because GLSL ES
|
|
46
|
+
* 3.00 requires a constant bound. A mesh with two targets still costs two iterations rather than
|
|
47
|
+
* eight, which is the point of the break — and the branch is uniform across the draw, so nothing
|
|
48
|
+
* here falls foul of the 2026-08-07 rule even before the observation that a vertex stage computes
|
|
49
|
+
* no derivatives.
|
|
50
|
+
*/
|
|
51
|
+
vec3 morphOffset() {
|
|
52
|
+
vec3 offset = vec3(0.0);
|
|
53
|
+
for (int t = 0; t < ${MAX_MORPH_TARGETS}; t++) {
|
|
54
|
+
if (t >= uMorphTargetCount) break;
|
|
55
|
+
int texel = gl_VertexID * uMorphTargetCount + t;
|
|
56
|
+
ivec2 at = ivec2(texel % uMorphTextureWidth, texel / uMorphTextureWidth);
|
|
57
|
+
offset += texelFetch(uMorphDeltas, at, 0).xyz * uMorphWeights[t];
|
|
58
|
+
}
|
|
59
|
+
return offset;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { vec2, vec3 } from 'gl-matrix';
|
|
2
|
+
/**
|
|
3
|
+
* Octahedral mapping: a direction to a point on the unit square, and back.
|
|
4
|
+
*
|
|
5
|
+
* **One projection over the whole sphere, which is the entire reason this exists.** A cube map
|
|
6
|
+
* stores six images rasterised under six separate 90 degree projections, and along a shared edge
|
|
7
|
+
* the two disagree by up to a texel of depth — so a filter tap that crosses the edge reads the
|
|
8
|
+
* other projection's answer, the comparison flips along that line, and the line draws as a
|
|
9
|
+
* straight ray from beneath the light. Seven separate reports pointed at those rays, and four
|
|
10
|
+
* attempts at widening the point-shadow filter failed against them. There is no second projection
|
|
11
|
+
* here for a tap to cross.
|
|
12
|
+
*
|
|
13
|
+
* **The algorithm is written twice, in two languages, and they must move together.** The GLSL is
|
|
14
|
+
* what runs, on both backends, since the WGSL is generated from it. The TypeScript exists so that
|
|
15
|
+
* a change to it has a test that needs no device, and `octahedral.test.ts` is that test. Nothing
|
|
16
|
+
* catches a divergence between the two, which is why they are in one file rather than one each.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The chunk both the resolve pass and the lit pass include.
|
|
20
|
+
*
|
|
21
|
+
* **Not `sign()`, anywhere in here.** GLSL's `sign` returns 0 at 0, and a direction with an exact
|
|
22
|
+
* zero component is not a rarity in this engine — it is every axis-aligned wall in every scene it
|
|
23
|
+
* draws. `sign(0.0)` folds such a direction to the origin of the map, which reads as one light's
|
|
24
|
+
* shadow appearing on a surface it does not face. The ternaries below are that fix and are not
|
|
25
|
+
* style; a test asserts this text contains no `sign(` at all.
|
|
26
|
+
*
|
|
27
|
+
* **`octWrapUv` and the two inset helpers exist because a *filtered* octahedral map needs a
|
|
28
|
+
* gutter, and the point-shadow array never did.** That array is one storage level with `NEAREST`
|
|
29
|
+
* on both filters, so no tap ever crosses the map's outer border. A prefiltered environment is
|
|
30
|
+
* `LINEAR` with a mip chain, and there a tap does cross it — into whatever `CLAMP_TO_EDGE` last
|
|
31
|
+
* repeated, which is not the direction on the other side of the fold.
|
|
32
|
+
*
|
|
33
|
+
* The square's border is a fold rather than an edge: the point just past the right border at
|
|
34
|
+
* height `v` is the point just inside it at `1 - v`, and passing through a corner comes back in at
|
|
35
|
+
* the opposite corner, because all four corners are the same pole. Measured before it was written:
|
|
36
|
+
* a gutter texel filled by this rule matches the texel it is folded against to **3.3e-16**, and a
|
|
37
|
+
* border without one is wrong by **4.6e-2** in direction. The corner case is exact to 1.1e-16, and
|
|
38
|
+
* the direction gap across a corner falls linearly with the step, which is what a pole requires.
|
|
39
|
+
*
|
|
40
|
+
* `octInsetUv` and `octInsetDir` are the two ends of that: a sampler maps a direction into the
|
|
41
|
+
* inner `edge - 2` texels, and a generator asks which direction its own texel must hold — which in
|
|
42
|
+
* the gutter is a folded one. They are exact inverses on the interior.
|
|
43
|
+
*/
|
|
44
|
+
export declare const OCTAHEDRAL_GLSL = "vec2 octEncode(vec3 d) {\n vec3 n = d / (abs(d.x) + abs(d.y) + abs(d.z));\n vec2 p = n.z >= 0.0\n ? n.xy\n : (1.0 - abs(vec2(n.y, n.x))) * vec2(n.x >= 0.0 ? 1.0 : -1.0, n.y >= 0.0 ? 1.0 : -1.0);\n return p * 0.5 + 0.5;\n}\n\nvec3 octDecode(vec2 uv) {\n vec2 f = uv * 2.0 - 1.0;\n vec3 n = vec3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));\n float t = max(-n.z, 0.0);\n n.x += n.x >= 0.0 ? -t : t;\n n.y += n.y >= 0.0 ? -t : t;\n return normalize(n);\n}\n\nvec2 octWrapUv(vec2 uv) {\n vec2 f = uv * 2.0 - 1.0;\n if (f.x < -1.0 || f.x > 1.0) {\n f.x = (f.x > 0.0 ? 2.0 : -2.0) - f.x;\n f.y = -f.y;\n }\n if (f.y < -1.0 || f.y > 1.0) {\n f.y = (f.y > 0.0 ? 2.0 : -2.0) - f.y;\n f.x = -f.x;\n }\n return f * 0.5 + 0.5;\n}\n\nvec2 octInsetUv(vec3 d, float edge) {\n return (octEncode(d) * (edge - 2.0) + 1.0) / edge;\n}\n\nvec3 octInsetDir(vec2 uv, float edge) {\n return octDecode(octWrapUv((uv * edge - 1.0) / (edge - 2.0)));\n}";
|
|
45
|
+
/**
|
|
46
|
+
* The GLSL above, in TypeScript, filling a target the caller owns.
|
|
47
|
+
*
|
|
48
|
+
* The direction need not be normalised: the L1 division below normalises it in the only sense this
|
|
49
|
+
* mapping cares about. Fills rather than returns a new vector because the callers that will exist
|
|
50
|
+
* are per-face rather than per-frame, and the rule is cheaper to keep than to reason about.
|
|
51
|
+
*/
|
|
52
|
+
export declare function octEncode(x: number, y: number, z: number, out: vec2): vec2;
|
|
53
|
+
/**
|
|
54
|
+
* A point outside the unit square, folded back to the point of the sphere it names.
|
|
55
|
+
*
|
|
56
|
+
* The GLSL above, in TypeScript, and the identity inside the square — a texel that is not in the
|
|
57
|
+
* gutter must not move, or every map would be resampled by a function meant to touch its border.
|
|
58
|
+
*/
|
|
59
|
+
export declare function octWrapUv(u: number, v: number, out: vec2): vec2;
|
|
60
|
+
/**
|
|
61
|
+
* Where to sample a direction in a map `edge` texels across whose outer ring is a gutter.
|
|
62
|
+
*
|
|
63
|
+
* The inner region is `edge - 2` texels, offset by one, so a direction at the very border of the
|
|
64
|
+
* octahedral square lands on the last real texel and the tap that interpolates past it reads the
|
|
65
|
+
* gutter — which `octInsetDir` filled with the folded direction.
|
|
66
|
+
*/
|
|
67
|
+
export declare function octInsetUv(x: number, y: number, z: number, edge: number, out: vec2): vec2;
|
|
68
|
+
/**
|
|
69
|
+
* The direction one texel of such a map must hold, gutter included.
|
|
70
|
+
*
|
|
71
|
+
* The exact inverse of `octInsetUv` on the interior. In the gutter the un-inset coordinate falls
|
|
72
|
+
* outside the square and the fold answers it, which is the whole point.
|
|
73
|
+
*/
|
|
74
|
+
export declare function octInsetDir(u: number, v: number, edge: number, out: vec3): vec3;
|
|
75
|
+
/** The exact inverse, filling a target the caller owns. Returns a unit vector. */
|
|
76
|
+
export declare function octDecode(u: number, v: number, out: vec3): vec3;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Octahedral mapping: a direction to a point on the unit square, and back.
|
|
3
|
+
*
|
|
4
|
+
* **One projection over the whole sphere, which is the entire reason this exists.** A cube map
|
|
5
|
+
* stores six images rasterised under six separate 90 degree projections, and along a shared edge
|
|
6
|
+
* the two disagree by up to a texel of depth — so a filter tap that crosses the edge reads the
|
|
7
|
+
* other projection's answer, the comparison flips along that line, and the line draws as a
|
|
8
|
+
* straight ray from beneath the light. Seven separate reports pointed at those rays, and four
|
|
9
|
+
* attempts at widening the point-shadow filter failed against them. There is no second projection
|
|
10
|
+
* here for a tap to cross.
|
|
11
|
+
*
|
|
12
|
+
* **The algorithm is written twice, in two languages, and they must move together.** The GLSL is
|
|
13
|
+
* what runs, on both backends, since the WGSL is generated from it. The TypeScript exists so that
|
|
14
|
+
* a change to it has a test that needs no device, and `octahedral.test.ts` is that test. Nothing
|
|
15
|
+
* catches a divergence between the two, which is why they are in one file rather than one each.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The chunk both the resolve pass and the lit pass include.
|
|
19
|
+
*
|
|
20
|
+
* **Not `sign()`, anywhere in here.** GLSL's `sign` returns 0 at 0, and a direction with an exact
|
|
21
|
+
* zero component is not a rarity in this engine — it is every axis-aligned wall in every scene it
|
|
22
|
+
* draws. `sign(0.0)` folds such a direction to the origin of the map, which reads as one light's
|
|
23
|
+
* shadow appearing on a surface it does not face. The ternaries below are that fix and are not
|
|
24
|
+
* style; a test asserts this text contains no `sign(` at all.
|
|
25
|
+
*
|
|
26
|
+
* **`octWrapUv` and the two inset helpers exist because a *filtered* octahedral map needs a
|
|
27
|
+
* gutter, and the point-shadow array never did.** That array is one storage level with `NEAREST`
|
|
28
|
+
* on both filters, so no tap ever crosses the map's outer border. A prefiltered environment is
|
|
29
|
+
* `LINEAR` with a mip chain, and there a tap does cross it — into whatever `CLAMP_TO_EDGE` last
|
|
30
|
+
* repeated, which is not the direction on the other side of the fold.
|
|
31
|
+
*
|
|
32
|
+
* The square's border is a fold rather than an edge: the point just past the right border at
|
|
33
|
+
* height `v` is the point just inside it at `1 - v`, and passing through a corner comes back in at
|
|
34
|
+
* the opposite corner, because all four corners are the same pole. Measured before it was written:
|
|
35
|
+
* a gutter texel filled by this rule matches the texel it is folded against to **3.3e-16**, and a
|
|
36
|
+
* border without one is wrong by **4.6e-2** in direction. The corner case is exact to 1.1e-16, and
|
|
37
|
+
* the direction gap across a corner falls linearly with the step, which is what a pole requires.
|
|
38
|
+
*
|
|
39
|
+
* `octInsetUv` and `octInsetDir` are the two ends of that: a sampler maps a direction into the
|
|
40
|
+
* inner `edge - 2` texels, and a generator asks which direction its own texel must hold — which in
|
|
41
|
+
* the gutter is a folded one. They are exact inverses on the interior.
|
|
42
|
+
*/
|
|
43
|
+
export const OCTAHEDRAL_GLSL = `vec2 octEncode(vec3 d) {
|
|
44
|
+
vec3 n = d / (abs(d.x) + abs(d.y) + abs(d.z));
|
|
45
|
+
vec2 p = n.z >= 0.0
|
|
46
|
+
? n.xy
|
|
47
|
+
: (1.0 - abs(vec2(n.y, n.x))) * vec2(n.x >= 0.0 ? 1.0 : -1.0, n.y >= 0.0 ? 1.0 : -1.0);
|
|
48
|
+
return p * 0.5 + 0.5;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
vec3 octDecode(vec2 uv) {
|
|
52
|
+
vec2 f = uv * 2.0 - 1.0;
|
|
53
|
+
vec3 n = vec3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));
|
|
54
|
+
float t = max(-n.z, 0.0);
|
|
55
|
+
n.x += n.x >= 0.0 ? -t : t;
|
|
56
|
+
n.y += n.y >= 0.0 ? -t : t;
|
|
57
|
+
return normalize(n);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
vec2 octWrapUv(vec2 uv) {
|
|
61
|
+
vec2 f = uv * 2.0 - 1.0;
|
|
62
|
+
if (f.x < -1.0 || f.x > 1.0) {
|
|
63
|
+
f.x = (f.x > 0.0 ? 2.0 : -2.0) - f.x;
|
|
64
|
+
f.y = -f.y;
|
|
65
|
+
}
|
|
66
|
+
if (f.y < -1.0 || f.y > 1.0) {
|
|
67
|
+
f.y = (f.y > 0.0 ? 2.0 : -2.0) - f.y;
|
|
68
|
+
f.x = -f.x;
|
|
69
|
+
}
|
|
70
|
+
return f * 0.5 + 0.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
vec2 octInsetUv(vec3 d, float edge) {
|
|
74
|
+
return (octEncode(d) * (edge - 2.0) + 1.0) / edge;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
vec3 octInsetDir(vec2 uv, float edge) {
|
|
78
|
+
return octDecode(octWrapUv((uv * edge - 1.0) / (edge - 2.0)));
|
|
79
|
+
}`;
|
|
80
|
+
/**
|
|
81
|
+
* The GLSL above, in TypeScript, filling a target the caller owns.
|
|
82
|
+
*
|
|
83
|
+
* The direction need not be normalised: the L1 division below normalises it in the only sense this
|
|
84
|
+
* mapping cares about. Fills rather than returns a new vector because the callers that will exist
|
|
85
|
+
* are per-face rather than per-frame, and the rule is cheaper to keep than to reason about.
|
|
86
|
+
*/
|
|
87
|
+
export function octEncode(x, y, z, out) {
|
|
88
|
+
const l = Math.abs(x) + Math.abs(y) + Math.abs(z);
|
|
89
|
+
const nx = x / l;
|
|
90
|
+
const ny = y / l;
|
|
91
|
+
const nz = z / l;
|
|
92
|
+
let px = nx;
|
|
93
|
+
let py = ny;
|
|
94
|
+
if (nz < 0) {
|
|
95
|
+
px = (1 - Math.abs(ny)) * (nx >= 0 ? 1 : -1);
|
|
96
|
+
py = (1 - Math.abs(nx)) * (ny >= 0 ? 1 : -1);
|
|
97
|
+
}
|
|
98
|
+
out[0] = px * 0.5 + 0.5;
|
|
99
|
+
out[1] = py * 0.5 + 0.5;
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A point outside the unit square, folded back to the point of the sphere it names.
|
|
104
|
+
*
|
|
105
|
+
* The GLSL above, in TypeScript, and the identity inside the square — a texel that is not in the
|
|
106
|
+
* gutter must not move, or every map would be resampled by a function meant to touch its border.
|
|
107
|
+
*/
|
|
108
|
+
export function octWrapUv(u, v, out) {
|
|
109
|
+
let fx = u * 2 - 1;
|
|
110
|
+
let fy = v * 2 - 1;
|
|
111
|
+
if (fx < -1 || fx > 1) {
|
|
112
|
+
fx = (fx > 0 ? 2 : -2) - fx;
|
|
113
|
+
fy = -fy;
|
|
114
|
+
}
|
|
115
|
+
if (fy < -1 || fy > 1) {
|
|
116
|
+
fy = (fy > 0 ? 2 : -2) - fy;
|
|
117
|
+
fx = -fx;
|
|
118
|
+
}
|
|
119
|
+
out[0] = fx * 0.5 + 0.5;
|
|
120
|
+
out[1] = fy * 0.5 + 0.5;
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Where to sample a direction in a map `edge` texels across whose outer ring is a gutter.
|
|
125
|
+
*
|
|
126
|
+
* The inner region is `edge - 2` texels, offset by one, so a direction at the very border of the
|
|
127
|
+
* octahedral square lands on the last real texel and the tap that interpolates past it reads the
|
|
128
|
+
* gutter — which `octInsetDir` filled with the folded direction.
|
|
129
|
+
*/
|
|
130
|
+
export function octInsetUv(x, y, z, edge, out) {
|
|
131
|
+
octEncode(x, y, z, out);
|
|
132
|
+
out[0] = (out[0] * (edge - 2) + 1) / edge;
|
|
133
|
+
out[1] = (out[1] * (edge - 2) + 1) / edge;
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The direction one texel of such a map must hold, gutter included.
|
|
138
|
+
*
|
|
139
|
+
* The exact inverse of `octInsetUv` on the interior. In the gutter the un-inset coordinate falls
|
|
140
|
+
* outside the square and the fold answers it, which is the whole point.
|
|
141
|
+
*/
|
|
142
|
+
export function octInsetDir(u, v, edge, out) {
|
|
143
|
+
const wrapped = octWrapUv((u * edge - 1) / (edge - 2), (v * edge - 1) / (edge - 2), insetScratch);
|
|
144
|
+
return octDecode(wrapped[0], wrapped[1], out);
|
|
145
|
+
}
|
|
146
|
+
/** Reused by `octInsetDir`, which the convolution calls once per texel of every level. */
|
|
147
|
+
const insetScratch = [0, 0];
|
|
148
|
+
/** The exact inverse, filling a target the caller owns. Returns a unit vector. */
|
|
149
|
+
export function octDecode(u, v, out) {
|
|
150
|
+
const fx = u * 2 - 1;
|
|
151
|
+
const fy = v * 2 - 1;
|
|
152
|
+
const nz = 1 - Math.abs(fx) - Math.abs(fy);
|
|
153
|
+
const t = Math.max(-nz, 0);
|
|
154
|
+
const nx = fx + (fx >= 0 ? -t : t);
|
|
155
|
+
const ny = fy + (fy >= 0 ? -t : t);
|
|
156
|
+
const l = Math.hypot(nx, ny, nz);
|
|
157
|
+
out[0] = nx / l;
|
|
158
|
+
out[1] = ny / l;
|
|
159
|
+
out[2] = nz / l;
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fullscreen triangle built from the vertex index, so the pass binds no buffer.
|
|
3
|
+
*
|
|
4
|
+
* Three vertices rather than a quad's six: a quad's diagonal is a seam every fragment on it is
|
|
5
|
+
* rasterised twice across, and this pass writes depth, so twice is not free.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OCTAHEDRAL_RESOLVE_VERT = "#version 300 es\nvoid main() {\n vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));\n gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);\n}";
|
|
8
|
+
/**
|
|
9
|
+
* One cube face into its region of an octahedral map, as linear radial distance.
|
|
10
|
+
*
|
|
11
|
+
* **Every octahedral texel has exactly one dominant axis, so the six regions are disjoint and
|
|
12
|
+
* together cover the map.** That is what makes one scratch texture enough for the whole engine
|
|
13
|
+
* rather than one cube per pool slot: a face is consumed the moment it is resolved, so a bake
|
|
14
|
+
* spread across frames — which is how bakes work here, a couple of faces at a time against
|
|
15
|
+
* `pointShadowBudget.ts` — never needs a second face to still exist.
|
|
16
|
+
*
|
|
17
|
+
* **The perspective decode happens here, once per texel, instead of twelve times per shaded
|
|
18
|
+
* fragment.** What lands in the layer is `radius / far`, linear, which at a far plane of 20 m
|
|
19
|
+
* quantises to about a micrometre in DEPTH_COMPONENT24 against a bias that starts at 4 cm. A cube
|
|
20
|
+
* spends most of its bits near the light instead, which is the wrong end for a shadow.
|
|
21
|
+
*
|
|
22
|
+
* The face index and the sampler are named apart on purpose: two uniforms called `uFace` is a
|
|
23
|
+
* redeclaration and GLSL rejects the whole shader.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OCTAHEDRAL_RESOLVE_FRAG = "#version 300 es\nprecision highp float;\n\n/** The face the bake just rendered, as a depth texture. */\nuniform highp sampler2D uFace;\n/** That face's world-to-face rotation. See pointShadowFaceRotation. */\nuniform mat3 uFaceRotation;\n/** Which of the six this pass is resolving. Every other texel discards. */\nuniform int uFaceIndex;\nuniform float uFar;\nuniform float uNear;\n/** The octahedral map's edge, so this needs no viewport query. */\nuniform float uEdge;\n\nvec2 octEncode(vec3 d) {\n vec3 n = d / (abs(d.x) + abs(d.y) + abs(d.z));\n vec2 p = n.z >= 0.0\n ? n.xy\n : (1.0 - abs(vec2(n.y, n.x))) * vec2(n.x >= 0.0 ? 1.0 : -1.0, n.y >= 0.0 ? 1.0 : -1.0);\n return p * 0.5 + 0.5;\n}\n\nvec3 octDecode(vec2 uv) {\n vec2 f = uv * 2.0 - 1.0;\n vec3 n = vec3(f.x, f.y, 1.0 - abs(f.x) - abs(f.y));\n float t = max(-n.z, 0.0);\n n.x += n.x >= 0.0 ? -t : t;\n n.y += n.y >= 0.0 ? -t : t;\n return normalize(n);\n}\n\nvec2 octWrapUv(vec2 uv) {\n vec2 f = uv * 2.0 - 1.0;\n if (f.x < -1.0 || f.x > 1.0) {\n f.x = (f.x > 0.0 ? 2.0 : -2.0) - f.x;\n f.y = -f.y;\n }\n if (f.y < -1.0 || f.y > 1.0) {\n f.y = (f.y > 0.0 ? 2.0 : -2.0) - f.y;\n f.x = -f.x;\n }\n return f * 0.5 + 0.5;\n}\n\nvec2 octInsetUv(vec3 d, float edge) {\n return (octEncode(d) * (edge - 2.0) + 1.0) / edge;\n}\n\nvec3 octInsetDir(vec2 uv, float edge) {\n return octDecode(octWrapUv((uv * edge - 1.0) / (edge - 2.0)));\n}\n\nvoid main() {\n vec3 d = octDecode(gl_FragCoord.xy / uEdge);\n\n /*\n * Which face owns this texel. The tie-breaking is x, then y, then z, and it has to match the\n * CPU's exactly or a sliver of texels along a boundary belongs to two faces or to none.\n */\n vec3 a = abs(d);\n int face;\n if (a.x >= a.y && a.x >= a.z) face = d.x >= 0.0 ? 0 : 1;\n else if (a.y >= a.z) face = d.y >= 0.0 ? 2 : 3;\n else face = d.z >= 0.0 ? 4 : 5;\n if (face != uFaceIndex) discard;\n\n /* lookAt looks down -z, so a direction inside this face has a negative z here. */\n vec3 v = uFaceRotation * d;\n float forward = -v.z;\n vec2 faceUv = (v.xy / forward) * 0.5 + 0.5;\n\n /*\n * textureLod at level zero rather than plain texture. The scratch carries one storage level and\n * NEAREST filtering so the fetch is identical, and this call sits after a discard \u2014 which is\n * non-uniform control flow, where an implicit derivative is undefined in GLSL and rejected\n * outright in WGSL. AGENTS.md, 2026-08-07.\n */\n float stored = textureLod(uFace, faceUv, 0.0).r;\n if (stored >= 0.9999) {\n /* Nothing was rendered along this direction, so the stored radius is the far plane. */\n gl_FragDepth = 1.0;\n return;\n }\n float ndc = stored * 2.0 - 1.0;\n float faceLocalZ = (2.0 * uFar * uNear) / (uFar + uNear - ndc * (uFar - uNear));\n /* d is a unit vector, so forward is its cosine to the axis and this is the true radius. */\n gl_FragDepth = clamp((faceLocalZ / forward) / uFar, 0.0, 1.0);\n}";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { OCTAHEDRAL_GLSL } from './octahedral.js';
|
|
2
|
+
/**
|
|
3
|
+
* A fullscreen triangle built from the vertex index, so the pass binds no buffer.
|
|
4
|
+
*
|
|
5
|
+
* Three vertices rather than a quad's six: a quad's diagonal is a seam every fragment on it is
|
|
6
|
+
* rasterised twice across, and this pass writes depth, so twice is not free.
|
|
7
|
+
*/
|
|
8
|
+
export const OCTAHEDRAL_RESOLVE_VERT = `#version 300 es
|
|
9
|
+
void main() {
|
|
10
|
+
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
11
|
+
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
12
|
+
}`;
|
|
13
|
+
/**
|
|
14
|
+
* One cube face into its region of an octahedral map, as linear radial distance.
|
|
15
|
+
*
|
|
16
|
+
* **Every octahedral texel has exactly one dominant axis, so the six regions are disjoint and
|
|
17
|
+
* together cover the map.** That is what makes one scratch texture enough for the whole engine
|
|
18
|
+
* rather than one cube per pool slot: a face is consumed the moment it is resolved, so a bake
|
|
19
|
+
* spread across frames — which is how bakes work here, a couple of faces at a time against
|
|
20
|
+
* `pointShadowBudget.ts` — never needs a second face to still exist.
|
|
21
|
+
*
|
|
22
|
+
* **The perspective decode happens here, once per texel, instead of twelve times per shaded
|
|
23
|
+
* fragment.** What lands in the layer is `radius / far`, linear, which at a far plane of 20 m
|
|
24
|
+
* quantises to about a micrometre in DEPTH_COMPONENT24 against a bias that starts at 4 cm. A cube
|
|
25
|
+
* spends most of its bits near the light instead, which is the wrong end for a shadow.
|
|
26
|
+
*
|
|
27
|
+
* The face index and the sampler are named apart on purpose: two uniforms called `uFace` is a
|
|
28
|
+
* redeclaration and GLSL rejects the whole shader.
|
|
29
|
+
*/
|
|
30
|
+
export const OCTAHEDRAL_RESOLVE_FRAG = `#version 300 es
|
|
31
|
+
precision highp float;
|
|
32
|
+
|
|
33
|
+
/** The face the bake just rendered, as a depth texture. */
|
|
34
|
+
uniform highp sampler2D uFace;
|
|
35
|
+
/** That face's world-to-face rotation. See pointShadowFaceRotation. */
|
|
36
|
+
uniform mat3 uFaceRotation;
|
|
37
|
+
/** Which of the six this pass is resolving. Every other texel discards. */
|
|
38
|
+
uniform int uFaceIndex;
|
|
39
|
+
uniform float uFar;
|
|
40
|
+
uniform float uNear;
|
|
41
|
+
/** The octahedral map's edge, so this needs no viewport query. */
|
|
42
|
+
uniform float uEdge;
|
|
43
|
+
|
|
44
|
+
${OCTAHEDRAL_GLSL}
|
|
45
|
+
|
|
46
|
+
void main() {
|
|
47
|
+
vec3 d = octDecode(gl_FragCoord.xy / uEdge);
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Which face owns this texel. The tie-breaking is x, then y, then z, and it has to match the
|
|
51
|
+
* CPU's exactly or a sliver of texels along a boundary belongs to two faces or to none.
|
|
52
|
+
*/
|
|
53
|
+
vec3 a = abs(d);
|
|
54
|
+
int face;
|
|
55
|
+
if (a.x >= a.y && a.x >= a.z) face = d.x >= 0.0 ? 0 : 1;
|
|
56
|
+
else if (a.y >= a.z) face = d.y >= 0.0 ? 2 : 3;
|
|
57
|
+
else face = d.z >= 0.0 ? 4 : 5;
|
|
58
|
+
if (face != uFaceIndex) discard;
|
|
59
|
+
|
|
60
|
+
/* lookAt looks down -z, so a direction inside this face has a negative z here. */
|
|
61
|
+
vec3 v = uFaceRotation * d;
|
|
62
|
+
float forward = -v.z;
|
|
63
|
+
vec2 faceUv = (v.xy / forward) * 0.5 + 0.5;
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* textureLod at level zero rather than plain texture. The scratch carries one storage level and
|
|
67
|
+
* NEAREST filtering so the fetch is identical, and this call sits after a discard — which is
|
|
68
|
+
* non-uniform control flow, where an implicit derivative is undefined in GLSL and rejected
|
|
69
|
+
* outright in WGSL. AGENTS.md, 2026-08-07.
|
|
70
|
+
*/
|
|
71
|
+
float stored = textureLod(uFace, faceUv, 0.0).r;
|
|
72
|
+
if (stored >= 0.9999) {
|
|
73
|
+
/* Nothing was rendered along this direction, so the stored radius is the far plane. */
|
|
74
|
+
gl_FragDepth = 1.0;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
float ndc = stored * 2.0 - 1.0;
|
|
78
|
+
float faceLocalZ = (2.0 * uFar * uNear) / (uFar + uNear - ndc * (uFar - uNear));
|
|
79
|
+
/* d is a unit vector, so forward is its cosine to the axis and this is the true radius. */
|
|
80
|
+
gl_FragDepth = clamp((faceLocalZ / forward) / uFar, 0.0, 1.0);
|
|
81
|
+
}`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The order-independent transparency resolve: two buffers composited over the finished scene.
|
|
3
|
+
*
|
|
4
|
+
* **The accumulation holds a weighted sum and the revealage a product.** Dividing the summed
|
|
5
|
+
* premultiplied colour by the summed weighted alpha gives the average colour the translucent
|
|
6
|
+
* layers make; the revealage says how much of what is behind them still shows through. For a
|
|
7
|
+
* single layer that reduces exactly to ordinary alpha blending, which is the anchor
|
|
8
|
+
* "orderIndependent.ts" asserts against numbers.
|
|
9
|
+
*
|
|
10
|
+
* **The composite is done by the blend state rather than by reading the scene.** Drawn with
|
|
11
|
+
* (ONE_MINUS_SRC_ALPHA, SRC_ALPHA) over the scene target, the hardware computes
|
|
12
|
+
* average * (1 - reveal) + scene * reveal, which is the resolve — so this pass never samples the
|
|
13
|
+
* colour it is compositing onto and cannot be caught reading a target it is also writing.
|
|
14
|
+
*
|
|
15
|
+
* The vertex stage is FULLSCREEN_VERT, shared with the occlusion pass, its blur and the rush.
|
|
16
|
+
*/
|
|
17
|
+
export declare const OIT_RESOLVE_FRAG = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\n\n/** Weighted premultiplied colour in rgb, weighted alpha in a. Cleared to zero. */\nuniform sampler2D uOitAccum;\n/** What every layer let through, as a product. Cleared to one, so an untouched pixel is all scene. */\nuniform sampler2D uOitReveal;\n\nout vec4 fragColor;\n\nvoid main() {\n vec4 accum = textureLod(uOitAccum, vUv, 0.0);\n float reveal = textureLod(uOitReveal, vUv, 0.0).r;\n\n /*\n * Guarded because a pixel no fragment touched has a weighted alpha of zero. Its revealage is\n * then one, so the blend discards whatever this produced anyway \u2014 but a division by zero would\n * put a NaN into the target first, and a NaN blended against anything stays a NaN.\n */\n vec3 average = accum.rgb / max(accum.a, 1e-5);\n\n fragColor = vec4(average, reveal);\n}\n";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The order-independent transparency resolve: two buffers composited over the finished scene.
|
|
3
|
+
*
|
|
4
|
+
* **The accumulation holds a weighted sum and the revealage a product.** Dividing the summed
|
|
5
|
+
* premultiplied colour by the summed weighted alpha gives the average colour the translucent
|
|
6
|
+
* layers make; the revealage says how much of what is behind them still shows through. For a
|
|
7
|
+
* single layer that reduces exactly to ordinary alpha blending, which is the anchor
|
|
8
|
+
* "orderIndependent.ts" asserts against numbers.
|
|
9
|
+
*
|
|
10
|
+
* **The composite is done by the blend state rather than by reading the scene.** Drawn with
|
|
11
|
+
* (ONE_MINUS_SRC_ALPHA, SRC_ALPHA) over the scene target, the hardware computes
|
|
12
|
+
* average * (1 - reveal) + scene * reveal, which is the resolve — so this pass never samples the
|
|
13
|
+
* colour it is compositing onto and cannot be caught reading a target it is also writing.
|
|
14
|
+
*
|
|
15
|
+
* The vertex stage is FULLSCREEN_VERT, shared with the occlusion pass, its blur and the rush.
|
|
16
|
+
*/
|
|
17
|
+
export const OIT_RESOLVE_FRAG = `#version 300 es
|
|
18
|
+
precision highp float;
|
|
19
|
+
|
|
20
|
+
in vec2 vUv;
|
|
21
|
+
|
|
22
|
+
/** Weighted premultiplied colour in rgb, weighted alpha in a. Cleared to zero. */
|
|
23
|
+
uniform sampler2D uOitAccum;
|
|
24
|
+
/** What every layer let through, as a product. Cleared to one, so an untouched pixel is all scene. */
|
|
25
|
+
uniform sampler2D uOitReveal;
|
|
26
|
+
|
|
27
|
+
out vec4 fragColor;
|
|
28
|
+
|
|
29
|
+
void main() {
|
|
30
|
+
vec4 accum = textureLod(uOitAccum, vUv, 0.0);
|
|
31
|
+
float reveal = textureLod(uOitReveal, vUv, 0.0).r;
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* Guarded because a pixel no fragment touched has a weighted alpha of zero. Its revealage is
|
|
35
|
+
* then one, so the blend discards whatever this produced anyway — but a division by zero would
|
|
36
|
+
* put a NaN into the target first, and a NaN blended against anything stays a NaN.
|
|
37
|
+
*/
|
|
38
|
+
vec3 average = accum.rgb / max(accum.a, 1e-5);
|
|
39
|
+
|
|
40
|
+
fragColor = vec4(average, reveal);
|
|
41
|
+
}
|
|
42
|
+
`;
|