@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,655 @@
|
|
|
1
|
+
/** Fixed point-light budget shared by CPU selection and the flat shader. */
|
|
2
|
+
import type { AreaLightBuffer } from './areaLights.ts';
|
|
3
|
+
import type { ResolvedAreaShadows } from './areaShadowSet.ts';
|
|
4
|
+
import { POINT_LIGHT_COS_INNER, POINT_LIGHT_COS_OUTER } from './clusteredLights.ts';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How many point lights the shading pass shades against at once.
|
|
8
|
+
*
|
|
9
|
+
* It was eight, and eight is what an ordinary lamp-lit courtyard broke over: six lamps
|
|
10
|
+
* and a brazier inside 8.7 m take seven of them, so a gate's two lights —
|
|
11
|
+
* equidistant by construction, both 12.52 m out — contended for the one remaining
|
|
12
|
+
* slot and only ever one of them was rendered. More slots do not make the budget
|
|
13
|
+
* unbounded, and they are not what fixes contention; `CONTENTION_BAND_M` in
|
|
14
|
+
* `pointLightSelection.ts` is, by making the trade continuous. They buy the room
|
|
15
|
+
* that stops a scene this ordinary from having to make the trade at all.
|
|
16
|
+
*
|
|
17
|
+
* **It was ten, and ten was a texture-unit limit that no longer exists.** The comment
|
|
18
|
+
* here used to say that raising it "costs a texture unit and a pool slot each" and that
|
|
19
|
+
* eleven "would spend the last guaranteed unit, so this is the end of the road". That was
|
|
20
|
+
* true while each light's shadow was its own `samplerCube`. Every point shadow is now one
|
|
21
|
+
* layer of one `TEXTURE_2D_ARRAY` — see `pointShadowArray.ts` — so a light costs a layer
|
|
22
|
+
* and a pool slot, and no bindings at all.
|
|
23
|
+
*
|
|
24
|
+
* **Sixteen because that is what costs nothing.** A cube at face 512 was 6.29 MB and the
|
|
25
|
+
* pool plus the two live maps was sixteen of them, 100.7 MB. An octahedral layer at 1024 is
|
|
26
|
+
* 4.19 MB, so sixteen lights is a pool of twenty plus two live, twenty-two layers, 92.3 MB —
|
|
27
|
+
* less than the storage it replaces, with six more shadowed lights. **Eighteen is where the
|
|
28
|
+
* memory exactly equals what the cubes cost**, which is the number to reach for if a scene
|
|
29
|
+
* ever wants more, and the arithmetic is written down here so nobody has to re-derive it.
|
|
30
|
+
*
|
|
31
|
+
* What limits it now is the shader rather than the bindings: every one of these is a slot in
|
|
32
|
+
* five uniform arrays and an iteration of the light loop in the widest permutation of the
|
|
33
|
+
* largest shader in the engine.
|
|
34
|
+
*/
|
|
35
|
+
export const MAX_POINT_LIGHTS = 16;
|
|
36
|
+
|
|
37
|
+
/** Two live maps make changing the caster's owning light a crossfade, not a pop. */
|
|
38
|
+
export const LIVE_POINT_SHADOW_MAPS = 2;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Texture units the directional cascade binds: static, its depth peel, and dynamic.
|
|
42
|
+
*
|
|
43
|
+
* Named because the shading pass's total unit count has to be compared against what a
|
|
44
|
+
* device offers, and a budget assembled from three literals scattered across two files
|
|
45
|
+
* is a budget nobody can check. See the guard in `Renderer`'s constructor.
|
|
46
|
+
*/
|
|
47
|
+
export const DIRECTIONAL_SHADOW_UNITS = 3;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Texture units every point light's shadow binds: one, for all of them.
|
|
51
|
+
*
|
|
52
|
+
* **It was twelve** — ten pooled cubemaps and two live transition maps, each its own
|
|
53
|
+
* `samplerCube`, because GLSL ES cannot index a sampler array with a non-constant expression.
|
|
54
|
+
* One `TEXTURE_2D_ARRAY` of octahedral maps makes the choice a layer index instead, so the
|
|
55
|
+
* count stops depending on `MAX_POINT_LIGHTS` at all.
|
|
56
|
+
*/
|
|
57
|
+
export const POINT_SHADOW_UNITS = 1;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Where surface colour binds, directly above the shadow units.
|
|
61
|
+
*
|
|
62
|
+
* Units 0–2 are the sun's static, peeled and mover depth layers; unit 3 is the point-shadow
|
|
63
|
+
* array, every light in one binding. This is the fifth, the normal map is the sixth, and **ten of
|
|
64
|
+
* WebGL2's guaranteed sixteen are free** — where the lit pass used to fill all sixteen exactly.
|
|
65
|
+
*
|
|
66
|
+
* It lives here rather than in the renderer because this is where the unit accounting is
|
|
67
|
+
* written down. Raising `MAX_POINT_LIGHTS` no longer moves it: lights cost layers now, not
|
|
68
|
+
* units, which is the whole of what the octahedral change bought.
|
|
69
|
+
*/
|
|
70
|
+
export const SURFACE_TEXTURE_UNIT = DIRECTIONAL_SHADOW_UNITS + POINT_SHADOW_UNITS;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Where a normal map binds, directly above surface colour.
|
|
74
|
+
*
|
|
75
|
+
* **The first of the eleven units Phase 1.4 freed to be spent**, and it is worth saying what it
|
|
76
|
+
* cost to have one at all. `uTextureRelief`'s comment records the constraint in as many words: a
|
|
77
|
+
* second image sampler "is not the free addition it would be in a smaller shader", because the
|
|
78
|
+
* widest permutation already declared one more sampler than this project's adapter offered.
|
|
79
|
+
* Twelve point-shadow cubemaps became one array binding, and this is what that was for.
|
|
80
|
+
*
|
|
81
|
+
* The ORM map is the next one, and takes the unit above this.
|
|
82
|
+
*/
|
|
83
|
+
export const NORMAL_TEXTURE_UNIT = SURFACE_TEXTURE_UNIT + 1;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Occlusion, roughness and metallic in one image, on the unit above the normal map.
|
|
87
|
+
*
|
|
88
|
+
* Derived rather than written down, for the reason `SURFACE_TEXTURE_UNIT` is: a gap wastes a unit
|
|
89
|
+
* on a device that has none to waste, and an overlap binds two textures to one unit, which is
|
|
90
|
+
* undefined at best and reads as a surface losing one of its maps depending on the driver.
|
|
91
|
+
*
|
|
92
|
+
* **One unit for three channels rather than three units for three maps.** glTF packs them this way
|
|
93
|
+
* and so does every authoring tool that emits them; a file that separates its occlusion into its
|
|
94
|
+
* own image loses it, with the reason stated in the importer rather than a second sampler spent.
|
|
95
|
+
*
|
|
96
|
+
* The emissive map is the next one, and takes the unit above this.
|
|
97
|
+
*/
|
|
98
|
+
export const ORM_TEXTURE_UNIT = NORMAL_TEXTURE_UNIT + 1;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Where a consumer's emissive map binds.
|
|
102
|
+
*
|
|
103
|
+
* **The unit `textureUnitBudget.test.ts` has named for it since the sampler unlock**, which is the
|
|
104
|
+
* point of naming units rather than counting them: the change that spends one has to read what it
|
|
105
|
+
* is spending, and this one was written down before it was taken.
|
|
106
|
+
*
|
|
107
|
+
* Directly above the ORM map so the four material maps are contiguous — surface, normal, ORM,
|
|
108
|
+
* emissive. They are the set a device's guaranteed sixteen has to hold together, and anything else
|
|
109
|
+
* sitting between two of them makes that budget harder to read than it is.
|
|
110
|
+
*/
|
|
111
|
+
export const EMISSIVE_TEXTURE_UNIT = ORM_TEXTURE_UNIT + 1;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Where a baked reflection probe binds, when there is a unit spare for one.
|
|
115
|
+
*
|
|
116
|
+
* **It used to be one past the guarantee, and it is not any more.** WebGL2 promises sixteen
|
|
117
|
+
* units; the lit pass used to fill 0 through 15, so the probe sat at the seventeenth and every
|
|
118
|
+
* Apple GPU — all of which report exactly sixteen — had no unit for it and stood down. The
|
|
119
|
+
* point-shadow cubes became one array binding, so this is the eighth of sixteen and the probe
|
|
120
|
+
* fits everywhere.
|
|
121
|
+
*
|
|
122
|
+
* The rule it carried is kept anyway rather than deleted, because the reasoning is still the
|
|
123
|
+
* right one if the budget ever fills again: the probe is the thing given up, not the shadows.
|
|
124
|
+
* Dropping shadows to make room would trade a feature every scene uses for one a single
|
|
125
|
+
* material asks for, and a surface that cannot mirror the room still reflects the
|
|
126
|
+
* sky-and-ground approximation it always did.
|
|
127
|
+
*/
|
|
128
|
+
export const ENVIRONMENT_TEXTURE_UNIT = EMISSIVE_TEXTURE_UNIT + 1;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Where the froxel table binds.
|
|
132
|
+
*
|
|
133
|
+
* **Spent unconditionally, and that is what a runtime branch costs.** The clustered arm is
|
|
134
|
+
* compiled into every profile rather than permuted in, because a fifth permutation flag doubled
|
|
135
|
+
* the generated WGSL and cost 49% of the bundle on every consumer — the measurement is at the
|
|
136
|
+
* declaration in `shaders/flat/preamble.ts`. A declared sampler needs a valid texture bound to it
|
|
137
|
+
* whether or not the branch reads it, so this unit is taken even with `clusteredLights` off, and a
|
|
138
|
+
* one-texel placeholder stands in it.
|
|
139
|
+
*
|
|
140
|
+
* The eighth of sixteen. The sampler unlock left nine free and this is the first of them.
|
|
141
|
+
*/
|
|
142
|
+
export const CLUSTER_TABLE_TEXTURE_UNIT = ENVIRONMENT_TEXTURE_UNIT + 1;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Where the photometric atlas binds: one row per IES profile, any number of them.
|
|
146
|
+
*
|
|
147
|
+
* **One unit for every profile a world holds, which is the whole reason it is an atlas.** A
|
|
148
|
+
* fixture's distribution is a curve rather than an image, so a row of 128 floats holds one and a
|
|
149
|
+
* texture holds as many as a consumer loads. Per-profile textures would have spent the remaining
|
|
150
|
+
* units on the third fixture.
|
|
151
|
+
*
|
|
152
|
+
* **Spent unconditionally, for the same reason the froxel table is**, and the argument is at that
|
|
153
|
+
* declaration: the lookup is a branch on a value rather than a permutation, so the sampler is
|
|
154
|
+
* declared in every profile and a declared sampler needs a complete texture bound whether or not
|
|
155
|
+
* the branch reads it. With no profile loaded that texture is a single row of ones, which is the
|
|
156
|
+
* multiplicative identity — a row of zeros would switch off every light that reached it.
|
|
157
|
+
*
|
|
158
|
+
* The tenth of sixteen. `CAPABILITIES.md` §3 keeps the running count.
|
|
159
|
+
*/
|
|
160
|
+
export const IES_ATLAS_TEXTURE_UNIT = CLUSTER_TABLE_TEXTURE_UNIT + 1;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The joint palette, read by the **vertex** stage.
|
|
164
|
+
*
|
|
165
|
+
* **It comes out of the same sixteen as everything above it, and that is the correction.** The
|
|
166
|
+
* palette was first given unit 0 on the reasoning that `MAX_VERTEX_TEXTURE_IMAGE_UNITS` is a
|
|
167
|
+
* separate guarantee of sixteen from `MAX_TEXTURE_IMAGE_UNITS`. Those two do bound the stages
|
|
168
|
+
* separately — but they bound how many units each stage may *reference*, not how the units are
|
|
169
|
+
* numbered: `activeTexture` selects from one shared pool, so unit 0 is the directional shadow map
|
|
170
|
+
* whoever binds it. The result is `GL_INVALID_OPERATION: two textures of different types use the
|
|
171
|
+
* same sampler location`, on a frame that otherwise draws.
|
|
172
|
+
*
|
|
173
|
+
* Found on hardware rather than in review, which is the whole reason a capture is part of the
|
|
174
|
+
* work. WebGPU never had it: its bindings are per bind group and carry no shared namespace.
|
|
175
|
+
*
|
|
176
|
+
* What it costs is one of the five units left after the IES atlas. What would make it wrong is
|
|
177
|
+
* the lit pass growing past sixteen, which `textureUnitBudget.test.ts` asserts against.
|
|
178
|
+
*/
|
|
179
|
+
export const SKIN_PALETTE_TEXTURE_UNIT = IES_ATLAS_TEXTURE_UNIT + 1;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A mesh's morph deltas, also read by the vertex stage, and also out of this same sixteen.
|
|
183
|
+
*
|
|
184
|
+
* The second vertex-stage sampler this engine has, and it takes a unit for the reason the palette
|
|
185
|
+
* does: `activeTexture` selects from one pool whichever stage the sampler is declared in. Thirteen
|
|
186
|
+
* of sixteen spoken for, three free.
|
|
187
|
+
*/
|
|
188
|
+
export const MORPH_DELTA_TEXTURE_UNIT = SKIN_PALETTE_TEXTURE_UNIT + 1;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Where the spot-light cookie atlas binds: one row of square tiles, one tile a cookie.
|
|
192
|
+
*
|
|
193
|
+
* **The fourteenth of sixteen, and two are left.** `CAPABILITIES.md` §3 keeps the running count —
|
|
194
|
+
* and had been three units stale for as long as the IES atlas, the skin palette and the morph
|
|
195
|
+
* deltas have existed, which is why the number is derived in `textureUnitBudget.test.ts` and only
|
|
196
|
+
* quoted in prose.
|
|
197
|
+
*
|
|
198
|
+
* **Spent unconditionally, for the reason the froxel table and the IES atlas are**: a declared
|
|
199
|
+
* sampler needs a complete texture bound whether or not the branch reads it, so a one-texel white
|
|
200
|
+
* placeholder stands in it when no consumer has loaded a cookie. White rather than black, because
|
|
201
|
+
* it multiplies a light's colour and a black stand-in would switch off every light that reached
|
|
202
|
+
* it — the identity `packIesAtlas` chooses for the same reason.
|
|
203
|
+
*/
|
|
204
|
+
export const COOKIE_ATLAS_TEXTURE_UNIT = MORPH_DELTA_TEXTURE_UNIT + 1;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The colour the frame had already drawn, for a refracting surface to sample.
|
|
208
|
+
*
|
|
209
|
+
* **The second-to-last unit WebGL2 guarantees, and derived rather than a literal** for the reason
|
|
210
|
+
* every unit above it is: a gap wastes a unit on a device that has none to waste, and an overlap
|
|
211
|
+
* binds two textures of different types to one unit, which is undefined and reads as a scene
|
|
212
|
+
* losing one of them depending on the driver.
|
|
213
|
+
*
|
|
214
|
+
* **One unit is left after this.** What that costs is that the next sampler added has to find room
|
|
215
|
+
* rather than take it — by folding into an existing binding the way the twelve point-shadow
|
|
216
|
+
* cubemaps became one array, which is what freed the units this one is spending.
|
|
217
|
+
* `textureUnitBudget.test.ts` carries the phone that budget was written for.
|
|
218
|
+
*/
|
|
219
|
+
export const REFRACT_SCENE_TEXTURE_UNIT = COOKIE_ATLAS_TEXTURE_UNIT + 1;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A cookie's tile, in texels a side.
|
|
223
|
+
*
|
|
224
|
+
* **128, which is what a gobo is.** A cookie is a soft mask — a window frame, a leaf canopy, a
|
|
225
|
+
* grille — and its edges are blurred by the source's own size before anything sees them, so the
|
|
226
|
+
* resolution that matters is the shape rather than the detail. Sixteen tiles at 128 is a
|
|
227
|
+
* 2048x128 atlas at 1 MB, against 16 MB for the same count at 512.
|
|
228
|
+
*
|
|
229
|
+
* Interpolated into the shader rather than repeated there, so the half-texel inset that stops one
|
|
230
|
+
* tile bleeding into the next is derived from one definition.
|
|
231
|
+
*/
|
|
232
|
+
export const COOKIE_TILE = 128;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Where the SDF text atlas binds.
|
|
236
|
+
*
|
|
237
|
+
* **Not a new number past `SURFACE_TEXTURE_UNIT`.** The next untaken one by that reading is
|
|
238
|
+
* `ENVIRONMENT_TEXTURE_UNIT`, the seventeenth unit — and on the Apple GPUs this file already
|
|
239
|
+
* accounts for, which report exactly the guaranteed sixteen, a seventeenth unit does not
|
|
240
|
+
* exist. The reflection probe can decline gracefully when that happens and still leave a
|
|
241
|
+
* correct picture behind. SDF text has no such fallback: it is opt-in, but a consumer who
|
|
242
|
+
* opts in wants their labels on every device that promises WebGL2, not on every device except
|
|
243
|
+
* one vendor's phones.
|
|
244
|
+
*
|
|
245
|
+
* So the atlas reuses `SURFACE_TEXTURE_UNIT` itself, which needs no capability check because
|
|
246
|
+
* it is already the last unit WebGL2 guarantees. That is safe rather than a compromise: text
|
|
247
|
+
* draws through its own program, in its own pass, with exactly one sampler, so it never
|
|
248
|
+
* needs to coexist with whatever the shading pass bound a moment earlier — the two are never
|
|
249
|
+
* bound at once. Named separately anyway, so the SDF renderer's call site reads as "the
|
|
250
|
+
* atlas's unit" rather than as a reference to a surface colour it has nothing to do with.
|
|
251
|
+
*/
|
|
252
|
+
export const SDF_TEXT_TEXTURE_UNIT = SURFACE_TEXTURE_UNIT;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Cubemaps kept for world lights, independent of how many lights a world has.
|
|
256
|
+
*
|
|
257
|
+
* This used to be one map per light, forever, and it is the single most expensive
|
|
258
|
+
* mistake the renderer has made. A `DEPTH_COMPONENT24` cube at face size 512 is
|
|
259
|
+
* six faces at four bytes a texel, about 6.3 MB; a measured world carries 50
|
|
260
|
+
* lights, so the renderer allocated roughly 327 MB of shadow storage — of which
|
|
261
|
+
* `MAX_POINT_LIGHTS` worth, eight maps, could be sampled in any given frame.
|
|
262
|
+
* Forty-two of them, some 265 MB, were unreadable by construction.
|
|
263
|
+
*
|
|
264
|
+
* Nothing about that is visible on a GPU with its own memory. On an integrated
|
|
265
|
+
* part it is fatal: system RAM *is* the VRAM, over a bus shared with the CPU, so
|
|
266
|
+
* past the budget the driver evicts and re-uploads every frame and the frame rate
|
|
267
|
+
* falls off a cliff rather than degrading. It reproduced as a game that ran at
|
|
268
|
+
* 3 fps maximised and *perfectly* in a small window, because shrinking the window
|
|
269
|
+
* shrank the other targets back under the budget.
|
|
270
|
+
*
|
|
271
|
+
* So the pool is sized to what the shader can actually read, plus headroom. The
|
|
272
|
+
* headroom is not optional: selection reorders as the camera moves, and a pool of
|
|
273
|
+
* exactly eight would evict a map that is about to be wanted again and re-bake it
|
|
274
|
+
* on the next frame, forever. Four spare slots absorb that churn.
|
|
275
|
+
*
|
|
276
|
+
* The maps are no longer permanent, which is the cost of this: a light entering
|
|
277
|
+
* the sampled set for the first time in a while pays six face passes once. They
|
|
278
|
+
* bake from static geometry, so the result is identical whenever it is taken.
|
|
279
|
+
*/
|
|
280
|
+
export const POINT_SHADOW_POOL = MAX_POINT_LIGHTS + 4;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The active point lights a pass shades against.
|
|
284
|
+
*
|
|
285
|
+
* Named separately from `Environment` so a pass can ask for the lights without asking
|
|
286
|
+
* for the sky, the fog, the shadow maps and the highlight box as well — and named with
|
|
287
|
+
* `Environment`'s own field names so an environment satisfies it structurally, which
|
|
288
|
+
* keeps the call free of a per-frame adapter object in a per-frame path.
|
|
289
|
+
*/
|
|
290
|
+
export interface PointLightSet {
|
|
291
|
+
readonly lightCount: number;
|
|
292
|
+
readonly lightPositions: Float32Array;
|
|
293
|
+
readonly lightColors: Float32Array;
|
|
294
|
+
readonly lightRadii: Float32Array;
|
|
295
|
+
readonly lightWeights: Float32Array;
|
|
296
|
+
/**
|
|
297
|
+
* Each light's emitter radius in metres, optional per consumer.
|
|
298
|
+
*
|
|
299
|
+
* Absent means every source is a mathematical point, which is what this engine assumed until
|
|
300
|
+
* a highlight smaller than a fragment turned out to be the cause of speckle on glossy paint.
|
|
301
|
+
*/
|
|
302
|
+
readonly lightSourceRadii?: Float32Array;
|
|
303
|
+
/**
|
|
304
|
+
* Three per light: where a spot points, normalised. Absent means every light is a point.
|
|
305
|
+
*
|
|
306
|
+
* Optional so that a consumer which has never heard of spot lights passes exactly what it passed
|
|
307
|
+
* before and gets exactly what it got before.
|
|
308
|
+
*/
|
|
309
|
+
readonly lightDirections?: Float32Array;
|
|
310
|
+
/** Two per light: the cosine of the inner cone angle, then of the outer. */
|
|
311
|
+
readonly lightConeCos?: Float32Array;
|
|
312
|
+
/** One per light: a row of the photometric atlas, or negative for none. */
|
|
313
|
+
readonly lightIesProfiles?: Float32Array;
|
|
314
|
+
/**
|
|
315
|
+
* Three per light: where a photometric profile's azimuth zero points, in world space.
|
|
316
|
+
*
|
|
317
|
+
* **Only an asymmetric fixture reads it** — a street light, a wall washer — and every axially
|
|
318
|
+
* symmetric profile ignores it entirely, which is nearly all of them. It need not be
|
|
319
|
+
* perpendicular to the light's direction: the shader orthogonalises it against the aim, so a
|
|
320
|
+
* caller can hand the fixture's own forward and let the aim decide the rest. A zero vector, or
|
|
321
|
+
* one parallel to the aim, leaves the profile on its first plane.
|
|
322
|
+
*
|
|
323
|
+
* **It cannot be derived from the direction**, which is why it is here at all: there is no
|
|
324
|
+
* continuous field of unit vectors tangent to a sphere, so any reference built from the aim
|
|
325
|
+
* alone flips somewhere — and the obvious constructions put that flip exactly where these
|
|
326
|
+
* fixtures point, `cross(worldUp, dir)` being singular for a light aimed straight down.
|
|
327
|
+
*/
|
|
328
|
+
readonly lightIesAxes?: Float32Array;
|
|
329
|
+
/**
|
|
330
|
+
* One per light: a tile of the cookie atlas, or negative for none.
|
|
331
|
+
*
|
|
332
|
+
* A cookie is a mask the fixture projects — a window frame, a grille, foliage — and it is
|
|
333
|
+
* oriented by the same `lightIesAxes` a photometric profile is, because both answer the same
|
|
334
|
+
* question about a fixture: which way is up. It fills the light's **outer cone**, so a cookie
|
|
335
|
+
* drawn for one spot works in another with a different angle.
|
|
336
|
+
*/
|
|
337
|
+
readonly lightCookies?: Float32Array;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Weights are optional per consumer; a short array means every light is fully present. */
|
|
341
|
+
const FULLY_PRESENT: Float32Array = new Float32Array(MAX_POINT_LIGHTS).fill(1);
|
|
342
|
+
|
|
343
|
+
/** No size at all, which is the behaviour every scene had before a light could have one. */
|
|
344
|
+
const POINT_SOURCES: Float32Array = new Float32Array(MAX_POINT_LIGHTS);
|
|
345
|
+
/**
|
|
346
|
+
* Every light pointing nowhere, which is what a light with no cone needs.
|
|
347
|
+
*
|
|
348
|
+
* The direction is never read when the cone admits everything — `smoothstep` is already at its
|
|
349
|
+
* upper bound — so zeroes are correct rather than merely harmless.
|
|
350
|
+
*/
|
|
351
|
+
const NO_DIRECTIONS: Float32Array = new Float32Array(MAX_POINT_LIGHTS * 3);
|
|
352
|
+
/**
|
|
353
|
+
* Every light carrying no photometric profile.
|
|
354
|
+
*
|
|
355
|
+
* Filled with −1 rather than left at zero, because zero is a valid row index: a world with one
|
|
356
|
+
* profile loaded and a light that never asked for it would otherwise take row 0 and be shaped by
|
|
357
|
+
* a fixture it has nothing to do with.
|
|
358
|
+
*/
|
|
359
|
+
const NO_PROFILES: Float32Array = new Float32Array(MAX_POINT_LIGHTS).fill(-1);
|
|
360
|
+
/**
|
|
361
|
+
* Every light carrying no azimuth reference.
|
|
362
|
+
*
|
|
363
|
+
* Zero rather than an axis, and the shader reads a zero-length reference as "no usable one" and
|
|
364
|
+
* stays on the first plane — which is what every symmetric profile does anyway, so a scene that
|
|
365
|
+
* never heard of this shades exactly as it did.
|
|
366
|
+
*/
|
|
367
|
+
const NO_IES_AXES: Float32Array = new Float32Array(MAX_POINT_LIGHTS * 3);
|
|
368
|
+
/** Every light carrying no cookie. −1 rather than 0, because tile 0 is a real cookie. */
|
|
369
|
+
const NO_COOKIES: Float32Array = new Float32Array(MAX_POINT_LIGHTS).fill(-1);
|
|
370
|
+
/**
|
|
371
|
+
* A cone that admits every direction, for every light.
|
|
372
|
+
*
|
|
373
|
+
* Inner −1 and outer −2 in each pair, which is the collapse `POINT_LIGHT_COS_OUTER` describes: the
|
|
374
|
+
* dot product never falls below −1, so the term is exactly 1 and a scene with no spot light shades
|
|
375
|
+
* exactly as it did before spot lights existed.
|
|
376
|
+
*/
|
|
377
|
+
/**
|
|
378
|
+
* A fresh cone array where every light admits every direction.
|
|
379
|
+
*
|
|
380
|
+
* Exported because `createEnvironment` needs one it owns: the module-scope `OPEN_CONES` is shared
|
|
381
|
+
* by every fallback in this file, and handing it to an environment would let one scene's edit
|
|
382
|
+
* reach another's — the aliasing `createEnvironment` already warns about for `lightPositions`.
|
|
383
|
+
*/
|
|
384
|
+
export function openCones(lights: number = MAX_POINT_LIGHTS): Float32Array {
|
|
385
|
+
const cones = new Float32Array(lights * 2);
|
|
386
|
+
for (let light = 0; light < lights; light++) {
|
|
387
|
+
cones[light * 2] = POINT_LIGHT_COS_INNER;
|
|
388
|
+
cones[light * 2 + 1] = POINT_LIGHT_COS_OUTER;
|
|
389
|
+
}
|
|
390
|
+
return cones;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const OPEN_CONES: Float32Array = (() => {
|
|
394
|
+
const cones = new Float32Array(MAX_POINT_LIGHTS * 2);
|
|
395
|
+
for (let light = 0; light < MAX_POINT_LIGHTS; light++) {
|
|
396
|
+
cones[light * 2] = POINT_LIGHT_COS_INNER;
|
|
397
|
+
cones[light * 2 + 1] = POINT_LIGHT_COS_OUTER;
|
|
398
|
+
}
|
|
399
|
+
return cones;
|
|
400
|
+
})();
|
|
401
|
+
/** A light nobody positioned, at the origin with no colour: shaded, and contributing nothing. */
|
|
402
|
+
const NO_POSITIONS: Float32Array = new Float32Array(MAX_POINT_LIGHTS * 3);
|
|
403
|
+
const NO_COLORS: Float32Array = new Float32Array(MAX_POINT_LIGHTS * 3);
|
|
404
|
+
/** Said once per process, not once per frame. See the guard that sets it. */
|
|
405
|
+
let warnedShortArrays = false;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Bind a light set to whichever program declares the shared slot names.
|
|
409
|
+
*
|
|
410
|
+
* Three passes now shade against these — surfaces, smoke and water — and each had its
|
|
411
|
+
* own copy of the same four uploads. A fourth would have made it four, and one of the
|
|
412
|
+
* four would eventually have been the one to forget `uLightWeight` and have lights pop
|
|
413
|
+
* in and out instead of fading.
|
|
414
|
+
*
|
|
415
|
+
* `falloff` travels with them because the shape a lamp fades with is a property of the
|
|
416
|
+
* *world*, not of the material it lands on: a lamp that behaves one way on stone and
|
|
417
|
+
* another on the water beside it is the same light in two places.
|
|
418
|
+
*/
|
|
419
|
+
export function bindPointLights(
|
|
420
|
+
gl: WebGL2RenderingContext,
|
|
421
|
+
uniforms: Record<string, WebGLUniformLocation>,
|
|
422
|
+
lights: PointLightSet | null,
|
|
423
|
+
falloff: 'smooth' | 'inverseSquare',
|
|
424
|
+
): void {
|
|
425
|
+
const r = resolvePointLights(lights, falloff, glLights);
|
|
426
|
+
gl.uniform1i(uniforms['uLightCount'] ?? null, r.count);
|
|
427
|
+
gl.uniform1i(uniforms['uLightFalloff'] ?? null, r.falloff);
|
|
428
|
+
if (r.count === 0) return;
|
|
429
|
+
gl.uniform3fv(uniforms['uLightPos[0]'] ?? null, r.positions);
|
|
430
|
+
gl.uniform3fv(uniforms['uLightColor[0]'] ?? null, r.colors);
|
|
431
|
+
gl.uniform1fv(uniforms['uLightRadius[0]'] ?? null, r.radii);
|
|
432
|
+
gl.uniform1fv(uniforms['uLightSourceRadius[0]'] ?? null, r.sourceRadii);
|
|
433
|
+
gl.uniform1fv(uniforms['uLightWeight[0]'] ?? null, r.weights);
|
|
434
|
+
/*
|
|
435
|
+
* The cone, uploaded for every light rather than only for spots. The shader reads these slots
|
|
436
|
+
* unconditionally — a point light's pair is what makes its term collapse to 1 — so leaving them
|
|
437
|
+
* unwritten is a uniform holding zeros, which is a cone that admits nothing and a world with
|
|
438
|
+
* every lamp switched off.
|
|
439
|
+
*/
|
|
440
|
+
gl.uniform3fv(uniforms['uLightDir[0]'] ?? null, r.directions);
|
|
441
|
+
gl.uniform2fv(uniforms['uLightCone[0]'] ?? null, r.coneCos);
|
|
442
|
+
gl.uniform1fv(uniforms['uLightIesProfile[0]'] ?? null, r.iesProfiles);
|
|
443
|
+
gl.uniform3fv(uniforms['uLightIesAxis[0]'] ?? null, r.iesAxes);
|
|
444
|
+
gl.uniform1fv(uniforms['uLightCookie[0]'] ?? null, r.cookies);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Bind the rectangular emitters, on the same reasoning `bindPointLights` gives.
|
|
449
|
+
*
|
|
450
|
+
* Separate from the point lights because they are a separate loop with separate arrays, and in the
|
|
451
|
+
* same file because a fourth pass forgetting one of these is the failure that helper exists to
|
|
452
|
+
* prevent — and there is no reason a second one would be immune to it.
|
|
453
|
+
*/
|
|
454
|
+
export function bindAreaLights(
|
|
455
|
+
gl: WebGL2RenderingContext,
|
|
456
|
+
uniforms: Record<string, WebGLUniformLocation>,
|
|
457
|
+
lights: AreaLightBuffer | null,
|
|
458
|
+
): void {
|
|
459
|
+
const count = lights?.count ?? 0;
|
|
460
|
+
gl.uniform1i(uniforms['uAreaLightCount'] ?? null, count);
|
|
461
|
+
/*
|
|
462
|
+
* Nothing else uploaded at zero, which is what makes an area light free to a scene that has
|
|
463
|
+
* none: the shader's loop breaks on the count before it reads an array, so the arrays may hold
|
|
464
|
+
* whatever they held.
|
|
465
|
+
*/
|
|
466
|
+
if (count === 0 || lights === null) return;
|
|
467
|
+
gl.uniform3fv(uniforms['uAreaLightPos[0]'] ?? null, lights.positions);
|
|
468
|
+
gl.uniform3fv(uniforms['uAreaLightColor[0]'] ?? null, lights.colors);
|
|
469
|
+
gl.uniform3fv(uniforms['uAreaLightRight[0]'] ?? null, lights.right);
|
|
470
|
+
gl.uniform3fv(uniforms['uAreaLightUp[0]'] ?? null, lights.up);
|
|
471
|
+
gl.uniform2fv(uniforms['uAreaLightSize[0]'] ?? null, lights.sizes);
|
|
472
|
+
gl.uniform1fv(uniforms['uAreaLightTwoSided[0]'] ?? null, lights.twoSided);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Put a rectangle's occlusion on the program: eight arrays, no texture of its own.
|
|
477
|
+
*
|
|
478
|
+
* **No sampler here, and that is the whole reason this is a separate function rather than part of
|
|
479
|
+
* `bindPointShadows`.** An area light's layers live in the array that call already bound, so the
|
|
480
|
+
* unit and the sampler name are its business and these are only indices into it — which is also
|
|
481
|
+
* what makes an area shadow ride `RenderQuality.pointShadows`: with the flag off the program
|
|
482
|
+
* declares no array at all, none of these eight names exists, and every lookup below answers
|
|
483
|
+
* `null`.
|
|
484
|
+
*
|
|
485
|
+
* Addressed as `name[0]`, because GLSL ES exposes an array uniform under the name of its first
|
|
486
|
+
* element and `name[1]` returns nothing from the cached table — the mistake that left point-light
|
|
487
|
+
* slots 1 to 7 at zero and made their shadows vanish.
|
|
488
|
+
*/
|
|
489
|
+
export function bindAreaShadows(
|
|
490
|
+
gl: WebGL2RenderingContext,
|
|
491
|
+
uniforms: Record<string, WebGLUniformLocation>,
|
|
492
|
+
shadows: ResolvedAreaShadows,
|
|
493
|
+
): void {
|
|
494
|
+
gl.uniform1iv(uniforms['uAreaShadowLayer[0]'] ?? null, shadows.layer);
|
|
495
|
+
gl.uniform1fv(uniforms['uAreaShadowFar[0]'] ?? null, shadows.far);
|
|
496
|
+
gl.uniform1fv(uniforms['uAreaShadowNear[0]'] ?? null, shadows.near);
|
|
497
|
+
gl.uniform1fv(uniforms['uAreaShadowWeight[0]'] ?? null, shadows.weight);
|
|
498
|
+
gl.uniform1iv(uniforms['uLiveAreaShadowLayer[0]'] ?? null, shadows.liveLayer);
|
|
499
|
+
gl.uniform1fv(uniforms['uLiveAreaShadowFar[0]'] ?? null, shadows.liveFar);
|
|
500
|
+
gl.uniform1fv(uniforms['uLiveAreaShadowNear[0]'] ?? null, shadows.liveNear);
|
|
501
|
+
gl.uniform1fv(uniforms['uLiveAreaShadowWeight[0]'] ?? null, shadows.liveWeight);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** The five arrays and two scalars a shader needs, after every fallback has been applied. */
|
|
505
|
+
export interface ResolvedPointLights {
|
|
506
|
+
count: number;
|
|
507
|
+
/** 1 for `inverseSquare`, 0 for `smooth`. An `int` uniform on both backends. */
|
|
508
|
+
falloff: number;
|
|
509
|
+
positions: Float32Array;
|
|
510
|
+
colors: Float32Array;
|
|
511
|
+
radii: Float32Array;
|
|
512
|
+
sourceRadii: Float32Array;
|
|
513
|
+
weights: Float32Array;
|
|
514
|
+
directions: Float32Array;
|
|
515
|
+
coneCos: Float32Array;
|
|
516
|
+
iesProfiles: Float32Array;
|
|
517
|
+
iesAxes: Float32Array;
|
|
518
|
+
cookies: Float32Array;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** One per GL binder, refilled per call: holds references, allocates nothing. */
|
|
522
|
+
const glLights: ResolvedPointLights = {
|
|
523
|
+
count: 0,
|
|
524
|
+
falloff: 0,
|
|
525
|
+
positions: NO_POSITIONS,
|
|
526
|
+
colors: NO_COLORS,
|
|
527
|
+
radii: POINT_SOURCES,
|
|
528
|
+
sourceRadii: POINT_SOURCES,
|
|
529
|
+
weights: FULLY_PRESENT,
|
|
530
|
+
directions: NO_DIRECTIONS,
|
|
531
|
+
coneCos: OPEN_CONES,
|
|
532
|
+
iesProfiles: NO_PROFILES,
|
|
533
|
+
iesAxes: NO_IES_AXES,
|
|
534
|
+
cookies: NO_COOKIES,
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Choose which array each slot actually gets, with every fallback applied.
|
|
539
|
+
*
|
|
540
|
+
* **Separated from the upload so a second backend reaches the same five arrays.** The whole
|
|
541
|
+
* argument for `bindPointLights` is that a fourth pass would eventually be the one to forget
|
|
542
|
+
* `uLightWeight`; a second *backend* that cannot call it, having no `WebGL2RenderingContext`,
|
|
543
|
+
* is that same fourth pass wearing a different hat. WebGPU scatters these into a uniform block
|
|
544
|
+
* at the generated stride, WebGL2 hands them to `uniform3fv`.
|
|
545
|
+
*
|
|
546
|
+
* Fills a target the caller owns, because both callers are per-frame paths.
|
|
547
|
+
*/
|
|
548
|
+
export function resolvePointLights(
|
|
549
|
+
lights: PointLightSet | null,
|
|
550
|
+
falloff: 'smooth' | 'inverseSquare',
|
|
551
|
+
out: ResolvedPointLights,
|
|
552
|
+
): ResolvedPointLights {
|
|
553
|
+
const count = lights?.lightCount ?? 0;
|
|
554
|
+
out.count = count;
|
|
555
|
+
out.falloff = falloff === 'inverseSquare' ? 1 : 0;
|
|
556
|
+
if (count === 0 || lights === null) {
|
|
557
|
+
out.positions = NO_POSITIONS;
|
|
558
|
+
out.colors = NO_COLORS;
|
|
559
|
+
out.radii = POINT_SOURCES;
|
|
560
|
+
out.sourceRadii = POINT_SOURCES;
|
|
561
|
+
out.weights = FULLY_PRESENT;
|
|
562
|
+
out.directions = NO_DIRECTIONS;
|
|
563
|
+
out.coneCos = OPEN_CONES;
|
|
564
|
+
out.iesProfiles = NO_PROFILES;
|
|
565
|
+
out.iesAxes = NO_IES_AXES;
|
|
566
|
+
out.cookies = NO_COOKIES;
|
|
567
|
+
return out;
|
|
568
|
+
}
|
|
569
|
+
/*
|
|
570
|
+
* **Every array is guarded on its length, and they used to disagree about what absent means.**
|
|
571
|
+
*
|
|
572
|
+
* `uLightWeight` checked a length and `uLightSourceRadius` checked for `undefined`, and
|
|
573
|
+
* `createEnvironment` initialises the whole family to `new Float32Array(0)`, which is not
|
|
574
|
+
* undefined. So the emitter-size fallback never fired: a zero-length array reached a uniform
|
|
575
|
+
* declared as `MAX_POINT_LIGHTS` floats, `uniform1fv` refused it with `INVALID_VALUE` on every
|
|
576
|
+
* frame that had a light in it, and the uniform kept the zeros it started with. Every light in
|
|
577
|
+
* the scene was then shaded as a mathematical point, which is a highlight narrower than a
|
|
578
|
+
* fragment: exactly the speckle on dark glossy paint that `sourceRadius` was added to remove.
|
|
579
|
+
* **The feature was silently off in the app that asked for it.** Reported from outside; the
|
|
580
|
+
* comment here previously claimed the fallback covered "an environment built before this
|
|
581
|
+
* existed", which is true of a hand-written literal and false of anything the factory made.
|
|
582
|
+
*
|
|
583
|
+
* The other three had no guard at all, so the same mistake on them was the same error with a
|
|
584
|
+
* different name. A short array now means a light that is unlit rather than a frame that is
|
|
585
|
+
* invalid, which is the difference between a picture somebody can debug and a console flood.
|
|
586
|
+
*/
|
|
587
|
+
const positions =
|
|
588
|
+
lights.lightPositions.length >= MAX_POINT_LIGHTS * 3 ? lights.lightPositions : NO_POSITIONS;
|
|
589
|
+
const colors = lights.lightColors.length >= MAX_POINT_LIGHTS * 3 ? lights.lightColors : NO_COLORS;
|
|
590
|
+
const radii = lights.lightRadii.length >= MAX_POINT_LIGHTS ? lights.lightRadii : POINT_SOURCES;
|
|
591
|
+
const sourceRadii =
|
|
592
|
+
(lights.lightSourceRadii?.length ?? 0) >= MAX_POINT_LIGHTS
|
|
593
|
+
? (lights.lightSourceRadii as Float32Array)
|
|
594
|
+
: POINT_SOURCES;
|
|
595
|
+
const weights =
|
|
596
|
+
lights.lightWeights.length >= MAX_POINT_LIGHTS ? lights.lightWeights : FULLY_PRESENT;
|
|
597
|
+
/*
|
|
598
|
+
* Guarded on length exactly as the five above are, and for the reason that comment gives: a short
|
|
599
|
+
* array reaching a uniform declared `MAX_POINT_LIGHTS` wide is an `INVALID_VALUE` every frame and
|
|
600
|
+
* a uniform that keeps whatever it started with. For the cone that would be zeros, which is a
|
|
601
|
+
* cone admitting nothing — every light in the scene switched off, silently.
|
|
602
|
+
*/
|
|
603
|
+
const directions =
|
|
604
|
+
(lights.lightDirections?.length ?? 0) >= MAX_POINT_LIGHTS * 3
|
|
605
|
+
? (lights.lightDirections as Float32Array)
|
|
606
|
+
: NO_DIRECTIONS;
|
|
607
|
+
const coneCos =
|
|
608
|
+
(lights.lightConeCos?.length ?? 0) >= MAX_POINT_LIGHTS * 2
|
|
609
|
+
? (lights.lightConeCos as Float32Array)
|
|
610
|
+
: OPEN_CONES;
|
|
611
|
+
const iesProfiles =
|
|
612
|
+
(lights.lightIesProfiles?.length ?? 0) >= MAX_POINT_LIGHTS
|
|
613
|
+
? (lights.lightIesProfiles as Float32Array)
|
|
614
|
+
: NO_PROFILES;
|
|
615
|
+
/* Guarded on length like the five above, and for that comment's reason: a short array reaching a
|
|
616
|
+
uniform declared `MAX_POINT_LIGHTS` wide is an `INVALID_VALUE` every frame and a uniform that
|
|
617
|
+
keeps whatever it started with — which here would be a stale reference axis, and a fixture
|
|
618
|
+
whose pattern points somewhere nobody asked for. */
|
|
619
|
+
const iesAxes =
|
|
620
|
+
(lights.lightIesAxes?.length ?? 0) >= MAX_POINT_LIGHTS * 3
|
|
621
|
+
? (lights.lightIesAxes as Float32Array)
|
|
622
|
+
: NO_IES_AXES;
|
|
623
|
+
const cookies =
|
|
624
|
+
(lights.lightCookies?.length ?? 0) >= MAX_POINT_LIGHTS
|
|
625
|
+
? (lights.lightCookies as Float32Array)
|
|
626
|
+
: NO_COOKIES;
|
|
627
|
+
/*
|
|
628
|
+
* Said once, because a consumer who has done this wants to know and does not want it every
|
|
629
|
+
* frame. It is the diagnostic that was missing: the symptom is "the highlights look wrong",
|
|
630
|
+
* which leads nowhere, and the cause is one array the caller forgot to bind.
|
|
631
|
+
*/
|
|
632
|
+
if (
|
|
633
|
+
!warnedShortArrays &&
|
|
634
|
+
(positions === NO_POSITIONS || radii === POINT_SOURCES || sourceRadii === POINT_SOURCES)
|
|
635
|
+
) {
|
|
636
|
+
warnedShortArrays = true;
|
|
637
|
+
console.warn(
|
|
638
|
+
`bindPointLights: lightCount is ${count} but at least one light array is shorter than ` +
|
|
639
|
+
`MAX_POINT_LIGHTS (${MAX_POINT_LIGHTS}). Those lights are being drawn unlit or as ` +
|
|
640
|
+
'points. Bind every array from the same PointLightBuffer: positions, colors, radii, ' +
|
|
641
|
+
'sourceRadii and weights.',
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
out.positions = positions;
|
|
645
|
+
out.colors = colors;
|
|
646
|
+
out.radii = radii;
|
|
647
|
+
out.sourceRadii = sourceRadii;
|
|
648
|
+
out.weights = weights;
|
|
649
|
+
out.directions = directions;
|
|
650
|
+
out.coneCos = coneCos;
|
|
651
|
+
out.iesProfiles = iesProfiles;
|
|
652
|
+
out.iesAxes = iesAxes;
|
|
653
|
+
out.cookies = cookies;
|
|
654
|
+
return out;
|
|
655
|
+
}
|