@nova-lab/core 1.0.0-dev.19 → 1.1.0-dev.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1035 -10
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/dist/2d/accessibility.d.ts +2 -0
- package/dist/2d/accessibility.js +171 -0
- package/dist/2d/commands.d.ts +2 -0
- package/dist/2d/commands.js +80 -0
- package/dist/2d/effects.d.ts +10 -0
- package/dist/2d/effects.js +566 -0
- package/dist/2d/ktx2.d.ts +5 -0
- package/dist/2d/ktx2.js +542 -0
- package/dist/2d/lighting.d.ts +3 -0
- package/dist/2d/lighting.js +495 -0
- package/dist/2d/lottie.d.ts +3 -0
- package/dist/2d/lottie.js +254 -0
- package/dist/2d/meshes.d.ts +4 -0
- package/dist/2d/meshes.js +451 -0
- package/dist/2d/primitives.d.ts +3 -0
- package/dist/2d/primitives.js +85 -0
- package/dist/2d/render-textures.d.ts +3 -0
- package/dist/2d/render-textures.js +539 -0
- package/dist/2d/svg/documents.d.ts +5 -0
- package/dist/2d/svg/documents.js +7 -0
- package/dist/2d/svg/renderer.d.ts +3 -0
- package/dist/2d/svg/renderer.js +222 -0
- package/dist/2d/svg.d.ts +3 -0
- package/dist/2d/svg.js +4 -0
- package/dist/2d/tools.d.ts +2 -0
- package/dist/2d/tools.js +100 -0
- package/dist/2d/video.d.ts +5 -0
- package/dist/2d/video.js +90 -0
- package/dist/2d.d.ts +2 -0
- package/dist/2d.js +220 -0
- package/dist/3d/animation.d.ts +8 -0
- package/dist/3d/animation.js +1396 -0
- package/dist/3d/area-lights.d.ts +2 -0
- package/dist/3d/area-lights.js +19 -0
- package/dist/3d/audio.d.ts +4 -0
- package/dist/3d/audio.js +500 -0
- package/dist/3d/character.d.ts +2 -0
- package/dist/3d/character.js +136 -0
- package/dist/3d/collision.d.ts +3 -0
- package/dist/3d/collision.js +387 -0
- package/dist/3d/commands.d.ts +2 -0
- package/dist/3d/commands.js +108 -0
- package/dist/3d/controls.d.ts +8 -0
- package/dist/3d/controls.js +1041 -0
- package/dist/3d/documents.d.ts +5 -0
- package/dist/3d/documents.js +227 -0
- package/dist/3d/effects.d.ts +5 -0
- package/dist/3d/effects.js +1986 -0
- package/dist/3d/export.d.ts +4 -0
- package/dist/3d/export.js +347 -0
- package/dist/3d/fbx.d.ts +2 -0
- package/dist/3d/fbx.js +784 -0
- package/dist/3d/gltf.d.ts +2 -0
- package/dist/3d/gltf.js +5 -0
- package/dist/3d/helpers.d.ts +5 -0
- package/dist/3d/helpers.js +191 -0
- package/dist/3d/ik.d.ts +9 -0
- package/dist/3d/ik.js +777 -0
- package/dist/3d/loaders.d.ts +17 -0
- package/dist/3d/loaders.js +1406 -0
- package/dist/3d/nodes.d.ts +8 -0
- package/dist/3d/nodes.js +49 -0
- package/dist/3d/particles.d.ts +5 -0
- package/dist/3d/particles.js +1574 -0
- package/dist/3d/physics/backend.d.ts +7 -0
- package/dist/3d/physics/backend.js +1 -0
- package/dist/3d/physics/rapier.d.ts +3 -0
- package/dist/3d/physics/rapier.js +765 -0
- package/dist/3d/physics.d.ts +5 -0
- package/dist/3d/physics.js +3346 -0
- package/dist/3d/splats.d.ts +7 -0
- package/dist/3d/splats.js +862 -0
- package/dist/3d/text.d.ts +5 -0
- package/dist/3d/text.js +1043 -0
- package/dist/3d/tiles.d.ts +24 -0
- package/dist/3d/tiles.js +1705 -0
- package/dist/3d/tools.d.ts +12 -0
- package/dist/3d/tools.js +338 -0
- package/dist/3d/usdz.d.ts +2 -0
- package/dist/3d/usdz.js +634 -0
- package/dist/3d/xr.d.ts +2 -0
- package/dist/3d/xr.js +202 -0
- package/dist/3d-B4jWF8Qb.js +5591 -0
- package/dist/3d.d.ts +40 -0
- package/dist/3d.js +44 -0
- package/dist/Capsule-BFVpZfvc.js +44 -0
- package/dist/Clip-CAN7t03k.js +204 -0
- package/dist/Color-vuv9UnoY.js +34 -0
- package/dist/DeformedMesh-CPi0P_vc.js +280 -0
- package/dist/Document-DCVEZSvM.js +415 -0
- package/dist/Errors-B2ekO9bZ.js +30 -0
- package/dist/Features-BsjmePtc.js +557 -0
- package/dist/GLTFResourceIO-CYJyCUTt.js +124 -0
- package/dist/GPUParticleState-CQlNpoDa.js +545 -0
- package/dist/Geometry-DytO490z.js +227 -0
- package/dist/Inflate-DWw0V-Up.js +42 -0
- package/dist/InstancedMesh-DPrgrw5z.js +527 -0
- package/dist/Limits-Bw5XQdFr.js +20 -0
- package/dist/LineHelper-Ad0z9uDi.js +131 -0
- package/dist/LoaderIO-BwrM84OM.js +114 -0
- package/dist/Material-BpfLPmK9.js +777 -0
- package/dist/Mesh-BaRxAAJq.js +209 -0
- package/dist/Node-QfgAE2_v.js +877 -0
- package/dist/NovaAssetRegistry-p2QlCwvT.js +1168 -0
- package/dist/NovaNode-CBZ-Ol-W.js +2016 -0
- package/dist/NovaRenderCommandWriter-CWQRa42y.js +1949 -0
- package/dist/NovaTextSelectionService-CipuujCT.js +18526 -0
- package/dist/NovaWebGLProgram-BO250QNF.js +97 -0
- package/dist/Options-CajE7LLJ.js +15 -0
- package/dist/PolygonMesh-D4PnnfIo.js +657 -0
- package/dist/Ready-BzyhRtjD.js +21 -0
- package/dist/Scene-CDfNgf9I.js +911 -0
- package/dist/Shader-b6_HDndT.js +48 -0
- package/dist/SplatShader-wJ6GJ3vo.js +130 -0
- package/dist/Texture-dTKMlTpK.js +267 -0
- package/dist/TextureLoader-CfDzdy2m.js +411 -0
- package/dist/Textures-CGL4Kf-8.js +651 -0
- package/dist/ToneMapping-D9IWvN0u.js +46 -0
- package/dist/WebGPURenderer-DjD0IxVC.js +4921 -0
- package/dist/ZipReader-C-MSEsSr.js +84 -0
- package/dist/core.js +218 -24024
- package/dist/domain/types/base.types.d.ts +18 -9
- package/dist/domain/types/component.types.d.ts +5 -5
- package/dist/domain/types/cursor.types.d.ts +1 -1
- package/dist/domain/types/diagnostics.types.d.ts +2 -0
- package/dist/domain/types/export.types.d.ts +2 -2
- package/dist/domain/types/hit-test.types.d.ts +1 -1
- package/dist/domain/types/motion.types.d.ts +2 -2
- package/dist/domain/types/renderer.types.d.ts +88 -4
- package/dist/domain/types/rendering/index.d.ts +29 -4
- package/dist/domain/types/sound.types.d.ts +1 -1
- package/dist/domain/types/theme.types.d.ts +1 -1
- package/dist/domain/utils/bounds.d.ts +1 -1
- package/dist/domain/utils/nova-text.d.ts +9 -0
- package/dist/domain/utils/schemaBounds.d.ts +2 -2
- package/dist/export-svg-document-ChaNXMaG.js +668 -0
- package/dist/features/3d/Errors.d.ts +57 -0
- package/dist/features/3d/Nova3DApp.d.ts +429 -0
- package/dist/features/3d/animation/Animator.d.ts +260 -0
- package/dist/features/3d/animation/Clip.d.ts +74 -0
- package/dist/features/3d/animation/Graph.d.ts +158 -0
- package/dist/features/3d/animation/Mask.d.ts +40 -0
- package/dist/features/3d/audio/Audio.d.ts +114 -0
- package/dist/features/3d/audio/Sound.d.ts +133 -0
- package/dist/features/3d/character/CharacterController.d.ts +61 -0
- package/dist/features/3d/collision/Capsule.d.ts +25 -0
- package/dist/features/3d/collision/Octree.d.ts +94 -0
- package/dist/features/3d/controls/CameraMotionControls.d.ts +154 -0
- package/dist/features/3d/controls/CameraOrientation.d.ts +47 -0
- package/dist/features/3d/controls/OrbitControls.d.ts +73 -0
- package/dist/features/3d/controls/PointerGesture.d.ts +25 -0
- package/dist/features/3d/controls/PointerLock.d.ts +36 -0
- package/dist/features/3d/controls/Snapping.d.ts +32 -0
- package/dist/features/3d/controls/TransformGizmo.d.ts +79 -0
- package/dist/features/3d/deformation/DeformationGPU.d.ts +52 -0
- package/dist/features/3d/deformation/DeformationShader.d.ts +2 -0
- package/dist/features/3d/deformation/DeformedMesh.d.ts +36 -0
- package/dist/features/3d/deformation/GeometryDeformation.d.ts +25 -0
- package/dist/features/3d/documents/Document.d.ts +59 -0
- package/dist/features/3d/documents/DocumentCommands.d.ts +45 -0
- package/dist/features/3d/documents/DocumentSchema.d.ts +18 -0
- package/dist/features/3d/documents/DocumentTransform.d.ts +4 -0
- package/dist/features/3d/documents/DocumentTypes.d.ts +182 -0
- package/dist/features/3d/documents/DocumentValidation.d.ts +18 -0
- package/dist/features/3d/documents/Projection.d.ts +65 -0
- package/dist/features/3d/effects/CubeLUT.d.ts +24 -0
- package/dist/features/3d/effects/Effects.d.ts +32 -0
- package/dist/features/3d/effects/EffectsGPU.d.ts +80 -0
- package/dist/features/3d/effects/EffectsPlan.d.ts +268 -0
- package/dist/features/3d/effects/EffectsShaders.d.ts +35 -0
- package/dist/features/3d/export/GLTFExporter.d.ts +49 -0
- package/dist/features/3d/export/ThreeMFExporter.d.ts +19 -0
- package/dist/features/3d/export/ZipWriter.d.ts +9 -0
- package/dist/features/3d/fbx/FBXLoader.d.ts +26 -0
- package/dist/features/3d/fbx/FBXParser.d.ts +35 -0
- package/dist/features/3d/fbx/FBXScene.d.ts +20 -0
- package/dist/features/3d/gltf/GLTFLoader.d.ts +16 -0
- package/dist/features/3d/gltf/GLTFTypes.d.ts +64 -0
- package/dist/features/3d/gltf/services/GLTFBinary.d.ts +21 -0
- package/dist/features/3d/gltf/services/GLTFGeometry.d.ts +14 -0
- package/dist/features/3d/gltf/services/GLTFResourceIO.d.ts +64 -0
- package/dist/features/3d/helpers/LineHelper.d.ts +51 -0
- package/dist/features/3d/helpers/StaticHelpers.d.ts +47 -0
- package/dist/features/3d/helpers/TrackedHelpers.d.ts +84 -0
- package/dist/features/3d/ik/ChainIK.d.ts +44 -0
- package/dist/features/3d/ik/IKChain.d.ts +92 -0
- package/dist/features/3d/ik/IKMath.d.ts +49 -0
- package/dist/features/3d/ik/IKSolver.d.ts +97 -0
- package/dist/features/3d/ik/LookAtIK.d.ts +58 -0
- package/dist/features/3d/ik/TwoBoneIK.d.ts +57 -0
- package/dist/features/3d/import/ImportAnimation.d.ts +20 -0
- package/dist/features/3d/import/ImportMath.d.ts +42 -0
- package/dist/features/3d/import/ImportedModel.d.ts +135 -0
- package/dist/features/3d/import/Inflate.d.ts +5 -0
- package/dist/features/3d/import/ModelAsset.d.ts +149 -0
- package/dist/features/3d/import/PolygonMesh.d.ts +54 -0
- package/dist/features/3d/lights/AreaLightTables.d.ts +8 -0
- package/dist/features/3d/lights/AreaLights.d.ts +11 -0
- package/dist/features/3d/loaders/EXRCompression.d.ts +13 -0
- package/dist/features/3d/loaders/EXRLoader.d.ts +39 -0
- package/dist/features/3d/loaders/HDRLoader.d.ts +26 -0
- package/dist/features/3d/loaders/Limits.d.ts +70 -0
- package/dist/features/3d/loaders/LoaderBuffers.d.ts +42 -0
- package/dist/features/3d/loaders/LoaderIO.d.ts +81 -0
- package/dist/features/3d/loaders/LoaderModel.d.ts +80 -0
- package/dist/features/3d/loaders/LoaderText.d.ts +27 -0
- package/dist/features/3d/loaders/MTLLoader.d.ts +105 -0
- package/dist/features/3d/loaders/OBJLoader.d.ts +70 -0
- package/dist/features/3d/loaders/PLYLoader.d.ts +47 -0
- package/dist/features/3d/loaders/STLLoader.d.ts +27 -0
- package/dist/features/3d/model/Camera.d.ts +33 -0
- package/dist/features/3d/model/Environment.d.ts +31 -0
- package/dist/features/3d/model/Geometry.d.ts +59 -0
- package/dist/features/3d/model/InstancedMesh.d.ts +134 -0
- package/dist/features/3d/model/LOD.d.ts +31 -0
- package/dist/features/3d/model/Light.d.ts +200 -0
- package/dist/features/3d/model/Material.d.ts +308 -0
- package/dist/features/3d/model/MaterialExtensions.d.ts +200 -0
- package/dist/features/3d/model/Mesh.d.ts +92 -0
- package/dist/features/3d/model/Node.d.ts +87 -0
- package/dist/features/3d/model/ReflectionProbe.d.ts +45 -0
- package/dist/features/3d/model/RenderTarget.d.ts +41 -0
- package/dist/features/3d/model/Scene.d.ts +173 -0
- package/dist/features/3d/model/Texture.d.ts +143 -0
- package/dist/features/3d/nodes/Nodes.d.ts +8 -0
- package/dist/features/3d/nodes/ShaderNode.d.ts +240 -0
- package/dist/features/3d/particles/GPUParticleSchedule.d.ts +67 -0
- package/dist/features/3d/particles/GPUParticleShaders.d.ts +19 -0
- package/dist/features/3d/particles/GPUParticleState.d.ts +106 -0
- package/dist/features/3d/particles/GPUParticleSystem.d.ts +192 -0
- package/dist/features/3d/particles/ParticleCurves.d.ts +34 -0
- package/dist/features/3d/particles/ParticleOptions.d.ts +78 -0
- package/dist/features/3d/particles/ParticleSystem.d.ts +368 -0
- package/dist/features/3d/physics/PhysicsBackend.d.ts +352 -0
- package/dist/features/3d/physics/PhysicsDebug.d.ts +24 -0
- package/dist/features/3d/physics/PhysicsWorld.d.ts +352 -0
- package/dist/features/3d/physics/basic/BasicCollision.d.ts +75 -0
- package/dist/features/3d/physics/basic/BasicPhysics.d.ts +24 -0
- package/dist/features/3d/physics/basic/BasicShapes.d.ts +103 -0
- package/dist/features/3d/physics/rapier/ContactBuffer.d.ts +32 -0
- package/dist/features/3d/physics/rapier/RapierBackend.d.ts +17 -0
- package/dist/features/3d/physics/rapier/RapierShapes.d.ts +4 -0
- package/dist/features/3d/physics/rapier/RapierWorld.d.ts +198 -0
- package/dist/features/3d/physics/rapier/Validation.d.ts +8 -0
- package/dist/features/3d/services/Background.d.ts +22 -0
- package/dist/features/3d/services/BasicShader.d.ts +55 -0
- package/dist/features/3d/services/ClusteredLights.d.ts +69 -0
- package/dist/features/3d/services/DrawOrder.d.ts +37 -0
- package/dist/features/3d/services/EffectsProcessor.d.ts +38 -0
- package/dist/features/3d/services/EnvironmentBRDF.d.ts +35 -0
- package/dist/features/3d/services/EnvironmentMaps.d.ts +55 -0
- package/dist/features/3d/services/FogShader.d.ts +6 -0
- package/dist/features/3d/services/Frustum.d.ts +7 -0
- package/dist/features/3d/services/GLState.d.ts +86 -0
- package/dist/features/3d/services/GPUPicker.d.ts +31 -0
- package/dist/features/3d/services/InstanceShader.d.ts +3 -0
- package/dist/features/3d/services/LineProgram.d.ts +32 -0
- package/dist/features/3d/services/PBRProgram.d.ts +115 -0
- package/dist/features/3d/services/Renderer.d.ts +50 -0
- package/dist/features/3d/services/Shader.d.ts +22 -0
- package/dist/features/3d/services/ShaderProgram.d.ts +38 -0
- package/dist/features/3d/services/ShadowMaps.d.ts +97 -0
- package/dist/features/3d/services/SpatialIndex.d.ts +16 -0
- package/dist/features/3d/services/TextureLoader.d.ts +40 -0
- package/dist/features/3d/services/TextureMipmaps.d.ts +42 -0
- package/dist/features/3d/services/ToneMapping.d.ts +12 -0
- package/dist/features/3d/services/WebGLRenderer.d.ts +261 -0
- package/dist/features/3d/splats/SplatData.d.ts +136 -0
- package/dist/features/3d/splats/SplatLoaders.d.ts +64 -0
- package/dist/features/3d/splats/SplatShader.d.ts +14 -0
- package/dist/features/3d/splats/SplatSort.d.ts +69 -0
- package/dist/features/3d/splats/Splats.d.ts +116 -0
- package/dist/features/3d/text/FontAtlas.d.ts +246 -0
- package/dist/features/3d/text/SDF.d.ts +28 -0
- package/dist/features/3d/text/Text.d.ts +179 -0
- package/dist/features/3d/text/TextLayout.d.ts +73 -0
- package/dist/features/3d/text/TextShader.d.ts +12 -0
- package/dist/features/3d/tiles/BoundingVolume.d.ts +43 -0
- package/dist/features/3d/tiles/Geodesy.d.ts +106 -0
- package/dist/features/3d/tiles/GlobeControls.d.ts +147 -0
- package/dist/features/3d/tiles/TileContent.d.ts +35 -0
- package/dist/features/3d/tiles/TileFormats.d.ts +77 -0
- package/dist/features/3d/tiles/Tiles3D.d.ts +236 -0
- package/dist/features/3d/tiles/Tileset.d.ts +81 -0
- package/dist/features/3d/tools/BatchedMesh.d.ts +74 -0
- package/dist/features/3d/tools/CanvasSurface.d.ts +81 -0
- package/dist/features/3d/tools/Color.d.ts +11 -0
- package/dist/features/3d/tools/MergeGeometries.d.ts +22 -0
- package/dist/features/3d/tools/Options.d.ts +15 -0
- package/dist/features/3d/tools/Polyhedra.d.ts +30 -0
- package/dist/features/3d/tools/PrimitiveBuffers.d.ts +42 -0
- package/dist/features/3d/tools/Primitives.d.ts +164 -0
- package/dist/features/3d/tools/Ready.d.ts +12 -0
- package/dist/features/3d/tools/SpatialMath.d.ts +57 -0
- package/dist/features/3d/tools/SphericalHarmonics.d.ts +9 -0
- package/dist/features/3d/tools/math/mat3.d.ts +7 -0
- package/dist/features/3d/tools/math/mat4.d.ts +19 -0
- package/dist/features/3d/tools/math/quat.d.ts +6 -0
- package/dist/features/3d/tools/math/vec3.d.ts +16 -0
- package/dist/features/3d/tools/math/vec4.d.ts +5 -0
- package/dist/features/3d/types.d.ts +359 -0
- package/dist/features/3d/usdz/USDAParser.d.ts +50 -0
- package/dist/features/3d/usdz/USDScene.d.ts +20 -0
- package/dist/features/3d/usdz/USDZLoader.d.ts +27 -0
- package/dist/features/3d/usdz/ZipReader.d.ts +16 -0
- package/dist/features/3d/webgpu/Backend.d.ts +40 -0
- package/dist/features/3d/webgpu/BasicShader.d.ts +10 -0
- package/dist/features/3d/webgpu/Constants.d.ts +32 -0
- package/dist/features/3d/webgpu/Deformation.d.ts +71 -0
- package/dist/features/3d/webgpu/Environment.d.ts +66 -0
- package/dist/features/3d/webgpu/Features.d.ts +68 -0
- package/dist/features/3d/webgpu/Layouts.d.ts +27 -0
- package/dist/features/3d/webgpu/Lines.d.ts +40 -0
- package/dist/features/3d/webgpu/LitExtras.d.ts +46 -0
- package/dist/features/3d/webgpu/LitFeatures.d.ts +41 -0
- package/dist/features/3d/webgpu/LitScene.d.ts +60 -0
- package/dist/features/3d/webgpu/LitShader.d.ts +68 -0
- package/dist/features/3d/webgpu/Particles.d.ts +114 -0
- package/dist/features/3d/webgpu/Picking.d.ts +59 -0
- package/dist/features/3d/webgpu/PipelineKey.d.ts +33 -0
- package/dist/features/3d/webgpu/Points.d.ts +41 -0
- package/dist/features/3d/webgpu/Probes.d.ts +45 -0
- package/dist/features/3d/webgpu/ShaderChunks.d.ts +18 -0
- package/dist/features/3d/webgpu/ShaderMaterial.d.ts +57 -0
- package/dist/features/3d/webgpu/ShaderMaterialSource.d.ts +5 -0
- package/dist/features/3d/webgpu/Shadows.d.ts +49 -0
- package/dist/features/3d/webgpu/Splats.d.ts +47 -0
- package/dist/features/3d/webgpu/Textures.d.ts +52 -0
- package/dist/features/3d/webgpu/Transmission.d.ts +30 -0
- package/dist/features/3d/webgpu/UniformLayout.d.ts +30 -0
- package/dist/features/3d/webgpu/UtilityShaders.d.ts +38 -0
- package/dist/features/3d/webgpu/WebGPURenderer.d.ts +327 -0
- package/dist/features/3d/webgpu/effects/EffectsShaders.d.ts +74 -0
- package/dist/features/3d/webgpu/effects/WebGPUEffects.d.ts +140 -0
- package/dist/features/3d/xr/XR.d.ts +100 -0
- package/dist/gltf-By-n0qEg.js +960 -0
- package/dist/index.d.ts +86 -81
- package/dist/model/document-actions/document-commands.d.ts +18 -0
- package/dist/model/documents/svg/create-svg-document-renderer.d.ts +32 -0
- package/dist/model/documents/svg/export-svg-document.d.ts +5 -0
- package/dist/model/documents/svg/import-svg-document.d.ts +6 -0
- package/dist/model/documents/svg/svg-document.types.d.ts +111 -0
- package/dist/model/documents/svg/svg-values.d.ts +16 -0
- package/dist/model/documents/svg/svg-xml.d.ts +18 -0
- package/dist/model/input/NovaInputProxy_Adapter.d.ts +2 -1
- package/dist/model/input/NovaInputValidationController.d.ts +1 -1
- package/dist/model/input/NovaTextInputController.d.ts +1 -1
- package/dist/model/input/NovaTextLayoutEngine.d.ts +2 -6
- package/dist/model/input/index.d.ts +7 -7
- package/dist/model/input/nova-input.types.d.ts +1 -1
- package/dist/model/lighting/LightingRenderer2D.d.ts +58 -0
- package/dist/model/lighting/NovaLighting2D.d.ts +56 -0
- package/dist/model/lighting/lighting-shaders.d.ts +3 -0
- package/dist/model/lighting/lighting-state.d.ts +27 -0
- package/dist/model/lighting/lighting.types.d.ts +107 -0
- package/dist/model/lottie/LottieNode.d.ts +4 -0
- package/dist/model/lottie/lottie.types.d.ts +83 -0
- package/dist/model/lottie/prepare-lottie.d.ts +3 -0
- package/dist/model/lottie/sample-position.d.ts +9 -0
- package/dist/model/motion/NovaMotionEngine.d.ts +3 -3
- package/dist/model/motion/nova-motion-easing.d.ts +1 -1
- package/dist/model/motion/nova-motion-interpolation.d.ts +1 -1
- package/dist/model/motion/nova-motion-presets.d.ts +2 -2
- package/dist/model/motion/nova-motion-timeline.d.ts +1 -1
- package/dist/model/platform/NovaCanvas.d.ts +7 -6
- package/dist/model/primitives/NovaPrimitiveUnsupportedError.d.ts +13 -0
- package/dist/model/primitives/definePrimitive.d.ts +5 -0
- package/dist/model/primitives/primitive.types.d.ts +28 -0
- package/dist/model/render/backends/canvas2d/NovaCanvas2DTargetManager.d.ts +3 -3
- package/dist/model/render/backends/canvas2d/NovaRenderer2D.d.ts +61 -15
- package/dist/model/render/backends/canvas2d/nova-canvas-blend.d.ts +5 -0
- package/dist/model/render/backends/nova-render-backend-factory.d.ts +6 -6
- package/dist/model/render/backends/nova-render-backend.d.ts +8 -2
- package/dist/model/render/backends/webgl/NovaRendererWebGL.d.ts +32 -11
- package/dist/model/render/backends/webgl/NovaStreamCacheIdleLedger.d.ts +12 -1
- package/dist/model/render/backends/webgl/NovaWebGLBatcher.d.ts +1 -1
- package/dist/model/render/backends/webgl/NovaWebGLCircleImagePass.d.ts +23 -0
- package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +9 -0
- package/dist/model/render/backends/webgl/NovaWebGLDevice.d.ts +3 -1
- package/dist/model/render/backends/webgl/NovaWebGLDiagnostics.d.ts +1 -1
- package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +162 -53
- package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +13 -0
- package/dist/model/render/backends/webgl/NovaWebGLPathUnion.d.ts +23 -0
- package/dist/model/render/compiler/NovaRenderBuilder.d.ts +24 -10
- package/dist/model/render/compiler/NovaRenderCommandWriter.d.ts +10 -5
- package/dist/model/render/compiler/NovaRenderCompiler.d.ts +7 -6
- package/dist/model/render/compiler/NovaRenderFrameBuilder.d.ts +4 -3
- package/dist/model/render/effects/blur.d.ts +8 -0
- package/dist/model/render/effects/color-matrix.d.ts +8 -0
- package/dist/model/render/effects/drop-shadow.d.ts +18 -0
- package/dist/model/render/effects/nova-effect-registry.d.ts +66 -0
- package/dist/model/render/effects/nova-gaussian-kernel.d.ts +7 -0
- package/dist/model/render/effects/nova-gaussian-textures.d.ts +11 -0
- package/dist/model/render/effects/shader-effect.d.ts +64 -0
- package/dist/model/render/geometry/nova-alpha-mask.d.ts +5 -0
- package/dist/model/render/geometry/nova-composition.d.ts +9 -0
- package/dist/model/render/geometry/nova-node-clip.d.ts +17 -0
- package/dist/model/render/geometry/nova-path-geometry.d.ts +24 -0
- package/dist/model/render/geometry/nova-path-tessellation.d.ts +7 -0
- package/dist/model/render/geometry/nova-polygon-triangulation.d.ts +1 -1
- package/dist/model/render/graph/NovaRectBatchBuffer.d.ts +58 -0
- package/dist/model/render/graph/NovaRenderGraph.d.ts +40 -6
- package/dist/model/render/graph/NovaRenderHitIndex.d.ts +1 -1
- package/dist/model/render/graph/nova-auto-rect.d.ts +1 -1
- package/dist/model/render/graph/nova-linear-rect-repack.d.ts +4 -4
- package/dist/model/render/graph/nova-linear-rect-transition.d.ts +2 -2
- package/dist/model/render/graph/nova-render-culling.d.ts +2 -2
- package/dist/model/render/graph/nova-render-dirty-items.d.ts +1 -1
- package/dist/model/render/graph/nova-render-group.d.ts +1 -1
- package/dist/model/render/graph/nova-render-item.d.ts +2 -2
- package/dist/model/render/graph/nova-render-layer.d.ts +1 -1
- package/dist/model/render/graph/nova-render-payload-snapshot.d.ts +3 -1
- package/dist/model/render/graph/nova-render-program.d.ts +5 -3
- package/dist/model/render/graph/nova-render-sequence.d.ts +1 -1
- package/dist/model/render/graph/nova-render-stream.d.ts +2 -2
- package/dist/model/render/ktx2/BasisSession.d.ts +45 -0
- package/dist/model/render/ktx2/KTX2Container.d.ts +26 -0
- package/dist/model/render/ktx2/KTX2Loader.d.ts +55 -0
- package/dist/model/render/meshes/MeshNode.d.ts +13 -0
- package/dist/model/render/meshes/NovaMeshWebGLDevice.d.ts +27 -0
- package/dist/model/render/meshes/geometry.d.ts +7 -0
- package/dist/model/render/meshes/mesh.d.ts +3 -0
- package/dist/model/render/meshes/mesh.types.d.ts +116 -0
- package/dist/model/render/meshes/nova-mesh-registry.d.ts +55 -0
- package/dist/model/render/orchestration/NovaRenderOrchestrator.d.ts +25 -3
- package/dist/model/render/policy/nova-render-policy.d.ts +1 -1
- package/dist/model/render/resources/NovaGlyphAtlasManager.d.ts +2 -2
- package/dist/model/render/resources/NovaTextAtlasManager.d.ts +3 -3
- package/dist/model/render/resources/NovaTextLayoutEngine.d.ts +1 -1
- package/dist/model/render/resources/nova-bitmap-upload.d.ts +10 -0
- package/dist/model/render/schema/NovaRenderContext.d.ts +6 -4
- package/dist/model/render/schema/nova-style-compiler.d.ts +5 -2
- package/dist/model/render/targets/NovaNodeRenderTextureSource.d.ts +29 -0
- package/dist/model/render/targets/NovaRenderTargetManager.d.ts +1 -1
- package/dist/model/render/targets/NovaRenderTexture.d.ts +57 -0
- package/dist/model/render/targets/nova-render-target-refs.d.ts +5 -0
- package/dist/model/render/targets/nova-render-target-resource.d.ts +1 -1
- package/dist/model/render/targets/nova-render-texture-runtime.d.ts +71 -0
- package/dist/model/render/textures/nova-compressed-image.d.ts +20 -0
- package/dist/model/render/utils/nova-icon-rendering.d.ts +3 -1
- package/dist/model/render/utils/nova-image-geometry.d.ts +11 -0
- package/dist/model/render/utils/nova-markdown-layout.d.ts +19 -0
- package/dist/model/render/utils/nova-text-paint.d.ts +26 -0
- package/dist/model/render/utils/nova-wrapped-text-layout.d.ts +19 -0
- package/dist/model/runtime/app/Nova.d.ts +35 -35
- package/dist/model/runtime/app/NovaApp.d.ts +58 -30
- package/dist/model/runtime/app/NovaRaphRuntime.d.ts +2 -2
- package/dist/model/runtime/app/createNovaRaphRuntime.d.ts +3 -3
- package/dist/model/runtime/assets/NovaAssetRegistry.d.ts +89 -2
- package/dist/model/runtime/assets/NovaVideoTexture.d.ts +38 -0
- package/dist/model/runtime/assets/nova-render-texture-image-identity.d.ts +4 -0
- package/dist/model/runtime/commands/NovaCommandBus.d.ts +1 -1
- package/dist/model/runtime/components/NovaComponentNode.d.ts +6 -6
- package/dist/model/runtime/components/NovaComponentRegistry.d.ts +1 -1
- package/dist/model/runtime/components/NovaSchemaRegistry.d.ts +7 -6
- package/dist/model/runtime/components/nova-component-metadata.d.ts +1 -1
- package/dist/model/runtime/components/nova-component.decorator.d.ts +2 -2
- package/dist/model/runtime/components/nova-defined-component.d.ts +3 -3
- package/dist/model/runtime/context/nova-context.d.ts +1 -1
- package/dist/model/runtime/cursor/NovaCursorManager.d.ts +3 -3
- package/dist/model/runtime/diagnostics/NovaDiagnostics_Module.d.ts +3 -3
- package/dist/model/runtime/interaction/NovaEvents.d.ts +16 -6
- package/dist/model/runtime/interaction/NovaHitIndex.d.ts +1 -1
- package/dist/model/runtime/interaction/NovaSpatialIndex.d.ts +2 -2
- package/dist/model/runtime/scene/NovaScene.d.ts +3 -3
- package/dist/model/runtime/scene/nova-scene-components.d.ts +6 -6
- package/dist/model/runtime/state/nova-store-decorators.d.ts +1 -1
- package/dist/model/runtime/state/nova-store-runtime.d.ts +1 -1
- package/dist/model/runtime/state/nova-store-tracking.d.ts +7 -3
- package/dist/model/runtime/sync/NovaSyncScope.d.ts +11 -2
- package/dist/model/runtime/sync/nova-sync-context.d.ts +2 -2
- package/dist/model/runtime/sync/nova-sync-ports.d.ts +2 -2
- package/dist/model/runtime/sync/nova-sync.types.d.ts +15 -3
- package/dist/model/runtime/template/NovaTemplateRuntime.d.ts +6 -6
- package/dist/model/runtime/tree/NovaContainer.d.ts +4 -4
- package/dist/model/runtime/tree/NovaNode.d.ts +58 -18
- package/dist/model/runtime/tree/NovaRaphNode.d.ts +8 -2
- package/dist/model/runtime/tree/NovaSurface.d.ts +32 -10
- package/dist/model/runtime/tree/nova-node-capture-invalidation.d.ts +11 -0
- package/dist/model/semantic/NovaSemanticService.d.ts +1 -1
- package/dist/model/semantic/browser/createAccessibilityBridge.d.ts +29 -0
- package/dist/model/sound/NovaSoundEngine.d.ts +3 -2
- package/dist/model/text-selection/NovaTextSelectionService.d.ts +2 -2
- package/dist/model/text-selection/index.d.ts +2 -2
- package/dist/model/text-selection/nova-text-selection.types.d.ts +1 -1
- package/dist/model/theme/NovaGlobalThemeRegistry.d.ts +2 -2
- package/dist/model/theme/NovaThemeService.d.ts +5 -3
- package/dist/model/theme/createTokenTheme.d.ts +15 -0
- package/dist/model/tools/transform-tools.d.ts +43 -0
- package/dist/nodes--Ds4IS2h.js +621 -0
- package/dist/nova-color-parser-BCN_rFRN.js +250 -0
- package/dist/nova-compressed-image-CE2Ya9Xa.js +46 -0
- package/dist/nova-mesh-registry-B7Xz5mhU.js +24 -0
- package/dist/nova-render-texture-image-identity-DQ09XFKs.js +15 -0
- package/dist/nova-text-paint-CcntsRjI.js +48 -0
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.js +50 -0
- package/dist/vec4-BTNv1fUp.js +20 -0
- package/package.json +223 -4
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
import { N as g } from "./Errors-B2ekO9bZ.js";
|
|
2
|
+
import { u as E, m as C } from "./Features-BsjmePtc.js";
|
|
3
|
+
const Y = Object.freeze({ MAP_READ: 1, MAP_WRITE: 2, COPY_SRC: 4, COPY_DST: 8, INDEX: 16, VERTEX: 32, UNIFORM: 64, STORAGE: 128 }), m = Object.freeze({ COPY_SRC: 1, COPY_DST: 2, TEXTURE_BINDING: 4, STORAGE_BINDING: 8, RENDER_ATTACHMENT: 16 }), X = Object.freeze({ VERTEX: 1, FRAGMENT: 2, COMPUTE: 4 }), H = Object.freeze({ READ: 1, WRITE: 2 }), K = 256, I = {
|
|
4
|
+
f32: { align: 4, size: 4 },
|
|
5
|
+
i32: { align: 4, size: 4 },
|
|
6
|
+
u32: { align: 4, size: 4 },
|
|
7
|
+
vec2f: { align: 8, size: 8 },
|
|
8
|
+
// vec3 occupies 12 bytes in a 16-byte aligned slot; a following scalar fills the gap.
|
|
9
|
+
vec3f: { align: 16, size: 12 },
|
|
10
|
+
vec4f: { align: 16, size: 16 },
|
|
11
|
+
// Matrix columns are vec3/vec4 with 16-byte stride.
|
|
12
|
+
mat3x3f: { align: 16, size: 48 },
|
|
13
|
+
mat4x4f: { align: 16, size: 64 }
|
|
14
|
+
};
|
|
15
|
+
function b(i, e) {
|
|
16
|
+
return Math.ceil(i / e) * e;
|
|
17
|
+
}
|
|
18
|
+
function p(i, e) {
|
|
19
|
+
const t = {}, r = {}, o = [];
|
|
20
|
+
let n = 0;
|
|
21
|
+
for (const [a, f, s] of e) {
|
|
22
|
+
if (a in t)
|
|
23
|
+
throw new g("state", `[Nova3D] Duplicate uniform field ${a}.`);
|
|
24
|
+
const l = I[f];
|
|
25
|
+
if (!l)
|
|
26
|
+
throw new g("invalid-option", `[Nova3D] Unsupported uniform type ${f}.`);
|
|
27
|
+
if (s !== void 0) {
|
|
28
|
+
if (!Number.isInteger(s) || s < 1)
|
|
29
|
+
throw new g("invalid-option", `[Nova3D] Uniform array ${a} needs a positive length.`);
|
|
30
|
+
const u = b(l.size, l.align);
|
|
31
|
+
if (u % 16 !== 0)
|
|
32
|
+
throw new g("invalid-option", `[Nova3D] Uniform array ${a} of ${f} has a ${u}-byte stride; the uniform address space requires multiples of 16.`);
|
|
33
|
+
n = b(n, Math.max(16, l.align)), t[a] = n, r[a] = u, n += u * s, o.push(` ${a}: array<${f}, ${s}>,`);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
n = b(n, l.align), t[a] = n, n += l.size, o.push(` ${a}: ${f},`);
|
|
37
|
+
}
|
|
38
|
+
const c = Math.max(16, b(n, 16));
|
|
39
|
+
return Object.freeze({ name: i, size: c, offsets: Object.freeze(t), strides: Object.freeze(r), wgsl: `struct ${i} {
|
|
40
|
+
${o.join(`
|
|
41
|
+
`)}
|
|
42
|
+
}` });
|
|
43
|
+
}
|
|
44
|
+
function x(i) {
|
|
45
|
+
const e = {};
|
|
46
|
+
for (const [t, r] of Object.entries(i.offsets))
|
|
47
|
+
e[t] = r / 4;
|
|
48
|
+
return Object.freeze(e);
|
|
49
|
+
}
|
|
50
|
+
function Q(i, e, t) {
|
|
51
|
+
i[e] = t[0], i[e + 1] = t[1], i[e + 2] = t[2], i[e + 4] = t[3], i[e + 5] = t[4], i[e + 6] = t[5], i[e + 8] = t[6], i[e + 9] = t[7], i[e + 10] = t[8];
|
|
52
|
+
}
|
|
53
|
+
function J(i, e, t) {
|
|
54
|
+
for (let r = 0; r < 16; r++)
|
|
55
|
+
i[e + r] = t[r];
|
|
56
|
+
}
|
|
57
|
+
const y = 16, d = 4, S = p("View", [
|
|
58
|
+
["viewProjection", "mat4x4f"],
|
|
59
|
+
["inverseViewProjection", "mat4x4f"],
|
|
60
|
+
["viewMatrix", "mat4x4f"],
|
|
61
|
+
["cameraPosition", "vec3f"],
|
|
62
|
+
["exposure", "f32"],
|
|
63
|
+
["fogEye", "vec3f"],
|
|
64
|
+
["toneMapping", "f32"],
|
|
65
|
+
["fogForward", "vec3f"],
|
|
66
|
+
// 1 encodes sRGB with tone mapping in the shader; 0 writes linear premultiplied colour.
|
|
67
|
+
["direct", "f32"],
|
|
68
|
+
["fogColor", "vec3f"],
|
|
69
|
+
// −1 flips clip y so render targets keep the WebGL row order.
|
|
70
|
+
["flipY", "f32"],
|
|
71
|
+
["fogParameters", "vec2f"],
|
|
72
|
+
// gl_FragCoord.y = fragOffset + fragScale · position.y.
|
|
73
|
+
["fragOffset", "f32"],
|
|
74
|
+
["fragScale", "f32"],
|
|
75
|
+
["environmentRotation", "vec2f"],
|
|
76
|
+
["environmentIntensity", "f32"],
|
|
77
|
+
["derivativeSign", "f32"],
|
|
78
|
+
["backgroundRotation", "vec2f"],
|
|
79
|
+
["backgroundIntensity", "f32"],
|
|
80
|
+
["backgroundLevel", "f32"],
|
|
81
|
+
// Points and wide lines: view size in device pixels, point attenuation scale (0 orthographic), pixel ratio.
|
|
82
|
+
["viewport", "vec4f"],
|
|
83
|
+
// Projection without the view, for wide lines.
|
|
84
|
+
["projection", "mat4x4f"],
|
|
85
|
+
["ambientConstant", "vec3f"],
|
|
86
|
+
["shadowTexel", "f32"],
|
|
87
|
+
["clearColor", "vec4f"],
|
|
88
|
+
["ambientLinear", "mat3x3f"],
|
|
89
|
+
["ambientQuadratic", "vec4f", 5],
|
|
90
|
+
["lightPositions", "vec4f", y],
|
|
91
|
+
["lightDirections", "vec4f", y],
|
|
92
|
+
["lightColors", "vec4f", y],
|
|
93
|
+
// x: cos inner, y: cos outer, z: shadow slot or −1.
|
|
94
|
+
["lightCones", "vec4f", y],
|
|
95
|
+
["shadowMatrices", "mat4x4f", d],
|
|
96
|
+
["shadowParameters", "vec4f", d],
|
|
97
|
+
["shadowPlanes", "vec4f", d],
|
|
98
|
+
["shadowTiles", "vec4f", d],
|
|
99
|
+
["shadowFilter", "vec4f", d],
|
|
100
|
+
["cascadeMatrices", "mat4x4f", 4],
|
|
101
|
+
["cascadeFrustums", "vec4f", 4],
|
|
102
|
+
["cascadeSplits", "vec4f"],
|
|
103
|
+
// x: cascade count, w: atlas size in texels.
|
|
104
|
+
["cascadeLayout", "vec4f"]
|
|
105
|
+
]), P = p("ObjectData", [
|
|
106
|
+
["world", "mat4x4f"],
|
|
107
|
+
["normalMatrix", "mat3x3f"],
|
|
108
|
+
// x: instanced, y: receives shadows.
|
|
109
|
+
["flags", "vec4f"]
|
|
110
|
+
]), A = p("LitMaterial", [
|
|
111
|
+
["baseColor", "vec4f"],
|
|
112
|
+
["emissive", "vec3f"],
|
|
113
|
+
["metallic", "f32"],
|
|
114
|
+
["specularColor", "vec3f"],
|
|
115
|
+
["roughness", "f32"],
|
|
116
|
+
["normalScale", "f32"],
|
|
117
|
+
["occlusionStrength", "f32"],
|
|
118
|
+
["cutoff", "f32"],
|
|
119
|
+
// 0 opaque, 1 mask, 2 blend.
|
|
120
|
+
["alphaMode", "f32"],
|
|
121
|
+
// 0 front, 1 back, 2 double.
|
|
122
|
+
["surfaceSide", "f32"],
|
|
123
|
+
["shininess", "f32"],
|
|
124
|
+
["lightMapIntensity", "f32"],
|
|
125
|
+
["mapTransforms", "mat3x3f", 6]
|
|
126
|
+
]), N = p("BasicMaterial", [
|
|
127
|
+
["color", "vec4f"],
|
|
128
|
+
["mapTransform", "mat3x3f"],
|
|
129
|
+
// Columns, rows, frame and 1 when the map is upright (flipY).
|
|
130
|
+
["spriteSheet", "vec4f"],
|
|
131
|
+
["billboardRotation", "vec2f"],
|
|
132
|
+
["cutoff", "f32"],
|
|
133
|
+
// Point primitives: size in CSS pixels and 1 with size attenuation.
|
|
134
|
+
["pointSize", "f32"],
|
|
135
|
+
["sizeAttenuation", "f32"]
|
|
136
|
+
]), T = p("Caster", [
|
|
137
|
+
["mapTransform", "mat3x3f"],
|
|
138
|
+
["alpha", "f32"],
|
|
139
|
+
["cutoff", "f32"],
|
|
140
|
+
["masked", "f32"],
|
|
141
|
+
["surfaceSide", "f32"]
|
|
142
|
+
]), F = p("ShadowView", [
|
|
143
|
+
["viewProjection", "mat4x4f"]
|
|
144
|
+
]), V = p("Display", [
|
|
145
|
+
["exposure", "f32"],
|
|
146
|
+
["toneMapping", "f32"]
|
|
147
|
+
]), D = p("Prefilter", [
|
|
148
|
+
["face", "f32"],
|
|
149
|
+
["mode", "f32"],
|
|
150
|
+
["roughness", "f32"],
|
|
151
|
+
// Face side in texels.
|
|
152
|
+
["size", "f32"]
|
|
153
|
+
]), Z = x(S), ee = x(P), te = x(A), ie = x(N), re = x(T), z = `
|
|
154
|
+
fn novaRRTAndODTFit(v: vec3f) -> vec3f {
|
|
155
|
+
let a = v * (v + 0.0245786) - 0.000090537;
|
|
156
|
+
let b = v * (0.983729 * v + 0.4329510) + 0.238081;
|
|
157
|
+
return a / b;
|
|
158
|
+
}
|
|
159
|
+
fn novaAgXContrast(x: vec3f) -> vec3f {
|
|
160
|
+
let x2 = x * x;
|
|
161
|
+
let x4 = x2 * x2;
|
|
162
|
+
return 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232;
|
|
163
|
+
}
|
|
164
|
+
fn novaToneMap(input: vec3f, exposure: f32, mode: i32) -> vec3f {
|
|
165
|
+
var color = max(input, vec3f(0.0)) * exposure;
|
|
166
|
+
if (mode == 1) {
|
|
167
|
+
color = color / (vec3f(1.0) + color);
|
|
168
|
+
}
|
|
169
|
+
else if (mode == 2) {
|
|
170
|
+
color = max(vec3f(0.0), color - 0.004);
|
|
171
|
+
color = pow((color * (6.2 * color + 0.5)) / (color * (6.2 * color + 1.7) + 0.06), vec3f(2.2));
|
|
172
|
+
}
|
|
173
|
+
else if (mode == 3) {
|
|
174
|
+
let inputMat = mat3x3f(vec3f(0.59719, 0.07600, 0.02840), vec3f(0.35458, 0.90834, 0.13383), vec3f(0.04823, 0.01566, 0.83777));
|
|
175
|
+
let outputMat = mat3x3f(vec3f(1.60475, -0.10208, -0.00327), vec3f(-0.53108, 1.10813, -0.07276), vec3f(-0.07367, -0.00605, 1.07602));
|
|
176
|
+
color = outputMat * novaRRTAndODTFit(inputMat * (color / 0.6));
|
|
177
|
+
}
|
|
178
|
+
else if (mode == 4) {
|
|
179
|
+
let toRec2020 = mat3x3f(vec3f(0.6274, 0.0691, 0.0164), vec3f(0.3293, 0.9195, 0.0880), vec3f(0.0433, 0.0113, 0.8956));
|
|
180
|
+
let fromRec2020 = mat3x3f(vec3f(1.6605, -0.1246, -0.0182), vec3f(-0.5876, 1.1329, -0.1006), vec3f(-0.0728, -0.0083, 1.1187));
|
|
181
|
+
let inset = mat3x3f(vec3f(0.856627153315983, 0.137318972929847, 0.11189821299995), vec3f(0.0951212405381588, 0.761241990602591, 0.0767994186031903), vec3f(0.0482516061458583, 0.101439036467562, 0.811302368396859));
|
|
182
|
+
let outset = mat3x3f(vec3f(1.1271005818144368, -0.1413297634984383, -0.14132976349843826), vec3f(-0.11060664309660323, 1.157823702216272, -0.11060664309660294), vec3f(-0.016493938717834573, -0.016493938717834257, 1.2519364065950405));
|
|
183
|
+
color = inset * (toRec2020 * color);
|
|
184
|
+
color = clamp((log2(max(color, vec3f(1e-10))) + 12.47393) / (4.026069 + 12.47393), vec3f(0.0), vec3f(1.0));
|
|
185
|
+
color = outset * novaAgXContrast(color);
|
|
186
|
+
color = fromRec2020 * pow(max(vec3f(0.0), color), vec3f(2.2));
|
|
187
|
+
}
|
|
188
|
+
else if (mode == 5) {
|
|
189
|
+
let x = min(color.r, min(color.g, color.b));
|
|
190
|
+
color = color - select(0.04, x - 6.25 * x * x, x < 0.08);
|
|
191
|
+
let peak = max(color.r, max(color.g, color.b));
|
|
192
|
+
if (peak >= 0.76) {
|
|
193
|
+
let d = 0.24;
|
|
194
|
+
let newPeak = 1.0 - d * d / (peak + d - 0.76);
|
|
195
|
+
color = color * (newPeak / peak);
|
|
196
|
+
color = mix(color, vec3f(newPeak), 1.0 - 1.0 / (0.15 * (peak - newPeak) + 1.0));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return clamp(color, vec3f(0.0), vec3f(1.0));
|
|
200
|
+
}
|
|
201
|
+
fn novaEncodeSRGB(linear: vec3f) -> vec3f {
|
|
202
|
+
return mix(12.92 * linear, 1.055 * pow(linear, vec3f(1.0 / 2.4)) - 0.055, step(vec3f(0.0031308), linear));
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
function oe(i) {
|
|
206
|
+
return `
|
|
207
|
+
fn novaFog(color: vec3f, depth: f32) -> vec3f {
|
|
208
|
+
let d = max(depth, 0.0);
|
|
209
|
+
${i === 1 ? "let f = clamp((d - view.fogParameters.x) / (view.fogParameters.y - view.fogParameters.x), 0.0, 1.0);" : i === 2 ? "let f = 1.0 - exp(-view.fogParameters.x * d);" : `let k = view.fogParameters.x * d;
|
|
210
|
+
let f = 1.0 - exp(-k * k);`}
|
|
211
|
+
return mix(color, view.fogColor, f);
|
|
212
|
+
}
|
|
213
|
+
`;
|
|
214
|
+
}
|
|
215
|
+
const ne = `
|
|
216
|
+
fn novaClip(world: vec4f) -> vec4f {
|
|
217
|
+
var clip = view.viewProjection * world;
|
|
218
|
+
clip.y = clip.y * view.flipY;
|
|
219
|
+
clip.z = 0.5 * (clip.z + clip.w);
|
|
220
|
+
return clip;
|
|
221
|
+
}
|
|
222
|
+
`, L = `
|
|
223
|
+
@group(0) @binding(0) var<uniform> view: View;
|
|
224
|
+
@group(0) @binding(1) var shadowAtlas: texture_depth_2d;
|
|
225
|
+
@group(0) @binding(2) var shadowSampler: sampler_comparison;
|
|
226
|
+
@group(0) @binding(3) var diffuseEnvironment: texture_cube<f32>;
|
|
227
|
+
@group(0) @binding(4) var specularEnvironment: texture_cube<f32>;
|
|
228
|
+
@group(0) @binding(5) var environmentSampler: sampler;
|
|
229
|
+
`, h = `
|
|
230
|
+
fn novaFullscreen(index: u32) -> vec2f {
|
|
231
|
+
return vec2f(f32((index << 1u) & 2u), f32(index & 2u)) * 2.0 - 1.0;
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
function ae(i, e) {
|
|
235
|
+
return `${F.wgsl}
|
|
236
|
+
${T.wgsl}
|
|
237
|
+
${P.wgsl}
|
|
238
|
+
@group(0) @binding(0) var<uniform> shadowView: ShadowView;
|
|
239
|
+
@group(1) @binding(0) var<uniform> caster: Caster;
|
|
240
|
+
${e ? `@group(1) @binding(1) var map: texture_2d<f32>;
|
|
241
|
+
@group(1) @binding(2) var mapSampler: sampler;` : ""}
|
|
242
|
+
@group(2) @binding(0) var<uniform> object: ObjectData;
|
|
243
|
+
struct VertexInput {
|
|
244
|
+
@location(0) position: vec3f,
|
|
245
|
+
${e === 1 ? " @location(2) uv: vec2f," : e === 2 ? " @location(8) uv: vec2f," : ""}
|
|
246
|
+
${i ? ` @location(4) instance0: vec4f,
|
|
247
|
+
@location(5) instance1: vec4f,
|
|
248
|
+
@location(6) instance2: vec4f,
|
|
249
|
+
@location(7) instance3: vec4f,` : ""}
|
|
250
|
+
}
|
|
251
|
+
struct Varyings {
|
|
252
|
+
@builtin(position) position: vec4f,
|
|
253
|
+
@location(0) @interpolate(flat) parity: f32,
|
|
254
|
+
${e ? " @location(1) texCoord: vec2f," : ""}
|
|
255
|
+
}
|
|
256
|
+
@vertex
|
|
257
|
+
fn vertexMain(input: VertexInput) -> Varyings {
|
|
258
|
+
var out: Varyings;
|
|
259
|
+
${i ? ` let instance = mat4x4f(input.instance0, input.instance1, input.instance2, input.instance3);
|
|
260
|
+
out.parity = select(1.0, -1.0, determinant(mat3x3f(instance[0].xyz, instance[1].xyz, instance[2].xyz)) < 0.0);
|
|
261
|
+
var clip = shadowView.viewProjection * object.world * instance * vec4f(input.position, 1.0);` : ` out.parity = 1.0;
|
|
262
|
+
var clip = shadowView.viewProjection * object.world * vec4f(input.position, 1.0);`}
|
|
263
|
+
${e ? " out.texCoord = (caster.mapTransform * vec3f(input.uv, 1.0)).xy;" : ""}
|
|
264
|
+
clip.y = -clip.y;
|
|
265
|
+
clip.z = 0.5 * (clip.z + clip.w);
|
|
266
|
+
out.position = clip;
|
|
267
|
+
return out;
|
|
268
|
+
}
|
|
269
|
+
@fragment
|
|
270
|
+
fn fragmentMain(in: Varyings, @builtin(front_facing) frontFacing: bool) {
|
|
271
|
+
${e ? " let texel = textureSample(map, mapSampler, in.texCoord).a;" : " let texel = 1.0;"}
|
|
272
|
+
${i ? ` let front = frontFacing == (in.parity >= 0.0);
|
|
273
|
+
if ((caster.surfaceSide < 0.5 && !front) || (caster.surfaceSide > 0.5 && caster.surfaceSide < 1.5 && front)) {
|
|
274
|
+
discard;
|
|
275
|
+
}` : ""}
|
|
276
|
+
if (caster.masked > 0.5 && caster.alpha * texel < caster.cutoff) {
|
|
277
|
+
discard;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
function se(i) {
|
|
283
|
+
return `diagnostic(off, derivative_uniformity);
|
|
284
|
+
const PI = 3.141592653589793;
|
|
285
|
+
${S.wgsl}
|
|
286
|
+
${L}
|
|
287
|
+
@group(1) @binding(0) var source: texture_2d<f32>;
|
|
288
|
+
@group(1) @binding(1) var sourceSampler: sampler;
|
|
289
|
+
@group(1) @binding(2) var backgroundCube: texture_cube<f32>;
|
|
290
|
+
${h}
|
|
291
|
+
${z}
|
|
292
|
+
struct Varyings {
|
|
293
|
+
@builtin(position) position: vec4f,
|
|
294
|
+
@location(0) farPoint: vec4f,
|
|
295
|
+
@location(1) nearPoint: vec4f,
|
|
296
|
+
@location(2) screen: vec2f,
|
|
297
|
+
}
|
|
298
|
+
@vertex
|
|
299
|
+
fn vertexMain(@builtin(vertex_index) index: u32) -> Varyings {
|
|
300
|
+
var out: Varyings;
|
|
301
|
+
let p = novaFullscreen(index);
|
|
302
|
+
out.screen = p;
|
|
303
|
+
out.farPoint = view.inverseViewProjection * vec4f(p, 1.0, 1.0);
|
|
304
|
+
out.nearPoint = view.inverseViewProjection * vec4f(p, -1.0, 1.0);
|
|
305
|
+
out.position = vec4f(p.x, p.y * view.flipY, 1.0, 1.0);
|
|
306
|
+
return out;
|
|
307
|
+
}
|
|
308
|
+
@fragment
|
|
309
|
+
fn fragmentMain(in: Varyings) -> @location(0) vec4f {
|
|
310
|
+
${i === 2 ? " var color = textureSample(source, sourceSampler, vec2f(0.5 + 0.5 * in.screen.x, 0.5 - 0.5 * in.screen.y)).rgb;" : ` var d = normalize(in.farPoint.xyz / in.farPoint.w - in.nearPoint.xyz / in.nearPoint.w);
|
|
311
|
+
let rotation = view.backgroundRotation;
|
|
312
|
+
d = vec3f(rotation.x * d.x - rotation.y * d.z, d.y, rotation.y * d.x + rotation.x * d.z);
|
|
313
|
+
${i === 1 ? " var color = textureSampleLevel(backgroundCube, environmentSampler, d, view.backgroundLevel).rgb;" : ` let st = vec2f(atan2(d.z, d.x) / (2.0 * PI) + 0.5, 0.5 - asin(clamp(d.y, -1.0, 1.0)) / PI);
|
|
314
|
+
var dx = dpdx(st);
|
|
315
|
+
var dy = dpdy(st) * view.derivativeSign;
|
|
316
|
+
dx.x -= round(dx.x);
|
|
317
|
+
dy.x -= round(dy.x);
|
|
318
|
+
var color = textureSampleGrad(source, sourceSampler, st, dx, dy).rgb;`}`}
|
|
319
|
+
color *= view.backgroundIntensity;
|
|
320
|
+
if (view.direct > 0.5) {
|
|
321
|
+
return vec4f(novaEncodeSRGB(novaToneMap(color, view.exposure, i32(view.toneMapping))), 1.0);
|
|
322
|
+
}
|
|
323
|
+
return vec4f(color, 1.0);
|
|
324
|
+
}
|
|
325
|
+
`;
|
|
326
|
+
}
|
|
327
|
+
const ce = `${V.wgsl}
|
|
328
|
+
@group(0) @binding(0) var<uniform> display: Display;
|
|
329
|
+
@group(0) @binding(1) var source: texture_2d<f32>;
|
|
330
|
+
${h}
|
|
331
|
+
${z}
|
|
332
|
+
@vertex
|
|
333
|
+
fn vertexMain(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
|
|
334
|
+
return vec4f(novaFullscreen(index), 0.0, 1.0);
|
|
335
|
+
}
|
|
336
|
+
@fragment
|
|
337
|
+
fn fragmentMain(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
338
|
+
let p = textureLoad(source, vec2i(position.xy), 0);
|
|
339
|
+
var encoded = vec3f(0.0);
|
|
340
|
+
if (p.a > 0.0) {
|
|
341
|
+
encoded = novaEncodeSRGB(novaToneMap(p.rgb / p.a, display.exposure, i32(display.toneMapping)));
|
|
342
|
+
}
|
|
343
|
+
return vec4f(encoded * p.a, p.a);
|
|
344
|
+
}
|
|
345
|
+
`, le = `${S.wgsl}
|
|
346
|
+
${L}
|
|
347
|
+
${h}
|
|
348
|
+
@vertex
|
|
349
|
+
fn vertexMain(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
|
|
350
|
+
return vec4f(novaFullscreen(index), 1.0, 1.0);
|
|
351
|
+
}
|
|
352
|
+
@fragment
|
|
353
|
+
fn fragmentMain() -> @location(0) vec4f {
|
|
354
|
+
return view.clearColor;
|
|
355
|
+
}
|
|
356
|
+
`, M = `const PI = 3.141592653589793;
|
|
357
|
+
${h}
|
|
358
|
+
fn cubeDirection(st: vec2f) -> vec3f {
|
|
359
|
+
let p = st * 2.0 - 1.0;
|
|
360
|
+
let face = i32(prefilter.face);
|
|
361
|
+
if (face == 0) { return normalize(vec3f(1.0, -p.y, -p.x)); }
|
|
362
|
+
if (face == 1) { return normalize(vec3f(-1.0, -p.y, p.x)); }
|
|
363
|
+
if (face == 2) { return normalize(vec3f(p.x, 1.0, p.y)); }
|
|
364
|
+
if (face == 3) { return normalize(vec3f(p.x, -1.0, -p.y)); }
|
|
365
|
+
if (face == 4) { return normalize(vec3f(p.x, -p.y, 1.0)); }
|
|
366
|
+
return normalize(vec3f(-p.x, -p.y, -1.0));
|
|
367
|
+
}
|
|
368
|
+
@vertex
|
|
369
|
+
fn vertexMain(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
|
|
370
|
+
return vec4f(novaFullscreen(index), 0.0, 1.0);
|
|
371
|
+
}`, fe = `${D.wgsl}
|
|
372
|
+
@group(0) @binding(0) var<uniform> prefilter: Prefilter;
|
|
373
|
+
@group(0) @binding(1) var source: texture_2d<f32>;
|
|
374
|
+
@group(0) @binding(2) var sourceSampler: sampler;
|
|
375
|
+
${M}
|
|
376
|
+
fn equirect(direction: vec3f) -> vec3f {
|
|
377
|
+
let st = vec2f(atan2(direction.z, direction.x) / (2.0 * PI) + 0.5, 0.5 - asin(clamp(direction.y, -1.0, 1.0)) / PI);
|
|
378
|
+
return textureSampleLevel(source, sourceSampler, st, 0.0).rgb;
|
|
379
|
+
}
|
|
380
|
+
@fragment
|
|
381
|
+
fn fragmentMain(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
382
|
+
let st = position.xy / prefilter.size;
|
|
383
|
+
let o = 0.25 / prefilter.size;
|
|
384
|
+
let sum = equirect(cubeDirection(st + vec2f(-o, -o))) + equirect(cubeDirection(st + vec2f(o, -o))) + equirect(cubeDirection(st + vec2f(-o, o))) + equirect(cubeDirection(st + vec2f(o, o)));
|
|
385
|
+
return vec4f(0.25 * sum, 1.0);
|
|
386
|
+
}
|
|
387
|
+
`, ue = `${D.wgsl}
|
|
388
|
+
@group(0) @binding(0) var<uniform> prefilter: Prefilter;
|
|
389
|
+
@group(0) @binding(1) var source: texture_cube<f32>;
|
|
390
|
+
@group(0) @binding(2) var sourceSampler: sampler;
|
|
391
|
+
${M}
|
|
392
|
+
@fragment
|
|
393
|
+
fn fragmentMain(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
394
|
+
let size = max(floor(f32(textureDimensions(source, 0).x) * 0.5), 1.0);
|
|
395
|
+
return vec4f(textureSampleLevel(source, sourceSampler, cubeDirection(position.xy / size), 0.0).rgb, 1.0);
|
|
396
|
+
}
|
|
397
|
+
`, pe = `diagnostic(off, derivative_uniformity);
|
|
398
|
+
${D.wgsl}
|
|
399
|
+
@group(0) @binding(0) var<uniform> prefilter: Prefilter;
|
|
400
|
+
@group(0) @binding(1) var source: texture_cube<f32>;
|
|
401
|
+
@group(0) @binding(2) var sourceSampler: sampler;
|
|
402
|
+
const SPECULAR_SAMPLES = 256u;
|
|
403
|
+
const IRRADIANCE_SAMPLES = 512u;
|
|
404
|
+
${M}
|
|
405
|
+
fn radicalInverse(bits: u32) -> f32 {
|
|
406
|
+
return f32(reverseBits(bits)) * 2.3283064365386963e-10;
|
|
407
|
+
}
|
|
408
|
+
@fragment
|
|
409
|
+
fn fragmentMain(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
410
|
+
let st = position.xy / prefilter.size;
|
|
411
|
+
let N = cubeDirection(st);
|
|
412
|
+
let mode = i32(prefilter.mode);
|
|
413
|
+
let roughness = prefilter.roughness;
|
|
414
|
+
let sourceSize = f32(textureDimensions(source, 0).x);
|
|
415
|
+
if (mode == 0 && roughness < 0.001) {
|
|
416
|
+
return vec4f(textureSampleLevel(source, sourceSampler, N, max(log2(sourceSize / prefilter.size), 0.0)).rgb, 1.0);
|
|
417
|
+
}
|
|
418
|
+
let up = select(vec3f(1.0, 0.0, 0.0), vec3f(0.0, 1.0, 0.0), abs(N.y) < 0.999);
|
|
419
|
+
let T = normalize(cross(up, N));
|
|
420
|
+
let B = cross(N, T);
|
|
421
|
+
let a = roughness * roughness;
|
|
422
|
+
let a2 = a * a;
|
|
423
|
+
|
|
424
|
+
let count = select(SPECULAR_SAMPLES, IRRADIANCE_SAMPLES, mode == 1);
|
|
425
|
+
let lodScale = f32(count) * 4.0 * PI / (6.0 * sourceSize * sourceSize);
|
|
426
|
+
var sum = vec3f(0.0);
|
|
427
|
+
var weight = 0.0;
|
|
428
|
+
for (var i = 0u; i < count; i++) {
|
|
429
|
+
let xi = vec2f((f32(i) + 0.5) / f32(count), radicalInverse(i));
|
|
430
|
+
let phi = 2.0 * PI * xi.x;
|
|
431
|
+
var cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a2 - 1.0) * xi.y));
|
|
432
|
+
if (mode == 1) {
|
|
433
|
+
cosTheta = sqrt(1.0 - xi.y);
|
|
434
|
+
}
|
|
435
|
+
let sinTheta = sqrt(max(0.0, 1.0 - cosTheta * cosTheta));
|
|
436
|
+
let H = T * cos(phi) * sinTheta + B * sin(phi) * sinTheta + N * cosTheta;
|
|
437
|
+
if (mode == 1) {
|
|
438
|
+
|
|
439
|
+
let lod = 0.5 * log2(PI / (lodScale * max(cosTheta, 1e-4))) + 1.0;
|
|
440
|
+
sum += textureSampleLevel(source, sourceSampler, H, max(lod, 0.0)).rgb;
|
|
441
|
+
weight += 1.0;
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
|
|
445
|
+
let NoL = 2.0 * cosTheta * cosTheta - 1.0;
|
|
446
|
+
if (NoL > 0.0) {
|
|
447
|
+
let d = cosTheta * cosTheta * (a2 - 1.0) + 1.0;
|
|
448
|
+
let lod = 0.5 * log2(4.0 * PI * d * d / (a2 * lodScale)) + 1.0;
|
|
449
|
+
sum += textureSampleLevel(source, sourceSampler, 2.0 * cosTheta * H - N, max(lod, 0.0)).rgb * NoL;
|
|
450
|
+
weight += NoL;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return vec4f(sum / max(weight, 1e-6), 1.0);
|
|
455
|
+
}
|
|
456
|
+
`, O = `@group(0) @binding(0) var source: texture_2d<f32>;
|
|
457
|
+
@group(0) @binding(1) var sourceSampler: sampler;
|
|
458
|
+
${h}
|
|
459
|
+
@vertex
|
|
460
|
+
fn vertexMain(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
|
|
461
|
+
return vec4f(novaFullscreen(index), 0.0, 1.0);
|
|
462
|
+
}
|
|
463
|
+
@fragment
|
|
464
|
+
fn fragmentMain(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
465
|
+
let size = max(vec2f(textureDimensions(source, 0)) * 0.5, vec2f(1.0));
|
|
466
|
+
let level = max(floor(size), vec2f(1.0));
|
|
467
|
+
return textureSampleLevel(source, sourceSampler, position.xy / level, 0.0);
|
|
468
|
+
}
|
|
469
|
+
`, $ = new Float32Array(1), j = new Uint32Array($.buffer);
|
|
470
|
+
function G(i) {
|
|
471
|
+
$[0] = i;
|
|
472
|
+
const e = j[0], t = e >>> 16 & 32768, r = e >>> 23 & 255;
|
|
473
|
+
let o = e & 8388607;
|
|
474
|
+
if (r === 255)
|
|
475
|
+
return t | 31744 | (o ? 512 : 0);
|
|
476
|
+
const n = r - 127 + 15;
|
|
477
|
+
if (n >= 31)
|
|
478
|
+
return t | 31744;
|
|
479
|
+
if (n <= 0) {
|
|
480
|
+
if (n < -10)
|
|
481
|
+
return t;
|
|
482
|
+
o |= 8388608;
|
|
483
|
+
const f = 14 - n, s = o >> f, l = o & (1 << f) - 1, u = 1 << f - 1;
|
|
484
|
+
return t | s + (l > u || l === u && s & 1 ? 1 : 0);
|
|
485
|
+
}
|
|
486
|
+
const c = n << 10 | o >> 13, a = o & 8191;
|
|
487
|
+
return t | c + (a > 4096 || a === 4096 && c & 1 ? 1 : 0);
|
|
488
|
+
}
|
|
489
|
+
function k(i, e = 0, t = i.length) {
|
|
490
|
+
const r = new Uint16Array(t - e);
|
|
491
|
+
for (let o = e; o < t; o++)
|
|
492
|
+
r[o - e] = G(i[o]);
|
|
493
|
+
return r;
|
|
494
|
+
}
|
|
495
|
+
function U(i) {
|
|
496
|
+
const e = i.minFilter, t = e === "linear" || e.startsWith("linear-"), r = e.includes("mipmap"), o = e.endsWith("mipmap-linear"), n = (a) => a === "repeat" ? 1 : a === "mirror" ? 2 : 0, c = i.anisotropy > 1 && i.magFilter === "linear" && t && o ? Math.min(16, Math.floor(i.anisotropy)) : 1;
|
|
497
|
+
return (i.magFilter === "linear" ? 1 : 0) | (t ? 2 : 0) | (o ? 4 : 0) | (r ? 0 : 8) | n(i.wrapS) << 4 | n(i.wrapT) << 6 | c << 8;
|
|
498
|
+
}
|
|
499
|
+
function B(i) {
|
|
500
|
+
const e = ["clamp-to-edge", "repeat", "mirror-repeat"];
|
|
501
|
+
return {
|
|
502
|
+
magFilter: i & 1 ? "linear" : "nearest",
|
|
503
|
+
minFilter: i & 2 ? "linear" : "nearest",
|
|
504
|
+
mipmapFilter: i & 4 ? "linear" : "nearest",
|
|
505
|
+
// Non-mipmap minification samples the base level only, as WebGL does.
|
|
506
|
+
lodMaxClamp: i & 8 ? 0 : 32,
|
|
507
|
+
addressModeU: e[i >> 4 & 3],
|
|
508
|
+
addressModeV: e[i >> 6 & 3],
|
|
509
|
+
addressModeW: "clamp-to-edge",
|
|
510
|
+
maxAnisotropy: Math.max(1, i >> 8)
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
class ve {
|
|
514
|
+
constructor(e) {
|
|
515
|
+
this._device = e;
|
|
516
|
+
}
|
|
517
|
+
_residents = /* @__PURE__ */ new Map();
|
|
518
|
+
_samplers = /* @__PURE__ */ new Map();
|
|
519
|
+
_mipPipelines = /* @__PURE__ */ new Map();
|
|
520
|
+
_mipSampler;
|
|
521
|
+
_mipModule;
|
|
522
|
+
_white;
|
|
523
|
+
_bytes = 0;
|
|
524
|
+
/** Advances whenever a resident GPU texture is created or replaced. */
|
|
525
|
+
epoch = 0;
|
|
526
|
+
uploads = 0;
|
|
527
|
+
get count() {
|
|
528
|
+
return this._residents.size;
|
|
529
|
+
}
|
|
530
|
+
get bytes() {
|
|
531
|
+
return this._bytes;
|
|
532
|
+
}
|
|
533
|
+
sampler(e) {
|
|
534
|
+
const t = U(e);
|
|
535
|
+
let r = this._samplers.get(t);
|
|
536
|
+
return r || (r = this._device.createSampler(B(t)), this._samplers.set(t, r)), r;
|
|
537
|
+
}
|
|
538
|
+
/** A 1×1 white RGBA8 texture for absent optional maps. */
|
|
539
|
+
white() {
|
|
540
|
+
if (!this._white) {
|
|
541
|
+
const e = this._device.createTexture({ size: [1, 1], format: "rgba8unorm", usage: m.TEXTURE_BINDING | m.COPY_DST });
|
|
542
|
+
this._device.queue.writeTexture({ texture: e }, new Uint8Array([255, 255, 255, 255]), { bytesPerRow: 4 }, [1, 1]), this._white = { texture: e, view: e.createView(), version: 0, content: 0, width: 1, height: 1, bytes: 4, levels: 1, format: "rgba8unorm" };
|
|
543
|
+
}
|
|
544
|
+
return this._white.view;
|
|
545
|
+
}
|
|
546
|
+
/** Uploads or refreshes the GPU copy of a CPU or image texture (not a render-target texture). */
|
|
547
|
+
ensure(e) {
|
|
548
|
+
const t = this._residents.get(e);
|
|
549
|
+
if (t?.version === e.version && (t.content === e._contentVersion || this._refresh(e, t)))
|
|
550
|
+
return t;
|
|
551
|
+
const r = e._readSource();
|
|
552
|
+
if (r.dimension !== "2d")
|
|
553
|
+
throw E("Array and 3D textures");
|
|
554
|
+
const o = e.image, n = e._imageSize(), c = n ? n[0] : 1, a = n ? n[1] : 1, f = this._device.limits.maxTextureDimension2D;
|
|
555
|
+
if (c > f || a > f)
|
|
556
|
+
throw new g("invalid-option", "[Nova3D] Texture exceeds device dimensions.");
|
|
557
|
+
const s = r.format === "rgba16f" ? "rgba16float" : r.colorSpace === "srgb" ? "rgba8unorm-srgb" : "rgba8unorm", l = r.mipmaps && n ? C(c, a) : 1, u = this._device.createTexture({ size: [c, a], format: s, mipLevelCount: l, usage: m.TEXTURE_BINDING | m.COPY_DST | m.RENDER_ATTACHMENT }), R = r.format === "rgba16f" ? 8 : 4;
|
|
558
|
+
let _ = 0;
|
|
559
|
+
for (let w = 0; w < l; w++)
|
|
560
|
+
_ += Math.max(1, c >> w) * Math.max(1, a >> w) * R;
|
|
561
|
+
const v = { texture: u, view: u.createView(), version: e.version, content: o && !n ? -1 : e._contentVersion, width: c, height: a, bytes: _, levels: l, format: s };
|
|
562
|
+
return o && n ? this._copyImage(e, v) : o ? this._device.queue.writeTexture({ texture: u }, new Uint8Array(4), { bytesPerRow: 4 }, [1, 1]) : this._writeData(r, v, null), v.content !== -1 && e._takeDirty(), l > 1 && this._generateMipmaps(v), t && this.release(e), this._residents.set(e, v), this._bytes += _, this.epoch++, v;
|
|
563
|
+
}
|
|
564
|
+
release(e) {
|
|
565
|
+
const t = this._residents.get(e);
|
|
566
|
+
t && (t.texture.destroy(), this._bytes -= t.bytes, this._residents.delete(e), this.epoch++);
|
|
567
|
+
}
|
|
568
|
+
/** Drops every resident; `lost` skips destroy calls on objects of a lost device. */
|
|
569
|
+
reset(e) {
|
|
570
|
+
if (!e) {
|
|
571
|
+
for (const t of this._residents.values())
|
|
572
|
+
t.texture.destroy();
|
|
573
|
+
this._white?.texture.destroy();
|
|
574
|
+
}
|
|
575
|
+
this._residents.clear(), this._samplers.clear(), this._mipPipelines.clear(), this._mipSampler = void 0, this._mipModule = void 0, this._white = void 0, this._bytes = 0, this.epoch++;
|
|
576
|
+
}
|
|
577
|
+
/** Re-uploads changed pixels into the existing storage; false when it must be reallocated. */
|
|
578
|
+
_refresh(e, t) {
|
|
579
|
+
const r = e._imageSize();
|
|
580
|
+
if (!r)
|
|
581
|
+
return t.content === -1;
|
|
582
|
+
if (r[0] !== t.width || r[1] !== t.height || t.content === -1)
|
|
583
|
+
return !1;
|
|
584
|
+
const o = e._readSource();
|
|
585
|
+
return e.image ? (e._takeDirty(), this._copyImage(e, t)) : this._writeData(o, t, e._takeDirty()), t.levels > 1 && this._generateMipmaps(t), t.content = e._contentVersion, !0;
|
|
586
|
+
}
|
|
587
|
+
_copyImage(e, t) {
|
|
588
|
+
const r = e.image;
|
|
589
|
+
this._device.queue.copyExternalImageToTexture({ source: r, flipY: e.flipY }, { texture: t.texture, premultipliedAlpha: !1 }, [t.width, t.height]), this.uploads += t.width * t.height * 4;
|
|
590
|
+
}
|
|
591
|
+
_writeData(e, t, r) {
|
|
592
|
+
const o = t.width, n = e.format === "rgba16f", c = r?.x0 ?? 0, a = r?.y0 ?? 0, f = r?.x1 ?? o, s = r?.y1 ?? t.height, l = n ? 8 : 4;
|
|
593
|
+
if (n) {
|
|
594
|
+
const u = k(e.data, a * o * 4, s * o * 4);
|
|
595
|
+
this._device.queue.writeTexture({ texture: t.texture, origin: [c, a] }, u, { offset: c * l, bytesPerRow: o * l, rowsPerImage: s - a }, [f - c, s - a]);
|
|
596
|
+
} else
|
|
597
|
+
this._device.queue.writeTexture({ texture: t.texture, origin: [c, a] }, e.data, { offset: (a * o + c) * l, bytesPerRow: o * l, rowsPerImage: s - a }, [f - c, s - a]);
|
|
598
|
+
this.uploads += (f - c) * (s - a) * l;
|
|
599
|
+
}
|
|
600
|
+
/** Fills levels 1… by rendering each level from the one above (linear-space for sRGB formats). */
|
|
601
|
+
_generateMipmaps(e) {
|
|
602
|
+
const t = this._device;
|
|
603
|
+
let r = this._mipPipelines.get(e.format);
|
|
604
|
+
r || (this._mipModule ??= t.createShaderModule({ code: O, label: "nova3d-mipmap" }), r = t.createRenderPipeline({ layout: "auto", vertex: { module: this._mipModule, entryPoint: "vertexMain" }, fragment: { module: this._mipModule, entryPoint: "fragmentMain", targets: [{ format: e.format }] }, primitive: { topology: "triangle-list" } }), this._mipPipelines.set(e.format, r)), this._mipSampler ??= t.createSampler({ minFilter: "linear", magFilter: "linear" });
|
|
605
|
+
const o = t.createCommandEncoder({ label: "nova3d-mipmaps" });
|
|
606
|
+
for (let n = 1; n < e.levels; n++) {
|
|
607
|
+
const c = e.texture.createView({ baseMipLevel: n - 1, mipLevelCount: 1 }), a = e.texture.createView({ baseMipLevel: n, mipLevelCount: 1 }), f = t.createBindGroup({ layout: r.getBindGroupLayout(0), entries: [{ binding: 0, resource: c }, { binding: 1, resource: this._mipSampler }] }), s = o.beginRenderPass({ colorAttachments: [{ view: a, loadOp: "clear", storeOp: "store", clearValue: [0, 0, 0, 0] }] });
|
|
608
|
+
s.setPipeline(r), s.setBindGroup(0, f), s.draw(3), s.end();
|
|
609
|
+
}
|
|
610
|
+
t.queue.submit([o.finish()]);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
export {
|
|
614
|
+
Z as A,
|
|
615
|
+
Y as B,
|
|
616
|
+
y as C,
|
|
617
|
+
le as D,
|
|
618
|
+
se as E,
|
|
619
|
+
ce as F,
|
|
620
|
+
ae as G,
|
|
621
|
+
H as M,
|
|
622
|
+
X as S,
|
|
623
|
+
m as T,
|
|
624
|
+
ve as W,
|
|
625
|
+
L as a,
|
|
626
|
+
N as b,
|
|
627
|
+
ne as c,
|
|
628
|
+
x as d,
|
|
629
|
+
K as e,
|
|
630
|
+
oe as f,
|
|
631
|
+
fe as g,
|
|
632
|
+
G as h,
|
|
633
|
+
ue as i,
|
|
634
|
+
J as j,
|
|
635
|
+
T as k,
|
|
636
|
+
A as l,
|
|
637
|
+
h as m,
|
|
638
|
+
O as n,
|
|
639
|
+
P as o,
|
|
640
|
+
pe as p,
|
|
641
|
+
V as q,
|
|
642
|
+
te as r,
|
|
643
|
+
F as s,
|
|
644
|
+
z as t,
|
|
645
|
+
p as u,
|
|
646
|
+
S as v,
|
|
647
|
+
Q as w,
|
|
648
|
+
ie as x,
|
|
649
|
+
re as y,
|
|
650
|
+
ee as z
|
|
651
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const e = ["none", "reinhard", "cineon", "aces", "agx", "neutral"];
|
|
2
|
+
function c(o) {
|
|
3
|
+
return e.indexOf(o);
|
|
4
|
+
}
|
|
5
|
+
const a = `
|
|
6
|
+
vec3 novaRRTAndODTFit(vec3 v){vec3 a=v*(v+0.0245786)-0.000090537;vec3 b=v*(0.983729*v+0.4329510)+0.238081;return a/b;}
|
|
7
|
+
vec3 novaAgXContrast(vec3 x){vec3 x2=x*x;vec3 x4=x2*x2;return 15.5*x4*x2-40.14*x4*x+31.96*x4-6.868*x2*x+0.4298*x2+0.1191*x-0.00232;}
|
|
8
|
+
vec3 novaToneMap(vec3 color,float exposure,int mode){
|
|
9
|
+
color=max(color,vec3(0.0))*exposure;
|
|
10
|
+
if(mode==1)color=color/(vec3(1.0)+color);
|
|
11
|
+
else if(mode==2){color=max(vec3(0.0),color-0.004);color=pow((color*(6.2*color+0.5))/(color*(6.2*color+1.7)+0.06),vec3(2.2));}
|
|
12
|
+
else if(mode==3){
|
|
13
|
+
const mat3 inputMat=mat3(vec3(0.59719,0.07600,0.02840),vec3(0.35458,0.90834,0.13383),vec3(0.04823,0.01566,0.83777));
|
|
14
|
+
const mat3 outputMat=mat3(vec3(1.60475,-0.10208,-0.00327),vec3(-0.53108,1.10813,-0.07276),vec3(-0.07367,-0.00605,1.07602));
|
|
15
|
+
color=outputMat*novaRRTAndODTFit(inputMat*(color/0.6));
|
|
16
|
+
}
|
|
17
|
+
else if(mode==4){
|
|
18
|
+
const mat3 toRec2020=mat3(vec3(0.6274,0.0691,0.0164),vec3(0.3293,0.9195,0.0880),vec3(0.0433,0.0113,0.8956));
|
|
19
|
+
const mat3 fromRec2020=mat3(vec3(1.6605,-0.1246,-0.0182),vec3(-0.5876,1.1329,-0.1006),vec3(-0.0728,-0.0083,1.1187));
|
|
20
|
+
const mat3 inset=mat3(vec3(0.856627153315983,0.137318972929847,0.11189821299995),vec3(0.0951212405381588,0.761241990602591,0.0767994186031903),vec3(0.0482516061458583,0.101439036467562,0.811302368396859));
|
|
21
|
+
const mat3 outset=mat3(vec3(1.1271005818144368,-0.1413297634984383,-0.14132976349843826),vec3(-0.11060664309660323,1.157823702216272,-0.11060664309660294),vec3(-0.016493938717834573,-0.016493938717834257,1.2519364065950405));
|
|
22
|
+
color=inset*(toRec2020*color);
|
|
23
|
+
color=clamp((log2(max(color,1e-10))+12.47393)/(4.026069+12.47393),0.0,1.0);
|
|
24
|
+
color=outset*novaAgXContrast(color);
|
|
25
|
+
color=fromRec2020*pow(max(vec3(0.0),color),vec3(2.2));
|
|
26
|
+
}
|
|
27
|
+
else if(mode==5){
|
|
28
|
+
float x=min(color.r,min(color.g,color.b));
|
|
29
|
+
color-=x<0.08?x-6.25*x*x:0.04;
|
|
30
|
+
float peak=max(color.r,max(color.g,color.b));
|
|
31
|
+
if(peak>=0.76){
|
|
32
|
+
float d=0.24;
|
|
33
|
+
float newPeak=1.0-d*d/(peak+d-0.76);
|
|
34
|
+
color*=newPeak/peak;
|
|
35
|
+
color=mix(color,vec3(newPeak),1.0-1.0/(0.15*(peak-newPeak)+1.0));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return clamp(color,0.0,1.0);
|
|
39
|
+
}
|
|
40
|
+
vec3 novaEncodeSRGB(vec3 linear){return mix(12.92*linear,1.055*pow(linear,vec3(1.0/2.4))-0.055,step(vec3(0.0031308),linear));}
|
|
41
|
+
`;
|
|
42
|
+
export {
|
|
43
|
+
e as a,
|
|
44
|
+
c as b,
|
|
45
|
+
a as t
|
|
46
|
+
};
|