@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,862 @@
|
|
|
1
|
+
import { N as C, p as Et, a as Kt } from "../Errors-B2ekO9bZ.js";
|
|
2
|
+
import { r as Yt } from "../Limits-Bw5XQdFr.js";
|
|
3
|
+
import { o as yt } from "../Options-CajE7LLJ.js";
|
|
4
|
+
import { i as Vt } from "../Inflate-DWw0V-Up.js";
|
|
5
|
+
import { a as at, l as Gt, c as Zt, d as ut } from "../LoaderIO-BwrM84OM.js";
|
|
6
|
+
import { N as Xt } from "../Mesh-BaRxAAJq.js";
|
|
7
|
+
import { b as Nt, r as Qt, N as Jt, d as gt, y as te } from "../Node-QfgAE2_v.js";
|
|
8
|
+
import { s as ee } from "../Scene-CDfNgf9I.js";
|
|
9
|
+
import { s as se, a as ne } from "../SplatShader-wJ6GJ3vo.js";
|
|
10
|
+
const Mt = 16777216, kt = 0.28209479177387814, vt = Math.sqrt(2 * Math.log(255)), re = Object.freeze({ maxInputBytes: 1024 * 1024 * 1024, maxDecompressedBytes: 1024 * 1024 * 1024, maxSplats: 4194304 }), At = yt({ limits: !0, maxSHDegree: !0 });
|
|
11
|
+
function Z(e) {
|
|
12
|
+
return (e + 1) * (e + 1) - 1;
|
|
13
|
+
}
|
|
14
|
+
function ct(e) {
|
|
15
|
+
const t = Yt(e, re, "splat");
|
|
16
|
+
return t.maxSplats = Math.min(Mt, t.maxSplats), t;
|
|
17
|
+
}
|
|
18
|
+
function mt(e) {
|
|
19
|
+
if (e === void 0)
|
|
20
|
+
return 3;
|
|
21
|
+
if (e !== 0 && e !== 1 && e !== 2 && e !== 3)
|
|
22
|
+
throw new C("invalid-option", "[Nova3D] maxSHDegree must be 0, 1, 2 or 3.");
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
function wt(e, t, s) {
|
|
26
|
+
if (!Number.isSafeInteger(e) || e < 0)
|
|
27
|
+
throw new C("invalid-option", `[Nova3D] ${s} declares an invalid splat count.`);
|
|
28
|
+
if (e > t.maxSplats)
|
|
29
|
+
throw new C("budget", `[Nova3D] ${s} exceeds the splat limit (${e} > ${t.maxSplats}).`);
|
|
30
|
+
}
|
|
31
|
+
function xt(e, t) {
|
|
32
|
+
return {
|
|
33
|
+
positions: new Float32Array(e * 3),
|
|
34
|
+
scales: new Float32Array(e * 3),
|
|
35
|
+
rotations: new Float32Array(e * 4),
|
|
36
|
+
colors: new Uint8Array(e * 4),
|
|
37
|
+
sh: t > 0 ? new Float32Array(e * Z(t) * 3) : null
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function nt(e) {
|
|
41
|
+
return e > 0 ? e < 1 ? Math.round(e * 255) : 255 : 0;
|
|
42
|
+
}
|
|
43
|
+
function It(e) {
|
|
44
|
+
return 1 / (1 + Math.exp(-e));
|
|
45
|
+
}
|
|
46
|
+
function Ut(e) {
|
|
47
|
+
if (!e || typeof e != "object")
|
|
48
|
+
throw new C("invalid-option", "[Nova3D] Splat data must be an object.");
|
|
49
|
+
const t = e.count;
|
|
50
|
+
if (!Number.isSafeInteger(t) || t < 0 || t > Mt)
|
|
51
|
+
throw new C("invalid-option", `[Nova3D] Splat count must be an integer in [0, ${Mt}].`);
|
|
52
|
+
const s = e.shDegree;
|
|
53
|
+
if (s !== 0 && s !== 1 && s !== 2 && s !== 3)
|
|
54
|
+
throw new C("invalid-option", "[Nova3D] Splat shDegree must be 0, 1, 2 or 3.");
|
|
55
|
+
if (!(e.positions instanceof Float32Array) || e.positions.length !== t * 3 || !(e.scales instanceof Float32Array) || e.scales.length !== t * 3 || !(e.rotations instanceof Float32Array) || e.rotations.length !== t * 4 || !(e.colors instanceof Uint8Array) || e.colors.length !== t * 4)
|
|
56
|
+
throw new C("invalid-option", "[Nova3D] Splat data needs Float32Array positions, scales (3 per splat), rotations (4) and Uint8Array colors (4).");
|
|
57
|
+
const n = Z(s) * 3;
|
|
58
|
+
if (s === 0 ? e.sh !== null && e.sh !== void 0 : !(e.sh instanceof Float32Array) || e.sh.length !== t * n)
|
|
59
|
+
throw new C("invalid-option", "[Nova3D] Splat sh must be null for degree 0 or hold the degree's coefficients per splat.");
|
|
60
|
+
const r = e.positions, o = e.scales;
|
|
61
|
+
for (let i = 0; i < t * 3; i++) {
|
|
62
|
+
if (!Number.isFinite(r[i]))
|
|
63
|
+
throw new C("invalid-option", "[Nova3D] Splat positions must be finite.");
|
|
64
|
+
const c = o[i];
|
|
65
|
+
if (!(c >= 0) || c === 1 / 0)
|
|
66
|
+
throw new C("invalid-option", "[Nova3D] Splat scales must be finite and non-negative.");
|
|
67
|
+
}
|
|
68
|
+
const a = e.rotations;
|
|
69
|
+
for (let i = 0; i < t * 4; i += 4) {
|
|
70
|
+
const c = Math.hypot(a[i], a[i + 1], a[i + 2], a[i + 3]);
|
|
71
|
+
if (!(Math.abs(c - 1) < 1e-3))
|
|
72
|
+
throw new C("invalid-option", "[Nova3D] Splat rotations must be unit quaternions.");
|
|
73
|
+
}
|
|
74
|
+
if (e.sh) {
|
|
75
|
+
const i = e.sh;
|
|
76
|
+
for (let c = 0; c < i.length; c++)
|
|
77
|
+
if (!Number.isFinite(i[c]))
|
|
78
|
+
throw new C("invalid-option", "[Nova3D] Splat SH coefficients must be finite.");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function oe(e, t, s, n, r, o, a, i, c) {
|
|
82
|
+
const l = 1 - 2 * (r * r + o * o), w = 2 * (n * r - a * o), _ = 2 * (n * o + a * r), h = 2 * (n * r + a * o), d = 1 - 2 * (n * n + o * o), u = 2 * (r * o - a * n), D = 2 * (n * o - a * r), y = 2 * (r * o + a * n), m = 1 - 2 * (n * n + r * r), k = l * e, M = w * t, N = _ * s, P = h * e, x = d * t, v = u * s, A = D * e, b = y * t, f = m * s;
|
|
83
|
+
i[c] = k * k + M * M + N * N, i[c + 1] = k * P + M * x + N * v, i[c + 2] = k * A + M * b + N * f, i[c + 3] = P * P + x * x + v * v, i[c + 4] = P * A + x * b + v * f, i[c + 5] = A * A + b * b + f * f;
|
|
84
|
+
}
|
|
85
|
+
const Rt = new Float32Array(1), ie = new Uint32Array(Rt.buffer);
|
|
86
|
+
function it(e) {
|
|
87
|
+
Rt[0] = e;
|
|
88
|
+
const t = ie[0], s = t >>> 16 & 32768, n = t >>> 23 & 255;
|
|
89
|
+
let r = t & 8388607;
|
|
90
|
+
if (n === 255)
|
|
91
|
+
return s | 31744 | (r ? 512 : 0);
|
|
92
|
+
const o = n - 127 + 15;
|
|
93
|
+
if (o >= 31)
|
|
94
|
+
return s | 31744;
|
|
95
|
+
if (o <= 0) {
|
|
96
|
+
if (o < -10)
|
|
97
|
+
return s;
|
|
98
|
+
r |= 8388608;
|
|
99
|
+
const c = 14 - o;
|
|
100
|
+
let l = r >>> c;
|
|
101
|
+
const w = r & (1 << c) - 1, _ = 1 << c - 1;
|
|
102
|
+
return (w > _ || w === _ && l & 1) && l++, s | l;
|
|
103
|
+
}
|
|
104
|
+
let a = o << 10 | r >>> 13;
|
|
105
|
+
const i = r & 8191;
|
|
106
|
+
return (i > 4096 || i === 4096 && a & 1) && a++, s | a;
|
|
107
|
+
}
|
|
108
|
+
function ae(e) {
|
|
109
|
+
let t = 0;
|
|
110
|
+
for (; t < 11 && 1 << t < e; )
|
|
111
|
+
t++;
|
|
112
|
+
const s = 1 << t;
|
|
113
|
+
return { width: s, shift: t, rows: Math.max(1, Math.ceil(e / s)) };
|
|
114
|
+
}
|
|
115
|
+
function ce(e) {
|
|
116
|
+
return 7 + Math.ceil(Z(e) * 3 / 4);
|
|
117
|
+
}
|
|
118
|
+
function le(e) {
|
|
119
|
+
const t = e.count, s = e.shDegree, { width: n, shift: r, rows: o } = ae(t), a = ce(s), i = n * o, c = new Uint8Array(i * a * 4), l = new Uint32Array(c.buffer), w = new Float32Array(c.buffer), _ = e.positions, h = e.scales, d = e.rotations, u = new Float32Array(t * 6);
|
|
120
|
+
let D = 0;
|
|
121
|
+
const y = [1 / 0, 1 / 0, 1 / 0], m = [-1 / 0, -1 / 0, -1 / 0];
|
|
122
|
+
for (let x = 0; x < t; x++) {
|
|
123
|
+
const v = x * 3, A = x * 4, b = h[v], f = h[v + 1], g = h[v + 2];
|
|
124
|
+
oe(b, f, g, d[A], d[A + 1], d[A + 2], d[A + 3], u, x * 6);
|
|
125
|
+
const F = x * 6;
|
|
126
|
+
for (let p = 0; p < 6; p++) {
|
|
127
|
+
const T = Math.abs(u[F + p]);
|
|
128
|
+
T > D && (D = T);
|
|
129
|
+
}
|
|
130
|
+
const q = vt * Math.sqrt(u[F]), z = vt * Math.sqrt(u[F + 3]), B = vt * Math.sqrt(u[F + 5]), j = _[v], I = _[v + 1], H = _[v + 2];
|
|
131
|
+
y[0] = Math.min(y[0], j - q), y[1] = Math.min(y[1], I - z), y[2] = Math.min(y[2], H - B), m[0] = Math.max(m[0], j + q), m[1] = Math.max(m[1], I + z), m[2] = Math.max(m[2], H + B), w[x] = j, w[i + x] = I, w[2 * i + x] = H;
|
|
132
|
+
}
|
|
133
|
+
t === 0 && (y.fill(0), m.fill(0));
|
|
134
|
+
const k = D > 0 ? 14 - Math.floor(Math.log2(D)) : 0, M = 2 ** k;
|
|
135
|
+
for (let x = 0; x < t; x++) {
|
|
136
|
+
const v = x * 6;
|
|
137
|
+
l[3 * i + x] = (it(u[v] * M) | it(u[v + 1] * M) << 16) >>> 0, l[4 * i + x] = (it(u[v + 2] * M) | it(u[v + 3] * M) << 16) >>> 0, l[5 * i + x] = (it(u[v + 4] * M) | it(u[v + 5] * M) << 16) >>> 0;
|
|
138
|
+
}
|
|
139
|
+
c.set(e.colors, 6 * i * 4);
|
|
140
|
+
let N = 0;
|
|
141
|
+
const P = e.sh;
|
|
142
|
+
if (P && s > 0) {
|
|
143
|
+
for (let A = 0; A < P.length; A++)
|
|
144
|
+
N = Math.max(N, Math.abs(P[A]));
|
|
145
|
+
const x = Z(s) * 3, v = N > 0 ? 127 / N : 0;
|
|
146
|
+
for (let A = 0; A < t; A++) {
|
|
147
|
+
const b = A * x;
|
|
148
|
+
for (let f = 0; f < x; f++) {
|
|
149
|
+
const g = 7 + (f >> 2);
|
|
150
|
+
c[(g * i + A) * 4 + (f & 3)] = Math.round(P[b + f] * v) + 128;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return { width: n, shift: r, rows: o, layers: a, texels: c, covarianceScale: 2 ** -k, shScale: N, bounds: { min: y, max: m } };
|
|
155
|
+
}
|
|
156
|
+
const he = yt({ limits: !0, maxSHDegree: !0, signal: !0 }), Pt = yt({ limits: !0, maxSHDegree: !0, signal: !0, format: !0 }), fe = { char: 0, int8: 0, uchar: 1, uint8: 1, short: 2, int16: 2, ushort: 3, uint16: 3, int: 4, int32: 4, uint: 5, uint32: 5, float: 6, float32: 6, double: 7, float64: 7 }, de = [1, 1, 2, 2, 4, 4, 4, 8], Lt = 6, St = 256, Ct = [0, 9, 24, 45];
|
|
157
|
+
function L(e, t) {
|
|
158
|
+
throw new C(Et(t), `[Nova3D] ${e} ${t}.`);
|
|
159
|
+
}
|
|
160
|
+
function Ot(e) {
|
|
161
|
+
return e.length >= 4 && e[0] === 112 && e[1] === 108 && e[2] === 121 && (e[3] === 10 || e[3] === 13);
|
|
162
|
+
}
|
|
163
|
+
function zt(e, t) {
|
|
164
|
+
Ot(e) || L(t, "input is not a PLY file");
|
|
165
|
+
const s = Math.min(e.length, 1 << 20);
|
|
166
|
+
let n = -1;
|
|
167
|
+
const r = [101, 110, 100, 95, 104, 101, 97, 100, 101, 114];
|
|
168
|
+
for (let _ = 0; _ + r.length < s; _++)
|
|
169
|
+
if (e[_] === 101 && (_ === 0 || e[_ - 1] === 10)) {
|
|
170
|
+
let h = !0;
|
|
171
|
+
for (let d = 1; d < r.length && h; d++)
|
|
172
|
+
h = e[_ + d] === r[d];
|
|
173
|
+
if (h) {
|
|
174
|
+
n = _ + r.length;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
n < 0 && L(t, "header has no end_header");
|
|
179
|
+
let o = n;
|
|
180
|
+
e[o] === 13 && o++, e[o] !== 10 && L(t, "header must end with a line break"), o++;
|
|
181
|
+
const i = new TextDecoder().decode(e.subarray(0, n)).split(/\r?\n/);
|
|
182
|
+
let c = null;
|
|
183
|
+
const l = [];
|
|
184
|
+
for (const _ of i.slice(1)) {
|
|
185
|
+
const h = _.trim().split(/\s+/), d = h[0];
|
|
186
|
+
if (!(d === "" || d === "comment" || d === "obj_info" || d === "end_header"))
|
|
187
|
+
if (d === "format")
|
|
188
|
+
h[1] === "binary_little_endian" ? c = !0 : h[1] === "binary_big_endian" ? c = !1 : L(t, `format ${h[1]} is not supported; splats need binary PLY`);
|
|
189
|
+
else if (d === "element") {
|
|
190
|
+
const u = Number(h[2]);
|
|
191
|
+
(h.length !== 3 || !Number.isSafeInteger(u) || u < 0) && L(t, "element declaration is invalid"), l.push({ name: h[1], count: u, properties: [], stride: 0, start: 0 });
|
|
192
|
+
} else if (d === "property") {
|
|
193
|
+
const u = l[l.length - 1];
|
|
194
|
+
u || L(t, "property precedes every element"), h[1] === "list" && L(t, `list property ${h[4] ?? ""} is not supported in splat files`);
|
|
195
|
+
const D = fe[h[1]];
|
|
196
|
+
(D === void 0 || h.length !== 3) && L(t, `property type ${h[1]} is invalid`), u.properties.some((y) => y.name === h[2]) && L(t, `property ${h[2]} is declared twice`), u.properties.push({ name: h[2], type: D, offset: u.stride }), u.stride += de[D];
|
|
197
|
+
} else
|
|
198
|
+
L(t, `header keyword ${d} is not supported`);
|
|
199
|
+
}
|
|
200
|
+
c === null && L(t, "header has no format line");
|
|
201
|
+
let w = o;
|
|
202
|
+
for (const _ of l) {
|
|
203
|
+
_.start = w;
|
|
204
|
+
const h = _.count * _.stride;
|
|
205
|
+
(!Number.isSafeInteger(h) || h > e.length - w) && L(t, "data is truncated"), w += h;
|
|
206
|
+
}
|
|
207
|
+
return { little: c, elements: l };
|
|
208
|
+
}
|
|
209
|
+
function Ht(e, t) {
|
|
210
|
+
const s = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
211
|
+
return (n, r) => {
|
|
212
|
+
switch (n) {
|
|
213
|
+
case 0:
|
|
214
|
+
return s.getInt8(r);
|
|
215
|
+
case 1:
|
|
216
|
+
return s.getUint8(r);
|
|
217
|
+
case 2:
|
|
218
|
+
return s.getInt16(r, t);
|
|
219
|
+
case 3:
|
|
220
|
+
return s.getUint16(r, t);
|
|
221
|
+
case 4:
|
|
222
|
+
return s.getInt32(r, t);
|
|
223
|
+
case 5:
|
|
224
|
+
return s.getUint32(r, t);
|
|
225
|
+
case 6:
|
|
226
|
+
return s.getFloat32(r, t);
|
|
227
|
+
default:
|
|
228
|
+
return s.getFloat64(r, t);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function dt(e, t) {
|
|
233
|
+
return e.properties.find((s) => s.name === t);
|
|
234
|
+
}
|
|
235
|
+
function rt(e, t, s, n, r, o) {
|
|
236
|
+
const a = Math.hypot(s, n, r, o);
|
|
237
|
+
if (!(a > 1e-12) || !Number.isFinite(a)) {
|
|
238
|
+
e[t] = 0, e[t + 1] = 0, e[t + 2] = 0, e[t + 3] = 1;
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
e[t] = n / a, e[t + 1] = r / a, e[t + 2] = o / a, e[t + 3] = s / a;
|
|
242
|
+
}
|
|
243
|
+
function G(e, t) {
|
|
244
|
+
return Number.isFinite(e) || L(t, "holds a non-finite value"), e;
|
|
245
|
+
}
|
|
246
|
+
function pt(e) {
|
|
247
|
+
try {
|
|
248
|
+
Ut(e);
|
|
249
|
+
} catch (t) {
|
|
250
|
+
throw Kt(t);
|
|
251
|
+
}
|
|
252
|
+
return e;
|
|
253
|
+
}
|
|
254
|
+
async function pe(e, t) {
|
|
255
|
+
t = at(t, At, "splat parse");
|
|
256
|
+
const s = "Splat PLY", n = ct(t.limits), r = mt(t.maxSHDegree), o = ut(e, n.maxInputBytes, s), a = zt(o, s), i = a.elements.find((p) => p.name === "vertex");
|
|
257
|
+
i || L(s, "has no vertex element"), dt(i, "packed_position") && L(s, "is a compressed PLY; use parseCompressedPLYSplats");
|
|
258
|
+
const c = i.count;
|
|
259
|
+
wt(c, n, s);
|
|
260
|
+
const l = (p) => dt(i, p), w = (p) => l(p) ?? L(s, `vertex has no ${p} property`), _ = ["x", "y", "z"].map(w), h = ["scale_0", "scale_1", "scale_2"].map(w), d = ["rot_0", "rot_1", "rot_2", "rot_3"].map(w), u = ["f_dc_0", "f_dc_1", "f_dc_2"].map(l), D = ["red", "green", "blue"].map(l), y = u.every(Boolean);
|
|
261
|
+
!y && !D.every(Boolean) && L(s, "vertex has neither f_dc_0..2 nor red, green, blue");
|
|
262
|
+
const m = l("opacity");
|
|
263
|
+
let k = 0;
|
|
264
|
+
for (; l(`f_rest_${k}`); )
|
|
265
|
+
k++;
|
|
266
|
+
const M = Ct.indexOf(k);
|
|
267
|
+
M < 0 && L(s, `has ${k} f_rest properties; SH degree 1–3 needs 9, 24 or 45`);
|
|
268
|
+
const N = Math.min(M, r), P = Array.from({ length: k }, (p, T) => l(`f_rest_${T}`)), x = xt(c, N), { positions: v, scales: A, rotations: b, colors: f, sh: g } = x, F = i.stride, q = i.start, z = Z(M), B = Z(N);
|
|
269
|
+
if (a.little && i.properties.every((p) => p.type === Lt)) {
|
|
270
|
+
const p = (o.byteOffset + q) % 4 === 0 ? new Float32Array(o.buffer, o.byteOffset + q, c * F / 4) : new Float32Array(o.slice(q, q + c * F).buffer), T = F / 4, S = (K) => K.offset / 4, [$, R, U] = _.map(S), [W, O, tt] = h.map(S), [et, Y, X, st] = d.map(S), lt = (y ? u : D).map((K) => S(K)), ot = m ? S(m) : -1, ht = P.map(S);
|
|
271
|
+
for (let K = 0; K < c; K++) {
|
|
272
|
+
const E = K * T, Q = K * 3;
|
|
273
|
+
v[Q] = G(p[E + $], s), v[Q + 1] = G(p[E + R], s), v[Q + 2] = G(p[E + U], s), A[Q] = Math.exp(G(p[E + W], s)), A[Q + 1] = Math.exp(G(p[E + O], s)), A[Q + 2] = Math.exp(G(p[E + tt], s)), rt(b, K * 4, p[E + et], p[E + Y], p[E + X], p[E + st]);
|
|
274
|
+
const ft = K * 4;
|
|
275
|
+
for (let J = 0; J < 3; J++) {
|
|
276
|
+
const V = p[E + lt[J]];
|
|
277
|
+
f[ft + J] = nt(y ? 0.5 + kt * V : V);
|
|
278
|
+
}
|
|
279
|
+
if (f[ft + 3] = ot < 0 ? 255 : nt(It(p[E + ot])), g) {
|
|
280
|
+
const J = K * B * 3;
|
|
281
|
+
for (let V = 0; V < B; V++)
|
|
282
|
+
for (let _t = 0; _t < 3; _t++)
|
|
283
|
+
g[J + V * 3 + _t] = G(p[E + ht[_t * z + V]], s);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return pt({ count: c, shDegree: N, ...x, warnings: [] });
|
|
287
|
+
}
|
|
288
|
+
const j = Ht(o, a.little), I = (p, T) => j(T.type, p + T.offset), H = y || D[0].type === Lt || D[0].type === 7 ? 1 : 1 / 255;
|
|
289
|
+
for (let p = 0; p < c; p++) {
|
|
290
|
+
const T = q + p * F, S = p * 3;
|
|
291
|
+
for (let R = 0; R < 3; R++)
|
|
292
|
+
v[S + R] = G(I(T, _[R]), s), A[S + R] = Math.exp(G(I(T, h[R]), s));
|
|
293
|
+
rt(b, p * 4, I(T, d[0]), I(T, d[1]), I(T, d[2]), I(T, d[3]));
|
|
294
|
+
const $ = p * 4;
|
|
295
|
+
for (let R = 0; R < 3; R++)
|
|
296
|
+
f[$ + R] = nt(y ? 0.5 + kt * I(T, u[R]) : I(T, D[R]) * H);
|
|
297
|
+
if (f[$ + 3] = m ? nt(It(I(T, m))) : 255, g) {
|
|
298
|
+
const R = p * B * 3;
|
|
299
|
+
for (let U = 0; U < B; U++)
|
|
300
|
+
for (let W = 0; W < 3; W++)
|
|
301
|
+
g[R + U * 3 + W] = G(I(T, P[W * z + U]), s);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return pt({ count: c, shDegree: N, ...x, warnings: [] });
|
|
305
|
+
}
|
|
306
|
+
async function ue(e, t) {
|
|
307
|
+
t = at(t, At, "splat parse");
|
|
308
|
+
const s = "SPLAT", n = ct(t.limits);
|
|
309
|
+
mt(t.maxSHDegree);
|
|
310
|
+
const r = ut(e, n.maxInputBytes, s);
|
|
311
|
+
r.byteLength % 32 !== 0 && L(s, "length must be a multiple of 32 bytes");
|
|
312
|
+
const o = r.byteLength / 32;
|
|
313
|
+
wt(o, n, s);
|
|
314
|
+
const a = xt(o, 0), { positions: i, scales: c, rotations: l, colors: w } = a, _ = new DataView(r.buffer, r.byteOffset, r.byteLength);
|
|
315
|
+
for (let h = 0; h < o; h++) {
|
|
316
|
+
const d = h * 32, u = h * 3;
|
|
317
|
+
for (let y = 0; y < 3; y++) {
|
|
318
|
+
i[u + y] = G(_.getFloat32(d + y * 4, !0), s);
|
|
319
|
+
const m = _.getFloat32(d + 12 + y * 4, !0);
|
|
320
|
+
(!(m >= 0) || m === 1 / 0) && L(s, "holds an invalid scale"), c[u + y] = m;
|
|
321
|
+
}
|
|
322
|
+
const D = h * 4;
|
|
323
|
+
w[D] = r[d + 24], w[D + 1] = r[d + 25], w[D + 2] = r[d + 26], w[D + 3] = r[d + 27], rt(l, h * 4, (r[d + 28] - 128) / 128, (r[d + 29] - 128) / 128, (r[d + 30] - 128) / 128, (r[d + 31] - 128) / 128);
|
|
324
|
+
}
|
|
325
|
+
return pt({ count: o, shDegree: 0, ...a, warnings: [] });
|
|
326
|
+
}
|
|
327
|
+
async function me(e, t) {
|
|
328
|
+
t = at(t, At, "splat parse");
|
|
329
|
+
const s = "Compressed splat PLY", n = ct(t.limits), r = mt(t.maxSHDegree), o = ut(e, n.maxInputBytes, s), a = zt(o, s), i = a.elements.find((g) => g.name === "chunk"), c = a.elements.find((g) => g.name === "vertex");
|
|
330
|
+
(!i || !c) && L(s, "needs chunk and vertex elements");
|
|
331
|
+
const l = c.count;
|
|
332
|
+
wt(l, n, s), i.count !== Math.ceil(l / St) && L(s, "chunk count does not cover the vertices");
|
|
333
|
+
const w = ["min_x", "min_y", "min_z", "max_x", "max_y", "max_z", "min_scale_x", "min_scale_y", "min_scale_z", "max_scale_x", "max_scale_y", "max_scale_z"], _ = ["min_r", "min_g", "min_b", "max_r", "max_g", "max_b"], h = w.map((g) => dt(i, g) ?? L(s, `chunk has no ${g} property`)), d = _.map((g) => dt(i, g)), u = d.every(Boolean), D = ["packed_position", "packed_rotation", "packed_scale", "packed_color"].map((g) => {
|
|
334
|
+
const F = dt(c, g) ?? L(s, `vertex has no ${g} property`);
|
|
335
|
+
return F.type !== 5 && F.type !== 4 && L(s, `${g} must be a 32-bit integer`), F;
|
|
336
|
+
}), y = a.elements.find((g) => g.name === "sh");
|
|
337
|
+
let m = 0;
|
|
338
|
+
y && (y.count !== l && L(s, "sh element count differs from the vertex count"), m = Ct.indexOf(y.properties.length), (m < 0 || y.properties.some((g, F) => g.name !== `f_rest_${F}` || g.type !== 1)) && L(s, "sh element must hold 9, 24 or 45 uchar f_rest properties"));
|
|
339
|
+
const k = Math.min(m, r), M = xt(l, k), { positions: N, scales: P, rotations: x, colors: v, sh: A } = M, b = Ht(o, a.little), f = new Float64Array(18);
|
|
340
|
+
for (let g = 0; g < l; g++) {
|
|
341
|
+
if (g % St === 0) {
|
|
342
|
+
const W = i.start + g / St * i.stride;
|
|
343
|
+
for (let O = 0; O < 12; O++)
|
|
344
|
+
f[O] = G(b(h[O].type, W + h[O].offset), s);
|
|
345
|
+
for (let O = 0; O < 6; O++)
|
|
346
|
+
f[12 + O] = u ? G(b(d[O].type, W + d[O].offset), s) : O < 3 ? 0 : 1;
|
|
347
|
+
}
|
|
348
|
+
const F = c.start + g * c.stride, q = b(5, F + D[0].offset), z = b(5, F + D[1].offset), B = b(5, F + D[2].offset), j = b(5, F + D[3].offset), I = g * 3;
|
|
349
|
+
N[I] = f[0] + (f[3] - f[0]) * ((q >>> 21) / 2047), N[I + 1] = f[1] + (f[4] - f[1]) * ((q >>> 11 & 1023) / 1023), N[I + 2] = f[2] + (f[5] - f[2]) * ((q & 2047) / 2047), P[I] = Math.exp(f[6] + (f[9] - f[6]) * ((B >>> 21) / 2047)), P[I + 1] = Math.exp(f[7] + (f[10] - f[7]) * ((B >>> 11 & 1023) / 1023)), P[I + 2] = Math.exp(f[8] + (f[11] - f[8]) * ((B & 2047) / 2047));
|
|
350
|
+
const H = Math.SQRT2, p = ((z >>> 20 & 1023) / 1023 - 0.5) * H, T = ((z >>> 10 & 1023) / 1023 - 0.5) * H, S = ((z & 1023) / 1023 - 0.5) * H, $ = Math.sqrt(Math.max(0, 1 - (p * p + T * T + S * S))), R = z >>> 30, U = g * 4;
|
|
351
|
+
if (R === 0 ? rt(x, U, $, p, T, S) : R === 1 ? rt(x, U, p, $, T, S) : R === 2 ? rt(x, U, p, T, $, S) : rt(x, U, p, T, S, $), v[U] = nt(f[12] + (f[15] - f[12]) * ((j >>> 24) / 255)), v[U + 1] = nt(f[13] + (f[16] - f[13]) * ((j >>> 16 & 255) / 255)), v[U + 2] = nt(f[14] + (f[17] - f[14]) * ((j >>> 8 & 255) / 255)), v[U + 3] = j & 255, A && y) {
|
|
352
|
+
const W = Z(m), O = Z(k), tt = y.start + g * y.stride, et = g * O * 3;
|
|
353
|
+
for (let Y = 0; Y < O; Y++)
|
|
354
|
+
for (let X = 0; X < 3; X++) {
|
|
355
|
+
const st = o[tt + X * W + Y];
|
|
356
|
+
A[et + Y * 3 + X] = ((st === 0 ? 0 : (st + 0.5) / 256) - 0.5) * 8;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return pt({ count: l, shDegree: k, ...M, warnings: [] });
|
|
361
|
+
}
|
|
362
|
+
const _e = [-1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1];
|
|
363
|
+
async function ye(e, t) {
|
|
364
|
+
t = at(t, he, "SPZ parse");
|
|
365
|
+
const s = "SPZ", n = ct(t.limits), r = mt(t.maxSHDegree), o = ut(e, n.maxInputBytes, s), a = await ge(o, n.maxDecompressedBytes, t.signal);
|
|
366
|
+
a.length < 16 && L(s, "header is truncated");
|
|
367
|
+
const i = new DataView(a.buffer, a.byteOffset, a.byteLength);
|
|
368
|
+
i.getUint32(0, !0) !== 1347635022 && L(s, "magic is invalid");
|
|
369
|
+
const c = i.getUint32(4, !0);
|
|
370
|
+
c !== 2 && c !== 3 && L(s, `version ${c} is not supported`);
|
|
371
|
+
const l = i.getUint32(8, !0);
|
|
372
|
+
wt(l, n, s);
|
|
373
|
+
const w = a[12], _ = a[13];
|
|
374
|
+
w > 3 && L(s, "SH degree is above 3");
|
|
375
|
+
const h = Math.min(w, r), d = Z(w), u = c === 3 ? 4 : 3, D = 16 + l * (16 + u + d * 3);
|
|
376
|
+
a.length !== D && L(s, "data size does not match the header");
|
|
377
|
+
const y = xt(l, h), { positions: m, scales: k, rotations: M, colors: N, sh: P } = y, x = 16, v = x + l * 9, A = v + l, b = A + l * 3, f = b + l * 3, g = f + l * u, F = 1 / (1 << _), q = kt / 0.15;
|
|
378
|
+
for (let z = 0; z < l; z++) {
|
|
379
|
+
const B = z * 3;
|
|
380
|
+
for (let S = 0; S < 3; S++) {
|
|
381
|
+
const $ = x + (B + S) * 3, R = (a[$] | a[$ + 1] << 8 | a[$ + 2] << 16) << 8 >> 8;
|
|
382
|
+
m[B + S] = R * F * (S === 0 ? 1 : -1), k[B + S] = Math.exp(a[b + B + S] / 16 - 10);
|
|
383
|
+
}
|
|
384
|
+
const j = z * 4;
|
|
385
|
+
for (let S = 0; S < 3; S++)
|
|
386
|
+
N[j + S] = nt(0.5 + (a[A + B + S] / 255 - 0.5) * q);
|
|
387
|
+
N[j + 3] = a[v + z];
|
|
388
|
+
let I, H, p, T;
|
|
389
|
+
if (c === 2) {
|
|
390
|
+
const S = f + z * 3;
|
|
391
|
+
I = a[S] / 127.5 - 1, H = a[S + 1] / 127.5 - 1, p = a[S + 2] / 127.5 - 1, T = Math.sqrt(Math.max(0, 1 - I * I - H * H - p * p));
|
|
392
|
+
} else {
|
|
393
|
+
const S = f + z * 4;
|
|
394
|
+
let $ = (a[S] | a[S + 1] << 8 | a[S + 2] << 16 | a[S + 3] << 24) >>> 0;
|
|
395
|
+
const R = $ >>> 30, U = [0, 0, 0, 0];
|
|
396
|
+
let W = 0;
|
|
397
|
+
for (let O = 3; O >= 0; O--) {
|
|
398
|
+
if (O === R)
|
|
399
|
+
continue;
|
|
400
|
+
const tt = $ & 511, et = $ >>> 9 & 1;
|
|
401
|
+
$ >>>= 10;
|
|
402
|
+
const Y = Math.SQRT1_2 * tt / 511;
|
|
403
|
+
U[O] = et ? -Y : Y, W += Y * Y;
|
|
404
|
+
}
|
|
405
|
+
U[R] = Math.sqrt(Math.max(0, 1 - W)), I = U[0], H = U[1], p = U[2], T = U[3];
|
|
406
|
+
}
|
|
407
|
+
if (rt(M, j, T, I, -H, -p), P) {
|
|
408
|
+
const S = Z(h), $ = g + z * d * 3, R = z * S * 3;
|
|
409
|
+
for (let U = 0; U < S; U++)
|
|
410
|
+
for (let W = 0; W < 3; W++)
|
|
411
|
+
P[R + U * 3 + W] = (a[$ + U * 3 + W] - 128) / 128 * _e[U];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return pt({ count: l, shDegree: h, ...y, warnings: [] });
|
|
415
|
+
}
|
|
416
|
+
async function ge(e, t, s) {
|
|
417
|
+
(e.length < 18 || e[0] !== 31 || e[1] !== 139 || e[2] !== 8) && L("SPZ", "is not gzip data");
|
|
418
|
+
const n = e[3];
|
|
419
|
+
let r = 10;
|
|
420
|
+
n & 4 && (r += 2 + (e[r] | e[r + 1] << 8));
|
|
421
|
+
for (const i of [8, 16])
|
|
422
|
+
if (n & i) {
|
|
423
|
+
for (; r < e.length && e[r] !== 0; )
|
|
424
|
+
r++;
|
|
425
|
+
r++;
|
|
426
|
+
}
|
|
427
|
+
n & 2 && (r += 2), r >= e.length - 8 && L("SPZ", "gzip header is truncated");
|
|
428
|
+
const o = e.length, a = (e[o - 4] | e[o - 3] << 8 | e[o - 2] << 16 | e[o - 1] << 24) >>> 0;
|
|
429
|
+
if (a > t)
|
|
430
|
+
throw new C("budget", "[Nova3D] SPZ data exceeds the byte budget.");
|
|
431
|
+
return Vt(e.subarray(r, o - 8), "deflate-raw", a, s);
|
|
432
|
+
}
|
|
433
|
+
function $t(e) {
|
|
434
|
+
if (Ot(e)) {
|
|
435
|
+
const t = new TextDecoder().decode(e.subarray(0, Math.min(e.length, 65536))), s = t.indexOf("end_header");
|
|
436
|
+
return (s < 0 ? t : t.slice(0, s)).includes("packed_position") ? "compressed-ply" : "ply";
|
|
437
|
+
}
|
|
438
|
+
return e.length >= 2 && e[0] === 31 && e[1] === 139 ? "spz" : null;
|
|
439
|
+
}
|
|
440
|
+
const we = ["ply", "compressed-ply", "splat", "spz"];
|
|
441
|
+
async function xe(e, t) {
|
|
442
|
+
if (t = at(t, Pt, "splat parse"), t.format !== void 0 && !we.includes(t.format))
|
|
443
|
+
throw new C("invalid-option", "[Nova3D] Splat format must be ply, compressed-ply, splat or spz.");
|
|
444
|
+
const s = ct(t.limits), n = ut(e, s.maxInputBytes, "Splat"), r = t.format ?? $t(n) ?? "splat", o = { limits: t.limits, maxSHDegree: t.maxSHDegree };
|
|
445
|
+
switch (r) {
|
|
446
|
+
case "ply":
|
|
447
|
+
return pe(n, o);
|
|
448
|
+
case "compressed-ply":
|
|
449
|
+
return me(n, o);
|
|
450
|
+
case "spz":
|
|
451
|
+
return ye(n, { ...o, signal: t.signal });
|
|
452
|
+
default:
|
|
453
|
+
return ue(n, o);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function ve(e) {
|
|
457
|
+
const t = e.pathname.toLowerCase();
|
|
458
|
+
return t.endsWith(".compressed.ply") ? "compressed-ply" : t.endsWith(".ply") ? "ply" : t.endsWith(".spz") ? "spz" : t.endsWith(".splat") ? "splat" : null;
|
|
459
|
+
}
|
|
460
|
+
async function We(e, t) {
|
|
461
|
+
t = at(t, Pt, "splat load");
|
|
462
|
+
const s = ct(t.limits);
|
|
463
|
+
mt(t.maxSHDegree);
|
|
464
|
+
const n = Gt(e), r = await Zt(n, s.maxInputBytes, t.signal, "Splat"), o = t.format ?? $t(r) ?? ve(n) ?? "splat";
|
|
465
|
+
return xe(r, { limits: t.limits, maxSHDegree: t.maxSHDegree, format: o, signal: t.signal });
|
|
466
|
+
}
|
|
467
|
+
const qt = 65536;
|
|
468
|
+
function Se(e) {
|
|
469
|
+
return { depths: new Float32Array(e), keys: new Uint16Array(e), counts: new Uint32Array(qt) };
|
|
470
|
+
}
|
|
471
|
+
function Bt(e, t, s, n, r, o, a, i, c, l, w) {
|
|
472
|
+
let _ = 1 / 0, h = -1 / 0, d = 0;
|
|
473
|
+
for (let m = 0, k = 0; m < t; m++, k += 3) {
|
|
474
|
+
const M = -(s * e[k] + n * e[k + 1] + r * e[k + 2] + o);
|
|
475
|
+
M > a ? (i[m] = M, M < _ && (_ = M), M > h && (h = M), d++) : i[m] = -1 / 0;
|
|
476
|
+
}
|
|
477
|
+
if (d === 0)
|
|
478
|
+
return 0;
|
|
479
|
+
l.fill(0);
|
|
480
|
+
const u = h - _, D = u > 0 ? 65535 / u : 0;
|
|
481
|
+
for (let m = 0; m < t; m++) {
|
|
482
|
+
const k = i[m];
|
|
483
|
+
if (k !== -1 / 0) {
|
|
484
|
+
const M = (h - k) * D | 0;
|
|
485
|
+
c[m] = M, l[M]++;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
let y = 0;
|
|
489
|
+
for (let m = 0; m < 65536; m++) {
|
|
490
|
+
const k = l[m];
|
|
491
|
+
l[m] = y, y += k;
|
|
492
|
+
}
|
|
493
|
+
for (let m = 0; m < t; m++)
|
|
494
|
+
i[m] !== -1 / 0 && (w[l[c[m]]++] = m);
|
|
495
|
+
return d;
|
|
496
|
+
}
|
|
497
|
+
function be() {
|
|
498
|
+
return `const sortSplats=${Bt.toString()};
|
|
499
|
+
let centres=null,count=0,depths=null,keys=null,counts=null;
|
|
500
|
+
self.onmessage=(event)=>{
|
|
501
|
+
const message=event.data;
|
|
502
|
+
if(message.type==='init'){
|
|
503
|
+
centres=new Float32Array(message.centres);count=message.count;
|
|
504
|
+
depths=new Float32Array(count);keys=new Uint16Array(count);counts=new Uint32Array(${qt});
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const order=new Uint32Array(message.order);
|
|
508
|
+
const row=message.row;
|
|
509
|
+
const visible=sortSplats(centres,count,row[0],row[1],row[2],row[3],message.near,depths,keys,counts,order);
|
|
510
|
+
self.postMessage({type:'sorted',id:message.id,visible,order:message.order},[message.order]);
|
|
511
|
+
};`;
|
|
512
|
+
}
|
|
513
|
+
class De {
|
|
514
|
+
/**
|
|
515
|
+
* `onResult` receives every sort result; `onFallback` runs when a failing worker
|
|
516
|
+
* dropped an in-flight request, so the owner sorts again synchronously.
|
|
517
|
+
*/
|
|
518
|
+
constructor(t, s, n, r, o, a = () => {
|
|
519
|
+
}) {
|
|
520
|
+
if (this._centres = t, this._count = s, this._capacity = n, this._onResult = o, this._onFallback = a, !Number.isSafeInteger(n) || n < s)
|
|
521
|
+
throw new C("invalid-option", "[Nova3D] Splat order capacity must hold every splat.");
|
|
522
|
+
this._order = new Uint32Array(Math.max(1, n)), r === "worker" && s > 0 && this._startWorker();
|
|
523
|
+
}
|
|
524
|
+
_order;
|
|
525
|
+
_scratch = null;
|
|
526
|
+
_worker = null;
|
|
527
|
+
_url = null;
|
|
528
|
+
_pending = !1;
|
|
529
|
+
_id = 0;
|
|
530
|
+
_row = new Float64Array(4);
|
|
531
|
+
_destroyed = !1;
|
|
532
|
+
/** 'worker' while a worker sorts, otherwise 'sync'. */
|
|
533
|
+
get mode() {
|
|
534
|
+
return this._worker ? "worker" : "sync";
|
|
535
|
+
}
|
|
536
|
+
/** Whether a worker sort is in flight. */
|
|
537
|
+
get pending() {
|
|
538
|
+
return this._pending;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Sorts for the model-view row (a, b, c, d). Synchronous mode delivers the
|
|
542
|
+
* result before returning; worker mode returns false when a sort is already in
|
|
543
|
+
* flight (the caller retries on a later frame).
|
|
544
|
+
*/
|
|
545
|
+
sort(t, s, n, r, o) {
|
|
546
|
+
if (this._destroyed)
|
|
547
|
+
return !1;
|
|
548
|
+
if (this._worker) {
|
|
549
|
+
if (this._pending || !this._order)
|
|
550
|
+
return !1;
|
|
551
|
+
const l = this._row;
|
|
552
|
+
l[0] = t, l[1] = s, l[2] = n, l[3] = r;
|
|
553
|
+
const w = this._order.buffer;
|
|
554
|
+
this._order = null, this._pending = !0;
|
|
555
|
+
const _ = { type: "sort", id: ++this._id, row: l, near: o, order: w };
|
|
556
|
+
try {
|
|
557
|
+
return this._worker.postMessage(_, [w]), !0;
|
|
558
|
+
} catch {
|
|
559
|
+
this._order = new Uint32Array(Math.max(1, this._capacity)), this._pending = !1, this._stopWorker();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const a = this._order;
|
|
563
|
+
this._scratch ??= Se(this._count);
|
|
564
|
+
const i = this._scratch, c = Bt(this._centres, this._count, t, s, n, r, o, i.depths, i.keys, i.counts, a);
|
|
565
|
+
return this._onResult({ order: a, visible: c }), !0;
|
|
566
|
+
}
|
|
567
|
+
destroy() {
|
|
568
|
+
this._destroyed = !0, this._stopWorker(), this._order = null, this._scratch = null;
|
|
569
|
+
}
|
|
570
|
+
_startWorker() {
|
|
571
|
+
if (!(typeof Worker > "u" || typeof Blob > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function"))
|
|
572
|
+
try {
|
|
573
|
+
this._url = URL.createObjectURL(new Blob([be()], { type: "text/javascript" }));
|
|
574
|
+
const t = new Worker(this._url);
|
|
575
|
+
t.onmessage = (n) => {
|
|
576
|
+
const r = n.data;
|
|
577
|
+
this._destroyed || r?.type !== "sorted" || (this._pending = !1, this._order = new Uint32Array(r.order), this._onResult({ order: this._order, visible: r.visible }));
|
|
578
|
+
}, t.onerror = (n) => {
|
|
579
|
+
n.preventDefault?.(), this._stopWorker();
|
|
580
|
+
const r = this._pending;
|
|
581
|
+
this._order || (this._order = new Uint32Array(Math.max(1, this._capacity))), this._pending = !1, r && !this._destroyed && this._onFallback();
|
|
582
|
+
};
|
|
583
|
+
const s = this._centres.slice().buffer;
|
|
584
|
+
t.postMessage({ type: "init", centres: s, count: this._count }, [s]), this._worker = t;
|
|
585
|
+
} catch {
|
|
586
|
+
this._stopWorker();
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
_stopWorker() {
|
|
590
|
+
this._worker?.terminate(), this._worker = null, this._url && (URL.revokeObjectURL(this._url), this._url = null);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const Me = ["id", "visible", "pickable", "position", "rotation", "quaternion", "scale", "parent"], ke = yt({ ...te, sortCamera: !0, sort: !0, opacity: !0, colorSpace: !0, shDegree: !0, antialias: !0, depthTest: !0, renderOrder: !0, layers: !0 }), Ae = 26, bt = 2, Ne = 1 - 1e-6, Ie = 1e-3, Tt = gt(), Ft = gt(), Dt = gt(), Le = gt();
|
|
594
|
+
class Te extends Xt {
|
|
595
|
+
/** @internal */
|
|
596
|
+
_splats = null;
|
|
597
|
+
setGeometry() {
|
|
598
|
+
throw new C("owner", "[Nova3D] The geometry of splats is internal.");
|
|
599
|
+
}
|
|
600
|
+
setMaterial() {
|
|
601
|
+
throw new C("owner", "[Nova3D] The material of splats is internal.");
|
|
602
|
+
}
|
|
603
|
+
/** @internal */
|
|
604
|
+
_intersect(t, s) {
|
|
605
|
+
const n = super._intersect(t, "bounds");
|
|
606
|
+
return n === null || s === "bounds" || !this._splats ? n : this._splats._pick(t);
|
|
607
|
+
}
|
|
608
|
+
/** @internal */
|
|
609
|
+
_onDestroy() {
|
|
610
|
+
super._onDestroy(), this._splats?._teardown();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
class Fe {
|
|
614
|
+
/**
|
|
615
|
+
* The scene node drawing the splats: transform, reparent, hide or parent other
|
|
616
|
+
* nodes to it. Splat hits report it as `hit.node`.
|
|
617
|
+
*/
|
|
618
|
+
node;
|
|
619
|
+
/** Splats held. */
|
|
620
|
+
count;
|
|
621
|
+
/** SH degree evaluated by the shader. */
|
|
622
|
+
shDegree;
|
|
623
|
+
_mesh;
|
|
624
|
+
_app;
|
|
625
|
+
_centres;
|
|
626
|
+
_scales;
|
|
627
|
+
_rotations;
|
|
628
|
+
_opacities;
|
|
629
|
+
_dataTexture;
|
|
630
|
+
_orderTexture;
|
|
631
|
+
_orderWidth;
|
|
632
|
+
_sorter;
|
|
633
|
+
_sortCamera;
|
|
634
|
+
/** Model-view row of the last sort request (a, b, c, d) and its near cull; NaN before any. */
|
|
635
|
+
_sortedRow = new Float64Array(5).fill(Number.NaN);
|
|
636
|
+
_radius;
|
|
637
|
+
_viewport = new Float64Array(2);
|
|
638
|
+
_maxAxis = 0;
|
|
639
|
+
_cleanup = [];
|
|
640
|
+
_drawn = 0;
|
|
641
|
+
/** @internal */
|
|
642
|
+
constructor(t, s, n, r = {}) {
|
|
643
|
+
const o = Ue(t, s, n, r);
|
|
644
|
+
let a;
|
|
645
|
+
try {
|
|
646
|
+
a = new Te(s, o.meshOptions);
|
|
647
|
+
} catch (c) {
|
|
648
|
+
throw o.dispose(), c;
|
|
649
|
+
}
|
|
650
|
+
this._mesh = a, this.node = a, this.count = n.count, this.shDegree = o.degree, this._app = t, this._centres = n.positions.slice(), this._scales = n.scales.slice(), this._rotations = n.rotations.slice(), this._opacities = new Uint8Array(n.count);
|
|
651
|
+
for (let c = 0; c < n.count; c++)
|
|
652
|
+
this._opacities[c] = n.colors[c * 4 + 3];
|
|
653
|
+
this._dataTexture = o.dataTexture, this._orderTexture = o.orderTexture, this._orderWidth = o.width, this._sortCamera = r.sortCamera ?? null;
|
|
654
|
+
const i = o.bounds;
|
|
655
|
+
this._radius = Math.max(1e-6, 0.5 * Math.hypot(i.max[0] - i.min[0], i.max[1] - i.min[1], i.max[2] - i.min[2])), a._drawInstances = 0, this._sorter = new De(this._centres, n.count, o.width * o.rows, r.sort ?? "worker", this._onSorted, this._onFallback), a._splats = this, this._cleanup.push(t._own(() => this.destroy())), this._cleanup.push(t._beforeRender(this._onBeforeRender));
|
|
656
|
+
}
|
|
657
|
+
get destroyed() {
|
|
658
|
+
return this._mesh.destroyed;
|
|
659
|
+
}
|
|
660
|
+
/** Draw order within the blended group; see `Nova3DMesh.renderOrder`. */
|
|
661
|
+
get renderOrder() {
|
|
662
|
+
return this._mesh.renderOrder;
|
|
663
|
+
}
|
|
664
|
+
setRenderOrder(t) {
|
|
665
|
+
this._mesh.setRenderOrder(t);
|
|
666
|
+
}
|
|
667
|
+
/** Layer bit mask; see `Nova3DMesh.layers`. */
|
|
668
|
+
get layers() {
|
|
669
|
+
return this._mesh.layers;
|
|
670
|
+
}
|
|
671
|
+
setLayers(t) {
|
|
672
|
+
this._mesh.setLayers(t);
|
|
673
|
+
}
|
|
674
|
+
/** Removes the node and releases the textures, material, geometry and sort worker. */
|
|
675
|
+
destroy() {
|
|
676
|
+
this._mesh.destroyed || this._mesh.destroy();
|
|
677
|
+
}
|
|
678
|
+
/** Splats drawn by the last sort: those in front of the sort camera. */
|
|
679
|
+
get drawCount() {
|
|
680
|
+
return this._drawn;
|
|
681
|
+
}
|
|
682
|
+
/** 'worker' while sorting runs in a worker, otherwise 'sync'. */
|
|
683
|
+
get sortMode() {
|
|
684
|
+
return this._sorter.mode;
|
|
685
|
+
}
|
|
686
|
+
/** The camera sorted for, or null to follow the primary view camera. */
|
|
687
|
+
get sortCamera() {
|
|
688
|
+
return this._sortCamera;
|
|
689
|
+
}
|
|
690
|
+
/** Sorts for this camera, or for the primary view camera with null. */
|
|
691
|
+
setSortCamera(t) {
|
|
692
|
+
const s = this._mesh;
|
|
693
|
+
s._assertLogicalWrite(), t !== null && Wt(t, s.scene), this._sortCamera = t, this._sortedRow.fill(Number.NaN), s.scene._invalidate();
|
|
694
|
+
}
|
|
695
|
+
/** Multiplies every splat's opacity, [0, 1]. */
|
|
696
|
+
setOpacity(t) {
|
|
697
|
+
this._mesh._assertLogicalWrite(), this._mesh.material.set({ opacity: jt(t) });
|
|
698
|
+
}
|
|
699
|
+
get opacity() {
|
|
700
|
+
return this._mesh.material.getOptions().opacity ?? 1;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Nearest splat along the ray, each a 2σ ellipsoid with opacity ≥ 0.1; called
|
|
704
|
+
* after the bounding box was hit. The hit reports the splat as `instanceIndex`.
|
|
705
|
+
* @internal
|
|
706
|
+
*/
|
|
707
|
+
_pick(t) {
|
|
708
|
+
const s = this._mesh;
|
|
709
|
+
s.scene._flushMatrices();
|
|
710
|
+
const n = Nt(Le, s._worldState().matrix);
|
|
711
|
+
if (!n)
|
|
712
|
+
return null;
|
|
713
|
+
const [r, o, a] = t.origin, [i, c, l] = t.direction, w = n[0] * r + n[4] * o + n[8] * a + n[12], _ = n[1] * r + n[5] * o + n[9] * a + n[13], h = n[2] * r + n[6] * o + n[10] * a + n[14], d = n[0] * i + n[4] * c + n[8] * l, u = n[1] * i + n[5] * c + n[9] * l, D = n[2] * i + n[6] * c + n[10] * l, y = this._centres, m = this._scales, k = this._rotations, M = this._opacities;
|
|
714
|
+
let N = 1 / 0, P = -1;
|
|
715
|
+
for (let v = 0; v < this.count; v++) {
|
|
716
|
+
if (M[v] < Ae)
|
|
717
|
+
continue;
|
|
718
|
+
const A = v * 3, b = v * 4, f = -k[b], g = -k[b + 1], F = -k[b + 2], q = k[b + 3], z = w - y[A], B = _ - y[A + 1], j = h - y[A + 2];
|
|
719
|
+
let I = g * j - F * B, H = F * z - f * j, p = f * B - g * z;
|
|
720
|
+
const T = z + 2 * (q * I + g * p - F * H), S = B + 2 * (q * H + F * I - f * p), $ = j + 2 * (q * p + f * H - g * I);
|
|
721
|
+
I = g * D - F * u, H = F * d - f * D, p = f * u - g * d;
|
|
722
|
+
const R = d + 2 * (q * I + g * p - F * H), U = u + 2 * (q * H + F * I - f * p), W = D + 2 * (q * p + f * H - g * I), O = 1 / Math.max(m[A] * bt, 1e-12), tt = 1 / Math.max(m[A + 1] * bt, 1e-12), et = 1 / Math.max(m[A + 2] * bt, 1e-12), Y = T * O, X = S * tt, st = $ * et, lt = R * O, ot = U * tt, ht = W * et, K = lt * lt + ot * ot + ht * ht, E = Y * lt + X * ot + st * ht, Q = Y * Y + X * X + st * st - 1, ft = E * E - K * Q;
|
|
723
|
+
if (K === 0 || ft < 0)
|
|
724
|
+
continue;
|
|
725
|
+
const J = Math.sqrt(ft);
|
|
726
|
+
let V = (-E - J) / K;
|
|
727
|
+
V < 0 && (V = Q <= 0 ? 0 : (-E + J) / K), V >= 0 && V < N && (N = V, P = v);
|
|
728
|
+
}
|
|
729
|
+
if (P < 0)
|
|
730
|
+
return null;
|
|
731
|
+
const x = [r + i * N, o + c * N, a + l * N];
|
|
732
|
+
return { node: s, point: x, normal: null, distance: N, instanceIndex: P };
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Releases everything the splats own once their node is destroyed.
|
|
736
|
+
* @internal
|
|
737
|
+
*/
|
|
738
|
+
_teardown() {
|
|
739
|
+
for (const t of this._cleanup.splice(0))
|
|
740
|
+
t();
|
|
741
|
+
this._sorter.destroy(), this._mesh.material.destroy(), this._dataTexture.destroy(), this._orderTexture.destroy(), this._mesh.geometry.destroy();
|
|
742
|
+
}
|
|
743
|
+
/** Keeps the viewport uniform current and requests a sort when the view changed enough. */
|
|
744
|
+
_onBeforeRender = () => {
|
|
745
|
+
if (this.destroyed || this.count === 0)
|
|
746
|
+
return;
|
|
747
|
+
const t = this._mesh, s = this._app.size, n = Math.max(1, Math.round(s.width * s.dpr)), r = Math.max(1, Math.round(s.height * s.dpr));
|
|
748
|
+
if (n !== this._viewport[0] || r !== this._viewport[1]) {
|
|
749
|
+
this._viewport[0] = n, this._viewport[1] = r, t.material.setUniform("splatViewport", [n, r]), this._maxAxis = Math.max(1024, n, r);
|
|
750
|
+
const u = t.material._shaderUniforms().values.get("splatParams");
|
|
751
|
+
t.material.setUniform("splatParams", [u[0], u[1], u[2], this._maxAxis]);
|
|
752
|
+
}
|
|
753
|
+
if (!t._effective("visible"))
|
|
754
|
+
return;
|
|
755
|
+
let o = this._sortCamera;
|
|
756
|
+
if (o === null) {
|
|
757
|
+
const u = this._app.view;
|
|
758
|
+
o = u && u.scene === t.scene ? u.camera : null;
|
|
759
|
+
}
|
|
760
|
+
if (!o || o.destroyed || o.scene !== t.scene || (t.getWorldMatrix(Tt), o.getWorldMatrix(Ft), !Nt(Dt, Ft)))
|
|
761
|
+
return;
|
|
762
|
+
const a = Qt(Dt, Dt, Tt), i = a[2], c = a[6], l = a[10], w = a[14], _ = o.kind === "perspective" ? 0 : -1 / 0, h = this._sortedRow, d = Math.hypot(i, c, l);
|
|
763
|
+
if (d > 0) {
|
|
764
|
+
if (h[4] === _) {
|
|
765
|
+
const u = Math.hypot(h[0], h[1], h[2]), D = (i * h[0] + c * h[1] + l * h[2]) / (d * u), y = Math.abs(w / d - h[3] / u);
|
|
766
|
+
if (D >= Ne && y <= Ie * this._radius)
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
this._sorter.sort(i, c, l, w, _) && (h[0] = i, h[1] = c, h[2] = l, h[3] = w, h[4] = _);
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
/** Uploads the sorted prefix of the order texture and draws that many splats. */
|
|
773
|
+
_onSorted = (t) => {
|
|
774
|
+
if (this.destroyed)
|
|
775
|
+
return;
|
|
776
|
+
const s = this._orderWidth, n = Math.ceil(t.visible / s);
|
|
777
|
+
this._drawn = t.visible, this._mesh._drawInstances = t.visible, n > 0 ? this._orderTexture.updateRegion(0, 0, s, n, new Uint8Array(t.order.buffer, 0, s * n * 4)) : this._mesh.scene._invalidate();
|
|
778
|
+
};
|
|
779
|
+
/** A worker failed mid-sort: forget the request so the next frame sorts again. */
|
|
780
|
+
_onFallback = () => {
|
|
781
|
+
this.destroyed || (this._sortedRow.fill(Number.NaN), this._mesh.scene._invalidate());
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function Wt(e, t) {
|
|
785
|
+
if (typeof e != "object" || e === null || !("kind" in e) || e.destroyed || e.scene !== t)
|
|
786
|
+
throw new C("owner", "[Nova3D] Splat sortCamera must be a live camera of the same scene.");
|
|
787
|
+
}
|
|
788
|
+
function jt(e) {
|
|
789
|
+
if (typeof e != "number" || !(e >= 0 && e <= 1))
|
|
790
|
+
throw new C("invalid-option", "[Nova3D] Splat opacity must be in [0, 1].");
|
|
791
|
+
return e;
|
|
792
|
+
}
|
|
793
|
+
function Ue(e, t, s, n) {
|
|
794
|
+
if (!e || e.destroyed || typeof e.createGeometry != "function" || !e._ownsScene(t))
|
|
795
|
+
throw new C("owner", "[Nova3D] Splats need a live app and one of its scenes.");
|
|
796
|
+
if (!n || typeof n != "object")
|
|
797
|
+
throw new C("invalid-option", "[Nova3D] Splat options must be an object.");
|
|
798
|
+
for (const b of Object.keys(n))
|
|
799
|
+
if (!ke.has(b))
|
|
800
|
+
throw new C("invalid-option", `[Nova3D] Unknown splat option ${b}.`);
|
|
801
|
+
Ut(s);
|
|
802
|
+
const r = n.sort ?? "worker";
|
|
803
|
+
if (r !== "worker" && r !== "sync")
|
|
804
|
+
throw new C("invalid-option", "[Nova3D] Splat sort must be worker or sync.");
|
|
805
|
+
const o = n.colorSpace ?? "srgb";
|
|
806
|
+
if (o !== "srgb" && o !== "linear")
|
|
807
|
+
throw new C("invalid-option", "[Nova3D] Splat colorSpace must be srgb or linear.");
|
|
808
|
+
for (const b of ["antialias", "depthTest"])
|
|
809
|
+
if (n[b] !== void 0 && typeof n[b] != "boolean")
|
|
810
|
+
throw new C("invalid-option", `[Nova3D] Splat ${b} must be boolean.`);
|
|
811
|
+
const a = jt(n.opacity ?? 1), i = n.shDegree ?? s.shDegree;
|
|
812
|
+
if (i !== 0 && i !== 1 && i !== 2 && i !== 3)
|
|
813
|
+
throw new C("invalid-option", "[Nova3D] Splat shDegree must be 0, 1, 2 or 3.");
|
|
814
|
+
const c = Math.min(i, s.shDegree);
|
|
815
|
+
n.sortCamera && Wt(n.sortCamera, t);
|
|
816
|
+
const l = n.parent;
|
|
817
|
+
if (l !== void 0 && (!(l instanceof Jt) || l.destroyed || l.scene !== t))
|
|
818
|
+
throw new C("owner", "[Nova3D] Splat parent must be a live node of the scene.");
|
|
819
|
+
const w = le(s), { width: _, shift: h, rows: d, layers: u, bounds: D } = w, y = Math.ceil(Z(c) * 3 / 4), m = w.shScale * 255 / 127, k = -w.shScale * 128 / 127;
|
|
820
|
+
let M, N, P, x;
|
|
821
|
+
try {
|
|
822
|
+
M = e.createTexture({ width: _, height: d, depth: u, dimension: "2d-array", data: w.texels, format: "rgba8", colorSpace: "linear", filter: "nearest", mipmaps: !1 }), N = e.createTexture({ width: _, height: d, data: new Uint8Array(_ * d * 4), format: "rgba8", colorSpace: "linear", filter: "nearest", mipmaps: !1 }), P = e.createMaterial({
|
|
823
|
+
type: "shader",
|
|
824
|
+
vertex: ne,
|
|
825
|
+
fragment: se,
|
|
826
|
+
uniforms: { splatData: M, splatOrder: N, splatViewport: [1, 1], splatParams: [w.covarianceScale, m, k, 1024] },
|
|
827
|
+
defines: { SPLAT_SHIFT: h, SPLAT_SH_DEGREE: c, SPLAT_SH_TEXELS: Math.max(1, y), SPLAT_SRGB: o === "srgb", SPLAT_ANTIALIAS: n.antialias ?? !1 },
|
|
828
|
+
alphaMode: "blend",
|
|
829
|
+
blending: "normal",
|
|
830
|
+
depthTest: n.depthTest ?? !0,
|
|
831
|
+
depthWrite: !1,
|
|
832
|
+
side: "double",
|
|
833
|
+
opacity: a
|
|
834
|
+
});
|
|
835
|
+
const { min: b, max: f } = D;
|
|
836
|
+
x = e.createGeometry({ positions: new Float32Array([...b, ...f, ...b, ...f]), indices: new Uint16Array([0, 1, 2, 0, 2, 3]) });
|
|
837
|
+
} catch (b) {
|
|
838
|
+
throw P?.destroy(), M?.destroy(), N?.destroy(), x?.destroy(), b;
|
|
839
|
+
}
|
|
840
|
+
const v = { geometry: x, material: P, renderOrder: n.renderOrder, layers: n.layers };
|
|
841
|
+
for (const b of Me)
|
|
842
|
+
n[b] !== void 0 && (v[b] = n[b]);
|
|
843
|
+
return { meshOptions: v, dataTexture: M, orderTexture: N, width: _, rows: d, degree: c, bounds: D, dispose: () => {
|
|
844
|
+
P.destroy(), M.destroy(), N.destroy(), x.destroy();
|
|
845
|
+
} };
|
|
846
|
+
}
|
|
847
|
+
function je(e, t, s = {}) {
|
|
848
|
+
return new Fe(ee(e), e, t, s);
|
|
849
|
+
}
|
|
850
|
+
export {
|
|
851
|
+
Mt as MAX_SPLATS,
|
|
852
|
+
Fe as Nova3DSplats,
|
|
853
|
+
je as createSplats,
|
|
854
|
+
We as loadSplats,
|
|
855
|
+
me as parseCompressedPLYSplats,
|
|
856
|
+
pe as parsePLYSplats,
|
|
857
|
+
ue as parseSPLAT,
|
|
858
|
+
ye as parseSPZ,
|
|
859
|
+
xe as parseSplats,
|
|
860
|
+
Bt as sortSplats,
|
|
861
|
+
oe as splatCovariance
|
|
862
|
+
};
|