@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,557 @@
|
|
|
1
|
+
import { N as pe } from "./DeformedMesh-CPi0P_vc.js";
|
|
2
|
+
import { N as R } from "./Errors-B2ekO9bZ.js";
|
|
3
|
+
import { N as ge } from "./InstancedMesh-DPrgrw5z.js";
|
|
4
|
+
import { d as O, C as Ee, I as C, J as Y, K as $, r as H, o as ie, L as ae, k as Te, M as Q, O as Re, D as Pe, b as Z, f as se, P as ve, g as j } from "./Node-QfgAE2_v.js";
|
|
5
|
+
import { s as Ae, t as be, c as De } from "./vec4-BTNv1fUp.js";
|
|
6
|
+
import { b as ee, f as he, l as ne, d as _e } from "./Shader-b6_HDndT.js";
|
|
7
|
+
const we = `
|
|
8
|
+
precision highp sampler2D;
|
|
9
|
+
precision highp sampler2DArray;
|
|
10
|
+
layout(location=8) in vec4 jointIndices;
|
|
11
|
+
layout(location=9) in vec4 jointWeights;
|
|
12
|
+
uniform bool hasSkin;
|
|
13
|
+
|
|
14
|
+
uniform sampler2D skinMatrices;
|
|
15
|
+
uniform int skinOffset;
|
|
16
|
+
uniform sampler2DArray morphAtlas;
|
|
17
|
+
uniform int morphCount;
|
|
18
|
+
uniform int morphWidth;
|
|
19
|
+
uniform float morphWeights[8];
|
|
20
|
+
mat4 jointMatrix(int joint){int entry=skinOffset+joint;ivec2 at=ivec2((entry&255)<<2,entry>>8);return mat4(texelFetch(skinMatrices,at,0),texelFetch(skinMatrices,at+ivec2(1,0),0),texelFetch(skinMatrices,at+ivec2(2,0),0),texelFetch(skinMatrices,at+ivec2(3,0),0));}
|
|
21
|
+
|
|
22
|
+
#ifdef NOVA_NO_SKIN
|
|
23
|
+
mat4 skinTransform(){return mat4(1.0);}
|
|
24
|
+
#else
|
|
25
|
+
mat4 skinTransform(){if(!hasSkin)return mat4(1.0);return jointMatrix(int(jointIndices.x))*jointWeights.x+jointMatrix(int(jointIndices.y))*jointWeights.y+jointMatrix(int(jointIndices.z))*jointWeights.z+jointMatrix(int(jointIndices.w))*jointWeights.w;}
|
|
26
|
+
#endif
|
|
27
|
+
#ifdef NOVA_NO_MORPH
|
|
28
|
+
vec3 morphDelta(int normalOffset){return vec3(0.0);}
|
|
29
|
+
#else
|
|
30
|
+
vec3 morphDelta(int normalOffset){
|
|
31
|
+
vec3 result=vec3(0.0);if(morphCount==0)return result;
|
|
32
|
+
ivec2 texel=ivec2(gl_VertexID%morphWidth,gl_VertexID/morphWidth);
|
|
33
|
+
for(int target=0;target<8;target++){if(target>=morphCount)break;result+=texelFetch(morphAtlas,ivec3(texel,target*2+normalOffset),0).xyz*morphWeights[target];}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
`;
|
|
38
|
+
function Me(c, t) {
|
|
39
|
+
for (let e = 0; e < 3; e++)
|
|
40
|
+
for (let i = 0; i < 2; i++) {
|
|
41
|
+
const a = i === 0 ? 1 : -1, s = t[e * 2 + i];
|
|
42
|
+
s[0] = c[3] + a * c[e], s[1] = c[7] + a * c[e + 4], s[2] = c[11] + a * c[e + 8], s[3] = c[15] + a * c[e + 12];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
function xe(c, t) {
|
|
47
|
+
for (let e = 0; e < t.length; e++) {
|
|
48
|
+
const i = t[e];
|
|
49
|
+
if (i[0] * (i[0] >= 0 ? c.max[0] : c.min[0]) + i[1] * (i[1] >= 0 ? c.max[1] : c.min[1]) + i[2] * (i[2] >= 0 ? c.max[2] : c.min[2]) + i[3] < 0)
|
|
50
|
+
return !1;
|
|
51
|
+
}
|
|
52
|
+
return !0;
|
|
53
|
+
}
|
|
54
|
+
function Fe() {
|
|
55
|
+
return Array.from({ length: 6 }, () => [0, 0, 0, 0]);
|
|
56
|
+
}
|
|
57
|
+
const Se = `
|
|
58
|
+
layout(location=4) in vec4 instanceColumn0;
|
|
59
|
+
layout(location=5) in vec4 instanceColumn1;
|
|
60
|
+
layout(location=6) in vec4 instanceColumn2;
|
|
61
|
+
layout(location=7) in vec4 instanceColumn3;
|
|
62
|
+
uniform bool instanced;
|
|
63
|
+
flat out float instanceParity;
|
|
64
|
+
#ifdef NOVA_NO_INSTANCE
|
|
65
|
+
mat4 localInstance(){return mat4(1.0);}
|
|
66
|
+
#else
|
|
67
|
+
mat4 localInstance(){return instanced?mat4(instanceColumn0,instanceColumn1,instanceColumn2,instanceColumn3):mat4(1.0);}
|
|
68
|
+
#endif
|
|
69
|
+
`, Ne = `
|
|
70
|
+
flat in float instanceParity;
|
|
71
|
+
uniform int surfaceSide;
|
|
72
|
+
uniform bool instanced;
|
|
73
|
+
uniform bool hasSkin;
|
|
74
|
+
bool logicalFront(){return gl_FrontFacing==(instanceParity>=0.0);}
|
|
75
|
+
void cullInstance(){if(!instanced&&!hasSkin)return;if((surfaceSide==0&&!logicalFront())||(surfaceSide==1&&logicalFront()))discard;}
|
|
76
|
+
`, Ce = Fe(), J = O(), oe = O(), X = O(), q = O(), U = De(), A = j(), M = j(), x = j(), y = j(), D = new Float32Array(24), L = O(), B = O(), F = j(), S = j(), de = `#version 300 es
|
|
77
|
+
${Se}
|
|
78
|
+
${we}
|
|
79
|
+
layout(location=0) in vec3 position;
|
|
80
|
+
layout(location=2) in vec2 uv;
|
|
81
|
+
layout(location=10) in vec2 uv1;
|
|
82
|
+
uniform mat4 world;
|
|
83
|
+
uniform mat4 viewProjection;
|
|
84
|
+
|
|
85
|
+
uniform mat3 mapTransform;
|
|
86
|
+
uniform bool mapSet;
|
|
87
|
+
out vec2 texCoord;
|
|
88
|
+
void main(){
|
|
89
|
+
#if defined(NOVA_NO_INSTANCE)&&defined(NOVA_NO_SKIN)
|
|
90
|
+
instanceParity=1.0;texCoord=(mapTransform*vec3(mapSet?uv1:uv,1.0)).xy;gl_Position=viewProjection*(world*vec4(position+morphDelta(0),1.0));
|
|
91
|
+
#else
|
|
92
|
+
mat4 instance=localInstance()*skinTransform();instanceParity=determinant(mat3(instance))<0.0?-1.0:1.0;texCoord=(mapTransform*vec3(mapSet?uv1:uv,1.0)).xy;gl_Position=viewProjection*(world*(instance*vec4(position+morphDelta(0),1.0)));
|
|
93
|
+
#endif
|
|
94
|
+
}`, le = de.replace(`#version 300 es
|
|
95
|
+
`, `#version 300 es
|
|
96
|
+
#define NOVA_NO_INSTANCE
|
|
97
|
+
#define NOVA_NO_SKIN
|
|
98
|
+
`), Ue = `#version 300 es
|
|
99
|
+
precision highp float;
|
|
100
|
+
${Ne}
|
|
101
|
+
precision highp sampler2D;
|
|
102
|
+
in vec2 texCoord;
|
|
103
|
+
uniform sampler2D map;
|
|
104
|
+
uniform bool hasMap;
|
|
105
|
+
uniform bool masked;
|
|
106
|
+
uniform float alpha;
|
|
107
|
+
uniform float cutoff;
|
|
108
|
+
void main(){cullInstance();if(masked && alpha*(hasMap?texture(map,texCoord).a:1.0)<cutoff)discard;}`, fe = `#version 300 es
|
|
109
|
+
precision highp float;
|
|
110
|
+
void main(){}`, ye = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], Le = [[0, -1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1], [0, -1, 0], [0, -1, 0]], W = [], Oe = (c, t) => t.height - c.height || t.width - c.width;
|
|
111
|
+
class ze {
|
|
112
|
+
constructor(t, e) {
|
|
113
|
+
this._gl = t, this._state = e;
|
|
114
|
+
}
|
|
115
|
+
_residents = /* @__PURE__ */ new Map();
|
|
116
|
+
_atlas = { texture: null, sampler: null, size: 0 };
|
|
117
|
+
_verified = !1;
|
|
118
|
+
/** The atlas is cleared once per frame, by the first scene that renders shadows. */
|
|
119
|
+
_clearPending = !1;
|
|
120
|
+
_program;
|
|
121
|
+
_uniforms;
|
|
122
|
+
_plainProgram;
|
|
123
|
+
_plainUniforms;
|
|
124
|
+
/** The depth-only program, submitted ahead (prepareProgram) and checked at the first pass. */
|
|
125
|
+
_pendingPlain;
|
|
126
|
+
/** Service framebuffer; attachments live only for the duration of a pass. */
|
|
127
|
+
_framebuffer;
|
|
128
|
+
_selected = [];
|
|
129
|
+
/** Per-scene binding lists reused across frames. */
|
|
130
|
+
_bindings = /* @__PURE__ */ new WeakMap();
|
|
131
|
+
_drawCalls = 0;
|
|
132
|
+
get bytes() {
|
|
133
|
+
return this._atlas.size * this._atlas.size * 4;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Keeps tiles for exactly the enabled shadows of `lights` (all scenes of the frame)
|
|
137
|
+
* and repacks the atlas when that set changed, before any scene draws its maps.
|
|
138
|
+
*/
|
|
139
|
+
reserve(t) {
|
|
140
|
+
let e = !1;
|
|
141
|
+
for (const [i, a] of this._residents) {
|
|
142
|
+
const s = i._readShadow();
|
|
143
|
+
(!t.includes(i) || !s.enabled || a.resolution !== s.resolution || a.cascades !== s.cascades) && (this._residents.delete(i), e = !0);
|
|
144
|
+
}
|
|
145
|
+
for (const i of t) {
|
|
146
|
+
const a = i._readShadow();
|
|
147
|
+
if (a.enabled && !this._residents.has(i)) {
|
|
148
|
+
const s = i.kind === "point", o = a.cascades, f = a.resolution, m = s ? 6 : o, r = s ? f * 3 : o > 1 ? f * 2 : f, n = s || o > 2 ? f * 2 : f;
|
|
149
|
+
this._residents.set(i, { light: i, atlas: this._atlas, cube: s, matrices: Array.from({ length: m }, () => O()), resolution: f, cascades: o, width: r, height: n, x: 0, y: 0, splits: new Float32Array(4), frustums: new Float32Array(12), bytes: r * n * 4 }), e = !0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
e && this._pack(), this._residents.size > 0 && this.prepareProgram(), this._clearPending = !0;
|
|
153
|
+
}
|
|
154
|
+
/** Submits the depth-only caster program, so the driver compiles it while the frame uploads. */
|
|
155
|
+
prepareProgram() {
|
|
156
|
+
!this._plainProgram && !this._pendingPlain && (this._pendingPlain = ee(this._gl, le, fe));
|
|
157
|
+
}
|
|
158
|
+
/** True while any light owns a shadow map. */
|
|
159
|
+
get active() {
|
|
160
|
+
return this._residents.size > 0;
|
|
161
|
+
}
|
|
162
|
+
/** True while a light of `scene` owns a shadow map. */
|
|
163
|
+
activeFor(t) {
|
|
164
|
+
for (const e of this._residents.keys())
|
|
165
|
+
if (e.scene === t)
|
|
166
|
+
return !0;
|
|
167
|
+
return !1;
|
|
168
|
+
}
|
|
169
|
+
consumeDrawCalls() {
|
|
170
|
+
const t = this._drawCalls;
|
|
171
|
+
return this._drawCalls = 0, t;
|
|
172
|
+
}
|
|
173
|
+
render(t, e, i, a, s, o) {
|
|
174
|
+
const f = this._selected;
|
|
175
|
+
f.length = 0;
|
|
176
|
+
let m = 0;
|
|
177
|
+
for (const u of e) {
|
|
178
|
+
const l = u._readShadow();
|
|
179
|
+
l.enabled && (f.push(u), m += l.resolution ** 2 * 4 * (u.kind === "point" ? 6 : l.cascades > 2 ? 4 : l.cascades));
|
|
180
|
+
}
|
|
181
|
+
if (f.length > 4 || m > 64 * 1024 * 1024)
|
|
182
|
+
throw new R("invalid-option", "[Nova3D] Shadows exceed four sources or 64 MiB.");
|
|
183
|
+
let r = 0;
|
|
184
|
+
for (const u of f)
|
|
185
|
+
r += u._readShadow().cascades > 1 ? 1 : 0;
|
|
186
|
+
if (r > 1)
|
|
187
|
+
throw new R("invalid-option", "[Nova3D] A scene has at most one light with shadow cascades.");
|
|
188
|
+
const n = this._gl, h = this._state;
|
|
189
|
+
for (const u of this._residents.keys())
|
|
190
|
+
u.scene === t && !f.includes(u) && this.release(u);
|
|
191
|
+
let p = this._bindings.get(t);
|
|
192
|
+
if (p || (p = [], this._bindings.set(t, p)), p.length = 0, !f.length)
|
|
193
|
+
return p;
|
|
194
|
+
if (!this._plainProgram) {
|
|
195
|
+
const u = this._pendingPlain;
|
|
196
|
+
this._pendingPlain = void 0;
|
|
197
|
+
const l = u ? he(n, u) : ne(n, le, fe), T = (V) => n.getUniformLocation(l, V);
|
|
198
|
+
this._plainProgram = l, this._plainUniforms = { viewProjection: T("viewProjection"), instanced: T("instanced"), surfaceSide: null, world: T("world"), masked: null, alpha: null, cutoff: null, map: null, hasMap: null, mapTransform: T("mapTransform"), mapSet: T("mapSet") };
|
|
199
|
+
}
|
|
200
|
+
const _ = this._plainProgram;
|
|
201
|
+
for (const u of f) {
|
|
202
|
+
const l = this._residents.get(u);
|
|
203
|
+
if (!l)
|
|
204
|
+
throw new R("state", "[Nova3D] Shadow tile was not reserved.");
|
|
205
|
+
this._matrices(u, l, o), p.push(l);
|
|
206
|
+
}
|
|
207
|
+
if (!this._framebuffer) {
|
|
208
|
+
const u = n.createFramebuffer();
|
|
209
|
+
if (!u)
|
|
210
|
+
throw new R("gpu", "[Nova3D] Shadow framebuffer allocation failed.");
|
|
211
|
+
this._framebuffer = u, h.bindFramebuffer(u), n.drawBuffers([n.NONE]), n.readBuffer(n.NONE);
|
|
212
|
+
}
|
|
213
|
+
const d = this._framebuffer;
|
|
214
|
+
h.colorMask(!1), h.depthMask(!0), h.capability(n.DEPTH_TEST, !0), h.depthFunc(n.LEQUAL), h.capability(n.BLEND, !1), h.capability(n.SCISSOR_TEST, !1), h.clearDepth(1), h.useProgram(_), h.bindFramebuffer(d);
|
|
215
|
+
try {
|
|
216
|
+
if (n.framebufferTexture2D(n.FRAMEBUFFER, n.DEPTH_ATTACHMENT, n.TEXTURE_2D, this._atlas.texture, 0), !this._verified && n.checkFramebufferStatus(n.FRAMEBUFFER) !== n.FRAMEBUFFER_COMPLETE)
|
|
217
|
+
throw new R("gpu", "[Nova3D] Shadow framebuffer is incomplete.");
|
|
218
|
+
this._verified = !0, this._clearPending && (h.viewport(0, 0, this._atlas.size, this._atlas.size), n.clear(n.DEPTH_BUFFER_BIT), this._clearPending = !1), this._renderFaces(p, i, a, s);
|
|
219
|
+
} finally {
|
|
220
|
+
n.isContextLost() || (h.bindFramebuffer(d), n.framebufferTexture2D(n.FRAMEBUFFER, n.DEPTH_ATTACHMENT, n.TEXTURE_2D, null, 0));
|
|
221
|
+
}
|
|
222
|
+
if (h.colorMask(!0), n.isContextLost())
|
|
223
|
+
throw new R("gpu", "[Nova3D] Shadow pass lost its context.");
|
|
224
|
+
return p;
|
|
225
|
+
}
|
|
226
|
+
_renderFaces(t, e, i, a) {
|
|
227
|
+
const s = this._gl, o = this._state;
|
|
228
|
+
let f = this._program, m = this._uniforms;
|
|
229
|
+
const r = this._plainProgram, n = this._plainUniforms;
|
|
230
|
+
let h = 0, p = -1, _ = -1;
|
|
231
|
+
for (const d of t) {
|
|
232
|
+
const u = d.cube ? 3 : 2;
|
|
233
|
+
for (let l = 0; l < d.matrices.length; l++, h++) {
|
|
234
|
+
const T = d.x + l % u * d.resolution, V = d.y + Math.floor(l / u) * d.resolution, G = d.matrices[l];
|
|
235
|
+
o.viewport(T, V, d.resolution, d.resolution);
|
|
236
|
+
const K = Me(G, Ce);
|
|
237
|
+
for (const E of e) {
|
|
238
|
+
if (!E._readShadow().cast || E.geometry.topology !== "triangles")
|
|
239
|
+
continue;
|
|
240
|
+
const N = E._ownBounds();
|
|
241
|
+
if (N !== null && !xe(N, K))
|
|
242
|
+
continue;
|
|
243
|
+
const P = E.material._readOptions(), I = P.map, g = E._renderMatrix(), w = E instanceof ge, z = E instanceof pe && E._hasSkin(), b = P.alphaMode === "mask";
|
|
244
|
+
P.side === "double" || w || z ? o.capability(s.CULL_FACE, !1) : (o.capability(s.CULL_FACE, !0), o.cullFace(P.side === "front" ? s.BACK : s.FRONT)), o.frontFace(Ee(g) < 0 ? s.CW : s.CCW);
|
|
245
|
+
const k = b || w || z;
|
|
246
|
+
k && !f && (f = this._linkFull(), m = this._uniforms);
|
|
247
|
+
const te = k ? f : r, v = k ? m : n;
|
|
248
|
+
if (o.useProgram(te), (k ? p : _) !== h && (o.uniformMatrix4(v.viewProjection, G), k ? p = h : _ = h), o.uniform1i(v.instanced, w ? 1 : 0), o.uniformMatrix4(v.world, g), k && (o.uniform1i(v.surfaceSide, P.side === "front" ? 0 : P.side === "back" ? 1 : 2), o.uniform1i(v.masked, b ? 1 : 0), o.uniform1f(v.alpha, E.material._readColor()[3] * P.opacity), o.uniform1f(v.cutoff, P.alphaCutoff), o.texture2D(0, I ? i(I) : null), o.uniform1i(v.map, 0), o.uniform1i(v.hasMap, I ? 1 : 0), I && b)) {
|
|
249
|
+
const re = E.material._textureTransforms();
|
|
250
|
+
o.uniformMatrix3(v.mapTransform, re.slots[0]), o.uniform1i(v.mapSet, re.sets & 1);
|
|
251
|
+
}
|
|
252
|
+
a(E, te), this._drawCalls++;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/** Links the discarding caster program (masks, instance and skin culling). */
|
|
258
|
+
_linkFull() {
|
|
259
|
+
const t = this._gl, e = ne(t, de, Ue), i = (a) => t.getUniformLocation(e, a);
|
|
260
|
+
return this._program = e, this._uniforms = { viewProjection: i("viewProjection"), instanced: i("instanced"), surfaceSide: i("surfaceSide"), world: i("world"), masked: i("masked"), alpha: i("alpha"), cutoff: i("cutoff"), map: i("map"), hasMap: i("hasMap"), mapTransform: i("mapTransform"), mapSet: i("mapSet") }, e;
|
|
261
|
+
}
|
|
262
|
+
/** Shelf-packs every tile, tallest first, into the smallest fitting power-of-two atlas. */
|
|
263
|
+
_pack() {
|
|
264
|
+
const t = this._gl;
|
|
265
|
+
W.length = 0;
|
|
266
|
+
let e = 0;
|
|
267
|
+
for (const s of this._residents.values())
|
|
268
|
+
W.push(s), e = Math.max(e, s.width, s.height);
|
|
269
|
+
if (W.length === 0) {
|
|
270
|
+
this._freeAtlas();
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
W.sort(Oe);
|
|
274
|
+
const i = Math.min(4096, t.getParameter(t.MAX_TEXTURE_SIZE));
|
|
275
|
+
let a = 1024;
|
|
276
|
+
for (; a < e; )
|
|
277
|
+
a *= 2;
|
|
278
|
+
for (; a <= i; a *= 2) {
|
|
279
|
+
let s = 0, o = 0, f = 0, m = !0;
|
|
280
|
+
for (const r of W) {
|
|
281
|
+
if (s + r.width > a && (s = 0, o += f, f = 0), o + r.height > a) {
|
|
282
|
+
m = !1;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
r.x = s, r.y = o, s += r.width, f = Math.max(f, r.height);
|
|
286
|
+
}
|
|
287
|
+
if (m)
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
if (W.length = 0, a > i)
|
|
291
|
+
throw this._residents.clear(), this._freeAtlas(), new R("invalid-option", "[Nova3D] Shadows exceed the 4096² (64 MiB) shadow atlas.");
|
|
292
|
+
(a !== this._atlas.size || !this._atlas.texture) && this._allocate(a);
|
|
293
|
+
}
|
|
294
|
+
_allocate(t) {
|
|
295
|
+
const e = this._gl;
|
|
296
|
+
this._freeAtlas();
|
|
297
|
+
const i = e.createTexture(), a = e.createSampler();
|
|
298
|
+
if (!i || !a)
|
|
299
|
+
throw new R("gpu", "[Nova3D] Shadow atlas allocation failed.");
|
|
300
|
+
this._state.invalidate();
|
|
301
|
+
try {
|
|
302
|
+
e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, i), e.texStorage2D(e.TEXTURE_2D, 1, e.DEPTH_COMPONENT24, t, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_COMPARE_MODE, e.COMPARE_REF_TO_TEXTURE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_COMPARE_FUNC, e.LEQUAL), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.bindTexture(e.TEXTURE_2D, null), e.samplerParameteri(a, e.TEXTURE_MIN_FILTER, e.NEAREST), e.samplerParameteri(a, e.TEXTURE_MAG_FILTER, e.NEAREST), e.samplerParameteri(a, e.TEXTURE_COMPARE_MODE, e.NONE), e.samplerParameteri(a, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.samplerParameteri(a, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
|
|
303
|
+
const s = e.getError();
|
|
304
|
+
if (s !== e.NO_ERROR)
|
|
305
|
+
throw new R("gpu", `[Nova3D] Shadow allocation failed (${s}).`);
|
|
306
|
+
} catch (s) {
|
|
307
|
+
throw e.deleteTexture(i), e.deleteSampler(a), s;
|
|
308
|
+
}
|
|
309
|
+
this._atlas.texture = i, this._atlas.sampler = a, this._atlas.size = t, this._verified = !1;
|
|
310
|
+
}
|
|
311
|
+
_freeAtlas() {
|
|
312
|
+
this._atlas.texture && (this._state.invalidate(), this._gl.deleteTexture(this._atlas.texture)), this._atlas.sampler && this._gl.deleteSampler(this._atlas.sampler), this._atlas.texture = null, this._atlas.sampler = null, this._atlas.size = 0, this._verified = !1;
|
|
313
|
+
}
|
|
314
|
+
release(t) {
|
|
315
|
+
this._residents.delete(t) && this._residents.size === 0 && this._freeAtlas();
|
|
316
|
+
}
|
|
317
|
+
reset(t = !1) {
|
|
318
|
+
t || (this._freeAtlas(), this._plainProgram && this._gl.deleteProgram(this._plainProgram), this._program && this._gl.deleteProgram(this._program), this._pendingPlain && _e(this._gl, this._pendingPlain), this._framebuffer && this._gl.deleteFramebuffer(this._framebuffer)), this._residents.clear(), this._atlas.texture = null, this._atlas.sampler = null, this._atlas.size = 0, this._verified = !1, this._bindings = /* @__PURE__ */ new WeakMap(), this._program = void 0, this._uniforms = void 0, this._plainProgram = void 0, this._plainUniforms = void 0, this._pendingPlain = void 0, this._framebuffer = void 0, this._drawCalls = 0;
|
|
319
|
+
}
|
|
320
|
+
/** Writes face, slice or cascade matrices into the resident's reused matrices. */
|
|
321
|
+
_matrices(t, e, i) {
|
|
322
|
+
const a = t._worldState().matrix, s = t._readShadow(), o = t._readLight(), f = e.matrices;
|
|
323
|
+
if (t.kind === "point") {
|
|
324
|
+
C(S, a[12], a[13], a[14]), Y(L, Math.PI / 2, 1, s.near, s.far);
|
|
325
|
+
for (let m = 0; m < 6; m++) {
|
|
326
|
+
const r = ye[m];
|
|
327
|
+
C(F, S[0] + r[0], S[1] + r[1], S[2] + r[2]), $(B, S, F, Le[m]), H(f[m], L, B);
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (C(x, -a[8], -a[9], -a[10]), ie(x, x), ae(x) === 0)
|
|
332
|
+
throw new R("invalid-option", "[Nova3D] Shadow light direction is singular.");
|
|
333
|
+
if (C(y, a[4], a[5], a[6]), ie(y, y), Te(F, x, y), ae(F) < 1e-6)
|
|
334
|
+
throw new R("invalid-option", "[Nova3D] Shadow light orientation is singular.");
|
|
335
|
+
if (e.cascades > 1 && i) {
|
|
336
|
+
this._fitCascades(e, s, i);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
C(S, a[12], a[13], a[14]), t.kind === "directional" ? Q(L, -s.extent, s.extent, -s.extent, s.extent, s.near, s.far) : Y(L, 2 * o.outerConeAngle, 1, s.near, s.far), Re(F, S, x), $(B, S, F, y), H(f[0], L, B);
|
|
340
|
+
for (let m = 1; m < f.length; m++)
|
|
341
|
+
Pe(f[m], f[0]);
|
|
342
|
+
e.splits.fill(Number.POSITIVE_INFINITY);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Splits the camera frustum (practical scheme) and fits each slice in a stable,
|
|
346
|
+
* texel-snapped orthographic box along the light direction (fitDirection/fitUp).
|
|
347
|
+
*/
|
|
348
|
+
_fitCascades(t, e, i) {
|
|
349
|
+
const a = i.camera, s = a.getOptions(), o = s.near, f = Math.min(e.cascadeDistance, s.far), m = t.cascades;
|
|
350
|
+
Z(oe, a._worldState().matrix), C(F, 0, 0, 0), $(q, F, x, y);
|
|
351
|
+
let r = o;
|
|
352
|
+
for (let n = 0; n < m; n++) {
|
|
353
|
+
const h = (n + 1) / m, p = e.cascadeLambda * o * (f / o) ** h + (1 - e.cascadeLambda) * (o + (f - o) * h);
|
|
354
|
+
if (t.splits[n] = p, "fov" in s)
|
|
355
|
+
Y(J, s.fov, i.aspect, r, p);
|
|
356
|
+
else {
|
|
357
|
+
const l = s.verticalSize / 2;
|
|
358
|
+
Q(J, -l * i.aspect, l * i.aspect, -l, l, r, p);
|
|
359
|
+
}
|
|
360
|
+
H(X, J, oe), Z(X, X), C(A, 0, 0, 0);
|
|
361
|
+
for (let l = 0; l < 8; l++) {
|
|
362
|
+
Ae(U, l & 1 ? 1 : -1, l & 2 ? 1 : -1, l & 4 ? 1 : -1, 1), be(U, U, X);
|
|
363
|
+
const T = U[3];
|
|
364
|
+
D[l * 3] = U[0] / T, D[l * 3 + 1] = U[1] / T, D[l * 3 + 2] = U[2] / T, A[0] += D[l * 3] / 8, A[1] += D[l * 3 + 1] / 8, A[2] += D[l * 3 + 2] / 8;
|
|
365
|
+
}
|
|
366
|
+
let _ = 0;
|
|
367
|
+
for (let l = 0; l < 8; l++)
|
|
368
|
+
_ = Math.max(_, Math.hypot(D[l * 3] - A[0], D[l * 3 + 1] - A[1], D[l * 3 + 2] - A[2]));
|
|
369
|
+
_ = Math.ceil(_ * 16) / 16;
|
|
370
|
+
const d = _ * 2 / t.resolution;
|
|
371
|
+
se(M, A, q), M[0] = Math.floor(M[0] / d) * d, M[1] = Math.floor(M[1] / d) * d, Z(X, q), se(A, M, X);
|
|
372
|
+
const u = _ + e.extent;
|
|
373
|
+
ve(M, A, x, -u), $(B, M, A, y), Q(L, -_, _, -_, _, 0, u + _), H(t.matrices[n], L, B), t.frustums[n * 3] = 0, t.frustums[n * 3 + 1] = u + _, t.frustums[n * 3 + 2] = t.resolution / (2 * _), r = p;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function Ge(c, t) {
|
|
378
|
+
return Math.floor(Math.log2(Math.max(c, t, 1))) + 1;
|
|
379
|
+
}
|
|
380
|
+
function ce(c, t) {
|
|
381
|
+
return Math.max(1, c >> t);
|
|
382
|
+
}
|
|
383
|
+
const me = `#version 300 es
|
|
384
|
+
void main(){vec2 p=vec2(float((gl_VertexID<<1)&2),float(gl_VertexID&2));gl_Position=vec4(p*2.0-1.0,0.0,1.0);}`;
|
|
385
|
+
function ue(c) {
|
|
386
|
+
return `#version 300 es
|
|
387
|
+
precision highp float;
|
|
388
|
+
precision highp ${c ? "sampler2DArray" : "sampler2D"};
|
|
389
|
+
uniform ${c ? "sampler2DArray" : "sampler2D"} source;
|
|
390
|
+
uniform vec2 size;
|
|
391
|
+
uniform float layer;
|
|
392
|
+
out vec4 result;
|
|
393
|
+
void main(){result=textureLod(source,${c ? "vec3(gl_FragCoord.xy/size,layer)" : "gl_FragCoord.xy/size"},0.0);}`;
|
|
394
|
+
}
|
|
395
|
+
class $e {
|
|
396
|
+
constructor(t) {
|
|
397
|
+
this._gl = t, this._capabilities = [t.DEPTH_TEST, t.BLEND, t.CULL_FACE, t.SCISSOR_TEST, t.STENCIL_TEST, t.RASTERIZER_DISCARD, t.SAMPLE_ALPHA_TO_COVERAGE, t.SAMPLE_COVERAGE, t.DITHER];
|
|
398
|
+
}
|
|
399
|
+
_programs = [];
|
|
400
|
+
/** Submitted programs, checked at their first pass. */
|
|
401
|
+
_pending = [];
|
|
402
|
+
/** Internal formats (per target) whose level-1 framebuffer was found complete. */
|
|
403
|
+
_complete = /* @__PURE__ */ new Set();
|
|
404
|
+
_framebuffer;
|
|
405
|
+
_sampler;
|
|
406
|
+
/** Capabilities that would clip, discard, blend or dither a level pass. */
|
|
407
|
+
_capabilities;
|
|
408
|
+
/**
|
|
409
|
+
* Submits the level-pass program of `target` before a texture of `internal` uploads, so
|
|
410
|
+
* the driver compiles it meanwhile; generate checks it at its first pass.
|
|
411
|
+
*/
|
|
412
|
+
prepare(t, e) {
|
|
413
|
+
const i = t === this._gl.TEXTURE_2D_ARRAY, a = i ? 1 : 0;
|
|
414
|
+
!this._programs[a] && !this._pending[a] && this.renderable(e) && (this._pending[a] = ee(this._gl, me, ue(i)));
|
|
415
|
+
}
|
|
416
|
+
/** Whether levels of `internal` are renderable; RGBA16F needs a colour-buffer extension. */
|
|
417
|
+
renderable(t) {
|
|
418
|
+
const e = this._gl;
|
|
419
|
+
return t !== e.RGBA16F || !!e.getExtension("EXT_color_buffer_float") || !!e.getExtension("EXT_color_buffer_half_float");
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Rebuilds levels 1…`levels`−1 of an immutable TEXTURE_2D or TEXTURE_2D_ARRAY of
|
|
423
|
+
* `width`×`height` (`layers` array layers) from level 0, falling back to
|
|
424
|
+
* gl.generateMipmap when its format cannot be rendered. `colorMask`, when the caller
|
|
425
|
+
* knows it, spares the synchronous COLOR_WRITEMASK query.
|
|
426
|
+
*/
|
|
427
|
+
generate(t, e, i, a, s, o, f, m) {
|
|
428
|
+
const r = this._gl;
|
|
429
|
+
if (f < 2 || r.isContextLost())
|
|
430
|
+
return;
|
|
431
|
+
const n = e === r.TEXTURE_2D_ARRAY, h = n ? r.TEXTURE_BINDING_2D_ARRAY : r.TEXTURE_BINDING_2D, p = r.getParameter(r.ACTIVE_TEXTURE);
|
|
432
|
+
r.activeTexture(r.TEXTURE0);
|
|
433
|
+
const _ = r.getParameter(h);
|
|
434
|
+
if (!this.renderable(i)) {
|
|
435
|
+
r.bindTexture(e, t), r.generateMipmap(e), r.bindTexture(e, _), r.activeTexture(p);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const d = this._program(n), u = this._ensureSampler(), l = this._ensureFramebuffer(), T = r.getParameter(r.CURRENT_PROGRAM), V = r.getParameter(r.VERTEX_ARRAY_BINDING), G = r.getParameter(r.DRAW_FRAMEBUFFER_BINDING), K = r.getParameter(r.SAMPLER_BINDING), E = r.getParameter(r.VIEWPORT), N = m === void 0 ? r.getParameter(r.COLOR_WRITEMASK) : [m, m, m, m], P = this._capabilities, I = P.map((g) => r.isEnabled(g));
|
|
439
|
+
for (const g of P)
|
|
440
|
+
r.disable(g);
|
|
441
|
+
r.colorMask(!0, !0, !0, !0), r.useProgram(d.program), r.bindVertexArray(null), r.bindFramebuffer(r.DRAW_FRAMEBUFFER, l), r.bindTexture(e, t), r.bindSampler(0, u);
|
|
442
|
+
try {
|
|
443
|
+
for (let g = 1; g < f; g++) {
|
|
444
|
+
const w = ce(a, g), z = ce(s, g);
|
|
445
|
+
r.texParameteri(e, r.TEXTURE_BASE_LEVEL, g - 1), r.texParameteri(e, r.TEXTURE_MAX_LEVEL, g - 1), r.viewport(0, 0, w, z), r.uniform2f(d.size, w, z);
|
|
446
|
+
for (let b = 0; b < o; b++) {
|
|
447
|
+
if (n ? (r.framebufferTextureLayer(r.DRAW_FRAMEBUFFER, r.COLOR_ATTACHMENT0, t, g, b), r.uniform1f(d.layer, b)) : r.framebufferTexture2D(r.DRAW_FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, t, g), g === 1 && b === 0 && !this._complete.has(i * 2 + (n ? 1 : 0))) {
|
|
448
|
+
if (r.checkFramebufferStatus(r.DRAW_FRAMEBUFFER) !== r.FRAMEBUFFER_COMPLETE)
|
|
449
|
+
throw new R("gpu", "[Nova3D] Mipmap framebuffer is incomplete.");
|
|
450
|
+
this._complete.add(i * 2 + (n ? 1 : 0));
|
|
451
|
+
}
|
|
452
|
+
r.drawArrays(r.TRIANGLES, 0, 3);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
} finally {
|
|
456
|
+
r.framebufferTexture2D(r.DRAW_FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, null, 0), r.texParameteri(e, r.TEXTURE_BASE_LEVEL, 0), r.texParameteri(e, r.TEXTURE_MAX_LEVEL, f - 1), r.bindSampler(0, K), r.bindTexture(e, _), r.activeTexture(p), r.bindFramebuffer(r.DRAW_FRAMEBUFFER, G), r.bindVertexArray(V), r.useProgram(T && r.isProgram(T) ? T : null), r.viewport(E[0], E[1], E[2], E[3]), r.colorMask(N[0], N[1], N[2], N[3]), P.forEach((g, w) => {
|
|
457
|
+
I[w] && r.enable(g);
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
_program(t) {
|
|
462
|
+
const e = t ? 1 : 0;
|
|
463
|
+
let i = this._programs[e];
|
|
464
|
+
if (!i) {
|
|
465
|
+
const a = this._gl, s = this._pending[e] ?? ee(a, me, ue(t));
|
|
466
|
+
this._pending[e] = void 0;
|
|
467
|
+
const o = he(a, s), f = a.getParameter(a.CURRENT_PROGRAM);
|
|
468
|
+
a.useProgram(o), a.uniform1i(a.getUniformLocation(o, "source"), 0), a.useProgram(f && a.isProgram(f) ? f : null), i = { program: o, size: a.getUniformLocation(o, "size"), layer: a.getUniformLocation(o, "layer") }, this._programs[e] = i;
|
|
469
|
+
}
|
|
470
|
+
return i;
|
|
471
|
+
}
|
|
472
|
+
/** Bilinear, clamped and single-level: it overrides the texture's own sampling state. */
|
|
473
|
+
_ensureSampler() {
|
|
474
|
+
if (!this._sampler) {
|
|
475
|
+
const t = this._gl, e = t.createSampler();
|
|
476
|
+
if (!e)
|
|
477
|
+
throw new R("gpu", "[Nova3D] Mipmap sampler allocation failed.");
|
|
478
|
+
t.samplerParameteri(e, t.TEXTURE_MIN_FILTER, t.LINEAR), t.samplerParameteri(e, t.TEXTURE_MAG_FILTER, t.LINEAR), t.samplerParameteri(e, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.samplerParameteri(e, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), this._sampler = e;
|
|
479
|
+
}
|
|
480
|
+
return this._sampler;
|
|
481
|
+
}
|
|
482
|
+
_ensureFramebuffer() {
|
|
483
|
+
if (!this._framebuffer) {
|
|
484
|
+
const t = this._gl.createFramebuffer();
|
|
485
|
+
if (!t)
|
|
486
|
+
throw new R("gpu", "[Nova3D] Mipmap framebuffer allocation failed.");
|
|
487
|
+
this._framebuffer = t;
|
|
488
|
+
}
|
|
489
|
+
return this._framebuffer;
|
|
490
|
+
}
|
|
491
|
+
/** Releases the GL objects; `discard` drops handles of a lost context without deleting them. */
|
|
492
|
+
reset(t = !1) {
|
|
493
|
+
const e = this._gl;
|
|
494
|
+
if (!t) {
|
|
495
|
+
for (const i of this._programs)
|
|
496
|
+
i && e.deleteProgram(i.program);
|
|
497
|
+
for (const i of this._pending)
|
|
498
|
+
i && _e(e, i);
|
|
499
|
+
this._framebuffer && e.deleteFramebuffer(this._framebuffer), this._sampler && e.deleteSampler(this._sampler);
|
|
500
|
+
}
|
|
501
|
+
this._programs.length = 0, this._pending.length = 0, this._complete.clear(), this._framebuffer = void 0, this._sampler = void 0;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
const Ie = Object.freeze({
|
|
505
|
+
backend: "webgl2",
|
|
506
|
+
pbr: !0,
|
|
507
|
+
classicMaterials: !0,
|
|
508
|
+
unlitMaterials: !0,
|
|
509
|
+
punctualLights: !0,
|
|
510
|
+
ambientLights: !0,
|
|
511
|
+
shadows: !0,
|
|
512
|
+
softShadows: !0,
|
|
513
|
+
imageBasedLighting: !0,
|
|
514
|
+
fog: !0,
|
|
515
|
+
lightMaps: !0,
|
|
516
|
+
instancing: !0,
|
|
517
|
+
renderTargets: !0,
|
|
518
|
+
multipleViews: !0,
|
|
519
|
+
toneMapping: !0,
|
|
520
|
+
msaa: !0,
|
|
521
|
+
postEffects: !0,
|
|
522
|
+
clusteredLights: !0,
|
|
523
|
+
areaLights: !0,
|
|
524
|
+
reflectionProbes: !0,
|
|
525
|
+
pbrExtensions: !0,
|
|
526
|
+
skinning: !0,
|
|
527
|
+
morphTargets: !0,
|
|
528
|
+
lineMaterials: !0,
|
|
529
|
+
points: !0,
|
|
530
|
+
shaderMaterials: !0,
|
|
531
|
+
gpuPicking: !0,
|
|
532
|
+
xr: !0,
|
|
533
|
+
nodeMaterials: !0,
|
|
534
|
+
splatsAndGpuParticles: !0
|
|
535
|
+
}), He = Object.freeze({
|
|
536
|
+
...Ie,
|
|
537
|
+
backend: "webgpu",
|
|
538
|
+
xr: !1
|
|
539
|
+
});
|
|
540
|
+
function Ke(c, t = !0) {
|
|
541
|
+
return new R("unsupported", `[Nova3D] ${c} ${t ? "are" : "is"} not supported on the WebGPU backend yet.`);
|
|
542
|
+
}
|
|
543
|
+
export {
|
|
544
|
+
ze as S,
|
|
545
|
+
$e as T,
|
|
546
|
+
Fe as a,
|
|
547
|
+
xe as b,
|
|
548
|
+
de as c,
|
|
549
|
+
we as d,
|
|
550
|
+
Se as e,
|
|
551
|
+
He as f,
|
|
552
|
+
Ie as g,
|
|
553
|
+
Ne as i,
|
|
554
|
+
Ge as m,
|
|
555
|
+
Ke as u,
|
|
556
|
+
Me as w
|
|
557
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { N as o, f as b } from "./Errors-B2ekO9bZ.js";
|
|
2
|
+
import { r as y, d as w } from "./Limits-Bw5XQdFr.js";
|
|
3
|
+
import { i as v, b as B } from "./LoaderIO-BwrM84OM.js";
|
|
4
|
+
const x = Object.freeze({ maxJSONBytes: 8 * 1024 * 1024, maxBufferBytes: 256 * 1024 * 1024, ...w, maxImageDimension: 8192, maxNodes: 1e4, maxParts: 1e4, maxVertices: 1e6, maxAccessorBytes: 256 * 1024 * 1024 });
|
|
5
|
+
class L {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this._options = e, this.limits = y(e.limits, x, "glTF"), this.signal = this._controller.signal, this._externalAbort = () => this._controller.abort(e.signal?.reason), e.signal?.addEventListener("abort", this._externalAbort, { once: !0 }), e.signal?.aborted && this._externalAbort();
|
|
8
|
+
}
|
|
9
|
+
limits;
|
|
10
|
+
signal;
|
|
11
|
+
_controller = new AbortController();
|
|
12
|
+
_externalAbort;
|
|
13
|
+
_bufferBytes = 0;
|
|
14
|
+
_imageEncodedBytes = 0;
|
|
15
|
+
_imageDecodedBytes = 0;
|
|
16
|
+
_accessorBytes = 0;
|
|
17
|
+
check() {
|
|
18
|
+
if (this.signal.aborted)
|
|
19
|
+
throw this.signal.reason ?? new DOMException("Load aborted", "AbortError");
|
|
20
|
+
}
|
|
21
|
+
wait(e) {
|
|
22
|
+
return new Promise((s, c) => {
|
|
23
|
+
let i = !1;
|
|
24
|
+
const r = () => {
|
|
25
|
+
i || (i = !0, this.signal.removeEventListener("abort", r), c(this.signal.reason ?? new DOMException("Load aborted", "AbortError")));
|
|
26
|
+
};
|
|
27
|
+
this.signal.addEventListener("abort", r, { once: !0 }), this.signal.aborted && r(), e.then((a) => {
|
|
28
|
+
i || (i = !0, this.signal.removeEventListener("abort", r), s(a));
|
|
29
|
+
}, (a) => {
|
|
30
|
+
i || (i = !0, this.signal.removeEventListener("abort", r), c(a));
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
dispose() {
|
|
35
|
+
this._options.signal?.removeEventListener("abort", this._externalAbort);
|
|
36
|
+
}
|
|
37
|
+
consumeBuffer(e) {
|
|
38
|
+
this._bufferBytes = this._consume(this._bufferBytes, e, this.limits.maxBufferBytes, "buffer");
|
|
39
|
+
}
|
|
40
|
+
consumeImageEncoded(e) {
|
|
41
|
+
this._imageEncodedBytes = this._consume(this._imageEncodedBytes, e, this.limits.maxEncodedImageBytes, "encoded image");
|
|
42
|
+
}
|
|
43
|
+
consumeImage(e) {
|
|
44
|
+
this._imageDecodedBytes = this._consume(this._imageDecodedBytes, e, this.limits.maxDecodedImageBytes, "decoded image");
|
|
45
|
+
}
|
|
46
|
+
consumeAccessor(e) {
|
|
47
|
+
this._accessorBytes = this._consume(this._accessorBytes, e, this.limits.maxAccessorBytes, "accessor");
|
|
48
|
+
}
|
|
49
|
+
async read(e, s, c, i) {
|
|
50
|
+
if (this.check(), typeof e != "string" || e.length === 0)
|
|
51
|
+
throw new o("format", "[Nova3D] Resource URI must be nonempty.");
|
|
52
|
+
const r = Math.min(i ?? Number.MAX_SAFE_INTEGER, s === "container" ? this.limits.maxJSONBytes + this.limits.maxBufferBytes : s === "buffer" ? this.limits.maxBufferBytes : this.limits.maxEncodedImageBytes);
|
|
53
|
+
let a;
|
|
54
|
+
if (this._options.resolveResource) {
|
|
55
|
+
const t = await this.wait(this._options.resolveResource(e, { kind: s, baseUrl: c, signal: this.signal, maxBytes: r }));
|
|
56
|
+
if (this.check(), !v(t))
|
|
57
|
+
throw new o("invalid-option", "[Nova3D] Resolver must return byte data.");
|
|
58
|
+
if (t.byteLength > r)
|
|
59
|
+
throw new o("budget", "[Nova3D] Resolved resource exceeds byte budget.");
|
|
60
|
+
a = new Uint8Array(B(t));
|
|
61
|
+
} else if (e.startsWith("data:")) {
|
|
62
|
+
const t = /^data:[^;,]*;base64,([A-Za-z0-9+/]*={0,2})$/.exec(e);
|
|
63
|
+
if (!t || t[1].length > Math.ceil(r / 3) * 4 || t[1].length % 4 !== 0)
|
|
64
|
+
throw new o("format", "[Nova3D] Invalid or oversized base64 resource.");
|
|
65
|
+
const n = atob(t[1]);
|
|
66
|
+
if (n.length > r)
|
|
67
|
+
throw new o("budget", "[Nova3D] Data resource exceeds byte budget.");
|
|
68
|
+
a = Uint8Array.from(n, (d) => d.charCodeAt(0));
|
|
69
|
+
} else {
|
|
70
|
+
let t;
|
|
71
|
+
try {
|
|
72
|
+
t = c ? new URL(e, c) : new URL(e);
|
|
73
|
+
} catch {
|
|
74
|
+
throw new o("format", "[Nova3D] Relative resources require an explicit baseUrl.");
|
|
75
|
+
}
|
|
76
|
+
if (!["http:", "https:", "blob:"].includes(t.protocol) || t.username || t.password)
|
|
77
|
+
throw new o("unsupported", "[Nova3D] Unsupported resource URL; use an explicit resolver.");
|
|
78
|
+
const n = await b(t, { signal: this.signal });
|
|
79
|
+
if (this.check(), !n.ok)
|
|
80
|
+
throw new o("network", `[Nova3D] Resource request failed (${n.status}).`);
|
|
81
|
+
const d = n.headers.get("content-length");
|
|
82
|
+
if (d !== null && Number(d) > r)
|
|
83
|
+
throw await n.body?.cancel(), new o("budget", "[Nova3D] Resource content-length exceeds byte budget.");
|
|
84
|
+
if (!n.body)
|
|
85
|
+
throw new o("network", "[Nova3D] Bounded resource loading requires a readable response body.");
|
|
86
|
+
const l = n.body.getReader(), u = [];
|
|
87
|
+
let m = 0;
|
|
88
|
+
const g = () => {
|
|
89
|
+
l.cancel(this.signal.reason).catch(() => {
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
this.signal.addEventListener("abort", g, { once: !0 });
|
|
93
|
+
try {
|
|
94
|
+
for (; ; ) {
|
|
95
|
+
const h = await l.read();
|
|
96
|
+
if (this.check(), h.done)
|
|
97
|
+
break;
|
|
98
|
+
if (m += h.value.byteLength, m > r)
|
|
99
|
+
throw new o("budget", "[Nova3D] Resource stream exceeds byte budget.");
|
|
100
|
+
u.push(h.value);
|
|
101
|
+
}
|
|
102
|
+
} catch (h) {
|
|
103
|
+
throw await l.cancel().catch(() => {
|
|
104
|
+
}), h;
|
|
105
|
+
} finally {
|
|
106
|
+
this.signal.removeEventListener("abort", g), await l.cancel().catch(() => {
|
|
107
|
+
}), l.releaseLock();
|
|
108
|
+
}
|
|
109
|
+
a = new Uint8Array(m);
|
|
110
|
+
let f = 0;
|
|
111
|
+
for (const h of u)
|
|
112
|
+
a.set(h, f), f += h.byteLength;
|
|
113
|
+
}
|
|
114
|
+
return this.check(), s === "buffer" ? this.consumeBuffer(a.byteLength) : s === "image" && (this._imageEncodedBytes = this._consume(this._imageEncodedBytes, a.byteLength, this.limits.maxEncodedImageBytes, "encoded image")), a;
|
|
115
|
+
}
|
|
116
|
+
_consume(e, s, c, i) {
|
|
117
|
+
if (!Number.isSafeInteger(s) || s < 0 || e + s > c)
|
|
118
|
+
throw new o("budget", `[Nova3D] glTF ${i} budget exceeded.`);
|
|
119
|
+
return e + s;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
L as G
|
|
124
|
+
};
|