@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,911 @@
|
|
|
1
|
+
import { N as F } from "./DeformedMesh-CPi0P_vc.js";
|
|
2
|
+
import { N as a } from "./Errors-B2ekO9bZ.js";
|
|
3
|
+
import { a as B, N as w, D as I, J as R, M as K, d as N, b as C, r as T, Q as M, o as V, s as $, g as L, y as b, R as E, S as q, G as W, T as G, U as J, V as Q } from "./Node-QfgAE2_v.js";
|
|
4
|
+
import { a as k, b as A, p as H, l as j } from "./Color-vuv9UnoY.js";
|
|
5
|
+
import { c as m, o as l } from "./Options-CajE7LLJ.js";
|
|
6
|
+
import { t as P, c as U } from "./vec4-BTNv1fUp.js";
|
|
7
|
+
import { N as X, i as Y } from "./InstancedMesh-DPrgrw5z.js";
|
|
8
|
+
import { N as g, v as Z, a as ee } from "./Mesh-BaRxAAJq.js";
|
|
9
|
+
function O(c, e) {
|
|
10
|
+
return { min: [Math.min(c.min[0], e.min[0]), Math.min(c.min[1], e.min[1]), Math.min(c.min[2], e.min[2])], max: [Math.max(c.max[0], e.max[0]), Math.max(c.max[1], e.max[1]), Math.max(c.max[2], e.max[2])] };
|
|
11
|
+
}
|
|
12
|
+
function te(c, e) {
|
|
13
|
+
return e.every((t) => t[0] * (t[0] >= 0 ? c.max[0] : c.min[0]) + t[1] * (t[1] >= 0 ? c.max[1] : c.min[1]) + t[2] * (t[2] >= 0 ? c.max[2] : c.min[2]) + t[3] >= 0);
|
|
14
|
+
}
|
|
15
|
+
class ie {
|
|
16
|
+
_leaves = /* @__PURE__ */ new Map();
|
|
17
|
+
_root;
|
|
18
|
+
_structure = !0;
|
|
19
|
+
_sequence = 0;
|
|
20
|
+
set(e, t) {
|
|
21
|
+
if (!t) {
|
|
22
|
+
this.remove(e);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const i = this._leaves.get(e);
|
|
26
|
+
if (!i) {
|
|
27
|
+
this._leaves.set(e, { node: e, bounds: t, order: ++this._sequence }), this._structure = !0;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (i.bounds = t, this._structure)
|
|
31
|
+
return;
|
|
32
|
+
let r = i.parent;
|
|
33
|
+
for (; r; )
|
|
34
|
+
r.bounds = O(r.left.bounds, r.right.bounds), r = r.parent;
|
|
35
|
+
}
|
|
36
|
+
remove(e) {
|
|
37
|
+
this._leaves.delete(e) && (this._structure = !0);
|
|
38
|
+
}
|
|
39
|
+
clear() {
|
|
40
|
+
this._leaves.clear(), this._root = void 0, this._structure = !0;
|
|
41
|
+
}
|
|
42
|
+
ray(e, t) {
|
|
43
|
+
return this._query((i) => {
|
|
44
|
+
const r = B(e, i);
|
|
45
|
+
return r !== null && r <= t;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
frustum(e) {
|
|
49
|
+
return this._query((t) => te(t, e));
|
|
50
|
+
}
|
|
51
|
+
_query(e) {
|
|
52
|
+
if (this._structure && (this._root = this._build([...this._leaves.values()]), this._structure = !1), !this._root)
|
|
53
|
+
return [];
|
|
54
|
+
const t = [], i = [this._root];
|
|
55
|
+
for (; i.length; ) {
|
|
56
|
+
const r = i.pop();
|
|
57
|
+
e(r.bounds) && (r.node ? t.push(r) : i.push(r.right, r.left));
|
|
58
|
+
}
|
|
59
|
+
return t.sort((r, s) => r.order - s.order).map((r) => r.node);
|
|
60
|
+
}
|
|
61
|
+
_build(e, t) {
|
|
62
|
+
if (!e.length)
|
|
63
|
+
return;
|
|
64
|
+
if (e.length === 1)
|
|
65
|
+
return e[0].parent = t, e[0];
|
|
66
|
+
const i = e.reduce((d, h) => O(d, h.bounds), e[0].bounds), r = i.max.map((d, h) => d - i.min[h]), s = r.indexOf(Math.max(...r));
|
|
67
|
+
e.sort((d, h) => d.bounds.min[s] + d.bounds.max[s] - (h.bounds.min[s] + h.bounds.max[s]) || d.order - h.order);
|
|
68
|
+
const n = { bounds: i, parent: t, order: 0 }, o = Math.floor(e.length / 2);
|
|
69
|
+
return n.left = this._build(e.slice(0, o), n), n.right = this._build(e.slice(o), n), n;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const re = {
|
|
73
|
+
perspective: l({ fov: !0, near: !0, far: !0 }),
|
|
74
|
+
orthographic: l({ verticalSize: !0, near: !0, far: !0 })
|
|
75
|
+
}, se = {
|
|
76
|
+
perspective: l({ ...b, fov: !0, near: !0, far: !0 }),
|
|
77
|
+
orthographic: l({ ...b, verticalSize: !0, near: !0, far: !0 })
|
|
78
|
+
};
|
|
79
|
+
class D extends w {
|
|
80
|
+
/** @internal */
|
|
81
|
+
constructor(e, t, i) {
|
|
82
|
+
m(i, se[t], `${t} camera`);
|
|
83
|
+
const r = D._validate(t, i);
|
|
84
|
+
super(e, i), this.kind = t, this._projection = r;
|
|
85
|
+
}
|
|
86
|
+
_projection;
|
|
87
|
+
/**
|
|
88
|
+
* Changes whenever the projection options change.
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
_projectionVersion = 0;
|
|
92
|
+
/** Patches the projection options of the camera's kind. */
|
|
93
|
+
set(e) {
|
|
94
|
+
m(e, re[this.kind], `${this.kind} camera`), this._setProjection(e);
|
|
95
|
+
}
|
|
96
|
+
/** `set` without the key check, for controls that adjust near and far every frame. @internal */
|
|
97
|
+
_setProjection(e) {
|
|
98
|
+
this._assertLogicalWrite(), this._projection = D._validate(this.kind, { ...this._projection, ...e }), this._projectionVersion++, this.scene._invalidate();
|
|
99
|
+
}
|
|
100
|
+
/** The projection options of the camera's kind. */
|
|
101
|
+
getOptions() {
|
|
102
|
+
return { ...this._projection };
|
|
103
|
+
}
|
|
104
|
+
/** The projection options without a copy, for per-frame renderer reads. @internal */
|
|
105
|
+
_readProjection() {
|
|
106
|
+
return this._projection;
|
|
107
|
+
}
|
|
108
|
+
/** Explicit projection, e.g. a WebXR view's; null returns to the options. */
|
|
109
|
+
_matrix = null;
|
|
110
|
+
/**
|
|
111
|
+
* Replaces the projection with an explicit column-major matrix (WebXR eyes, off-axis
|
|
112
|
+
* projections); the aspect is then ignored. Near and far follow the matrix for a
|
|
113
|
+
* perspective camera. null restores the option-driven projection.
|
|
114
|
+
* @experimental
|
|
115
|
+
*/
|
|
116
|
+
setProjectionMatrix(e) {
|
|
117
|
+
if (this._assertLogicalWrite(), e === null)
|
|
118
|
+
this._matrix = null;
|
|
119
|
+
else {
|
|
120
|
+
if (e.length !== 16 || !Array.from(e).every(Number.isFinite))
|
|
121
|
+
throw new a("invalid-option", "[Nova3D] A projection matrix needs 16 finite numbers.");
|
|
122
|
+
if (this._matrix ??= new Float32Array(16), this._matrix.set(e), "fov" in this._projection && e[11] !== 0) {
|
|
123
|
+
const t = e[14] / (e[10] - 1), i = e[14] / (e[10] + 1);
|
|
124
|
+
t > 0 && i > t && (this._projection = { ...this._projection, near: t, far: i });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
this._projectionVersion++, this.scene._invalidate();
|
|
128
|
+
}
|
|
129
|
+
getProjectionMatrix(e, t = N()) {
|
|
130
|
+
if (this._assertAlive(), !Number.isFinite(e) || e <= 0)
|
|
131
|
+
throw new a("invalid-option", "[Nova3D] Camera aspect must be positive.");
|
|
132
|
+
if (this._matrix)
|
|
133
|
+
return I(t, this._matrix);
|
|
134
|
+
const i = this._projection;
|
|
135
|
+
if ("fov" in i)
|
|
136
|
+
return R(t, i.fov, e, i.near, i.far);
|
|
137
|
+
const r = i.verticalSize / 2;
|
|
138
|
+
return K(t, -r * e, r * e, -r, r, i.near, i.far);
|
|
139
|
+
}
|
|
140
|
+
getViewProjection(e) {
|
|
141
|
+
return this._writeViewProjection(e, N(), N());
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Writes the view-projection and the inverse camera world into caller-owned storage.
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
_writeViewProjection(e, t, i) {
|
|
148
|
+
if (this._assertAlive(), this.scene._flushMatrices(), !C(i, this._worldState().matrix))
|
|
149
|
+
throw new a("invalid-option", "[Nova3D] Camera transform is singular.");
|
|
150
|
+
return T(t, this.getProjectionMatrix(e, t), i);
|
|
151
|
+
}
|
|
152
|
+
/** Projects a world point into `viewport` pixels (top-left origin). */
|
|
153
|
+
project(e, t) {
|
|
154
|
+
if (this._viewport(t), e.length !== 3 || !e.every(Number.isFinite))
|
|
155
|
+
throw new a("invalid-option", "[Nova3D] Invalid world point.");
|
|
156
|
+
const i = P(U(), [...e, 1], this.getViewProjection(t.width / t.height)), r = i[3];
|
|
157
|
+
if (Math.abs(r) < 1e-15)
|
|
158
|
+
throw new a("invalid-option", "[Nova3D] Point projects to infinity.");
|
|
159
|
+
const s = i[0] / r, n = i[1] / r, o = i[2] / r;
|
|
160
|
+
return { x: (s + 1) * t.width / 2, y: (1 - n) * t.height / 2, depth: (o + 1) / 2, inFrustum: r > 0 && Math.abs(s) <= 1 && Math.abs(n) <= 1 && Math.abs(o) <= 1 };
|
|
161
|
+
}
|
|
162
|
+
/** World point of a `viewport` pixel at a depth in [0, 1]. */
|
|
163
|
+
unproject(e, t) {
|
|
164
|
+
if (this._viewport(t), M(e.x, "screen x"), M(e.y, "screen y"), !Number.isFinite(e.depth) || e.depth < 0 || e.depth > 1)
|
|
165
|
+
throw new a("invalid-option", "[Nova3D] Depth must be between zero and one.");
|
|
166
|
+
const i = C(N(), this.getViewProjection(t.width / t.height));
|
|
167
|
+
if (!i)
|
|
168
|
+
throw new a("invalid-option", "[Nova3D] Projection is singular.");
|
|
169
|
+
const r = P(U(), [e.x * 2 / t.width - 1, 1 - e.y * 2 / t.height, e.depth * 2 - 1, 1], i);
|
|
170
|
+
if (Math.abs(r[3]) < 1e-15)
|
|
171
|
+
throw new a("invalid-option", "[Nova3D] Unprojection is at infinity.");
|
|
172
|
+
return [r[0] / r[3], r[1] / r[3], r[2] / r[3]];
|
|
173
|
+
}
|
|
174
|
+
/** Ray from the near plane through a `viewport` pixel. */
|
|
175
|
+
screenRay(e, t) {
|
|
176
|
+
const i = this.unproject({ ...e, depth: 0 }, t), r = this.unproject({ ...e, depth: 1 }, t), s = V(L(), $(L(), r, i));
|
|
177
|
+
return { origin: i, direction: Array.from(s) };
|
|
178
|
+
}
|
|
179
|
+
_viewport(e) {
|
|
180
|
+
if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || e.width <= 0 || e.height <= 0)
|
|
181
|
+
throw new a("invalid-option", "[Nova3D] Viewport dimensions must be positive.");
|
|
182
|
+
}
|
|
183
|
+
static _validate(e, t) {
|
|
184
|
+
const i = t.near, r = t.far;
|
|
185
|
+
if (!Number.isFinite(i) || !Number.isFinite(r) || i < 0 || i === 0 && e === "perspective" || r <= i)
|
|
186
|
+
throw new a("invalid-option", e === "perspective" ? "[Nova3D] Camera requires 0 < near < far." : "[Nova3D] Orthographic camera requires 0 <= near < far.");
|
|
187
|
+
if (e === "perspective") {
|
|
188
|
+
const n = t.fov;
|
|
189
|
+
if (!Number.isFinite(n) || n <= 0 || n >= Math.PI)
|
|
190
|
+
throw new a("invalid-option", n >= Math.PI ? `[Nova3D] Perspective fov ${n} exceeds π (radians; did you pass degrees?).` : "[Nova3D] Perspective fov must be between 0 and π radians.");
|
|
191
|
+
return { fov: n, near: i, far: r };
|
|
192
|
+
}
|
|
193
|
+
const s = t.verticalSize;
|
|
194
|
+
if (!Number.isFinite(s) || s <= 0)
|
|
195
|
+
throw new a("invalid-option", "[Nova3D] Orthographic verticalSize must be positive.");
|
|
196
|
+
return { verticalSize: s, near: i, far: r };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const ne = {
|
|
200
|
+
directional: l({ color: !0, intensity: !0 }),
|
|
201
|
+
point: l({ color: !0, intensity: !0, range: !0 }),
|
|
202
|
+
spot: l({ color: !0, intensity: !0, range: !0, innerConeAngle: !0, outerConeAngle: !0 }),
|
|
203
|
+
ambient: l({ color: !0, intensity: !0 }),
|
|
204
|
+
hemisphere: l({ skyColor: !0, groundColor: !0, intensity: !0 }),
|
|
205
|
+
rect: l({ color: !0, intensity: !0, width: !0, height: !0 }),
|
|
206
|
+
probe: l({ coefficients: !0, intensity: !0 })
|
|
207
|
+
};
|
|
208
|
+
function z(c, e) {
|
|
209
|
+
const t = k(c === "hemisphere" ? e.skyColor : e.color), i = [t[0], t[1], t[2], 1], r = "groundColor" in e ? k(e.groundColor, [0, 0, 0]) : t, s = [r[0], r[1], r[2], 1], n = e.intensity ?? 1;
|
|
210
|
+
let o = null;
|
|
211
|
+
if (c === "probe") {
|
|
212
|
+
const f = e.coefficients;
|
|
213
|
+
if (!f || f.length !== 27 || !Array.from(f).every(Number.isFinite))
|
|
214
|
+
throw new a("invalid-option", "[Nova3D] A light probe needs 27 finite coefficients.");
|
|
215
|
+
o = Float32Array.from(f);
|
|
216
|
+
}
|
|
217
|
+
const d = e.range ?? 0, h = e.innerConeAngle ?? 0, _ = e.outerConeAngle ?? Math.PI / 4;
|
|
218
|
+
if (!Number.isFinite(n) || n < 0 || !Number.isFinite(d) || d < 0 || !Number.isFinite(h) || !Number.isFinite(_) || h < 0 || h > _ || _ <= 0 || _ >= Math.PI / 2)
|
|
219
|
+
throw new a("invalid-option", "[Nova3D] Invalid photometric light or cone.");
|
|
220
|
+
const y = e.width ?? 0, u = e.height ?? 0;
|
|
221
|
+
if (c === "rect" && !(Number.isFinite(y) && Number.isFinite(u) && y > 0 && u > 0))
|
|
222
|
+
throw new a("invalid-option", "[Nova3D] An area light needs a positive width and height.");
|
|
223
|
+
return Object.freeze({ color: Object.freeze(i), groundColor: Object.freeze(s), intensity: n, range: d, innerConeAngle: h, outerConeAngle: _, width: y, height: u, coefficients: o });
|
|
224
|
+
}
|
|
225
|
+
const oe = l({ enabled: !0, resolution: !0, bias: !0, normalBias: !0, near: !0, far: !0, extent: !0, filter: !0, filterRadius: !0, lightSize: !0, cascades: !0, cascadeDistance: !0, cascadeLambda: !0 }), ae = {
|
|
226
|
+
directional: l({ ...b, color: !0, intensity: !0 }),
|
|
227
|
+
point: l({ ...b, color: !0, intensity: !0, range: !0 }),
|
|
228
|
+
spot: l({ ...b, color: !0, intensity: !0, range: !0, innerConeAngle: !0, outerConeAngle: !0 }),
|
|
229
|
+
ambient: l({ ...b, color: !0, intensity: !0 }),
|
|
230
|
+
hemisphere: l({ ...b, skyColor: !0, groundColor: !0, intensity: !0 }),
|
|
231
|
+
rect: l({ ...b, color: !0, intensity: !0, width: !0, height: !0 }),
|
|
232
|
+
probe: l({ ...b, coefficients: !0, intensity: !0 })
|
|
233
|
+
};
|
|
234
|
+
class v extends w {
|
|
235
|
+
/** @internal */
|
|
236
|
+
constructor(e, t, i) {
|
|
237
|
+
m(i, ae[t], `${t} light`);
|
|
238
|
+
const r = z(t, i), s = v._validateShadow({}, t);
|
|
239
|
+
super(e, i), this.kind = t, this._light = r, this._shadow = s;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Linearly-transformed-cosine tables of a rect light, set by `createRectAreaLight`.
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
245
|
+
_areaTables = null;
|
|
246
|
+
_light;
|
|
247
|
+
_shadow;
|
|
248
|
+
/**
|
|
249
|
+
* Patches the photometric options of the light's kind (colour, intensity, range, cone, size).
|
|
250
|
+
* @experimental
|
|
251
|
+
*/
|
|
252
|
+
set(e) {
|
|
253
|
+
m(e, ne[this.kind], `${this.kind} light`), this._assertLogicalWrite(), this._light = z(this.kind, { ...this.getOptions(), ...e }), this.scene._invalidate();
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* The photometric options of the light's kind; colours as normalized sRGB triples.
|
|
257
|
+
* @experimental
|
|
258
|
+
*/
|
|
259
|
+
getOptions() {
|
|
260
|
+
const e = this._light, t = (i) => [i[0], i[1], i[2]];
|
|
261
|
+
switch (this.kind) {
|
|
262
|
+
case "directional":
|
|
263
|
+
case "ambient":
|
|
264
|
+
return { color: t(e.color), intensity: e.intensity };
|
|
265
|
+
case "point":
|
|
266
|
+
return { color: t(e.color), intensity: e.intensity, range: e.range };
|
|
267
|
+
case "spot":
|
|
268
|
+
return { color: t(e.color), intensity: e.intensity, range: e.range, innerConeAngle: e.innerConeAngle, outerConeAngle: e.outerConeAngle };
|
|
269
|
+
case "hemisphere":
|
|
270
|
+
return { skyColor: t(e.color), groundColor: t(e.groundColor), intensity: e.intensity };
|
|
271
|
+
case "rect":
|
|
272
|
+
return { color: t(e.color), intensity: e.intensity, width: e.width, height: e.height };
|
|
273
|
+
case "probe":
|
|
274
|
+
return { coefficients: Float32Array.from(e.coefficients), intensity: e.intensity };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** True for ambient and hemisphere lights, which have no position, range or shadow. */
|
|
278
|
+
get ambient() {
|
|
279
|
+
return this.kind === "ambient" || this.kind === "hemisphere" || this.kind === "probe";
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Patches the shadow settings; `enabled: true` turns shadows on.
|
|
283
|
+
* @experimental
|
|
284
|
+
*/
|
|
285
|
+
setShadows(e) {
|
|
286
|
+
if (m(e, oe, "light shadow"), this._assertLogicalWrite(), this.ambient || this.kind === "rect")
|
|
287
|
+
throw new a("invalid-option", "[Nova3D] Ambient, hemisphere and area lights cast no shadows.");
|
|
288
|
+
const t = v._validateShadow({ ...this._shadow, ...e }, this.kind);
|
|
289
|
+
this._shadow = t, this.scene._invalidate();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @internal
|
|
293
|
+
*/
|
|
294
|
+
_readLight() {
|
|
295
|
+
return this._light;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
_readShadow() {
|
|
301
|
+
return this._shadow;
|
|
302
|
+
}
|
|
303
|
+
static _validateShadow(e, t) {
|
|
304
|
+
const i = { enabled: e.enabled ?? !1, resolution: e.resolution ?? (t === "point" ? 512 : 1024), bias: e.bias ?? 1e-3, normalBias: e.normalBias ?? 5e-3, near: e.near ?? 0.1, far: e.far ?? 100, extent: e.extent ?? 10, filter: e.filter ?? "hard", filterRadius: e.filterRadius ?? 1.5, cascades: e.cascades ?? 1, cascadeDistance: e.cascadeDistance ?? 50, cascadeLambda: e.cascadeLambda ?? 0.5, lightSize: e.lightSize ?? (t === "directional" ? 0.02 : 0.2) };
|
|
305
|
+
if (!["hard", "pcf", "pcss"].includes(i.filter) || !Number.isFinite(i.lightSize) || i.lightSize < 0 || i.lightSize > 100 || !Number.isFinite(i.filterRadius) || i.filterRadius < 0 || i.filterRadius > 32 || !Number.isInteger(i.cascades) || i.cascades < 1 || i.cascades > 4 || i.cascades > 1 && t !== "directional" || !Number.isFinite(i.cascadeDistance) || i.cascadeDistance <= 0 || !Number.isFinite(i.cascadeLambda) || i.cascadeLambda < 0 || i.cascadeLambda > 1)
|
|
306
|
+
throw new a("invalid-option", "[Nova3D] Invalid shadow filter or cascades (1–4, directional lights only).");
|
|
307
|
+
if (typeof i.enabled != "boolean" || !Number.isInteger(i.resolution) || i.resolution < 128 || i.resolution > 4096 || (i.resolution & i.resolution - 1) !== 0 || !Number.isFinite(i.bias) || i.bias < 0 || i.bias > 0.1 || !Number.isFinite(i.normalBias) || i.normalBias < 0 || i.normalBias > 1 || !Number.isFinite(i.near) || !Number.isFinite(i.far) || i.near <= 0 || i.far <= i.near || !Number.isFinite(i.extent) || i.extent <= 0)
|
|
308
|
+
throw new a("invalid-option", "[Nova3D] Invalid shadow options.");
|
|
309
|
+
if (i.resolution * i.resolution * 4 * (t === "point" ? 6 : i.cascades > 2 ? 4 : i.cascades) > 64 * 1024 * 1024)
|
|
310
|
+
throw new a("budget", "[Nova3D] Shadow map exceeds the 64 MiB shadow budget.");
|
|
311
|
+
return Object.freeze(i);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const he = l({ ...b, levels: !0, hysteresis: !0 }), ce = l({ distance: !0, root: !0 });
|
|
315
|
+
class S extends w {
|
|
316
|
+
_levels;
|
|
317
|
+
_hysteresis;
|
|
318
|
+
_active = 0;
|
|
319
|
+
_selected = !1;
|
|
320
|
+
/** @internal */
|
|
321
|
+
constructor(e, t) {
|
|
322
|
+
const i = t.hysteresis ?? 0.1, r = t.levels?.map((n) => (m(n, ce, "LOD level"), { ...n }));
|
|
323
|
+
if (!r?.length || !Number.isFinite(i) || i < 0 || i >= 0.5)
|
|
324
|
+
throw new a("invalid-option", "[Nova3D] LOD requires explicit levels and hysteresis in [0,.5).");
|
|
325
|
+
if (r[0].distance !== 0 || r.some((n, o) => !Number.isFinite(n.distance) || n.distance < 0 || o > 0 && n.distance <= r[o - 1].distance))
|
|
326
|
+
throw new a("invalid-option", "[Nova3D] LOD distances must increase strictly from zero.");
|
|
327
|
+
const s = new Set(r.map((n) => n.root));
|
|
328
|
+
if (s.size !== r.length || r.some((n) => !(n.root instanceof w) || n.root.scene !== e || n.root.destroyed || n.root._getLODOwner()))
|
|
329
|
+
throw new a("owner", "[Nova3D] LOD roots must be distinct unmanaged nodes of the same scene.");
|
|
330
|
+
for (const n of s) {
|
|
331
|
+
let o = n.parent;
|
|
332
|
+
for (; o instanceof w; ) {
|
|
333
|
+
if (s.has(o))
|
|
334
|
+
throw new a("invalid-option", "[Nova3D] LOD levels cannot contain one another.");
|
|
335
|
+
o = o.parent;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
super(e, t), this._levels = Object.freeze(r.map((n) => Object.freeze(n))), this._hysteresis = i;
|
|
339
|
+
for (const [n, o] of this._levels.entries())
|
|
340
|
+
o.root.reparent(this, { preserve: "local" }), o.root._setLODOwner(this), o.root._setLODVisible(n === 0);
|
|
341
|
+
}
|
|
342
|
+
/** @internal */
|
|
343
|
+
_select(e) {
|
|
344
|
+
const t = this._worldState().matrix, i = e._worldState().matrix, r = Math.hypot(t[12] - i[12], t[13] - i[13], t[14] - i[14]);
|
|
345
|
+
let s = this._active;
|
|
346
|
+
if (this._selected) {
|
|
347
|
+
for (; s + 1 < this._levels.length && r >= this._levels[s + 1].distance * (1 + this._hysteresis); )
|
|
348
|
+
s++;
|
|
349
|
+
for (; s > 0 && r < this._levels[s].distance * (1 - this._hysteresis); )
|
|
350
|
+
s--;
|
|
351
|
+
} else
|
|
352
|
+
for (s = 0; s + 1 < this._levels.length && r >= this._levels[s + 1].distance; )
|
|
353
|
+
s++;
|
|
354
|
+
this._selected = !0, s !== this._active && (this._levels[this._active].root._setLODVisible(!1), this._active = s, this._levels[s].root._setLODVisible(!0));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const le = l({ id: !0, position: !0, parent: !0, box: !0, resolution: !0, near: !0, far: !0, intensity: !0, boxProjection: !0, layers: !0 }), de = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], ue = [[0, -1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1], [0, -1, 0], [0, -1, 0]];
|
|
358
|
+
function _e(c) {
|
|
359
|
+
const e = de[c], t = ue[c], i = [-e[0], -e[1], -e[2]], r = [t[1] * i[2] - t[2] * i[1], t[2] * i[0] - t[0] * i[2], t[0] * i[1] - t[1] * i[0]], s = E(r[0], r[1], r[2], t[0], t[1], t[2], i[0], i[1], i[2]), n = q(W(), s);
|
|
360
|
+
return G(n, n), [n[0], n[1], n[2], n[3]];
|
|
361
|
+
}
|
|
362
|
+
class fe {
|
|
363
|
+
/** @internal */
|
|
364
|
+
constructor(e, t, i) {
|
|
365
|
+
this._scene = e, this._unregister = i;
|
|
366
|
+
const r = t.box ?? [5, 5, 5], s = t.resolution ?? 128, n = t.near ?? 0.1, o = t.far ?? 100, d = t.intensity ?? 1, h = t.layers ?? 4294967295;
|
|
367
|
+
if (!Array.isArray(r) || r.length !== 3 || !r.every((y) => Number.isFinite(y) && y > 0))
|
|
368
|
+
throw new a("invalid-option", "[Nova3D] Reflection probe box needs three positive half extents.");
|
|
369
|
+
if (!Number.isInteger(s) || s < 16 || s > 512 || (s & s - 1) !== 0)
|
|
370
|
+
throw new a("invalid-option", "[Nova3D] Reflection probe resolution must be a power of two in [16, 512].");
|
|
371
|
+
if (!(n > 0) || !(o > n) || !Number.isFinite(o) || !(d >= 0) || !Number.isFinite(d) || !Number.isInteger(h) || h < 0 || h > 4294967295)
|
|
372
|
+
throw new a("invalid-option", "[Nova3D] Invalid reflection probe range, intensity or layers.");
|
|
373
|
+
if (t.boxProjection !== void 0 && typeof t.boxProjection != "boolean")
|
|
374
|
+
throw new a("invalid-option", "[Nova3D] boxProjection must be boolean.");
|
|
375
|
+
this.node = e.createGroup({ id: t.id, position: t.position, parent: t.parent });
|
|
376
|
+
const _ = [];
|
|
377
|
+
try {
|
|
378
|
+
for (let y = 0; y < 6; y++) {
|
|
379
|
+
const u = e.createPerspectiveCamera({ fov: Math.PI / 2, near: n, far: o, quaternion: _e(y) });
|
|
380
|
+
u.reparent(this.node), _.push(u);
|
|
381
|
+
}
|
|
382
|
+
} catch (y) {
|
|
383
|
+
throw this.node.destroy(), y;
|
|
384
|
+
}
|
|
385
|
+
this.cameras = Object.freeze(_), this.box = Object.freeze([r[0], r[1], r[2]]), this.resolution = s, this.intensity = d, this.boxProjection = t.boxProjection ?? !0, this.layers = h >>> 0;
|
|
386
|
+
}
|
|
387
|
+
/** Group at the capture point; the six face cameras are its children. */
|
|
388
|
+
node;
|
|
389
|
+
cameras;
|
|
390
|
+
box;
|
|
391
|
+
resolution;
|
|
392
|
+
intensity;
|
|
393
|
+
boxProjection;
|
|
394
|
+
layers;
|
|
395
|
+
_destroyed = !1;
|
|
396
|
+
_version = 0;
|
|
397
|
+
_captured = -1;
|
|
398
|
+
get destroyed() {
|
|
399
|
+
return this._destroyed || this.node.destroyed;
|
|
400
|
+
}
|
|
401
|
+
/** Captures the scene again before the next frame that shows it. */
|
|
402
|
+
update() {
|
|
403
|
+
if (this.destroyed)
|
|
404
|
+
throw new a("destroyed", "[Nova3D] Reflection probe is destroyed.");
|
|
405
|
+
this._version++, this._scene._invalidate();
|
|
406
|
+
}
|
|
407
|
+
destroy() {
|
|
408
|
+
this._destroyed || (this._destroyed = !0, this._unregister(this), this.node.destroyed || this.node.destroy());
|
|
409
|
+
}
|
|
410
|
+
/** @internal */
|
|
411
|
+
get _pending() {
|
|
412
|
+
return this._captured !== this._version;
|
|
413
|
+
}
|
|
414
|
+
/** @internal */
|
|
415
|
+
_markCaptured() {
|
|
416
|
+
this._captured = this._version;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function ye(c) {
|
|
420
|
+
c._markDeformationDirty(!1);
|
|
421
|
+
}
|
|
422
|
+
const me = l({ type: !0 }), pe = { linear: /* @__PURE__ */ new Set(["type", "color", "near", "far"]), exp: /* @__PURE__ */ new Set(["type", "color", "density"]), exp2: /* @__PURE__ */ new Set(["type", "color", "density"]) }, ve = { color: /* @__PURE__ */ new Set(["type", "color"]), environment: /* @__PURE__ */ new Set(["type", "environment", "intensity", "blur"]), texture: /* @__PURE__ */ new Set(["type", "texture", "intensity"]) };
|
|
423
|
+
class be {
|
|
424
|
+
/** @internal */
|
|
425
|
+
constructor(e, t, i = () => {
|
|
426
|
+
}, r = () => {
|
|
427
|
+
}, s = () => {
|
|
428
|
+
}) {
|
|
429
|
+
this.id = t, this._change = i, this._release = r, this._releaseNode = s, this.owner = e;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @internal
|
|
433
|
+
*/
|
|
434
|
+
_roots = /* @__PURE__ */ new Set();
|
|
435
|
+
/**
|
|
436
|
+
* The app that created the scene, so subpath factories take only the scene.
|
|
437
|
+
* @internal
|
|
438
|
+
*/
|
|
439
|
+
_app = null;
|
|
440
|
+
_nodes = /* @__PURE__ */ new Map();
|
|
441
|
+
/** Meshes in registration order, as `_nodes` lists them: render collection skips joints and groups. */
|
|
442
|
+
_meshes = /* @__PURE__ */ new Set();
|
|
443
|
+
/**
|
|
444
|
+
* Nodes whose world matrix is stale, in invalidation order; membership is the node's
|
|
445
|
+
* `_matrixDirty` flag (an unregistered node clears it and is skipped). An array and a
|
|
446
|
+
* flag instead of a Set: every animated joint is added and cleared each frame. The
|
|
447
|
+
* array keeps its capacity (`_dirtyLength` is its used part, the rest is undefined).
|
|
448
|
+
*/
|
|
449
|
+
_dirty = [];
|
|
450
|
+
_dirtyLength = 0;
|
|
451
|
+
/** Live (flagged) entries of `_dirty`. */
|
|
452
|
+
_dirtyCount = 0;
|
|
453
|
+
_environment = null;
|
|
454
|
+
/** Replaced on every change, so renderers compare it by identity. */
|
|
455
|
+
_fog = null;
|
|
456
|
+
_background = null;
|
|
457
|
+
/** Retention key of the background environment, separate from the lighting one. */
|
|
458
|
+
_backgroundUser = {};
|
|
459
|
+
_lightNodes = /* @__PURE__ */ new Set();
|
|
460
|
+
_probes = /* @__PURE__ */ new Set();
|
|
461
|
+
_lodNodes = /* @__PURE__ */ new Set();
|
|
462
|
+
_index = new ie();
|
|
463
|
+
_dirtyBounds = /* @__PURE__ */ new Set();
|
|
464
|
+
_indexType = "none";
|
|
465
|
+
_jointUsers = /* @__PURE__ */ new Map();
|
|
466
|
+
_tearingDown = !1;
|
|
467
|
+
_nextId = 0;
|
|
468
|
+
_destroyed = !1;
|
|
469
|
+
_matrixUpdates = 0;
|
|
470
|
+
/**
|
|
471
|
+
* Scratch of `_flushMatrices`: dirty nodes without a dirty ancestor, and the walk below
|
|
472
|
+
* them; both keep their capacity and are emptied to undefined after each flush.
|
|
473
|
+
*/
|
|
474
|
+
_flushRoots = [];
|
|
475
|
+
_flushStack = [];
|
|
476
|
+
_flushTop = 0;
|
|
477
|
+
/** World record of the scene root as parent of top-level nodes (never written). */
|
|
478
|
+
_sceneParent = { matrix: N(), version: 0 };
|
|
479
|
+
_pushChild = (e) => {
|
|
480
|
+
this._flushStack[this._flushTop++] = e;
|
|
481
|
+
};
|
|
482
|
+
/**
|
|
483
|
+
* Bumped whenever a node changes parent or is destroyed, so per-frame readers can keep
|
|
484
|
+
* subtree membership checks until the hierarchy changes.
|
|
485
|
+
* @internal
|
|
486
|
+
*/
|
|
487
|
+
_hierarchyVersion = 0;
|
|
488
|
+
/** Bumped by visible flags and LOD switches; with the hierarchy version it keys cached visibility. @internal */
|
|
489
|
+
_visibilityVersion = 0;
|
|
490
|
+
/** App that created this object; checked when objects are combined. @internal */
|
|
491
|
+
owner;
|
|
492
|
+
get destroyed() {
|
|
493
|
+
return this._destroyed;
|
|
494
|
+
}
|
|
495
|
+
get children() {
|
|
496
|
+
return [...this._roots];
|
|
497
|
+
}
|
|
498
|
+
getNode(e) {
|
|
499
|
+
return this._nodes.get(e);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Sets or clears scene fog.
|
|
503
|
+
* @experimental
|
|
504
|
+
*/
|
|
505
|
+
setFog(e) {
|
|
506
|
+
if (this._assertAlive(), e === null)
|
|
507
|
+
this._fog = null;
|
|
508
|
+
else {
|
|
509
|
+
const t = pe[e?.type];
|
|
510
|
+
if (!t)
|
|
511
|
+
throw new a("invalid-option", "[Nova3D] Fog type must be linear, exp or exp2.");
|
|
512
|
+
m(e, t, `${e.type} fog`);
|
|
513
|
+
const i = k(e.color);
|
|
514
|
+
if (e.type === "linear") {
|
|
515
|
+
if (!Number.isFinite(e.near) || !Number.isFinite(e.far) || e.near < 0 || e.far <= e.near)
|
|
516
|
+
throw new a("invalid-option", "[Nova3D] Linear fog requires 0 <= near < far.");
|
|
517
|
+
this._fog = { options: { type: "linear", color: i, near: e.near, far: e.far }, mode: 0, color: A(i), a: e.near, b: e.far };
|
|
518
|
+
} else if (e.type === "exp" || e.type === "exp2") {
|
|
519
|
+
if (!Number.isFinite(e.density) || e.density < 0)
|
|
520
|
+
throw new a("invalid-option", "[Nova3D] Fog density must be finite and nonnegative.");
|
|
521
|
+
this._fog = { options: { type: e.type, color: i, density: e.density }, mode: e.type === "exp" ? 1 : 2, color: A(i), a: e.density, b: 0 };
|
|
522
|
+
} else
|
|
523
|
+
throw new a("invalid-option", "[Nova3D] Fog type must be linear, exp or exp2.");
|
|
524
|
+
}
|
|
525
|
+
this._invalidate();
|
|
526
|
+
}
|
|
527
|
+
getFog() {
|
|
528
|
+
return this._fog ? { ...this._fog.options } : null;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Fog normalized for shaders: mode 0 linear, 1 exp, 2 exp2; linear colour.
|
|
532
|
+
* @internal
|
|
533
|
+
*/
|
|
534
|
+
_readFog() {
|
|
535
|
+
return this._fog;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Sets or clears the scene background.
|
|
539
|
+
* @experimental
|
|
540
|
+
*/
|
|
541
|
+
setBackground(e) {
|
|
542
|
+
this._assertAlive();
|
|
543
|
+
let t = null;
|
|
544
|
+
if (e !== null) {
|
|
545
|
+
const i = ve[e?.type];
|
|
546
|
+
if (i && m(e, i, `${e.type} background`), e?.type === "color") {
|
|
547
|
+
const r = H(e.color);
|
|
548
|
+
if (r[3] !== 1)
|
|
549
|
+
throw new a("invalid-option", "[Nova3D] Background colour must be opaque.");
|
|
550
|
+
t = { options: { type: "color", color: [r[0], r[1], r[2]] }, color: r, environment: null, texture: null, intensity: 1, blur: 0 };
|
|
551
|
+
} else if (e?.type === "environment") {
|
|
552
|
+
const r = e.environment ?? null, s = e.intensity ?? 1, n = e.blur ?? 0;
|
|
553
|
+
if (r && (r.destroyed || r.owner !== this.owner))
|
|
554
|
+
throw new a("owner", "[Nova3D] Environment must be live and belong to this app.");
|
|
555
|
+
if (!Number.isFinite(s) || s < 0 || s > 65504 || !Number.isFinite(n) || n < 0 || n > 1)
|
|
556
|
+
throw new a("invalid-option", "[Nova3D] Background intensity must be in [0, 65504] and blur in [0, 1].");
|
|
557
|
+
t = { options: { type: "environment", environment: r, intensity: s, blur: n }, color: null, environment: r, texture: null, intensity: s, blur: n };
|
|
558
|
+
} else if (e?.type === "texture") {
|
|
559
|
+
const r = e.texture, s = e.intensity ?? 1;
|
|
560
|
+
if (!r || r.destroyed || r.owner !== this.owner)
|
|
561
|
+
throw new a("owner", "[Nova3D] Background texture must be live and belong to this app.");
|
|
562
|
+
if (!Number.isFinite(s) || s < 0 || s > 65504)
|
|
563
|
+
throw new a("invalid-option", "[Nova3D] Background intensity must be in [0, 65504].");
|
|
564
|
+
t = { options: { type: "texture", texture: r, intensity: s }, color: null, environment: null, texture: r, intensity: s, blur: 0 };
|
|
565
|
+
} else
|
|
566
|
+
throw new a("invalid-option", "[Nova3D] Background type must be color, environment or texture.");
|
|
567
|
+
}
|
|
568
|
+
t?.environment?._retain(this._backgroundUser, () => this._invalidate()), t?.texture?._retain(this._backgroundUser, () => this._invalidate()), this._background?.environment && this._background.environment !== t?.environment && this._background.environment._releaseUser(this._backgroundUser), this._background?.texture && this._background.texture !== t?.texture && this._background.texture._releaseUser(this._backgroundUser), this._background = t, this._invalidate();
|
|
569
|
+
}
|
|
570
|
+
getBackground() {
|
|
571
|
+
return this._background ? { ...this._background.options } : null;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Current background; replaced on every change.
|
|
575
|
+
* @internal
|
|
576
|
+
*/
|
|
577
|
+
_readBackground() {
|
|
578
|
+
return this._background;
|
|
579
|
+
}
|
|
580
|
+
setEnvironment(e) {
|
|
581
|
+
if (this._assertAlive(), e && (e.destroyed || e.owner !== this.owner))
|
|
582
|
+
throw new a("owner", "[Nova3D] Environment must be live and belong to this app.");
|
|
583
|
+
e !== this._environment && (e?._retain(this, () => this._invalidate()), this._environment?._releaseUser(this), this._environment = e, this._invalidate());
|
|
584
|
+
}
|
|
585
|
+
/** @internal */
|
|
586
|
+
_readEnvironment() {
|
|
587
|
+
return this._environment;
|
|
588
|
+
}
|
|
589
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
590
|
+
createGroup(e = {}) {
|
|
591
|
+
return m(e, Q, "group"), new w(this, e);
|
|
592
|
+
}
|
|
593
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
594
|
+
createMesh(e) {
|
|
595
|
+
return m(e, ee, "mesh"), new g(this, e);
|
|
596
|
+
}
|
|
597
|
+
/** @internal */
|
|
598
|
+
_createDeformedMesh(e, t, i) {
|
|
599
|
+
return new F(this, e, t, i);
|
|
600
|
+
}
|
|
601
|
+
/** @internal */
|
|
602
|
+
_attachDeformed(e, t) {
|
|
603
|
+
for (const i of t) {
|
|
604
|
+
const r = this._jointUsers.get(i) ?? /* @__PURE__ */ new Set();
|
|
605
|
+
r.add(e), this._jointUsers.set(i, r), i._skinUsers = r;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
/** @internal */
|
|
609
|
+
_detachDeformed(e, t) {
|
|
610
|
+
for (const i of t) {
|
|
611
|
+
const r = this._jointUsers.get(i);
|
|
612
|
+
r?.delete(e), r?.size === 0 && (this._jointUsers.delete(i), i._skinUsers = void 0);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
/** @internal */
|
|
616
|
+
_assertJointUsers(e, t) {
|
|
617
|
+
if (!this._tearingDown && [...this._jointUsers.get(e) ?? []].some((i) => !i.destroyed && !t.has(i)))
|
|
618
|
+
throw new a("state", "[Nova3D] Joint is referenced by a live mesh outside the destroyed subtree.");
|
|
619
|
+
}
|
|
620
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
621
|
+
createInstancedMesh(e) {
|
|
622
|
+
return m(e, Y, "instanced mesh"), new X(this, e);
|
|
623
|
+
}
|
|
624
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
625
|
+
createLOD(e) {
|
|
626
|
+
return m(e, he, "LOD"), new S(this, e);
|
|
627
|
+
}
|
|
628
|
+
/** Chooses the raycast acceleration structure. */
|
|
629
|
+
setSpatialIndex(e) {
|
|
630
|
+
if (m(e, me, "spatial index"), this._assertAlive(), e.type !== "none" && e.type !== "bvh")
|
|
631
|
+
throw new a("invalid-option", "[Nova3D] Unsupported spatial index.");
|
|
632
|
+
if (e.type !== this._indexType && (this._indexType = e.type, this._index.clear(), this._dirtyBounds.clear(), this._indexType === "bvh"))
|
|
633
|
+
for (const t of this._nodes.values())
|
|
634
|
+
t instanceof g && this._dirtyBounds.add(t);
|
|
635
|
+
}
|
|
636
|
+
/** @internal */
|
|
637
|
+
_boundsChanged(e, t = !0) {
|
|
638
|
+
this._indexType === "bvh" && this._dirtyBounds.add(e), t && this._invalidate();
|
|
639
|
+
}
|
|
640
|
+
/** @internal */
|
|
641
|
+
_selectLODs(e) {
|
|
642
|
+
if (this._flushMatrices(), this._lodNodes.size !== 0)
|
|
643
|
+
for (const t of this._lodNodes)
|
|
644
|
+
t._select(e);
|
|
645
|
+
}
|
|
646
|
+
_flushIndex() {
|
|
647
|
+
if (this._indexType === "bvh") {
|
|
648
|
+
for (const e of this._dirtyBounds)
|
|
649
|
+
e.destroyed || this._index.set(e, e._ownBounds());
|
|
650
|
+
this._dirtyBounds.clear();
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
654
|
+
createDirectionalLight(e) {
|
|
655
|
+
return new v(this, "directional", e);
|
|
656
|
+
}
|
|
657
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
658
|
+
createPointLight(e) {
|
|
659
|
+
return new v(this, "point", e);
|
|
660
|
+
}
|
|
661
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
662
|
+
createSpotLight(e) {
|
|
663
|
+
return new v(this, "spot", e);
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Local reflection cube for PBR meshes inside its box; captured on creation and on update().
|
|
667
|
+
* Owned by the scene: destroyed with it or the app.
|
|
668
|
+
* @experimental
|
|
669
|
+
*/
|
|
670
|
+
createReflectionProbe(e = {}) {
|
|
671
|
+
m(e, le, "reflection probe");
|
|
672
|
+
const t = new fe(this, e, (i) => this._probes.delete(i));
|
|
673
|
+
return this._probes.add(t), this._invalidate(), t;
|
|
674
|
+
}
|
|
675
|
+
/** @internal */
|
|
676
|
+
_reflectionProbes() {
|
|
677
|
+
for (const e of this._probes)
|
|
678
|
+
e.destroyed && this._probes.delete(e);
|
|
679
|
+
return this._probes;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Global spherical-harmonic light probe; see LightProbeOptions3D.
|
|
683
|
+
* Owned by the scene: destroyed with it, its parent or the app.
|
|
684
|
+
* @experimental
|
|
685
|
+
*/
|
|
686
|
+
createLightProbe(e) {
|
|
687
|
+
return new v(this, "probe", e);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Adds uniform irradiance to PBR surfaces.
|
|
691
|
+
* Owned by the scene: destroyed with it, its parent or the app.
|
|
692
|
+
* @experimental
|
|
693
|
+
*/
|
|
694
|
+
createAmbientLight(e) {
|
|
695
|
+
return new v(this, "ambient", e);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Adds sky/ground irradiance oriented by the node's local +Y to PBR surfaces.
|
|
699
|
+
* Owned by the scene: destroyed with it, its parent or the app.
|
|
700
|
+
* @experimental
|
|
701
|
+
*/
|
|
702
|
+
createHemisphereLight(e) {
|
|
703
|
+
return new v(this, "hemisphere", e);
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Visible punctual (directional, point, spot) lights.
|
|
707
|
+
* @internal
|
|
708
|
+
*/
|
|
709
|
+
_lights() {
|
|
710
|
+
return this._flushMatrices(), [...this._lightNodes].filter((e) => !e.ambient && e._effective("visible"));
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Sums visible ambient and hemisphere lights into linear irradiance
|
|
714
|
+
* `E(N) = constant + linear·N` (column-major 3×3 `linear`). Hemisphere
|
|
715
|
+
* irradiance is linear in N, so any number of lights folds into these values.
|
|
716
|
+
* Returns false when the scene has none.
|
|
717
|
+
* @internal
|
|
718
|
+
*/
|
|
719
|
+
_writeAmbient(e, t, i) {
|
|
720
|
+
e.fill(0), t.fill(0), i?.fill(0);
|
|
721
|
+
let r = !1;
|
|
722
|
+
for (const s of this._lightNodes) {
|
|
723
|
+
if (!s.ambient || !s._effective("visible"))
|
|
724
|
+
continue;
|
|
725
|
+
r = !0;
|
|
726
|
+
const n = s._readLight(), o = n.color, d = n.groundColor, h = n.intensity;
|
|
727
|
+
if (s.kind === "probe") {
|
|
728
|
+
const u = n.coefficients;
|
|
729
|
+
for (let f = 0; f < 3; f++) {
|
|
730
|
+
const p = (x) => u[x * 3 + f] * h;
|
|
731
|
+
e[f] += 0.886227 * p(0) - 0.247708 * p(6), t[f] += 1.023328 * p(3), t[3 + f] += 1.023328 * p(1), t[6 + f] += 1.023328 * p(2), i && (i[f] += 0.858086 * p(4), i[3 + f] += 0.858086 * p(5), i[6 + f] += 0.743125 * p(6), i[9 + f] += 0.858086 * p(7), i[12 + f] += 0.429043 * p(8));
|
|
732
|
+
}
|
|
733
|
+
continue;
|
|
734
|
+
}
|
|
735
|
+
if (s.kind === "ambient") {
|
|
736
|
+
for (let u = 0; u < 3; u++)
|
|
737
|
+
e[u] += j(o[u]) * h;
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
const _ = s._worldState().matrix, y = Math.hypot(_[4], _[5], _[6]) || 1;
|
|
741
|
+
for (let u = 0; u < 3; u++) {
|
|
742
|
+
const f = j(o[u]) * h, p = j(d[u]) * h;
|
|
743
|
+
e[u] += (f + p) / 2;
|
|
744
|
+
const x = (f - p) / 2 / y;
|
|
745
|
+
t[u] += x * _[4], t[3 + u] += x * _[5], t[6 + u] += x * _[6];
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
return r;
|
|
749
|
+
}
|
|
750
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
751
|
+
createPerspectiveCamera(e) {
|
|
752
|
+
return new D(this, "perspective", e);
|
|
753
|
+
}
|
|
754
|
+
/** Owned by the scene: destroyed with it, its parent or the app. */
|
|
755
|
+
createOrthographicCamera(e) {
|
|
756
|
+
return new D(this, "orthographic", e);
|
|
757
|
+
}
|
|
758
|
+
raycast(e, t = {}) {
|
|
759
|
+
return this.raycastAll(e, t)[0] ?? null;
|
|
760
|
+
}
|
|
761
|
+
raycastAll(e, t = {}) {
|
|
762
|
+
this._assertAlive();
|
|
763
|
+
const i = J(e), r = t.precision ?? "triangles";
|
|
764
|
+
if (r !== "bounds" && r !== "triangles")
|
|
765
|
+
throw new a("invalid-option", "[Nova3D] Unsupported picking precision.");
|
|
766
|
+
const s = t.maxDistance ?? 1 / 0;
|
|
767
|
+
if (!(s >= 0))
|
|
768
|
+
throw new a("invalid-option", "[Nova3D] Invalid maximum ray distance.");
|
|
769
|
+
const n = Z(t.layers ?? 4294967295);
|
|
770
|
+
this._flushMatrices();
|
|
771
|
+
const o = [];
|
|
772
|
+
this._flushIndex();
|
|
773
|
+
const d = this._indexType === "bvh" ? this._index.ray(i, s) : this._nodes.values();
|
|
774
|
+
for (const h of d) {
|
|
775
|
+
if (!(h instanceof g) || !h._effective("visible") || !h._effective("pickable") || n !== 4294967295 && (h.layers & n) === 0 || t.filter && !t.filter(h))
|
|
776
|
+
continue;
|
|
777
|
+
const _ = h._intersect(i, r);
|
|
778
|
+
_ && _.distance <= s && o.push(_);
|
|
779
|
+
}
|
|
780
|
+
return o.sort((h, _) => h.distance - _.distance);
|
|
781
|
+
}
|
|
782
|
+
destroy() {
|
|
783
|
+
if (!this._destroyed) {
|
|
784
|
+
for (const e of this._nodes.values())
|
|
785
|
+
e._assertLogicalWrite();
|
|
786
|
+
this._tearingDown = !0;
|
|
787
|
+
try {
|
|
788
|
+
for (const e of [...this._roots])
|
|
789
|
+
e.destroy();
|
|
790
|
+
} finally {
|
|
791
|
+
this._tearingDown = !1;
|
|
792
|
+
}
|
|
793
|
+
this._environment?._releaseUser(this), this._environment = null, this._background?.environment?._releaseUser(this._backgroundUser), this._background?.texture?._releaseUser(this._backgroundUser), this._background = null, this._destroyed = !0, this._nodes.clear(), this._meshes.clear();
|
|
794
|
+
for (const e of this._jointUsers.keys())
|
|
795
|
+
e._skinUsers = void 0;
|
|
796
|
+
this._jointUsers.clear(), this._index.clear(), this._lightNodes.clear(), this._lodNodes.clear(), this._dirtyBounds.clear(), this._clearDirty(), this._release();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* @internal
|
|
801
|
+
*/
|
|
802
|
+
_register(e, t) {
|
|
803
|
+
this._assertAlive();
|
|
804
|
+
let i = t;
|
|
805
|
+
if (i === void 0)
|
|
806
|
+
do
|
|
807
|
+
i = `node:${++this._nextId}`;
|
|
808
|
+
while (this._nodes.has(i));
|
|
809
|
+
if (typeof i != "string" || i.length === 0 || this._nodes.has(i))
|
|
810
|
+
throw new a("invalid-option", "[Nova3D] Node id must be nonempty and unique within its scene.");
|
|
811
|
+
return this._nodes.set(i, e), e instanceof g && this._meshes.add(e), e instanceof v && this._lightNodes.add(e), e instanceof S && this._lodNodes.add(e), this._indexType === "bvh" && e instanceof g && this._dirtyBounds.add(e), i;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* @internal
|
|
815
|
+
*/
|
|
816
|
+
_unregister(e) {
|
|
817
|
+
this._releaseNode(e), e instanceof g && (this._meshes.delete(e), this._index.remove(e), this._dirtyBounds.delete(e)), e instanceof v && this._lightNodes.delete(e), e instanceof S && this._lodNodes.delete(e), this._nodes.delete(e.id), e._matrixDirty && (e._matrixDirty = !1, this._dirtyCount--);
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* @internal
|
|
821
|
+
*/
|
|
822
|
+
_invalidate(e) {
|
|
823
|
+
this._destroyed || (e && !e._matrixDirty && (e._matrixDirty = !0, this._dirty[this._dirtyLength++] = e, this._dirtyCount++), this._change());
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* @internal
|
|
827
|
+
*/
|
|
828
|
+
_flushMatrices() {
|
|
829
|
+
if (this._dirtyCount === 0) {
|
|
830
|
+
this._clearDirty();
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
const e = this._flushRoots;
|
|
834
|
+
let t = 0;
|
|
835
|
+
const i = this._dirty;
|
|
836
|
+
for (let s = 0; s < this._dirtyLength; s++) {
|
|
837
|
+
const n = i[s];
|
|
838
|
+
if (!n._matrixDirty)
|
|
839
|
+
continue;
|
|
840
|
+
let o = n.parent;
|
|
841
|
+
for (; o instanceof w && !o._matrixDirty; )
|
|
842
|
+
o = o.parent;
|
|
843
|
+
o instanceof w || (e[t++] = n);
|
|
844
|
+
}
|
|
845
|
+
const r = this._flushStack;
|
|
846
|
+
for (let s = 0; s < t; s++)
|
|
847
|
+
for (r[0] = e[s], e[s] = void 0, this._flushTop = 1; this._flushTop > 0; ) {
|
|
848
|
+
const n = --this._flushTop, o = r[n];
|
|
849
|
+
r[n] = void 0;
|
|
850
|
+
const d = o.parent instanceof w ? o.parent._worldState() : this._sceneParent;
|
|
851
|
+
if (o._updateWorld(d.matrix, d.version)) {
|
|
852
|
+
this._matrixUpdates++, o instanceof F && o._markDeformationDirty(!1);
|
|
853
|
+
const h = o._skinUsers;
|
|
854
|
+
h !== void 0 && h.forEach(ye), this._indexType === "bvh" && o instanceof g && this._dirtyBounds.add(o);
|
|
855
|
+
}
|
|
856
|
+
o._worldState().children.forEach(this._pushChild);
|
|
857
|
+
}
|
|
858
|
+
this._clearDirty();
|
|
859
|
+
}
|
|
860
|
+
_clearDirty() {
|
|
861
|
+
const e = this._dirty;
|
|
862
|
+
for (let t = 0; t < this._dirtyLength; t++)
|
|
863
|
+
e[t]._matrixDirty = !1, e[t] = void 0;
|
|
864
|
+
this._dirtyLength = 0, this._dirtyCount = 0;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* @internal
|
|
868
|
+
*/
|
|
869
|
+
_consumeMatrixUpdates() {
|
|
870
|
+
const e = this._matrixUpdates;
|
|
871
|
+
return this._matrixUpdates = 0, e;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* @internal
|
|
875
|
+
*/
|
|
876
|
+
_renderNodes(e) {
|
|
877
|
+
return this._collectRenderNodes([], e);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Fills caller-owned storage with visible meshes in the same order as `_renderNodes`.
|
|
881
|
+
* @internal
|
|
882
|
+
*/
|
|
883
|
+
_collectRenderNodes(e, t) {
|
|
884
|
+
if (this._flushMatrices(), this._flushIndex(), e.length = 0, t && this._indexType === "bvh") {
|
|
885
|
+
for (const i of this._index.frustum(t))
|
|
886
|
+
i._effective("visible") && e.push(i);
|
|
887
|
+
return e;
|
|
888
|
+
}
|
|
889
|
+
for (const i of this._meshes)
|
|
890
|
+
i._effective("visible") && e.push(i);
|
|
891
|
+
return e;
|
|
892
|
+
}
|
|
893
|
+
_assertAlive() {
|
|
894
|
+
if (this._destroyed)
|
|
895
|
+
throw new a("destroyed", "[Nova3D] Scene is destroyed.");
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
function Fe(c) {
|
|
899
|
+
const e = c instanceof be ? c._app : null;
|
|
900
|
+
if (!e)
|
|
901
|
+
throw new a("invalid-option", "[Nova3D] Expected a scene created by app.createScene.");
|
|
902
|
+
return e;
|
|
903
|
+
}
|
|
904
|
+
export {
|
|
905
|
+
D as N,
|
|
906
|
+
be as a,
|
|
907
|
+
v as b,
|
|
908
|
+
S as c,
|
|
909
|
+
fe as d,
|
|
910
|
+
Fe as s
|
|
911
|
+
};
|