@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,527 @@
|
|
|
1
|
+
import { N as m } from "./Errors-B2ekO9bZ.js";
|
|
2
|
+
import { p as Vt, l as Tt } from "./Color-vuv9UnoY.js";
|
|
3
|
+
import { c as qt, t as zt, a as Rt, b as Pt, d as Nt, n as kt, e as Mt, f as Ot, g as B, h as St, j as Yt, k as jt, s as Ct, l as Gt, m as Wt, o as $t, q as Ut, r as Xt, u as Zt, i as Kt, v as Qt, w as Lt } from "./Node-QfgAE2_v.js";
|
|
4
|
+
import { o as Ht } from "./Options-CajE7LLJ.js";
|
|
5
|
+
import { N as Jt, m as ts } from "./Mesh-BaRxAAJq.js";
|
|
6
|
+
const ls = Ht({ ...ts, capacity: !0, count: !0, colors: !0, frames: !0 }), ss = 65536;
|
|
7
|
+
let D = 256, Et = new Float64Array(D * 10), Ft = new Float32Array(D * 16);
|
|
8
|
+
function es(a) {
|
|
9
|
+
if (a <= D)
|
|
10
|
+
return !0;
|
|
11
|
+
if (a > ss)
|
|
12
|
+
return !1;
|
|
13
|
+
for (; D < a; )
|
|
14
|
+
D *= 2;
|
|
15
|
+
return Et = new Float64Array(D * 10), Ft = new Float32Array(D * 16), !0;
|
|
16
|
+
}
|
|
17
|
+
const C = new Float64Array(6), At = new Float64Array(4);
|
|
18
|
+
function ns() {
|
|
19
|
+
C[0] = 1 / 0, C[1] = 1 / 0, C[2] = 1 / 0, C[3] = -1 / 0, C[4] = -1 / 0, C[5] = -1 / 0;
|
|
20
|
+
}
|
|
21
|
+
const A = new Float32Array(4), V = 4096, tt = (() => {
|
|
22
|
+
const a = new Float64Array(V + 2);
|
|
23
|
+
for (let t = 0; t <= V; t++)
|
|
24
|
+
a[t] = Tt(t / V);
|
|
25
|
+
return a[V + 1] = 1, a;
|
|
26
|
+
})();
|
|
27
|
+
function Dt(a) {
|
|
28
|
+
const t = (a <= 0 ? 0 : a >= 1 ? 1 : a) * V, s = t | 0, n = t - s;
|
|
29
|
+
return tt[s] + (tt[s + 1] - tt[s]) * n;
|
|
30
|
+
}
|
|
31
|
+
class ds extends Jt {
|
|
32
|
+
capacity;
|
|
33
|
+
_count;
|
|
34
|
+
_poses;
|
|
35
|
+
_matrices;
|
|
36
|
+
_version = 1;
|
|
37
|
+
_journal = [];
|
|
38
|
+
_instancesBounds;
|
|
39
|
+
_instancesBoundsVersion = -1;
|
|
40
|
+
_instancesBoundsWorld = -1;
|
|
41
|
+
_instancesBoundsGeometry = -1;
|
|
42
|
+
/** Per-instance world boxes `[minX,minY,minZ,maxX,maxY,maxZ]`, valid for a world/geometry version. */
|
|
43
|
+
_boxes;
|
|
44
|
+
_boxesWorld = -1;
|
|
45
|
+
_boxesGeometry = -1;
|
|
46
|
+
/** Prefix of `_boxes` computed since the last full rebuild. */
|
|
47
|
+
_boxesCount = 0;
|
|
48
|
+
/** Instance range written since the boxes were last refreshed. */
|
|
49
|
+
_dirtyStart = Number.POSITIVE_INFINITY;
|
|
50
|
+
_dirtyEnd = 0;
|
|
51
|
+
/** Linear RGBA per instance when created with `colors`. */
|
|
52
|
+
_colors;
|
|
53
|
+
_colorVersion = 0;
|
|
54
|
+
_colorStart = Number.POSITIVE_INFINITY;
|
|
55
|
+
_colorEnd = 0;
|
|
56
|
+
/** Sprite-sheet frame per instance when created with `frames`. */
|
|
57
|
+
_frames;
|
|
58
|
+
_frameVersion = 0;
|
|
59
|
+
_frameStart = Number.POSITIVE_INFINITY;
|
|
60
|
+
_frameEnd = 0;
|
|
61
|
+
/** @internal */
|
|
62
|
+
constructor(t, s) {
|
|
63
|
+
if (!Number.isSafeInteger(s.capacity) || s.capacity < 1 || s.capacity * 168 > 64 * 1024 * 1024)
|
|
64
|
+
throw new m("invalid-option", "[Nova3D] Instance capacity must be positive and fit the 64 MiB CPU instance budget.");
|
|
65
|
+
const n = s.count ?? s.capacity;
|
|
66
|
+
if (!Number.isSafeInteger(n) || n < 0 || n > s.capacity)
|
|
67
|
+
throw new m("invalid-option", "[Nova3D] Invalid instance count.");
|
|
68
|
+
const i = new Float64Array(s.capacity * 10), e = new Float32Array(s.capacity * 16);
|
|
69
|
+
if (s.colors !== void 0 && typeof s.colors != "boolean")
|
|
70
|
+
throw new m("invalid-option", "[Nova3D] Instance colors must be boolean.");
|
|
71
|
+
const r = s.colors ? new Float32Array(s.capacity * 4).fill(1) : null;
|
|
72
|
+
if (s.frames !== void 0 && typeof s.frames != "boolean")
|
|
73
|
+
throw new m("invalid-option", "[Nova3D] Instance frames must be boolean.");
|
|
74
|
+
const o = s.frames ? new Float32Array(s.capacity) : null, c = new Uint8Array(s.capacity);
|
|
75
|
+
super(t, s), this._mirrored = c, this._colors = r, this._frames = o, this.capacity = s.capacity, this._count = n, this._poses = i, this._matrices = e;
|
|
76
|
+
const _ = Kt();
|
|
77
|
+
for (let h = 0; h < this.capacity; h++)
|
|
78
|
+
this._write(h, _);
|
|
79
|
+
}
|
|
80
|
+
get count() {
|
|
81
|
+
return this._count;
|
|
82
|
+
}
|
|
83
|
+
/** @internal */
|
|
84
|
+
get _instanceVersion() {
|
|
85
|
+
return this._version;
|
|
86
|
+
}
|
|
87
|
+
/** 1 where the instance scale has a negative product (a mirrored instance). */
|
|
88
|
+
_mirrored;
|
|
89
|
+
_mirroredCount = 0;
|
|
90
|
+
/**
|
|
91
|
+
* True when some instance may be mirrored (or the poses are not derived yet): only then
|
|
92
|
+
* must shaders cull faces per instance with a discard; otherwise fixed-function culling
|
|
93
|
+
* keeps early depth rejection.
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
get _mayMirror() {
|
|
97
|
+
return this._mirroredCount > 0 || this._recordPoses !== null;
|
|
98
|
+
}
|
|
99
|
+
/** Recounts mirrored instances in [start, end) from the pose scales. */
|
|
100
|
+
_countMirrors(t, s) {
|
|
101
|
+
const n = this._poses, i = this._mirrored;
|
|
102
|
+
let e = this._mirroredCount;
|
|
103
|
+
for (let r = t; r < s; r++) {
|
|
104
|
+
const o = r * 10, c = n[o + 7] * n[o + 8] * n[o + 9] < 0 ? 1 : 0;
|
|
105
|
+
e += c - i[r], i[r] = c;
|
|
106
|
+
}
|
|
107
|
+
this._mirroredCount = e;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Compact quad records of an owner that draws through pulled quads (WebGL particles),
|
|
111
|
+
* `_quadRecordTexels` RGBA texels per instance: position xyz and scale; then, with
|
|
112
|
+
* `_quadRecordRoll`, the scaled cos and sin of the roll, frame and an unused float; then,
|
|
113
|
+
* without `_quadRecordColor`, the linear colour. Without the roll texel the roll is zero
|
|
114
|
+
* (column (scale, 0)); `_quadRecordColor` is the linear colour shared by every instance.
|
|
115
|
+
* The owner fills them and calls `_writeRecords`.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
_quadRecords = null;
|
|
119
|
+
/** @internal */
|
|
120
|
+
_quadRecordTexels = 3;
|
|
121
|
+
/** @internal */
|
|
122
|
+
_quadRecordRoll = !0;
|
|
123
|
+
/** @internal */
|
|
124
|
+
_quadRecordColor = null;
|
|
125
|
+
/** @internal */
|
|
126
|
+
_quadRecordVersion = 0;
|
|
127
|
+
/** Owner pose source behind the last `_writeRecords`; the instance arrays derive from it on first read. */
|
|
128
|
+
_recordPoses = null;
|
|
129
|
+
_recordCount = 0;
|
|
130
|
+
/**
|
|
131
|
+
* Owner write of `count` complete quad records (colour included); `poses` returns their
|
|
132
|
+
* packed poses (10 floats each) on demand: matrices, colours and frames are derived only
|
|
133
|
+
* when something reads them, so a WebGL particle frame touches just the records.
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
_writeRecords(t, s) {
|
|
137
|
+
this._recordPoses = s, this._recordCount = t, this._quadRecordVersion++, t > 0 && (this._colors && (this._colorStart = 0, this._colorEnd = Math.max(this._colorEnd, t), this._colorVersion++), this._frames && (this._frameStart = 0, this._frameEnd = Math.max(this._frameEnd, t), this._frameVersion++), this._changed(0, t));
|
|
138
|
+
}
|
|
139
|
+
/** Derives poses, matrices, colours and frames of the last records write. */
|
|
140
|
+
_sync() {
|
|
141
|
+
const t = this._recordPoses;
|
|
142
|
+
if (t === null)
|
|
143
|
+
return;
|
|
144
|
+
this._recordPoses = null;
|
|
145
|
+
const s = this._quadRecords, n = this._recordCount, i = this._poses;
|
|
146
|
+
i.set(t().subarray(0, n * 10)), this._countMirrors(0, n);
|
|
147
|
+
const e = this._quadRecordTexels * 4, r = this._quadRecordColor, o = e - 4, c = this._colors, _ = this._quadRecordRoll ? this._frames : null;
|
|
148
|
+
for (let h = 0; h < n; h++) {
|
|
149
|
+
et(this._matrices, h * 16, i, h * 10);
|
|
150
|
+
const f = h * e;
|
|
151
|
+
if (c) {
|
|
152
|
+
const l = h * 4;
|
|
153
|
+
r ? (c[l] = r[0], c[l + 1] = r[1], c[l + 2] = r[2], c[l + 3] = r[3]) : (c[l] = s[f + o], c[l + 1] = s[f + o + 1], c[l + 2] = s[f + o + 2], c[l + 3] = s[f + o + 3]);
|
|
154
|
+
}
|
|
155
|
+
_ && (_[h] = s[f + 6]);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
setCount(t) {
|
|
159
|
+
if (this._assertAlive(), !Number.isSafeInteger(t) || t < 0 || t > this.capacity)
|
|
160
|
+
throw new m("invalid-option", "[Nova3D] Invalid instance count.");
|
|
161
|
+
t !== this._count && (this._count = t, this._changed(0, 0));
|
|
162
|
+
}
|
|
163
|
+
setTransform(t, s) {
|
|
164
|
+
if (this._sync(), typeof t != "number") {
|
|
165
|
+
super.setTransform(t);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!s)
|
|
169
|
+
throw new m("invalid-option", "[Nova3D] An instance transform patch is required.");
|
|
170
|
+
qt(s), this.updateRange(t, [s]);
|
|
171
|
+
}
|
|
172
|
+
updateRange(t, s) {
|
|
173
|
+
this._sync(), this._assertAlive();
|
|
174
|
+
const n = s.length;
|
|
175
|
+
if (!Number.isSafeInteger(t) || t < 0 || t + n > this.capacity)
|
|
176
|
+
throw new m("budget", "[Nova3D] Instance update exceeds fixed capacity.");
|
|
177
|
+
const i = es(n), e = i ? Et : new Float64Array(n * 10), r = i ? Ft : new Float32Array(n * 16);
|
|
178
|
+
for (let o = 0; o < n; o++)
|
|
179
|
+
is(e, o * 10, this._poses, (t + o) * 10, s[o]);
|
|
180
|
+
for (let o = 0; o < n; o++) {
|
|
181
|
+
const c = o * 10, _ = o * 16;
|
|
182
|
+
et(r, _, e, c);
|
|
183
|
+
for (let h = _; h < _ + 16; h++)
|
|
184
|
+
if (!Number.isFinite(r[h]))
|
|
185
|
+
throw new m("invalid-option", "[Nova3D] Instance matrix exceeds finite Float32 coordinates.");
|
|
186
|
+
}
|
|
187
|
+
this._poses.set(e.subarray(0, n * 10), t * 10), this._matrices.set(r.subarray(0, n * 16), t * 16), n && this._changed(t, t + n);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Writes poses of `[start, start + count)` from packed numbers, 10 per instance:
|
|
191
|
+
* position xyz, quaternion xyzw (normalized here), scale xyz. Validated before
|
|
192
|
+
* any write and allocation-free, for particles and simulations.
|
|
193
|
+
* @experimental
|
|
194
|
+
*/
|
|
195
|
+
updatePoses(t, s, n = Math.floor(s.length / 10)) {
|
|
196
|
+
if (this._sync(), this._assertAlive(), !Number.isSafeInteger(t) || !Number.isSafeInteger(n) || t < 0 || n < 0 || t + n > this.capacity || n * 10 > s.length)
|
|
197
|
+
throw new m("budget", "[Nova3D] Instance poses exceed the data or the fixed capacity.");
|
|
198
|
+
for (let e = 0, r = n * 10; e < r; e += 10) {
|
|
199
|
+
for (let o = 0; o < 10; o++) {
|
|
200
|
+
const c = s[e + o];
|
|
201
|
+
if (!(Math.abs(c) <= 1e30))
|
|
202
|
+
throw new m("invalid-option", "[Nova3D] Instance pose values must be finite and within ±1e30.");
|
|
203
|
+
}
|
|
204
|
+
if (Math.sqrt(s[e + 3] * s[e + 3] + s[e + 4] * s[e + 4] + s[e + 5] * s[e + 5] + s[e + 6] * s[e + 6]) < 1e-15)
|
|
205
|
+
throw new m("invalid-option", "[Nova3D] Quaternion must have a nonzero length.");
|
|
206
|
+
}
|
|
207
|
+
const i = this._poses;
|
|
208
|
+
for (let e = 0; e < n; e++) {
|
|
209
|
+
const r = e * 10, o = (t + e) * 10;
|
|
210
|
+
for (let _ = 0; _ < 10; _++)
|
|
211
|
+
i[o + _] = s[r + _];
|
|
212
|
+
const c = Math.sqrt(i[o + 3] * i[o + 3] + i[o + 4] * i[o + 4] + i[o + 5] * i[o + 5] + i[o + 6] * i[o + 6]);
|
|
213
|
+
for (let _ = 3; _ < 7; _++)
|
|
214
|
+
i[o + _] /= c;
|
|
215
|
+
et(this._matrices, (t + e) * 16, i, o);
|
|
216
|
+
}
|
|
217
|
+
n && this._changed(t, t + n);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Whether the mesh was created with per-instance colours (`colors: true`).
|
|
221
|
+
* @experimental
|
|
222
|
+
*/
|
|
223
|
+
get colors() {
|
|
224
|
+
return this._colors !== null;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Sets the sRGB colour of one instance; [r, g, b] is opaque.
|
|
228
|
+
* @experimental
|
|
229
|
+
*/
|
|
230
|
+
setColor(t, s) {
|
|
231
|
+
this._sync(), this._assertAlive(), this._checkIndex(t);
|
|
232
|
+
const n = Vt(s);
|
|
233
|
+
A[0] = n[0], A[1] = n[1], A[2] = n[2], A[3] = n[3], this.updateColors(t, A, 1);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Writes sRGB RGBA colours of `[start, start + count)`, 4 numbers each.
|
|
237
|
+
* @experimental
|
|
238
|
+
*/
|
|
239
|
+
updateColors(t, s, n = Math.floor(s.length / 4)) {
|
|
240
|
+
this._sync(), this._assertAlive();
|
|
241
|
+
const i = this._colors;
|
|
242
|
+
if (!i)
|
|
243
|
+
throw new m("invalid-option", "[Nova3D] Create the instanced mesh with colors: true.");
|
|
244
|
+
if (!Number.isSafeInteger(t) || !Number.isSafeInteger(n) || t < 0 || n < 0 || t + n > this.capacity || n * 4 > s.length)
|
|
245
|
+
throw new m("budget", "[Nova3D] Instance colours exceed the data or the fixed capacity.");
|
|
246
|
+
for (let e = 0, r = n * 4; e < r; e++) {
|
|
247
|
+
const o = s[e];
|
|
248
|
+
if (!(o >= 0 && o <= 1))
|
|
249
|
+
throw new m("invalid-option", "[Nova3D] Instance colours must be normalized.");
|
|
250
|
+
}
|
|
251
|
+
for (let e = 0, r = n * 4; e < r; e++)
|
|
252
|
+
i[t * 4 + e] = (e & 3) === 3 ? s[e] : Dt(s[e]);
|
|
253
|
+
n && (this._colorStart = Math.min(this._colorStart, t), this._colorEnd = Math.max(this._colorEnd, t + n), this._colorVersion++, this.scene._invalidate());
|
|
254
|
+
}
|
|
255
|
+
/** @internal */
|
|
256
|
+
_instanceColors() {
|
|
257
|
+
return this._sync(), this._colors;
|
|
258
|
+
}
|
|
259
|
+
/** @internal */
|
|
260
|
+
get _instanceColorVersion() {
|
|
261
|
+
return this._colorVersion;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Returns and clears the instance range of colours changed since the last upload.
|
|
265
|
+
* @internal
|
|
266
|
+
*/
|
|
267
|
+
_takeColorRange(t) {
|
|
268
|
+
t.start = this._colorStart, t.end = this._colorEnd, this._colorStart = Number.POSITIVE_INFINITY, this._colorEnd = 0;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Whether the mesh has per-instance sprite-sheet frames.
|
|
272
|
+
* @experimental
|
|
273
|
+
*/
|
|
274
|
+
get frames() {
|
|
275
|
+
return this._frames !== null;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Sets the sprite-sheet frame of one instance.
|
|
279
|
+
* @experimental
|
|
280
|
+
*/
|
|
281
|
+
setFrame(t, s) {
|
|
282
|
+
this._sync(), this._assertAlive(), this._checkIndex(t), A[0] = s, this.updateFrames(t, A, 1);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Writes sprite-sheet frames of `[start, start + count)`: nonnegative integers;
|
|
286
|
+
* frames past the material grid wrap.
|
|
287
|
+
* @experimental
|
|
288
|
+
*/
|
|
289
|
+
updateFrames(t, s, n = s.length) {
|
|
290
|
+
this._sync(), this._assertAlive();
|
|
291
|
+
const i = this._frames;
|
|
292
|
+
if (!i)
|
|
293
|
+
throw new m("invalid-option", "[Nova3D] Create the instanced mesh with frames: true.");
|
|
294
|
+
if (!Number.isSafeInteger(t) || !Number.isSafeInteger(n) || t < 0 || n < 0 || t + n > this.capacity || n > s.length)
|
|
295
|
+
throw new m("budget", "[Nova3D] Instance frames exceed the data or the fixed capacity.");
|
|
296
|
+
for (let e = 0; e < n; e++) {
|
|
297
|
+
const r = s[e];
|
|
298
|
+
if (!Number.isInteger(r) || r < 0 || r > 16777216)
|
|
299
|
+
throw new m("invalid-option", "[Nova3D] Instance frames must be integers in [0, 2^24].");
|
|
300
|
+
}
|
|
301
|
+
for (let e = 0; e < n; e++)
|
|
302
|
+
i[t + e] = s[e];
|
|
303
|
+
n && (this._frameStart = Math.min(this._frameStart, t), this._frameEnd = Math.max(this._frameEnd, t + n), this._frameVersion++, this.scene._invalidate());
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Owner write of instances `[0, count)` (particle systems): packed poses (10 each), their
|
|
307
|
+
* matrices (16 each) and sRGB RGBA colours, produced valid by construction, so nothing is
|
|
308
|
+
* re-validated or re-composed. @internal
|
|
309
|
+
*/
|
|
310
|
+
_writeOwned(t, s, n, i) {
|
|
311
|
+
this._sync(), this._poses.set(s.subarray(0, t * 10)), this._matrices.set(n.subarray(0, t * 16));
|
|
312
|
+
const e = this._colors;
|
|
313
|
+
if (i && e && t > 0) {
|
|
314
|
+
for (let r = 0, o = t * 4; r < o; r++)
|
|
315
|
+
e[r] = (r & 3) === 3 ? i[r] : Dt(i[r]);
|
|
316
|
+
this._colorStart = 0, this._colorEnd = Math.max(this._colorEnd, t), this._colorVersion++;
|
|
317
|
+
}
|
|
318
|
+
t > 0 && this._changed(0, t);
|
|
319
|
+
}
|
|
320
|
+
/** @internal */
|
|
321
|
+
_instanceFrames() {
|
|
322
|
+
return this._sync(), this._frames;
|
|
323
|
+
}
|
|
324
|
+
/** @internal */
|
|
325
|
+
get _instanceFrameVersion() {
|
|
326
|
+
return this._frameVersion;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Returns and clears the instance range of frames changed since the last upload.
|
|
330
|
+
* @internal
|
|
331
|
+
*/
|
|
332
|
+
_takeFrameRange(t) {
|
|
333
|
+
t.start = this._frameStart, t.end = this._frameEnd, this._frameStart = Number.POSITIVE_INFINITY, this._frameEnd = 0;
|
|
334
|
+
}
|
|
335
|
+
getTransform(t) {
|
|
336
|
+
return this._sync(), t === void 0 ? super.getTransform() : (this._assertAlive(), this._checkIndex(t), this._readPose(t));
|
|
337
|
+
}
|
|
338
|
+
/** @internal */
|
|
339
|
+
_instanceMatrices() {
|
|
340
|
+
return this._sync(), this._matrices;
|
|
341
|
+
}
|
|
342
|
+
/** @internal */
|
|
343
|
+
_instanceChangesSince(t) {
|
|
344
|
+
return t === this._version ? [] : !this._journal.length || t < this._journal[0].version - 1 ? null : this._journal.filter((s) => s.version > t);
|
|
345
|
+
}
|
|
346
|
+
/** @internal */
|
|
347
|
+
_ownBounds() {
|
|
348
|
+
const t = this._worldState();
|
|
349
|
+
if (this._instancesBoundsVersion === this._version && this._instancesBoundsWorld === t.version && this._instancesBoundsGeometry === this.geometry.version)
|
|
350
|
+
return this._instancesBounds ?? null;
|
|
351
|
+
const s = this.geometry.getBounds();
|
|
352
|
+
let n = null;
|
|
353
|
+
const i = this._boundsOverride;
|
|
354
|
+
if (i)
|
|
355
|
+
this._boxesCount = 0, this._count > 0 && i[0] <= i[3] && (n = rs(i, t.matrix));
|
|
356
|
+
else if (s && this._count > 0) {
|
|
357
|
+
const e = this._refreshBoxes(s, t.matrix, t.version), r = C;
|
|
358
|
+
let o = r[0], c = r[1], _ = r[2], h = r[3], f = r[4], l = r[5];
|
|
359
|
+
const y = this._count, b = At;
|
|
360
|
+
for (let x = 0; x < 3; x++) {
|
|
361
|
+
const p = x === 0 ? 0 : Math.min(b[x * 2 - 1], y), u = x === 2 ? y : Math.min(b[x * 2], y);
|
|
362
|
+
for (let d = p * 6, N = u * 6; d < N; d += 6) {
|
|
363
|
+
const w = e[d], g = e[d + 1], v = e[d + 2], I = e[d + 3], E = e[d + 4], F = e[d + 5];
|
|
364
|
+
w < o && (o = w), g < c && (c = g), v < _ && (_ = v), I > h && (h = I), E > f && (f = E), F > l && (l = F);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
n = { min: [o, c, _], max: [h, f, l] };
|
|
368
|
+
}
|
|
369
|
+
return this._instancesBounds = n, this._instancesBoundsVersion = this._version, this._instancesBoundsWorld = t.version, this._instancesBoundsGeometry = this.geometry.version, n;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Brings the per-instance world boxes of `[0,count)` up to date and returns them.
|
|
373
|
+
* Rewritten boxes below `count` are merged into `rewrittenUnion`; their ranges are
|
|
374
|
+
* left in `rewrittenRanges` so the caller scans only the rest.
|
|
375
|
+
*/
|
|
376
|
+
_refreshBoxes(t, s, n) {
|
|
377
|
+
this._sync(), ns();
|
|
378
|
+
const i = At;
|
|
379
|
+
i.fill(0), (!this._boxes || this._boxesWorld !== n || this._boxesGeometry !== this.geometry.version) && (this._boxes ??= new Float32Array(this.capacity * 6), this._boxesWorld = n, this._boxesGeometry = this.geometry.version, this._boxesCount = 0);
|
|
380
|
+
const e = this._count;
|
|
381
|
+
if (this._dirtyStart < this._boxesCount) {
|
|
382
|
+
const r = this._dirtyStart, o = Math.min(this._dirtyEnd, this._boxesCount), c = Math.min(o, e);
|
|
383
|
+
r < c && (this._writeBoxes(t, s, r, c, !0), i[0] = r, i[1] = c), Math.max(r, e) < o && this._writeBoxes(t, s, Math.max(r, e), o, !1);
|
|
384
|
+
}
|
|
385
|
+
return this._boxesCount < e ? (this._writeBoxes(t, s, this._boxesCount, e, !0), i[2] = this._boxesCount, i[3] = e, this._boxesCount = e) : (i[2] = i[1], i[3] = i[1]), this._dirtyStart = Number.POSITIVE_INFINITY, this._dirtyEnd = 0, this._boxes;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* World boxes of instances `[start, end)` by the centre/extent form of the affine
|
|
389
|
+
* world × instance matrix, merged into `rewrittenUnion`.
|
|
390
|
+
*/
|
|
391
|
+
_writeBoxes(t, s, n, i, e) {
|
|
392
|
+
const r = this._boxes, o = this._matrices, c = C, _ = (t.min[0] + t.max[0]) * 0.5, h = (t.min[1] + t.max[1]) * 0.5, f = (t.min[2] + t.max[2]) * 0.5, l = (t.max[0] - t.min[0]) * 0.5, y = (t.max[1] - t.min[1]) * 0.5, b = (t.max[2] - t.min[2]) * 0.5, x = s[0], p = s[1], u = s[2], d = s[4], N = s[5], w = s[6], g = s[8], v = s[9], I = s[10], E = s[12], F = s[13], Bt = s[14];
|
|
393
|
+
let z = c[0], R = c[1], P = c[2], k = c[3], O = c[4], Y = c[5];
|
|
394
|
+
for (let T = n; T < i; T++) {
|
|
395
|
+
const M = T * 16, j = o[M], G = o[M + 1], W = o[M + 2], $ = o[M + 4], U = o[M + 5], X = o[M + 6], Z = o[M + 8], K = o[M + 9], Q = o[M + 10], L = o[M + 12], H = o[M + 13], J = o[M + 14], nt = x * j + d * G + g * W, it = p * j + N * G + v * W, rt = u * j + w * G + I * W, ot = x * $ + d * U + g * X, at = p * $ + N * U + v * X, ct = u * $ + w * U + I * X, ht = x * Z + d * K + g * Q, _t = p * Z + N * K + v * Q, lt = u * Z + w * K + I * Q, dt = x * L + d * H + g * J + E + nt * _ + ot * h + ht * f, mt = p * L + N * H + v * J + F + it * _ + at * h + _t * f, ft = u * L + w * H + I * J + Bt + rt * _ + ct * h + lt * f, ut = Math.abs(nt) * l + Math.abs(ot) * y + Math.abs(ht) * b, yt = Math.abs(it) * l + Math.abs(at) * y + Math.abs(_t) * b, xt = Math.abs(rt) * l + Math.abs(ct) * y + Math.abs(lt) * b, S = T * 6;
|
|
396
|
+
r[S] = dt - ut, r[S + 1] = mt - yt, r[S + 2] = ft - xt, r[S + 3] = dt + ut, r[S + 4] = mt + yt, r[S + 5] = ft + xt;
|
|
397
|
+
const gt = r[S], wt = r[S + 1], vt = r[S + 2], bt = r[S + 3], pt = r[S + 4], It = r[S + 5];
|
|
398
|
+
gt < z && (z = gt), wt < R && (R = wt), vt < P && (P = vt), bt > k && (k = bt), pt > O && (O = pt), It > Y && (Y = It);
|
|
399
|
+
}
|
|
400
|
+
e && (c[0] = z, c[1] = R, c[2] = P, c[3] = k, c[4] = O, c[5] = Y);
|
|
401
|
+
}
|
|
402
|
+
/** @internal */
|
|
403
|
+
_intersect(t, s) {
|
|
404
|
+
this._sync();
|
|
405
|
+
const n = this.geometry.getBounds();
|
|
406
|
+
if (!n)
|
|
407
|
+
return null;
|
|
408
|
+
let i = null;
|
|
409
|
+
for (let e = 0; e < this._count; e++) {
|
|
410
|
+
const r = this._worldInstance(e), o = zt(n, r), c = Rt(t, o);
|
|
411
|
+
if (c === null || i && c >= i.distance)
|
|
412
|
+
continue;
|
|
413
|
+
if (s === "bounds") {
|
|
414
|
+
i = { node: this, instanceIndex: e, distance: c, point: t.origin.map((u, d) => u + t.direction[d] * c), normal: null };
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if (this.geometry.topology !== "triangles")
|
|
418
|
+
continue;
|
|
419
|
+
const _ = Pt(Nt(), r), h = kt(Mt(), r);
|
|
420
|
+
if (!_ || !h)
|
|
421
|
+
continue;
|
|
422
|
+
const f = Ot(B(), t.origin, _), l = St(B(), t.direction, Yt(Mt(), _)), y = this.geometry._buffers(), b = this.geometry.drawRange, x = this.material._readOptions().side, p = (u) => {
|
|
423
|
+
const d = (y.indices ? y.indices[u] : u) * 3;
|
|
424
|
+
return Qt(y.positions[d], y.positions[d + 1], y.positions[d + 2]);
|
|
425
|
+
};
|
|
426
|
+
for (let u = b.start; u < b.start + b.count; u += 3) {
|
|
427
|
+
const d = p(u), N = p(u + 1), w = p(u + 2), g = jt(B(), Ct(B(), N, d), Ct(B(), w, d)), v = Gt(g, l);
|
|
428
|
+
if (x === "front" && v >= 0 || x === "back" && v <= 0)
|
|
429
|
+
continue;
|
|
430
|
+
const I = Wt(f, l, d, N, w);
|
|
431
|
+
I === null || i && I >= i.distance || ($t(g, St(g, g, h)), i = { node: this, instanceIndex: e, distance: I, point: t.origin.map((E, F) => E + t.direction[F] * I), normal: Array.from(g), triangleIndex: u / 3, uv: Ut(y, u, f, l, I) });
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return i;
|
|
435
|
+
}
|
|
436
|
+
_worldInstance(t) {
|
|
437
|
+
return Xt(Nt(), this._worldState().matrix, this._matrices.subarray(t * 16, t * 16 + 16));
|
|
438
|
+
}
|
|
439
|
+
_readPose(t) {
|
|
440
|
+
const s = t * 10;
|
|
441
|
+
return { position: Array.from(this._poses.subarray(s, s + 3)), quaternion: Array.from(this._poses.subarray(s + 3, s + 7)), scale: Array.from(this._poses.subarray(s + 7, s + 10)) };
|
|
442
|
+
}
|
|
443
|
+
_write(t, s) {
|
|
444
|
+
this._poses.set([...s.position, ...s.quaternion, ...s.scale], t * 10), this._matrices.set(Zt(s), t * 16);
|
|
445
|
+
}
|
|
446
|
+
_checkIndex(t) {
|
|
447
|
+
if (!Number.isSafeInteger(t) || t < 0 || t >= this.capacity)
|
|
448
|
+
throw new m("budget", "[Nova3D] Instance index exceeds capacity.");
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Exchanges two instances: pose, matrix, colour and frame. For batched meshes
|
|
452
|
+
* that keep visible instances in the drawn prefix. @internal
|
|
453
|
+
*/
|
|
454
|
+
_swapInstances(t, s) {
|
|
455
|
+
if (this._sync(), this._assertAlive(), this._checkIndex(t), this._checkIndex(s), t === s)
|
|
456
|
+
return;
|
|
457
|
+
q(this._poses, t * 10, s * 10, 10), q(this._matrices, t * 16, s * 16, 16);
|
|
458
|
+
const n = Math.min(t, s), i = Math.max(t, s) + 1;
|
|
459
|
+
this._colors && (q(this._colors, t * 4, s * 4, 4), this._colorStart = Math.min(this._colorStart, n), this._colorEnd = Math.max(this._colorEnd, i), this._colorVersion++), this._frames && (q(this._frames, t, s, 1), this._frameStart = Math.min(this._frameStart, n), this._frameEnd = Math.max(this._frameEnd, i), this._frameVersion++), this._changed(n, i);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Mesh-space union (min xyz, max xyz) of every instance box, kept current by the owner
|
|
463
|
+
* before each pose update; replaces the per-instance bounds pass. @internal
|
|
464
|
+
*/
|
|
465
|
+
_setInstanceBounds(t) {
|
|
466
|
+
this._boundsOverride = t, this._version++, this.scene._boundsChanged(this);
|
|
467
|
+
}
|
|
468
|
+
_boundsOverride = null;
|
|
469
|
+
_changed(t, s) {
|
|
470
|
+
s > t && this._recordPoses === null && this._countMirrors(t, s), s > t && (this._dirtyStart = Math.min(this._dirtyStart, t), this._dirtyEnd = Math.max(this._dirtyEnd, s)), this._version++, this._journal.push({ version: this._version, start: t, end: s }), this._journal.length > 64 && this._journal.shift(), this.scene._boundsChanged(this);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function q(a, t, s, n) {
|
|
474
|
+
for (let i = 0; i < n; i++) {
|
|
475
|
+
const e = a[t + i];
|
|
476
|
+
a[t + i] = a[s + i], a[s + i] = e;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function st(a, t, s, n, i) {
|
|
480
|
+
if (!Array.isArray(a) && !ArrayBuffer.isView(a))
|
|
481
|
+
throw new m("invalid-option", `[Nova3D] ${s} must be a vector.`);
|
|
482
|
+
if (a.length !== t)
|
|
483
|
+
throw new m("invalid-option", `[Nova3D] ${s} must have ${t} components.`);
|
|
484
|
+
for (let e = 0; e < t; e++) {
|
|
485
|
+
const r = a[e];
|
|
486
|
+
if (!Number.isFinite(r))
|
|
487
|
+
throw new m("invalid-option", `[Nova3D] ${s} must be finite.`);
|
|
488
|
+
n[i + e] = r;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function is(a, t, s, n, i) {
|
|
492
|
+
if (i.rotation !== void 0 && i.quaternion !== void 0)
|
|
493
|
+
throw new m("invalid-option", "[Nova3D] Choose rotation or quaternion.");
|
|
494
|
+
for (let e = 0; e < 10; e++)
|
|
495
|
+
a[t + e] = s[n + e];
|
|
496
|
+
if (i.rotation !== void 0) {
|
|
497
|
+
const e = Lt(i.rotation);
|
|
498
|
+
for (let r = 0; r < 4; r++)
|
|
499
|
+
a[t + 3 + r] = e[r];
|
|
500
|
+
}
|
|
501
|
+
if (i.quaternion !== void 0) {
|
|
502
|
+
st(i.quaternion, 4, "quaternion", a, t + 3);
|
|
503
|
+
const e = Math.hypot(a[t + 3], a[t + 4], a[t + 5], a[t + 6]);
|
|
504
|
+
if (e < 1e-15)
|
|
505
|
+
throw new m("invalid-option", "[Nova3D] Quaternion must have a nonzero length.");
|
|
506
|
+
for (let r = 3; r < 7; r++)
|
|
507
|
+
a[t + r] /= e;
|
|
508
|
+
}
|
|
509
|
+
i.position !== void 0 && st(i.position, 3, "position", a, t), i.scale !== void 0 && st(i.scale, 3, "scale", a, t + 7);
|
|
510
|
+
}
|
|
511
|
+
function rs(a, t) {
|
|
512
|
+
const s = (a[0] + a[3]) * 0.5, n = (a[1] + a[4]) * 0.5, i = (a[2] + a[5]) * 0.5, e = (a[3] - a[0]) * 0.5, r = (a[4] - a[1]) * 0.5, o = (a[5] - a[2]) * 0.5, c = [0, 0, 0], _ = [0, 0, 0];
|
|
513
|
+
for (let h = 0; h < 3; h++) {
|
|
514
|
+
const f = t[h] * s + t[4 + h] * n + t[8 + h] * i + t[12 + h], l = Math.abs(t[h]) * e + Math.abs(t[4 + h]) * r + Math.abs(t[8 + h]) * o;
|
|
515
|
+
c[h] = Math.fround(f - l), _[h] = Math.fround(f + l);
|
|
516
|
+
}
|
|
517
|
+
return { min: c, max: _ };
|
|
518
|
+
}
|
|
519
|
+
function et(a, t, s, n) {
|
|
520
|
+
const i = s[n + 3], e = s[n + 4], r = s[n + 5], o = s[n + 6], c = i + i, _ = e + e, h = r + r, f = i * c, l = i * _, y = i * h, b = e * _, x = e * h, p = r * h, u = o * c, d = o * _, N = o * h, w = s[n + 7], g = s[n + 8], v = s[n + 9];
|
|
521
|
+
a[t] = (1 - (b + p)) * w, a[t + 1] = (l + N) * w, a[t + 2] = (y - d) * w, a[t + 3] = 0, a[t + 4] = (l - N) * g, a[t + 5] = (1 - (f + p)) * g, a[t + 6] = (x + u) * g, a[t + 7] = 0, a[t + 8] = (y + d) * v, a[t + 9] = (x - u) * v, a[t + 10] = (1 - (f + b)) * v, a[t + 11] = 0, a[t + 12] = s[n], a[t + 13] = s[n + 1], a[t + 14] = s[n + 2], a[t + 15] = 1;
|
|
522
|
+
}
|
|
523
|
+
export {
|
|
524
|
+
ds as N,
|
|
525
|
+
ls as i,
|
|
526
|
+
Dt as l
|
|
527
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { N as o } from "./Errors-B2ekO9bZ.js";
|
|
2
|
+
import { c as i, o as u } from "./Options-CajE7LLJ.js";
|
|
3
|
+
const n = u({ maxInputBytes: !0, maxJSONBytes: !0, maxBufferBytes: !0, maxAccessorBytes: !0, maxEncodedImageBytes: !0, maxDecodedImageBytes: !0, maxImageDimension: !0, maxNodes: !0, maxParts: !0, maxVertices: !0, maxPrimitives: !0, maxRecords: !0, maxDecompressedBytes: !0, maxAnimationKeys: !0, maxSplats: !0, maxResources: !0, maxDepth: !0, maxGeometryValues: !0 }), d = Object.freeze({ maxEncodedImageBytes: 256 * 1024 * 1024, maxDecodedImageBytes: 512 * 1024 * 1024 });
|
|
4
|
+
function f(r, m, a = "loader") {
|
|
5
|
+
const e = { ...m };
|
|
6
|
+
if (r === void 0)
|
|
7
|
+
return e;
|
|
8
|
+
i(r, n, `${a} limits`);
|
|
9
|
+
for (const [s, t] of Object.entries(r))
|
|
10
|
+
if (t !== void 0) {
|
|
11
|
+
if (!Number.isSafeInteger(t) || t <= 0)
|
|
12
|
+
throw new o("invalid-option", `[Nova3D] ${a} limit ${s} must be a positive safe integer.`);
|
|
13
|
+
s in e && (e[s] = t);
|
|
14
|
+
}
|
|
15
|
+
return e;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
d,
|
|
19
|
+
f as r
|
|
20
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { N as l } from "./Errors-B2ekO9bZ.js";
|
|
2
|
+
import { a as f } from "./Scene-CDfNgf9I.js";
|
|
3
|
+
import { p } from "./Color-vuv9UnoY.js";
|
|
4
|
+
import { c as _ } from "./Options-CajE7LLJ.js";
|
|
5
|
+
function m(r, e, t) {
|
|
6
|
+
return r === void 0 ? {} : (_(r, t, e), r);
|
|
7
|
+
}
|
|
8
|
+
function g(r, e, t) {
|
|
9
|
+
const s = r ?? e;
|
|
10
|
+
if (typeof s != "number" || !Number.isFinite(s) || s <= 0)
|
|
11
|
+
throw new l("invalid-option", `[Nova3D] Helper ${t} must be a positive finite number.`);
|
|
12
|
+
return s;
|
|
13
|
+
}
|
|
14
|
+
function N(r, e) {
|
|
15
|
+
const t = r ?? e;
|
|
16
|
+
return p(t), t;
|
|
17
|
+
}
|
|
18
|
+
function D(r, e) {
|
|
19
|
+
for (let t = 0; t < 16; t++)
|
|
20
|
+
if (r[t] !== e[t])
|
|
21
|
+
return !1;
|
|
22
|
+
return !0;
|
|
23
|
+
}
|
|
24
|
+
function H(r, e, t) {
|
|
25
|
+
for (let s = 0; s < e.length; s += 3) {
|
|
26
|
+
const a = e[s], o = e[s + 1], i = e[s + 2];
|
|
27
|
+
r[s] = t[0] * a + t[4] * o + t[8] * i + t[12], r[s + 1] = t[1] * a + t[5] * o + t[9] * i + t[13], r[s + 2] = t[2] * a + t[6] * o + t[10] * i + t[14];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function M(r, e, t, s, a, o, i, d, h = [0, 0, 0]) {
|
|
31
|
+
for (let n = 0; n < a; n++) {
|
|
32
|
+
const y = n * Math.PI * 2 / a, c = (t + n) * 3;
|
|
33
|
+
r[c] = h[0], r[c + 1] = h[1], r[c + 2] = h[2], r[c + i] += Math.cos(y) * o, r[c + d] += Math.sin(y) * o, e[s + n * 2] = t + n, e[s + n * 2 + 1] = t + (n + 1) % a;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class k {
|
|
37
|
+
/** @internal */
|
|
38
|
+
constructor(e, t, s = null) {
|
|
39
|
+
if (this._app = e, this._scene = t, !e || typeof e.createGeometry != "function" || typeof e.createMaterial != "function" || e.destroyed)
|
|
40
|
+
throw new l("destroyed", "[Nova3D] Helper requires a live app.");
|
|
41
|
+
if (!(t instanceof f) || t.destroyed)
|
|
42
|
+
throw new l("invalid-option", "[Nova3D] Helper requires a live scene.");
|
|
43
|
+
this._target = s, this.root = t.createGroup({ pickable: !1 }), this._detach = e._own(() => this.destroy());
|
|
44
|
+
}
|
|
45
|
+
/** Root group of the helper; tracked helpers write world-space lines, so keep it at identity. */
|
|
46
|
+
root;
|
|
47
|
+
/** @internal */
|
|
48
|
+
_parts = [];
|
|
49
|
+
/**
|
|
50
|
+
* Node whose pose or bounds the lines follow; null for static helpers.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
_target;
|
|
54
|
+
_destroyed = !1;
|
|
55
|
+
_detach;
|
|
56
|
+
get visible() {
|
|
57
|
+
return !this._destroyed && this.root.visible;
|
|
58
|
+
}
|
|
59
|
+
get destroyed() {
|
|
60
|
+
return this._destroyed;
|
|
61
|
+
}
|
|
62
|
+
/** Recomputes lines from the tracked object; a no-op for static helpers. */
|
|
63
|
+
update() {
|
|
64
|
+
this._assertAlive(), this._refresh();
|
|
65
|
+
}
|
|
66
|
+
setVisible(e) {
|
|
67
|
+
if (this._assertAlive(), typeof e != "boolean")
|
|
68
|
+
throw new l("invalid-option", "[Nova3D] Helper visibility must be boolean.");
|
|
69
|
+
this.root.setVisible(e);
|
|
70
|
+
}
|
|
71
|
+
/** Releases the helper's own nodes, geometry and materials, never the tracked object. */
|
|
72
|
+
destroy() {
|
|
73
|
+
if (!this._destroyed) {
|
|
74
|
+
this._destroyed = !0, this._detach(), !this.root.destroyed && !this._scene.destroyed && this.root.destroy();
|
|
75
|
+
for (const e of this._parts)
|
|
76
|
+
!e.mesh.destroyed && !this._scene.destroyed && e.mesh.destroy(), e.geometry.destroyed || e.geometry.destroy(), e.material.destroyed || e.material.destroy();
|
|
77
|
+
this._parts.length = 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Runs construction and releases everything already created when it throws.
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
_build(e) {
|
|
85
|
+
try {
|
|
86
|
+
e();
|
|
87
|
+
} catch (t) {
|
|
88
|
+
throw this.destroy(), t;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** @internal */
|
|
92
|
+
_addPart(e, t, s, a) {
|
|
93
|
+
const o = this._app.createGeometry({ positions: e, indices: t, topology: "lines", usage: a });
|
|
94
|
+
let i;
|
|
95
|
+
try {
|
|
96
|
+
i = this._app.createMaterial({ type: "basic", color: s });
|
|
97
|
+
const d = this._scene.createMesh({ geometry: o, material: i, pickable: !1 });
|
|
98
|
+
d.reparent(this.root);
|
|
99
|
+
const h = { geometry: o, material: i, mesh: d, positions: e, columns: { positions: e } };
|
|
100
|
+
return this._parts.push(h), h;
|
|
101
|
+
} catch (d) {
|
|
102
|
+
throw i?.destroy(), o.destroy(), d;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** @internal */
|
|
106
|
+
_refresh() {
|
|
107
|
+
if (this._target?.destroyed)
|
|
108
|
+
throw new l("destroyed", "[Nova3D] Helper target is destroyed.");
|
|
109
|
+
this._track();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Rewrites the lines from the target; static helpers draw once and keep them.
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
_track() {
|
|
116
|
+
}
|
|
117
|
+
/** @internal */
|
|
118
|
+
_assertAlive() {
|
|
119
|
+
if (this._destroyed)
|
|
120
|
+
throw new l("destroyed", "[Nova3D] Helper is destroyed.");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
k as N,
|
|
125
|
+
g as a,
|
|
126
|
+
N as b,
|
|
127
|
+
m as h,
|
|
128
|
+
D as s,
|
|
129
|
+
H as t,
|
|
130
|
+
M as w
|
|
131
|
+
};
|