@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
package/dist/3d/fbx.js
ADDED
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
import { N as w, p as xt, w as bt, a as Bt } from "../Errors-B2ekO9bZ.js";
|
|
2
|
+
import { G as dt } from "../GLTFResourceIO-CYJyCUTt.js";
|
|
3
|
+
import { b as Ft, i as Ge, m as ce, d as Dt, k as ot, a as rt, s as Ct, t as Nt, c as st, e as Ie, f as Me, g as Re, h as at, j as At, l as Xt, p as St, n as $e, o as It, q as it, B as Mt, r as pt, u as _e, v as kt } from "../PolygonMesh-D4PnnfIo.js";
|
|
4
|
+
import { l as Lt, i as Ot, b as Tt } from "../LoaderIO-BwrM84OM.js";
|
|
5
|
+
import { c as Vt } from "../Clip-CAN7t03k.js";
|
|
6
|
+
import { i as Et } from "../Inflate-DWw0V-Up.js";
|
|
7
|
+
class Le {
|
|
8
|
+
constructor(n, t, h, s, f) {
|
|
9
|
+
this.type = n, this.length = t, this.encoding = h, this.bytes = s, this.values = f;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const ct = "Kaydara FBX Binary \0", ut = { f: 4, d: 8, l: 8, i: 4, b: 1 }, ht = 64, ke = new TextDecoder("utf-8");
|
|
13
|
+
function Ut(e) {
|
|
14
|
+
if (e.byteLength < 27)
|
|
15
|
+
return !1;
|
|
16
|
+
for (let n = 0; n < ct.length; n++)
|
|
17
|
+
if (e[n] !== ct.charCodeAt(n))
|
|
18
|
+
return !1;
|
|
19
|
+
return !0;
|
|
20
|
+
}
|
|
21
|
+
function Pt(e, n) {
|
|
22
|
+
if (Ut(e))
|
|
23
|
+
return Rt(e, n);
|
|
24
|
+
const t = ke.decode(e.subarray(0, Math.min(e.byteLength, 4096)));
|
|
25
|
+
if (/^\s*;\s*FBX/.test(t) || /FBXHeaderExtension\s*:/.test(t))
|
|
26
|
+
return Zt(ke.decode(e), n);
|
|
27
|
+
throw new w("format", "[Nova3D] Data is neither binary nor ASCII FBX.");
|
|
28
|
+
}
|
|
29
|
+
function Rt(e, n) {
|
|
30
|
+
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), h = t.getUint32(23, !0);
|
|
31
|
+
if (h < 7e3 || h >= 8e3)
|
|
32
|
+
throw new w("format", `[Nova3D] FBX version ${h} is outside the supported 7.x range.`);
|
|
33
|
+
const s = h >= 7500, f = s ? 25 : 13, a = e.byteLength;
|
|
34
|
+
let $ = 0;
|
|
35
|
+
const d = (A) => {
|
|
36
|
+
if (!s)
|
|
37
|
+
return t.getUint32(A, !0);
|
|
38
|
+
const fe = t.getBigUint64(A, !0);
|
|
39
|
+
return fe > BigInt(a) ? a + 1 : Number(fe);
|
|
40
|
+
}, m = (A, fe, ae) => {
|
|
41
|
+
if (A + f > fe)
|
|
42
|
+
throw new w("format", "[Nova3D] FBX record header is truncated.");
|
|
43
|
+
const l = d(A), x = d(A + (s ? 8 : 4)), S = d(A + (s ? 16 : 8)), P = e[A + (s ? 24 : 12)];
|
|
44
|
+
if (l === 0) {
|
|
45
|
+
if (x !== 0 || S !== 0 || P !== 0)
|
|
46
|
+
throw new w("format", "[Nova3D] FBX null record is malformed.");
|
|
47
|
+
return { node: null, next: A + f };
|
|
48
|
+
}
|
|
49
|
+
if (++$ > n.maxRecords)
|
|
50
|
+
throw new w("budget", "[Nova3D] FBX record budget exceeded.");
|
|
51
|
+
if (ae > ht)
|
|
52
|
+
throw new w("format", "[Nova3D] FBX nesting is too deep.");
|
|
53
|
+
const j = A + f, ee = j + P, te = ee + S;
|
|
54
|
+
if (l <= A || l > fe || te > l || x > S)
|
|
55
|
+
throw new w("format", "[Nova3D] FBX record range is invalid.");
|
|
56
|
+
const we = ke.decode(e.subarray(j, ee)), Be = [];
|
|
57
|
+
let K = ee;
|
|
58
|
+
for (let de = 0; de < x; de++)
|
|
59
|
+
K = $t(e, t, K, te, Be, n);
|
|
60
|
+
if (K !== te)
|
|
61
|
+
throw new w("format", "[Nova3D] FBX property list length differs from its contents.");
|
|
62
|
+
const Fe = [];
|
|
63
|
+
for (K = te; K < l; ) {
|
|
64
|
+
const de = m(K, l, ae + 1);
|
|
65
|
+
if (K = de.next, !de.node)
|
|
66
|
+
break;
|
|
67
|
+
Fe.push(de.node);
|
|
68
|
+
}
|
|
69
|
+
return { node: { name: we, props: Be, children: Fe }, next: l };
|
|
70
|
+
}, L = [];
|
|
71
|
+
let O = 27;
|
|
72
|
+
for (; O + f <= a; ) {
|
|
73
|
+
const A = m(O, a, 0);
|
|
74
|
+
if (!A.node)
|
|
75
|
+
break;
|
|
76
|
+
L.push(A.node), O = A.next;
|
|
77
|
+
}
|
|
78
|
+
return { version: h, binary: !0, nodes: L };
|
|
79
|
+
}
|
|
80
|
+
function $t(e, n, t, h, s, f) {
|
|
81
|
+
const a = (m) => {
|
|
82
|
+
if (t + 1 + m > h)
|
|
83
|
+
throw new w("format", "[Nova3D] FBX property is truncated.");
|
|
84
|
+
};
|
|
85
|
+
a(0);
|
|
86
|
+
const $ = String.fromCharCode(e[t]), d = t + 1;
|
|
87
|
+
switch ($) {
|
|
88
|
+
case "Y":
|
|
89
|
+
return a(2), s.push(n.getInt16(d, !0)), d + 2;
|
|
90
|
+
case "C":
|
|
91
|
+
return a(1), s.push(e[d]), d + 1;
|
|
92
|
+
case "I":
|
|
93
|
+
return a(4), s.push(n.getInt32(d, !0)), d + 4;
|
|
94
|
+
case "F":
|
|
95
|
+
return a(4), s.push(n.getFloat32(d, !0)), d + 4;
|
|
96
|
+
case "D":
|
|
97
|
+
return a(8), s.push(n.getFloat64(d, !0)), d + 8;
|
|
98
|
+
case "L": {
|
|
99
|
+
a(8);
|
|
100
|
+
const m = n.getBigInt64(d, !0);
|
|
101
|
+
return s.push(m >= BigInt(Number.MIN_SAFE_INTEGER) && m <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(m) : m), d + 8;
|
|
102
|
+
}
|
|
103
|
+
case "S":
|
|
104
|
+
case "R": {
|
|
105
|
+
a(4);
|
|
106
|
+
const m = n.getUint32(d, !0);
|
|
107
|
+
a(4 + m);
|
|
108
|
+
const L = e.subarray(d + 4, d + 4 + m);
|
|
109
|
+
if ($ === "R")
|
|
110
|
+
s.push(L);
|
|
111
|
+
else {
|
|
112
|
+
const O = ke.decode(L), A = O.indexOf("\0");
|
|
113
|
+
s.push(A >= 0 ? `${O.slice(A + 2)}::${O.slice(0, A)}` : O);
|
|
114
|
+
}
|
|
115
|
+
return d + 4 + m;
|
|
116
|
+
}
|
|
117
|
+
case "f":
|
|
118
|
+
case "d":
|
|
119
|
+
case "l":
|
|
120
|
+
case "i":
|
|
121
|
+
case "b": {
|
|
122
|
+
a(12);
|
|
123
|
+
const m = n.getUint32(d, !0), L = n.getUint32(d + 4, !0), O = n.getUint32(d + 8, !0), A = m * ut[$];
|
|
124
|
+
if (A > f.maxArrayBytes)
|
|
125
|
+
throw new w("budget", "[Nova3D] FBX array exceeds its byte limit.");
|
|
126
|
+
if (L !== 0 && L !== 1)
|
|
127
|
+
throw new w("unsupported", "[Nova3D] FBX array encoding is unsupported.");
|
|
128
|
+
if (L === 0 && O !== A)
|
|
129
|
+
throw new w("format", "[Nova3D] FBX raw array length differs from its element count.");
|
|
130
|
+
return a(12 + O), s.push(new Le($, m, L, e.subarray(d + 12, d + 12 + O), null)), d + 12 + O;
|
|
131
|
+
}
|
|
132
|
+
default:
|
|
133
|
+
throw new w("invalid-option", `[Nova3D] Unknown FBX property type ${JSON.stringify($)}.`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function jt(e, n, t) {
|
|
137
|
+
if (e.values)
|
|
138
|
+
return e.values;
|
|
139
|
+
const h = ut[e.type], s = e.length * h;
|
|
140
|
+
n.consume(s);
|
|
141
|
+
const f = e.encoding === 0 ? e.bytes.slice() : await Et(e.bytes, "deflate", s, t);
|
|
142
|
+
let a;
|
|
143
|
+
switch (e.type) {
|
|
144
|
+
case "f":
|
|
145
|
+
a = new Float32Array(f.buffer, f.byteOffset, e.length);
|
|
146
|
+
break;
|
|
147
|
+
case "d":
|
|
148
|
+
a = new Float64Array(f.buffer, f.byteOffset, e.length);
|
|
149
|
+
break;
|
|
150
|
+
case "i":
|
|
151
|
+
a = new Int32Array(f.buffer, f.byteOffset, e.length);
|
|
152
|
+
break;
|
|
153
|
+
case "b":
|
|
154
|
+
a = f;
|
|
155
|
+
break;
|
|
156
|
+
default: {
|
|
157
|
+
const $ = new BigInt64Array(f.buffer, f.byteOffset, e.length);
|
|
158
|
+
a = new Float64Array(e.length);
|
|
159
|
+
for (let d = 0; d < e.length; d++)
|
|
160
|
+
a[d] = Number($[d]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return e.values = a, a;
|
|
164
|
+
}
|
|
165
|
+
async function Yt(e, n, t, h) {
|
|
166
|
+
const s = [], f = [...e];
|
|
167
|
+
for (; f.length; ) {
|
|
168
|
+
const d = f.pop();
|
|
169
|
+
if (n.has(d.name))
|
|
170
|
+
for (const m of d.props)
|
|
171
|
+
m instanceof Le && !m.values && s.push(m);
|
|
172
|
+
for (const m of d.children)
|
|
173
|
+
f.push(m);
|
|
174
|
+
}
|
|
175
|
+
let a = 0;
|
|
176
|
+
const $ = async () => {
|
|
177
|
+
for (; a < s.length; ) {
|
|
178
|
+
const d = s[a++];
|
|
179
|
+
await jt(d, t, h);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
await Promise.all(Array.from({ length: Math.min(8, s.length) }, $));
|
|
183
|
+
}
|
|
184
|
+
const C = { Tab: 9, LineFeed: 10, Return: 13, Space: 32, Quote: 34, Star: 42, Comma: 44, Colon: 58, Semicolon: 59, OpenBrace: 123, CloseBrace: 125 };
|
|
185
|
+
function Zt(e, n) {
|
|
186
|
+
let t = 0, h = 0;
|
|
187
|
+
const s = e.length, f = (l) => {
|
|
188
|
+
throw new w(xt(l), `[Nova3D] FBX ASCII ${l} at offset ${t}.`);
|
|
189
|
+
}, a = (l) => {
|
|
190
|
+
for (; t < s; ) {
|
|
191
|
+
const x = e.charCodeAt(t);
|
|
192
|
+
if (x === C.Space || x === C.Tab || x === C.Return || l && x === C.LineFeed)
|
|
193
|
+
t++;
|
|
194
|
+
else if (x === C.Semicolon && l)
|
|
195
|
+
for (; t < s && e.charCodeAt(t) !== C.LineFeed; )
|
|
196
|
+
t++;
|
|
197
|
+
else
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}, $ = (l) => l === C.Comma || l === C.LineFeed || l === C.Return || l === C.OpenBrace || l === C.CloseBrace || l === C.Space || l === C.Tab || l === C.Semicolon, d = () => {
|
|
201
|
+
if (e.charCodeAt(t) === C.Quote) {
|
|
202
|
+
const P = e.indexOf('"', t + 1);
|
|
203
|
+
P < 0 && f("unterminated string");
|
|
204
|
+
const j = e.slice(t + 1, P).replace(/"/g, '"');
|
|
205
|
+
return t = P + 1, j;
|
|
206
|
+
}
|
|
207
|
+
const x = t;
|
|
208
|
+
for (; t < s && !$(e.charCodeAt(t)); )
|
|
209
|
+
t++;
|
|
210
|
+
const S = e.slice(x, t);
|
|
211
|
+
if (/^[+-]?\d+$/.test(S)) {
|
|
212
|
+
const P = Number(S);
|
|
213
|
+
return Number.isSafeInteger(P) ? P : BigInt(S);
|
|
214
|
+
}
|
|
215
|
+
return /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(S) ? Number(S) : S;
|
|
216
|
+
}, m = (l) => {
|
|
217
|
+
(!Number.isSafeInteger(l) || l < 0 || l * 8 > n.maxArrayBytes) && f("array exceeds its byte limit"), a(!0), e.charCodeAt(t) !== C.OpenBrace && f("array requires a body"), t++, a(!0);
|
|
218
|
+
const x = new Float64Array(l);
|
|
219
|
+
if (e.charCodeAt(t) !== C.CloseBrace) {
|
|
220
|
+
(e[t] !== "a" || e.charCodeAt(t + 1) !== C.Colon) && f('array body requires "a:"'), t += 2;
|
|
221
|
+
let S = 0;
|
|
222
|
+
for (; ; ) {
|
|
223
|
+
a(!0);
|
|
224
|
+
const P = e.charCodeAt(t);
|
|
225
|
+
if (P === C.CloseBrace || t >= s)
|
|
226
|
+
break;
|
|
227
|
+
if (P === C.Comma) {
|
|
228
|
+
t++;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const j = t;
|
|
232
|
+
for (; t < s && !$(e.charCodeAt(t)); )
|
|
233
|
+
t++;
|
|
234
|
+
S >= l && f("array has more values than declared");
|
|
235
|
+
const ee = Number(e.slice(j, t));
|
|
236
|
+
Number.isNaN(ee) && e.slice(j, t).toLowerCase().replace(/^[+-]/, "") !== "nan" && f("array value is not a number"), x[S++] = ee;
|
|
237
|
+
}
|
|
238
|
+
S !== l && f("array has fewer values than declared");
|
|
239
|
+
}
|
|
240
|
+
return e.charCodeAt(t) !== C.CloseBrace && f("unterminated array"), t++, new Le("d", l, 0, null, x);
|
|
241
|
+
}, L = (l) => {
|
|
242
|
+
l > ht && f("nesting is too deep");
|
|
243
|
+
const x = [];
|
|
244
|
+
for (; ; ) {
|
|
245
|
+
if (a(!0), t >= s)
|
|
246
|
+
return l && f("unterminated node"), x;
|
|
247
|
+
if (e.charCodeAt(t) === C.CloseBrace)
|
|
248
|
+
return l || f('unexpected "}"'), t++, x;
|
|
249
|
+
const S = e.indexOf(":", t);
|
|
250
|
+
S < 0 && f('expected "Name:"');
|
|
251
|
+
const P = e.slice(t, S).trim();
|
|
252
|
+
if (/^[\w|.\- ]+$/.test(P) || f("invalid node name"), ++h > n.maxRecords)
|
|
253
|
+
throw new w("budget", "[Nova3D] FBX record budget exceeded.");
|
|
254
|
+
t = S + 1;
|
|
255
|
+
const j = [];
|
|
256
|
+
let ee = [];
|
|
257
|
+
if (a(!1), e.charCodeAt(t) === C.Star) {
|
|
258
|
+
t++;
|
|
259
|
+
const we = t;
|
|
260
|
+
for (; t < s && /\d/.test(e[t]); )
|
|
261
|
+
t++;
|
|
262
|
+
j.push(m(Number(e.slice(we, t)))), x.push({ name: P, props: j, children: ee });
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
let te = e.charCodeAt(t);
|
|
266
|
+
if (te !== C.LineFeed && te !== C.OpenBrace && te !== C.CloseBrace && t < s)
|
|
267
|
+
for (; te = e.charCodeAt(t), te === C.Comma ? j.push("") : j.push(d()), a(!1), e.charCodeAt(t) === C.Comma; )
|
|
268
|
+
t++, a(!0);
|
|
269
|
+
a(!1), e.charCodeAt(t) === C.OpenBrace && (t++, ee = L(l + 1)), x.push({ name: P, props: j, children: ee });
|
|
270
|
+
}
|
|
271
|
+
}, O = L(0), fe = O.find((l) => l.name === "FBXHeaderExtension")?.children.find((l) => l.name === "FBXVersion"), ae = typeof fe?.props[0] == "number" ? fe.props[0] : 7e3;
|
|
272
|
+
if (ae < 7e3 || ae >= 8e3)
|
|
273
|
+
throw new w("format", `[Nova3D] FBX version ${ae} is outside the supported 7.x range.`);
|
|
274
|
+
return { version: ae, binary: !1, nodes: O };
|
|
275
|
+
}
|
|
276
|
+
const je = 46186158e3, Gt = /* @__PURE__ */ new Set(["Vertices", "PolygonVertexIndex", "Normals", "NormalsIndex", "NormalIndex", "UV", "UVIndex", "Colors", "ColorIndex", "Materials", "Indexes", "Weights", "Transform", "TransformLink", "KeyTime", "KeyValueFloat", "FullWeights"]), _t = ["XYZ", "XZY", "YZX", "YXZ", "ZXY", "ZYX", "XYZ"], qt = ["Lcl Translation", "Lcl Rotation", "Lcl Scaling"];
|
|
277
|
+
function Q(e, n) {
|
|
278
|
+
return e.children.find((t) => t.name === n);
|
|
279
|
+
}
|
|
280
|
+
function Ye(e) {
|
|
281
|
+
if (typeof e == "bigint" || typeof e == "number" && Number.isInteger(e))
|
|
282
|
+
return String(e);
|
|
283
|
+
if (typeof e == "string" && /^-?\d+$/.test(e))
|
|
284
|
+
return e;
|
|
285
|
+
throw new w("format", "[Nova3D] FBX object id must be an integer.");
|
|
286
|
+
}
|
|
287
|
+
function Ze(e) {
|
|
288
|
+
const n = e.props[1];
|
|
289
|
+
if (typeof n != "string")
|
|
290
|
+
return "";
|
|
291
|
+
const t = n.indexOf("::");
|
|
292
|
+
return t >= 0 ? n.slice(t + 2) : n;
|
|
293
|
+
}
|
|
294
|
+
function be(e) {
|
|
295
|
+
const n = /* @__PURE__ */ new Map();
|
|
296
|
+
for (const t of Q(e, "Properties70")?.children ?? [])
|
|
297
|
+
t.name === "P" && typeof t.props[0] == "string" && n.set(t.props[0], t.props.slice(4));
|
|
298
|
+
return n;
|
|
299
|
+
}
|
|
300
|
+
function Ae(e, n) {
|
|
301
|
+
const t = typeof e == "number" ? e : typeof e == "bigint" ? Number(e) : n;
|
|
302
|
+
return Number.isFinite(t) ? t : n;
|
|
303
|
+
}
|
|
304
|
+
function U(e, n, t) {
|
|
305
|
+
return Ae(e.get(n)?.[0], t);
|
|
306
|
+
}
|
|
307
|
+
function _(e, n, t) {
|
|
308
|
+
const h = e.get(n);
|
|
309
|
+
return t.map((s, f) => Ae(h?.[f], s));
|
|
310
|
+
}
|
|
311
|
+
function me(e) {
|
|
312
|
+
const n = e?.props[0];
|
|
313
|
+
return typeof n == "string" ? n : "";
|
|
314
|
+
}
|
|
315
|
+
function H(e, n) {
|
|
316
|
+
const t = e ? Q(e, n)?.props[0] : void 0;
|
|
317
|
+
if (t !== void 0) {
|
|
318
|
+
if (!(t instanceof Le) || !t.values)
|
|
319
|
+
throw new w("format", `[Nova3D] FBX ${n} must be a numeric array.`);
|
|
320
|
+
return t.values;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function lt(e, n) {
|
|
324
|
+
if (e instanceof Int32Array)
|
|
325
|
+
return e;
|
|
326
|
+
const t = new Int32Array(e.length);
|
|
327
|
+
for (let h = 0; h < e.length; h++) {
|
|
328
|
+
const s = e[h];
|
|
329
|
+
if (!Number.isInteger(s) || s < -2147483648 || s > 2147483647)
|
|
330
|
+
throw new w("format", `[Nova3D] FBX ${n} must contain 32-bit integers.`);
|
|
331
|
+
t[h] = s;
|
|
332
|
+
}
|
|
333
|
+
return t;
|
|
334
|
+
}
|
|
335
|
+
function ft(e, n) {
|
|
336
|
+
if (!e)
|
|
337
|
+
return Ge();
|
|
338
|
+
if (e.length !== 16 || !Array.from(e).every(Number.isFinite))
|
|
339
|
+
throw new w("format", `[Nova3D] FBX ${n} must be a finite 4x4 matrix.`);
|
|
340
|
+
return Float64Array.from(e);
|
|
341
|
+
}
|
|
342
|
+
function Kt(e) {
|
|
343
|
+
switch (e) {
|
|
344
|
+
case "ByPolygonVertex":
|
|
345
|
+
return "polygon-vertex";
|
|
346
|
+
case "ByVertice":
|
|
347
|
+
case "ByVertex":
|
|
348
|
+
case "ByControlPoint":
|
|
349
|
+
return "vertex";
|
|
350
|
+
case "ByPolygon":
|
|
351
|
+
return "polygon";
|
|
352
|
+
case "AllSame":
|
|
353
|
+
return "all";
|
|
354
|
+
default:
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
async function Wt(e, n) {
|
|
359
|
+
const t = Pt(e, { maxRecords: n.maxRecords, maxArrayBytes: n.maxArrayBytes });
|
|
360
|
+
return zt(t, n);
|
|
361
|
+
}
|
|
362
|
+
async function zt(e, n) {
|
|
363
|
+
const t = [], h = /* @__PURE__ */ new Set(), s = (o, r) => {
|
|
364
|
+
h.has(r) || (h.add(r), t.push(bt(o, r)));
|
|
365
|
+
}, f = e.nodes.find((o) => o.name === "Objects");
|
|
366
|
+
if (!f)
|
|
367
|
+
throw new w("format", "[Nova3D] FBX document has no Objects section.");
|
|
368
|
+
await Yt(f.children, Gt, new Mt(n.maxDecompressedBytes, "FBX decompressed array"), n.signal), n.signal?.throwIfAborted();
|
|
369
|
+
const a = /* @__PURE__ */ new Map();
|
|
370
|
+
for (const o of f.children)
|
|
371
|
+
if (o.props.length) {
|
|
372
|
+
const r = Ye(o.props[0]);
|
|
373
|
+
if (a.has(r))
|
|
374
|
+
throw new w("format", "[Nova3D] FBX object ids must be unique.");
|
|
375
|
+
a.set(r, o);
|
|
376
|
+
}
|
|
377
|
+
const $ = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
|
|
378
|
+
for (const o of e.nodes.find((r) => r.name === "Connections")?.children ?? []) {
|
|
379
|
+
if (o.name !== "C" || o.props.length < 3)
|
|
380
|
+
continue;
|
|
381
|
+
const r = { child: Ye(o.props[1]), parent: Ye(o.props[2]), property: typeof o.props[3] == "string" ? o.props[3] : "" };
|
|
382
|
+
$.set(r.parent, [...$.get(r.parent) ?? [], r]), d.set(r.child, [...d.get(r.child) ?? [], r]);
|
|
383
|
+
}
|
|
384
|
+
const m = (o, r, c) => ($.get(o) ?? []).filter((i) => {
|
|
385
|
+
const u = a.get(i.child);
|
|
386
|
+
return u?.name === r && (c === void 0 || u.props[2] === c);
|
|
387
|
+
}), L = be(e.nodes.find((o) => o.name === "GlobalSettings") ?? { children: [] });
|
|
388
|
+
let O = { right: [1, 0, 0], up: [0, 1, 0], front: [0, 0, 1] };
|
|
389
|
+
if (n.convertAxes) {
|
|
390
|
+
const o = (u, y) => [0, 1, 2].map((v) => v === u ? y < 0 ? -1 : 1 : 0), r = U(L, "UpAxis", 1), c = U(L, "FrontAxis", 2), i = U(L, "CoordAxis", 0);
|
|
391
|
+
[r, c, i].every((u) => [0, 1, 2].includes(u)) && (/* @__PURE__ */ new Set([r, c, i])).size === 3 ? O = { right: o(i, U(L, "CoordAxisSign", 1)), up: o(r, U(L, "UpAxisSign", 1)), front: o(c, U(L, "FrontAxisSign", 1)) } : s("ignored", "FBX axis system is invalid; axes were left unchanged.");
|
|
392
|
+
}
|
|
393
|
+
const A = U(L, "UnitScaleFactor", 1), fe = n.convertUnits ? A > 0 && Number.isFinite(A) ? A / 100 : 0.01 : 1, ae = Ft(O.right, O.up, O.front, fe), l = (o) => At(ae.matrix, ae.inverse, o), x = [], S = /* @__PURE__ */ new Map();
|
|
394
|
+
for (const [o, r] of a)
|
|
395
|
+
if (r.name === "Model") {
|
|
396
|
+
if (x.length >= n.maxNodes)
|
|
397
|
+
throw new w("budget", "[Nova3D] FBX model budget exceeded.");
|
|
398
|
+
S.set(o, x.length), x.push({ id: o, node: r, index: x.length, parent: -1, props: be(r), local: Ge(), world: Ge() });
|
|
399
|
+
}
|
|
400
|
+
for (const o of x) {
|
|
401
|
+
const r = (d.get(o.id) ?? []).find((c) => a.get(c.parent)?.name === "Model" && !c.property);
|
|
402
|
+
r && (o.parent = S.get(r.parent));
|
|
403
|
+
}
|
|
404
|
+
const P = [], j = new Uint8Array(x.length);
|
|
405
|
+
for (const o of x) {
|
|
406
|
+
const r = [];
|
|
407
|
+
let c = o.index;
|
|
408
|
+
for (; c >= 0 && j[c] === 0; )
|
|
409
|
+
j[c] = 1, r.push(c), c = x[c].parent;
|
|
410
|
+
if (c >= 0 && j[c] === 1)
|
|
411
|
+
throw new w("format", "[Nova3D] FBX model hierarchy has a cycle.");
|
|
412
|
+
for (let i = r.length - 1; i >= 0; i--)
|
|
413
|
+
j[r[i]] = 2, P.push(r[i]);
|
|
414
|
+
}
|
|
415
|
+
const ee = (o, r, c, i) => {
|
|
416
|
+
const u = o.props, y = U(u, "RotationOrder", 0), v = _t[y] ?? "XYZ", Z = _(u, "RotationOffset", [0, 0, 0]), b = _(u, "RotationPivot", [0, 0, 0]), I = _(u, "ScalingOffset", [0, 0, 0]), g = _(u, "ScalingPivot", [0, 0, 0]), G = _(u, "PreRotation", [0, 0, 0]), X = _(u, "PostRotation", [0, 0, 0]);
|
|
417
|
+
let D = Ie(r[0] + Z[0] + b[0], r[1] + Z[1] + b[1], r[2] + Z[2] + b[2]);
|
|
418
|
+
return D = ce(D, Me(G[0], G[1], G[2], "XYZ")), D = ce(D, Me(c[0], c[1], c[2], v)), D = ce(D, Re(Me(X[0], X[1], X[2], "XYZ"))), D = ce(D, Ie(I[0] - b[0] + g[0], I[1] - b[1] + g[1], I[2] - b[2] + g[2])), D = ce(D, at(i[0], i[1], i[2])), ce(D, Ie(-g[0], -g[1], -g[2]));
|
|
419
|
+
}, te = (o) => [_(o.props, "Lcl Translation", [0, 0, 0]), _(o.props, "Lcl Rotation", [0, 0, 0]), _(o.props, "Lcl Scaling", [1, 1, 1])];
|
|
420
|
+
let we = !1;
|
|
421
|
+
const Be = () => {
|
|
422
|
+
we || (we = !0, s("approximated", "An FBX transform has shear; it was approximated by translation, rotation and scale."));
|
|
423
|
+
}, K = x.map((o) => ({ name: Ze(o.node), transform: { position: [0, 0, 0], quaternion: [0, 0, 0, 1], scale: [1, 1, 1] }, children: [] })), Fe = [];
|
|
424
|
+
for (const o of P) {
|
|
425
|
+
const r = x[o], [c, i, u] = te(r);
|
|
426
|
+
r.local = ee(r, c, i, u), r.world = r.parent >= 0 ? ce(x[r.parent].world, r.local) : r.local;
|
|
427
|
+
const y = Dt(l(r.local));
|
|
428
|
+
y.shear && Be(), K[o].transform = y.transform, r.parent >= 0 ? K[r.parent].children.push(o) : Fe.push(o);
|
|
429
|
+
}
|
|
430
|
+
const de = [], qe = /* @__PURE__ */ new Map(), De = [], Ke = /* @__PURE__ */ new Map();
|
|
431
|
+
let Oe = -1;
|
|
432
|
+
const gt = () => (Oe < 0 && (Oe = De.length, De.push(It())), Oe), yt = (o) => {
|
|
433
|
+
const r = qe.get(o);
|
|
434
|
+
if (r !== void 0)
|
|
435
|
+
return r;
|
|
436
|
+
const c = a.get(o), i = m(o, "Video").map((b) => a.get(b.child))[0];
|
|
437
|
+
let u;
|
|
438
|
+
const y = i ? Q(i, "Content") : void 0;
|
|
439
|
+
if (y)
|
|
440
|
+
if (y.props[0] instanceof Uint8Array && y.props[0].byteLength)
|
|
441
|
+
u = y.props[0];
|
|
442
|
+
else {
|
|
443
|
+
const b = y.props.filter((I) => typeof I == "string").join("").replace(/\s/g, "");
|
|
444
|
+
if (b) {
|
|
445
|
+
if (!/^[A-Z0-9+/]*={0,2}$/i.test(b) || b.length % 4 !== 0 || b.length / 4 * 3 > n.maxArrayBytes)
|
|
446
|
+
throw new w("format", "[Nova3D] Embedded FBX texture is invalid or oversized.");
|
|
447
|
+
const I = atob(b);
|
|
448
|
+
u = new Uint8Array(I.length);
|
|
449
|
+
for (let g = 0; g < I.length; g++)
|
|
450
|
+
u[g] = I.charCodeAt(g);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
let v = me(Q(c, "RelativeFilename")) || me(Q(c, "FileName")) || (i ? me(Q(i, "RelativeFilename")) || me(Q(i, "Filename")) : "");
|
|
454
|
+
v = v.replace(/\\/g, "/"), (/^[a-z]:\//i.test(v) || v.startsWith("/")) && (v = v.slice(v.lastIndexOf("/") + 1));
|
|
455
|
+
const Z = de.length;
|
|
456
|
+
return de.push({ bytes: u, uri: u ? void 0 : v || void 0, baseUrl: n.baseUrl, label: JSON.stringify(Ze(c) || v || o) }), qe.set(o, Z), Z;
|
|
457
|
+
}, Xe = (o, r) => {
|
|
458
|
+
const c = a.get(o), i = be(c), u = (b) => U(i, b, 0) === 1 ? "clamp" : "repeat", y = _(i, "Translation", [0, 0, 0]), v = _(i, "Scaling", [1, 1, 1]);
|
|
459
|
+
_(i, "Rotation", [0, 0, 0]).some((b) => b !== 0) && s("ignored", "FBX texture rotation is not supported and was ignored.");
|
|
460
|
+
const Z = y[0] === 0 && y[1] === 0 && v[0] === 1 && v[1] === 1 ? null : { offset: [y[0], 1 - v[1] - y[1]], scale: [v[0], v[1]] };
|
|
461
|
+
return { source: yt(o), channel: r, wrapS: u("WrapModeU"), wrapT: u("WrapModeV"), transform: Z };
|
|
462
|
+
}, wt = (o) => {
|
|
463
|
+
const r = Ke.get(o);
|
|
464
|
+
if (r !== void 0)
|
|
465
|
+
return r;
|
|
466
|
+
const c = a.get(o), i = be(c), u = (me(Q(c, "ShadingModel")) || String(i.get("ShadingModel")?.[0] ?? "")).toLowerCase(), y = (X, D) => {
|
|
467
|
+
for (const T of X)
|
|
468
|
+
if (i.has(T))
|
|
469
|
+
return _(i, T, D).map((B) => it(Math.min(1, Math.max(0, B))));
|
|
470
|
+
return D.map(it);
|
|
471
|
+
}, v = y(["DiffuseColor", "Diffuse"], [0.8, 0.8, 0.8]).map((X) => X * U(i, "DiffuseFactor", 1)), Z = y(["EmissiveColor", "Emissive"], [0, 0, 0]).map((X) => X * U(i, "EmissiveFactor", 1)), b = y(["SpecularColor", "Specular"], [0.2, 0.2, 0.2]).map((X) => X * U(i, "SpecularFactor", 1));
|
|
472
|
+
let I = 1;
|
|
473
|
+
i.has("Opacity") ? I = U(i, "Opacity", 1) : i.has("TransparencyFactor") && U(i, "TransparencyFactor", 0) > 0 && (I = 1 - U(i, "TransparencyFactor", 0)), I = Math.min(1, Math.max(0, I));
|
|
474
|
+
const g = {
|
|
475
|
+
type: u === "lambert" ? "lambert" : "phong",
|
|
476
|
+
baseColor: [v[0], v[1], v[2], I],
|
|
477
|
+
emissive: [Z[0], Z[1], Z[2]],
|
|
478
|
+
specular: [b[0], b[1], b[2]],
|
|
479
|
+
shininess: U(i, "Shininess", U(i, "ShininessExponent", 20)),
|
|
480
|
+
alphaMode: I < 1 ? "blend" : "opaque",
|
|
481
|
+
alphaCutoff: 0.5,
|
|
482
|
+
side: "front"
|
|
483
|
+
};
|
|
484
|
+
for (const X of m(o, "Texture"))
|
|
485
|
+
switch (X.property) {
|
|
486
|
+
case "DiffuseColor":
|
|
487
|
+
case "Diffuse":
|
|
488
|
+
case "Maya|TEX_color_map":
|
|
489
|
+
case "Maya|baseColor":
|
|
490
|
+
g.baseColorMap = Xe(X.child);
|
|
491
|
+
break;
|
|
492
|
+
case "NormalMap":
|
|
493
|
+
case "Maya|TEX_normal_map":
|
|
494
|
+
g.normalMap = Xe(X.child);
|
|
495
|
+
break;
|
|
496
|
+
case "EmissiveColor":
|
|
497
|
+
case "Emissive":
|
|
498
|
+
g.emissiveMap = Xe(X.child), g.emissive.every((D) => D === 0) && (g.emissive = [1, 1, 1]);
|
|
499
|
+
break;
|
|
500
|
+
case "SpecularColor":
|
|
501
|
+
case "SpecularFactor":
|
|
502
|
+
g.specularMap = Xe(X.child);
|
|
503
|
+
break;
|
|
504
|
+
default:
|
|
505
|
+
s("unsupported", `FBX texture slot ${JSON.stringify(X.property)} is not supported.`);
|
|
506
|
+
}
|
|
507
|
+
g.baseColorMap && (g.baseColor = [1, 1, 1, I]);
|
|
508
|
+
const G = De.length;
|
|
509
|
+
return De.push(g), Ke.set(o, G), G;
|
|
510
|
+
}, Te = [], Ve = [], Ee = [], We = /* @__PURE__ */ new Map();
|
|
511
|
+
let ze = n.maxVertices;
|
|
512
|
+
const vt = (o, r) => {
|
|
513
|
+
const c = r.props, i = _(c, "GeometricTranslation", [0, 0, 0]), u = _(c, "GeometricRotation", [0, 0, 0]), y = _(c, "GeometricScaling", [1, 1, 1]), v = `${o}|${i}|${u}|${y}`, Z = We.get(v);
|
|
514
|
+
if (Z)
|
|
515
|
+
return Z;
|
|
516
|
+
const b = a.get(o), I = ce(ce(Ie(i[0], i[1], i[2]), Me(u[0], u[1], u[2], "XYZ")), at(y[0], y[1], y[2])), g = ce(ae.matrix, I), G = H(b, "Vertices"), X = H(b, "PolygonVertexIndex");
|
|
517
|
+
if (!G || !X)
|
|
518
|
+
throw new w("format", "[Nova3D] FBX mesh requires Vertices and PolygonVertexIndex.");
|
|
519
|
+
const D = lt(X, "PolygonVertexIndex"), T = new Int32Array(D.length);
|
|
520
|
+
let B = 0;
|
|
521
|
+
for (let p = 0; p < D.length; p++)
|
|
522
|
+
D[p] < 0 && B++;
|
|
523
|
+
D.length && D[D.length - 1] >= 0 && (B++, s("ignored", "FBX polygon index column does not close its last polygon."));
|
|
524
|
+
const M = new Int32Array(B);
|
|
525
|
+
let W = 0, k = 0;
|
|
526
|
+
for (let p = 0; p < D.length; p++) {
|
|
527
|
+
const F = D[p];
|
|
528
|
+
T[p] = F < 0 ? ~F : F, k++, (F < 0 || p === D.length - 1) && (M[W++] = k, k = 0);
|
|
529
|
+
}
|
|
530
|
+
const R = (p, F, z, ne, J = 0) => {
|
|
531
|
+
const E = b.children.filter((se) => se.name === p).sort((se, ie) => Ae(se.props[0], 0) - Ae(ie.props[0], 0))[J];
|
|
532
|
+
if (!E)
|
|
533
|
+
return;
|
|
534
|
+
const oe = Kt(me(Q(E, "MappingInformationType"))), pe = me(Q(E, "ReferenceInformationType")), le = H(E, F);
|
|
535
|
+
if (!oe || !le) {
|
|
536
|
+
s("unsupported", `FBX ${p} mapping ${JSON.stringify(me(Q(E, "MappingInformationType")))} is not supported.`);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
let re;
|
|
540
|
+
if (pe === "IndexToDirect" || pe === "Index") {
|
|
541
|
+
const se = z.map((ie) => H(E, ie)).find((ie) => ie !== void 0);
|
|
542
|
+
if (!se)
|
|
543
|
+
throw new w("format", `[Nova3D] FBX ${p} IndexToDirect requires an index column.`);
|
|
544
|
+
re = lt(se, `${p} index`);
|
|
545
|
+
}
|
|
546
|
+
return { mapping: oe, values: le, size: ne, indices: re };
|
|
547
|
+
}, ue = R("LayerElementUV", "UV", ["UVIndex"], 2), V = R("LayerElementUV", "UV", ["UVIndex"], 2, 1), Y = R("LayerElementNormal", "Normals", ["NormalsIndex", "NormalIndex"], 3), ve = R("LayerElementColor", "Colors", ["ColorIndex"], 4);
|
|
548
|
+
let q, xe = 1;
|
|
549
|
+
const N = Q(b, "LayerElementMaterial");
|
|
550
|
+
if (N && me(Q(N, "MappingInformationType")) === "ByPolygon") {
|
|
551
|
+
const p = H(N, "Materials");
|
|
552
|
+
if (p) {
|
|
553
|
+
q = new Int32Array(M.length);
|
|
554
|
+
for (let F = 0; F < M.length; F++) {
|
|
555
|
+
const z = F < p.length ? p[F] : 0;
|
|
556
|
+
q[F] = Number.isInteger(z) && z >= 0 && z < 65536 ? z : 0, xe = Math.max(xe, q[F] + 1);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
} else if (N) {
|
|
560
|
+
const p = H(N, "Materials"), F = p?.length ? p[0] : 0;
|
|
561
|
+
Number.isInteger(F) && F > 0 && F < 65536 && (q = new Int32Array(M.length).fill(F), xe = F + 1);
|
|
562
|
+
}
|
|
563
|
+
const ge = Xt({ points: G, counts: M, indices: T, normals: Y, uvs: ue, uvs1: V, colors: ve, groups: q, groupCount: xe, matrix: g, flipWinding: ae.mirrored, flipV: !0, maxVertices: ze });
|
|
564
|
+
ze -= ge.vertexCount, ge.skipped && s("skipped", "FBX polygons with fewer than three corners were skipped.");
|
|
565
|
+
const ye = G.length / 3;
|
|
566
|
+
let Se, he;
|
|
567
|
+
const et = m(o, "Deformer", "Skin")[0];
|
|
568
|
+
if (et) {
|
|
569
|
+
const p = [], F = [], z = [];
|
|
570
|
+
let ne;
|
|
571
|
+
for (const J of m(et.child, "Deformer", "Cluster")) {
|
|
572
|
+
const E = a.get(J.child), oe = m(J.child, "Model")[0];
|
|
573
|
+
if (!oe) {
|
|
574
|
+
s("skipped", "An FBX skin cluster has no bone and was skipped.");
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
const pe = ft(H(E, "Transform"), "cluster Transform"), le = ft(H(E, "TransformLink"), "cluster TransformLink");
|
|
578
|
+
ne ??= pe;
|
|
579
|
+
let re = p.indexOf(S.get(oe.child));
|
|
580
|
+
re < 0 && (re = p.length, p.push(S.get(oe.child)), F.push(l(ce(Re(le), pe))));
|
|
581
|
+
const se = H(E, "Indexes"), ie = H(E, "Weights");
|
|
582
|
+
se && ie && z.push({ joint: re, indices: se, weights: ie });
|
|
583
|
+
}
|
|
584
|
+
if (p.length) {
|
|
585
|
+
const J = St(ye, z, p.length);
|
|
586
|
+
if (J.unweighted && (p.push(r.index), F.push(l(ce(Re(r.world), ne ?? r.world)))), p.length > 256)
|
|
587
|
+
throw new w("format", "[Nova3D] FBX skins support at most 256 joints.");
|
|
588
|
+
const E = new Float32Array(p.length * 16);
|
|
589
|
+
F.forEach((oe, pe) => E.set(oe, pe * 16)), Se = Ee.length, Ee.push({ joints: p, inverseBindMatrices: E }), he = J;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const Ne = [], tt = [], nt = [];
|
|
593
|
+
for (const p of m(o, "Deformer", "BlendShape"))
|
|
594
|
+
for (const F of m(p.child, "Deformer", "BlendShapeChannel")) {
|
|
595
|
+
const z = m(F.child, "Geometry", "Shape")[0];
|
|
596
|
+
if (!z)
|
|
597
|
+
continue;
|
|
598
|
+
if (Ne.length === 8) {
|
|
599
|
+
s("skipped", "FBX meshes support at most 8 morph targets; extra shapes were skipped.");
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
const ne = a.get(z.child), J = H(ne, "Indexes"), E = H(ne, "Vertices");
|
|
603
|
+
if (!J || !E || E.length !== J.length * 3)
|
|
604
|
+
throw new w("format", "[Nova3D] FBX shape indices and vertices differ in length.");
|
|
605
|
+
const oe = new Float32Array(ye * 3);
|
|
606
|
+
for (let le = 0; le < J.length; le++) {
|
|
607
|
+
const re = J[le];
|
|
608
|
+
if (!Number.isInteger(re) || re < 0 || re >= ye)
|
|
609
|
+
throw new w("format", "[Nova3D] FBX shape index is out of range.");
|
|
610
|
+
const se = E[le * 3], ie = E[le * 3 + 1], Pe = E[le * 3 + 2];
|
|
611
|
+
oe[re * 3] = g[0] * se + g[4] * ie + g[8] * Pe, oe[re * 3 + 1] = g[1] * se + g[5] * ie + g[9] * Pe, oe[re * 3 + 2] = g[2] * se + g[6] * ie + g[10] * Pe;
|
|
612
|
+
}
|
|
613
|
+
Ne.push(oe), tt.push(F.child);
|
|
614
|
+
const pe = a.get(F.child);
|
|
615
|
+
nt.push(U(be(pe), "DeformPercent", Ae(Q(pe, "DeformPercent")?.props[0], 0)) / 100);
|
|
616
|
+
}
|
|
617
|
+
const Ue = { groups: [], skin: Se, targetCount: Ne.length, channels: tt, weights: nt };
|
|
618
|
+
for (const p of ge.groups) {
|
|
619
|
+
const F = { positions: p.positions, normals: p.normals, uvs: p.uvs, uvs1: p.uvs1, colors: p.colors, indices: p.indices };
|
|
620
|
+
if (he || Ne.length) {
|
|
621
|
+
const z = Ne.map((ne) => ({ positions: $e(p.points, ne, 3, (J) => new Float32Array(J)) }));
|
|
622
|
+
F.deformation = {
|
|
623
|
+
joints: he ? $e(p.points, he.joints, 4, (ne) => new Uint16Array(ne)) : void 0,
|
|
624
|
+
weights: he ? $e(p.points, he.weights, 4, (ne) => new Float32Array(ne)) : void 0,
|
|
625
|
+
targets: z,
|
|
626
|
+
flatNormals: !1
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
Ue.groups.push({ group: p.group, geometry: Te.length }), Te.push(F);
|
|
630
|
+
}
|
|
631
|
+
return We.set(v, Ue), Ue;
|
|
632
|
+
}, Je = /* @__PURE__ */ new Map();
|
|
633
|
+
let He = 0;
|
|
634
|
+
for (const o of x) {
|
|
635
|
+
const r = m(o.id, "Geometry").find((y) => a.get(y.child).props[2] === "Mesh");
|
|
636
|
+
if (!r)
|
|
637
|
+
continue;
|
|
638
|
+
n.signal?.throwIfAborted();
|
|
639
|
+
const c = vt(r.child, o), i = m(o.id, "Material").map((y) => wt(y.child)), u = {
|
|
640
|
+
primitives: c.groups.map(({ group: y, geometry: v }) => (y >= i.length && i.length && s("approximated", "An FBX polygon references a missing material slot; a default material was used."), { geometry: v, material: i[y] ?? gt() })),
|
|
641
|
+
weights: c.weights
|
|
642
|
+
};
|
|
643
|
+
if (He += u.primitives.length, He > n.maxPrimitives)
|
|
644
|
+
throw new w("budget", "[Nova3D] FBX primitive budget exceeded.");
|
|
645
|
+
u.primitives.length && (K[o.index].mesh = Ve.length, K[o.index].skin = c.skin, Ve.push(u), Je.set(o.index, c));
|
|
646
|
+
}
|
|
647
|
+
const Qe = [];
|
|
648
|
+
let Ce = n.maxAnimationKeys;
|
|
649
|
+
for (const [o, r] of a) {
|
|
650
|
+
if (r.name !== "AnimationStack")
|
|
651
|
+
continue;
|
|
652
|
+
const c = m(o, "AnimationLayer");
|
|
653
|
+
if (!c.length)
|
|
654
|
+
continue;
|
|
655
|
+
c.length > 1 && s("unsupported", "Only the first FBX animation layer of each stack is imported.");
|
|
656
|
+
const i = be(r), u = /* @__PURE__ */ new Map();
|
|
657
|
+
for (const T of m(c[0].child, "AnimationCurveNode")) {
|
|
658
|
+
const B = (d.get(T.child) ?? []).find((M) => M.property && a.has(M.parent));
|
|
659
|
+
B && u.set(T.child, { node: a.get(T.child), property: B.property, target: B.parent });
|
|
660
|
+
}
|
|
661
|
+
const y = /* @__PURE__ */ new Map();
|
|
662
|
+
let v = 1 / 0;
|
|
663
|
+
for (const [T] of u) {
|
|
664
|
+
const B = /* @__PURE__ */ new Map();
|
|
665
|
+
for (const M of m(T, "AnimationCurve")) {
|
|
666
|
+
const W = a.get(M.child), k = H(W, "KeyTime"), R = H(W, "KeyValueFloat");
|
|
667
|
+
if (!(!k || !R || !k.length)) {
|
|
668
|
+
if (k.length !== R.length)
|
|
669
|
+
throw new w("format", "[Nova3D] FBX curve key times and values differ in length.");
|
|
670
|
+
B.set(M.property, { times: k, values: R }), v = Math.min(v, k[0]);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
y.set(T, B);
|
|
674
|
+
}
|
|
675
|
+
if (!Number.isFinite(v))
|
|
676
|
+
continue;
|
|
677
|
+
const Z = i.has("LocalStart") ? U(i, "LocalStart", 0) : v, b = Math.min(Z, v) / je, I = 1 / je, g = [];
|
|
678
|
+
let G = i.has("LocalStop") ? Math.max(0, U(i, "LocalStop", 0) / je - b) : 0;
|
|
679
|
+
const X = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map();
|
|
680
|
+
for (const [T, B] of u) {
|
|
681
|
+
const M = y.get(T), W = S.get(B.target), k = qt.indexOf(B.property);
|
|
682
|
+
if (W !== void 0 && k >= 0) {
|
|
683
|
+
const R = X.get(W) ?? Array.from({ length: 9 });
|
|
684
|
+
["d|X", "d|Y", "d|Z"].forEach((ue, V) => {
|
|
685
|
+
const Y = M.get(ue);
|
|
686
|
+
Y && (R[k * 3 + V] = ot(Y.times, Y.values, I, b));
|
|
687
|
+
}), X.set(W, R);
|
|
688
|
+
} else if (B.property === "DeformPercent" && a.get(B.target)?.props[2] === "BlendShapeChannel") {
|
|
689
|
+
const R = M.get("d|DeformPercent") ?? [...M.values()][0];
|
|
690
|
+
R && D.set(B.target, ot(R.times, R.values, I, b));
|
|
691
|
+
} else M.size && s("unsupported", `FBX animation of ${JSON.stringify(B.property)} is not supported.`);
|
|
692
|
+
}
|
|
693
|
+
for (const [T, B] of X) {
|
|
694
|
+
const M = x[T], W = B.filter((N) => N !== void 0);
|
|
695
|
+
if (!W.length)
|
|
696
|
+
continue;
|
|
697
|
+
const k = te(M), R = B.slice(3, 6), ue = () => B.map((N) => N ? st(N) : void 0), V = ue();
|
|
698
|
+
let Y = rt(W.map((N) => N.times), Ce);
|
|
699
|
+
Y = Ct(Y, (N, ge) => {
|
|
700
|
+
let ye = 0;
|
|
701
|
+
return R.forEach((Se, he) => {
|
|
702
|
+
Se && (ye = Math.max(ye, Math.abs(V[3 + he](ge) - V[3 + he](N))));
|
|
703
|
+
}), ye / 30;
|
|
704
|
+
}, Ce), Ce -= Y.length;
|
|
705
|
+
const ve = ue(), q = (N, ge) => ve[N]?.(ge) ?? k[Math.floor(N / 3)][N % 3], xe = (N) => l(ee(M, [q(0, N), q(1, N), q(2, N)], [q(3, N), q(4, N), q(5, N)], [q(6, N), q(7, N), q(8, N)]));
|
|
706
|
+
g.push(...Nt(String(T), Y, xe, K[T].transform, Be)), G = Math.max(G, Y[Y.length - 1]);
|
|
707
|
+
}
|
|
708
|
+
for (const [T, B] of Je) {
|
|
709
|
+
const M = B.channels.map((V) => D.get(V)), W = M.filter((V) => V !== void 0);
|
|
710
|
+
if (!W.length)
|
|
711
|
+
continue;
|
|
712
|
+
const k = rt(W.map((V) => V.times), Ce);
|
|
713
|
+
Ce -= k.length * B.targetCount;
|
|
714
|
+
const R = M.map((V) => V ? st(V) : void 0), ue = new Float64Array(k.length * B.targetCount);
|
|
715
|
+
for (let V = 0; V < k.length; V++)
|
|
716
|
+
for (let Y = 0; Y < B.targetCount; Y++) {
|
|
717
|
+
const ve = R[Y];
|
|
718
|
+
ue[V * B.targetCount + Y] = ve ? ve(k[V]) / 100 : B.weights[Y];
|
|
719
|
+
}
|
|
720
|
+
g.push({ target: String(T), channel: "weights", valueSize: B.targetCount, times: k, values: ue }), G = Math.max(G, k[k.length - 1]);
|
|
721
|
+
}
|
|
722
|
+
if (g.length > 1024)
|
|
723
|
+
throw new w("format", "[Nova3D] FBX animation stack exceeds 1024 tracks.");
|
|
724
|
+
g.length && Qe.push(Vt({ name: Ze(r), duration: G, tracks: g }));
|
|
725
|
+
}
|
|
726
|
+
return { nodes: K, roots: Fe, geometries: Te, meshes: Ve, materials: De, textures: de, skins: Ee, clips: Qe, warnings: t };
|
|
727
|
+
}
|
|
728
|
+
function Jt(e, n) {
|
|
729
|
+
if (typeof e == "string") {
|
|
730
|
+
if (e.length > n)
|
|
731
|
+
throw new w("budget", "[Nova3D] FBX file exceeds its byte limit.");
|
|
732
|
+
return new TextEncoder().encode(e);
|
|
733
|
+
}
|
|
734
|
+
if (!Ot(e))
|
|
735
|
+
throw new w("invalid-option", "[Nova3D] parseFBX accepts bytes or ASCII text.");
|
|
736
|
+
if (e.byteLength > n)
|
|
737
|
+
throw new w("budget", "[Nova3D] FBX file exceeds its byte limit.");
|
|
738
|
+
return Tt(e);
|
|
739
|
+
}
|
|
740
|
+
async function mt(e, n, t) {
|
|
741
|
+
try {
|
|
742
|
+
return await Ht(e, n, t);
|
|
743
|
+
} catch (h) {
|
|
744
|
+
throw Bt(h);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
async function Ht(e, n, t) {
|
|
748
|
+
const h = _e(t, n.limits), s = await Wt(e, {
|
|
749
|
+
maxRecords: h.maxRecords,
|
|
750
|
+
maxArrayBytes: h.maxDecompressedBytes,
|
|
751
|
+
maxDecompressedBytes: h.maxDecompressedBytes,
|
|
752
|
+
maxNodes: h.maxNodes,
|
|
753
|
+
maxVertices: h.maxVertices,
|
|
754
|
+
maxPrimitives: h.maxParts,
|
|
755
|
+
maxAnimationKeys: h.maxAnimationKeys,
|
|
756
|
+
convertUnits: n.convertUnits ?? !0,
|
|
757
|
+
convertAxes: n.convertAxes ?? !0,
|
|
758
|
+
baseUrl: n.baseUrl,
|
|
759
|
+
signal: t.signal
|
|
760
|
+
});
|
|
761
|
+
return t.check(), kt(t, s);
|
|
762
|
+
}
|
|
763
|
+
async function sn(e, n = {}) {
|
|
764
|
+
const t = new dt(pt(n, "FBX", !0));
|
|
765
|
+
try {
|
|
766
|
+
const h = _e(t, n.limits);
|
|
767
|
+
return await mt(Jt(e, h.maxInputBytes), n, t);
|
|
768
|
+
} finally {
|
|
769
|
+
t.dispose();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
async function an(e, n = {}) {
|
|
773
|
+
const t = new dt(pt(n, "FBX", !1));
|
|
774
|
+
try {
|
|
775
|
+
const h = _e(t, n.limits), s = Lt(e).href, f = await t.read(s, "container", void 0, h.maxInputBytes);
|
|
776
|
+
return await mt(f, { ...n, baseUrl: s }, t);
|
|
777
|
+
} finally {
|
|
778
|
+
t.dispose();
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
export {
|
|
782
|
+
an as loadFBX,
|
|
783
|
+
sn as parseFBX
|
|
784
|
+
};
|