@nova-lab/core 1.0.0-dev.19 → 1.1.1-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 +229 -4
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Nova3DCamera } from '../model/Camera.js';
|
|
2
|
+
import { Nova3DEnvironment } from '../model/Environment.js';
|
|
3
|
+
import { Nova3DGeometry } from '../model/Geometry.js';
|
|
4
|
+
import { Nova3DMesh } from '../model/Mesh.js';
|
|
5
|
+
import { Nova3DNode } from '../model/Node.js';
|
|
6
|
+
import { Nova3DRenderTarget } from '../model/RenderTarget.js';
|
|
7
|
+
import { Nova3DScene } from '../model/Scene.js';
|
|
8
|
+
import { Nova3DTexture } from '../model/Texture.js';
|
|
9
|
+
import { FrameMetrics3D } from '../types.js';
|
|
10
|
+
import { EffectsProcessor3D } from './EffectsProcessor.js';
|
|
11
|
+
import { Renderer3D } from './Renderer.js';
|
|
12
|
+
import { ToneMapping3D } from './ToneMapping.js';
|
|
13
|
+
export type Color3DTuple = readonly [number, number, number, number];
|
|
14
|
+
/** One view of a frame as resolved by the app; viewport is normalized with a top-left origin. */
|
|
15
|
+
export interface RenderView3D {
|
|
16
|
+
readonly scene: Nova3DScene;
|
|
17
|
+
readonly camera: Nova3DCamera;
|
|
18
|
+
readonly viewport: Readonly<{
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}>;
|
|
24
|
+
readonly target?: Nova3DRenderTarget;
|
|
25
|
+
/** `undefined` uses the app clear colour, `null` keeps the colour buffer. */
|
|
26
|
+
readonly clearColor?: Color3DTuple | null;
|
|
27
|
+
readonly clearDepth: boolean;
|
|
28
|
+
/** Layer bit mask; meshes sharing no bit are skipped. */
|
|
29
|
+
readonly layers: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Owns the app's device and the restorable GPU resources derived from app data.
|
|
33
|
+
*/
|
|
34
|
+
export declare class Nova3DWebGLRenderer implements Renderer3D {
|
|
35
|
+
protected constructor();
|
|
36
|
+
readonly gl: WebGL2RenderingContext;
|
|
37
|
+
readonly backend: "webgl2";
|
|
38
|
+
private readonly _geometry;
|
|
39
|
+
private readonly _textures;
|
|
40
|
+
private readonly _instanceBuffers;
|
|
41
|
+
private readonly _pulledInstances;
|
|
42
|
+
private _quadIndices?;
|
|
43
|
+
private readonly _state;
|
|
44
|
+
private readonly _casters;
|
|
45
|
+
/** Culled meshes of the view being prepared, before `orderView3D` orders them. */
|
|
46
|
+
private readonly _culled;
|
|
47
|
+
/** Per-view-slot caches reused across frames. */
|
|
48
|
+
private readonly _viewStates;
|
|
49
|
+
private readonly _frameScenes;
|
|
50
|
+
private readonly _sceneShadows;
|
|
51
|
+
private readonly _sceneLights;
|
|
52
|
+
/** Folded ambient irradiance of scenes in this frame that have ambient lights. */
|
|
53
|
+
private readonly _sceneAmbient;
|
|
54
|
+
private readonly _ambientBuffers;
|
|
55
|
+
private readonly _viewCounts;
|
|
56
|
+
private readonly _renderTargets;
|
|
57
|
+
private readonly _resolveTexture;
|
|
58
|
+
/** Shadow and picking draws; attribute-free instanced addons have no meaning there. */
|
|
59
|
+
private readonly _drawShadow;
|
|
60
|
+
/** Reused variant request; the program cache copies it into a numeric key. */
|
|
61
|
+
private readonly _variant;
|
|
62
|
+
private readonly _metrics;
|
|
63
|
+
/** Set by the canvas loss event and cleared by a generation reset. */
|
|
64
|
+
private _lost;
|
|
65
|
+
/** Drawing-buffer size cached after every canvas resize and restore. */
|
|
66
|
+
private _bufferWidth;
|
|
67
|
+
private _bufferHeight;
|
|
68
|
+
/** The next frame ends with one synchronous error query. */
|
|
69
|
+
private _verify;
|
|
70
|
+
private readonly _deformation;
|
|
71
|
+
private readonly _shadows;
|
|
72
|
+
private readonly _environments;
|
|
73
|
+
private readonly _mipmaps;
|
|
74
|
+
private _pbr?;
|
|
75
|
+
private _sky?;
|
|
76
|
+
private _picker?;
|
|
77
|
+
private readonly _pickNodes;
|
|
78
|
+
private readonly _pickMatrices;
|
|
79
|
+
private _shaders?;
|
|
80
|
+
private readonly _linePrograms;
|
|
81
|
+
private readonly _lineSegments;
|
|
82
|
+
private readonly _lineVariant;
|
|
83
|
+
private readonly _shaderFrame;
|
|
84
|
+
private readonly _shaderVariant;
|
|
85
|
+
private _anisotropicExtension?;
|
|
86
|
+
private _whiteTexture?;
|
|
87
|
+
private readonly _colorRange;
|
|
88
|
+
private readonly _shadowLights;
|
|
89
|
+
/** Framebuffer canvas views draw into: null for the canvas, or a WebXR layer. */
|
|
90
|
+
private _output;
|
|
91
|
+
private readonly _frameLights;
|
|
92
|
+
private readonly _jitterSaved;
|
|
93
|
+
private readonly _sceneClustered;
|
|
94
|
+
private readonly _clusters;
|
|
95
|
+
private readonly _clusterRect;
|
|
96
|
+
private readonly _probeResidents;
|
|
97
|
+
private readonly _sceneProbes;
|
|
98
|
+
private readonly _probeViewState;
|
|
99
|
+
private readonly _probeViewport;
|
|
100
|
+
/** Probe being captured: its meshes see only the scene environment. */
|
|
101
|
+
private _capturing?;
|
|
102
|
+
private _transmission?;
|
|
103
|
+
private readonly _shadowCamera;
|
|
104
|
+
/** A draw of the current view disabled depth testing or enabled coverage. */
|
|
105
|
+
private _renderStateTouched;
|
|
106
|
+
/** CSS-to-device pixel ratio of the canvas, for point sizes. */
|
|
107
|
+
private _pixelRatio;
|
|
108
|
+
private _exposure;
|
|
109
|
+
/** Advances when exposure/tone mapping or the cached view-projection change. */
|
|
110
|
+
private _displayStamp;
|
|
111
|
+
private _viewStamp;
|
|
112
|
+
private _toneMapping;
|
|
113
|
+
/** 'display' keeps frames with transparent meshes on the direct canvas path, as three.js. */
|
|
114
|
+
private _blending;
|
|
115
|
+
private readonly _programs;
|
|
116
|
+
/** Consecutive frames presented without the linear target. */
|
|
117
|
+
private _directFrames;
|
|
118
|
+
private _display?;
|
|
119
|
+
private _effects?;
|
|
120
|
+
/** Reused per-frame inputs of the effects processor. */
|
|
121
|
+
private _effectsFrame?;
|
|
122
|
+
private _hdrSamples?;
|
|
123
|
+
/** MSAA samples of the 8-bit linear target, stored as SRGB8_ALPHA8. */
|
|
124
|
+
private _srgbSamples?;
|
|
125
|
+
private _target?;
|
|
126
|
+
private readonly _samples;
|
|
127
|
+
private _destroyed;
|
|
128
|
+
private _bytes;
|
|
129
|
+
private _uploads;
|
|
130
|
+
private _generation;
|
|
131
|
+
readonly maxSize: number;
|
|
132
|
+
configureDisplay(options: {
|
|
133
|
+
exposure?: number;
|
|
134
|
+
toneMapping?: ToneMapping3D;
|
|
135
|
+
blending?: 'linear' | 'display';
|
|
136
|
+
}): void;
|
|
137
|
+
get estimatedGpuBytes(): number;
|
|
138
|
+
get shadowBytes(): number;
|
|
139
|
+
releaseNode(node: Nova3DNode): void;
|
|
140
|
+
get environmentBytes(): number;
|
|
141
|
+
releaseEnvironment(environment: Nova3DEnvironment): void;
|
|
142
|
+
get targetBytes(): number;
|
|
143
|
+
get geometryCount(): number;
|
|
144
|
+
get textureCount(): number;
|
|
145
|
+
installEffects(processor: EffectsProcessor3D | undefined): void;
|
|
146
|
+
validateSize(width: number, height: number): void;
|
|
147
|
+
/** `depth` keeps a sampled DEPTH_COMPONENT24 texture (plus 24-bit samples) for effects. */
|
|
148
|
+
private _targetLayout;
|
|
149
|
+
get generation(): number;
|
|
150
|
+
/**
|
|
151
|
+
* Renders render-target views first, then canvas views, in list order.
|
|
152
|
+
* Canvas views share one presentation path: direct when none needs the linear target.
|
|
153
|
+
*/
|
|
154
|
+
render(views: readonly RenderView3D[], clearColor: Color3DTuple): FrameMetrics3D | null;
|
|
155
|
+
private _renderViews;
|
|
156
|
+
/**
|
|
157
|
+
* Submits the PBR variants `view` will bind this frame, before its uploads, so the driver
|
|
158
|
+
* compiles them while textures and buffers upload and shadow maps render. The keys come
|
|
159
|
+
* from what prepare and bind will see: the scene's lights and shadowed lights, its
|
|
160
|
+
* environment, probes, ambient light and fog. Frames whose lights need clusters (more
|
|
161
|
+
* than 16) or would be rejected skip it; bind compiles whatever was not submitted.
|
|
162
|
+
*/
|
|
163
|
+
private _precompile;
|
|
164
|
+
/** Resolves the view rectangle, view-projection, visible meshes and their uploads. */
|
|
165
|
+
private _prepareView;
|
|
166
|
+
/** Clears and draws one prepared view into `framebuffer`; `direct` selects canvas encoding. */
|
|
167
|
+
private _drawView;
|
|
168
|
+
private _releaseLineSegments;
|
|
169
|
+
/**
|
|
170
|
+
* GPU pick at `pixel` (device pixels from the view's top-left) of a view of
|
|
171
|
+
* `size` device pixels: draws only meshes under that pixel into a 1×1 integer
|
|
172
|
+
* target and resolves asynchronously. Billboards, lines and points are skipped.
|
|
173
|
+
*/
|
|
174
|
+
pickGPU(view: RenderView3D, pixel: readonly [number, number], size: readonly [number, number]): Promise<{
|
|
175
|
+
node: Nova3DMesh;
|
|
176
|
+
instance: number;
|
|
177
|
+
point: [number, number, number];
|
|
178
|
+
} | null>;
|
|
179
|
+
/** Depth, blending, coverage and culling of one material; GLState skips unchanged values. */
|
|
180
|
+
private _applyRenderState;
|
|
181
|
+
/** Projection without the view for the current view-projection, computed once per view change. */
|
|
182
|
+
private _ensureProjection;
|
|
183
|
+
/** Cold path of basic drawing: builds the variant and records the selection on the mesh. */
|
|
184
|
+
private _selectBasic;
|
|
185
|
+
/** Draws a mesh with a line material as one instanced quad per segment. */
|
|
186
|
+
private _drawLine;
|
|
187
|
+
/** Packs and uploads the segments of a 'lines' geometry into instance buffers. */
|
|
188
|
+
private _uploadLineSegments;
|
|
189
|
+
/** Selects, binds and feeds the program of a shader material. */
|
|
190
|
+
private _bindShader;
|
|
191
|
+
/** Prefiltering writes GL state directly; restores this view's bindings. */
|
|
192
|
+
private _restoreView;
|
|
193
|
+
/** Draws an environment background behind everything; skipped without an environment. */
|
|
194
|
+
private _drawSky;
|
|
195
|
+
/** `second` is nonzero when the map samples the second UV set. */
|
|
196
|
+
private _ensureMap;
|
|
197
|
+
clear(color: readonly [
|
|
198
|
+
number,
|
|
199
|
+
number,
|
|
200
|
+
number,
|
|
201
|
+
number
|
|
202
|
+
]): void;
|
|
203
|
+
releaseGeometry(geometry: Nova3DGeometry): void;
|
|
204
|
+
releaseRenderTarget(target: Nova3DRenderTarget): void;
|
|
205
|
+
private _deleteRenderTarget;
|
|
206
|
+
/** Allocates or resizes the GPU attachments of a render target. */
|
|
207
|
+
private _ensureRenderTarget;
|
|
208
|
+
releaseTexture(texture: Nova3DTexture): void;
|
|
209
|
+
/** Forgets cached GL state after an addon wrote the context directly. */
|
|
210
|
+
invalidateState(): void;
|
|
211
|
+
/** Records a context loss reported by the canvas event. */
|
|
212
|
+
markContextLost(): void;
|
|
213
|
+
/** Re-reads the drawing-buffer size; the browser may clamp it below the canvas size. */
|
|
214
|
+
syncDrawingBuffer(pixelRatio?: number): void;
|
|
215
|
+
/**
|
|
216
|
+
* Draws canvas views into `framebuffer` of `width`×`height` (a WebXR layer) instead
|
|
217
|
+
* of the canvas; null returns to the canvas. Effects anti-aliasing stages still
|
|
218
|
+
* finish on the canvas.
|
|
219
|
+
*/
|
|
220
|
+
setOutput(framebuffer: WebGLFramebuffer | null, width: number, height: number): void;
|
|
221
|
+
reset(discardLostGeneration?: boolean): void;
|
|
222
|
+
destroy(): void;
|
|
223
|
+
private _draw;
|
|
224
|
+
/** Draws `quads` quads of the shared quad list; vertex shaders pull their data by gl_VertexID. */
|
|
225
|
+
private _drawQuads;
|
|
226
|
+
/** Uploads changed instance data of a pulled-quad mesh and binds it with the quad corners. */
|
|
227
|
+
private _bindPulled;
|
|
228
|
+
/** Writes the first `count` instances (`floats` each) into rows of a pulled instance texture. */
|
|
229
|
+
private _uploadRows;
|
|
230
|
+
private _ensureInstances;
|
|
231
|
+
private _uploadInstances;
|
|
232
|
+
private _ensureGeometry;
|
|
233
|
+
/** A 1×1 white texture of this context generation, for optional samplers. */
|
|
234
|
+
private _white;
|
|
235
|
+
/** EXT_texture_filter_anisotropic of this context, looked up once; null when unsupported. */
|
|
236
|
+
private _anisotropic;
|
|
237
|
+
private _ensureTexture;
|
|
238
|
+
/**
|
|
239
|
+
* Uploads changed pixels into existing storage: a dirty region of a data texture
|
|
240
|
+
* or the whole image source. Returns false when the storage must be reallocated.
|
|
241
|
+
*/
|
|
242
|
+
private _refreshTexture;
|
|
243
|
+
/** Bins the scene's clustered lights for this view, or null without any. */
|
|
244
|
+
private _buildClusters;
|
|
245
|
+
/** Captures pending reflection probes of `scene` and lists the ready ones for PBR. */
|
|
246
|
+
private _updateProbes;
|
|
247
|
+
private _captureProbe;
|
|
248
|
+
private _releaseProbe;
|
|
249
|
+
/** Copies the view's colour into a mipmapped texture (unit 8) for transmission. */
|
|
250
|
+
private _grabTransmission;
|
|
251
|
+
private _releaseTransmission;
|
|
252
|
+
private _ensureTarget;
|
|
253
|
+
private _releaseTarget;
|
|
254
|
+
private _present;
|
|
255
|
+
/** Copies the first canvas view's camera into the reused effects frame record. */
|
|
256
|
+
private _writeEffectsFrame;
|
|
257
|
+
private _displayTexture;
|
|
258
|
+
private _basicProgram;
|
|
259
|
+
/** Releases the linear target after a run of direct frames; linear frames reset the run. */
|
|
260
|
+
private _trackDirectFrame;
|
|
261
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Nova3DWarning } from '../Errors.js';
|
|
2
|
+
import { Limits3D } from '../loaders/Limits.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parsed Gaussian splats in the 3DGS training convention (INRIA PLY: x right,
|
|
5
|
+
* y down, z forward). Arrays are structure-of-arrays, `count` entries each.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
export interface SplatData3D {
|
|
9
|
+
readonly count: number;
|
|
10
|
+
/** Centres, xyz per splat. */
|
|
11
|
+
readonly positions: Float32Array;
|
|
12
|
+
/** Standard deviations along the local axes, xyz per splat (linear, not log). */
|
|
13
|
+
readonly scales: Float32Array;
|
|
14
|
+
/** Unit rotation quaternions, xyzw per splat. */
|
|
15
|
+
readonly rotations: Float32Array;
|
|
16
|
+
/**
|
|
17
|
+
* Base colour (0.5 + SH_C0 · DC, as trained, display-referred) and opacity
|
|
18
|
+
* (after the sigmoid), RGBA8 per splat; colours clamp to [0, 1] as Spark and
|
|
19
|
+
* the antimatter15 `.splat` format store them.
|
|
20
|
+
*/
|
|
21
|
+
readonly colors: Uint8Array;
|
|
22
|
+
/** Spherical-harmonics degree of `sh`: 0 (DC only) to 3. */
|
|
23
|
+
readonly shDegree: SplatSHDegree3D;
|
|
24
|
+
/**
|
|
25
|
+
* Higher-order SH coefficients (bands 1..shDegree): per splat `shRestCount(degree)`
|
|
26
|
+
* coefficients of RGB triples, coefficient-major; null for degree 0.
|
|
27
|
+
*/
|
|
28
|
+
readonly sh: Float32Array | null;
|
|
29
|
+
/** Notes of the parser that produced the data (empty when nothing was skipped); `createSplats` ignores it. */
|
|
30
|
+
readonly warnings?: readonly Nova3DWarning[];
|
|
31
|
+
}
|
|
32
|
+
/** @experimental */
|
|
33
|
+
export type SplatSHDegree3D = 0 | 1 | 2 | 3;
|
|
34
|
+
/**
|
|
35
|
+
* Options shared by the splat parsers. `limits` applies `maxInputBytes` (default
|
|
36
|
+
* 1 GiB), `maxDecompressedBytes` (SPZ, default 1 GiB) and `maxSplats`.
|
|
37
|
+
* @experimental
|
|
38
|
+
*/
|
|
39
|
+
export interface SplatParseOptions3D {
|
|
40
|
+
limits?: Limits3D;
|
|
41
|
+
/** Highest SH degree kept, 0..3; higher bands of the file are dropped. Default 3. */
|
|
42
|
+
maxSHDegree?: SplatSHDegree3D;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hard maximum of splats: order indices and texture rows stay within 24 bits.
|
|
46
|
+
* @experimental
|
|
47
|
+
*/
|
|
48
|
+
export declare const MAX_SPLATS = 16777216;
|
|
49
|
+
/** SH basis constant of band 0. */
|
|
50
|
+
export declare const SH_C0 = 0.28209479177387814;
|
|
51
|
+
/**
|
|
52
|
+
* Largest drawn radius in standard deviations: where a fully opaque Gaussian
|
|
53
|
+
* falls below 1/255 (√(2·ln 255) ≈ 3.33), as the 3DGS reference cutoff.
|
|
54
|
+
*/
|
|
55
|
+
export declare const SPLAT_MAX_SIGMA: number;
|
|
56
|
+
declare const defaultLimits: Readonly<{
|
|
57
|
+
maxInputBytes: number;
|
|
58
|
+
maxDecompressedBytes: number;
|
|
59
|
+
maxSplats: 4194304;
|
|
60
|
+
}>;
|
|
61
|
+
/** Splat limits after defaults. */
|
|
62
|
+
export type SplatLimits3D = {
|
|
63
|
+
readonly [K in keyof typeof defaultLimits]: number;
|
|
64
|
+
};
|
|
65
|
+
export declare const splatParseKeys3D: ReadonlySet<string>;
|
|
66
|
+
/** Coefficients per colour channel above band 0 for SH degree 0..3: 0, 3, 8, 15. */
|
|
67
|
+
export declare function shRestCount(degree: number): number;
|
|
68
|
+
/** Validated limits with defaults. */
|
|
69
|
+
export declare function splatLimits3D(limits: Limits3D | undefined): SplatLimits3D;
|
|
70
|
+
/** Validated maxSHDegree option. */
|
|
71
|
+
export declare function splatMaxDegree3D(value: unknown): SplatSHDegree3D;
|
|
72
|
+
/** Checks a splat count against the limits before allocation. */
|
|
73
|
+
export declare function checkSplatCount3D(count: number, limits: SplatLimits3D, format: string): void;
|
|
74
|
+
/** Empty storage for `count` splats with SH bands up to `degree`. */
|
|
75
|
+
export declare function allocateSplats3D(count: number, degree: SplatSHDegree3D): {
|
|
76
|
+
positions: Float32Array;
|
|
77
|
+
scales: Float32Array;
|
|
78
|
+
rotations: Float32Array;
|
|
79
|
+
colors: Uint8Array;
|
|
80
|
+
sh: Float32Array | null;
|
|
81
|
+
};
|
|
82
|
+
/** 8-bit channel of a unit value, clamped. */
|
|
83
|
+
export declare function unitByte3D(value: number): number;
|
|
84
|
+
/** Logistic function of the 3DGS opacity logit. */
|
|
85
|
+
export declare function sigmoid3D(value: number): number;
|
|
86
|
+
/**
|
|
87
|
+
* Validates splat data (shape, finite values, unit-ish quaternions) once, so the
|
|
88
|
+
* renderer and sorter can trust it. Throws on the first problem.
|
|
89
|
+
*/
|
|
90
|
+
export declare function validateSplatData3D(data: SplatData3D): void;
|
|
91
|
+
/**
|
|
92
|
+
* Writes the 3D covariance Σ = R·S·Sᵀ·Rᵀ of one splat as its six unique values
|
|
93
|
+
* xx, xy, xz, yy, yz, zz at `out[offset..offset+5]`, as the 3DGS reference
|
|
94
|
+
* (computeCov3D) with a unit quaternion xyzw.
|
|
95
|
+
* @experimental
|
|
96
|
+
*/
|
|
97
|
+
export declare function splatCovariance(sx: number, sy: number, sz: number, x: number, y: number, z: number, w: number, out: Float32Array | Float64Array, offset: number): void;
|
|
98
|
+
/** IEEE binary16 bits of a float, rounded to nearest even, with subnormals and overflow to infinity. */
|
|
99
|
+
export declare function toHalf3D(value: number): number;
|
|
100
|
+
/** Float value of binary16 bits. */
|
|
101
|
+
export declare function fromHalf3D(bits: number): number;
|
|
102
|
+
/** Texture width (power of two, at most 2048) and rows for `count` splats. */
|
|
103
|
+
export declare function splatTextureSize3D(count: number): {
|
|
104
|
+
width: number;
|
|
105
|
+
shift: number;
|
|
106
|
+
rows: number;
|
|
107
|
+
};
|
|
108
|
+
/** Layers of the packed RGBA8 array texture: centre (3), covariance (3), colour (1), SH bytes. */
|
|
109
|
+
export declare function splatLayers3D(degree: SplatSHDegree3D): number;
|
|
110
|
+
/** Packed GPU texels and the uniform scales they were encoded with. */
|
|
111
|
+
export interface PackedSplats3D {
|
|
112
|
+
readonly width: number;
|
|
113
|
+
readonly shift: number;
|
|
114
|
+
readonly rows: number;
|
|
115
|
+
readonly layers: number;
|
|
116
|
+
/** RGBA8 texels: width × rows × layers. */
|
|
117
|
+
readonly texels: Uint8Array;
|
|
118
|
+
/** Multiplies the stored covariance halves back to model units. */
|
|
119
|
+
readonly covarianceScale: number;
|
|
120
|
+
/** Largest SH coefficient magnitude; bytes map to [-shScale, shScale]. */
|
|
121
|
+
readonly shScale: number;
|
|
122
|
+
/** Local bounding box of the splats grown by their drawn extents (SPLAT_MAX_SIGMA). */
|
|
123
|
+
readonly bounds: {
|
|
124
|
+
min: [number, number, number];
|
|
125
|
+
max: [number, number, number];
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Packs splats into one RGBA8 2D-array texture with a texel per splat per layer:
|
|
130
|
+
* layers 0–2 hold the centre as float32 bits, 3–5 the covariance as binary16
|
|
131
|
+
* pairs (xx xy, xz yy, yz zz), 6 the colour and opacity, 7… the SH bytes.
|
|
132
|
+
* Covariances are scaled by a power of two so the largest one sits near the
|
|
133
|
+
* top of the half range; small splats then keep full half precision.
|
|
134
|
+
*/
|
|
135
|
+
export declare function packSplats3D(data: SplatData3D): PackedSplats3D;
|
|
136
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LoaderInput3D } from '../loaders/LoaderIO.js';
|
|
2
|
+
import { SplatData3D, SplatParseOptions3D } from './SplatData.js';
|
|
3
|
+
/**
|
|
4
|
+
* Splat file formats `loadSplats` and `parseSplats` recognise.
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
export type SplatFormat3D = 'ply' | 'compressed-ply' | 'splat' | 'spz';
|
|
8
|
+
/**
|
|
9
|
+
* Options of `parseSPZ`, the asynchronous (gzip) splat parser.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
export interface SPZParseOptions3D extends SplatParseOptions3D {
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Options of `loadSplats` and `parseSplats`.
|
|
17
|
+
* @experimental
|
|
18
|
+
*/
|
|
19
|
+
export interface SplatLoadOptions3D extends SPZParseOptions3D {
|
|
20
|
+
/** Format of the file; by default detected from the bytes, then the URL extension. */
|
|
21
|
+
format?: SplatFormat3D;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parses an INRIA 3D Gaussian Splatting binary PLY: `x y z`, `f_dc_0..2`
|
|
25
|
+
* (or `red green blue`), `f_rest_*` (SH bands 1–3, channel-major), `opacity`
|
|
26
|
+
* (logit), `scale_0..2` (log) and `rot_0..3` (w x y z).
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
|
+
export declare function parsePLYSplats(input: LoaderInput3D, options?: SplatParseOptions3D): Promise<SplatData3D>;
|
|
30
|
+
/**
|
|
31
|
+
* Parses the antimatter15 `.splat` format: 32 bytes per splat — centre (3 × f32),
|
|
32
|
+
* linear scale (3 × f32), RGBA8 colour and opacity, rotation (4 × u8, w x y z,
|
|
33
|
+
* (b − 128) / 128).
|
|
34
|
+
* @experimental
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseSPLAT(input: LoaderInput3D, options?: SplatParseOptions3D): Promise<SplatData3D>;
|
|
37
|
+
/**
|
|
38
|
+
* Parses the PlayCanvas / SuperSplat `.compressed.ply`: chunks of 256 splats with
|
|
39
|
+
* min/max ranges, 11-10-11 quantized positions and log scales, smallest-three
|
|
40
|
+
* 2-10-10-10 rotations, RGBA8 colour (optionally range-mapped) and 8-bit SH in
|
|
41
|
+
* [-4, 4].
|
|
42
|
+
* @experimental
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseCompressedPLYSplats(input: LoaderInput3D, options?: SplatParseOptions3D): Promise<SplatData3D>;
|
|
45
|
+
/**
|
|
46
|
+
* Parses Niantic SPZ (versions 2 and 3, gzip): 24-bit fixed-point centres, 8-bit
|
|
47
|
+
* opacity, colour, log scale, rotation (v2: xyz, v3: smallest three) and SH.
|
|
48
|
+
* SPZ stores right-up-back axes; the result is converted to the 3DGS
|
|
49
|
+
* right-down-forward convention of the PLY loaders.
|
|
50
|
+
* @experimental
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseSPZ(input: LoaderInput3D, options?: SPZParseOptions3D): Promise<SplatData3D>;
|
|
53
|
+
/**
|
|
54
|
+
* Parses splat bytes of any supported format; `format` overrides detection.
|
|
55
|
+
* Files without a signature are read as `.splat`.
|
|
56
|
+
* @experimental
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseSplats(input: LoaderInput3D, options?: SplatLoadOptions3D): Promise<SplatData3D>;
|
|
59
|
+
/**
|
|
60
|
+
* Fetches and parses a splat file within the byte budget; the format comes from
|
|
61
|
+
* `format`, the file signature, then the URL extension.
|
|
62
|
+
* @experimental
|
|
63
|
+
*/
|
|
64
|
+
export declare function loadSplats(url: string | URL, options?: SplatLoadOptions3D): Promise<SplatData3D>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vertex stage of one splat quad (instance = sorted slot, vertex id = corner).
|
|
3
|
+
* The 2D covariance is the EWA projection J·W·Σ·Wᵀ·Jᵀ of the 3DGS reference in
|
|
4
|
+
* pixels, with its 0.3 px² low-pass; the quad spans the Gaussian out to where
|
|
5
|
+
* it falls below 1/255 of the splat's opacity. Splats behind the camera, outside
|
|
6
|
+
* near/far, or whose quad misses the view are collapsed outside the clip volume.
|
|
7
|
+
*
|
|
8
|
+
* Defines: SPLAT_SHIFT (log2 texture width), SPLAT_SH_DEGREE 0..3,
|
|
9
|
+
* SPLAT_SH_TEXELS, SPLAT_SRGB (decode colours), SPLAT_ANTIALIAS (Mip-Splatting
|
|
10
|
+
* opacity compensation).
|
|
11
|
+
*/
|
|
12
|
+
export declare const splatVertex3D = "uniform highp sampler2DArray splatData;\nuniform highp sampler2D splatOrder;\n\nuniform vec2 splatViewport;\n\nuniform vec4 splatParams;\nout vec2 vSplat;\nflat out vec4 vSplatColor;\n#define SPLAT_MASK ((1<<SPLAT_SHIFT)-1)\nuint splatWord(vec4 texel){\n uvec4 b=uvec4(texel*255.0+0.5);\n return b.r|(b.g<<8u)|(b.b<<16u)|(b.a<<24u);\n}\nfloat splatFloat(ivec2 at,int layer){return uintBitsToFloat(splatWord(texelFetch(splatData,ivec3(at,layer),0)));}\nvec2 splatHalves(ivec2 at,int layer){return unpackHalf2x16(splatWord(texelFetch(splatData,ivec3(at,layer),0)));}\nvoid splatCull(){\n gl_Position=vec4(0.0,0.0,2.0,1.0);\n vSplat=vec2(0.0);\n vSplatColor=vec4(0.0);\n}\n#if SPLAT_SH_DEGREE>0\nconst float SH_C1=0.4886025119029199;\nvec3 splatHarmonics(ivec2 at,vec3 dir){\n float s[SPLAT_SH_TEXELS*4];\n for(int i=0;i<SPLAT_SH_TEXELS;i++){\n vec4 t=texelFetch(splatData,ivec3(at,7+i),0)*splatParams.y+splatParams.z;\n s[i*4]=t.x;s[i*4+1]=t.y;s[i*4+2]=t.z;s[i*4+3]=t.w;\n }\n float x=dir.x;float y=dir.y;float z=dir.z;\n vec3 result=SH_C1*(-y*vec3(s[0],s[1],s[2])+z*vec3(s[3],s[4],s[5])-x*vec3(s[6],s[7],s[8]));\n#if SPLAT_SH_DEGREE>1\n float xx=x*x;float yy=y*y;float zz=z*z;float xy=x*y;float yz=y*z;float xz=x*z;\n result+=1.0925484305920792*xy*vec3(s[9],s[10],s[11])\n -1.0925484305920792*yz*vec3(s[12],s[13],s[14])\n +0.31539156525252005*(2.0*zz-xx-yy)*vec3(s[15],s[16],s[17])\n -1.0925484305920792*xz*vec3(s[18],s[19],s[20])\n +0.5462742152960396*(xx-yy)*vec3(s[21],s[22],s[23]);\n#if SPLAT_SH_DEGREE>2\n result+=-0.5900435899266435*y*(3.0*xx-yy)*vec3(s[24],s[25],s[26])\n +2.890611442640554*xy*z*vec3(s[27],s[28],s[29])\n -0.4570457994644658*y*(4.0*zz-xx-yy)*vec3(s[30],s[31],s[32])\n +0.3731763325901154*z*(2.0*zz-3.0*xx-3.0*yy)*vec3(s[33],s[34],s[35])\n -0.4570457994644658*x*(4.0*zz-xx-yy)*vec3(s[36],s[37],s[38])\n +1.445305721320277*z*(xx-yy)*vec3(s[39],s[40],s[41])\n -0.5900435899266435*x*(xx-3.0*yy)*vec3(s[42],s[43],s[44]);\n#endif\n#endif\n return result;\n}\n#endif\nvoid main(){\n int slot=gl_InstanceID;\n int index=int(splatWord(texelFetch(splatOrder,ivec2(slot&SPLAT_MASK,slot>>SPLAT_SHIFT),0)));\n ivec2 at=ivec2(index&SPLAT_MASK,index>>SPLAT_SHIFT);\n vec3 centre=vec3(splatFloat(at,0),splatFloat(at,1),splatFloat(at,2));\n mat4 modelView=viewMatrix*modelMatrix;\n vec4 view=modelView*vec4(centre,1.0);\n vec4 clip=projectionMatrix*view;\n\n if(clip.w<=0.0||clip.z<-clip.w||clip.z>clip.w){splatCull();return;}\n vec4 color=texelFetch(splatData,ivec3(at,6),0);\n if(color.a<1.0/255.0){splatCull();return;}\n vec2 c0=splatHalves(at,3);\n vec2 c1=splatHalves(at,4);\n vec2 c2=splatHalves(at,5);\n mat3 sigma=mat3(c0.x,c0.y,c1.x,c0.y,c1.y,c2.x,c1.x,c2.x,c2.y)*splatParams.x;\n vec2 focal=vec2(projectionMatrix[0][0],projectionMatrix[1][1])*splatViewport*0.5;\n mat3 jacobian;\n if(projectionMatrix[3][3]==0.0){\n\n float depth=-view.z;\n vec2 slope=view.xy/depth;\n vec2 lowest=(vec2(projectionMatrix[2][0],projectionMatrix[2][1])-1.3)/vec2(projectionMatrix[0][0],projectionMatrix[1][1]);\n vec2 highest=(vec2(projectionMatrix[2][0],projectionMatrix[2][1])+1.3)/vec2(projectionMatrix[0][0],projectionMatrix[1][1]);\n slope=clamp(slope,lowest,highest);\n jacobian=mat3(focal.x/depth,0.0,0.0,0.0,focal.y/depth,0.0,focal.x*slope.x/depth,focal.y*slope.y/depth,0.0);\n }else{\n jacobian=mat3(focal.x,0.0,0.0,0.0,focal.y,0.0,0.0,0.0,0.0);\n }\n mat3 projected=jacobian*mat3(modelView);\n mat3 screen=projected*sigma*transpose(projected);\n float a=screen[0][0]+0.3;\n float b=screen[0][1];\n float c=screen[1][1]+0.3;\n float opacity=color.a;\n#ifdef SPLAT_ANTIALIAS\n float det=a*c-b*b;\n float unfiltered=(a-0.3)*(c-0.3)-b*b;\n opacity*=sqrt(max(unfiltered,0.0)/max(det,1e-12));\n if(opacity<1.0/255.0){splatCull();return;}\n#endif\n float middle=0.5*(a+c);\n float radius=length(vec2(0.5*(a-c),b));\n float major=middle+radius;\n float minor=max(middle-radius,0.0);\n vec2 axis=abs(b)>1e-12*middle?normalize(vec2(b,major-a)):(a>=c?vec2(1.0,0.0):vec2(0.0,1.0));\n\n float extent=sqrt(max(2.0*log(255.0*opacity),0.0));\n vec2 majorAxis=axis*min(sqrt(major),splatParams.w)*extent;\n vec2 minorAxis=vec2(-axis.y,axis.x)*min(sqrt(minor),splatParams.w)*extent;\n\n vec2 reach=(abs(majorAxis)+abs(minorAxis))*2.0/splatViewport;\n vec2 ndc=clip.xy/clip.w;\n if(any(greaterThan(abs(ndc)-reach,vec2(1.0)))){splatCull();return;}\n vec2 corner=vec2(gl_VertexID==1||gl_VertexID==2?1.0:-1.0,gl_VertexID>=2?1.0:-1.0);\n vec2 offset=(corner.x*majorAxis+corner.y*minorAxis)*2.0/splatViewport;\n gl_Position=vec4(clip.xy+offset*clip.w,clip.z,clip.w);\n vSplat=corner*extent;\n vec3 rgb=color.rgb;\n#if SPLAT_SH_DEGREE>0\n vec3 world=(modelMatrix*vec4(centre,1.0)).xyz;\n vec3 direction=normalize(transpose(mat3(modelMatrix))*(world-cameraPosition));\n rgb+=splatHarmonics(at,direction);\n#endif\n rgb=clamp(rgb,0.0,1.0);\n#ifdef SPLAT_SRGB\n rgb=mix(rgb/12.92,pow((rgb+0.055)/1.055,vec3(2.4)),step(0.04045,rgb));\n#endif\n vSplatColor=vec4(rgb,opacity);\n}";
|
|
13
|
+
/** Gaussian falloff in standard deviations, premultiplied through novaOutput. */
|
|
14
|
+
export declare const splatFragment3D = "in vec2 vSplat;\nflat in vec4 vSplatColor;\nvoid main(){\n float alpha=min(0.99,vSplatColor.a*exp(-0.5*dot(vSplat,vSplat)));\n if(alpha<1.0/255.0)discard;\n novaOutput(vec4(vSplatColor.rgb,alpha));\n}";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Back-to-front ordering of splats by view depth: a stable counting sort on
|
|
3
|
+
* 16-bit quantized depths (as PlayCanvas and mkkellogg), run in a Web Worker when
|
|
4
|
+
* possible and synchronously otherwise. Buffers are allocated once per splat set.
|
|
5
|
+
*/
|
|
6
|
+
/** Buckets of the 16-bit depth keys. */
|
|
7
|
+
export declare const SORT_BUCKETS = 65536;
|
|
8
|
+
/** Scratch of one sorter; sized for the splat count once. */
|
|
9
|
+
export interface SplatSortScratch3D {
|
|
10
|
+
/** View distance per splat; −Infinity marks culled splats. */
|
|
11
|
+
readonly depths: Float32Array;
|
|
12
|
+
readonly keys: Uint16Array;
|
|
13
|
+
readonly counts: Uint32Array;
|
|
14
|
+
}
|
|
15
|
+
export declare function createSortScratch3D(count: number): SplatSortScratch3D;
|
|
16
|
+
/**
|
|
17
|
+
* Writes into `order` the indices of the splats in front of the camera, farthest
|
|
18
|
+
* first, and returns how many were written. The view distance of centre (x, y, z)
|
|
19
|
+
* is −(a·x + b·y + c·z + d), the negated view-space z of the model-view row
|
|
20
|
+
* (a, b, c, d). Splats with distance ≤ `near` are culled (pass −Infinity to keep
|
|
21
|
+
* all, as for orthographic views). Equal keys keep ascending index order.
|
|
22
|
+
*
|
|
23
|
+
* Self-contained on purpose: the worker runs this function's source text.
|
|
24
|
+
* @experimental
|
|
25
|
+
*/
|
|
26
|
+
export declare function sortSplats(centres: Float32Array, count: number, a: number, b: number, c: number, d: number, near: number, depths: Float32Array, keys: Uint16Array, counts: Uint32Array, order: Uint32Array): number;
|
|
27
|
+
/** Result of one sort: the ordered indices (valid up to `visible`) and how many are drawn. */
|
|
28
|
+
export interface SplatSortResult3D {
|
|
29
|
+
readonly order: Uint32Array;
|
|
30
|
+
readonly visible: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Owns the order buffer and sorts either on the calling thread or in a worker.
|
|
34
|
+
* In worker mode one request is in flight at a time and the buffer ping-pongs
|
|
35
|
+
* between threads as a transferable; nothing is allocated per sort.
|
|
36
|
+
*/
|
|
37
|
+
export declare class SplatSorter3D {
|
|
38
|
+
private readonly _centres;
|
|
39
|
+
private readonly _count;
|
|
40
|
+
private readonly _capacity;
|
|
41
|
+
private readonly _onResult;
|
|
42
|
+
private readonly _onFallback;
|
|
43
|
+
private _order;
|
|
44
|
+
private _scratch;
|
|
45
|
+
private _worker;
|
|
46
|
+
private _url;
|
|
47
|
+
private _pending;
|
|
48
|
+
private _id;
|
|
49
|
+
private readonly _row;
|
|
50
|
+
private _destroyed;
|
|
51
|
+
/**
|
|
52
|
+
* `onResult` receives every sort result; `onFallback` runs when a failing worker
|
|
53
|
+
* dropped an in-flight request, so the owner sorts again synchronously.
|
|
54
|
+
*/
|
|
55
|
+
constructor(_centres: Float32Array, _count: number, _capacity: number, mode: 'worker' | 'sync', _onResult: (result: SplatSortResult3D) => void, _onFallback?: () => void);
|
|
56
|
+
/** 'worker' while a worker sorts, otherwise 'sync'. */
|
|
57
|
+
get mode(): 'worker' | 'sync';
|
|
58
|
+
/** Whether a worker sort is in flight. */
|
|
59
|
+
get pending(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Sorts for the model-view row (a, b, c, d). Synchronous mode delivers the
|
|
62
|
+
* result before returning; worker mode returns false when a sort is already in
|
|
63
|
+
* flight (the caller retries on a later frame).
|
|
64
|
+
*/
|
|
65
|
+
sort(a: number, b: number, c: number, d: number, near: number): boolean;
|
|
66
|
+
destroy(): void;
|
|
67
|
+
private _startWorker;
|
|
68
|
+
private _stopWorker;
|
|
69
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Nova3DCamera } from '../model/Camera.js';
|
|
2
|
+
import { Hit3D } from '../model/Mesh.js';
|
|
3
|
+
import { Nova3DScene } from '../model/Scene.js';
|
|
4
|
+
import { Nova3DApp } from '../Nova3DApp.js';
|
|
5
|
+
import { NodeOptions3D, Ray3D } from '../types.js';
|
|
6
|
+
import { SplatData3D, SplatSHDegree3D } from './SplatData.js';
|
|
7
|
+
import { Nova3DNode } from '../model/Node.js';
|
|
8
|
+
/**
|
|
9
|
+
* Options of `createSplats`.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
export type SplatsOptions3D = NodeOptions3D & {
|
|
13
|
+
/**
|
|
14
|
+
* Camera the splats are sorted for, back to front; default the app's primary
|
|
15
|
+
* view camera while that view shows this scene.
|
|
16
|
+
*/
|
|
17
|
+
sortCamera?: Nova3DCamera | null;
|
|
18
|
+
/**
|
|
19
|
+
* 'worker' (default) sorts in a Web Worker and falls back to 'sync' where
|
|
20
|
+
* workers are unavailable or blocked; 'sync' sorts on the main thread before
|
|
21
|
+
* the frame that needs it.
|
|
22
|
+
*/
|
|
23
|
+
sort?: 'worker' | 'sync';
|
|
24
|
+
/** Multiplies every splat's opacity, [0, 1]; default 1. */
|
|
25
|
+
opacity?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Space of the stored colours: 'srgb' (default; display-referred, as trained)
|
|
28
|
+
* decodes to linear before blending, 'linear' uses them as they are.
|
|
29
|
+
*/
|
|
30
|
+
colorSpace?: 'srgb' | 'linear';
|
|
31
|
+
/** Highest SH degree evaluated, up to the data's degree; default the data's degree. */
|
|
32
|
+
shDegree?: SplatSHDegree3D;
|
|
33
|
+
/**
|
|
34
|
+
* Scales opacity by the screen-space filter's area change (Mip-Splatting), for
|
|
35
|
+
* scenes trained with antialiasing. Default false.
|
|
36
|
+
*/
|
|
37
|
+
antialias?: boolean;
|
|
38
|
+
/** Default true. */
|
|
39
|
+
depthTest?: boolean;
|
|
40
|
+
renderOrder?: number;
|
|
41
|
+
layers?: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 3D Gaussian splats drawn as one procedural instanced draw: 4 vertices per
|
|
45
|
+
* splat, EWA-projected in the vertex stage from packed textures (centre float32,
|
|
46
|
+
* covariance binary16, colour RGBA8, SH bytes), Gaussian falloff with
|
|
47
|
+
* premultiplied blending, depth test on and depth write off (PlayCanvas GSplat,
|
|
48
|
+
* Babylon.js GaussianSplattingMesh, Spark). Splats are re-sorted back to front
|
|
49
|
+
* when the sort camera turns or moves; the sort runs in a worker and uploads
|
|
50
|
+
* only the order texture. Move, parent, hide and raycast the splats through
|
|
51
|
+
* `node`; their material and geometry stay internal.
|
|
52
|
+
* @experimental
|
|
53
|
+
*/
|
|
54
|
+
export declare class Nova3DSplats {
|
|
55
|
+
protected constructor();
|
|
56
|
+
/**
|
|
57
|
+
* The scene node drawing the splats: transform, reparent, hide or parent other
|
|
58
|
+
* nodes to it. Splat hits report it as `hit.node`.
|
|
59
|
+
*/
|
|
60
|
+
readonly node: Nova3DNode;
|
|
61
|
+
/** Splats held. */
|
|
62
|
+
readonly count: number;
|
|
63
|
+
/** SH degree evaluated by the shader. */
|
|
64
|
+
readonly shDegree: SplatSHDegree3D;
|
|
65
|
+
private readonly _mesh;
|
|
66
|
+
private readonly _app;
|
|
67
|
+
private readonly _centres;
|
|
68
|
+
private readonly _scales;
|
|
69
|
+
private readonly _rotations;
|
|
70
|
+
private readonly _opacities;
|
|
71
|
+
private readonly _dataTexture;
|
|
72
|
+
private readonly _orderTexture;
|
|
73
|
+
private readonly _orderWidth;
|
|
74
|
+
private readonly _sorter;
|
|
75
|
+
private _sortCamera;
|
|
76
|
+
/** Model-view row of the last sort request (a, b, c, d) and its near cull; NaN before any. */
|
|
77
|
+
private readonly _sortedRow;
|
|
78
|
+
private readonly _radius;
|
|
79
|
+
private readonly _viewport;
|
|
80
|
+
private _maxAxis;
|
|
81
|
+
private readonly _cleanup;
|
|
82
|
+
private _drawn;
|
|
83
|
+
get destroyed(): boolean;
|
|
84
|
+
/** Draw order within the blended group; see `Nova3DMesh.renderOrder`. */
|
|
85
|
+
get renderOrder(): number;
|
|
86
|
+
setRenderOrder(value: number): void;
|
|
87
|
+
/** Layer bit mask; see `Nova3DMesh.layers`. */
|
|
88
|
+
get layers(): number;
|
|
89
|
+
setLayers(mask: number): void;
|
|
90
|
+
/** Removes the node and releases the textures, material, geometry and sort worker. */
|
|
91
|
+
destroy(): void;
|
|
92
|
+
/** Splats drawn by the last sort: those in front of the sort camera. */
|
|
93
|
+
get drawCount(): number;
|
|
94
|
+
/** 'worker' while sorting runs in a worker, otherwise 'sync'. */
|
|
95
|
+
get sortMode(): 'worker' | 'sync';
|
|
96
|
+
/** The camera sorted for, or null to follow the primary view camera. */
|
|
97
|
+
get sortCamera(): Nova3DCamera | null;
|
|
98
|
+
/** Sorts for this camera, or for the primary view camera with null. */
|
|
99
|
+
setSortCamera(camera: Nova3DCamera | null): void;
|
|
100
|
+
/** Multiplies every splat's opacity, [0, 1]. */
|
|
101
|
+
setOpacity(opacity: number): void;
|
|
102
|
+
get opacity(): number;
|
|
103
|
+
/** Keeps the viewport uniform current and requests a sort when the view changed enough. */
|
|
104
|
+
private readonly _onBeforeRender;
|
|
105
|
+
/** Uploads the sorted prefix of the order texture and draws that many splats. */
|
|
106
|
+
private readonly _onSorted;
|
|
107
|
+
/** A worker failed mid-sort: forget the request so the next frame sorts again. */
|
|
108
|
+
private readonly _onFallback;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates Gaussian splats in `scene` from parsed data (`loadSplats`,
|
|
112
|
+
* `parsePLYSplats`, …). The data is copied; the splats own their GPU resources and
|
|
113
|
+
* sort worker until destroyed. Owned by the scene's app: destroyed with it.
|
|
114
|
+
* @experimental
|
|
115
|
+
*/
|
|
116
|
+
export declare function createSplats(scene: Nova3DScene, data: SplatData3D, options?: SplatsOptions3D): Nova3DSplats;
|