@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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-vertex channel's declaration and its wind displacement, authored once for two programs.
|
|
3
|
+
*
|
|
4
|
+
* **Shared source rather than two copies, for the reason `scatter.ts` gives about its own.** The
|
|
5
|
+
* colour pass and the depth pass have to agree *exactly*: a canopy that bends in one and stands
|
|
6
|
+
* still in the other slides its whole shade off the ground it belongs to, and the drift follows
|
|
7
|
+
* the gust, so it never reads as a constant offset anybody could find by looking. One expression,
|
|
8
|
+
* two callers.
|
|
9
|
+
*
|
|
10
|
+
* The lanes are `MeshData.channel`: `.x` sway, `.y` skyDirect, `.z` alpha, `.w` reserved. Only
|
|
11
|
+
* `.x` is read here; the other two are varyings the fragment stage consumes.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The attribute, and the wind the bend below reads.
|
|
16
|
+
*
|
|
17
|
+
* Declared unconditionally in every vertex variant. **No lane is a permutation**: the fragment
|
|
18
|
+
* stage already carries sixteen of those at 282.2 KB gzipped, where the whole vertex stage is
|
|
19
|
+
* 4.1 KB across five, so a `#if` here would buy nothing measurable and cost a variant axis.
|
|
20
|
+
*/
|
|
21
|
+
export const CHANNEL_ATTRIBUTE = `
|
|
22
|
+
layout(location = 13) in vec4 aChannel;
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* The frame's wind, already converted by \`resolveScatterDeform\` — a normalised direction, metres
|
|
26
|
+
* of bend, a gust amplitude and a scaled clock.
|
|
27
|
+
*
|
|
28
|
+
* **The same numbers the scatter batch reads, and that is the rule rather than an economy.** A
|
|
29
|
+
* second conversion here would be a second wind however identical its inputs, and the failure is
|
|
30
|
+
* not localised: it shows up as a scene that does not cohere, a canopy leaning one way while the
|
|
31
|
+
* grass beneath it leans another, with no single element looking wrong. See "One wind, sampled
|
|
32
|
+
* once" in AGENTS.md.
|
|
33
|
+
*/
|
|
34
|
+
uniform vec2 uWindDirection;
|
|
35
|
+
uniform float uWindSpeed;
|
|
36
|
+
uniform float uWindGust;
|
|
37
|
+
uniform float uWindTime;
|
|
38
|
+
/* Spatial frequency of the travelling gust, per metre. */
|
|
39
|
+
uniform vec2 uWindSpatialPhase;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Where the wind puts a vertex, given how much of it that vertex takes.
|
|
44
|
+
*
|
|
45
|
+
* Phase comes from world position, so neighbouring geometry is never in lockstep and a gust
|
|
46
|
+
* visibly travels across a canopy instead of the whole canopy pulsing at once. That is the scatter
|
|
47
|
+
* shader's reasoning and it transfers without change.
|
|
48
|
+
*
|
|
49
|
+
* **The lane scales the bend once, where `scatter.ts` squares its own falloff.** That file derives
|
|
50
|
+
* its falloff from height, and a linear response there slides a whole plant sideways and reads as
|
|
51
|
+
* the ground moving, so it squares to keep the base planted. Here the falloff is *authored* — 0 on
|
|
52
|
+
* a trunk, 1 at a leaf tip — and squaring it would silently overrule a curve somebody had already
|
|
53
|
+
* shaped. What that costs is that a lane filled linearly up a trunk gives a tree that slides at
|
|
54
|
+
* its base; the fix is the curve the author meant, not a square in the shader.
|
|
55
|
+
*
|
|
56
|
+
* The early return is not an optimisation. Geometry that never said it bends must reach exactly
|
|
57
|
+
* the position it reached before this existed, and `sin` of a phase multiplied by zero is not
|
|
58
|
+
* bit-identical to not moving at all.
|
|
59
|
+
*/
|
|
60
|
+
export const CHANNEL_BEND = `
|
|
61
|
+
vec3 channelBend(vec3 worldPos, float sway) {
|
|
62
|
+
if (sway <= 0.0) return worldPos;
|
|
63
|
+
float phase = dot(worldPos.xz, uWindSpatialPhase) + uWindTime;
|
|
64
|
+
float bend = (uWindSpeed + uWindGust) * sin(phase) * sway;
|
|
65
|
+
return vec3(
|
|
66
|
+
worldPos.x + uWindDirection.x * bend,
|
|
67
|
+
worldPos.y,
|
|
68
|
+
worldPos.z + uWindDirection.y * bend
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { MAX_POINT_LIGHTS } from '../lightBudget.ts';
|
|
2
|
+
import { MAX_WATER_REFLECTION_FILTER_TAPS } from '../renderQuality.ts';
|
|
3
|
+
import { GERSTNER_GLSL } from './gerstner.ts';
|
|
4
|
+
import { FOG_GLSL } from './fog.ts';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The sky-ocean, as an actual wave simulation rather than a tinted plane.
|
|
8
|
+
*
|
|
9
|
+
* Four summed Gerstner waves: unlike a sine heightfield, Gerstner displaces
|
|
10
|
+
* vertices *horizontally* toward crests as well as vertically, which is what
|
|
11
|
+
* produces sharp peaks and broad troughs instead of a rolling blanket. Normals
|
|
12
|
+
* come analytically from the same sum, so lighting matches the geometry exactly
|
|
13
|
+
* and needs no derivative tricks.
|
|
14
|
+
*
|
|
15
|
+
* The wave field itself lives in `gerstner.ts` because it is shared: the caustics
|
|
16
|
+
* in `caustics.ts` are the light *this* surface throws onto what covers it, and
|
|
17
|
+
* they must be the same water, not a lookalike animated separately.
|
|
18
|
+
*
|
|
19
|
+
* The grid follows the camera and is snapped to whole cells, giving an endless
|
|
20
|
+
* ocean from a fixed vertex budget without the surface sliding underfoot.
|
|
21
|
+
*/
|
|
22
|
+
export const WATER_VERT = `#version 300 es
|
|
23
|
+
layout(location = 0) in vec2 aGrid;
|
|
24
|
+
|
|
25
|
+
uniform mat4 uViewProj;
|
|
26
|
+
uniform mat4 uReflectionViewProj;
|
|
27
|
+
uniform vec3 uCameraPos;
|
|
28
|
+
uniform float uTime;
|
|
29
|
+
/**
|
|
30
|
+
* Where the sheet is laid, in world XZ.
|
|
31
|
+
*
|
|
32
|
+
* The ocean passes its own camera position snapped to whole cells, which is what
|
|
33
|
+
* gives an endless sea from a fixed vertex budget without the surface sliding
|
|
34
|
+
* underfoot. A *bounded* sheet — a pool in a courtyard — passes the middle of the
|
|
35
|
+
* thing it is filling instead, and is world-fixed by construction.
|
|
36
|
+
*
|
|
37
|
+
* Snapped on the CPU rather than here so that one number is the only difference
|
|
38
|
+
* between an ocean and a basin, and the shader has no idea which it is drawing.
|
|
39
|
+
*/
|
|
40
|
+
uniform vec2 uGridOrigin;
|
|
41
|
+
/**
|
|
42
|
+
* Metres per unit of the sheet's own grid, along each of the body's own axes.
|
|
43
|
+
*
|
|
44
|
+
* One and one for the ocean, whose grid is authored in metres and is two meshes wide.
|
|
45
|
+
* A bounded body — a pool, a tank, a puddle, a channel — is drawn from a unit sheet
|
|
46
|
+
* and scaled by its own half-extents, which is what lets one mesh and one material
|
|
47
|
+
* serve every body of water in the world.
|
|
48
|
+
*
|
|
49
|
+
* **Two numbers and not one since 2026-08-28.** A single span makes every bounded
|
|
50
|
+
* body square, and a square that contains a channel floods the ground either side
|
|
51
|
+
* of it. The ocean passes the same number twice and is bit-identical to what it was.
|
|
52
|
+
*/
|
|
53
|
+
uniform vec2 uGridSpan;
|
|
54
|
+
uniform vec2 uGridHalf;
|
|
55
|
+
uniform vec2 uNearHalf;
|
|
56
|
+
/**
|
|
57
|
+
* The body's own +z, in world XZ, unit length. (0, 1) leaves the sheet unturned.
|
|
58
|
+
*
|
|
59
|
+
* A direction rather than an angle, so nothing here needs a trig call and a consumer
|
|
60
|
+
* bounding a channel can hand over the direction its run already takes. The across
|
|
61
|
+
* axis is world up crossed with this, \`(fz, -fx)\`, which is the basis
|
|
62
|
+
* \`MeshBuilder.addOrientedBox\` builds from a forward vector — one convention for an
|
|
63
|
+
* oriented thing, so a reader who has met one has met both.
|
|
64
|
+
*/
|
|
65
|
+
uniform vec2 uGridForward;
|
|
66
|
+
/** Prevailing wind bearing, normalised. Waves are steered toward it. */
|
|
67
|
+
uniform vec2 uWindDir;
|
|
68
|
+
/** Multiplier on authored steepness — how built-up the sea is. */
|
|
69
|
+
uniform float uWaveGain;
|
|
70
|
+
uniform float uWaterLevel;
|
|
71
|
+
|
|
72
|
+
out vec3 vWorldPos;
|
|
73
|
+
out vec3 vNormal;
|
|
74
|
+
out float vCrest;
|
|
75
|
+
out vec4 vReflectionClip;
|
|
76
|
+
/** Grid-local offset, so the sheet can fade out its own boundary. */
|
|
77
|
+
out vec2 vGrid;
|
|
78
|
+
|
|
79
|
+
${GERSTNER_GLSL}
|
|
80
|
+
|
|
81
|
+
void main() {
|
|
82
|
+
/*
|
|
83
|
+
* Waves must reach nothing by the near sheet's edge, because beyond it lies
|
|
84
|
+
* the flat skirt. A displaced rim meeting an undisplaced skirt would tear the
|
|
85
|
+
* surface open along a visible seam; fading first makes the two meshes agree
|
|
86
|
+
* exactly where they meet. Chebyshev distance, so the fade band follows the
|
|
87
|
+
* rectangular boundary rather than cutting an ellipse inside it.
|
|
88
|
+
*
|
|
89
|
+
* **Measured as a fraction of each axis' own extent**, which is what lets a
|
|
90
|
+
* channel three metres across and twenty-one long fade evenly at both its ends
|
|
91
|
+
* and both its sides. Against one shared extent the narrow axis would be inside
|
|
92
|
+
* the fade band along its whole length and the water would never reach its own
|
|
93
|
+
* bank. For the ocean, whose two extents are equal, this is the same arithmetic
|
|
94
|
+
* with the division moved one step earlier.
|
|
95
|
+
*
|
|
96
|
+
* It is also the honest thing to draw. At a few hundred metres a 1 m swell is
|
|
97
|
+
* well under a pixel, and out on the skirt a float32 phase argument has lost
|
|
98
|
+
* most of its meaningful bits — a calm horizon is what an ocean actually looks
|
|
99
|
+
* like from that far away.
|
|
100
|
+
*/
|
|
101
|
+
vec2 grid = aGrid * uGridSpan;
|
|
102
|
+
/* The same offset the fragment stage fades the rim on, so the two cannot disagree. */
|
|
103
|
+
vGrid = grid;
|
|
104
|
+
vec2 rimFraction = abs(grid) / max(uNearHalf, vec2(1e-4));
|
|
105
|
+
float rimDistance = max(rimFraction.x, rimFraction.y);
|
|
106
|
+
float waveFade = 1.0 - smoothstep(0.35, 0.97, rimDistance);
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* Into the world: across the body, then along it. \`right = up x forward\` is
|
|
110
|
+
* \`(fz, -fx)\`, and getting that pair the wrong way round is a sheet mirrored
|
|
111
|
+
* about its own axis, which on a square is invisible and on a channel is a
|
|
112
|
+
* channel across the road instead of along it.
|
|
113
|
+
*/
|
|
114
|
+
vec2 laid = vec2(uGridForward.y, -uGridForward.x) * grid.x + uGridForward * grid.y;
|
|
115
|
+
|
|
116
|
+
vec3 base = vec3(uGridOrigin.x + laid.x, uWaterLevel, uGridOrigin.y + laid.y);
|
|
117
|
+
|
|
118
|
+
GerstnerSurface sea = gerstnerSurface(base.xz, uTime, uWindDir, waveFade * uWaveGain);
|
|
119
|
+
vec3 pos = base + sea.offset;
|
|
120
|
+
|
|
121
|
+
vWorldPos = pos;
|
|
122
|
+
vNormal = normalize(sea.normal);
|
|
123
|
+
vCrest = sea.crest;
|
|
124
|
+
vReflectionClip = uReflectionViewProj * vec4(pos, 1.0);
|
|
125
|
+
gl_Position = uViewProj * vec4(pos, 1.0);
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
export const WATER_FRAG = `#version 300 es
|
|
130
|
+
precision highp float;
|
|
131
|
+
|
|
132
|
+
in vec3 vWorldPos;
|
|
133
|
+
in vec3 vNormal;
|
|
134
|
+
in float vCrest;
|
|
135
|
+
in vec4 vReflectionClip;
|
|
136
|
+
in vec2 vGrid;
|
|
137
|
+
|
|
138
|
+
uniform vec2 uGridHalf;
|
|
139
|
+
uniform float uFoamGain;
|
|
140
|
+
/**
|
|
141
|
+
* How much of what is beneath it a body of water hides, looked straight down.
|
|
142
|
+
*
|
|
143
|
+
* The *density* of the water rather than a rendering trick: a sea hides its own
|
|
144
|
+
* floor, a fountain shows the tiles at the bottom of it, and a puddle is nearly
|
|
145
|
+
* clear. Only the nadir end is configurable — at a grazing angle every water
|
|
146
|
+
* surface goes reflective, which is Fresnel and not a property of the liquid.
|
|
147
|
+
*/
|
|
148
|
+
uniform float uNadirOpacity;
|
|
149
|
+
/** The whole surface's visibility, 0 to 1. Zero draws nothing at all. */
|
|
150
|
+
uniform float uVisibility;
|
|
151
|
+
/**
|
|
152
|
+
* How much this body mirrors regardless of the angle it is seen at, 0 to 1.
|
|
153
|
+
*
|
|
154
|
+
* Zero is physics: reflection is Fresnel alone, which is right for an ocean seen
|
|
155
|
+
* across its own surface and which means *almost nothing* when you stand over a
|
|
156
|
+
* basin and look down into it — the angle is steep, the Fresnel term is a few
|
|
157
|
+
* percent, and a reflection nobody can see is the same as no reflection: the
|
|
158
|
+
* character's reflection is technically present and far too faint to perceive.
|
|
159
|
+
*
|
|
160
|
+
* So a body may declare itself more mirror than water. It is a lie about optics
|
|
161
|
+
* and an honest one about what a small pool is *for*: you look into it to see
|
|
162
|
+
* something. The sea keeps zero and behaves exactly as it always has.
|
|
163
|
+
*/
|
|
164
|
+
uniform float uMirror;
|
|
165
|
+
uniform vec3 uDeepColor;
|
|
166
|
+
uniform vec3 uShallowColor;
|
|
167
|
+
uniform vec3 uDirectionalDir;
|
|
168
|
+
uniform vec3 uDirectionalColor;
|
|
169
|
+
uniform vec3 uAmbient;
|
|
170
|
+
/**
|
|
171
|
+
* The scene's point lights, which water is entitled to as much as stone is.
|
|
172
|
+
*
|
|
173
|
+
* The surface used to answer to the sun alone, on the reasonable assumption that water
|
|
174
|
+
* is a thing that sits under the sky. It is not: a flooded corridor, a cistern, an
|
|
175
|
+
* indoor pool and a harbour at night are all water lit entirely by lamps, and under
|
|
176
|
+
* those this shaded to flat ambient — a coloured plane, with the specular glitter that
|
|
177
|
+
* is the single strongest cue that a surface *is* water switched off because no
|
|
178
|
+
* directional source existed to make it. A lantern on a jetty threw nothing.
|
|
179
|
+
*
|
|
180
|
+
* Same slots, same weights and the same two falloff shapes as the surface shader, so a
|
|
181
|
+
* lamp behaves the same way over water as it does over the ground beside it.
|
|
182
|
+
*/
|
|
183
|
+
#define MAX_LIGHTS ${MAX_POINT_LIGHTS}
|
|
184
|
+
uniform int uLightCount;
|
|
185
|
+
uniform vec3 uLightPos[MAX_LIGHTS];
|
|
186
|
+
uniform vec3 uLightColor[MAX_LIGHTS];
|
|
187
|
+
uniform float uLightRadius[MAX_LIGHTS];
|
|
188
|
+
uniform float uLightWeight[MAX_LIGHTS];
|
|
189
|
+
uniform int uLightFalloff;
|
|
190
|
+
${FOG_GLSL}
|
|
191
|
+
uniform vec3 uCameraPos;
|
|
192
|
+
uniform sampler2D uReflectionMap;
|
|
193
|
+
uniform int uReflectionEnabled;
|
|
194
|
+
uniform vec2 uReflectionTexelSize;
|
|
195
|
+
uniform int uReflectionFilterTaps;
|
|
196
|
+
|
|
197
|
+
const vec2 REFLECTION_FILTER[${MAX_WATER_REFLECTION_FILTER_TAPS}] = vec2[${MAX_WATER_REFLECTION_FILTER_TAPS}](
|
|
198
|
+
vec2( 0.00, 0.00), vec2(-0.62, -0.31), vec2( 0.54, 0.43),
|
|
199
|
+
vec2(-0.34, 0.76), vec2( 0.78, -0.57), vec2(-0.88, 0.28),
|
|
200
|
+
vec2( 0.22, -0.91), vec2( 0.91, 0.08), vec2(-0.18, 0.94)
|
|
201
|
+
);
|
|
202
|
+
// Preserve small moving silhouettes such as a character while still spreading
|
|
203
|
+
// the surrounding taps enough to make the target read as rough water.
|
|
204
|
+
const float REFLECTION_FILTER_WEIGHT[${MAX_WATER_REFLECTION_FILTER_TAPS}] = float[${MAX_WATER_REFLECTION_FILTER_TAPS}](
|
|
205
|
+
0.28, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
out vec4 outColor;
|
|
209
|
+
|
|
210
|
+
void main() {
|
|
211
|
+
vec3 n = normalize(vNormal);
|
|
212
|
+
vec3 view = normalize(uCameraPos - vWorldPos);
|
|
213
|
+
|
|
214
|
+
// Fresnel: water is nearly a mirror at grazing angles and clear straight down.
|
|
215
|
+
// abs keeps the underside physically continuous with the top instead of
|
|
216
|
+
// turning the entire surface into an opaque mirror below the waterline.
|
|
217
|
+
float facing = clamp(abs(dot(n, view)), 0.0, 1.0);
|
|
218
|
+
float fresnel = 0.02 + 0.98 * pow(1.0 - facing, 5.0);
|
|
219
|
+
|
|
220
|
+
vec3 atmosphereColor = mediumColor();
|
|
221
|
+
|
|
222
|
+
vec3 col = mix(uDeepColor, uShallowColor, clamp(vCrest * 1.4 + 0.4, 0.0, 1.0));
|
|
223
|
+
vec3 incident = uAmbient +
|
|
224
|
+
uDirectionalColor * max(dot(n, uDirectionalDir), 0.0) * 0.6;
|
|
225
|
+
|
|
226
|
+
// Specular glitter along the crests — the strongest single cue that a surface
|
|
227
|
+
// is water rather than a coloured plane.
|
|
228
|
+
vec3 halfVec = normalize(uDirectionalDir + view);
|
|
229
|
+
float spec = pow(max(dot(n, halfVec), 0.0), 220.0);
|
|
230
|
+
vec3 highlight = uDirectionalColor * spec * 1.6;
|
|
231
|
+
|
|
232
|
+
/*
|
|
233
|
+
* And the same from every lamp in range: a light over water lights it, and glitters
|
|
234
|
+
* on it. Indoors this is the whole of the surface's lighting.
|
|
235
|
+
*
|
|
236
|
+
* The exponent is the sun's, so a crest picks a lamp out as tightly as it picks out
|
|
237
|
+
* the sky — which is what makes a strip light read as a *streak* across a pool rather
|
|
238
|
+
* than a broad sheen. Weighted by presence like every other consumer of these slots,
|
|
239
|
+
* so a light entering the set fades in instead of appearing.
|
|
240
|
+
*/
|
|
241
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
242
|
+
if (i >= uLightCount) break;
|
|
243
|
+
vec3 toLight = uLightPos[i] - vWorldPos;
|
|
244
|
+
float lightDist = length(toLight);
|
|
245
|
+
float falloff;
|
|
246
|
+
if (uLightFalloff == 1) {
|
|
247
|
+
float window = clamp(1.0 - pow(lightDist / max(uLightRadius[i], 1e-4), 4.0), 0.0, 1.0);
|
|
248
|
+
falloff = window * window / max(lightDist * lightDist, 0.01);
|
|
249
|
+
} else {
|
|
250
|
+
falloff = clamp(1.0 - lightDist / max(uLightRadius[i], 1e-4), 0.0, 1.0);
|
|
251
|
+
}
|
|
252
|
+
if (falloff <= 0.0) continue;
|
|
253
|
+
vec3 lightDir = toLight / max(lightDist, 1e-4);
|
|
254
|
+
float shaped = falloff * uLightWeight[i];
|
|
255
|
+
incident += uLightColor[i] * max(dot(n, lightDir), 0.0) * shaped * 0.6;
|
|
256
|
+
vec3 lampHalf = normalize(lightDir + view);
|
|
257
|
+
highlight += uLightColor[i] * pow(max(dot(n, lampHalf), 0.0), 220.0) * shaped * 1.6;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
col *= incident;
|
|
261
|
+
col += highlight;
|
|
262
|
+
|
|
263
|
+
// Foam where crests peak — and only when the wind is actually breaking them.
|
|
264
|
+
float foam = smoothstep(0.55, 0.85, vCrest) * uFoamGain;
|
|
265
|
+
col = mix(col, vec3(0.92, 0.96, 1.0), foam * 0.5);
|
|
266
|
+
|
|
267
|
+
float dist = distance(vWorldPos, uCameraPos);
|
|
268
|
+
float fog = mediumFog(dist, vWorldPos.y);
|
|
269
|
+
col = mix(col, atmosphereColor, fog);
|
|
270
|
+
|
|
271
|
+
// Transparency is angle-dependent, like real water: looking down you see
|
|
272
|
+
// straight through to the seabed, at grazing angles it turns reflective.
|
|
273
|
+
// This is computed before reflection because straight-alpha compositing must
|
|
274
|
+
// not attenuate reflected radiance a second time below.
|
|
275
|
+
float airOpacity = mix(uNadirOpacity, 0.96, fresnel);
|
|
276
|
+
float underwaterOpacity = mix(uNadirOpacity * 0.55, 0.88, fresnel);
|
|
277
|
+
float opacity = mix(airOpacity, underwaterOpacity, uUnderwaterFactor);
|
|
278
|
+
opacity = mix(opacity, 0.96, foam * 0.7);
|
|
279
|
+
|
|
280
|
+
// Project the displaced surface into the mirrored camera. The Gerstner
|
|
281
|
+
// displacement supplies broad distortion; the analytic normal adds the
|
|
282
|
+
// smaller ripples that make reflected silhouettes move with each crest.
|
|
283
|
+
vec3 reflected = atmosphereColor;
|
|
284
|
+
float reflectionValid = 0.0;
|
|
285
|
+
if (uReflectionEnabled != 0 && vReflectionClip.w > 0.0) {
|
|
286
|
+
vec2 reflectionUv = vReflectionClip.xy / vReflectionClip.w * 0.5 + 0.5;
|
|
287
|
+
reflectionUv += n.xz * mix(0.008, 0.022, fresnel);
|
|
288
|
+
vec2 border = min(reflectionUv, 1.0 - reflectionUv);
|
|
289
|
+
reflectionValid = smoothstep(0.0, 0.025, min(border.x, border.y));
|
|
290
|
+
// A planar target is optically sharp, which is correct for a mirror but
|
|
291
|
+
// wrong for a moving water surface. Broaden it over a Poisson footprint
|
|
292
|
+
// that grows gently with viewing distance; normal displacement above
|
|
293
|
+
// still makes every crest steer that softened image independently.
|
|
294
|
+
float blurPixels = 1.35 + min(dist * 0.022, 3.5);
|
|
295
|
+
vec3 sceneReflection = vec3(0.0);
|
|
296
|
+
float filterWeight = 0.0;
|
|
297
|
+
for (int i = 0; i < ${MAX_WATER_REFLECTION_FILTER_TAPS}; i++) {
|
|
298
|
+
if (i >= uReflectionFilterTaps) break;
|
|
299
|
+
vec2 sampleUv = reflectionUv +
|
|
300
|
+
REFLECTION_FILTER[i] * uReflectionTexelSize * blurPixels;
|
|
301
|
+
float weight = REFLECTION_FILTER_WEIGHT[i];
|
|
302
|
+
/*
|
|
303
|
+
* \`textureLod\` rather than \`texture\`, by the rule \`AGENTS.md\` records on 2026-08-07:
|
|
304
|
+
* this loop is reached through a branch on \`vReflectionClip\`, which is not uniform, and
|
|
305
|
+
* an implicit derivative there is undefined. **WGSL does not merely leave it undefined,
|
|
306
|
+
* it refuses to compile the module**: *"'textureSample' must only be called from uniform
|
|
307
|
+
* control flow"*, with the note that reading \`vReflectionClip\` may be non-uniform.
|
|
308
|
+
*
|
|
309
|
+
* Bit-identical on WebGL2: \`planarReflection.ts\` allocates one level and filters
|
|
310
|
+
* \`LINEAR\`, so there is no mip to select and level zero is the only thing \`texture\`
|
|
311
|
+
* could have read.
|
|
312
|
+
*/
|
|
313
|
+
sceneReflection +=
|
|
314
|
+
textureLod(uReflectionMap, clamp(sampleUv, 0.0, 1.0), 0.0).rgb * weight;
|
|
315
|
+
filterWeight += weight;
|
|
316
|
+
}
|
|
317
|
+
sceneReflection /= max(filterWeight, 0.001);
|
|
318
|
+
reflected = mix(atmosphereColor, sceneReflection, reflectionValid);
|
|
319
|
+
}
|
|
320
|
+
// The atmosphere-colour fallback preserves the old sky reflection when a
|
|
321
|
+
// quality profile disables the extra scene pass. Foam scatters rather than
|
|
322
|
+
// mirroring, so it masks the reflection at breaking crests.
|
|
323
|
+
float sceneWeight = float(uReflectionEnabled) * reflectionValid;
|
|
324
|
+
float reflectionGain = mix(0.75, 0.94, sceneWeight);
|
|
325
|
+
// Angle-honest by default, and a mirror where a body says so. See uMirror above.
|
|
326
|
+
float reflectivity = mix(fresnel, 1.0, uMirror);
|
|
327
|
+
float reflectedRadiance = min(
|
|
328
|
+
reflectivity * reflectionGain * (1.0 - foam * 0.8),
|
|
329
|
+
opacity
|
|
330
|
+
);
|
|
331
|
+
// With SRC_ALPHA blending, mixing by Fresnel directly would multiply the
|
|
332
|
+
// reflection by opacity again. Divide it out here so the framebuffer gets
|
|
333
|
+
// the intended reflected fraction while the remainder stays transmissive.
|
|
334
|
+
float reflectionWeight = reflectedRadiance / max(opacity, 0.001);
|
|
335
|
+
col = mix(col, reflected, reflectionWeight);
|
|
336
|
+
|
|
337
|
+
/*
|
|
338
|
+
* Dissolve the sheet at its own boundary.
|
|
339
|
+
*
|
|
340
|
+
* Fading on fog alone made the horizon a function of the daily palette: a
|
|
341
|
+
* clear day never reached the threshold, so the grid's rim — corner and all —
|
|
342
|
+
* became the skyline. Fading on the grid coordinate cannot fail that way,
|
|
343
|
+
* because alpha reaches zero at the last row of vertices by construction.
|
|
344
|
+
* Chebyshev distance because the sheet is a rectangle, so the fade band
|
|
345
|
+
* follows its four edges instead of cutting an ellipse out of it — and it is
|
|
346
|
+
* measured per axis, or a channel's narrow sides would be one continuous fade
|
|
347
|
+
* and it would have no visible edge at all.
|
|
348
|
+
*/
|
|
349
|
+
vec2 rimFraction = abs(vGrid) / max(uGridHalf, vec2(0.001));
|
|
350
|
+
float rimT = max(rimFraction.x, rimFraction.y);
|
|
351
|
+
float rim = 1.0 - smoothstep(0.9, 1.0, rimT);
|
|
352
|
+
// Fog still helps where it is thick, it just is no longer load-bearing.
|
|
353
|
+
float edge = 1.0 - smoothstep(0.82, 1.0, fog);
|
|
354
|
+
outColor = vec4(col, opacity * edge * rim * uVisibility);
|
|
355
|
+
}
|
|
356
|
+
`;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visible wind: streaks of dust and debris carried past the camera.
|
|
3
|
+
*
|
|
4
|
+
* Wind you cannot see is a force from nowhere. Once it pushes the player even
|
|
5
|
+
* slightly, it has to be legible — otherwise a drift in the air reads as the
|
|
6
|
+
* controls being imprecise rather than as weather, which is the worst possible
|
|
7
|
+
* reading because it blames the game's feel for something that is deliberate.
|
|
8
|
+
*
|
|
9
|
+
* Entirely GPU-side: particles live on a repeating lattice that follows the
|
|
10
|
+
* camera, so there is no spawning, no pooling, no per-frame CPU work, and no
|
|
11
|
+
* bookkeeping that could disagree with the wind everything else is using.
|
|
12
|
+
*/
|
|
13
|
+
export const WIND_STREAK_VERT = `#version 300 es
|
|
14
|
+
layout(location = 0) in vec2 aCorner;
|
|
15
|
+
layout(location = 1) in float aIndex;
|
|
16
|
+
|
|
17
|
+
uniform mat4 uViewProj;
|
|
18
|
+
uniform vec3 uCameraPos;
|
|
19
|
+
/*
|
|
20
|
+
* No uCameraRight. It was declared here and read nowhere, which GLSL answers by optimising the
|
|
21
|
+
* location away — so the WebGL2 path never bound it and nothing was wrong. A uniform block is
|
|
22
|
+
* laid out whole, though, so the generated WGSL carried sixteen bytes of it at offset 80 and
|
|
23
|
+
* pushed everything after it along, leaving a field in the layout with no writer. That is the
|
|
24
|
+
* shape AGENTS.md 2026-08-13 is about, arriving as dead weight rather than as a bug.
|
|
25
|
+
*/
|
|
26
|
+
uniform vec2 uWind;
|
|
27
|
+
uniform vec2 uDrift;
|
|
28
|
+
uniform float uSpeed;
|
|
29
|
+
uniform float uStrength;
|
|
30
|
+
uniform float uCount;
|
|
31
|
+
uniform float uCellSize;
|
|
32
|
+
uniform float uTime;
|
|
33
|
+
|
|
34
|
+
out float vFade;
|
|
35
|
+
out float vAlong;
|
|
36
|
+
|
|
37
|
+
void main() {
|
|
38
|
+
float id = aIndex;
|
|
39
|
+
float rx = fract(sin(id * 12.9898) * 43758.5453);
|
|
40
|
+
float ry = fract(sin(id * 39.3467) * 24634.6345);
|
|
41
|
+
float rz = fract(sin(id * 78.2330) * 12934.1234);
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Scatter through a box that follows the camera, wrapped so a particle
|
|
45
|
+
* leaving one side re-enters the other. That wrap is what makes a finite
|
|
46
|
+
* count look like endless weather, and why nothing ever needs respawning.
|
|
47
|
+
*/
|
|
48
|
+
/*
|
|
49
|
+
* Biased low. You do not see air — you see what the wind has picked up, and
|
|
50
|
+
* it picks things up from surfaces. Spreading debris evenly through a volume
|
|
51
|
+
* puts streaks at head height in open sky, which is the single thing that
|
|
52
|
+
* makes this read as an effect rather than as weather.
|
|
53
|
+
*/
|
|
54
|
+
float lowBias = ry * ry;
|
|
55
|
+
vec3 cell = vec3(rx * uCellSize, lowBias * uCellSize * 0.42, rz * uCellSize);
|
|
56
|
+
vec3 base = vec3(
|
|
57
|
+
uCameraPos.x + cell.x - uCellSize * 0.5 - uDrift.x,
|
|
58
|
+
uCameraPos.y + cell.y - uCellSize * 0.3,
|
|
59
|
+
uCameraPos.z + cell.z - uCellSize * 0.5 - uDrift.y
|
|
60
|
+
);
|
|
61
|
+
vec3 rel = base - uCameraPos;
|
|
62
|
+
rel.x = mod(rel.x + uCellSize * 0.5, uCellSize) - uCellSize * 0.5;
|
|
63
|
+
rel.z = mod(rel.z + uCellSize * 0.5, uCellSize) - uCellSize * 0.5;
|
|
64
|
+
vec3 centre = uCameraPos + rel;
|
|
65
|
+
|
|
66
|
+
// Streaks lie along the wind and lengthen with it: a smear is how speed
|
|
67
|
+
// reads when the thing moving is too small to resolve.
|
|
68
|
+
vec2 alongXZ = uSpeed > 0.001 ? uWind / uSpeed : vec2(1.0, 0.0);
|
|
69
|
+
vec3 along = vec3(alongXZ.x, 0.0, alongXZ.y);
|
|
70
|
+
vec3 across = normalize(cross(along, vec3(0.0, 1.0, 0.0)));
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Turbulent, not ruled. A dead-straight line is the giveaway that something
|
|
74
|
+
* was drawn rather than blown, so each streak curls on its own slow phase and
|
|
75
|
+
* varies in length — a gust is made of eddies, and eddies are what the eye is
|
|
76
|
+
* actually reading when it decides air is moving.
|
|
77
|
+
*/
|
|
78
|
+
float curl = sin(uTime * 1.7 + id * 2.3) * 0.35 + sin(uTime * 0.9 + id) * 0.2;
|
|
79
|
+
float length = (0.18 + uSpeed * 0.09) * (0.5 + rz);
|
|
80
|
+
vec3 world = centre
|
|
81
|
+
+ along * (aCorner.y * length)
|
|
82
|
+
+ across * (aCorner.x * 0.012 + aCorner.y * curl * length * 0.35);
|
|
83
|
+
|
|
84
|
+
// Fade with distance from the camera so the lattice edge is never a visible
|
|
85
|
+
// boundary, and with strength so a calm day shows nothing at all.
|
|
86
|
+
float dist = distance(centre, uCameraPos);
|
|
87
|
+
/*
|
|
88
|
+
* Three fades, all of which have to hold for a streak to be visible at all:
|
|
89
|
+
* distance, so the lattice edge is never a boundary; a per-streak weight, so
|
|
90
|
+
* they are not a uniform field; and a near fade, because debris a metre from
|
|
91
|
+
* the eye is a smear across the screen rather than a cue.
|
|
92
|
+
*/
|
|
93
|
+
/*
|
|
94
|
+
* Fades spread across the whole volume rather than clipped into a band.
|
|
95
|
+
*
|
|
96
|
+
* Narrow near and far fades carve a spherical shell out of the lattice, and a
|
|
97
|
+
* shell centred on the camera is seen as a curtain hanging in front of the
|
|
98
|
+
* player — every particle at roughly the same distance, moving together. The
|
|
99
|
+
* cure is depth: a long ramp at both ends, so density falls away gradually
|
|
100
|
+
* and no distance is privileged.
|
|
101
|
+
*/
|
|
102
|
+
float far = 1.0 - smoothstep(uCellSize * 0.12, uCellSize * 0.5, dist);
|
|
103
|
+
float near = smoothstep(2.0, 16.0, dist);
|
|
104
|
+
// Most particles are faint; a few carry the effect. A uniform field is a veil.
|
|
105
|
+
float weight = rx * rx * rx;
|
|
106
|
+
vFade = uStrength * far * near * weight;
|
|
107
|
+
vAlong = aCorner.y * 0.5 + 0.5;
|
|
108
|
+
|
|
109
|
+
gl_Position = uViewProj * vec4(world, 1.0);
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
export const WIND_STREAK_FRAG = `#version 300 es
|
|
114
|
+
precision highp float;
|
|
115
|
+
|
|
116
|
+
in float vFade;
|
|
117
|
+
in float vAlong;
|
|
118
|
+
uniform vec3 uTint;
|
|
119
|
+
out vec4 outColor;
|
|
120
|
+
|
|
121
|
+
void main() {
|
|
122
|
+
// Tapered at both ends, so a streak reads as motion rather than as a stick.
|
|
123
|
+
// Squared taper: a streak should be a smear that thins to nothing, not a
|
|
124
|
+
// capsule with visible ends.
|
|
125
|
+
float taper = sin(vAlong * 3.14159);
|
|
126
|
+
float alpha = vFade * taper * taper * 0.13;
|
|
127
|
+
if (alpha <= 0.002) discard;
|
|
128
|
+
outColor = vec4(uTint, alpha);
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ReadonlyMat4 } from 'gl-matrix';
|
|
2
|
+
import type { InstanceData } from './instancedMesh.ts';
|
|
3
|
+
import type { InstancedHandle, MeshHandle, ScatterHandle } from './backend/api.ts';
|
|
4
|
+
import type { MeshInstances } from './instances.ts';
|
|
5
|
+
import type { SurfaceMaterial } from './surfaceTexture.ts';
|
|
6
|
+
import type { SurfaceTextureHandle } from './backend/api.ts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What a shadow-caster enumeration may hand to a depth pass.
|
|
10
|
+
*
|
|
11
|
+
* **Occluding light and stopping a body are two independent properties of a piece
|
|
12
|
+
* of geometry, and this interface exists to keep them apart.** The set that
|
|
13
|
+
* collides is a physics question; the set that casts is an optics one. They overlap
|
|
14
|
+
* heavily — most solid things do both — but neither contains the other, and a
|
|
15
|
+
* renderer that derives one from the other gets a whole class of geometry wrong in
|
|
16
|
+
* one stroke.
|
|
17
|
+
*
|
|
18
|
+
* The failure this was written for: a tree's canopy is deliberately not a collider
|
|
19
|
+
* (nothing should be halted mid-run by leaves) and is therefore not merged into the
|
|
20
|
+
* static world mesh either, because it bends in the wind and merged geometry cannot.
|
|
21
|
+
* The only thing a depth pass could accept was a rigid `Mesh`, so the canopy had no
|
|
22
|
+
* way in — and a crown that occludes nothing reads as sunlight passing straight
|
|
23
|
+
* through several metres of solid foliage. Nothing was switched off; there was
|
|
24
|
+
* simply no route for that kind of geometry to travel.
|
|
25
|
+
*
|
|
26
|
+
* So a sink takes both kinds. A caller enumerates what casts, once, and the same
|
|
27
|
+
* enumeration serves the directional cascade and every point-light cubemap.
|
|
28
|
+
*
|
|
29
|
+
* **Every draw may also carry its material, which is what lets one enumeration serve a colour
|
|
30
|
+
* pass as well as a depth one.** A depth pass ignores it, correctly: a material cannot change a
|
|
31
|
+
* depth, which is why this interface was right to carry only a handle, a matrix and a palette for
|
|
32
|
+
* as long as depth was the only thing replaying it. What that cost was measured from outside. A
|
|
33
|
+
* consumer wanting the scene from a second viewpoint — a mirror, a probe face — had one option,
|
|
34
|
+
* which was to run its whole draw path again; the first attempt to avoid it replayed this sink
|
|
35
|
+
* into the mirror and got **every car unpainted**, because the list carries no material. So the
|
|
36
|
+
* game re-enters its own draw with a mirrored camera, and pays its heaviest phase twice.
|
|
37
|
+
*
|
|
38
|
+
* Optional, and for the reason `instanced` gives at length: this interface is implemented
|
|
39
|
+
* outwards, so a required parameter added in a minor stops every consumer's sink and every test
|
|
40
|
+
* double compiling. A sink that ignores it behaves exactly as it did.
|
|
41
|
+
*/
|
|
42
|
+
export type SceneCasterMaterial = SurfaceMaterial<SurfaceTextureHandle> | null;
|
|
43
|
+
|
|
44
|
+
export interface ShadowCasterSink {
|
|
45
|
+
/** A rigid mesh at a model transform: the world, a prop, a static piece of scenery. */
|
|
46
|
+
mesh(mesh: MeshHandle, model: ReadonlyMat4, material?: SceneCasterMaterial): void;
|
|
47
|
+
/**
|
|
48
|
+
* A skinned mesh, deformed by the same palette the visible draw uses.
|
|
49
|
+
*
|
|
50
|
+
* **The palette is not optional in spirit**, for the reason `scatter` below states about the
|
|
51
|
+
* wind: handing the depth pass a different deformation from the colour pass is how a shadow
|
|
52
|
+
* comes loose from its caster. A skinned character submitted through `mesh` does not drift
|
|
53
|
+
* slightly — it casts its **bind pose**, so a running figure throws the shadow of a statue.
|
|
54
|
+
*
|
|
55
|
+
* Sixteen floats a joint, column-major, exactly as `Skeleton.palette` produces.
|
|
56
|
+
*/
|
|
57
|
+
skinnedMesh(
|
|
58
|
+
mesh: MeshHandle,
|
|
59
|
+
model: ReadonlyMat4,
|
|
60
|
+
palette: Float32Array,
|
|
61
|
+
material?: SceneCasterMaterial,
|
|
62
|
+
): void;
|
|
63
|
+
/**
|
|
64
|
+
* An instanced batch of rigid meshes, placed by the same matrices the visible draw uses.
|
|
65
|
+
*
|
|
66
|
+
* **Not optional in spirit, for the reason `scatter` gives about the wind**: a batch whose
|
|
67
|
+
* depth pass read a different placement casts shadows that have come loose from the things
|
|
68
|
+
* casting them — and a batch submitted through `mesh` instead casts *one* shadow, from
|
|
69
|
+
* whichever matrix happened to be bound, with the other twenty-nine missing entirely.
|
|
70
|
+
*
|
|
71
|
+
* **Optional in the type, and only because this interface is implemented outwards.** A
|
|
72
|
+
* consumer's own sinks and its test doubles satisfy this type, so a required member added in a
|
|
73
|
+
* minor stops every one of them compiling — which is what happened: 3.29.0 broke three test
|
|
74
|
+
* doubles in a consumer that has no instanced batches at all. The renderer always supplies
|
|
75
|
+
* it, so `sink.instanced?.(batch, data)` never actually skips, and a consumer written before
|
|
76
|
+
* instanced draws existed has nothing to declare through it.
|
|
77
|
+
*/
|
|
78
|
+
instanced?(batch: InstancedHandle, data: MeshInstances, material?: SceneCasterMaterial): void;
|
|
79
|
+
/**
|
|
80
|
+
* A scatter batch, deformed exactly as the visible draw deforms it.
|
|
81
|
+
*
|
|
82
|
+
* The wind and press arguments are the same values the matching `drawScatter`
|
|
83
|
+
* receives, and they are not optional in spirit: handing the depth pass a
|
|
84
|
+
* different gust from the colour pass is how a shadow comes loose from its
|
|
85
|
+
* caster. Positional rather than a bundled object, so a per-frame call site
|
|
86
|
+
* allocates nothing.
|
|
87
|
+
*/
|
|
88
|
+
scatter(
|
|
89
|
+
scatter: ScatterHandle,
|
|
90
|
+
data: InstanceData,
|
|
91
|
+
windX: number,
|
|
92
|
+
windZ: number,
|
|
93
|
+
windGust: number,
|
|
94
|
+
timeSeconds: number,
|
|
95
|
+
trample?: Float32Array | null,
|
|
96
|
+
): void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* A caller-supplied enumeration of everything that casts.
|
|
101
|
+
*
|
|
102
|
+
* Called once per directional layer and once per cubemap face, so it must be
|
|
103
|
+
* allocation-free — close over the meshes and read them, never build a list.
|
|
104
|
+
*/
|
|
105
|
+
export type ShadowCasters = (sink: ShadowCasterSink) => void;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Replay a caster enumeration into the colour pass that is open, materials and all.
|
|
109
|
+
*
|
|
110
|
+
* The counterpart of `drawShadowCasters`, and the reason `ShadowCasterSink` carries a material at
|
|
111
|
+
* all. A consumer enumerates what its frame contains once and hands the same closure to the
|
|
112
|
+
* shadow cascade, to every cubemap face, and to a mirror or a probe face — rather than re-entering
|
|
113
|
+
* its own draw path with a second camera, which is what the alternative costs: a consumer
|
|
114
|
+
* measures the phase it would run twice at 2.3 to 9.4 ms, the largest single row in its frame.
|
|
115
|
+
*
|
|
116
|
+
* **Scatter is declined rather than drawn**, and visibly. A scatter batch's colour draw needs the
|
|
117
|
+
* camera and the environment of the frame it is being drawn into, and this enumeration carries
|
|
118
|
+
* neither — it records what a thing *is*, not what the pass around it looks like. Handing the
|
|
119
|
+
* colour path a stale camera would put the grass of the last pass into this one, which is the
|
|
120
|
+
* silent-plausible-picture failure the two-backends rule exists to forbid. So a replayed pass has
|
|
121
|
+
* no scatter in it, the absence is in the picture rather than in a comment, and a caller wanting
|
|
122
|
+
* grass in a mirror draws it itself with the camera it already has.
|
|
123
|
+
*/
|
|
124
|
+
export type SceneCasters = ShadowCasters;
|