@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,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shader modules, built once per source per device.
|
|
3
|
+
*
|
|
4
|
+
* **A module used to be created inside every pipeline descriptor**, which reads as free and is
|
|
5
|
+
* not: `createShaderModule` parses and validates the WGSL, and a descriptor is built on every
|
|
6
|
+
* `PipelineCache` miss. The flat shader is the worst case and the common one. A consumer that
|
|
7
|
+
* creates two dozen meshes gets a pipeline per distinct vertex layout, times a blended twin,
|
|
8
|
+
* times every target the mesh can land on, and each of those parsed the same large source
|
|
9
|
+
* again. On a workstation that is invisible. On a phone it is seconds of the main thread,
|
|
10
|
+
* before a single frame, which is a black and unresponsive page rather than a slow one.
|
|
11
|
+
*
|
|
12
|
+
* Keyed by the source text rather than by the label, because the source is what decides what a
|
|
13
|
+
* module *is* — two passes that compile the same WGSL under different labels want one module,
|
|
14
|
+
* and a label is a debugging string that must never change the object graph. Modules are
|
|
15
|
+
* immutable once created and safe to share between pipelines, which is the whole reason this
|
|
16
|
+
* can be a cache rather than a pool.
|
|
17
|
+
*
|
|
18
|
+
* `WeakMap` on the device, so nothing here outlives the device it belongs to: a lost context
|
|
19
|
+
* builds a new device, which starts empty and cannot be handed a module belonging to the dead
|
|
20
|
+
* one. That also means this needs no `dispose` and no wiring into anybody's teardown.
|
|
21
|
+
*/
|
|
22
|
+
const byDevice = new WeakMap();
|
|
23
|
+
/**
|
|
24
|
+
* The module for this source, compiling it on the first ask only.
|
|
25
|
+
*
|
|
26
|
+
* A drop-in for `device.createShaderModule(descriptor)`, and deliberately the same shape so a
|
|
27
|
+
* call site reads the same after the change as before it.
|
|
28
|
+
*/
|
|
29
|
+
export function shaderModule(device, descriptor) {
|
|
30
|
+
let modules = byDevice.get(device);
|
|
31
|
+
if (modules === undefined) {
|
|
32
|
+
modules = new Map();
|
|
33
|
+
byDevice.set(device, modules);
|
|
34
|
+
}
|
|
35
|
+
const existing = modules.get(descriptor.code);
|
|
36
|
+
if (existing !== undefined)
|
|
37
|
+
return existing;
|
|
38
|
+
const built = device.createShaderModule(descriptor);
|
|
39
|
+
modules.set(descriptor.code, built);
|
|
40
|
+
return built;
|
|
41
|
+
}
|
|
42
|
+
/** How many distinct sources this device has compiled. Read by tests and diagnostics. */
|
|
43
|
+
export function shaderModuleCount(device) {
|
|
44
|
+
return byDevice.get(device)?.size ?? 0;
|
|
45
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The froxel binner, in WGSL, hand-authored.
|
|
3
|
+
*
|
|
4
|
+
* **`npm run wgsl` does not produce this file and `npm run wgsl:check` does not police it.** That
|
|
5
|
+
* is an exception to the standing rule that GLSL is the source of truth, it is written down in
|
|
6
|
+
* `AGENTS.md` under the 2026-08-12 rule, and the argument is in
|
|
7
|
+
* the compute-seam design. In one line: the rule exists so
|
|
8
|
+
* no shader is maintained twice and so a generator defect can only reach the backend that has a
|
|
9
|
+
* fallback, and a compute shader has no twin and no fallback — generating it would invert the very
|
|
10
|
+
* property the rule protects.
|
|
11
|
+
*
|
|
12
|
+
* **Every layout constant is interpolated from `clusteredLights.ts` rather than written here.**
|
|
13
|
+
* Two files agreeing about a stride by both containing the number 8 is the shape of defect this
|
|
14
|
+
* whole feature is gated against; there is one definition and this reads it.
|
|
15
|
+
*
|
|
16
|
+
* **It must produce the same bytes as `buildLightClusters`.** Where the two could have differed
|
|
17
|
+
* they were made to agree deliberately: lights are visited in increasing index so a cluster's list
|
|
18
|
+
* is sorted without sorting, unused slots are written as zero on both sides, and the overflow rule
|
|
19
|
+
* is the same eviction of the farthest from the cluster centre followed by the same ascending
|
|
20
|
+
* sort. `scripts/cluster-check.mjs` is what holds that, and the 2026-08-17 rule about two
|
|
21
|
+
* implementations of one decision is why it exists at all.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CLUSTER_BIN_WGSL = "\nconst CLUSTER_X: u32 = 16u;\nconst CLUSTER_Y: u32 = 9u;\nconst CLUSTER_Z: u32 = 24u;\nconst CLUSTER_COUNT: u32 = 3456u;\nconst CLUSTER_TEXELS: u32 = 5u;\nconst MAX_LIGHTS_PER_CLUSTER: u32 = 16u;\nconst LIGHT_TEXELS: u32 = 5u;\nconst LIGHT_REGION_TEXELS: u32 = 1600u;\nconst TABLE_WIDTH: u32 = 320u;\n\nstruct Params {\n view: mat4x4<f32>,\n /** near, far, tan(fovY/2), aspect. */\n frustum: vec4<f32>,\n lightCount: u32,\n pad0: u32,\n pad1: u32,\n pad2: u32,\n}\n\n@group(0) @binding(0) var<uniform> params: Params;\n/** Three vec4s a light, in exactly the record order `buildLightClusters` writes. */\n@group(0) @binding(1) var<storage, read> lights: array<vec4<f32>>;\n/**\n * Write-only, which is all core WGSL offers and all the fixed-slot layout needs.\n *\n * A read-modify-write list would need a storage buffer and an atomic counter, and it is the reason\n * a cluster owns a fixed run rather than appending into a shared one.\n */\n@group(0) @binding(2) var table: texture_storage_2d<rgba32uint, write>;\n\n/** A flat texel index to its place in the table. TABLE_WIDTH divides both regions exactly. */\nfn texelAt(texel: u32) -> vec2<i32> {\n return vec2<i32>(i32(texel % TABLE_WIDTH), i32(texel / TABLE_WIDTH));\n}\n\nfn sliceNearDepth(slice: f32) -> f32 {\n return params.frustum.x * pow(params.frustum.y / params.frustum.x, slice / f32(CLUSTER_Z));\n}\n\n/** Squared distance from a point to an axis-aligned box, zero inside it. */\nfn distanceSqToBounds(p: vec3<f32>, lo: vec3<f32>, hi: vec3<f32>) -> f32 {\n let d = max(max(lo - p, p - hi), vec3<f32>(0.0));\n return dot(d, d);\n}\n\n/** A light's view-space centre, with depth positive along the view direction. */\nfn viewOf(light: u32) -> vec3<f32> {\n let world = lights[light * LIGHT_TEXELS];\n let v = params.view * vec4<f32>(world.xyz, 1.0);\n return vec3<f32>(v.x, v.y, -v.z);\n}\n\n/**\n * Squared distance from a light's view-space centre to a point.\n *\n * **Squared, matching `centreDistanceSq` in `clusteredLights.ts` rather than taking a root.** The\n * ranking is identical either way, and a square root is one more operation for the two\n * implementations to round differently.\n */\nfn centreDistanceSq(light: u32, centre: vec3<f32>) -> f32 {\n let d = viewOf(light) - centre;\n return dot(d, d);\n}\n\n@compute @workgroup_size(64)\nfn main(@builtin(global_invocation_id) gid: vec3<u32>) {\n let id = gid.x;\n\n /*\n * The light records, written by the first invocations that have one.\n *\n * **Two jobs in one kernel, and it is deliberate.** The records have to reach the same texture\n * the clusters do, because the lit pass reads both through one texture unit; writing them from\n * the CPU instead would mean a partial texture upload racing a dispatch over the same resource.\n * There are always more clusters than lights, so every record has an invocation.\n */\n if (id < params.lightCount) {\n let record = id * LIGHT_TEXELS;\n for (var t: u32 = 0u; t < LIGHT_TEXELS; t = t + 1u) {\n textureStore(table, texelAt(record + t), bitcast<vec4<u32>>(lights[record + t]));\n }\n }\n\n if (id >= CLUSTER_COUNT) {\n return;\n }\n\n let k = id / (CLUSTER_X * CLUSTER_Y);\n let j = (id - k * CLUSTER_X * CLUSTER_Y) / CLUSTER_X;\n let i = id - k * CLUSTER_X * CLUSTER_Y - j * CLUSTER_X;\n\n /* The AABB of the froxel's eight corners, exactly as `clusterViewBounds` derives it. */\n let zNear = sliceNearDepth(f32(k));\n let zFar = sliceNearDepth(f32(k + 1u));\n let xLo = -1.0 + 2.0 * f32(i) / f32(CLUSTER_X);\n let xHi = -1.0 + 2.0 * f32(i + 1u) / f32(CLUSTER_X);\n let yLo = -1.0 + 2.0 * f32(j) / f32(CLUSTER_Y);\n let yHi = -1.0 + 2.0 * f32(j + 1u) / f32(CLUSTER_Y);\n let halfHNear = zNear * params.frustum.z;\n let halfHFar = zFar * params.frustum.z;\n let halfWNear = halfHNear * params.frustum.w;\n let halfWFar = halfHFar * params.frustum.w;\n\n let lo = vec3<f32>(\n min(min(xLo * halfWNear, xLo * halfWFar), min(xHi * halfWNear, xHi * halfWFar)),\n min(min(yLo * halfHNear, yLo * halfHFar), min(yHi * halfHNear, yHi * halfHFar)),\n zNear,\n );\n let hi = vec3<f32>(\n max(max(xLo * halfWNear, xLo * halfWFar), max(xHi * halfWNear, xHi * halfWFar)),\n max(max(yLo * halfHNear, yLo * halfHFar), max(yHi * halfHNear, yHi * halfHFar)),\n zFar,\n );\n let centre = (lo + hi) * 0.5;\n\n var indices: array<u32, MAX_LIGHTS_PER_CLUSTER>;\n for (var n: u32 = 0u; n < MAX_LIGHTS_PER_CLUSTER; n = n + 1u) {\n indices[n] = 0u;\n }\n var count: u32 = 0u;\n\n /* Increasing light index, which is what makes the list sorted without a sort. */\n for (var light: u32 = 0u; light < params.lightCount; light = light + 1u) {\n let radius = lights[light * LIGHT_TEXELS].w;\n let v = viewOf(light);\n if (v.z + radius <= 0.0) {\n continue;\n }\n if (distanceSqToBounds(v, lo, hi) > radius * radius) {\n continue;\n }\n\n if (count < MAX_LIGHTS_PER_CLUSTER) {\n indices[count] = light;\n count = count + 1u;\n continue;\n }\n\n /*\n * Full. Drop the farthest from the cluster's centre if this one is nearer.\n *\n * **The only float comparison that decides anything here**, and the reason the *order* is an\n * integer: a float rank cannot be relied on to agree between this and the JavaScript binner,\n * so it is confined to membership, where the conformance script forgives a light sitting\n * within epsilon of a boundary.\n */\n var worstSlot: i32 = -1;\n var worst = centreDistanceSq(light, centre);\n for (var n: u32 = 0u; n < MAX_LIGHTS_PER_CLUSTER; n = n + 1u) {\n let d = centreDistanceSq(indices[n], centre);\n if (d > worst) {\n worst = d;\n worstSlot = i32(n);\n }\n }\n if (worstSlot < 0) {\n continue;\n }\n indices[u32(worstSlot)] = light;\n\n /* Insertion sort over at most 28 integers, so the bytes stay ascending after a replacement. */\n for (var n: u32 = 1u; n < MAX_LIGHTS_PER_CLUSTER; n = n + 1u) {\n let value = indices[n];\n var m: i32 = i32(n) - 1;\n while (m >= 0 && indices[u32(m)] > value) {\n indices[u32(m) + 1u] = indices[u32(m)];\n m = m - 1;\n }\n indices[u32(m + 1)] = value;\n }\n }\n\n let base = LIGHT_REGION_TEXELS + id * CLUSTER_TEXELS;\n textureStore(table, texelAt(base), vec4<u32>(count, 0u, 0u, 0u));\n for (var t: u32 = 0u; t < CLUSTER_TEXELS - 1u; t = t + 1u) {\n textureStore(\n table,\n texelAt(base + 1u + t),\n vec4<u32>(indices[t * 4u], indices[t * 4u + 1u], indices[t * 4u + 2u], indices[t * 4u + 3u]),\n );\n }\n}\n";
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { CLUSTER_COUNT, CLUSTER_TEXELS, CLUSTER_X, CLUSTER_Y, CLUSTER_Z, LIGHT_REGION_TEXELS, LIGHT_TEXELS, MAX_LIGHTS_PER_CLUSTER, TABLE_WIDTH, } from '../../../clusteredLights.js';
|
|
2
|
+
/**
|
|
3
|
+
* The froxel binner, in WGSL, hand-authored.
|
|
4
|
+
*
|
|
5
|
+
* **`npm run wgsl` does not produce this file and `npm run wgsl:check` does not police it.** That
|
|
6
|
+
* is an exception to the standing rule that GLSL is the source of truth, it is written down in
|
|
7
|
+
* `AGENTS.md` under the 2026-08-12 rule, and the argument is in
|
|
8
|
+
* the compute-seam design. In one line: the rule exists so
|
|
9
|
+
* no shader is maintained twice and so a generator defect can only reach the backend that has a
|
|
10
|
+
* fallback, and a compute shader has no twin and no fallback — generating it would invert the very
|
|
11
|
+
* property the rule protects.
|
|
12
|
+
*
|
|
13
|
+
* **Every layout constant is interpolated from `clusteredLights.ts` rather than written here.**
|
|
14
|
+
* Two files agreeing about a stride by both containing the number 8 is the shape of defect this
|
|
15
|
+
* whole feature is gated against; there is one definition and this reads it.
|
|
16
|
+
*
|
|
17
|
+
* **It must produce the same bytes as `buildLightClusters`.** Where the two could have differed
|
|
18
|
+
* they were made to agree deliberately: lights are visited in increasing index so a cluster's list
|
|
19
|
+
* is sorted without sorting, unused slots are written as zero on both sides, and the overflow rule
|
|
20
|
+
* is the same eviction of the farthest from the cluster centre followed by the same ascending
|
|
21
|
+
* sort. `scripts/cluster-check.mjs` is what holds that, and the 2026-08-17 rule about two
|
|
22
|
+
* implementations of one decision is why it exists at all.
|
|
23
|
+
*/
|
|
24
|
+
export const CLUSTER_BIN_WGSL = `
|
|
25
|
+
const CLUSTER_X: u32 = ${CLUSTER_X}u;
|
|
26
|
+
const CLUSTER_Y: u32 = ${CLUSTER_Y}u;
|
|
27
|
+
const CLUSTER_Z: u32 = ${CLUSTER_Z}u;
|
|
28
|
+
const CLUSTER_COUNT: u32 = ${CLUSTER_COUNT}u;
|
|
29
|
+
const CLUSTER_TEXELS: u32 = ${CLUSTER_TEXELS}u;
|
|
30
|
+
const MAX_LIGHTS_PER_CLUSTER: u32 = ${MAX_LIGHTS_PER_CLUSTER}u;
|
|
31
|
+
const LIGHT_TEXELS: u32 = ${LIGHT_TEXELS}u;
|
|
32
|
+
const LIGHT_REGION_TEXELS: u32 = ${LIGHT_REGION_TEXELS}u;
|
|
33
|
+
const TABLE_WIDTH: u32 = ${TABLE_WIDTH}u;
|
|
34
|
+
|
|
35
|
+
struct Params {
|
|
36
|
+
view: mat4x4<f32>,
|
|
37
|
+
/** near, far, tan(fovY/2), aspect. */
|
|
38
|
+
frustum: vec4<f32>,
|
|
39
|
+
lightCount: u32,
|
|
40
|
+
pad0: u32,
|
|
41
|
+
pad1: u32,
|
|
42
|
+
pad2: u32,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@group(0) @binding(0) var<uniform> params: Params;
|
|
46
|
+
/** Three vec4s a light, in exactly the record order \`buildLightClusters\` writes. */
|
|
47
|
+
@group(0) @binding(1) var<storage, read> lights: array<vec4<f32>>;
|
|
48
|
+
/**
|
|
49
|
+
* Write-only, which is all core WGSL offers and all the fixed-slot layout needs.
|
|
50
|
+
*
|
|
51
|
+
* A read-modify-write list would need a storage buffer and an atomic counter, and it is the reason
|
|
52
|
+
* a cluster owns a fixed run rather than appending into a shared one.
|
|
53
|
+
*/
|
|
54
|
+
@group(0) @binding(2) var table: texture_storage_2d<rgba32uint, write>;
|
|
55
|
+
|
|
56
|
+
/** A flat texel index to its place in the table. TABLE_WIDTH divides both regions exactly. */
|
|
57
|
+
fn texelAt(texel: u32) -> vec2<i32> {
|
|
58
|
+
return vec2<i32>(i32(texel % TABLE_WIDTH), i32(texel / TABLE_WIDTH));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fn sliceNearDepth(slice: f32) -> f32 {
|
|
62
|
+
return params.frustum.x * pow(params.frustum.y / params.frustum.x, slice / f32(CLUSTER_Z));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Squared distance from a point to an axis-aligned box, zero inside it. */
|
|
66
|
+
fn distanceSqToBounds(p: vec3<f32>, lo: vec3<f32>, hi: vec3<f32>) -> f32 {
|
|
67
|
+
let d = max(max(lo - p, p - hi), vec3<f32>(0.0));
|
|
68
|
+
return dot(d, d);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A light's view-space centre, with depth positive along the view direction. */
|
|
72
|
+
fn viewOf(light: u32) -> vec3<f32> {
|
|
73
|
+
let world = lights[light * LIGHT_TEXELS];
|
|
74
|
+
let v = params.view * vec4<f32>(world.xyz, 1.0);
|
|
75
|
+
return vec3<f32>(v.x, v.y, -v.z);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Squared distance from a light's view-space centre to a point.
|
|
80
|
+
*
|
|
81
|
+
* **Squared, matching \`centreDistanceSq\` in \`clusteredLights.ts\` rather than taking a root.** The
|
|
82
|
+
* ranking is identical either way, and a square root is one more operation for the two
|
|
83
|
+
* implementations to round differently.
|
|
84
|
+
*/
|
|
85
|
+
fn centreDistanceSq(light: u32, centre: vec3<f32>) -> f32 {
|
|
86
|
+
let d = viewOf(light) - centre;
|
|
87
|
+
return dot(d, d);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@compute @workgroup_size(64)
|
|
91
|
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
|
92
|
+
let id = gid.x;
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* The light records, written by the first invocations that have one.
|
|
96
|
+
*
|
|
97
|
+
* **Two jobs in one kernel, and it is deliberate.** The records have to reach the same texture
|
|
98
|
+
* the clusters do, because the lit pass reads both through one texture unit; writing them from
|
|
99
|
+
* the CPU instead would mean a partial texture upload racing a dispatch over the same resource.
|
|
100
|
+
* There are always more clusters than lights, so every record has an invocation.
|
|
101
|
+
*/
|
|
102
|
+
if (id < params.lightCount) {
|
|
103
|
+
let record = id * LIGHT_TEXELS;
|
|
104
|
+
for (var t: u32 = 0u; t < LIGHT_TEXELS; t = t + 1u) {
|
|
105
|
+
textureStore(table, texelAt(record + t), bitcast<vec4<u32>>(lights[record + t]));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (id >= CLUSTER_COUNT) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let k = id / (CLUSTER_X * CLUSTER_Y);
|
|
114
|
+
let j = (id - k * CLUSTER_X * CLUSTER_Y) / CLUSTER_X;
|
|
115
|
+
let i = id - k * CLUSTER_X * CLUSTER_Y - j * CLUSTER_X;
|
|
116
|
+
|
|
117
|
+
/* The AABB of the froxel's eight corners, exactly as \`clusterViewBounds\` derives it. */
|
|
118
|
+
let zNear = sliceNearDepth(f32(k));
|
|
119
|
+
let zFar = sliceNearDepth(f32(k + 1u));
|
|
120
|
+
let xLo = -1.0 + 2.0 * f32(i) / f32(CLUSTER_X);
|
|
121
|
+
let xHi = -1.0 + 2.0 * f32(i + 1u) / f32(CLUSTER_X);
|
|
122
|
+
let yLo = -1.0 + 2.0 * f32(j) / f32(CLUSTER_Y);
|
|
123
|
+
let yHi = -1.0 + 2.0 * f32(j + 1u) / f32(CLUSTER_Y);
|
|
124
|
+
let halfHNear = zNear * params.frustum.z;
|
|
125
|
+
let halfHFar = zFar * params.frustum.z;
|
|
126
|
+
let halfWNear = halfHNear * params.frustum.w;
|
|
127
|
+
let halfWFar = halfHFar * params.frustum.w;
|
|
128
|
+
|
|
129
|
+
let lo = vec3<f32>(
|
|
130
|
+
min(min(xLo * halfWNear, xLo * halfWFar), min(xHi * halfWNear, xHi * halfWFar)),
|
|
131
|
+
min(min(yLo * halfHNear, yLo * halfHFar), min(yHi * halfHNear, yHi * halfHFar)),
|
|
132
|
+
zNear,
|
|
133
|
+
);
|
|
134
|
+
let hi = vec3<f32>(
|
|
135
|
+
max(max(xLo * halfWNear, xLo * halfWFar), max(xHi * halfWNear, xHi * halfWFar)),
|
|
136
|
+
max(max(yLo * halfHNear, yLo * halfHFar), max(yHi * halfHNear, yHi * halfHFar)),
|
|
137
|
+
zFar,
|
|
138
|
+
);
|
|
139
|
+
let centre = (lo + hi) * 0.5;
|
|
140
|
+
|
|
141
|
+
var indices: array<u32, MAX_LIGHTS_PER_CLUSTER>;
|
|
142
|
+
for (var n: u32 = 0u; n < MAX_LIGHTS_PER_CLUSTER; n = n + 1u) {
|
|
143
|
+
indices[n] = 0u;
|
|
144
|
+
}
|
|
145
|
+
var count: u32 = 0u;
|
|
146
|
+
|
|
147
|
+
/* Increasing light index, which is what makes the list sorted without a sort. */
|
|
148
|
+
for (var light: u32 = 0u; light < params.lightCount; light = light + 1u) {
|
|
149
|
+
let radius = lights[light * LIGHT_TEXELS].w;
|
|
150
|
+
let v = viewOf(light);
|
|
151
|
+
if (v.z + radius <= 0.0) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (distanceSqToBounds(v, lo, hi) > radius * radius) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (count < MAX_LIGHTS_PER_CLUSTER) {
|
|
159
|
+
indices[count] = light;
|
|
160
|
+
count = count + 1u;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/*
|
|
165
|
+
* Full. Drop the farthest from the cluster's centre if this one is nearer.
|
|
166
|
+
*
|
|
167
|
+
* **The only float comparison that decides anything here**, and the reason the *order* is an
|
|
168
|
+
* integer: a float rank cannot be relied on to agree between this and the JavaScript binner,
|
|
169
|
+
* so it is confined to membership, where the conformance script forgives a light sitting
|
|
170
|
+
* within epsilon of a boundary.
|
|
171
|
+
*/
|
|
172
|
+
var worstSlot: i32 = -1;
|
|
173
|
+
var worst = centreDistanceSq(light, centre);
|
|
174
|
+
for (var n: u32 = 0u; n < MAX_LIGHTS_PER_CLUSTER; n = n + 1u) {
|
|
175
|
+
let d = centreDistanceSq(indices[n], centre);
|
|
176
|
+
if (d > worst) {
|
|
177
|
+
worst = d;
|
|
178
|
+
worstSlot = i32(n);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (worstSlot < 0) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
indices[u32(worstSlot)] = light;
|
|
185
|
+
|
|
186
|
+
/* Insertion sort over at most 28 integers, so the bytes stay ascending after a replacement. */
|
|
187
|
+
for (var n: u32 = 1u; n < MAX_LIGHTS_PER_CLUSTER; n = n + 1u) {
|
|
188
|
+
let value = indices[n];
|
|
189
|
+
var m: i32 = i32(n) - 1;
|
|
190
|
+
while (m >= 0 && indices[u32(m)] > value) {
|
|
191
|
+
indices[u32(m) + 1u] = indices[u32(m)];
|
|
192
|
+
m = m - 1;
|
|
193
|
+
}
|
|
194
|
+
indices[u32(m + 1)] = value;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
let base = LIGHT_REGION_TEXELS + id * CLUSTER_TEXELS;
|
|
199
|
+
textureStore(table, texelAt(base), vec4<u32>(count, 0u, 0u, 0u));
|
|
200
|
+
for (var t: u32 = 0u; t < CLUSTER_TEXELS - 1u; t = t + 1u) {
|
|
201
|
+
textureStore(
|
|
202
|
+
table,
|
|
203
|
+
texelAt(base + 1u + t),
|
|
204
|
+
vec4<u32>(indices[t * 4u], indices[t * 4u + 1u], indices[t * 4u + 2u], indices[t * 4u + 3u]),
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
`;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many palettes one frame may set before the ring is full.
|
|
3
|
+
*
|
|
4
|
+
* The arithmetic rather than a round number: a character's palette is uploaded once per *pass*
|
|
5
|
+
* that draws it, and a full profile draws the same character five times — the main pass, a planar
|
|
6
|
+
* reflection, and the static, peel and dynamic shadow layers. So this is twenty-five characters at
|
|
7
|
+
* once, which is a crowd rather than a cast.
|
|
8
|
+
*
|
|
9
|
+
* **What it costs is nothing until it is used.** A slot allocates its texture on the first frame
|
|
10
|
+
* that reaches it and keeps it, so a scene with two characters holds two: a 24-joint rig is 96
|
|
11
|
+
* texels of `rgba32float`, which is 1.5 KB, and a 96-joint humanoid is 6 KB.
|
|
12
|
+
*
|
|
13
|
+
* **What would make it wrong** is a genuine crowd — a stadium, a swarm of rigged birds — and the
|
|
14
|
+
* fix is then the one `skinPalette.ts` names: one texture holding every palette with a per-draw
|
|
15
|
+
* row offset, which spends a uniform and a shader change to stop spending textures.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MAX_SKIN_PALETTES = 128;
|
|
18
|
+
/**
|
|
19
|
+
* Every joint palette a frame sets, each in its own texture, reused frame after frame.
|
|
20
|
+
*
|
|
21
|
+
* **This exists for the reason `UniformRing` exists, and the fact is the same one.**
|
|
22
|
+
* `queue.writeTexture` does not interleave with draw commands: writes are ordered on the queue
|
|
23
|
+
* timeline and the frame's encoder is submitted *after* all of them, so two palettes uploaded into
|
|
24
|
+
* one texture between two draws give **both** draws the last palette written. Not the first, not a
|
|
25
|
+
* blend — the last, for every skinned draw in the frame.
|
|
26
|
+
*
|
|
27
|
+
* What that looks like is not a skinning bug. Every character in the frame stands in the pose, and
|
|
28
|
+
* at the position, of whichever was drawn last, because a rig carries its placement in its palette
|
|
29
|
+
* rather than in `uModel`. Measured in the product: a game drawing a ghost of an earlier run and
|
|
30
|
+
* then the live character drew the ghost with the *character's* palette, so a translucent second body sat
|
|
31
|
+
* exactly on top of the player and read as a transparency fault.
|
|
32
|
+
*
|
|
33
|
+
* **The other backend needs none of this and that is not an asymmetry of decision.** WebGL2's
|
|
34
|
+
* `texSubImage2D` is a command in the same stream as the draws around it, so an upload between two
|
|
35
|
+
* draws separates them there by construction. The decision — a palette belongs to a draw — is one;
|
|
36
|
+
* only what it takes to honour it differs, which is what `skinPalette.ts` says a binder is for.
|
|
37
|
+
*
|
|
38
|
+
* **A slot is written at most once per frame**, since every `setSkinPalette` takes a fresh one.
|
|
39
|
+
* That is what makes the reallocation inside `SkinPaletteTexture` safe: a joint count can only
|
|
40
|
+
* change a slot's texture between frames, never while a recorded draw is still pointing at it.
|
|
41
|
+
*/
|
|
42
|
+
export declare class SkinPaletteRing {
|
|
43
|
+
private readonly slots;
|
|
44
|
+
private used;
|
|
45
|
+
private warnedFull;
|
|
46
|
+
/** How many slots this frame has taken. */
|
|
47
|
+
get count(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Start a frame: every slot is free again.
|
|
50
|
+
*
|
|
51
|
+
* **Called where the frame's encoder is replaced and not a line earlier.** A slot may only be
|
|
52
|
+
* re-let once the draws pointing at it have been submitted, which is exactly what `beginFrame`
|
|
53
|
+
* has just done — including for anything drawn after the previous `endFrame`.
|
|
54
|
+
*/
|
|
55
|
+
reset(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Upload a palette into a slot of its own and return that slot, or null when the ring is full.
|
|
58
|
+
*
|
|
59
|
+
* **Null rather than reusing a slot**, because reusing one is the defect this class is named
|
|
60
|
+
* after: the caller's character would silently take another character's pose. A caller that runs
|
|
61
|
+
* out declines the draw and says so once.
|
|
62
|
+
*/
|
|
63
|
+
take(device: GPUDevice, palette: Float32Array): number | null;
|
|
64
|
+
/** The view a draw binds for a slot, or null for a slot nothing has uploaded into. */
|
|
65
|
+
view(slot: number): GPUTextureView | null;
|
|
66
|
+
dispose(): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { SkinPaletteTexture } from './skinPaletteTexture.js';
|
|
2
|
+
/**
|
|
3
|
+
* How many palettes one frame may set before the ring is full.
|
|
4
|
+
*
|
|
5
|
+
* The arithmetic rather than a round number: a character's palette is uploaded once per *pass*
|
|
6
|
+
* that draws it, and a full profile draws the same character five times — the main pass, a planar
|
|
7
|
+
* reflection, and the static, peel and dynamic shadow layers. So this is twenty-five characters at
|
|
8
|
+
* once, which is a crowd rather than a cast.
|
|
9
|
+
*
|
|
10
|
+
* **What it costs is nothing until it is used.** A slot allocates its texture on the first frame
|
|
11
|
+
* that reaches it and keeps it, so a scene with two characters holds two: a 24-joint rig is 96
|
|
12
|
+
* texels of `rgba32float`, which is 1.5 KB, and a 96-joint humanoid is 6 KB.
|
|
13
|
+
*
|
|
14
|
+
* **What would make it wrong** is a genuine crowd — a stadium, a swarm of rigged birds — and the
|
|
15
|
+
* fix is then the one `skinPalette.ts` names: one texture holding every palette with a per-draw
|
|
16
|
+
* row offset, which spends a uniform and a shader change to stop spending textures.
|
|
17
|
+
*/
|
|
18
|
+
export const MAX_SKIN_PALETTES = 128;
|
|
19
|
+
/**
|
|
20
|
+
* Every joint palette a frame sets, each in its own texture, reused frame after frame.
|
|
21
|
+
*
|
|
22
|
+
* **This exists for the reason `UniformRing` exists, and the fact is the same one.**
|
|
23
|
+
* `queue.writeTexture` does not interleave with draw commands: writes are ordered on the queue
|
|
24
|
+
* timeline and the frame's encoder is submitted *after* all of them, so two palettes uploaded into
|
|
25
|
+
* one texture between two draws give **both** draws the last palette written. Not the first, not a
|
|
26
|
+
* blend — the last, for every skinned draw in the frame.
|
|
27
|
+
*
|
|
28
|
+
* What that looks like is not a skinning bug. Every character in the frame stands in the pose, and
|
|
29
|
+
* at the position, of whichever was drawn last, because a rig carries its placement in its palette
|
|
30
|
+
* rather than in `uModel`. Measured in the product: a game drawing a ghost of an earlier run and
|
|
31
|
+
* then the live character drew the ghost with the *character's* palette, so a translucent second body sat
|
|
32
|
+
* exactly on top of the player and read as a transparency fault.
|
|
33
|
+
*
|
|
34
|
+
* **The other backend needs none of this and that is not an asymmetry of decision.** WebGL2's
|
|
35
|
+
* `texSubImage2D` is a command in the same stream as the draws around it, so an upload between two
|
|
36
|
+
* draws separates them there by construction. The decision — a palette belongs to a draw — is one;
|
|
37
|
+
* only what it takes to honour it differs, which is what `skinPalette.ts` says a binder is for.
|
|
38
|
+
*
|
|
39
|
+
* **A slot is written at most once per frame**, since every `setSkinPalette` takes a fresh one.
|
|
40
|
+
* That is what makes the reallocation inside `SkinPaletteTexture` safe: a joint count can only
|
|
41
|
+
* change a slot's texture between frames, never while a recorded draw is still pointing at it.
|
|
42
|
+
*/
|
|
43
|
+
export class SkinPaletteRing {
|
|
44
|
+
slots = [];
|
|
45
|
+
used = 0;
|
|
46
|
+
warnedFull = false;
|
|
47
|
+
/** How many slots this frame has taken. */
|
|
48
|
+
get count() {
|
|
49
|
+
return this.used;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Start a frame: every slot is free again.
|
|
53
|
+
*
|
|
54
|
+
* **Called where the frame's encoder is replaced and not a line earlier.** A slot may only be
|
|
55
|
+
* re-let once the draws pointing at it have been submitted, which is exactly what `beginFrame`
|
|
56
|
+
* has just done — including for anything drawn after the previous `endFrame`.
|
|
57
|
+
*/
|
|
58
|
+
reset() {
|
|
59
|
+
this.used = 0;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Upload a palette into a slot of its own and return that slot, or null when the ring is full.
|
|
63
|
+
*
|
|
64
|
+
* **Null rather than reusing a slot**, because reusing one is the defect this class is named
|
|
65
|
+
* after: the caller's character would silently take another character's pose. A caller that runs
|
|
66
|
+
* out declines the draw and says so once.
|
|
67
|
+
*/
|
|
68
|
+
take(device, palette) {
|
|
69
|
+
if (this.used >= MAX_SKIN_PALETTES) {
|
|
70
|
+
if (!this.warnedFull) {
|
|
71
|
+
this.warnedFull = true;
|
|
72
|
+
console.warn(`WebGPU: more than ${MAX_SKIN_PALETTES} skin palettes in one frame; the rest of the ` +
|
|
73
|
+
'skinned draws are declined this frame rather than drawn in another rig’s pose. ' +
|
|
74
|
+
'See MAX_SKIN_PALETTES.');
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const at = this.used++;
|
|
79
|
+
let slot = this.slots[at];
|
|
80
|
+
if (slot === undefined) {
|
|
81
|
+
slot = new SkinPaletteTexture();
|
|
82
|
+
this.slots[at] = slot;
|
|
83
|
+
}
|
|
84
|
+
slot.update(device, palette);
|
|
85
|
+
return at;
|
|
86
|
+
}
|
|
87
|
+
/** The view a draw binds for a slot, or null for a slot nothing has uploaded into. */
|
|
88
|
+
view(slot) {
|
|
89
|
+
return this.slots[slot]?.view() ?? null;
|
|
90
|
+
}
|
|
91
|
+
dispose() {
|
|
92
|
+
for (const slot of this.slots)
|
|
93
|
+
slot.dispose();
|
|
94
|
+
this.slots.length = 0;
|
|
95
|
+
this.used = 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class SkinPaletteTexture {
|
|
2
|
+
private texture;
|
|
3
|
+
private joints;
|
|
4
|
+
/**
|
|
5
|
+
* The view, cached rather than created per call.
|
|
6
|
+
*
|
|
7
|
+
* `createView` allocates, and a bind group is rebuilt against this per draw — so a fresh view
|
|
8
|
+
* each time is both an allocation in the frame loop and a value that never compares equal,
|
|
9
|
+
* which would defeat any cache keyed on it. Invalidated only when the texture is replaced.
|
|
10
|
+
*/
|
|
11
|
+
private cachedView;
|
|
12
|
+
/** Upload a palette, reallocating only when the joint count changes. */
|
|
13
|
+
update(device: GPUDevice, palette: Float32Array): void;
|
|
14
|
+
view(): GPUTextureView | null;
|
|
15
|
+
get ready(): boolean;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { paletteTextureWidth, validateSkinPalette } from '../../skinPalette.js';
|
|
2
|
+
/**
|
|
3
|
+
* The joint palette as a one-row `rgba32float` texture, on WebGPU.
|
|
4
|
+
*
|
|
5
|
+
* The twin of the WebGL2 module of this name, and deliberately symmetric with it: one decision in
|
|
6
|
+
* `skinPalette.ts`, two thin binders, per the 2026-08-13 rule.
|
|
7
|
+
*
|
|
8
|
+
* **`rgba32float` is `unfilterable-float` to a bind group layout**, which costs nothing because
|
|
9
|
+
* the shader reads it with `textureLoad` — an integer coordinate and no sampler at all. A layout
|
|
10
|
+
* declaring it filterable would fail validation at pipeline creation, which is the loud failure
|
|
11
|
+
* rather than the quiet one.
|
|
12
|
+
*/
|
|
13
|
+
/*
|
|
14
|
+
* Spelled out rather than read from the global `GPUTextureUsage`, which is not in the TypeScript
|
|
15
|
+
* lib this package compiles against — `clusterBinner.ts` does the same and for the same reason.
|
|
16
|
+
*/
|
|
17
|
+
const TEXTURE_USAGE = {
|
|
18
|
+
COPY_DST: 0x02,
|
|
19
|
+
TEXTURE_BINDING: 0x04,
|
|
20
|
+
};
|
|
21
|
+
export class SkinPaletteTexture {
|
|
22
|
+
texture = null;
|
|
23
|
+
joints = 0;
|
|
24
|
+
/**
|
|
25
|
+
* The view, cached rather than created per call.
|
|
26
|
+
*
|
|
27
|
+
* `createView` allocates, and a bind group is rebuilt against this per draw — so a fresh view
|
|
28
|
+
* each time is both an allocation in the frame loop and a value that never compares equal,
|
|
29
|
+
* which would defeat any cache keyed on it. Invalidated only when the texture is replaced.
|
|
30
|
+
*/
|
|
31
|
+
cachedView = null;
|
|
32
|
+
/** Upload a palette, reallocating only when the joint count changes. */
|
|
33
|
+
update(device, palette) {
|
|
34
|
+
validateSkinPalette(palette);
|
|
35
|
+
const joints = palette.length / 16;
|
|
36
|
+
const width = paletteTextureWidth(joints);
|
|
37
|
+
if (this.texture === null || this.joints !== joints) {
|
|
38
|
+
this.texture?.destroy();
|
|
39
|
+
this.cachedView = null;
|
|
40
|
+
this.texture = device.createTexture({
|
|
41
|
+
/* Labelled, because `createGpuSurface`'s uncaptured-error lines are only legible when
|
|
42
|
+
every resource carries one. See the 2026-08-14 rule. */
|
|
43
|
+
label: `skin.palette:${joints}`,
|
|
44
|
+
size: { width, height: 1 },
|
|
45
|
+
format: 'rgba32float',
|
|
46
|
+
usage: TEXTURE_USAGE.TEXTURE_BINDING | TEXTURE_USAGE.COPY_DST,
|
|
47
|
+
});
|
|
48
|
+
this.joints = joints;
|
|
49
|
+
}
|
|
50
|
+
device.queue.writeTexture({ texture: this.texture }, palette, { bytesPerRow: width * 16 }, { width, height: 1 });
|
|
51
|
+
}
|
|
52
|
+
view() {
|
|
53
|
+
if (this.texture === null)
|
|
54
|
+
return null;
|
|
55
|
+
if (this.cachedView === null)
|
|
56
|
+
this.cachedView = this.texture.createView();
|
|
57
|
+
return this.cachedView;
|
|
58
|
+
}
|
|
59
|
+
get ready() {
|
|
60
|
+
return this.texture !== null;
|
|
61
|
+
}
|
|
62
|
+
dispose() {
|
|
63
|
+
this.texture?.destroy();
|
|
64
|
+
this.texture = null;
|
|
65
|
+
this.cachedView = null;
|
|
66
|
+
this.joints = 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { PipelineCache } from './pipelineCache.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The sky: one triangle covering the screen, with the world reconstructed per fragment.
|
|
4
|
+
*
|
|
5
|
+
* **No vertex buffers at all.** The vertex shader builds its three corners from
|
|
6
|
+
* `gl_VertexIndex` — `gl_VertexID` in the GLSL, which the transform renames — so there is
|
|
7
|
+
* nothing to upload and nothing to bind. That makes this the simplest pass in the engine to
|
|
8
|
+
* port and a good second one after `flat`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SKY_FIELDS: {
|
|
11
|
+
readonly uInvViewProj: {
|
|
12
|
+
readonly offset: 0;
|
|
13
|
+
readonly size: 64;
|
|
14
|
+
readonly type: "mat4";
|
|
15
|
+
};
|
|
16
|
+
readonly uCameraPos: {
|
|
17
|
+
readonly offset: 64;
|
|
18
|
+
readonly size: 12;
|
|
19
|
+
readonly type: "vec3";
|
|
20
|
+
};
|
|
21
|
+
readonly uTopColor: {
|
|
22
|
+
readonly offset: 80;
|
|
23
|
+
readonly size: 12;
|
|
24
|
+
readonly type: "vec3";
|
|
25
|
+
};
|
|
26
|
+
readonly uHorizonColor: {
|
|
27
|
+
readonly offset: 96;
|
|
28
|
+
readonly size: 12;
|
|
29
|
+
readonly type: "vec3";
|
|
30
|
+
};
|
|
31
|
+
readonly uDeepColor: {
|
|
32
|
+
readonly offset: 112;
|
|
33
|
+
readonly size: 12;
|
|
34
|
+
readonly type: "vec3";
|
|
35
|
+
};
|
|
36
|
+
readonly uSunDir: {
|
|
37
|
+
readonly offset: 128;
|
|
38
|
+
readonly size: 12;
|
|
39
|
+
readonly type: "vec3";
|
|
40
|
+
};
|
|
41
|
+
readonly uSunColor: {
|
|
42
|
+
readonly offset: 144;
|
|
43
|
+
readonly size: 12;
|
|
44
|
+
readonly type: "vec3";
|
|
45
|
+
};
|
|
46
|
+
readonly uSunDiscExponent: {
|
|
47
|
+
readonly offset: 156;
|
|
48
|
+
readonly size: 4;
|
|
49
|
+
readonly type: "float";
|
|
50
|
+
};
|
|
51
|
+
readonly uMoonDir: {
|
|
52
|
+
readonly offset: 160;
|
|
53
|
+
readonly size: 12;
|
|
54
|
+
readonly type: "vec3";
|
|
55
|
+
};
|
|
56
|
+
readonly uMoonColor: {
|
|
57
|
+
readonly offset: 176;
|
|
58
|
+
readonly size: 12;
|
|
59
|
+
readonly type: "vec3";
|
|
60
|
+
};
|
|
61
|
+
readonly uMoonAngularRadius: {
|
|
62
|
+
readonly offset: 188;
|
|
63
|
+
readonly size: 4;
|
|
64
|
+
readonly type: "float";
|
|
65
|
+
};
|
|
66
|
+
readonly uMoonPhase: {
|
|
67
|
+
readonly offset: 192;
|
|
68
|
+
readonly size: 4;
|
|
69
|
+
readonly type: "float";
|
|
70
|
+
};
|
|
71
|
+
readonly uNightFactor: {
|
|
72
|
+
readonly offset: 196;
|
|
73
|
+
readonly size: 4;
|
|
74
|
+
readonly type: "float";
|
|
75
|
+
};
|
|
76
|
+
readonly uCloudOffset: {
|
|
77
|
+
readonly offset: 200;
|
|
78
|
+
readonly size: 8;
|
|
79
|
+
readonly type: "vec2";
|
|
80
|
+
};
|
|
81
|
+
readonly uUnderwaterColor: {
|
|
82
|
+
readonly offset: 208;
|
|
83
|
+
readonly size: 12;
|
|
84
|
+
readonly type: "vec3";
|
|
85
|
+
};
|
|
86
|
+
readonly uUnderwaterFactor: {
|
|
87
|
+
readonly offset: 220;
|
|
88
|
+
readonly size: 4;
|
|
89
|
+
readonly type: "float";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export declare const SKY_UNIFORM_SIZE: 224;
|
|
93
|
+
export declare function createSkyBindGroupLayout(device: GPUDevice): GPUBindGroupLayout;
|
|
94
|
+
export declare function createSkyBindGroup(device: GPUDevice, layout: GPUBindGroupLayout, uniforms: GPUBuffer): GPUBindGroup;
|
|
95
|
+
/**
|
|
96
|
+
* The sky pipeline.
|
|
97
|
+
*
|
|
98
|
+
* **Depth is tested but not written**, which is what `gl.depthMask(false)` does on the
|
|
99
|
+
* WebGL2 path. The sky sits at the far plane, so writing its depth would push every later
|
|
100
|
+
* pass behind it; not testing at all would paint it over geometry already drawn.
|
|
101
|
+
*/
|
|
102
|
+
export declare function skyPipeline(cache: PipelineCache, device: GPUDevice, layout: GPUBindGroupLayout): GPURenderPipeline;
|