@nova-lab/core 1.0.0-dev.19 → 1.1.0-dev.229
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/README.md +1035 -10
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/dist/2d/accessibility.d.ts +2 -0
- package/dist/2d/accessibility.js +171 -0
- package/dist/2d/commands.d.ts +2 -0
- package/dist/2d/commands.js +80 -0
- package/dist/2d/effects.d.ts +10 -0
- package/dist/2d/effects.js +566 -0
- package/dist/2d/ktx2.d.ts +5 -0
- package/dist/2d/ktx2.js +542 -0
- package/dist/2d/lighting.d.ts +3 -0
- package/dist/2d/lighting.js +495 -0
- package/dist/2d/lottie.d.ts +3 -0
- package/dist/2d/lottie.js +254 -0
- package/dist/2d/meshes.d.ts +4 -0
- package/dist/2d/meshes.js +451 -0
- package/dist/2d/primitives.d.ts +3 -0
- package/dist/2d/primitives.js +85 -0
- package/dist/2d/render-textures.d.ts +3 -0
- package/dist/2d/render-textures.js +539 -0
- package/dist/2d/svg/documents.d.ts +5 -0
- package/dist/2d/svg/documents.js +7 -0
- package/dist/2d/svg/renderer.d.ts +3 -0
- package/dist/2d/svg/renderer.js +222 -0
- package/dist/2d/svg.d.ts +3 -0
- package/dist/2d/svg.js +4 -0
- package/dist/2d/tools.d.ts +2 -0
- package/dist/2d/tools.js +100 -0
- package/dist/2d/video.d.ts +5 -0
- package/dist/2d/video.js +90 -0
- package/dist/2d.d.ts +2 -0
- package/dist/2d.js +220 -0
- package/dist/3d/animation.d.ts +8 -0
- package/dist/3d/animation.js +1396 -0
- package/dist/3d/area-lights.d.ts +2 -0
- package/dist/3d/area-lights.js +19 -0
- package/dist/3d/audio.d.ts +4 -0
- package/dist/3d/audio.js +500 -0
- package/dist/3d/character.d.ts +2 -0
- package/dist/3d/character.js +136 -0
- package/dist/3d/collision.d.ts +3 -0
- package/dist/3d/collision.js +387 -0
- package/dist/3d/commands.d.ts +2 -0
- package/dist/3d/commands.js +108 -0
- package/dist/3d/controls.d.ts +8 -0
- package/dist/3d/controls.js +1041 -0
- package/dist/3d/documents.d.ts +5 -0
- package/dist/3d/documents.js +227 -0
- package/dist/3d/effects.d.ts +5 -0
- package/dist/3d/effects.js +1986 -0
- package/dist/3d/export.d.ts +4 -0
- package/dist/3d/export.js +347 -0
- package/dist/3d/fbx.d.ts +2 -0
- package/dist/3d/fbx.js +784 -0
- package/dist/3d/gltf.d.ts +2 -0
- package/dist/3d/gltf.js +5 -0
- package/dist/3d/helpers.d.ts +5 -0
- package/dist/3d/helpers.js +191 -0
- package/dist/3d/ik.d.ts +9 -0
- package/dist/3d/ik.js +777 -0
- package/dist/3d/loaders.d.ts +17 -0
- package/dist/3d/loaders.js +1406 -0
- package/dist/3d/nodes.d.ts +8 -0
- package/dist/3d/nodes.js +49 -0
- package/dist/3d/particles.d.ts +5 -0
- package/dist/3d/particles.js +1574 -0
- package/dist/3d/physics/backend.d.ts +7 -0
- package/dist/3d/physics/backend.js +1 -0
- package/dist/3d/physics/rapier.d.ts +3 -0
- package/dist/3d/physics/rapier.js +765 -0
- package/dist/3d/physics.d.ts +5 -0
- package/dist/3d/physics.js +3346 -0
- package/dist/3d/splats.d.ts +7 -0
- package/dist/3d/splats.js +862 -0
- package/dist/3d/text.d.ts +5 -0
- package/dist/3d/text.js +1043 -0
- package/dist/3d/tiles.d.ts +24 -0
- package/dist/3d/tiles.js +1705 -0
- package/dist/3d/tools.d.ts +12 -0
- package/dist/3d/tools.js +338 -0
- package/dist/3d/usdz.d.ts +2 -0
- package/dist/3d/usdz.js +634 -0
- package/dist/3d/xr.d.ts +2 -0
- package/dist/3d/xr.js +202 -0
- package/dist/3d-B4jWF8Qb.js +5591 -0
- package/dist/3d.d.ts +40 -0
- package/dist/3d.js +44 -0
- package/dist/Capsule-BFVpZfvc.js +44 -0
- package/dist/Clip-CAN7t03k.js +204 -0
- package/dist/Color-vuv9UnoY.js +34 -0
- package/dist/DeformedMesh-CPi0P_vc.js +280 -0
- package/dist/Document-DCVEZSvM.js +415 -0
- package/dist/Errors-B2ekO9bZ.js +30 -0
- package/dist/Features-BsjmePtc.js +557 -0
- package/dist/GLTFResourceIO-CYJyCUTt.js +124 -0
- package/dist/GPUParticleState-CQlNpoDa.js +545 -0
- package/dist/Geometry-DytO490z.js +227 -0
- package/dist/Inflate-DWw0V-Up.js +42 -0
- package/dist/InstancedMesh-DPrgrw5z.js +527 -0
- package/dist/Limits-Bw5XQdFr.js +20 -0
- package/dist/LineHelper-Ad0z9uDi.js +131 -0
- package/dist/LoaderIO-BwrM84OM.js +114 -0
- package/dist/Material-BpfLPmK9.js +777 -0
- package/dist/Mesh-BaRxAAJq.js +209 -0
- package/dist/Node-QfgAE2_v.js +877 -0
- package/dist/NovaAssetRegistry-p2QlCwvT.js +1168 -0
- package/dist/NovaNode-CBZ-Ol-W.js +2016 -0
- package/dist/NovaRenderCommandWriter-CWQRa42y.js +1949 -0
- package/dist/NovaTextSelectionService-CipuujCT.js +18526 -0
- package/dist/NovaWebGLProgram-BO250QNF.js +97 -0
- package/dist/Options-CajE7LLJ.js +15 -0
- package/dist/PolygonMesh-D4PnnfIo.js +657 -0
- package/dist/Ready-BzyhRtjD.js +21 -0
- package/dist/Scene-CDfNgf9I.js +911 -0
- package/dist/Shader-b6_HDndT.js +48 -0
- package/dist/SplatShader-wJ6GJ3vo.js +130 -0
- package/dist/Texture-dTKMlTpK.js +267 -0
- package/dist/TextureLoader-CfDzdy2m.js +411 -0
- package/dist/Textures-CGL4Kf-8.js +651 -0
- package/dist/ToneMapping-D9IWvN0u.js +46 -0
- package/dist/WebGPURenderer-DjD0IxVC.js +4921 -0
- package/dist/ZipReader-C-MSEsSr.js +84 -0
- package/dist/core.js +218 -24024
- package/dist/domain/types/base.types.d.ts +18 -9
- package/dist/domain/types/component.types.d.ts +5 -5
- package/dist/domain/types/cursor.types.d.ts +1 -1
- package/dist/domain/types/diagnostics.types.d.ts +2 -0
- package/dist/domain/types/export.types.d.ts +2 -2
- package/dist/domain/types/hit-test.types.d.ts +1 -1
- package/dist/domain/types/motion.types.d.ts +2 -2
- package/dist/domain/types/renderer.types.d.ts +88 -4
- package/dist/domain/types/rendering/index.d.ts +29 -4
- package/dist/domain/types/sound.types.d.ts +1 -1
- package/dist/domain/types/theme.types.d.ts +1 -1
- package/dist/domain/utils/bounds.d.ts +1 -1
- package/dist/domain/utils/nova-text.d.ts +9 -0
- package/dist/domain/utils/schemaBounds.d.ts +2 -2
- package/dist/export-svg-document-ChaNXMaG.js +668 -0
- package/dist/features/3d/Errors.d.ts +57 -0
- package/dist/features/3d/Nova3DApp.d.ts +429 -0
- package/dist/features/3d/animation/Animator.d.ts +260 -0
- package/dist/features/3d/animation/Clip.d.ts +74 -0
- package/dist/features/3d/animation/Graph.d.ts +158 -0
- package/dist/features/3d/animation/Mask.d.ts +40 -0
- package/dist/features/3d/audio/Audio.d.ts +114 -0
- package/dist/features/3d/audio/Sound.d.ts +133 -0
- package/dist/features/3d/character/CharacterController.d.ts +61 -0
- package/dist/features/3d/collision/Capsule.d.ts +25 -0
- package/dist/features/3d/collision/Octree.d.ts +94 -0
- package/dist/features/3d/controls/CameraMotionControls.d.ts +154 -0
- package/dist/features/3d/controls/CameraOrientation.d.ts +47 -0
- package/dist/features/3d/controls/OrbitControls.d.ts +73 -0
- package/dist/features/3d/controls/PointerGesture.d.ts +25 -0
- package/dist/features/3d/controls/PointerLock.d.ts +36 -0
- package/dist/features/3d/controls/Snapping.d.ts +32 -0
- package/dist/features/3d/controls/TransformGizmo.d.ts +79 -0
- package/dist/features/3d/deformation/DeformationGPU.d.ts +52 -0
- package/dist/features/3d/deformation/DeformationShader.d.ts +2 -0
- package/dist/features/3d/deformation/DeformedMesh.d.ts +36 -0
- package/dist/features/3d/deformation/GeometryDeformation.d.ts +25 -0
- package/dist/features/3d/documents/Document.d.ts +59 -0
- package/dist/features/3d/documents/DocumentCommands.d.ts +45 -0
- package/dist/features/3d/documents/DocumentSchema.d.ts +18 -0
- package/dist/features/3d/documents/DocumentTransform.d.ts +4 -0
- package/dist/features/3d/documents/DocumentTypes.d.ts +182 -0
- package/dist/features/3d/documents/DocumentValidation.d.ts +18 -0
- package/dist/features/3d/documents/Projection.d.ts +65 -0
- package/dist/features/3d/effects/CubeLUT.d.ts +24 -0
- package/dist/features/3d/effects/Effects.d.ts +32 -0
- package/dist/features/3d/effects/EffectsGPU.d.ts +80 -0
- package/dist/features/3d/effects/EffectsPlan.d.ts +268 -0
- package/dist/features/3d/effects/EffectsShaders.d.ts +35 -0
- package/dist/features/3d/export/GLTFExporter.d.ts +49 -0
- package/dist/features/3d/export/ThreeMFExporter.d.ts +19 -0
- package/dist/features/3d/export/ZipWriter.d.ts +9 -0
- package/dist/features/3d/fbx/FBXLoader.d.ts +26 -0
- package/dist/features/3d/fbx/FBXParser.d.ts +35 -0
- package/dist/features/3d/fbx/FBXScene.d.ts +20 -0
- package/dist/features/3d/gltf/GLTFLoader.d.ts +16 -0
- package/dist/features/3d/gltf/GLTFTypes.d.ts +64 -0
- package/dist/features/3d/gltf/services/GLTFBinary.d.ts +21 -0
- package/dist/features/3d/gltf/services/GLTFGeometry.d.ts +14 -0
- package/dist/features/3d/gltf/services/GLTFResourceIO.d.ts +64 -0
- package/dist/features/3d/helpers/LineHelper.d.ts +51 -0
- package/dist/features/3d/helpers/StaticHelpers.d.ts +47 -0
- package/dist/features/3d/helpers/TrackedHelpers.d.ts +84 -0
- package/dist/features/3d/ik/ChainIK.d.ts +44 -0
- package/dist/features/3d/ik/IKChain.d.ts +92 -0
- package/dist/features/3d/ik/IKMath.d.ts +49 -0
- package/dist/features/3d/ik/IKSolver.d.ts +97 -0
- package/dist/features/3d/ik/LookAtIK.d.ts +58 -0
- package/dist/features/3d/ik/TwoBoneIK.d.ts +57 -0
- package/dist/features/3d/import/ImportAnimation.d.ts +20 -0
- package/dist/features/3d/import/ImportMath.d.ts +42 -0
- package/dist/features/3d/import/ImportedModel.d.ts +135 -0
- package/dist/features/3d/import/Inflate.d.ts +5 -0
- package/dist/features/3d/import/ModelAsset.d.ts +149 -0
- package/dist/features/3d/import/PolygonMesh.d.ts +54 -0
- package/dist/features/3d/lights/AreaLightTables.d.ts +8 -0
- package/dist/features/3d/lights/AreaLights.d.ts +11 -0
- package/dist/features/3d/loaders/EXRCompression.d.ts +13 -0
- package/dist/features/3d/loaders/EXRLoader.d.ts +39 -0
- package/dist/features/3d/loaders/HDRLoader.d.ts +26 -0
- package/dist/features/3d/loaders/Limits.d.ts +70 -0
- package/dist/features/3d/loaders/LoaderBuffers.d.ts +42 -0
- package/dist/features/3d/loaders/LoaderIO.d.ts +81 -0
- package/dist/features/3d/loaders/LoaderModel.d.ts +80 -0
- package/dist/features/3d/loaders/LoaderText.d.ts +27 -0
- package/dist/features/3d/loaders/MTLLoader.d.ts +105 -0
- package/dist/features/3d/loaders/OBJLoader.d.ts +70 -0
- package/dist/features/3d/loaders/PLYLoader.d.ts +47 -0
- package/dist/features/3d/loaders/STLLoader.d.ts +27 -0
- package/dist/features/3d/model/Camera.d.ts +33 -0
- package/dist/features/3d/model/Environment.d.ts +31 -0
- package/dist/features/3d/model/Geometry.d.ts +59 -0
- package/dist/features/3d/model/InstancedMesh.d.ts +134 -0
- package/dist/features/3d/model/LOD.d.ts +31 -0
- package/dist/features/3d/model/Light.d.ts +200 -0
- package/dist/features/3d/model/Material.d.ts +308 -0
- package/dist/features/3d/model/MaterialExtensions.d.ts +200 -0
- package/dist/features/3d/model/Mesh.d.ts +92 -0
- package/dist/features/3d/model/Node.d.ts +87 -0
- package/dist/features/3d/model/ReflectionProbe.d.ts +45 -0
- package/dist/features/3d/model/RenderTarget.d.ts +41 -0
- package/dist/features/3d/model/Scene.d.ts +173 -0
- package/dist/features/3d/model/Texture.d.ts +143 -0
- package/dist/features/3d/nodes/Nodes.d.ts +8 -0
- package/dist/features/3d/nodes/ShaderNode.d.ts +240 -0
- package/dist/features/3d/particles/GPUParticleSchedule.d.ts +67 -0
- package/dist/features/3d/particles/GPUParticleShaders.d.ts +19 -0
- package/dist/features/3d/particles/GPUParticleState.d.ts +106 -0
- package/dist/features/3d/particles/GPUParticleSystem.d.ts +192 -0
- package/dist/features/3d/particles/ParticleCurves.d.ts +34 -0
- package/dist/features/3d/particles/ParticleOptions.d.ts +78 -0
- package/dist/features/3d/particles/ParticleSystem.d.ts +368 -0
- package/dist/features/3d/physics/PhysicsBackend.d.ts +352 -0
- package/dist/features/3d/physics/PhysicsDebug.d.ts +24 -0
- package/dist/features/3d/physics/PhysicsWorld.d.ts +352 -0
- package/dist/features/3d/physics/basic/BasicCollision.d.ts +75 -0
- package/dist/features/3d/physics/basic/BasicPhysics.d.ts +24 -0
- package/dist/features/3d/physics/basic/BasicShapes.d.ts +103 -0
- package/dist/features/3d/physics/rapier/ContactBuffer.d.ts +32 -0
- package/dist/features/3d/physics/rapier/RapierBackend.d.ts +17 -0
- package/dist/features/3d/physics/rapier/RapierShapes.d.ts +4 -0
- package/dist/features/3d/physics/rapier/RapierWorld.d.ts +198 -0
- package/dist/features/3d/physics/rapier/Validation.d.ts +8 -0
- package/dist/features/3d/services/Background.d.ts +22 -0
- package/dist/features/3d/services/BasicShader.d.ts +55 -0
- package/dist/features/3d/services/ClusteredLights.d.ts +69 -0
- package/dist/features/3d/services/DrawOrder.d.ts +37 -0
- package/dist/features/3d/services/EffectsProcessor.d.ts +38 -0
- package/dist/features/3d/services/EnvironmentBRDF.d.ts +35 -0
- package/dist/features/3d/services/EnvironmentMaps.d.ts +55 -0
- package/dist/features/3d/services/FogShader.d.ts +6 -0
- package/dist/features/3d/services/Frustum.d.ts +7 -0
- package/dist/features/3d/services/GLState.d.ts +86 -0
- package/dist/features/3d/services/GPUPicker.d.ts +31 -0
- package/dist/features/3d/services/InstanceShader.d.ts +3 -0
- package/dist/features/3d/services/LineProgram.d.ts +32 -0
- package/dist/features/3d/services/PBRProgram.d.ts +115 -0
- package/dist/features/3d/services/Renderer.d.ts +50 -0
- package/dist/features/3d/services/Shader.d.ts +22 -0
- package/dist/features/3d/services/ShaderProgram.d.ts +38 -0
- package/dist/features/3d/services/ShadowMaps.d.ts +97 -0
- package/dist/features/3d/services/SpatialIndex.d.ts +16 -0
- package/dist/features/3d/services/TextureLoader.d.ts +40 -0
- package/dist/features/3d/services/TextureMipmaps.d.ts +42 -0
- package/dist/features/3d/services/ToneMapping.d.ts +12 -0
- package/dist/features/3d/services/WebGLRenderer.d.ts +261 -0
- package/dist/features/3d/splats/SplatData.d.ts +136 -0
- package/dist/features/3d/splats/SplatLoaders.d.ts +64 -0
- package/dist/features/3d/splats/SplatShader.d.ts +14 -0
- package/dist/features/3d/splats/SplatSort.d.ts +69 -0
- package/dist/features/3d/splats/Splats.d.ts +116 -0
- package/dist/features/3d/text/FontAtlas.d.ts +246 -0
- package/dist/features/3d/text/SDF.d.ts +28 -0
- package/dist/features/3d/text/Text.d.ts +179 -0
- package/dist/features/3d/text/TextLayout.d.ts +73 -0
- package/dist/features/3d/text/TextShader.d.ts +12 -0
- package/dist/features/3d/tiles/BoundingVolume.d.ts +43 -0
- package/dist/features/3d/tiles/Geodesy.d.ts +106 -0
- package/dist/features/3d/tiles/GlobeControls.d.ts +147 -0
- package/dist/features/3d/tiles/TileContent.d.ts +35 -0
- package/dist/features/3d/tiles/TileFormats.d.ts +77 -0
- package/dist/features/3d/tiles/Tiles3D.d.ts +236 -0
- package/dist/features/3d/tiles/Tileset.d.ts +81 -0
- package/dist/features/3d/tools/BatchedMesh.d.ts +74 -0
- package/dist/features/3d/tools/CanvasSurface.d.ts +81 -0
- package/dist/features/3d/tools/Color.d.ts +11 -0
- package/dist/features/3d/tools/MergeGeometries.d.ts +22 -0
- package/dist/features/3d/tools/Options.d.ts +15 -0
- package/dist/features/3d/tools/Polyhedra.d.ts +30 -0
- package/dist/features/3d/tools/PrimitiveBuffers.d.ts +42 -0
- package/dist/features/3d/tools/Primitives.d.ts +164 -0
- package/dist/features/3d/tools/Ready.d.ts +12 -0
- package/dist/features/3d/tools/SpatialMath.d.ts +57 -0
- package/dist/features/3d/tools/SphericalHarmonics.d.ts +9 -0
- package/dist/features/3d/tools/math/mat3.d.ts +7 -0
- package/dist/features/3d/tools/math/mat4.d.ts +19 -0
- package/dist/features/3d/tools/math/quat.d.ts +6 -0
- package/dist/features/3d/tools/math/vec3.d.ts +16 -0
- package/dist/features/3d/tools/math/vec4.d.ts +5 -0
- package/dist/features/3d/types.d.ts +359 -0
- package/dist/features/3d/usdz/USDAParser.d.ts +50 -0
- package/dist/features/3d/usdz/USDScene.d.ts +20 -0
- package/dist/features/3d/usdz/USDZLoader.d.ts +27 -0
- package/dist/features/3d/usdz/ZipReader.d.ts +16 -0
- package/dist/features/3d/webgpu/Backend.d.ts +40 -0
- package/dist/features/3d/webgpu/BasicShader.d.ts +10 -0
- package/dist/features/3d/webgpu/Constants.d.ts +32 -0
- package/dist/features/3d/webgpu/Deformation.d.ts +71 -0
- package/dist/features/3d/webgpu/Environment.d.ts +66 -0
- package/dist/features/3d/webgpu/Features.d.ts +68 -0
- package/dist/features/3d/webgpu/Layouts.d.ts +27 -0
- package/dist/features/3d/webgpu/Lines.d.ts +40 -0
- package/dist/features/3d/webgpu/LitExtras.d.ts +46 -0
- package/dist/features/3d/webgpu/LitFeatures.d.ts +41 -0
- package/dist/features/3d/webgpu/LitScene.d.ts +60 -0
- package/dist/features/3d/webgpu/LitShader.d.ts +68 -0
- package/dist/features/3d/webgpu/Particles.d.ts +114 -0
- package/dist/features/3d/webgpu/Picking.d.ts +59 -0
- package/dist/features/3d/webgpu/PipelineKey.d.ts +33 -0
- package/dist/features/3d/webgpu/Points.d.ts +41 -0
- package/dist/features/3d/webgpu/Probes.d.ts +45 -0
- package/dist/features/3d/webgpu/ShaderChunks.d.ts +18 -0
- package/dist/features/3d/webgpu/ShaderMaterial.d.ts +57 -0
- package/dist/features/3d/webgpu/ShaderMaterialSource.d.ts +5 -0
- package/dist/features/3d/webgpu/Shadows.d.ts +49 -0
- package/dist/features/3d/webgpu/Splats.d.ts +47 -0
- package/dist/features/3d/webgpu/Textures.d.ts +52 -0
- package/dist/features/3d/webgpu/Transmission.d.ts +30 -0
- package/dist/features/3d/webgpu/UniformLayout.d.ts +30 -0
- package/dist/features/3d/webgpu/UtilityShaders.d.ts +38 -0
- package/dist/features/3d/webgpu/WebGPURenderer.d.ts +327 -0
- package/dist/features/3d/webgpu/effects/EffectsShaders.d.ts +74 -0
- package/dist/features/3d/webgpu/effects/WebGPUEffects.d.ts +140 -0
- package/dist/features/3d/xr/XR.d.ts +100 -0
- package/dist/gltf-By-n0qEg.js +960 -0
- package/dist/index.d.ts +86 -81
- package/dist/model/document-actions/document-commands.d.ts +18 -0
- package/dist/model/documents/svg/create-svg-document-renderer.d.ts +32 -0
- package/dist/model/documents/svg/export-svg-document.d.ts +5 -0
- package/dist/model/documents/svg/import-svg-document.d.ts +6 -0
- package/dist/model/documents/svg/svg-document.types.d.ts +111 -0
- package/dist/model/documents/svg/svg-values.d.ts +16 -0
- package/dist/model/documents/svg/svg-xml.d.ts +18 -0
- package/dist/model/input/NovaInputProxy_Adapter.d.ts +2 -1
- package/dist/model/input/NovaInputValidationController.d.ts +1 -1
- package/dist/model/input/NovaTextInputController.d.ts +1 -1
- package/dist/model/input/NovaTextLayoutEngine.d.ts +2 -6
- package/dist/model/input/index.d.ts +7 -7
- package/dist/model/input/nova-input.types.d.ts +1 -1
- package/dist/model/lighting/LightingRenderer2D.d.ts +58 -0
- package/dist/model/lighting/NovaLighting2D.d.ts +56 -0
- package/dist/model/lighting/lighting-shaders.d.ts +3 -0
- package/dist/model/lighting/lighting-state.d.ts +27 -0
- package/dist/model/lighting/lighting.types.d.ts +107 -0
- package/dist/model/lottie/LottieNode.d.ts +4 -0
- package/dist/model/lottie/lottie.types.d.ts +83 -0
- package/dist/model/lottie/prepare-lottie.d.ts +3 -0
- package/dist/model/lottie/sample-position.d.ts +9 -0
- package/dist/model/motion/NovaMotionEngine.d.ts +3 -3
- package/dist/model/motion/nova-motion-easing.d.ts +1 -1
- package/dist/model/motion/nova-motion-interpolation.d.ts +1 -1
- package/dist/model/motion/nova-motion-presets.d.ts +2 -2
- package/dist/model/motion/nova-motion-timeline.d.ts +1 -1
- package/dist/model/platform/NovaCanvas.d.ts +7 -6
- package/dist/model/primitives/NovaPrimitiveUnsupportedError.d.ts +13 -0
- package/dist/model/primitives/definePrimitive.d.ts +5 -0
- package/dist/model/primitives/primitive.types.d.ts +28 -0
- package/dist/model/render/backends/canvas2d/NovaCanvas2DTargetManager.d.ts +3 -3
- package/dist/model/render/backends/canvas2d/NovaRenderer2D.d.ts +61 -15
- package/dist/model/render/backends/canvas2d/nova-canvas-blend.d.ts +5 -0
- package/dist/model/render/backends/nova-render-backend-factory.d.ts +6 -6
- package/dist/model/render/backends/nova-render-backend.d.ts +8 -2
- package/dist/model/render/backends/webgl/NovaRendererWebGL.d.ts +32 -11
- package/dist/model/render/backends/webgl/NovaStreamCacheIdleLedger.d.ts +12 -1
- package/dist/model/render/backends/webgl/NovaWebGLBatcher.d.ts +1 -1
- package/dist/model/render/backends/webgl/NovaWebGLCircleImagePass.d.ts +23 -0
- package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +9 -0
- package/dist/model/render/backends/webgl/NovaWebGLDevice.d.ts +3 -1
- package/dist/model/render/backends/webgl/NovaWebGLDiagnostics.d.ts +1 -1
- package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +162 -53
- package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +13 -0
- package/dist/model/render/backends/webgl/NovaWebGLPathUnion.d.ts +23 -0
- package/dist/model/render/compiler/NovaRenderBuilder.d.ts +24 -10
- package/dist/model/render/compiler/NovaRenderCommandWriter.d.ts +10 -5
- package/dist/model/render/compiler/NovaRenderCompiler.d.ts +7 -6
- package/dist/model/render/compiler/NovaRenderFrameBuilder.d.ts +4 -3
- package/dist/model/render/effects/blur.d.ts +8 -0
- package/dist/model/render/effects/color-matrix.d.ts +8 -0
- package/dist/model/render/effects/drop-shadow.d.ts +18 -0
- package/dist/model/render/effects/nova-effect-registry.d.ts +66 -0
- package/dist/model/render/effects/nova-gaussian-kernel.d.ts +7 -0
- package/dist/model/render/effects/nova-gaussian-textures.d.ts +11 -0
- package/dist/model/render/effects/shader-effect.d.ts +64 -0
- package/dist/model/render/geometry/nova-alpha-mask.d.ts +5 -0
- package/dist/model/render/geometry/nova-composition.d.ts +9 -0
- package/dist/model/render/geometry/nova-node-clip.d.ts +17 -0
- package/dist/model/render/geometry/nova-path-geometry.d.ts +24 -0
- package/dist/model/render/geometry/nova-path-tessellation.d.ts +7 -0
- package/dist/model/render/geometry/nova-polygon-triangulation.d.ts +1 -1
- package/dist/model/render/graph/NovaRectBatchBuffer.d.ts +58 -0
- package/dist/model/render/graph/NovaRenderGraph.d.ts +40 -6
- package/dist/model/render/graph/NovaRenderHitIndex.d.ts +1 -1
- package/dist/model/render/graph/nova-auto-rect.d.ts +1 -1
- package/dist/model/render/graph/nova-linear-rect-repack.d.ts +4 -4
- package/dist/model/render/graph/nova-linear-rect-transition.d.ts +2 -2
- package/dist/model/render/graph/nova-render-culling.d.ts +2 -2
- package/dist/model/render/graph/nova-render-dirty-items.d.ts +1 -1
- package/dist/model/render/graph/nova-render-group.d.ts +1 -1
- package/dist/model/render/graph/nova-render-item.d.ts +2 -2
- package/dist/model/render/graph/nova-render-layer.d.ts +1 -1
- package/dist/model/render/graph/nova-render-payload-snapshot.d.ts +3 -1
- package/dist/model/render/graph/nova-render-program.d.ts +5 -3
- package/dist/model/render/graph/nova-render-sequence.d.ts +1 -1
- package/dist/model/render/graph/nova-render-stream.d.ts +2 -2
- package/dist/model/render/ktx2/BasisSession.d.ts +45 -0
- package/dist/model/render/ktx2/KTX2Container.d.ts +26 -0
- package/dist/model/render/ktx2/KTX2Loader.d.ts +55 -0
- package/dist/model/render/meshes/MeshNode.d.ts +13 -0
- package/dist/model/render/meshes/NovaMeshWebGLDevice.d.ts +27 -0
- package/dist/model/render/meshes/geometry.d.ts +7 -0
- package/dist/model/render/meshes/mesh.d.ts +3 -0
- package/dist/model/render/meshes/mesh.types.d.ts +116 -0
- package/dist/model/render/meshes/nova-mesh-registry.d.ts +55 -0
- package/dist/model/render/orchestration/NovaRenderOrchestrator.d.ts +25 -3
- package/dist/model/render/policy/nova-render-policy.d.ts +1 -1
- package/dist/model/render/resources/NovaGlyphAtlasManager.d.ts +2 -2
- package/dist/model/render/resources/NovaTextAtlasManager.d.ts +3 -3
- package/dist/model/render/resources/NovaTextLayoutEngine.d.ts +1 -1
- package/dist/model/render/resources/nova-bitmap-upload.d.ts +10 -0
- package/dist/model/render/schema/NovaRenderContext.d.ts +6 -4
- package/dist/model/render/schema/nova-style-compiler.d.ts +5 -2
- package/dist/model/render/targets/NovaNodeRenderTextureSource.d.ts +29 -0
- package/dist/model/render/targets/NovaRenderTargetManager.d.ts +1 -1
- package/dist/model/render/targets/NovaRenderTexture.d.ts +57 -0
- package/dist/model/render/targets/nova-render-target-refs.d.ts +5 -0
- package/dist/model/render/targets/nova-render-target-resource.d.ts +1 -1
- package/dist/model/render/targets/nova-render-texture-runtime.d.ts +71 -0
- package/dist/model/render/textures/nova-compressed-image.d.ts +20 -0
- package/dist/model/render/utils/nova-icon-rendering.d.ts +3 -1
- package/dist/model/render/utils/nova-image-geometry.d.ts +11 -0
- package/dist/model/render/utils/nova-markdown-layout.d.ts +19 -0
- package/dist/model/render/utils/nova-text-paint.d.ts +26 -0
- package/dist/model/render/utils/nova-wrapped-text-layout.d.ts +19 -0
- package/dist/model/runtime/app/Nova.d.ts +35 -35
- package/dist/model/runtime/app/NovaApp.d.ts +58 -30
- package/dist/model/runtime/app/NovaRaphRuntime.d.ts +2 -2
- package/dist/model/runtime/app/createNovaRaphRuntime.d.ts +3 -3
- package/dist/model/runtime/assets/NovaAssetRegistry.d.ts +89 -2
- package/dist/model/runtime/assets/NovaVideoTexture.d.ts +38 -0
- package/dist/model/runtime/assets/nova-render-texture-image-identity.d.ts +4 -0
- package/dist/model/runtime/commands/NovaCommandBus.d.ts +1 -1
- package/dist/model/runtime/components/NovaComponentNode.d.ts +6 -6
- package/dist/model/runtime/components/NovaComponentRegistry.d.ts +1 -1
- package/dist/model/runtime/components/NovaSchemaRegistry.d.ts +7 -6
- package/dist/model/runtime/components/nova-component-metadata.d.ts +1 -1
- package/dist/model/runtime/components/nova-component.decorator.d.ts +2 -2
- package/dist/model/runtime/components/nova-defined-component.d.ts +3 -3
- package/dist/model/runtime/context/nova-context.d.ts +1 -1
- package/dist/model/runtime/cursor/NovaCursorManager.d.ts +3 -3
- package/dist/model/runtime/diagnostics/NovaDiagnostics_Module.d.ts +3 -3
- package/dist/model/runtime/interaction/NovaEvents.d.ts +16 -6
- package/dist/model/runtime/interaction/NovaHitIndex.d.ts +1 -1
- package/dist/model/runtime/interaction/NovaSpatialIndex.d.ts +2 -2
- package/dist/model/runtime/scene/NovaScene.d.ts +3 -3
- package/dist/model/runtime/scene/nova-scene-components.d.ts +6 -6
- package/dist/model/runtime/state/nova-store-decorators.d.ts +1 -1
- package/dist/model/runtime/state/nova-store-runtime.d.ts +1 -1
- package/dist/model/runtime/state/nova-store-tracking.d.ts +7 -3
- package/dist/model/runtime/sync/NovaSyncScope.d.ts +11 -2
- package/dist/model/runtime/sync/nova-sync-context.d.ts +2 -2
- package/dist/model/runtime/sync/nova-sync-ports.d.ts +2 -2
- package/dist/model/runtime/sync/nova-sync.types.d.ts +15 -3
- package/dist/model/runtime/template/NovaTemplateRuntime.d.ts +6 -6
- package/dist/model/runtime/tree/NovaContainer.d.ts +4 -4
- package/dist/model/runtime/tree/NovaNode.d.ts +58 -18
- package/dist/model/runtime/tree/NovaRaphNode.d.ts +8 -2
- package/dist/model/runtime/tree/NovaSurface.d.ts +32 -10
- package/dist/model/runtime/tree/nova-node-capture-invalidation.d.ts +11 -0
- package/dist/model/semantic/NovaSemanticService.d.ts +1 -1
- package/dist/model/semantic/browser/createAccessibilityBridge.d.ts +29 -0
- package/dist/model/sound/NovaSoundEngine.d.ts +3 -2
- package/dist/model/text-selection/NovaTextSelectionService.d.ts +2 -2
- package/dist/model/text-selection/index.d.ts +2 -2
- package/dist/model/text-selection/nova-text-selection.types.d.ts +1 -1
- package/dist/model/theme/NovaGlobalThemeRegistry.d.ts +2 -2
- package/dist/model/theme/NovaThemeService.d.ts +5 -3
- package/dist/model/theme/createTokenTheme.d.ts +15 -0
- package/dist/model/tools/transform-tools.d.ts +43 -0
- package/dist/nodes--Ds4IS2h.js +621 -0
- package/dist/nova-color-parser-BCN_rFRN.js +250 -0
- package/dist/nova-compressed-image-CE2Ya9Xa.js +46 -0
- package/dist/nova-mesh-registry-B7Xz5mhU.js +24 -0
- package/dist/nova-render-texture-image-identity-DQ09XFKs.js +15 -0
- package/dist/nova-text-paint-CcntsRjI.js +48 -0
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.js +50 -0
- package/dist/vec4-BTNv1fUp.js +20 -0
- package/package.json +223 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Nova3DEnvironment } from '../model/Environment.js';
|
|
2
|
+
export interface EnvironmentResident3D {
|
|
3
|
+
readonly diffuse: GPUTexture;
|
|
4
|
+
readonly specular: GPUTexture;
|
|
5
|
+
readonly diffuseView: GPUTextureView;
|
|
6
|
+
readonly specularView: GPUTextureView;
|
|
7
|
+
readonly version: number;
|
|
8
|
+
}
|
|
9
|
+
/** One mip pass of a cube face: the level above as a cube view, the face and the target level. */
|
|
10
|
+
export interface CubeMipPass3D {
|
|
11
|
+
readonly group: GPUBindGroup;
|
|
12
|
+
readonly face: number;
|
|
13
|
+
readonly target: GPUTextureView;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The passes of EnvironmentMaps.ts on WebGPU, shared by environments and
|
|
17
|
+
* reflection probes: equirect to cube, the cube's mip chain, and the filtered
|
|
18
|
+
* importance-sampled irradiance (32²) and roughness (128², 8 levels) cubes.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CubeFilter3D {
|
|
21
|
+
private readonly _device;
|
|
22
|
+
private _prefilter?;
|
|
23
|
+
private _convert?;
|
|
24
|
+
private _mip?;
|
|
25
|
+
/** Face, mode, roughness and size of every prefilter pass; they never change. */
|
|
26
|
+
private _uniforms?;
|
|
27
|
+
/** Face and size of the six conversion passes, rewritten per conversion. */
|
|
28
|
+
private _convertUniforms?;
|
|
29
|
+
private readonly _convertData;
|
|
30
|
+
private _sampler?;
|
|
31
|
+
private readonly _offsets;
|
|
32
|
+
constructor(_device: GPUDevice);
|
|
33
|
+
/** Bind group of a mipmapped radiance cube for `prefilter`. */
|
|
34
|
+
prefilterGroup(source: GPUTextureView): GPUBindGroup;
|
|
35
|
+
/** Views and bind groups that rebuild levels 1… of every face of `cube` from level 0 (WebGL mode 3). */
|
|
36
|
+
mipPasses(cube: GPUTexture, count: number): CubeMipPass3D[];
|
|
37
|
+
/** Encodes the conversion of an equirect into level 0 of `cube` (`size`² faces); returns the pass count. */
|
|
38
|
+
convert(encoder: GPUCommandEncoder, cube: GPUTexture, size: number, source: GPUTextureView, sampler: GPUSampler): number;
|
|
39
|
+
/** Encodes `mipPasses` (box average of the level above); returns the pass count. */
|
|
40
|
+
mipmaps(encoder: GPUCommandEncoder, list: readonly CubeMipPass3D[]): number;
|
|
41
|
+
/** Encodes the irradiance and roughness passes from a `prefilterGroup`; returns the pass count. */
|
|
42
|
+
prefilter(encoder: GPUCommandEncoder, group: GPUBindGroup, diffuse: GPUTexture, specular: GPUTexture): number;
|
|
43
|
+
reset(lost: boolean): void;
|
|
44
|
+
private _ensure;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Irradiance (32²) and roughness-filtered (128², 8 levels) RGBA16F cubes of an
|
|
48
|
+
* equirect source, filtered by the EnvironmentMaps.ts passes; at most four resident.
|
|
49
|
+
*/
|
|
50
|
+
export declare class WebGPUEnvironments3D {
|
|
51
|
+
private readonly _device;
|
|
52
|
+
private readonly _residents;
|
|
53
|
+
private _passes;
|
|
54
|
+
/** Shared with the reflection probes. */
|
|
55
|
+
readonly filter: CubeFilter3D;
|
|
56
|
+
constructor(_device: GPUDevice);
|
|
57
|
+
get bytes(): number;
|
|
58
|
+
consumePasses(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Prefilters on first use and after source changes; `source`, `sampler` and
|
|
61
|
+
* `width` belong to the equirect texture.
|
|
62
|
+
*/
|
|
63
|
+
ensure(environment: Nova3DEnvironment, source: GPUTextureView, sampler: GPUSampler, width: number): EnvironmentResident3D;
|
|
64
|
+
release(environment: Nova3DEnvironment): void;
|
|
65
|
+
reset(lost: boolean): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering backend of an app.
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
|
+
export type Backend3D = 'webgl2' | 'webgpu';
|
|
6
|
+
/**
|
|
7
|
+
* Backend request of `createAppAsync`: 'auto' prefers WebGPU and falls back to WebGL2.
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export type BackendRequest3D = Backend3D | 'auto';
|
|
11
|
+
/**
|
|
12
|
+
* What the app's backend can draw. Unsupported features fail with a clear
|
|
13
|
+
* `[Nova3D] … is not supported on the WebGPU backend yet.` error instead of
|
|
14
|
+
* rendering something different.
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
export interface BackendFeatures3D {
|
|
18
|
+
readonly backend: Backend3D;
|
|
19
|
+
/** PBR metallic-roughness with base colour, metal-rough, normal, occlusion and emissive maps. */
|
|
20
|
+
readonly pbr: boolean;
|
|
21
|
+
/** Lambert, Phong and toon materials. */
|
|
22
|
+
readonly classicMaterials: boolean;
|
|
23
|
+
/** Basic, matcap, normal and depth materials, billboards and sprite sheets. */
|
|
24
|
+
readonly unlitMaterials: boolean;
|
|
25
|
+
/** Directional, point and spot lights in the uniform set (up to 16). */
|
|
26
|
+
readonly punctualLights: boolean;
|
|
27
|
+
/** Ambient, hemisphere and light-probe irradiance. */
|
|
28
|
+
readonly ambientLights: boolean;
|
|
29
|
+
/** Shadow maps with hard and PCF filtering, cascades and point-light cubes. */
|
|
30
|
+
readonly shadows: boolean;
|
|
31
|
+
/** Percentage-closer soft shadows. */
|
|
32
|
+
readonly softShadows: boolean;
|
|
33
|
+
/** Prefiltered environment lighting and environment, texture and colour backgrounds. */
|
|
34
|
+
readonly imageBasedLighting: boolean;
|
|
35
|
+
readonly fog: boolean;
|
|
36
|
+
readonly lightMaps: boolean;
|
|
37
|
+
readonly instancing: boolean;
|
|
38
|
+
readonly renderTargets: boolean;
|
|
39
|
+
readonly multipleViews: boolean;
|
|
40
|
+
readonly toneMapping: boolean;
|
|
41
|
+
readonly msaa: boolean;
|
|
42
|
+
/** Post-processing stacks of `@nova-lab/core/3d/effects`. */
|
|
43
|
+
readonly postEffects: boolean;
|
|
44
|
+
/** More than 16 point and spot lights binned into clusters. */
|
|
45
|
+
readonly clusteredLights: boolean;
|
|
46
|
+
readonly areaLights: boolean;
|
|
47
|
+
readonly reflectionProbes: boolean;
|
|
48
|
+
/** KHR material extensions (clearcoat, sheen, transmission, …) other than emissive strength. */
|
|
49
|
+
readonly pbrExtensions: boolean;
|
|
50
|
+
readonly skinning: boolean;
|
|
51
|
+
readonly morphTargets: boolean;
|
|
52
|
+
/** Wide line materials and point primitives (1-pixel 'lines' geometry draws on both backends). */
|
|
53
|
+
readonly lineMaterials: boolean;
|
|
54
|
+
readonly points: boolean;
|
|
55
|
+
/** Shader materials: GLSL on WebGL2; on WebGPU only materials with a `wgsl` twin (experimental). */
|
|
56
|
+
readonly shaderMaterials: boolean;
|
|
57
|
+
readonly gpuPicking: boolean;
|
|
58
|
+
/** WebXR sessions. WebGPU needs the WebXR/WebGPU binding (XRGPUBinding), which browsers do not expose yet. */
|
|
59
|
+
readonly xr: boolean;
|
|
60
|
+
/** Node-graph surfaces of `@nova-lab/core/3d/nodes`. */
|
|
61
|
+
readonly nodeMaterials: boolean;
|
|
62
|
+
/** Gaussian splats and GPU particles (attribute-free instanced draws). */
|
|
63
|
+
readonly splatsAndGpuParticles: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare const webgl2Features3D: BackendFeatures3D;
|
|
66
|
+
export declare const webgpuFeatures3D: BackendFeatures3D;
|
|
67
|
+
/** The error every unsupported WebGPU feature throws. */
|
|
68
|
+
export declare function unsupportedOnWebGPU3D(subject: string, plural?: boolean): Error;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Most punctual lights and shadow sources in the uniform set, as in the WebGL PBR program. */
|
|
2
|
+
export declare const maxLights3D = 16;
|
|
3
|
+
export declare const maxShadows3D = 4;
|
|
4
|
+
/**
|
|
5
|
+
* Per-view block (group 0, dynamic offset): camera, display encoding, scene
|
|
6
|
+
* lights, shadows, ambient irradiance, environment and background.
|
|
7
|
+
*/
|
|
8
|
+
export declare const viewLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
9
|
+
/** Per-mesh block (group 2, dynamic offset). */
|
|
10
|
+
export declare const objectLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
11
|
+
/** Lit material block (group 1). */
|
|
12
|
+
export declare const litMaterialLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
13
|
+
/** Unlit material block (group 1). */
|
|
14
|
+
export declare const basicMaterialLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
15
|
+
/** Shadow caster material block (group 1 of the shadow pass). */
|
|
16
|
+
export declare const casterLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
17
|
+
/** View-projection of one shadow face (group 0 of the shadow pass, dynamic offset). */
|
|
18
|
+
export declare const shadowViewLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
19
|
+
/** Display pass of the linear canvas target. */
|
|
20
|
+
export declare const displayLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
21
|
+
/** One environment prefilter pass (dynamic offset). */
|
|
22
|
+
export declare const prefilterLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
23
|
+
export declare const viewFloats3D: Readonly<Record<string, number>>;
|
|
24
|
+
export declare const objectFloats3D: Readonly<Record<string, number>>;
|
|
25
|
+
export declare const litMaterialFloats3D: Readonly<Record<string, number>>;
|
|
26
|
+
export declare const basicMaterialFloats3D: Readonly<Record<string, number>>;
|
|
27
|
+
export declare const casterFloats3D: Readonly<Record<string, number>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Nova3DGeometry } from '../model/Geometry.js';
|
|
2
|
+
import { LineMaterialState3D } from '../model/Material.js';
|
|
3
|
+
import { Nova3DMesh } from '../model/Mesh.js';
|
|
4
|
+
import { LineVariant3D } from '../services/LineProgram.js';
|
|
5
|
+
/** Line material block (group 1 of line pipelines). */
|
|
6
|
+
export declare const lineMaterialLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
7
|
+
/**
|
|
8
|
+
* WGSL of a wide-line variant: LineProgram.ts term for term (one six-vertex
|
|
9
|
+
* quad per segment instance, near-plane clipping in view space, round caps
|
|
10
|
+
* and dashes in the fragment stage). GL takes flat varyings from the last
|
|
11
|
+
* vertex of a triangle and WebGPU from the first, so the quad's first and
|
|
12
|
+
* fourth vertices carry the half width GL reads from the third and sixth.
|
|
13
|
+
*/
|
|
14
|
+
export declare function lineShaderSource3D(variant: Omit<LineVariant3D, 'direct'>): string;
|
|
15
|
+
/** Builds a scene pipeline descriptor for a layout, module, vertex buffers and state key. */
|
|
16
|
+
export type LinePipelineDescriptor3D = (layout: GPUPipelineLayout, module: GPUShaderModule, buffers: GPUVertexBufferLayout[], stateKey: number) => GPURenderPipelineDescriptor;
|
|
17
|
+
/**
|
|
18
|
+
* Wide line materials on WebGPU: packed segment instances per geometry
|
|
19
|
+
* revision, a uniform block per material and pipelines per variant and state.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WebGPULines3D {
|
|
22
|
+
private readonly _device;
|
|
23
|
+
readonly layout: GPUBindGroupLayout;
|
|
24
|
+
private readonly _segments;
|
|
25
|
+
private _materials;
|
|
26
|
+
private readonly _shaders;
|
|
27
|
+
private _pipelineLayout?;
|
|
28
|
+
private readonly _data;
|
|
29
|
+
private readonly _variant;
|
|
30
|
+
bytes: number;
|
|
31
|
+
uploads: number;
|
|
32
|
+
constructor(_device: GPUDevice);
|
|
33
|
+
/** Packs the segments and writes the material block of a line mesh. */
|
|
34
|
+
prepare(node: Nova3DMesh, options: Readonly<LineMaterialState3D>): void;
|
|
35
|
+
/** Draws a prepared line mesh; groups 0 and 2 are bound by the caller. Returns false without segments. */
|
|
36
|
+
draw(pass: GPURenderPassEncoder, node: Nova3DMesh, options: Readonly<LineMaterialState3D>, fog: number, stateKey: number, view: GPUBindGroupLayout, object: GPUBindGroupLayout, descriptor: LinePipelineDescriptor3D): boolean;
|
|
37
|
+
release(geometry: Nova3DGeometry): void;
|
|
38
|
+
reset(lost: boolean): void;
|
|
39
|
+
private _upload;
|
|
40
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitMaterialState3D } from '../model/Material.js';
|
|
2
|
+
import { Nova3DTexture } from '../model/Texture.js';
|
|
3
|
+
interface LitMaterial3D {
|
|
4
|
+
_extensions: () => {
|
|
5
|
+
readonly id: number;
|
|
6
|
+
readonly units: readonly Nova3DTexture[];
|
|
7
|
+
readonly slots: readonly Float32Array[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Group 1 of PBR materials with KHR extensions or node surfaces: the base lit
|
|
12
|
+
* bindings plus a LitExtras block (extension factors, extension map transforms,
|
|
13
|
+
* node uniforms), up to four extension textures and up to four node textures.
|
|
14
|
+
* Layouts are cached per shape; node uniform values upload when they change.
|
|
15
|
+
*/
|
|
16
|
+
export declare class WebGPULitExtras3D {
|
|
17
|
+
private readonly _device;
|
|
18
|
+
private readonly _base;
|
|
19
|
+
private readonly _groups;
|
|
20
|
+
private readonly _layouts;
|
|
21
|
+
private readonly _pipelines;
|
|
22
|
+
private _residents;
|
|
23
|
+
/** Bytes of node uniforms uploaded since the last consume. */
|
|
24
|
+
uploads: number;
|
|
25
|
+
constructor(_device: GPUDevice, _base: readonly GPUBindGroupLayoutEntry[], _groups: {
|
|
26
|
+
view: GPUBindGroupLayout;
|
|
27
|
+
object: GPUBindGroupLayout;
|
|
28
|
+
scene: GPUBindGroupLayout;
|
|
29
|
+
});
|
|
30
|
+
layout(units: number, textures: number): GPUBindGroupLayout;
|
|
31
|
+
pipelineLayout(units: number, textures: number): GPUPipelineLayout;
|
|
32
|
+
/**
|
|
33
|
+
* Writes extension factors when the options change and node uniforms when
|
|
34
|
+
* their values change; resolves extension and node texture views through
|
|
35
|
+
* `view`. Returns true when a texture view changed (the bind group must be rebuilt).
|
|
36
|
+
*/
|
|
37
|
+
prepare(material: LitMaterial3D & object, options: Readonly<LitMaterialState3D>, view: (texture: Nova3DTexture) => GPUTextureView): boolean;
|
|
38
|
+
/** Appends the extras, extension and node entries of `material` to its base entries. */
|
|
39
|
+
entries(material: LitMaterial3D & object, options: Readonly<LitMaterialState3D>, entries: GPUBindGroupEntry[], sampler: (texture: Nova3DTexture) => GPUSampler): void;
|
|
40
|
+
reset(): void;
|
|
41
|
+
}
|
|
42
|
+
/** PBR extensions other than emissive strength (which the base material block carries). */
|
|
43
|
+
export declare function shadedExtensions3D(options: Readonly<LitMaterialState3D>): boolean;
|
|
44
|
+
/** Materials drawn through the extended group: shaded extensions or a node surface. */
|
|
45
|
+
export declare function extendedMaterial3D(options: Readonly<LitMaterialState3D>): boolean;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { UniformLayout3D } from './UniformLayout.js';
|
|
2
|
+
/**
|
|
3
|
+
* Lit shader features beyond phase 1: PBR extensions, clustered and area
|
|
4
|
+
* lights, reflection probes, transmission and node surfaces. The WGSL below
|
|
5
|
+
* ports the matching PBRProgram.ts GLSL statement by statement.
|
|
6
|
+
*/
|
|
7
|
+
/** Feature flags, map units and UV sets of an interned extension layout. */
|
|
8
|
+
export interface ExtensionInfo3D {
|
|
9
|
+
readonly dielectric: boolean;
|
|
10
|
+
readonly specular: boolean;
|
|
11
|
+
readonly clearcoat: boolean;
|
|
12
|
+
readonly sheen: boolean;
|
|
13
|
+
readonly iridescence: boolean;
|
|
14
|
+
readonly anisotropy: boolean;
|
|
15
|
+
readonly transmission: boolean;
|
|
16
|
+
/** Distinct extension textures (bindings). */
|
|
17
|
+
readonly units: number;
|
|
18
|
+
/** Unit of each map in extensionMapNames3D order, −1 when absent. */
|
|
19
|
+
readonly mapUnits: readonly number[];
|
|
20
|
+
/** Bit k: unit k samples the second UV set. */
|
|
21
|
+
readonly sets: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function extensionInfo3D(id: number): ExtensionInfo3D;
|
|
24
|
+
export declare function litExtrasLayout3D(nodeUniforms: number): UniformLayout3D;
|
|
25
|
+
/**
|
|
26
|
+
* Group 3 block of lit and shader-material draws (dynamic offset per view and
|
|
27
|
+
* reflection probe): projection, probe box, environment, clusters, transmission.
|
|
28
|
+
*/
|
|
29
|
+
export declare const litSceneLayout3D: UniformLayout3D;
|
|
30
|
+
/** Bindings of group 3 in the lit shaders. */
|
|
31
|
+
export declare const litSceneBindingsWGSL3D = "@group(3) @binding(0) var<uniform> scene: LitScene;\n@group(3) @binding(1) var<storage, read> clusterData: array<vec4u>;\n@group(3) @binding(2) var transmissionMap: texture_2d<f32>;\n@group(3) @binding(3) var areaTables: texture_2d_array<f32>;";
|
|
32
|
+
/** Screen-derivative tangent frame (PBRProgram surfaceTangents); `ok` is false for degenerate UVs. */
|
|
33
|
+
export declare const tangentsWGSL3D = "struct Tangents { T: vec3f, B: vec3f, ok: bool }\nfn surfaceTangents(t1: vec2f, t2: vec2f, q1: vec3f, q2: vec3f, n: vec3f) -> Tangents {\n let determinant = t1.x * t2.y - t1.y * t2.x;\n var tangent = q1 * t2.y - q2 * t1.y;\n tangent -= n * dot(n, tangent);\n if (abs(determinant) <= 1e-10 || dot(tangent, tangent) <= 1e-12) {\n let T = normalize(cross(select(vec3f(1.0, 0.0, 0.0), vec3f(0.0, 1.0, 0.0), abs(n.y) < 0.99), n));\n return Tangents(T, cross(n, T), false);\n }\n let T = normalize(tangent) * sign(determinant);\n return Tangents(T, normalize(cross(n, T)) * sign(determinant), true);\n}";
|
|
34
|
+
export declare const sheenWGSL3D = "fn sheenDistribution(alpha: f32, NoH: f32) -> f32 {\n let inverse = 1.0 / alpha;\n let cos2 = NoH * NoH;\n let sin2 = max(1.0 - cos2, 0.0078125);\n return (2.0 + inverse) * pow(sin2, inverse * 0.5) / (2.0 * PI);\n}\nfn sheenEnvironment(NoV: f32, roughness: f32) -> f32 {\n let r2 = roughness * roughness;\n let a = select(-8.48 * r2 + 14.3 * roughness - 9.95, -339.2 * r2 + 161.4 * roughness - 25.9, roughness < 0.25);\n let b = select(1.97 * r2 - 3.27 * roughness + 0.72, 44.0 * r2 - 23.7 * roughness + 3.26, roughness < 0.25);\n return min(exp(a * NoV + b) + select(0.1 * (roughness - 0.25), 0.0, roughness < 0.25), PI);\n}";
|
|
35
|
+
export declare const iridescenceWGSL3D = "fn schlick1(f0: f32, f90: f32, c: f32) -> f32 {\n return f0 + (f90 - f0) * pow(1.0 - c, 5.0);\n}\nfn schlick3(f0: vec3f, f90: f32, c: f32) -> vec3f {\n return f0 + (f90 - f0) * pow(1.0 - c, 5.0);\n}\nfn iridescenceSensitivity(opd: f32, shift: vec3f) -> vec3f {\n let phase = 2.0 * PI * opd * 1.0e-9;\n let val = vec3f(5.4856e-13, 4.4201e-13, 5.2481e-13);\n let pos = vec3f(1.6810e+06, 1.7953e+06, 2.2084e+06);\n let spread = vec3f(4.3278e+09, 9.3046e+09, 6.6121e+09);\n var xyz = val * sqrt(2.0 * PI * spread) * cos(pos * phase + shift) * exp(-phase * phase * spread);\n xyz.x += 9.7470e-14 * sqrt(2.0 * PI * 4.5282e+09) * cos(2.2399e+06 * phase + shift.x) * exp(-4.5282e+09 * phase * phase);\n xyz /= 1.0685e-7;\n return mat3x3f(3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, -0.4985314, 0.0415560, 1.0572252) * xyz;\n}\nfn iridescenceFresnel(outside: f32, film: f32, cosine: f32, thickness: f32, baseF0: vec3f) -> vec3f {\n let eta = mix(outside, film, smoothstep(0.0, 0.03, thickness));\n let sin2 = (outside / eta) * (outside / eta) * (1.0 - cosine * cosine);\n let cos2 = 1.0 - sin2;\n if (cos2 < 0.0) {\n return vec3f(1.0);\n }\n let cosine2 = sqrt(cos2);\n var r0 = (eta - outside) / (eta + outside);\n r0 *= r0;\n let r12 = schlick1(r0, 1.0, cosine);\n let t121 = 1.0 - r12;\n let phi12 = select(0.0, PI, eta < outside);\n let phi21 = PI - phi12;\n let root = sqrt(clamp(baseF0, vec3f(0.0), vec3f(0.9999)));\n let baseIor = (1.0 + root) / (1.0 - root);\n var r1 = (baseIor - eta) / (baseIor + eta);\n r1 *= r1;\n let r23 = schlick3(r1, 1.0, cosine2);\n let phi23 = select(vec3f(0.0), vec3f(PI), baseIor < vec3f(eta));\n let opd = 2.0 * eta * thickness * cosine2;\n let phi = vec3f(phi21) + phi23;\n let r123 = clamp(r12 * r23, vec3f(1e-5), vec3f(0.9999));\n let rs = t121 * t121 * r23 / (1.0 - r123);\n var result = r12 + rs;\n var cm = rs - t121;\n let amplitude = sqrt(r123);\n for (var order = 1; order <= 2; order++) {\n cm *= amplitude;\n result += cm * 2.0 * iridescenceSensitivity(f32(order) * opd, f32(order) * phi);\n }\n return max(result, vec3f(0.0));\n}";
|
|
36
|
+
/** LTC polygon form factor (Heitz et al. 2016) of PBRProgram RECT_LIGHTS. */
|
|
37
|
+
export declare const areaWGSL3D = "fn edgeFormFactor(v1: vec3f, v2: vec3f) -> vec3f {\n let x = dot(v1, v2);\n let y = abs(x);\n let a = 0.8543985 + (0.4965155 + 0.0145206 * y) * y;\n let b = 3.4175940 + (4.1616724 + y) * y;\n let v = a / b;\n let thetaSinTheta = select(0.5 * inverseSqrt(max(1.0 - x * x, 1e-7)) - v, v, x > 0.0);\n return cross(v1, v2) * thetaSinTheta;\n}\nfn areaIntegral(N: vec3f, V: vec3f, P: vec3f, inverseMatrix: mat3x3f, c0: vec3f, c1: vec3f, c2: vec3f, c3: vec3f) -> f32 {\n if (dot(cross(c1 - c0, c3 - c0), P - c0) < 0.0) {\n return 0.0;\n }\n let T1 = normalize(V - N * dot(V, N));\n let T2 = -cross(N, T1);\n let frame = inverseMatrix * transpose(mat3x3f(T1, T2, N));\n let p0 = normalize(frame * (c0 - P));\n let p1 = normalize(frame * (c1 - P));\n let p2 = normalize(frame * (c2 - P));\n let p3 = normalize(frame * (c3 - P));\n let f = edgeFormFactor(p0, p1) + edgeFormFactor(p1, p2) + edgeFormFactor(p2, p3) + edgeFormFactor(p3, p0);\n let l = length(f);\n return max((l * l + f.z) / (l + 1.0), 0.0);\n}";
|
|
38
|
+
/** Parallax-corrected lookup direction of a box-projected probe (PBRProgram probeDirection). */
|
|
39
|
+
export declare const probeWGSL3D = "fn probeDirection(direction: vec3f, position: vec3f) -> vec3f {\n if (scene.probeBox < 0.5) {\n return direction;\n }\n let safe = select(direction, vec3f(1e-6), abs(direction) < vec3f(1e-6));\n let far = max((scene.probeMax - position) / safe, (scene.probeMin - position) / safe);\n return position + direction * min(min(far.x, far.y), far.z) - scene.probeCenter;\n}";
|
|
40
|
+
/** Texel offsets of the cluster image (ClusteredLights.ts). */
|
|
41
|
+
export declare const clusterWalk3D = 64;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { mat4 as Matrix4 } from 'gl-matrix';
|
|
2
|
+
import { Nova3DLight } from '../model/Light.js';
|
|
3
|
+
/**
|
|
4
|
+
* Group 3 of lit and shader-material pipelines: a dynamic-offset LitScene
|
|
5
|
+
* block per view and reflection probe, the views' light clusters in one
|
|
6
|
+
* storage buffer (one region per view), the transmission copy and the LTC
|
|
7
|
+
* area-light tables. Buffers grow and are reused; bind groups are cached by
|
|
8
|
+
* the resources they reference.
|
|
9
|
+
*/
|
|
10
|
+
export declare class WebGPULitScene3D {
|
|
11
|
+
private readonly _device;
|
|
12
|
+
readonly layout: GPUBindGroupLayout;
|
|
13
|
+
private _data;
|
|
14
|
+
private _buffer;
|
|
15
|
+
private _capacity;
|
|
16
|
+
private _used;
|
|
17
|
+
private _clusters;
|
|
18
|
+
private _clusterCapacity;
|
|
19
|
+
private readonly _regions;
|
|
20
|
+
private readonly _bins;
|
|
21
|
+
/** BRDF tables, 64×64×3 RGBA16F: LTC layers 0–1 once area lights are installed, the DFG table in layer 2. */
|
|
22
|
+
private _areaTexture;
|
|
23
|
+
private _areaView;
|
|
24
|
+
private _areaLoaded;
|
|
25
|
+
private readonly _dummy;
|
|
26
|
+
private readonly _groups;
|
|
27
|
+
private readonly _offsets;
|
|
28
|
+
/** Bytes uploaded for clusters and tables since the last consume. */
|
|
29
|
+
uploads: number;
|
|
30
|
+
constructor(_device: GPUDevice);
|
|
31
|
+
get bytes(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Starts a frame: slots are handed out again from zero, and `views` cluster
|
|
34
|
+
* regions exist before any is written (growth replaces the buffer).
|
|
35
|
+
*/
|
|
36
|
+
begin(views: number): void;
|
|
37
|
+
/** Reserves `count` consecutive slots and returns the first; slot data starts zeroed only on growth. */
|
|
38
|
+
allocate(count: number): number;
|
|
39
|
+
/** Writes the view part of a slot: projection, scene environment, cluster slicing and transmission rectangle. */
|
|
40
|
+
writeView(slot: number, projection: Matrix4, intensity: number, rotation: number, framebufferWidth: number, framebufferHeight: number, x: number, y: number, width: number, height: number, region: number): void;
|
|
41
|
+
/** Copies a view slot into `slot` with a reflection probe's environment and influence box. */
|
|
42
|
+
writeProbe(slot: number, viewSlot: number, intensity: number, boxProjection: boolean, center: Float32Array, min: Float32Array, max: Float32Array): void;
|
|
43
|
+
/** Uploads the slots written this frame. */
|
|
44
|
+
flush(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Bins `lights` into cluster region `region` unless the camera, rectangle and
|
|
47
|
+
* lights are unchanged since its last bin. Returns false when no light lands
|
|
48
|
+
* in any cluster (the view then draws without them).
|
|
49
|
+
*/
|
|
50
|
+
buildClusters(region: number, stamp: number, lights: readonly Nova3DLight[], view: Matrix4, projection: Matrix4, near: number, far: number, x: number, y: number, width: number, height: number): boolean;
|
|
51
|
+
/** LTC tables of a rect light (`createRectAreaLight`) into layers 0–1 of the BRDF tables, uploaded once. */
|
|
52
|
+
areaTables(tables: Uint16Array | null): void;
|
|
53
|
+
/** The BRDF table texture, created with the DFG layer on first use. */
|
|
54
|
+
private _tables;
|
|
55
|
+
/** Sets group 3 for a view slot and its cluster region (−1: none) with the transmission copy bound. */
|
|
56
|
+
bind(pass: GPURenderPassEncoder, slot: number, region: number, transmission: GPUTextureView): void;
|
|
57
|
+
/** Releases every GPU object; `lost` skips destroy calls. */
|
|
58
|
+
reset(lost: boolean): void;
|
|
59
|
+
private _ensureRegions;
|
|
60
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CompiledNodeSurface3D } from '../nodes/ShaderNode.js';
|
|
2
|
+
/**
|
|
3
|
+
* Features compiled into one lit (PBR, Lambert, Phong, toon) shader module.
|
|
4
|
+
* Mirrors the PBRProgram variant key for the features the WebGPU backend supports.
|
|
5
|
+
*/
|
|
6
|
+
export interface LitVariant3D {
|
|
7
|
+
/** 0 PBR, 1 Lambert, 2 Phong, 3 toon. */
|
|
8
|
+
readonly shading: number;
|
|
9
|
+
/** Punctual lights in the uniform set (0–16). */
|
|
10
|
+
readonly lights: number;
|
|
11
|
+
/** Shadow slots (0–4). */
|
|
12
|
+
readonly shadows: number;
|
|
13
|
+
readonly environment: boolean;
|
|
14
|
+
/** Bit k: material map k (base, metal-rough/specular/gradient, normal, occlusion, emissive) is present. */
|
|
15
|
+
readonly maps: number;
|
|
16
|
+
readonly vertexColor: boolean;
|
|
17
|
+
/** 0 none, 1 linear, 2 exp, 3 exp2. */
|
|
18
|
+
readonly fog: number;
|
|
19
|
+
readonly ambient: boolean;
|
|
20
|
+
/** Some map has a non-identity UV transform. */
|
|
21
|
+
readonly transform: boolean;
|
|
22
|
+
/** Bit k: map slot k (5: light map) samples the second UV set. Bits of absent maps are ignored. */
|
|
23
|
+
readonly sets: number;
|
|
24
|
+
readonly coverage: boolean;
|
|
25
|
+
readonly lightMap: boolean;
|
|
26
|
+
readonly instanceColor: boolean;
|
|
27
|
+
readonly instanced: boolean;
|
|
28
|
+
/** The geometry has vertex tangents and the normal map uses them (PBRProgram HAS_TANGENT). */
|
|
29
|
+
readonly tangent?: boolean;
|
|
30
|
+
/** Shadow slot of the cascaded light, or −1. */
|
|
31
|
+
readonly cascadeSlot: number;
|
|
32
|
+
readonly pcf: boolean;
|
|
33
|
+
readonly pcss: boolean;
|
|
34
|
+
/** Interned PBR extension layout (0: none). */
|
|
35
|
+
readonly extensions?: number;
|
|
36
|
+
/** Some uniform light is a rectangular area light. */
|
|
37
|
+
readonly rect?: boolean;
|
|
38
|
+
/** Point and spot lights beyond the uniform ones come from light clusters. */
|
|
39
|
+
readonly clustered?: boolean;
|
|
40
|
+
/** Some uniform light is a point or spot light; false compiles the directional path only (PBRProgram DIRECTIONAL_LIGHTS_ONLY). */
|
|
41
|
+
readonly positional?: boolean;
|
|
42
|
+
/** The scene has reflection probes: environment terms come from the group 3 probe slot. */
|
|
43
|
+
readonly probes?: boolean;
|
|
44
|
+
/** Bit 0: the raw first UV set is read (anisotropy frame, node uv()); bit 1: the second set (extension maps, node uv(1)). */
|
|
45
|
+
readonly uvs?: number;
|
|
46
|
+
/** Node surface spliced into the shader. */
|
|
47
|
+
readonly nodes?: CompiledNodeSurface3D | null;
|
|
48
|
+
}
|
|
49
|
+
/** Secondary key of the features litShaderKey3D leaves out (node surfaces add their interned id). */
|
|
50
|
+
export declare function litExtraKey3D(variant: LitVariant3D): number;
|
|
51
|
+
/** Lit variants with extensions or node surfaces bind the extended material group. */
|
|
52
|
+
export declare function extendedLit3D(variant: LitVariant3D): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Numeric variant key: bitwise fields up to bit 30, then cascade slot, PCF, PCSS,
|
|
55
|
+
* tangents and directional-only lights added arithmetically (as the WebGL key does), all below 2^53.
|
|
56
|
+
*/
|
|
57
|
+
export declare function litShaderKey3D(variant: LitVariant3D): number;
|
|
58
|
+
/** Inverse of litShaderKey3D. */
|
|
59
|
+
export declare function litVariantFromKey3D(key: number): LitVariant3D;
|
|
60
|
+
/** Vertex attribute bit of the tangents (location 13), read by normal-mapped lit variants. */
|
|
61
|
+
export declare const tangentAttributes3D = 1024;
|
|
62
|
+
/** Vertex attributes a lit variant reads: bit 0 position, 1 normal, 2 uv, 3 colour, 4 uv1, 5 instance matrix, 6 instance colour, 10 tangent. */
|
|
63
|
+
export declare function litAttributes3D(variant: LitVariant3D): number;
|
|
64
|
+
/** Binding of extension unit k (group 1 of the extended layout) and of node texture k. */
|
|
65
|
+
export declare const extensionBinding3D = 14;
|
|
66
|
+
export declare const nodeTextureBinding3D = 22;
|
|
67
|
+
/** WGSL of a lit variant: the PBRProgram.ts math, translated statement by statement. */
|
|
68
|
+
export declare function litShaderSource3D(variant: LitVariant3D): string;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Nova3DMesh } from '../model/Mesh.js';
|
|
2
|
+
import { Nova3DTexture } from '../model/Texture.js';
|
|
3
|
+
import { GPUParticleConfig3D, GPUParticlePass3D, GPUParticleState3D } from '../particles/GPUParticleState.js';
|
|
4
|
+
/**
|
|
5
|
+
* Compute port of the GPU particle simulation (GPUParticleShaders.ts): one
|
|
6
|
+
* invocation per state slot updates its own A = (position, age) and
|
|
7
|
+
* B = (velocity, id) in place, so no ping-pong copy is needed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function particleSimulationSource3D(config: Pick<GPUParticleConfig3D, 'shape' | 'world' | 'drag' | 'speedCurve' | 'velocityCurve'> & {
|
|
10
|
+
randomize: boolean;
|
|
11
|
+
}): string;
|
|
12
|
+
/**
|
|
13
|
+
* One stage of the bitonic network over draw positions (GPUParticleShaders.ts),
|
|
14
|
+
* in place: an invocation per compared pair swaps it when out of order. Keys
|
|
15
|
+
* are view depths of the held slots; free slots sort last.
|
|
16
|
+
*/
|
|
17
|
+
export declare const particleSortSource3D = "struct SortStage {\n forward: vec3f,\n capacity: u32,\n block: u32,\n distance: u32,\n count: u32,\n}\n@group(0) @binding(0) var<uniform> sorting: SortStage;\n@group(0) @binding(1) var<storage, read_write> order: array<u32>;\n@group(0) @binding(2) var<storage, read> stateA: array<vec4f>;\nfn particleKey(slot: u32) -> f32 {\n if (slot >= sorting.capacity) {\n return 3.0e38;\n }\n let a = stateA[slot];\n\n return select(-dot(a.xyz, sorting.forward), 3.0e38, a.w < 0.0);\n}\n@compute @workgroup_size(64)\nfn sortStage(@builtin(global_invocation_id) invocation: vec3u) {\n let pair = invocation.x;\n if (pair >= sorting.count) {\n return;\n }\n let low = pair & (sorting.distance - 1u);\n let position = ((pair - low) << 1u) | low;\n let partner = position | sorting.distance;\n let own = order[position];\n let other = order[partner];\n let ownKey = particleKey(own);\n let otherKey = particleKey(other);\n\n let ascending = (position & sorting.block) == 0u;\n if (select(otherKey > ownKey, otherKey < ownKey, ascending)) {\n order[position] = other;\n order[partner] = own;\n }\n}\n@compute @workgroup_size(64)\nfn identity(@builtin(global_invocation_id) invocation: vec3u) {\n if (invocation.x < sorting.count) {\n order[invocation.x] = invocation.x;\n }\n}\n";
|
|
18
|
+
/** Services of the renderer a WebGPU particle state uses. */
|
|
19
|
+
export interface ParticleHost3D {
|
|
20
|
+
readonly device: GPUDevice;
|
|
21
|
+
/** Registers the state the renderer draws `mesh` with, or removes it with null. */
|
|
22
|
+
register: (mesh: Nova3DMesh, state: WebGPUParticleState3D | null) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* WebGPU particle state: storage buffers for state A and B, the curve table and
|
|
26
|
+
* the draw order, updated by compute passes; a batch of passes is submitted
|
|
27
|
+
* together and live counts read back with `mapAsync`.
|
|
28
|
+
*/
|
|
29
|
+
export declare class WebGPUParticleState3D implements GPUParticleState3D {
|
|
30
|
+
private readonly _host;
|
|
31
|
+
private readonly _config;
|
|
32
|
+
private _resources;
|
|
33
|
+
private _encoder;
|
|
34
|
+
private _pass;
|
|
35
|
+
private _slot;
|
|
36
|
+
private _sortSlot;
|
|
37
|
+
private _mesh;
|
|
38
|
+
private readonly _data;
|
|
39
|
+
private readonly _floats;
|
|
40
|
+
private readonly _words;
|
|
41
|
+
private readonly _stage;
|
|
42
|
+
private readonly _stageFloats;
|
|
43
|
+
private readonly _stageWords;
|
|
44
|
+
private readonly _offsets;
|
|
45
|
+
private _forward;
|
|
46
|
+
private _sortSize;
|
|
47
|
+
constructor(_host: ParticleHost3D, _config: GPUParticleConfig3D);
|
|
48
|
+
get ordered(): boolean;
|
|
49
|
+
/** Buffers of the render pass. */
|
|
50
|
+
get buffers(): {
|
|
51
|
+
stateA: GPUBuffer;
|
|
52
|
+
stateB: GPUBuffer;
|
|
53
|
+
curves: GPUBuffer;
|
|
54
|
+
order: GPUBuffer | undefined;
|
|
55
|
+
} | null;
|
|
56
|
+
attach(mesh: Nova3DMesh): void;
|
|
57
|
+
create(): void;
|
|
58
|
+
simulate(rows: number, input: GPUParticlePass3D): void;
|
|
59
|
+
flush(): void;
|
|
60
|
+
clear(): void;
|
|
61
|
+
ensureOrder(): boolean;
|
|
62
|
+
beginSort(size: number, x: number, y: number, z: number): void;
|
|
63
|
+
sortStage(block: number, distance: number): void;
|
|
64
|
+
endSort(): void;
|
|
65
|
+
readCount(rows: number, slots: number, current: () => boolean): Promise<number>;
|
|
66
|
+
destroy(lost: boolean): void;
|
|
67
|
+
/** Constant fields of every simulation slot. */
|
|
68
|
+
private _writeConstants;
|
|
69
|
+
/** A uniform slot of the current batch; a full batch is submitted first. */
|
|
70
|
+
private _nextSlot;
|
|
71
|
+
private _compute;
|
|
72
|
+
private _writeStage;
|
|
73
|
+
/** Writes draw position = slot over the whole order. */
|
|
74
|
+
private _identity;
|
|
75
|
+
}
|
|
76
|
+
/** Render block of the particle draw (group 1): the material uniforms of GPUParticleSystem. */
|
|
77
|
+
export declare const particleRenderLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
78
|
+
/** Render defines of the particle material, as a key: bit k is define k of particleRenderDefines3D. */
|
|
79
|
+
export declare const particleRenderDefines3D: readonly ["PARTICLE_SIZE_CURVE", "PARTICLE_ALPHA_CURVE", "PARTICLE_COLOR_CURVE", "PARTICLE_TWO_COLORS", "PARTICLE_MAP", "PARTICLE_SHEET", "PARTICLE_ANIMATED", "PARTICLE_ROTATES", "PARTICLE_VERTICAL", "PARTICLE_FOG"];
|
|
80
|
+
/** WGSL of the particle draw: GPUParticleShaders.ts render stages over the storage buffers. */
|
|
81
|
+
export declare function particleRenderSource3D(key: number): string;
|
|
82
|
+
/** True for the meshes of GPU particle systems. */
|
|
83
|
+
export declare function isParticleMesh3D(node: Nova3DMesh): boolean;
|
|
84
|
+
/** Builds a scene pipeline descriptor for a layout, module and state key (position and uv buffers). */
|
|
85
|
+
export type ParticlePipelineDescriptor3D = (layout: GPUPipelineLayout, module: GPUShaderModule, stateKey: number) => GPURenderPipelineDescriptor;
|
|
86
|
+
/**
|
|
87
|
+
* Draws the meshes of GPU particle systems on WebGPU: the render block from
|
|
88
|
+
* the material uniforms, the state buffers of the registered particle state
|
|
89
|
+
* and one indexed instanced draw of the billboard quad.
|
|
90
|
+
*/
|
|
91
|
+
export declare class WebGPUParticleDraws3D {
|
|
92
|
+
private readonly _device;
|
|
93
|
+
readonly layout: GPUBindGroupLayout;
|
|
94
|
+
readonly states: Map<Nova3DMesh, WebGPUParticleState3D>;
|
|
95
|
+
private _draws;
|
|
96
|
+
private readonly _shaders;
|
|
97
|
+
private _pipelineLayout?;
|
|
98
|
+
constructor(_device: GPUDevice);
|
|
99
|
+
/**
|
|
100
|
+
* Writes the render block when the material changed and rebuilds the bind
|
|
101
|
+
* group when the state buffers or the map changed. False without GPU state.
|
|
102
|
+
*/
|
|
103
|
+
prepare(node: Nova3DMesh, map: (texture: Nova3DTexture) => {
|
|
104
|
+
view: GPUTextureView;
|
|
105
|
+
sampler: GPUSampler;
|
|
106
|
+
}, fallback: {
|
|
107
|
+
view: GPUTextureView;
|
|
108
|
+
sampler: GPUSampler;
|
|
109
|
+
}): boolean;
|
|
110
|
+
/** Binds the pipeline and group 1 of a prepared particle mesh; the caller binds groups 0 and 2 and draws. */
|
|
111
|
+
bind(pass: GPURenderPassEncoder, node: Nova3DMesh, stateKey: number, view: GPUBindGroupLayout, object: GPUBindGroupLayout, descriptor: ParticlePipelineDescriptor3D): boolean;
|
|
112
|
+
release(node: Nova3DMesh): void;
|
|
113
|
+
reset(): void;
|
|
114
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Nova3DMesh } from '../model/Mesh.js';
|
|
2
|
+
import { RenderView3D } from '../services/WebGLRenderer.js';
|
|
3
|
+
import { WebGPUDeformation3D } from './Deformation.js';
|
|
4
|
+
/** One pick draw (group 0, dynamic offset): the pixel's narrowed view-projection and the candidate id. */
|
|
5
|
+
export declare const pickLayout3D: import('./UniformLayout.js').UniformLayout3D;
|
|
6
|
+
/**
|
|
7
|
+
* Pick pass shader (GPUPicker.ts): the caster geometry with instance parity
|
|
8
|
+
* culling and alpha-mask discards, writing candidate + 1, instance index and
|
|
9
|
+
* window depth bits into an RGBA32 unsigned target. `uvSet` is 0 without a
|
|
10
|
+
* masked map, 1 for uv, 2 for uv1.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pickShaderSource3D(instanced: boolean, uvSet: 0 | 1 | 2): string;
|
|
13
|
+
/** Renderer services the pick pass draws through. */
|
|
14
|
+
export interface PickHost3D {
|
|
15
|
+
readonly device: GPUDevice;
|
|
16
|
+
readonly casterLayout: GPUBindGroupLayout;
|
|
17
|
+
readonly objectLayout: GPUBindGroupLayout;
|
|
18
|
+
readonly deformation: WebGPUDeformation3D;
|
|
19
|
+
/** Uploads geometry, instances, caster bindings, object slot and deformation of a candidate. */
|
|
20
|
+
prepare: (node: Nova3DMesh) => void;
|
|
21
|
+
/** Writes the object uniforms prepared so far. */
|
|
22
|
+
flush: () => void;
|
|
23
|
+
casterGroup: (node: Nova3DMesh) => GPUBindGroup;
|
|
24
|
+
/** Clears the binding caches before a pass. */
|
|
25
|
+
resetBindings: () => void;
|
|
26
|
+
/** Binds the object slot, vertex buffers of `attributes` and deformation, then draws. */
|
|
27
|
+
draw: (pass: GPURenderPassEncoder, node: Nova3DMesh, attributes: number) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* GPU picking on WebGPU, as GPUPicker3D on WebGL2: candidates under the pixel
|
|
31
|
+
* drawn through a pick matrix into a 1×1 RGBA32 unsigned target, read back
|
|
32
|
+
* asynchronously with `mapAsync`. Billboards, lines and points are skipped.
|
|
33
|
+
*/
|
|
34
|
+
export declare class WebGPUPicker3D {
|
|
35
|
+
private readonly _host;
|
|
36
|
+
private _color?;
|
|
37
|
+
private _depth?;
|
|
38
|
+
private _uniforms?;
|
|
39
|
+
private _uniformGroup?;
|
|
40
|
+
private _uniformLayout?;
|
|
41
|
+
private _capacity;
|
|
42
|
+
private _data;
|
|
43
|
+
private readonly _shaders;
|
|
44
|
+
private readonly _layouts;
|
|
45
|
+
private readonly _candidates;
|
|
46
|
+
private readonly _matrices;
|
|
47
|
+
private readonly _offsets;
|
|
48
|
+
constructor(_host: PickHost3D);
|
|
49
|
+
pick(view: RenderView3D, pixel: readonly [number, number], size: readonly [number, number], lost: () => boolean): Promise<{
|
|
50
|
+
node: Nova3DMesh;
|
|
51
|
+
instance: number;
|
|
52
|
+
point: [number, number, number];
|
|
53
|
+
} | null>;
|
|
54
|
+
/** Forgets the device objects; `lost` skips destroy calls on objects of a lost device. */
|
|
55
|
+
reset(lost: boolean): void;
|
|
56
|
+
private _ensureTarget;
|
|
57
|
+
private _shader;
|
|
58
|
+
private _pipeline;
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Fixed-function state of a scene pipeline, packed into a 16-bit key. */
|
|
2
|
+
export interface PipelineState3D {
|
|
3
|
+
/** 0 none, 1 normal (premultiplied over), 2 additive, 3 multiply, 4 subtractive. */
|
|
4
|
+
readonly blend: number;
|
|
5
|
+
readonly depthWrite: boolean;
|
|
6
|
+
readonly depthTest: boolean;
|
|
7
|
+
/** 0 none, 1 back faces, 2 front faces. */
|
|
8
|
+
readonly cull: number;
|
|
9
|
+
/** Clockwise front faces (mirrored world matrix, or a flipped render-target view). */
|
|
10
|
+
readonly clockwise: boolean;
|
|
11
|
+
/** Colour target: 0 canvas format, 1 rgba8unorm, 2 rgba16float, 3 rgba8unorm-srgb. */
|
|
12
|
+
readonly target: number;
|
|
13
|
+
/** Depth attachment: 0 none, 1 depth24plus, 2 depth16unorm. */
|
|
14
|
+
readonly depth: number;
|
|
15
|
+
/** 1 or 4. */
|
|
16
|
+
readonly samples: number;
|
|
17
|
+
readonly coverage: boolean;
|
|
18
|
+
/** 'line-list' instead of 'triangle-list'. */
|
|
19
|
+
readonly lines: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const blendModes3D: readonly ["none", "normal", "additive", "multiply", "subtractive"];
|
|
22
|
+
export declare function pipelineStateKey3D(state: PipelineState3D): number;
|
|
23
|
+
export declare function pipelineStateFromKey3D(key: number): PipelineState3D;
|
|
24
|
+
/** Pass-dependent bits of the state key: target, depth format and samples. */
|
|
25
|
+
export declare function passStateBits3D(target: number, depth: number, samples: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Blend factors of WebGLRenderer._applyRenderState: premultiplied output, as
|
|
28
|
+
* three.js premultipliedAlpha blending.
|
|
29
|
+
*/
|
|
30
|
+
export declare function blendState3D(mode: number): GPUBlendState | undefined;
|
|
31
|
+
/** Blend index of a material: none unless alphaMode is 'blend'. */
|
|
32
|
+
export declare function blendIndex3D(alphaMode: string, blending: string): number;
|
|
33
|
+
export declare function depthFormat3D(index: number): GPUTextureFormat | undefined;
|