@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,657 @@
|
|
|
1
|
+
import { N as k, w as R } from "./Errors-B2ekO9bZ.js";
|
|
2
|
+
import { r as X } from "./Limits-Bw5XQdFr.js";
|
|
3
|
+
import { d as Y, M as G, N as Z } from "./TextureLoader-CfDzdy2m.js";
|
|
4
|
+
import { c as H, o as Q } from "./Options-CajE7LLJ.js";
|
|
5
|
+
import J from "earcut";
|
|
6
|
+
function _() {
|
|
7
|
+
const e = new Float64Array(16);
|
|
8
|
+
return e[0] = e[5] = e[10] = e[15] = 1, e;
|
|
9
|
+
}
|
|
10
|
+
function O(e, t, s = new Float64Array(16)) {
|
|
11
|
+
for (let n = 0; n < 4; n++) {
|
|
12
|
+
const o = t[n * 4], a = t[n * 4 + 1], g = t[n * 4 + 2], u = t[n * 4 + 3];
|
|
13
|
+
for (let f = 0; f < 4; f++)
|
|
14
|
+
s[n * 4 + f] = e[f] * o + e[4 + f] * a + e[8 + f] * g + e[12 + f] * u;
|
|
15
|
+
}
|
|
16
|
+
return s;
|
|
17
|
+
}
|
|
18
|
+
function W(e, t = new Float64Array(16)) {
|
|
19
|
+
const [s, n, o, a, g, u, f, M, v, y, c, x, m, d, p, w] = e, b = s * u - n * g, r = s * f - o * g, i = s * M - a * g, h = n * f - o * u, l = n * M - a * u, N = o * M - a * f, F = v * d - y * m, z = v * p - c * m, U = v * w - x * m, L = y * p - c * d, D = y * w - x * d, S = c * w - x * p, j = b * S - r * D + i * L + h * U - l * z + N * F;
|
|
20
|
+
if (!Number.isFinite(j) || Math.abs(j) < 1e-300)
|
|
21
|
+
throw new k("invalid-option", "[Nova3D] Imported transform is singular.");
|
|
22
|
+
const T = 1 / j;
|
|
23
|
+
return t[0] = (u * S - f * D + M * L) * T, t[1] = (o * D - n * S - a * L) * T, t[2] = (d * N - p * l + w * h) * T, t[3] = (c * l - y * N - x * h) * T, t[4] = (f * U - g * S - M * z) * T, t[5] = (s * S - o * U + a * z) * T, t[6] = (p * i - m * N - w * r) * T, t[7] = (v * N - c * i + x * r) * T, t[8] = (g * D - u * U + M * F) * T, t[9] = (n * U - s * D - a * F) * T, t[10] = (m * l - d * i + w * b) * T, t[11] = (y * i - v * l - x * b) * T, t[12] = (u * z - g * L - f * F) * T, t[13] = (s * L - n * z + o * F) * T, t[14] = (d * r - m * h - p * b) * T, t[15] = (v * h - y * r + c * b) * T, t;
|
|
24
|
+
}
|
|
25
|
+
function ye(e, t, s) {
|
|
26
|
+
const n = _();
|
|
27
|
+
return n[12] = e, n[13] = t, n[14] = s, n;
|
|
28
|
+
}
|
|
29
|
+
function Me(e, t, s) {
|
|
30
|
+
const n = _();
|
|
31
|
+
return n[0] = e, n[5] = t, n[10] = s, n;
|
|
32
|
+
}
|
|
33
|
+
function ee(e) {
|
|
34
|
+
const [t, s, n, o] = [e[0], e[1], e[2], e[3]], a = _();
|
|
35
|
+
return a[0] = 1 - 2 * (s * s + n * n), a[1] = 2 * (t * s + n * o), a[2] = 2 * (t * n - s * o), a[4] = 2 * (t * s - n * o), a[5] = 1 - 2 * (t * t + n * n), a[6] = 2 * (s * n + t * o), a[8] = 2 * (t * n + s * o), a[9] = 2 * (s * n - t * o), a[10] = 1 - 2 * (t * t + s * s), a;
|
|
36
|
+
}
|
|
37
|
+
function te(e, t) {
|
|
38
|
+
return [
|
|
39
|
+
e[3] * t[0] + e[0] * t[3] + e[1] * t[2] - e[2] * t[1],
|
|
40
|
+
e[3] * t[1] - e[0] * t[2] + e[1] * t[3] + e[2] * t[0],
|
|
41
|
+
e[3] * t[2] + e[0] * t[1] - e[1] * t[0] + e[2] * t[3],
|
|
42
|
+
e[3] * t[3] - e[0] * t[0] - e[1] * t[1] - e[2] * t[2]
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
function ne(e, t, s, n) {
|
|
46
|
+
let o = [0, 0, 0, 1];
|
|
47
|
+
for (const a of n) {
|
|
48
|
+
const g = (a === "X" ? e : a === "Y" ? t : s) * Math.PI / 360, u = Math.sin(g), f = [a === "X" ? u : 0, a === "Y" ? u : 0, a === "Z" ? u : 0, Math.cos(g)];
|
|
49
|
+
o = te(f, o);
|
|
50
|
+
}
|
|
51
|
+
return o;
|
|
52
|
+
}
|
|
53
|
+
function xe(e, t, s, n) {
|
|
54
|
+
return ee(ne(e, t, s, n));
|
|
55
|
+
}
|
|
56
|
+
function oe(e) {
|
|
57
|
+
const t = W(e);
|
|
58
|
+
return Float64Array.of(t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10]);
|
|
59
|
+
}
|
|
60
|
+
function se(e) {
|
|
61
|
+
return e[0] * (e[5] * e[10] - e[6] * e[9]) - e[4] * (e[1] * e[10] - e[2] * e[9]) + e[8] * (e[1] * e[6] - e[2] * e[5]);
|
|
62
|
+
}
|
|
63
|
+
function be(e, t, s) {
|
|
64
|
+
return O(O(e, s), t);
|
|
65
|
+
}
|
|
66
|
+
function re(e) {
|
|
67
|
+
for (let m = 0; m < 16; m++)
|
|
68
|
+
if (!Number.isFinite(e[m]))
|
|
69
|
+
throw new k("format", "[Nova3D] Imported transform is not finite.");
|
|
70
|
+
const t = [[e[0], e[1], e[2]], [e[4], e[5], e[6]], [e[8], e[9], e[10]]], s = t.map((m) => Math.hypot(m[0], m[1], m[2])), n = 1e-12 * Math.max(1, ...s), o = [], a = [0, 0, 0];
|
|
71
|
+
let g = !1;
|
|
72
|
+
for (let m = 0; m < 3; m++) {
|
|
73
|
+
const d = [...t[m]];
|
|
74
|
+
for (const w of o)
|
|
75
|
+
if (w) {
|
|
76
|
+
const b = w[0] * t[m][0] + w[1] * t[m][1] + w[2] * t[m][2];
|
|
77
|
+
g ||= Math.abs(b) > 1e-5 * Math.max(s[m], 1e-30), d[0] -= b * w[0], d[1] -= b * w[1], d[2] -= b * w[2];
|
|
78
|
+
}
|
|
79
|
+
const p = Math.hypot(d[0], d[1], d[2]);
|
|
80
|
+
a[m] = p > n ? p : 0, o.push(p > n ? d.map((w) => w / p) : null);
|
|
81
|
+
}
|
|
82
|
+
const u = (m, d) => [m[1] * d[2] - m[2] * d[1], m[2] * d[0] - m[0] * d[2], m[0] * d[1] - m[1] * d[0]], f = o.filter((m) => !m).length;
|
|
83
|
+
if (f === 3)
|
|
84
|
+
o[0] = [1, 0, 0], o[1] = [0, 1, 0], o[2] = [0, 0, 1];
|
|
85
|
+
else if (f === 2) {
|
|
86
|
+
const m = o.findIndex((r) => r), d = o[m], p = Math.abs(d[0]) < 0.9 ? [1, 0, 0] : [0, 1, 0], w = u(d, p), b = Math.hypot(w[0], w[1], w[2]);
|
|
87
|
+
o[(m + 1) % 3] = w.map((r) => r / b), o[(m + 2) % 3] = u(d, o[(m + 1) % 3]);
|
|
88
|
+
} else if (f === 1) {
|
|
89
|
+
const m = o.findIndex((d) => !d);
|
|
90
|
+
o[m] = u(o[(m + 1) % 3], o[(m + 2) % 3]);
|
|
91
|
+
}
|
|
92
|
+
const [M, v] = [o[0], o[1]];
|
|
93
|
+
let y = o[2];
|
|
94
|
+
const c = u(M, v);
|
|
95
|
+
c[0] * y[0] + c[1] * y[1] + c[2] * y[2] < 0 && (a[2] = -a[2], y = y.map((m) => -m));
|
|
96
|
+
const x = ae(M, v, y);
|
|
97
|
+
return { transform: { position: [e[12], e[13], e[14]], quaternion: x, scale: a }, shear: g };
|
|
98
|
+
}
|
|
99
|
+
function ae(e, t, s) {
|
|
100
|
+
const n = e[0], o = e[1], a = e[2], g = t[0], u = t[1], f = t[2], M = s[0], v = s[1], y = s[2], c = n + u + y;
|
|
101
|
+
let x;
|
|
102
|
+
if (c > 0) {
|
|
103
|
+
const d = 0.5 / Math.sqrt(c + 1);
|
|
104
|
+
x = [(f - v) * d, (M - a) * d, (o - g) * d, 0.25 / d];
|
|
105
|
+
} else if (n > u && n > y) {
|
|
106
|
+
const d = 2 * Math.sqrt(1 + n - u - y);
|
|
107
|
+
x = [0.25 * d, (g + o) / d, (M + a) / d, (f - v) / d];
|
|
108
|
+
} else if (u > y) {
|
|
109
|
+
const d = 2 * Math.sqrt(1 + u - n - y);
|
|
110
|
+
x = [(g + o) / d, 0.25 * d, (v + f) / d, (M - a) / d];
|
|
111
|
+
} else {
|
|
112
|
+
const d = 2 * Math.sqrt(1 + y - n - u);
|
|
113
|
+
x = [(M + a) / d, (v + f) / d, 0.25 * d, (o - g) / d];
|
|
114
|
+
}
|
|
115
|
+
const m = Math.hypot(x[0], x[1], x[2], x[3]);
|
|
116
|
+
return x.map((d) => d / m);
|
|
117
|
+
}
|
|
118
|
+
function De(e) {
|
|
119
|
+
return e <= 0.04045 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
|
|
120
|
+
}
|
|
121
|
+
function ie(e) {
|
|
122
|
+
return e <= 31308e-7 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - 0.055;
|
|
123
|
+
}
|
|
124
|
+
function Ne(e, t, s, n) {
|
|
125
|
+
const o = _();
|
|
126
|
+
for (let a = 0; a < 3; a++)
|
|
127
|
+
o[a * 4] = e[a] * n, o[a * 4 + 1] = t[a] * n, o[a * 4 + 2] = s[a] * n;
|
|
128
|
+
return { matrix: o, inverse: W(o), mirrored: se(o) < 0 };
|
|
129
|
+
}
|
|
130
|
+
const le = Object.freeze({ maxInputBytes: 256 * 1024 * 1024, maxRecords: 2e6, maxDecompressedBytes: 512 * 1024 * 1024, maxAnimationKeys: 4e6 }), ce = Q({ signal: !0, limits: !0, resolveResource: !0, convertUnits: !0, convertAxes: !0 }), ue = Q({ signal: !0, limits: !0, resolveResource: !0, convertUnits: !0, convertAxes: !0, baseUrl: !0 });
|
|
131
|
+
function Ae(e, t) {
|
|
132
|
+
return { ...e.limits, ...X(t, le, "model") };
|
|
133
|
+
}
|
|
134
|
+
function ke(e, t, s) {
|
|
135
|
+
return H(e, s ? ue : ce, `${t} ${s ? "parse" : "load"}`), { signal: e.signal, resolveResource: e.resolveResource, limits: e.limits };
|
|
136
|
+
}
|
|
137
|
+
class Fe {
|
|
138
|
+
constructor(t, s) {
|
|
139
|
+
this._limit = t, this._label = s;
|
|
140
|
+
}
|
|
141
|
+
_used = 0;
|
|
142
|
+
consume(t) {
|
|
143
|
+
if (!Number.isSafeInteger(t) || t < 0 || t > this._limit - this._used)
|
|
144
|
+
throw new k("budget", `[Nova3D] ${this._label} budget exceeded.`);
|
|
145
|
+
this._used += t;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function Ce() {
|
|
149
|
+
return { type: "lambert", baseColor: [0.6, 0.6, 0.6, 1], emissive: [0, 0, 0], alphaMode: "opaque", alphaCutoff: 0.5, side: "front" };
|
|
150
|
+
}
|
|
151
|
+
function Ie(e, t, s) {
|
|
152
|
+
const n = new Uint16Array(e * 4), o = new Float64Array(e * 4);
|
|
153
|
+
for (const u of t) {
|
|
154
|
+
if (u.indices.length !== u.weights.length)
|
|
155
|
+
throw new k("format", "[Nova3D] Skin cluster indices and weights differ in length.");
|
|
156
|
+
for (let f = 0; f < u.indices.length; f++) {
|
|
157
|
+
const M = u.indices[f], v = u.weights[f];
|
|
158
|
+
if (!Number.isInteger(M) || M < 0 || M >= e)
|
|
159
|
+
throw new k("format", "[Nova3D] Skin cluster index is out of range.");
|
|
160
|
+
if (!(v > 0) || !Number.isFinite(v))
|
|
161
|
+
continue;
|
|
162
|
+
const y = M * 4;
|
|
163
|
+
let c = -1, x = y;
|
|
164
|
+
for (let m = y; m < y + 4; m++) {
|
|
165
|
+
if (o[m] > 0 && n[m] === u.joint) {
|
|
166
|
+
c = m;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
o[m] < o[x] && (x = m);
|
|
170
|
+
}
|
|
171
|
+
c >= 0 ? o[c] += v : v > o[x] && (o[x] = v, n[x] = u.joint);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const a = new Float32Array(e * 4);
|
|
175
|
+
let g = 0;
|
|
176
|
+
for (let u = 0; u < e; u++) {
|
|
177
|
+
const f = u * 4, M = o[f] + o[f + 1] + o[f + 2] + o[f + 3];
|
|
178
|
+
if (!(M > 0)) {
|
|
179
|
+
n[f] = s, a[f] = 1, g++;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
let v = 0;
|
|
183
|
+
for (let c = f; c < f + 4; c++)
|
|
184
|
+
a[c] = o[c] / M, v += a[c];
|
|
185
|
+
let y = f;
|
|
186
|
+
for (let c = f + 1; c < f + 4; c++)
|
|
187
|
+
a[c] > a[y] && (y = c);
|
|
188
|
+
a[y] += 1 - v;
|
|
189
|
+
}
|
|
190
|
+
return { joints: n, weights: a, unweighted: g };
|
|
191
|
+
}
|
|
192
|
+
async function Te(e, t) {
|
|
193
|
+
const s = [...t.warnings], n = new G(), o = [], a = [], g = [];
|
|
194
|
+
try {
|
|
195
|
+
if (e.check(), t.nodes.length > e.limits.maxNodes)
|
|
196
|
+
throw new k("budget", "[Nova3D] Model node budget exceeded.");
|
|
197
|
+
if (t.materials.length + t.textures.length > e.limits.maxParts * 2)
|
|
198
|
+
throw new k("budget", "[Nova3D] Model material budget exceeded.");
|
|
199
|
+
const u = /* @__PURE__ */ new Set();
|
|
200
|
+
for (const r of t.materials)
|
|
201
|
+
for (const i of [r.baseColorMap, r.normalMap, r.emissiveMap, r.specularMap, r.occlusionMap, r.metallicMap, r.roughnessMap])
|
|
202
|
+
if (i) {
|
|
203
|
+
if (!Number.isInteger(i.source) || i.source < 0 || i.source >= t.textures.length)
|
|
204
|
+
throw new k("format", "[Nova3D] Material texture reference is out of range.");
|
|
205
|
+
u.add(i.source);
|
|
206
|
+
}
|
|
207
|
+
const f = /* @__PURE__ */ new Map();
|
|
208
|
+
await Promise.all([...u].map(async (r) => {
|
|
209
|
+
const i = t.textures[r];
|
|
210
|
+
try {
|
|
211
|
+
let h;
|
|
212
|
+
if (i.bytes)
|
|
213
|
+
e.consumeImageEncoded(i.bytes.byteLength), h = i.bytes;
|
|
214
|
+
else if (i.uri)
|
|
215
|
+
h = await e.read(i.uri, "image", i.baseUrl);
|
|
216
|
+
else
|
|
217
|
+
throw new k("format", "[Nova3D] Texture has no source.");
|
|
218
|
+
const l = await Y(document, h, { signal: e.signal, maxEncodedBytes: e.limits.maxEncodedImageBytes, maxDecodedBytes: e.limits.maxDecodedImageBytes, maxDimension: e.limits.maxImageDimension });
|
|
219
|
+
e.consumeImage(l.data.byteLength), f.set(r, { options: l });
|
|
220
|
+
} catch (h) {
|
|
221
|
+
if (e.signal.aborted)
|
|
222
|
+
throw h;
|
|
223
|
+
f.set(r, null), s.push(R("skipped", `Texture ${i.label} skipped: ${h instanceof Error ? h.message : String(h)}`));
|
|
224
|
+
}
|
|
225
|
+
})), e.check();
|
|
226
|
+
const M = /* @__PURE__ */ new Map(), v = (r, i) => {
|
|
227
|
+
const h = r ? f.get(r.source) : void 0;
|
|
228
|
+
if (!r || !h)
|
|
229
|
+
return null;
|
|
230
|
+
const l = `${r.source}|${i}|${r.wrapS}|${r.wrapT}`;
|
|
231
|
+
let N = M.get(l);
|
|
232
|
+
return N || (N = n.createTexture({ ...h.options, colorSpace: i, filter: "linear", minFilter: "linear-mipmap-linear", magFilter: "linear", mipmaps: !0, wrapS: r.wrapS, wrapT: r.wrapT }), g.push(N), M.set(l, N)), N;
|
|
233
|
+
}, y = (r, i) => {
|
|
234
|
+
const h = r.map((D) => D && f.get(D.source) ? D : void 0), l = h.find((D) => D !== void 0);
|
|
235
|
+
if (!l)
|
|
236
|
+
return null;
|
|
237
|
+
const N = h.map((D) => D ? f.get(D.source).options : void 0), F = N.find((D) => D !== void 0);
|
|
238
|
+
if (N.some((D) => D && (D.width !== F.width || D.height !== F.height || !(D.data instanceof Uint8Array))))
|
|
239
|
+
return s.push(R("skipped", `${i} maps differ in size or format and were skipped.`)), null;
|
|
240
|
+
if (h.every((D, S) => !D || D.source === l.source && (D.channel ?? S) === S))
|
|
241
|
+
return { texture: v(l, "linear"), ref: l };
|
|
242
|
+
const U = `pack|${h.map((D) => D ? `${D.source}:${D.channel ?? 0}` : "-").join("|")}|${l.wrapS}|${l.wrapT}`;
|
|
243
|
+
let L = M.get(U);
|
|
244
|
+
if (!L) {
|
|
245
|
+
const D = F.width * F.height;
|
|
246
|
+
e.consumeImage(D * 4);
|
|
247
|
+
const S = new Uint8Array(D * 4).fill(255);
|
|
248
|
+
h.forEach((j, T) => {
|
|
249
|
+
if (!j)
|
|
250
|
+
return;
|
|
251
|
+
const P = N[T].data, $ = j.channel ?? T;
|
|
252
|
+
for (let A = 0; A < D; A++)
|
|
253
|
+
S[A * 4 + T] = P[A * 4 + $];
|
|
254
|
+
}), L = n.createTexture({ width: F.width, height: F.height, data: S, colorSpace: "linear", filter: "linear", minFilter: "linear-mipmap-linear", magFilter: "linear", mipmaps: !0, wrapS: l.wrapS, wrapT: l.wrapT }), g.push(L), M.set(U, L);
|
|
255
|
+
}
|
|
256
|
+
return { texture: L, ref: l };
|
|
257
|
+
}, c = (r, i) => r !== void 0 && (r < 0 || r > i);
|
|
258
|
+
let x = !1;
|
|
259
|
+
for (const r of t.materials) {
|
|
260
|
+
e.check(), x ||= r.baseColor.some((l) => c(l, 1)) || r.emissive.some((l) => c(l, 65504)) || c(r.alphaCutoff, 1) || c(r.metallic, 1) || c(r.roughness, 1) || (r.specular ?? []).some((l) => c(l, 1)) || c(r.shininess, 65504);
|
|
261
|
+
const i = { alphaMode: r.alphaMode, alphaCutoff: Math.min(1, Math.max(0, r.alphaCutoff)), side: r.side, baseColorFactor: r.baseColor.map((l) => Math.min(1, Math.max(0, l))), emissiveFactor: r.emissive.map((l) => Math.min(65504, Math.max(0, l))), baseColorMap: v(r.baseColorMap, "srgb"), baseColorMapTransform: r.baseColorMap?.transform ?? null, normalMap: v(r.normalMap, "linear"), normalMapTransform: r.normalMap?.transform ?? null, emissiveMap: v(r.emissiveMap, "srgb"), emissiveMapTransform: r.emissiveMap?.transform ?? null };
|
|
262
|
+
let h;
|
|
263
|
+
if (r.type === "pbr") {
|
|
264
|
+
const l = y([void 0, r.roughnessMap, r.metallicMap], "Metallic/roughness"), N = y([r.occlusionMap], "Occlusion");
|
|
265
|
+
h = { type: "pbr", ...i, metallicFactor: Math.min(1, Math.max(0, r.metallic ?? 0)), roughnessFactor: Math.min(1, Math.max(0, r.roughness ?? 0.5)), metallicRoughnessMap: l?.texture ?? null, metallicRoughnessMapTransform: l?.ref.transform ?? null, occlusionMap: N?.texture ?? null, occlusionMapTransform: N?.ref.transform ?? null };
|
|
266
|
+
} else r.type === "phong" ? h = { type: "phong", ...i, specularColor: (r.specular ?? [56e-4, 56e-4, 56e-4]).map((l) => ie(Math.min(1, Math.max(0, l)))), shininess: Math.min(65504, Math.max(0, r.shininess ?? 30)), specularMap: v(r.specularMap, "linear"), specularMapTransform: r.specularMap?.transform ?? null } : h = { type: "lambert", ...i };
|
|
267
|
+
a.push(n.createMaterial(h));
|
|
268
|
+
}
|
|
269
|
+
x && s.push(R("clamped", "Material factors outside their range were clamped."));
|
|
270
|
+
const m = /* @__PURE__ */ new Set();
|
|
271
|
+
for (const r of t.meshes)
|
|
272
|
+
for (const i of r.primitives) {
|
|
273
|
+
const h = a[i.material]?._readOptions();
|
|
274
|
+
h && "baseColorMap" in h && (h.baseColorMap || h.normalMap || h.emissiveMap || h.occlusionMap || h.metallicRoughnessMap) && m.add(i.geometry);
|
|
275
|
+
}
|
|
276
|
+
let d = e.limits.maxVertices;
|
|
277
|
+
for (const [r, i] of t.geometries.entries()) {
|
|
278
|
+
e.check();
|
|
279
|
+
let h = i;
|
|
280
|
+
if (m.has(r) && !h.uvs && (h = { ...h, uvs: new Float32Array(h.positions.length / 3 * 2) }, s.push(R("generated", "A textured mesh has no UVs; zero UVs were generated."))), d -= h.positions.length / 3, d < 0)
|
|
281
|
+
throw new k("budget", "[Nova3D] Model vertex budget exceeded.");
|
|
282
|
+
const { deformation: l, ...N } = h;
|
|
283
|
+
e.consumeAccessor(N.positions.byteLength + (N.normals?.byteLength ?? 0) + (N.uvs?.byteLength ?? 0) + (N.uvs1?.byteLength ?? 0) + (N.colors?.byteLength ?? 0) + (N.indices?.byteLength ?? 0));
|
|
284
|
+
const F = n.createGeometry(N);
|
|
285
|
+
o.push(F), l && (e.consumeAccessor((l.joints?.byteLength ?? 0) + (l.weights?.byteLength ?? 0) + (l.targets ?? []).reduce((z, U) => z + U.positions.byteLength + (U.normals?.byteLength ?? 0), 0)), F._setDeformation(l));
|
|
286
|
+
}
|
|
287
|
+
const p = t.meshes.map((r) => r.primitives.map((i) => {
|
|
288
|
+
const h = t.geometries[i.geometry], l = a[i.material];
|
|
289
|
+
if (!h || !l)
|
|
290
|
+
throw new k("format", "[Nova3D] Mesh primitive reference is out of range.");
|
|
291
|
+
return { geometry: o[i.geometry], material: l };
|
|
292
|
+
})), w = t.nodes.map((r) => {
|
|
293
|
+
if (r.mesh !== void 0 && !t.meshes[r.mesh])
|
|
294
|
+
throw new k("format", "[Nova3D] Node mesh reference is out of range.");
|
|
295
|
+
if (r.skin !== void 0 && (!t.skins[r.skin] || r.mesh === void 0))
|
|
296
|
+
throw new k("format", "[Nova3D] Node skin reference is invalid.");
|
|
297
|
+
return { name: r.name || void 0, transform: r.transform, children: r.children, mesh: r.mesh, skin: r.skin };
|
|
298
|
+
});
|
|
299
|
+
for (const r of t.skins)
|
|
300
|
+
if (!r.joints.length || r.joints.length > 256 || r.joints.some((i) => !w[i]) || r.inverseBindMatrices.length !== r.joints.length * 16 || !r.inverseBindMatrices.every(Number.isFinite))
|
|
301
|
+
throw new k("format", "[Nova3D] Invalid imported skin.");
|
|
302
|
+
e.check();
|
|
303
|
+
const b = { nodes: w, scenes: [t.roots], defaultScene: 0, meshes: p, meshWeights: t.meshes.map((r) => Object.freeze([...r.weights])), geometry: o, materials: a, textures: g, animations: t.clips, skins: t.skins };
|
|
304
|
+
return new Z(b, s);
|
|
305
|
+
} catch (u) {
|
|
306
|
+
for (const f of [...a, ...o, ...g])
|
|
307
|
+
f.destroy();
|
|
308
|
+
throw u;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function ze(e, t, s, n) {
|
|
312
|
+
if (e.length !== t.length || e.length < 1)
|
|
313
|
+
throw new k("format", "[Nova3D] Animation curve keys and values differ in length.");
|
|
314
|
+
const o = new Float64Array(e.length), a = new Float64Array(e.length);
|
|
315
|
+
let g = 0;
|
|
316
|
+
for (let u = 0; u < e.length; u++) {
|
|
317
|
+
const f = e[u] * s - n, M = t[u];
|
|
318
|
+
if (!Number.isFinite(f) || !Number.isFinite(M))
|
|
319
|
+
throw new k("format", "[Nova3D] Animation keys must be finite.");
|
|
320
|
+
if (g && f <= o[g - 1]) {
|
|
321
|
+
if (f < o[g - 1] - 1e-9)
|
|
322
|
+
throw new k("format", "[Nova3D] Animation key times must not decrease.");
|
|
323
|
+
a[g - 1] = M;
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
o[g] = f, a[g++] = M;
|
|
327
|
+
}
|
|
328
|
+
return { times: o.subarray(0, g), values: a.subarray(0, g) };
|
|
329
|
+
}
|
|
330
|
+
function $e(e) {
|
|
331
|
+
let t = 0;
|
|
332
|
+
const { times: s, values: n } = e;
|
|
333
|
+
return (o) => {
|
|
334
|
+
if (o <= s[0])
|
|
335
|
+
return t = 0, n[0];
|
|
336
|
+
const a = s.length - 1;
|
|
337
|
+
if (o >= s[a])
|
|
338
|
+
return n[a];
|
|
339
|
+
for (s[t] > o && (t = 0); t < a && s[t + 1] <= o; )
|
|
340
|
+
t++;
|
|
341
|
+
const g = s[t], u = s[t + 1], f = (o - g) / (u - g);
|
|
342
|
+
return n[t] + (n[t + 1] - n[t]) * f;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function Le(e, t) {
|
|
346
|
+
let s = 0;
|
|
347
|
+
for (const g of e)
|
|
348
|
+
s += g.length;
|
|
349
|
+
if (s > t)
|
|
350
|
+
throw new k("budget", "[Nova3D] Animation key budget exceeded.");
|
|
351
|
+
const n = new Float64Array(s);
|
|
352
|
+
let o = 0;
|
|
353
|
+
for (const g of e)
|
|
354
|
+
n.set(g, o), o += g.length;
|
|
355
|
+
n.sort();
|
|
356
|
+
let a = 0;
|
|
357
|
+
for (let g = 0; g < n.length; g++)
|
|
358
|
+
(!a || n[g] - n[a - 1] > 1e-9) && (n[a++] = n[g]);
|
|
359
|
+
return n.slice(0, a);
|
|
360
|
+
}
|
|
361
|
+
function Se(e, t, s) {
|
|
362
|
+
const n = new Int32Array(Math.max(0, e.length - 1));
|
|
363
|
+
let o = e.length;
|
|
364
|
+
for (let u = 0; u + 1 < e.length; u++) {
|
|
365
|
+
const f = Math.max(1, Math.min(4096, Math.ceil(t(e[u], e[u + 1]))));
|
|
366
|
+
if (n[u] = f, o += f - 1, o > s)
|
|
367
|
+
throw new k("budget", "[Nova3D] Animation key budget exceeded.");
|
|
368
|
+
}
|
|
369
|
+
if (o === e.length)
|
|
370
|
+
return e;
|
|
371
|
+
const a = new Float64Array(o);
|
|
372
|
+
let g = 0;
|
|
373
|
+
for (let u = 0; u < e.length; u++)
|
|
374
|
+
if (a[g++] = e[u], u + 1 < e.length)
|
|
375
|
+
for (let f = 1; f < n[u]; f++)
|
|
376
|
+
a[g++] = e[u] + (e[u + 1] - e[u]) * f / n[u];
|
|
377
|
+
return a;
|
|
378
|
+
}
|
|
379
|
+
function K(e, t, s) {
|
|
380
|
+
for (let n = 0; n < e.length; n++)
|
|
381
|
+
if (Math.abs(e[n] - s[n % t]) > 1e-6 * Math.max(1, Math.abs(s[n % t])))
|
|
382
|
+
return !0;
|
|
383
|
+
return !1;
|
|
384
|
+
}
|
|
385
|
+
function Ue(e, t, s, n, o) {
|
|
386
|
+
const a = t.length, g = new Float64Array(a * 3), u = new Float64Array(a * 4), f = new Float64Array(a * 3);
|
|
387
|
+
for (let c = 0; c < a; c++) {
|
|
388
|
+
const { transform: x, shear: m } = re(s(t[c]));
|
|
389
|
+
m && o(), g.set(x.position, c * 3), f.set(x.scale, c * 3);
|
|
390
|
+
let [d, p, w, b] = x.quaternion;
|
|
391
|
+
const r = c ? c * 4 - 4 : -1, i = r < 0 ? n.quaternion : u.subarray(r, r + 4);
|
|
392
|
+
d * i[0] + p * i[1] + w * i[2] + b * i[3] < 0 && (d = -d, p = -p, w = -w, b = -b), u[c * 4] = d, u[c * 4 + 1] = p, u[c * 4 + 2] = w, u[c * 4 + 3] = b;
|
|
393
|
+
}
|
|
394
|
+
const M = [...n.quaternion], v = [];
|
|
395
|
+
K(g, 3, n.position) && v.push({ target: e, channel: "position", times: t, values: g });
|
|
396
|
+
let y = !1;
|
|
397
|
+
for (let c = 0; c < a && !y; c++)
|
|
398
|
+
y = Math.abs(u[c * 4] * M[0] + u[c * 4 + 1] * M[1] + u[c * 4 + 2] * M[2] + u[c * 4 + 3] * M[3]) < 1 - 1e-9;
|
|
399
|
+
return y && v.push({ target: e, channel: "quaternion", times: t, values: u }), K(f, 3, n.scale) && v.push({ target: e, channel: "scale", times: t, values: f }), v;
|
|
400
|
+
}
|
|
401
|
+
function E(e, t, s, n) {
|
|
402
|
+
const o = e.mapping === "polygon-vertex" ? t : e.mapping === "vertex" ? n : e.mapping === "polygon" ? s : 0;
|
|
403
|
+
if (!e.indices)
|
|
404
|
+
return o;
|
|
405
|
+
if (o >= e.indices.length)
|
|
406
|
+
throw new k("format", "[Nova3D] Mesh layer index column is too short.");
|
|
407
|
+
return e.indices[o];
|
|
408
|
+
}
|
|
409
|
+
function V(e, t, s, n, o) {
|
|
410
|
+
if (!e)
|
|
411
|
+
return;
|
|
412
|
+
if (!Number.isInteger(e.size) || e.size < 1 || e.values.length % e.size !== 0)
|
|
413
|
+
throw new k("format", `[Nova3D] Mesh ${t} layer has an invalid size.`);
|
|
414
|
+
const a = e.mapping === "polygon-vertex" ? s : e.mapping === "vertex" ? o : e.mapping === "polygon" ? n : 1;
|
|
415
|
+
if ((e.indices ? e.indices.length : e.values.length / e.size) < a)
|
|
416
|
+
throw new k("format", `[Nova3D] Mesh ${t} layer is shorter than its mapping.`);
|
|
417
|
+
const u = e.values.length / e.size;
|
|
418
|
+
if (e.indices)
|
|
419
|
+
for (let f = 0; f < a; f++) {
|
|
420
|
+
const M = e.indices[f];
|
|
421
|
+
if (!Number.isInteger(M) || M >= u)
|
|
422
|
+
throw new k("format", `[Nova3D] Mesh ${t} index is out of range.`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function fe(e, t) {
|
|
426
|
+
const s = new Float64Array(t * 3), { points: n, counts: o, indices: a } = e;
|
|
427
|
+
let g = 0;
|
|
428
|
+
for (let u = 0; u < o.length; u++) {
|
|
429
|
+
const f = o[u];
|
|
430
|
+
let M = 0, v = 0, y = 0;
|
|
431
|
+
for (let c = 0; c < f; c++) {
|
|
432
|
+
const x = a[g + c] * 3, m = a[g + (c + 1) % f] * 3;
|
|
433
|
+
M += (n[x + 1] - n[m + 1]) * (n[x + 2] + n[m + 2]), v += (n[x + 2] - n[m + 2]) * (n[x] + n[m]), y += (n[x] - n[m]) * (n[x + 1] + n[m + 1]);
|
|
434
|
+
}
|
|
435
|
+
for (let c = 0; c < f; c++) {
|
|
436
|
+
const x = a[g + c] * 3;
|
|
437
|
+
s[x] += M, s[x + 1] += v, s[x + 2] += y;
|
|
438
|
+
}
|
|
439
|
+
g += f;
|
|
440
|
+
}
|
|
441
|
+
return s;
|
|
442
|
+
}
|
|
443
|
+
function he(e, t, s) {
|
|
444
|
+
let n = Math.imul(e ^ 2654435769, 2246822507);
|
|
445
|
+
for (let o = 0; o < s; o++)
|
|
446
|
+
n = Math.imul(n ^ t[o], 3266489909), n ^= n >>> 15;
|
|
447
|
+
return n >>> 0;
|
|
448
|
+
}
|
|
449
|
+
function je(e) {
|
|
450
|
+
const { points: t, counts: s, indices: n, groups: o } = e;
|
|
451
|
+
if (t.length % 3 !== 0)
|
|
452
|
+
throw new k("format", "[Nova3D] Mesh points must have three components.");
|
|
453
|
+
const a = t.length / 3;
|
|
454
|
+
for (let i = 0; i < t.length; i++)
|
|
455
|
+
if (!Number.isFinite(t[i]))
|
|
456
|
+
throw new k("format", "[Nova3D] Mesh points must be finite.");
|
|
457
|
+
let g = 0;
|
|
458
|
+
for (let i = 0; i < s.length; i++) {
|
|
459
|
+
const h = s[i];
|
|
460
|
+
if (!Number.isInteger(h) || h < 0)
|
|
461
|
+
throw new k("format", "[Nova3D] Polygon corner counts must be nonnegative integers.");
|
|
462
|
+
g += h;
|
|
463
|
+
}
|
|
464
|
+
if (g !== n.length)
|
|
465
|
+
throw new k("format", "[Nova3D] Polygon corner counts differ from the index column.");
|
|
466
|
+
for (let i = 0; i < n.length; i++) {
|
|
467
|
+
const h = n[i];
|
|
468
|
+
if (h < 0 || h >= a)
|
|
469
|
+
throw new k("format", "[Nova3D] Polygon point index is out of range.");
|
|
470
|
+
}
|
|
471
|
+
if (o && o.length < s.length)
|
|
472
|
+
throw new k("format", "[Nova3D] Polygon group column is too short.");
|
|
473
|
+
if (!Number.isInteger(e.groupCount) || e.groupCount < 1 || e.groupCount > 65536)
|
|
474
|
+
throw new k("format", "[Nova3D] Invalid polygon group count.");
|
|
475
|
+
if (V(e.normals, "normal", n.length, s.length, a), V(e.uvs, "UV", n.length, s.length, a), V(e.uvs1, "UV", n.length, s.length, a), V(e.colors, "colour", n.length, s.length, a), e.normals && e.normals.size !== 3 || e.uvs && e.uvs.size !== 2 || e.uvs1 && e.uvs1.size !== 2 || e.colors && e.colors.size !== 3 && e.colors.size !== 4)
|
|
476
|
+
throw new k("format", "[Nova3D] Mesh layer component counts are invalid.");
|
|
477
|
+
const u = e.normals ?? { mapping: "vertex", values: fe(e, a) }, f = [];
|
|
478
|
+
for (let i = 0; i < e.groupCount; i++)
|
|
479
|
+
f.push({ corners: 0, triangles: 0, vertexCount: 0, triangleCount: 0 });
|
|
480
|
+
let M = 0;
|
|
481
|
+
for (let i = 0; i < s.length; i++) {
|
|
482
|
+
const h = o ? o[i] : 0;
|
|
483
|
+
if (!Number.isInteger(h) || h < 0 || h >= e.groupCount)
|
|
484
|
+
throw new k("format", "[Nova3D] Polygon group is out of range.");
|
|
485
|
+
if (s[i] < 3) {
|
|
486
|
+
M++;
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
f[h].corners += s[i], f[h].triangles += s[i] - 2;
|
|
490
|
+
}
|
|
491
|
+
for (const i of f) {
|
|
492
|
+
if (!i.corners)
|
|
493
|
+
continue;
|
|
494
|
+
const h = Math.min(i.corners, e.maxVertices);
|
|
495
|
+
i.positions = new Float32Array(h * 3), i.normals = new Float32Array(h * 3), i.uvs = e.uvs ? new Float32Array(h * 2) : void 0, i.uvs1 = e.uvs1 ? new Float32Array(h * 2) : void 0, i.colors = e.colors ? new Float32Array(h * 4) : void 0, i.points = new Uint32Array(h), i.indices = new Uint32Array(i.triangles * 3);
|
|
496
|
+
let l = 16;
|
|
497
|
+
for (; l < i.corners * 2; )
|
|
498
|
+
l *= 2;
|
|
499
|
+
i.table = new Int32Array(l).fill(-1);
|
|
500
|
+
}
|
|
501
|
+
const v = e.matrix, y = oe(v), c = new Float32Array(13), x = new Uint32Array(c.buffer), m = e.colors?.size ?? 0;
|
|
502
|
+
let d = new Int32Array(64), p = 0, w = 0;
|
|
503
|
+
const b = [0, 0, 0, 1];
|
|
504
|
+
for (let i = 0; i < s.length; i++) {
|
|
505
|
+
const h = s[i];
|
|
506
|
+
if (h < 3) {
|
|
507
|
+
w += h;
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
const l = f[o ? o[i] : 0];
|
|
511
|
+
d.length < h && (d = new Int32Array(h * 2));
|
|
512
|
+
for (let N = 0; N < h; N++, w++) {
|
|
513
|
+
const F = n[w];
|
|
514
|
+
let z = 0;
|
|
515
|
+
const U = E(u, w, i, F);
|
|
516
|
+
let L = 0, D = 0, S = 0;
|
|
517
|
+
if (U >= 0) {
|
|
518
|
+
const A = u.values[U * 3], C = u.values[U * 3 + 1], I = u.values[U * 3 + 2];
|
|
519
|
+
L = y[0] * A + y[3] * C + y[6] * I, D = y[1] * A + y[4] * C + y[7] * I, S = y[2] * A + y[5] * C + y[8] * I;
|
|
520
|
+
}
|
|
521
|
+
const j = Math.hypot(L, D, S);
|
|
522
|
+
j > 0 && Number.isFinite(j) ? (L /= j, D /= j, S /= j) : (L = 0, D = 1, S = 0), c[z++] = L, c[z++] = D, c[z++] = S;
|
|
523
|
+
for (const A of [e.uvs, e.uvs1]) {
|
|
524
|
+
if (!A)
|
|
525
|
+
continue;
|
|
526
|
+
const C = E(A, w, i, F), I = C >= 0 ? A.values[C * 2] : 0, q = C >= 0 ? A.values[C * 2 + 1] : 0;
|
|
527
|
+
c[z++] = Number.isFinite(I) ? I : 0, c[z++] = Number.isFinite(q) ? e.flipV ? 1 - q : q : 0;
|
|
528
|
+
}
|
|
529
|
+
if (e.colors) {
|
|
530
|
+
const A = E(e.colors, w, i, F);
|
|
531
|
+
for (let C = 0; C < 4; C++) {
|
|
532
|
+
const I = A >= 0 && C < m ? e.colors.values[A * m + C] : C === 3 ? 1 : 0;
|
|
533
|
+
b[C] = Number.isFinite(I) ? Math.min(1, Math.max(0, I)) : 0;
|
|
534
|
+
}
|
|
535
|
+
c[z++] = b[0], c[z++] = b[1], c[z++] = b[2], c[z++] = b[3];
|
|
536
|
+
}
|
|
537
|
+
const T = l.table.length - 1;
|
|
538
|
+
let P = he(F, x, z) & T, $ = -1;
|
|
539
|
+
for (; ; ) {
|
|
540
|
+
const A = l.table[P];
|
|
541
|
+
if (A < 0)
|
|
542
|
+
break;
|
|
543
|
+
if (l.points[A] === F && l.normals[A * 3] === c[0] && l.normals[A * 3 + 1] === c[1] && l.normals[A * 3 + 2] === c[2]) {
|
|
544
|
+
let C = !0, I = 3;
|
|
545
|
+
if (l.uvs && (C = l.uvs[A * 2] === c[I] && l.uvs[A * 2 + 1] === c[I + 1], I += 2), C && l.uvs1 && (C = l.uvs1[A * 2] === c[I] && l.uvs1[A * 2 + 1] === c[I + 1], I += 2), C && l.colors && (C = l.colors[A * 4] === c[I] && l.colors[A * 4 + 1] === c[I + 1] && l.colors[A * 4 + 2] === c[I + 2] && l.colors[A * 4 + 3] === c[I + 3]), C) {
|
|
546
|
+
$ = A;
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
P = P + 1 & T;
|
|
551
|
+
}
|
|
552
|
+
if ($ < 0) {
|
|
553
|
+
if (++p > e.maxVertices)
|
|
554
|
+
throw new k("budget", "[Nova3D] Mesh vertex budget exceeded.");
|
|
555
|
+
$ = l.vertexCount++, l.table[P] = $, l.points[$] = F;
|
|
556
|
+
const A = t[F * 3], C = t[F * 3 + 1], I = t[F * 3 + 2];
|
|
557
|
+
l.positions[$ * 3] = v[0] * A + v[4] * C + v[8] * I + v[12], l.positions[$ * 3 + 1] = v[1] * A + v[5] * C + v[9] * I + v[13], l.positions[$ * 3 + 2] = v[2] * A + v[6] * C + v[10] * I + v[14], l.normals[$ * 3] = c[0], l.normals[$ * 3 + 1] = c[1], l.normals[$ * 3 + 2] = c[2];
|
|
558
|
+
let q = 3;
|
|
559
|
+
l.uvs && (l.uvs[$ * 2] = c[q++], l.uvs[$ * 2 + 1] = c[q++]), l.uvs1 && (l.uvs1[$ * 2] = c[q++], l.uvs1[$ * 2 + 1] = c[q++]), l.colors && l.colors.set(c.subarray(q, q + 4), $ * 4);
|
|
560
|
+
}
|
|
561
|
+
d[N] = $;
|
|
562
|
+
}
|
|
563
|
+
me(l, d, h, e.flipWinding);
|
|
564
|
+
}
|
|
565
|
+
const r = [];
|
|
566
|
+
return f.forEach((i, h) => {
|
|
567
|
+
if (!i.triangleCount)
|
|
568
|
+
return;
|
|
569
|
+
const l = i.vertexCount, N = i.indices.subarray(0, i.triangleCount * 3);
|
|
570
|
+
for (let F = 0; F < 3 * l; F++)
|
|
571
|
+
if (!Number.isFinite(i.positions[F]))
|
|
572
|
+
throw new k("format", "[Nova3D] Transformed mesh points exceed Float32.");
|
|
573
|
+
r.push({
|
|
574
|
+
group: h,
|
|
575
|
+
positions: i.positions.slice(0, l * 3),
|
|
576
|
+
normals: i.normals.slice(0, l * 3),
|
|
577
|
+
uvs: i.uvs?.slice(0, l * 2),
|
|
578
|
+
uvs1: i.uvs1?.slice(0, l * 2),
|
|
579
|
+
colors: i.colors?.slice(0, l * 4),
|
|
580
|
+
indices: l <= 65535 ? Uint16Array.from(N) : N.slice(),
|
|
581
|
+
points: i.points.slice(0, l)
|
|
582
|
+
});
|
|
583
|
+
}), { groups: r, vertexCount: p, skipped: M };
|
|
584
|
+
}
|
|
585
|
+
function B(e, t, s, n, o) {
|
|
586
|
+
const a = e.triangleCount++ * 3;
|
|
587
|
+
e.indices[a] = t, e.indices[a + 1] = o ? n : s, e.indices[a + 2] = o ? s : n;
|
|
588
|
+
}
|
|
589
|
+
function me(e, t, s, n) {
|
|
590
|
+
const o = e.positions;
|
|
591
|
+
if (s === 3) {
|
|
592
|
+
B(e, t[0], t[1], t[2], n);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
let a = 0, g = 0, u = 0;
|
|
596
|
+
for (let p = 0; p < s; p++) {
|
|
597
|
+
const w = t[p] * 3, b = t[(p + 1) % s] * 3;
|
|
598
|
+
a += (o[w + 1] - o[b + 1]) * (o[w + 2] + o[b + 2]), g += (o[w + 2] - o[b + 2]) * (o[w] + o[b]), u += (o[w] - o[b]) * (o[w + 1] + o[b + 1]);
|
|
599
|
+
}
|
|
600
|
+
const f = (p, w, b) => {
|
|
601
|
+
const r = o[w * 3] - o[p * 3], i = o[w * 3 + 1] - o[p * 3 + 1], h = o[w * 3 + 2] - o[p * 3 + 2], l = o[b * 3] - o[p * 3], N = o[b * 3 + 1] - o[p * 3 + 1], F = o[b * 3 + 2] - o[p * 3 + 2];
|
|
602
|
+
return (i * F - h * N) * a + (h * l - r * F) * g + (r * N - i * l) * u;
|
|
603
|
+
};
|
|
604
|
+
if (s === 4) {
|
|
605
|
+
const [p, w, b, r] = [t[0], t[1], t[2], t[3]];
|
|
606
|
+
f(p, w, b) >= 0 && f(p, b, r) >= 0 ? (B(e, p, w, b, n), B(e, p, b, r, n)) : (B(e, w, b, r, n), B(e, w, r, p, n));
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
const M = Math.abs(a), v = Math.abs(g), y = Math.abs(u), [c, x] = y >= M && y >= v ? [0, 1] : v >= M ? [2, 0] : [1, 2], m = new Float64Array(s * 2);
|
|
610
|
+
for (let p = 0; p < s; p++)
|
|
611
|
+
m[p * 2] = o[t[p] * 3 + c], m[p * 2 + 1] = o[t[p] * 3 + x];
|
|
612
|
+
const d = J(m);
|
|
613
|
+
if (d.length !== (s - 2) * 3) {
|
|
614
|
+
for (let p = 1; p + 1 < s; p++)
|
|
615
|
+
B(e, t[0], t[p], t[p + 1], n);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
for (let p = 0; p < d.length; p += 3) {
|
|
619
|
+
const w = t[d[p]], b = t[d[p + 1]], r = t[d[p + 2]];
|
|
620
|
+
f(w, b, r) >= 0 ? B(e, w, b, r, n) : B(e, w, r, b, n);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
function qe(e, t, s, n) {
|
|
624
|
+
const o = n(e.length * s);
|
|
625
|
+
for (let a = 0; a < e.length; a++) {
|
|
626
|
+
const g = e[a] * s;
|
|
627
|
+
for (let u = 0; u < s; u++)
|
|
628
|
+
o[a * s + u] = t[g + u];
|
|
629
|
+
}
|
|
630
|
+
return o;
|
|
631
|
+
}
|
|
632
|
+
export {
|
|
633
|
+
Fe as B,
|
|
634
|
+
Le as a,
|
|
635
|
+
Ne as b,
|
|
636
|
+
$e as c,
|
|
637
|
+
re as d,
|
|
638
|
+
ye as e,
|
|
639
|
+
xe as f,
|
|
640
|
+
W as g,
|
|
641
|
+
Me as h,
|
|
642
|
+
_ as i,
|
|
643
|
+
be as j,
|
|
644
|
+
ze as k,
|
|
645
|
+
je as l,
|
|
646
|
+
O as m,
|
|
647
|
+
qe as n,
|
|
648
|
+
Ce as o,
|
|
649
|
+
Ie as p,
|
|
650
|
+
De as q,
|
|
651
|
+
ke as r,
|
|
652
|
+
Se as s,
|
|
653
|
+
Ue as t,
|
|
654
|
+
Ae as u,
|
|
655
|
+
Te as v,
|
|
656
|
+
ee as w
|
|
657
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { c as b, o as c } from "./Options-CajE7LLJ.js";
|
|
2
|
+
const i = c({ signal: !0 });
|
|
3
|
+
function s(r, e) {
|
|
4
|
+
return r === void 0 ? {} : (b(r, i, `${e} ready`), r);
|
|
5
|
+
}
|
|
6
|
+
function u(r, e) {
|
|
7
|
+
return e ? e.aborted ? Promise.reject(e.reason ?? new DOMException("Aborted.", "AbortError")) : new Promise((a, n) => {
|
|
8
|
+
const t = () => {
|
|
9
|
+
e.removeEventListener("abort", t), n(e.reason ?? new DOMException("Aborted.", "AbortError"));
|
|
10
|
+
};
|
|
11
|
+
e.addEventListener("abort", t, { once: !0 }), r.then((o) => {
|
|
12
|
+
e.removeEventListener("abort", t), a(o);
|
|
13
|
+
}, (o) => {
|
|
14
|
+
e.removeEventListener("abort", t), n(o);
|
|
15
|
+
});
|
|
16
|
+
}) : r;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
s as r,
|
|
20
|
+
u as w
|
|
21
|
+
};
|