@carbonenginejs/runtime 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +58 -125
- package/dist/audio/index.js +8 -1
- package/dist/audio/index.js.map +1 -1
- package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js +84 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js +14 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js +26 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js +27 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js +27 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js +25 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js +26 -0
- package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js.map +1 -0
- package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js +58 -0
- package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js.map +1 -0
- package/dist/audio/trinity/audio/AudManager.js +1 -1
- package/dist/audio/trinity/audio/AudManager.js.map +1 -1
- package/dist/audio/trinity/audio/{AudObstructionOcclusion.js → AudObstructionOcclusion/AudObstructionOcclusion.js} +8 -52
- package/dist/audio/trinity/audio/AudObstructionOcclusion/AudObstructionOcclusion.js.map +1 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js +17 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js.map +1 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js +46 -0
- package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js.map +1 -0
- package/dist/audio/trinity/index.js +8 -1
- package/dist/audio/trinity/index.js.map +1 -1
- package/dist/character/CjsCharacterAppearanceConstruction.js +5 -0
- package/dist/character/CjsCharacterAppearanceConstruction.js.map +1 -1
- package/dist/character/CjsCharacterAppearanceManager.js +14 -0
- package/dist/character/CjsCharacterAppearanceManager.js.map +1 -1
- package/dist/character/CjsCharacterFoundationConstruction.js +5 -0
- package/dist/character/CjsCharacterFoundationConstruction.js.map +1 -1
- package/dist/character/CjsCharacterTexturePolicy.js +5 -0
- package/dist/character/CjsCharacterTexturePolicy.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesAppearanceAL.js +17 -0
- package/dist/character/gles/CjsCharacterGlesAppearanceAL.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js +2 -0
- package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js +5 -0
- package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js +5 -0
- package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesMorphDeformation.js +2 -0
- package/dist/character/gles/CjsCharacterGlesMorphDeformation.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js +5 -0
- package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js.map +1 -1
- package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js +5 -0
- package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js.map +1 -1
- package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js +9 -0
- package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js.map +1 -1
- package/dist/global/blue/CjsScriptCallback.js +142 -0
- package/dist/global/blue/CjsScriptCallback.js.map +1 -0
- package/dist/global/blue/index.js +2 -0
- package/dist/global/blue/index.js.map +1 -0
- package/dist/global/consts/renderContext/formats.js +51 -1
- package/dist/global/consts/renderContext/formats.js.map +1 -1
- package/dist/global/consts/renderContext/index.js +2 -2
- package/dist/global/consts/renderContext/renderStates.js +16 -1
- package/dist/global/consts/renderContext/renderStates.js.map +1 -1
- package/dist/global/contracts/index.js +0 -1
- package/dist/global/contracts/index.js.map +1 -1
- package/dist/global/index.js +4 -3
- package/dist/global/index.js.map +1 -1
- package/dist/global/math/index.js +2 -0
- package/dist/global/math/index.js.map +1 -1
- package/dist/global/math/mesh.js +70 -16
- package/dist/global/math/mesh.js.map +1 -1
- package/dist/global/math/noise.js +47 -68
- package/dist/global/math/noise.js.map +1 -1
- package/dist/global/math/pool.js +18 -3
- package/dist/global/math/pool.js.map +1 -1
- package/dist/global/math/random.js +52 -0
- package/dist/global/math/random.js.map +1 -0
- package/dist/global/math/tri3.js +18 -4
- package/dist/global/math/tri3.js.map +1 -1
- package/dist/global/schema/CjsSchema.js +20 -2
- package/dist/global/schema/CjsSchema.js.map +1 -1
- package/dist/global/schema/hydration.js +14 -0
- package/dist/global/schema/hydration.js.map +1 -1
- package/dist/global/utils/bytes.js +22 -4
- package/dist/global/utils/bytes.js.map +1 -1
- package/dist/global/utils/checksum.js +80 -0
- package/dist/global/utils/checksum.js.map +1 -0
- package/dist/global/utils/errors/CjsCancellationError.js +36 -0
- package/dist/global/utils/errors/CjsCancellationError.js.map +1 -0
- package/dist/global/utils/errors/CjsError.js +21 -52
- package/dist/global/utils/errors/CjsError.js.map +1 -1
- package/dist/global/utils/errors/abort.js +1 -1
- package/dist/global/utils/errors/abort.js.map +1 -1
- package/dist/global/utils/errors/index.js +2 -1
- package/dist/global/utils/errors/index.js.map +1 -1
- package/dist/global/utils/index.js +4 -2
- package/dist/global/utils/index.js.map +1 -1
- package/dist/index.js +95 -35
- package/dist/index.js.map +1 -1
- package/dist/input/Tr2MainWindow.js +7 -9
- package/dist/input/Tr2MainWindow.js.map +1 -1
- package/dist/resource/CjsResMan.js +33 -39
- package/dist/resource/CjsResMan.js.map +1 -1
- package/dist/resource/CjsResource.js +19 -5
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/audio/AudioGeometryResData.js +22 -27
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -1
- package/dist/resource/audio/CjsAudioRes.js +4 -5
- package/dist/resource/audio/CjsAudioRes.js.map +1 -1
- package/dist/resource/format/CjsBitReader.js +263 -0
- package/dist/resource/format/CjsBitReader.js.map +1 -0
- package/dist/resource/format/CjsByteReader.js +130 -125
- package/dist/resource/format/CjsByteReader.js.map +1 -1
- package/dist/resource/format/CjsFormat.js +11 -4
- package/dist/resource/format/CjsFormat.js.map +1 -1
- package/dist/resource/format/CjsFormatError.js +37 -1
- package/dist/resource/format/CjsFormatError.js.map +1 -1
- package/dist/resource/format/CjsResourceProbe.js +41 -37
- package/dist/resource/format/CjsResourceProbe.js.map +1 -1
- package/dist/resource/format/carbonRecordGuard.js +33 -0
- package/dist/resource/format/carbonRecordGuard.js.map +1 -0
- package/dist/resource/format/imageSignatures.js +202 -0
- package/dist/resource/format/imageSignatures.js.map +1 -0
- package/dist/resource/format/index.js +2 -1
- package/dist/resource/format/index.js.map +1 -1
- package/dist/resource/format/jsonPolicies.js +180 -0
- package/dist/resource/format/jsonPolicies.js.map +1 -0
- package/dist/resource/formats/black/core/helpers.js +18 -29
- package/dist/resource/formats/black/core/helpers.js.map +1 -1
- package/dist/resource/formats/bnk/CjsBnkFormat.js +4 -3
- package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/resource/formats/bnk/core/WwiseCursor.js +218 -0
- package/dist/resource/formats/bnk/core/WwiseCursor.js.map +1 -0
- package/dist/resource/formats/bnk/core/busNodes.js +2 -1
- package/dist/resource/formats/bnk/core/busNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/effectNodes.js +2 -1
- package/dist/resource/formats/bnk/core/effectNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/eventAction.js +15 -93
- package/dist/resource/formats/bnk/core/eventAction.js.map +1 -1
- package/dist/resource/formats/bnk/core/globalSettings.js +19 -94
- package/dist/resource/formats/bnk/core/globalSettings.js.map +1 -1
- package/dist/resource/formats/bnk/core/helpers.js +2 -48
- package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
- package/dist/resource/formats/bnk/core/musicNodes.js +42 -134
- package/dist/resource/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/resource/formats/bnk/core/nodeBase.js +20 -111
- package/dist/resource/formats/bnk/core/nodeBase.js.map +1 -1
- package/dist/resource/formats/bnk/core/sfxNodes.js +2 -1
- package/dist/resource/formats/bnk/core/sfxNodes.js.map +1 -1
- package/dist/resource/formats/cmf/CjsCmfFormat.js +242 -228
- package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/resource/formats/cmf/core/binary.js +54 -60
- package/dist/resource/formats/cmf/core/binary.js.map +1 -1
- package/dist/resource/formats/dds/CjsDdsFormat.js +5 -3
- package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/resource/formats/dds/core/bc6h.js +16 -18
- package/dist/resource/formats/dds/core/bc6h.js.map +1 -1
- package/dist/resource/formats/dds/core/bc7.js +28 -24
- package/dist/resource/formats/dds/core/bc7.js.map +1 -1
- package/dist/resource/formats/dds/core/helpers.js +7 -133
- package/dist/resource/formats/dds/core/helpers.js.map +1 -1
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js +3 -2
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/resource/formats/dxbc/core/helpers.js +4 -32
- package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
- package/dist/resource/formats/fbx/CjsFbxFormat.js +11 -0
- package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/resource/formats/fbx/core/helpers.js +18 -12
- package/dist/resource/formats/fbx/core/helpers.js.map +1 -1
- package/dist/resource/formats/flac/CjsFlacFormat.js +4 -9
- package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/resource/formats/flac/core/helpers.js +1 -62
- package/dist/resource/formats/flac/core/helpers.js.map +1 -1
- package/dist/resource/formats/gif/CjsGifFormat.js +4 -9
- package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/resource/formats/gif/core/helpers.js +1 -63
- package/dist/resource/formats/gif/core/helpers.js.map +1 -1
- package/dist/resource/formats/gltf/CjsGltfFormat.js +4 -3
- package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/resource/formats/gltf/core/helpers.js +3 -19
- package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/CjsGr2Format.js +105 -92
- package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/resource/formats/gr2/core/container.js +1 -10
- package/dist/resource/formats/gr2/core/container.js.map +1 -1
- package/dist/resource/formats/gr2/core/helpers.js +24 -35
- package/dist/resource/formats/gr2/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/core/shared.js +193 -189
- package/dist/resource/formats/gr2/core/shared.js.map +1 -1
- package/dist/resource/formats/hlsl/CjsHlslFormat.js +4 -3
- package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/resource/formats/hlsl/core/helpers.js +1 -30
- package/dist/resource/formats/hlsl/core/helpers.js.map +1 -1
- package/dist/resource/formats/jpeg/CjsJpegFormat.js +5 -3
- package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/resource/formats/jpeg/core/helpers.js +7 -134
- package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp3/CjsMp3Format.js +4 -9
- package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/resource/formats/mp3/core/helpers.js +1 -64
- package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp4/CjsMp4Format.js +4 -9
- package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/resource/formats/mp4/core/helpers.js +1 -73
- package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
- package/dist/resource/formats/obj/CjsObjFormat.js +4 -3
- package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/resource/formats/obj/core/helpers.js +93 -115
- package/dist/resource/formats/obj/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/CjsOggFormat.js +4 -3
- package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/resource/formats/ogg/core/helpers.js +1 -15
- package/dist/resource/formats/ogg/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/core/vorbis.js +138 -144
- package/dist/resource/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/resource/formats/pickle/CjsPickleFormat.js +83 -114
- package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/resource/formats/png/CjsPngFormat.js +5 -3
- package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/resource/formats/png/core/helpers.js +13 -152
- package/dist/resource/formats/png/core/helpers.js.map +1 -1
- package/dist/resource/formats/png/core/writer.js +3 -27
- package/dist/resource/formats/png/core/writer.js.map +1 -1
- package/dist/resource/formats/red/core/helpers.js +19 -29
- package/dist/resource/formats/red/core/helpers.js.map +1 -1
- package/dist/resource/formats/stl/CjsStlFormat.js +158 -147
- package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/resource/formats/stl/core/helpers.js +44 -66
- package/dist/resource/formats/stl/core/helpers.js.map +1 -1
- package/dist/resource/formats/tga/CjsTgaFormat.js +5 -3
- package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/resource/formats/tga/core/helpers.js +7 -153
- package/dist/resource/formats/tga/core/helpers.js.map +1 -1
- package/dist/resource/formats/vta/CjsVtaFormat.js +4 -3
- package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
- package/dist/resource/formats/vta/core/helpers.js +1 -17
- package/dist/resource/formats/vta/core/helpers.js.map +1 -1
- package/dist/resource/formats/wav/CjsWavFormat.js +4 -3
- package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/resource/formats/wav/core/helpers.js +1 -15
- package/dist/resource/formats/wav/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgl/CjsWebglFormat.js +4 -3
- package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +69 -9
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/resource/formats/webgl/core/helpers.js +39 -68
- package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +4 -3
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/resource/formats/webgpu/core/helpers.js +4 -30
- package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/resource/formats/webm/CjsWebmFormat.js +4 -9
- package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/resource/formats/webm/core/helpers.js +1 -73
- package/dist/resource/formats/webm/core/helpers.js.map +1 -1
- package/dist/resource/formats/webp/CjsWebpFormat.js +4 -9
- package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/resource/formats/webp/core/helpers.js +1 -62
- package/dist/resource/formats/webp/core/helpers.js.map +1 -1
- package/dist/resource/formats/wem/CjsWemFormat.js +4 -3
- package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/resource/formats/wem/core/bitStream.js +83 -106
- package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
- package/dist/resource/formats/wem/core/codebookLibrary.js +52 -52
- package/dist/resource/formats/wem/core/codebookLibrary.js.map +1 -1
- package/dist/resource/formats/wem/core/helpers.js +1 -15
- package/dist/resource/formats/wem/core/helpers.js.map +1 -1
- package/dist/resource/formats/wem/core/wemToOgg.js +67 -67
- package/dist/resource/formats/wem/core/wemToOgg.js.map +1 -1
- package/dist/resource/geometry/MeshDecalData.js +23 -25
- package/dist/resource/geometry/MeshDecalData.js.map +1 -1
- package/dist/resource/geometry/MeshDecalLodData.js +14 -23
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +299 -284
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResAreaData.js +30 -31
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResJointData.js +16 -24
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResLodData.js +50 -41
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResMeshData.js +32 -32
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -1
- package/dist/resource/geometry/TriGeometryResSkeletonData.js +14 -23
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -1
- package/dist/resource/geometry/TriJointBinding.js +16 -24
- package/dist/resource/geometry/TriJointBinding.js.map +1 -1
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js +22 -27
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -1
- package/dist/resource/geometry/TriRtGeometryConstants.js +50 -41
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -1
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js +12 -22
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js +30 -31
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -1
- package/dist/resource/index.js +1 -1
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +16 -17
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +26 -28
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +24 -25
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +21 -22
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +25 -26
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +69 -72
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +17 -18
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +42 -43
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2RenderStateSetup.js +26 -5
- package/dist/resource/shader/reflection/Tr2RenderStateSetup.js.map +1 -1
- package/dist/resource/shader/reflection/carbonRecordFields.js +87 -90
- package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -1
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +32 -34
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +1 -6
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2TextureLodManager.js +35 -27
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -1
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js +16 -24
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePackChannel.js +16 -24
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipeline.js +24 -20
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineParams.js +14 -23
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +18 -25
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +11 -16
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +14 -23
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +12 -22
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js +38 -26
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
- package/dist/resource/worker/CjsResManMainThreadLoader.js +2 -5
- package/dist/resource/worker/CjsResManMainThreadLoader.js.map +1 -1
- package/dist/resource/worker/CjsResManWorkerLoader.js +6 -7
- package/dist/resource/worker/CjsResManWorkerLoader.js.map +1 -1
- package/dist/resource/worker/protocol.js +18 -1
- package/dist/resource/worker/protocol.js.map +1 -1
- package/dist/sof/EveSOF.js +2 -222
- package/dist/sof/EveSOF.js.map +1 -1
- package/dist/sof/SofDocumentBuilder.js +205 -0
- package/dist/sof/SofDocumentBuilder.js.map +1 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js +16 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js.map +1 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js +16 -0
- package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js.map +1 -0
- package/dist/sof/faction/EveSOFDataFactionColorSet.js +3 -27
- package/dist/sof/faction/EveSOFDataFactionColorSet.js.map +1 -1
- package/dist/sof/faction/index.js +3 -1
- package/dist/sof/faction/index.js.map +1 -1
- package/dist/sof/generic/ErrSOFAreaShaderNotFound.js +18 -0
- package/dist/sof/generic/ErrSOFAreaShaderNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFDecalShaderNotFound.js +18 -0
- package/dist/sof/generic/ErrSOFDecalShaderNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js +21 -0
- package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js.map +1 -0
- package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js +21 -0
- package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js.map +1 -0
- package/dist/sof/generic/EveSOFDataGeneric.js +5 -69
- package/dist/sof/generic/EveSOFDataGeneric.js.map +1 -1
- package/dist/sof/generic/index.js +5 -1
- package/dist/sof/generic/index.js.map +1 -1
- package/dist/sof/index.js +23 -7
- package/dist/sof/index.js.map +1 -1
- package/dist/sof/pattern/ErrSOFProjectionNotFound.js +20 -0
- package/dist/sof/pattern/ErrSOFProjectionNotFound.js.map +1 -0
- package/dist/sof/pattern/EveSOFDataPattern.js +2 -17
- package/dist/sof/pattern/EveSOFDataPattern.js.map +1 -1
- package/dist/sof/pattern/index.js +2 -1
- package/dist/sof/pattern/index.js.map +1 -1
- package/dist/sof/shared/ErrSOFAreaTypeNotFound.js +16 -0
- package/dist/sof/shared/ErrSOFAreaTypeNotFound.js.map +1 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js +16 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js.map +1 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js +16 -0
- package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js.map +1 -0
- package/dist/sof/shared/EveSOFDataArea.js +2 -13
- package/dist/sof/shared/EveSOFDataArea.js.map +1 -1
- package/dist/sof/shared/EveSOFDataLogoSet.js +3 -27
- package/dist/sof/shared/EveSOFDataLogoSet.js.map +1 -1
- package/dist/sof/shared/EveSOFDataParameter.js +2 -146
- package/dist/sof/shared/EveSOFDataParameter.js.map +1 -1
- package/dist/sof/shared/EveSOFDataParameterBool.js +40 -0
- package/dist/sof/shared/EveSOFDataParameterBool.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterColor.js +36 -0
- package/dist/sof/shared/EveSOFDataParameterColor.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterFloat.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterFloat.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterInt.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterInt.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterVector2.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterVector2.js.map +1 -0
- package/dist/sof/shared/EveSOFDataParameterVector3.js +37 -0
- package/dist/sof/shared/EveSOFDataParameterVector3.js.map +1 -0
- package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js → EveSOFDataSpotLightAttachment.js} +1 -1
- package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js.map → EveSOFDataSpotLightAttachment.js.map} +1 -1
- package/dist/sof/shared/index.js +13 -4
- package/dist/sof/shared/index.js.map +1 -1
- package/dist/sof/sofDocumentValues.js +33 -0
- package/dist/sof/sofDocumentValues.js.map +1 -0
- package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js +168 -0
- package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js.map +1 -0
- package/dist/trinity/controllers/{ITr2Controller.js → ITr2Controller/ITr2Controller.js} +2 -134
- package/dist/trinity/controllers/ITr2Controller/ITr2Controller.js.map +1 -0
- package/dist/trinity/controllers/Tr2Controller.js +2 -1
- package/dist/trinity/controllers/Tr2Controller.js.map +1 -1
- package/dist/trinity/controllers/Tr2ControllerReference.js +2 -1
- package/dist/trinity/controllers/Tr2ControllerReference.js.map +1 -1
- package/dist/trinity/controllers/action/ITr2ControllerAction.js +2 -1
- package/dist/trinity/controllers/action/ITr2ControllerAction.js.map +1 -1
- package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js +10 -9
- package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js.map +1 -1
- package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js +26 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js +24 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js +387 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js.map +1 -0
- package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js +4 -1011
- package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js.map +1 -1
- package/dist/trinity/controllers/expression/expressionRuntime.js +605 -0
- package/dist/trinity/controllers/expression/expressionRuntime.js.map +1 -0
- package/dist/trinity/controllers/index.js +5 -2
- package/dist/trinity/controllers/index.js.map +1 -1
- package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js +2 -1
- package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js.map +1 -1
- package/dist/trinity/controllers/timeline/Tr2TimelineController.js +2 -1
- package/dist/trinity/controllers/timeline/Tr2TimelineController.js.map +1 -1
- package/dist/trinity/core/ITr2Updateable.js +2 -1
- package/dist/trinity/core/ITr2Updateable.js.map +1 -1
- package/dist/trinity/core/Tr2Blitter.js +6 -3
- package/dist/trinity/core/Tr2Blitter.js.map +1 -1
- package/dist/trinity/core/Tr2Denoiser.js +256 -0
- package/dist/trinity/core/Tr2Denoiser.js.map +1 -0
- package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js +115 -0
- package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js.map +1 -0
- package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js +79 -0
- package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js.map +1 -0
- package/dist/trinity/core/{Tr2GpuResourcePool.js → Tr2GpuResourcePool/Tr2GpuResourcePool.js} +63 -151
- package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -0
- package/dist/trinity/core/{Tr2QuadRenderer.js → Tr2QuadRenderer/Tr2QuadRenderer.js} +8 -30
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRenderer.js.map +1 -0
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js +38 -0
- package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js.map +1 -0
- package/dist/trinity/core/Tr2RenderUtils.js +20 -3
- package/dist/trinity/core/Tr2RenderUtils.js.map +1 -1
- package/dist/trinity/core/Tr2Renderer.js +146 -1
- package/dist/trinity/core/Tr2Renderer.js.map +1 -1
- package/dist/trinity/core/Tr2ShadowMap.js +135 -14
- package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
- package/dist/trinity/core/{Tr2TextureArray.js → Tr2TextureArray/Tr2TextureArray.js} +3 -58
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -0
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js +61 -0
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js +26 -0
- package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js +29 -0
- package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js.map +1 -0
- package/dist/trinity/core/batch/{ITriRenderBatchAccumulator.js → TriRenderBatch/ITriRenderBatchAccumulator.js} +30 -30
- package/dist/trinity/core/batch/TriRenderBatch/ITriRenderBatchAccumulator.js.map +1 -0
- package/dist/trinity/core/batch/{Tr2RenderBatch.js → TriRenderBatch/Tr2RenderBatch.js} +81 -154
- package/dist/trinity/core/batch/TriRenderBatch/Tr2RenderBatch.js.map +1 -0
- package/dist/trinity/core/batch/{TriRenderBatchAccumulator.js → TriRenderBatch/TriRenderBatchAccumulator.js} +7 -38
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAccumulator.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js +61 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js +40 -0
- package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js.map +1 -0
- package/dist/trinity/core/batch/TriRenderBatchMap.js +6 -1
- package/dist/trinity/core/batch/TriRenderBatchMap.js.map +1 -1
- package/dist/trinity/core/context/Tr2RenderContext.js +75 -57
- package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js +67 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js.map +1 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js +50 -0
- package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js.map +1 -0
- package/dist/trinity/core/device/Tr2DepthStencil.js +186 -13
- package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
- package/dist/trinity/core/device/{Tr2RingBuffer.js → Tr2RingBuffer/Tr2RingBuffer.js} +27 -79
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js.map +1 -0
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js +114 -0
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js.map +1 -0
- package/dist/trinity/core/device/{Tr2SuballocatedBuffer.js → Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js} +5 -59
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js.map +1 -0
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js +80 -0
- package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js.map +1 -0
- package/dist/trinity/core/index.js +42 -15
- package/dist/trinity/core/index.js.map +1 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js +6 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
- package/dist/trinity/core/mesh/{ITr2ImpostorSource.js → ITr2ImpostorSource/ITr2ImpostorSource.js} +6 -28
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSource.js.map +1 -0
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js +32 -0
- package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js.map +1 -0
- package/dist/trinity/core/mesh/{ITr2InstanceData.js → ITr2InstanceData/ITr2InstanceData.js} +5 -29
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceData.js.map +1 -0
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js +33 -0
- package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js.map +1 -0
- package/dist/trinity/core/mesh/Tr2DirectInstanceData.js +2 -1
- package/dist/trinity/core/mesh/Tr2DirectInstanceData.js.map +1 -1
- package/dist/trinity/core/mesh/Tr2MeshBase.js +7 -1
- package/dist/trinity/core/mesh/Tr2MeshBase.js.map +1 -1
- package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js +2 -1
- package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js.map +1 -1
- package/dist/trinity/core/mesh/TriGeometryResAllocations.js +6 -2
- package/dist/trinity/core/mesh/TriGeometryResAllocations.js.map +1 -1
- package/dist/trinity/core/rawData/CjsConstantLayout.js +196 -0
- package/dist/trinity/core/rawData/CjsConstantLayout.js.map +1 -0
- package/dist/trinity/core/rawData/CjsPerFrameLayouts.js +8 -3
- package/dist/trinity/core/rawData/CjsPerFrameLayouts.js.map +1 -1
- package/dist/trinity/core/rawData/CjsPerObjectLayouts.js +40 -732
- package/dist/trinity/core/rawData/CjsPerObjectLayouts.js.map +1 -1
- package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js +34 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js +69 -0
- package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js +59 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js +37 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js +44 -0
- package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js +31 -0
- package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js +29 -0
- package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js +39 -0
- package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js +30 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js +78 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js +169 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js +107 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js +44 -0
- package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js +34 -0
- package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js +82 -0
- package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js.map +1 -0
- package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js +42 -0
- package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js +59 -0
- package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js +55 -0
- package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/{Tr2PerObjectData.js → perObjectData/Tr2PerObjectData.js} +110 -62
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectData.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js +104 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js.map +1 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js +87 -0
- package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js.map +1 -0
- package/dist/trinity/core/variable/TriVariable.js +83 -83
- package/dist/trinity/core/variable/TriVariable.js.map +1 -1
- package/dist/trinity/core/vertex/{Tr2VertexDefinition.js → Tr2VertexDefinition/Tr2VertexDefinition.js} +4 -20
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinition.js.map +1 -0
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js +29 -0
- package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js.map +1 -0
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +116 -36
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
- package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js +50 -92
- package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js.map +1 -1
- package/dist/trinity/eve/EveModularObjectModifier.js +9 -5
- package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
- package/dist/trinity/eve/IEveInheritPropertiesOwner.js +2 -1
- package/dist/trinity/eve/IEveInheritPropertiesOwner.js.map +1 -1
- package/dist/trinity/eve/IEveSpaceObject2.js +2 -1
- package/dist/trinity/eve/IEveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/IEveTransform.js +2 -1
- package/dist/trinity/eve/IEveTransform.js.map +1 -1
- package/dist/trinity/eve/attachment/banner/EveBannerSet.js +2 -2
- package/dist/trinity/eve/attachment/banner/EveBannerSet.js.map +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js +109 -133
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js.map +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js +40 -0
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js.map +1 -0
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js +1 -1
- package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js.map +1 -1
- package/dist/trinity/eve/attachment/decal/DecalMeshCache.js +2 -14
- package/dist/trinity/eve/attachment/decal/DecalMeshCache.js.map +1 -1
- package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js +18 -0
- package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js.map +1 -0
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +1 -1
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
- package/dist/trinity/eve/attachment/haze/EveHazeSet.js +1 -1
- package/dist/trinity/eve/attachment/haze/EveHazeSet.js.map +1 -1
- package/dist/trinity/eve/attachment/plane/EvePlaneSet.js +1 -1
- package/dist/trinity/eve/attachment/plane/EvePlaneSet.js.map +1 -1
- package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js +2 -2
- package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js.map +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js.map +1 -1
- package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js +4 -2
- package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js.map +1 -1
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +143 -139
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
- package/dist/trinity/eve/camera/EveCamera.js +1 -1
- package/dist/trinity/eve/camera/EveCamera.js.map +1 -1
- package/dist/trinity/eve/child/EveChildBoosterSet.js +12 -1
- package/dist/trinity/eve/child/EveChildBoosterSet.js.map +1 -1
- package/dist/trinity/eve/child/EveChildCloud2.js +178 -151
- package/dist/trinity/eve/child/EveChildCloud2.js.map +1 -1
- package/dist/trinity/eve/child/EveChildContainer.js +141 -141
- package/dist/trinity/eve/child/EveChildContainer.js.map +1 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +87 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js +46 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js.map +1 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js +35 -0
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js.map +1 -0
- package/dist/trinity/eve/child/{EveChildInstancedMeshes.js → EveChildInstancedMeshes/EveChildInstancedMeshes.js} +42 -163
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -0
- package/dist/trinity/eve/child/EveChildMesh.js +218 -218
- package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js +53 -0
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js.map +1 -0
- package/dist/trinity/eve/child/{EveChildPartData.js → EveChildPartData/EveChildPartDataPartData.js} +9 -45
- package/dist/trinity/eve/child/EveChildPartData/EveChildPartDataPartData.js.map +1 -0
- package/dist/trinity/eve/child/EveChildParticleSystem.js +30 -29
- package/dist/trinity/eve/child/EveChildParticleSystem.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTransform.js +5 -0
- package/dist/trinity/eve/child/EveChildTransform.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTurret.js +7 -0
- package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
- package/dist/trinity/eve/index.js +10 -4
- package/dist/trinity/eve/index.js.map +1 -1
- package/dist/trinity/eve/lights/Tr2Light.js +5 -0
- package/dist/trinity/eve/lights/Tr2Light.js.map +1 -1
- package/dist/trinity/eve/overlays/overlayBatches.js +6 -1
- package/dist/trinity/eve/overlays/overlayBatches.js.map +1 -1
- package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js +4 -4
- package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js.map +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch2.js +76 -71
- package/dist/trinity/eve/renderable/stretch/EveStretch2.js.map +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch3.js +1 -1
- package/dist/trinity/eve/renderable/stretch/EveStretch3.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveShip2.js +3 -3
- package/dist/trinity/eve/spaceObject/EveShip2.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +408 -407
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/ui/EveTacticalOverlay.js +1 -1
- package/dist/trinity/eve/ui/EveTacticalOverlay.js.map +1 -1
- package/dist/trinity/eve/ui/lines/EveCurveLineSet.js +9 -9
- package/dist/trinity/eve/ui/lines/EveCurveLineSet.js.map +1 -1
- package/dist/trinity/eve/ui/lines/EveLineSet.js +27 -25
- package/dist/trinity/eve/ui/lines/EveLineSet.js.map +1 -1
- package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js +3 -2
- package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js.map +1 -1
- package/dist/trinity/generated/index.js +0 -1
- package/dist/trinity/generated/index.js.map +1 -1
- package/dist/trinity/generated/trinityCore/index.js +0 -1
- package/dist/trinity/generated/trinityCore/index.js.map +1 -1
- package/dist/trinity/index.js +59 -23
- package/dist/trinity/index.js.map +1 -1
- package/dist/trinity/particle/{ITr2GenericEmitter.js → ITr2GenericEmitter/ITr2GenericEmitter.js} +4 -32
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitter.js.map +1 -0
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js +36 -0
- package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js.map +1 -0
- package/dist/trinity/particle/Tr2ParticleSystem.js +4 -2
- package/dist/trinity/particle/Tr2ParticleSystem.js.map +1 -1
- package/dist/trinity/particle/element/Tr2ParticleElementData.js +15 -4
- package/dist/trinity/particle/element/Tr2ParticleElementData.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js +21 -20
- package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +23 -22
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
- package/dist/trinity/particle/emitter/Tr2StaticEmitter.js +14 -13
- package/dist/trinity/particle/emitter/Tr2StaticEmitter.js.map +1 -1
- package/dist/trinity/particle/index.js +2 -1
- package/dist/trinity/particle/index.js.map +1 -1
- package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js +7 -1
- package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js.map +1 -1
- package/dist/trinity/shader/Tr2Effect.js +131 -58
- package/dist/trinity/shader/Tr2Effect.js.map +1 -1
- package/dist/trinity/shader/Tr2EffectStateManager.js +17 -5
- package/dist/trinity/shader/Tr2EffectStateManager.js.map +1 -1
- package/dist/trinity/shader/Tr2Material.js +21 -4
- package/dist/trinity/shader/Tr2Material.js.map +1 -1
- package/dist/trinity/shader/material/Tr2EffectPassParameters.js +4 -1
- package/dist/trinity/shader/material/Tr2EffectPassParameters.js.map +1 -1
- package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js +2 -2
- package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js.map +1 -1
- package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js +79 -0
- package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js.map +1 -0
- package/dist/trinityal/{Tr2DeviceResourceAL.js → Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js} +77 -79
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js.map +1 -0
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js +24 -0
- package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js.map +1 -0
- package/dist/trinityal/Tr2DrawUPHelper.js +2 -1
- package/dist/trinityal/Tr2DrawUPHelper.js.map +1 -1
- package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js +45 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js +154 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js +48 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js +75 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js.map +1 -0
- package/dist/trinityal/{Tr2HalHelperStructures.js → Tr2HalHelperStructures/Tr2TextureSubresource.js} +11 -115
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js +51 -0
- package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js.map +1 -0
- package/dist/trinityal/{Tr2RenderPassAL.js → Tr2RenderPassAL/Tr2ColorAttachment.js} +5 -28
- package/dist/trinityal/Tr2RenderPassAL/Tr2ColorAttachment.js.map +1 -0
- package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js +38 -0
- package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js +80 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js +76 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js +96 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js.map +1 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js +196 -0
- package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js.map +1 -0
- package/dist/trinityal/index.js +22 -9
- package/dist/trinityal/index.js.map +1 -1
- package/dist/trinityal/stub/Tr2BufferALStub.js +86 -141
- package/dist/trinityal/stub/Tr2BufferALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2CapsALStub.js +17 -0
- package/dist/trinityal/stub/Tr2CapsALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ConstantBufferALStub.js +57 -41
- package/dist/trinityal/stub/Tr2ConstantBufferALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2FenceALStub.js +18 -2
- package/dist/trinityal/stub/Tr2FenceALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2GpuTimerALStub.js +97 -0
- package/dist/trinityal/stub/Tr2GpuTimerALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js +124 -0
- package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js +146 -0
- package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js +28 -0
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js.map +1 -0
- package/dist/trinityal/stub/{Tr2RenderContextALStub.js → Tr2RenderContextALStub/Tr2RenderContextALStub.js} +70 -75
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -0
- package/dist/trinityal/stub/Tr2SamplerStateALStub.js +47 -31
- package/dist/trinityal/stub/Tr2SamplerStateALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ShaderALStub.js +61 -45
- package/dist/trinityal/stub/Tr2ShaderALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2ShaderProgramALStub.js +51 -33
- package/dist/trinityal/stub/Tr2ShaderProgramALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2SwapChainALStub.js +61 -45
- package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2TextureALStub.js +188 -171
- package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2VertexLayoutALStub.js +43 -27
- package/dist/trinityal/stub/Tr2VertexLayoutALStub.js.map +1 -1
- package/dist/trinityal/stub/{Tr2VideoAdapterInfoALStub.js → Tr2VideoAdapterInfoStub.js} +16 -1
- package/dist/trinityal/stub/Tr2VideoAdapterInfoStub.js.map +1 -0
- package/dist/trinityal/stub/index.js +8 -4
- package/dist/trinityal/stub/index.js.map +1 -1
- package/dist/trinityal/vertexLayoutMatch.js +2 -2
- package/dist/trinityal/vertexLayoutMatch.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js +105 -90
- package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js +17 -0
- package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js +15 -0
- package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js +2 -2
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +900 -938
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +56 -60
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js +16 -1
- package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +100 -379
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +330 -0
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -0
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +15 -0
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
- package/dist/trinityal/webgpu/core/{constantArena.js → CjsWebgpuConstantArena.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuConstantArena.js.map +1 -0
- package/dist/trinityal/webgpu/core/{batchGroups.js → CjsWebgpuEncodeState.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuEncodeState.js.map +1 -0
- package/dist/trinityal/webgpu/core/{perFrameSource.js → CjsWebgpuPerFrameSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPerFrameSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{pipelineCache.js → CjsWebgpuPipelineCache.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPipelineCache.js.map +1 -0
- package/dist/trinityal/webgpu/core/{psoDescription.js → CjsWebgpuPsoDescription.js} +2 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -0
- package/dist/trinityal/webgpu/core/{renderTarget.js → CjsWebgpuRenderTarget.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuRenderTarget.js.map +1 -0
- package/dist/trinityal/webgpu/core/{samplerSource.js → CjsWebgpuSamplerSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuSamplerSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{textureSource.js → CjsWebgpuTextureSource.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuTextureSource.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityBatchDispatcher.js → CjsWebgpuTrinityBatchDispatcher.js} +4 -4
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchDispatcher.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityBatchResolver.js → CjsWebgpuTrinityBatchResolver.js} +81 -81
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchResolver.js.map +1 -0
- package/dist/trinityal/webgpu/core/{trinityPassEncoder.js → CjsWebgpuTrinityPassEncoder.js} +2 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuTrinityPassEncoder.js.map +1 -0
- package/dist/trinityal/webgpu/core/{workQueue.js → CjsWebgpuWorkQueue.js} +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -0
- package/dist/trinityal/webgpu/internal.js +12 -11
- package/dist/trinityal/webgpu/internal.js.map +1 -1
- package/docs/audio/reference/classes/trinity.md +44 -34
- package/docs/character/architecture.md +276 -0
- package/docs/character/reference/character-appearance-plans.md +30 -66
- package/docs/character/reference/prepared-libraries.md +14 -30
- package/docs/global/reference/api.md +2 -1
- package/docs/global/reference/classes/README.md +53 -71
- package/docs/global/reference/classes/dropped.md +16 -0
- package/docs/resource/README.md +19 -15
- package/docs/resource/architecture.md +9 -2
- package/docs/resource/concepts/format-capabilities.md +124 -80
- package/docs/resource/concepts/shared-format-helpers.md +94 -0
- package/docs/resource/formats/README.md +230 -224
- package/docs/resource/formats/bitknit2.md +221 -0
- package/docs/resource/formats/carbon-effect-container.md +184 -269
- package/docs/resource/formats/gr2.md +6 -1
- package/docs/resource/formats/schemabound.md +28 -48
- package/docs/resource/formats/static.md +70 -97
- package/docs/resource/formats/webgl/carbon-constant-layouts.md +8 -8
- package/docs/resource/formats/webgl/decl-io.md +165 -256
- package/docs/resource/formats/webgl/memory-structured.md +64 -142
- package/docs/resource/formats/webgl/texture-sample.md +109 -138
- package/docs/resource/formats/webgpu/formats/carbon-webgpu.md +38 -69
- package/docs/resource/formats/webgpu/guides/effect-packaging.md +54 -116
- package/docs/resource/formats/webgpu/reference/api.md +64 -67
- package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +158 -345
- package/docs/resource/reference/classes/core.md +256 -236
- package/docs/resource/reference/classes/formats.md +1668 -1672
- package/docs/resource/reference/workers.md +4 -2
- package/docs/sof/reference/classes/core.md +1 -1
- package/docs/sof/reference/classes/faction.md +2 -2
- package/docs/sof/reference/classes/generic.md +4 -4
- package/docs/sof/reference/classes/pattern.md +1 -1
- package/docs/sof/reference/classes/shared.md +10 -10
- package/docs/trinity/architecture.md +55 -44
- package/docs/trinity/concepts/generated-class-lifecycle.md +10 -15
- package/docs/trinity/reference/classes/curves-and-utilities.md +496 -506
- package/docs/trinity/reference/classes/dropped.md +0 -189
- package/docs/trinity/reference/classes/eve-runtime.md +8 -8
- package/docs/trinity/reference/classes/generated.md +0 -10
- package/docs/trinity/reference/classes/particle.md +2 -2
- package/docs/trinity/reference/classes/trinity-core.md +1554 -1256
- package/docs/trinity/reference/implementation-status.md +50 -75
- package/docs/trinity/reference/main-semantic-extraction.md +13 -17
- package/docs/trinityal/reference/classes/README.md +77 -27
- package/docs/trinityal/reference/classes/dropped.md +92 -0
- package/docs/trinityal/webgpu/README.md +3 -1
- package/docs/trinityal/webgpu/architecture.md +121 -228
- package/docs/trinityal/webgpu/reference/api.md +5 -5
- package/docs/trinityal/webgpu/reference/classes/README.md +13 -13
- package/format-notices/gr2/NOTICE +18 -12
- package/format-notices/gr2/THIRD-PARTY-NOTICES.md +5 -5
- package/package.json +4 -1
- package/dist/audio/trinity/audio/AudActionLog.js +0 -173
- package/dist/audio/trinity/audio/AudActionLog.js.map +0 -1
- package/dist/audio/trinity/audio/AudObstructionOcclusion.js.map +0 -1
- package/dist/global/contracts/CjsScriptCallback.js +0 -94
- package/dist/global/contracts/CjsScriptCallback.js.map +0 -1
- package/dist/trinity/controllers/ITr2Controller.js.map +0 -1
- package/dist/trinity/core/Tr2GpuResourcePool.js.map +0 -1
- package/dist/trinity/core/Tr2QuadRenderer.js.map +0 -1
- package/dist/trinity/core/Tr2TextureArray.js.map +0 -1
- package/dist/trinity/core/batch/ITriRenderBatchAccumulator.js.map +0 -1
- package/dist/trinity/core/batch/Tr2RenderBatch.js.map +0 -1
- package/dist/trinity/core/batch/TriRenderBatchAccumulator.js.map +0 -1
- package/dist/trinity/core/context/CjsShadowMapExecutor.js +0 -43
- package/dist/trinity/core/context/CjsShadowMapExecutor.js.map +0 -1
- package/dist/trinity/core/context/CjsVolumetricsExecutor.js +0 -64
- package/dist/trinity/core/context/CjsVolumetricsExecutor.js.map +0 -1
- package/dist/trinity/core/context/Tr2VisibilityResults.js +0 -109
- package/dist/trinity/core/context/Tr2VisibilityResults.js.map +0 -1
- package/dist/trinity/core/device/Tr2RingBuffer.js.map +0 -1
- package/dist/trinity/core/device/Tr2SuballocatedBuffer.js.map +0 -1
- package/dist/trinity/core/mesh/ITr2ImpostorSource.js.map +0 -1
- package/dist/trinity/core/mesh/ITr2InstanceData.js.map +0 -1
- package/dist/trinity/core/rawData/Tr2PerObjectData.js.map +0 -1
- package/dist/trinity/core/rawData/constantLayout.js +0 -175
- package/dist/trinity/core/rawData/constantLayout.js.map +0 -1
- package/dist/trinity/core/vertex/Tr2VertexDefinition.js.map +0 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes.js.map +0 -1
- package/dist/trinity/eve/child/EveChildPartData.js.map +0 -1
- package/dist/trinity/generated/trinityCore/Tr2Denoiser.js +0 -47
- package/dist/trinity/generated/trinityCore/Tr2Denoiser.js.map +0 -1
- package/dist/trinity/particle/ITr2GenericEmitter.js.map +0 -1
- package/dist/trinityal/Tr2DeviceResourceAL.js.map +0 -1
- package/dist/trinityal/Tr2HalHelperStructures.js.map +0 -1
- package/dist/trinityal/Tr2RenderPassAL.js.map +0 -1
- package/dist/trinityal/Tr2ResourceSetAL.js +0 -419
- package/dist/trinityal/Tr2ResourceSetAL.js.map +0 -1
- package/dist/trinityal/Tr2SamplerDescription.js +0 -72
- package/dist/trinityal/Tr2SamplerDescription.js.map +0 -1
- package/dist/trinityal/stub/Tr2QueryALStub.js +0 -326
- package/dist/trinityal/stub/Tr2QueryALStub.js.map +0 -1
- package/dist/trinityal/stub/Tr2RenderContextALStub.js.map +0 -1
- package/dist/trinityal/stub/Tr2VideoAdapterInfoALStub.js.map +0 -1
- package/dist/trinityal/webgpu/core/batchGroups.js.map +0 -1
- package/dist/trinityal/webgpu/core/constantArena.js.map +0 -1
- package/dist/trinityal/webgpu/core/perFrameSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/pipelineCache.js.map +0 -1
- package/dist/trinityal/webgpu/core/psoDescription.js.map +0 -1
- package/dist/trinityal/webgpu/core/renderTarget.js.map +0 -1
- package/dist/trinityal/webgpu/core/samplerSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/textureSource.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityBatchDispatcher.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityBatchResolver.js.map +0 -1
- package/dist/trinityal/webgpu/core/trinityPassEncoder.js.map +0 -1
- package/dist/trinityal/webgpu/core/workQueue.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { asUint8Array } from '#utils/bytes';
|
|
2
2
|
import { CjsFormat } from '../../format/CjsFormat.js';
|
|
3
|
-
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues,
|
|
3
|
+
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, probeSupportWithValues, isWAV, OUTPUT_JSON, OUTPUT_RAW, OUTPUT_PCM, OUTPUT_AUDIO } from './core/helpers.js';
|
|
4
|
+
import { toJsonWithByteSummary } from '../../format/jsonPolicies.js';
|
|
4
5
|
|
|
5
6
|
const FORMAT_NAME = "CjsWavFormat";
|
|
6
7
|
|
|
@@ -89,7 +90,7 @@ class CjsWavFormat extends CjsFormat {
|
|
|
89
90
|
* @returns {any} JSON-compatible value.
|
|
90
91
|
*/
|
|
91
92
|
ToJSON(value) {
|
|
92
|
-
return
|
|
93
|
+
return toJsonWithByteSummary(value);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
/**
|
|
@@ -152,7 +153,7 @@ class CjsWavFormat extends CjsFormat {
|
|
|
152
153
|
* @returns {any} JSON-compatible value.
|
|
153
154
|
*/
|
|
154
155
|
static toJSON(value) {
|
|
155
|
-
return
|
|
156
|
+
return toJsonWithByteSummary(value);
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsWavFormat.js","sources":["../../../../../src/resource/formats/wav/CjsWavFormat.js"],"sourcesContent":["import { asUint8Array } from \"#utils/bytes\";\nimport { CjsFormat } from \"../../format/CjsFormat.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_AUDIO,\n OUTPUT_JSON,\n OUTPUT_PCM,\n OUTPUT_RAW,\n inspectWithValues,\n probeSupportWithValues,\n isWAV,\n normalizeValues,\n readWithValues,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWavFormat\";\n\n/**\n * WAV audio format profile that inspects RIFF chunk metadata and reads\n * supported WAV bytes into PCM or audio payloads, alongside raw and debug\n * JSON output.\n */\nexport class CjsWavFormat extends CjsFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable WAV format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n super();\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWavFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read WAV bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Read WAV bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect WAV bytes without decoding sample data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} RIFF/WAVE metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot asynchronous WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWavFormat.read(input, options);\n }\n\n /**\n * One-shot WAV inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} RIFF/WAVE metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot WAV support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static probeSupport(input, options = {})\n {\n return probeSupportWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a WAV file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate WAV bytes.\n * @returns {boolean} True when RIFF/WAVE signatures are present.\n */\n static isWAV(input)\n {\n try\n {\n return isWAV(asUint8Array(input, \"Audio input\"));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n AUDIO: OUTPUT_AUDIO,\n PCM: OUTPUT_PCM,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n static OUTPUT_WAV_JSON = \"wavJson\";\n static id = \"wav\";\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static outputs = CjsFormat.defineOutputs({\n audio: { decoded: true, probes: [ \"audio\", \"pcm\" ] },\n pcm: { decoded: true },\n wavJson: { role: \"debug\", probes: [ \"wavJson\", \"raw\" ] },\n raw: { role: \"debug\", default: true, passthrough: true }\n });\n static extensions = Object.freeze([ \".wav\" ]);\n}\n\nexport default CjsWavFormat;\n"],"names":["FORMAT_NAME","CjsWavFormat","CjsFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","probeSupport","probeSupportWithValues","toJSON","isWAV","asUint8Array","Output","Object","freeze","AUDIO","OUTPUT_AUDIO","PCM","OUTPUT_PCM","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_WAV_JSON","id","mediaTypes","outputs","defineOutputs","audio","decoded","probes","pcm","wavJson","role","raw","default","passthrough","extensions"],"mappings":";;;;AAgBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,SAASC,SAAS,CAC3C;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEL,WAAW,CAAC;AAC3F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIS,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEL,WAAW,CAAC;AACvF,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIU,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,OAAOO,cAAc,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACJ,OAAO,CAAC,EAAE,KAAK,CAAC;AAChE,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,MAAMQ,SAASA,CAACF,KAAK,EAAEN,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,OAAO,IAAI,CAACK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I,IAAAA,GAAG,EAAE;AAAED,MAAAA,IAAI,EAAE,OAAO;AAAEE,MAAAA,OAAO,EAAE,IAAI;AAAEC,MAAAA,WAAW,EAAE;AAAK;AAC3D,GAAC,CAAC;EACF,OAAOC,UAAU,GAAGxB,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AACjD;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsWavFormat.js","sources":["../../../../../src/resource/formats/wav/CjsWavFormat.js"],"sourcesContent":["import { asUint8Array } from \"#utils/bytes\";\nimport { CjsFormat } from \"../../format/CjsFormat.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_AUDIO,\n OUTPUT_JSON,\n OUTPUT_PCM,\n OUTPUT_RAW,\n inspectWithValues,\n probeSupportWithValues,\n isWAV,\n normalizeValues,\n readWithValues,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWavFormat\";\n\n/**\n * WAV audio format profile that inspects RIFF chunk metadata and reads\n * supported WAV bytes into PCM or audio payloads, alongside raw and debug\n * JSON output.\n */\nexport class CjsWavFormat extends CjsFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable WAV format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n super();\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWavFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read WAV bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Read WAV bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect WAV bytes without decoding sample data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} RIFF/WAVE metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot asynchronous WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWavFormat.read(input, options);\n }\n\n /**\n * One-shot WAV inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} RIFF/WAVE metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot WAV support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static probeSupport(input, options = {})\n {\n return probeSupportWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a WAV file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate WAV bytes.\n * @returns {boolean} True when RIFF/WAVE signatures are present.\n */\n static isWAV(input)\n {\n try\n {\n return isWAV(asUint8Array(input, \"Audio input\"));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n AUDIO: OUTPUT_AUDIO,\n PCM: OUTPUT_PCM,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n static OUTPUT_WAV_JSON = \"wavJson\";\n static id = \"wav\";\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static outputs = CjsFormat.defineOutputs({\n audio: { decoded: true, probes: [ \"audio\", \"pcm\" ] },\n pcm: { decoded: true },\n wavJson: { role: \"debug\", probes: [ \"wavJson\", \"raw\" ] },\n raw: { role: \"debug\", default: true, passthrough: true }\n });\n static extensions = Object.freeze([ \".wav\" ]);\n}\n\nexport default CjsWavFormat;\n"],"names":["FORMAT_NAME","CjsWavFormat","CjsFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","probeSupport","probeSupportWithValues","toJSON","isWAV","asUint8Array","Output","Object","freeze","AUDIO","OUTPUT_AUDIO","PCM","OUTPUT_PCM","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_WAV_JSON","id","mediaTypes","outputs","defineOutputs","audio","decoded","probes","pcm","wavJson","role","raw","default","passthrough","extensions"],"mappings":";;;;;AAgBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,SAASC,SAAS,CAC3C;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEL,WAAW,CAAC;AAC3F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIS,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEL,WAAW,CAAC;AACvF,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIU,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,OAAOO,cAAc,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACJ,OAAO,CAAC,EAAE,KAAK,CAAC;AAChE,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,MAAMQ,SAASA,CAACF,KAAK,EAAEN,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,OAAO,IAAI,CAACK,IAAI,CAACC,KAAK,EAAEN,OAAO,CAAC;AACpC,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;A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AAEC,MAAAA,WAAW,EAAE;AAAK;AAC3D,GAAC,CAAC;EACF,OAAOC,UAAU,GAAGxB,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AACjD;;;;"}
|
|
@@ -137,20 +137,6 @@ function getAudioMimeType(metadata) {
|
|
|
137
137
|
return "audio/wav";
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
/** Converts a parsed payload into a JSON-safe value for the WAV format reader. */
|
|
141
|
-
function toJsonValue(value) {
|
|
142
|
-
if (value instanceof Uint8Array) return {
|
|
143
|
-
byteLength: value.byteLength
|
|
144
|
-
};
|
|
145
|
-
if (Array.isArray(value)) return value.map(toJsonValue);
|
|
146
|
-
if (value && typeof value === "object") {
|
|
147
|
-
const output = {};
|
|
148
|
-
for (const [key, entry] of Object.entries(value)) output[key] = toJsonValue(entry);
|
|
149
|
-
return output;
|
|
150
|
-
}
|
|
151
|
-
return value;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
140
|
/**
|
|
155
141
|
* Inspects the supplied bytes without decoding their payload for the WAV format
|
|
156
142
|
* reader.
|
|
@@ -336,5 +322,5 @@ function channelLayoutFromMask(mask, channels) {
|
|
|
336
322
|
return layout.length === channels ? layout : layout.length ? layout : "unspecified";
|
|
337
323
|
}
|
|
338
324
|
|
|
339
|
-
export { DEFAULT_VALUES, OUTPUT_AUDIO, OUTPUT_JSON, OUTPUT_PCM, OUTPUT_RAW, inspectBytes, inspectWithValues, isMP3, isWAV, normalizeEmit, normalizeInputType, normalizeValues, probeSupportWithValues, readWithValues
|
|
325
|
+
export { DEFAULT_VALUES, OUTPUT_AUDIO, OUTPUT_JSON, OUTPUT_PCM, OUTPUT_RAW, inspectBytes, inspectWithValues, isMP3, isWAV, normalizeEmit, normalizeInputType, normalizeValues, probeSupportWithValues, readWithValues };
|
|
340
326
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../../../src/resource/formats/wav/core/helpers.js"],"sourcesContent":["import { asUint8Array, readFourCc, readU16LE, readU32LE } from \"#utils/bytes\";\nexport const OUTPUT_AUDIO = \"audio\";\nexport const OUTPUT_PCM = \"pcm\";\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_JSON = \"json\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"\",\n source: \"\"\n});\n\nconst DEBUG_OUTPUTS = Object.freeze({\n wav: \"wavJson\",\n mp3: \"mp3Json\"\n});\n\n/**\n * Normalizes reader options against their supported defaults for the WAV format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsAudioFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = normalizeInputType(values.inputType);\n values.emit = normalizeEmit(values.emit, values.inputType, readerName);\n return values;\n}\n\n/** Normalizes the requested input representation for the WAV format reader. */\nexport function normalizeInputType(inputType)\n{\n return inputType ? String(inputType).replace(/^\\./u, \"\").toLowerCase() : \"\";\n}\n\n/** Normalizes the requested output representation for the WAV format reader. */\nexport function normalizeEmit(emit, inputType, readerName)\n{\n if (emit === undefined || emit === null) return OUTPUT_RAW;\n if (emit === OUTPUT_JSON && inputType) return DEBUG_OUTPUTS[inputType] || OUTPUT_JSON;\n if ([ OUTPUT_AUDIO, OUTPUT_PCM, OUTPUT_RAW, OUTPUT_JSON ].includes(emit)) return emit;\n if (Object.values(DEBUG_OUTPUTS).includes(emit)) return emit;\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);\n}\n\n/** Returns a byte view over the supplied binary input for the WAV format reader. */\r/** Inspects input using normalized format options for the WAV format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = asUint8Array(input, \"Audio input\");\n const metadata = inspectBytes(bytes);\n if (expectedType && metadata.sourceFormat && metadata.sourceFormat !== expectedType)\n {\n throw new TypeError(`CjsAudioFormat: expected ${expectedType}, got ${metadata.sourceFormat}`);\n }\n return {\n payloadType: \"audio\",\n mediaTypes: [ \"audio\" ],\n byteLength: bytes.byteLength,\n sourceFormat: expectedType || values.inputType || metadata.sourceFormat,\n ...metadata\n };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the WAV\n * format reader.\n */\nexport function probeSupportWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n try\n {\n const metadata = inspectWithValues(input, values, expectedType);\n const canEmitPcm = metadata.sourceFormat === \"wav\" && canEmitWavPcm(metadata);\n const mimeType = getAudioMimeType(metadata);\n return {\n format: metadata.sourceFormat,\n source: values.source || \"buffer\",\n supported: metadata.sourceFormat ? (canEmitPcm ? \"full\" : \"partial\") : \"none\",\n confidence: metadata.sourceFormat ? 1 : 0,\n preferredOutput: canEmitPcm ? \"pcm\" : \"raw\",\n reason: metadata.sourceFormat ? \"Container/header recognized.\" : \"Unrecognized audio format.\",\n metadata,\n variants: [\n {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: metadata.audioFormat || metadata.sourceFormat,\n mimeType,\n supported: true,\n },\n {\n kind: \"pcm\",\n codec: metadata.sampleFormat || \"pcm\",\n supported: canEmitPcm,\n payloadType: canEmitPcm ? \"pcm\" : \"pcm\",\n reason: canEmitPcm ? \"\" : \"Only WAV PCM/IEEE-float data chunks can be emitted as PCM.\"\n }\n ],\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: expectedType || values.inputType || \"\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferredOutput: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n/** Reads input using normalized format options for the WAV format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = asUint8Array(input, \"Audio input\");\n const metadata = inspectWithValues(bytes, values, expectedType);\n if (values.emit === OUTPUT_RAW)\n {\n return {\n payloadType: \"raw\",\n sourceFormat: metadata.sourceFormat,\n mimeType: getAudioMimeType(metadata),\n metadata,\n bytes\n };\n }\n if (values.emit === OUTPUT_JSON || values.emit === DEBUG_OUTPUTS[metadata.sourceFormat]) return metadata;\n if ((values.emit === OUTPUT_PCM || values.emit === OUTPUT_AUDIO) && metadata.sourceFormat === \"wav\")\n {\n return readWavPcm(bytes, metadata, values.emit);\n }\n\n const error = new Error(`${metadata.sourceFormat}: emit \"${values.emit}\" is not implemented yet`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = metadata.sourceFormat;\n error.emit = values.emit;\n throw error;\n}\n\nfunction getAudioMimeType(metadata)\n{\n if (metadata.sourceFormat === \"mp3\") return \"audio/mpeg\";\n return \"audio/wav\";\n}\n\n/** Converts a parsed payload into a JSON-safe value for the WAV format reader. */\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array) return { byteLength: value.byteLength };\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\n/**\n * Inspects the supplied bytes without decoding their payload for the WAV format\n * reader.\n */\nexport function inspectBytes(bytes)\n{\n if (isWAV(bytes)) return inspectWAV(bytes);\n if (isMP3(bytes)) return inspectMP3(bytes);\n return { sourceFormat: \"\", audioFormat: \"\" };\n}\n\n/**\n * Reports whether the supplied bytes have a RIFF/WAVE header for the WAV format\n * reader.\n */\nexport function isWAV(bytes)\n{\n return bytes.byteLength >= 12 && readFourCc(bytes, 0) === \"RIFF\" && readFourCc(bytes, 8) === \"WAVE\";\n}\n\n/**\n * Reports whether the supplied bytes have a supported MP3 header for the WAV\n * format reader.\n */\nexport function isMP3(bytes)\n{\n return bytes.byteLength >= 3 &&\n (readFourCc(bytes, 0, 3) === \"ID3\" || (bytes[0] === 0xff && (bytes[1] & 0xe0) === 0xe0));\n}\n\nfunction inspectWAV(bytes)\n{\n let offset = 12;\n const info = {\n sourceFormat: \"wav\",\n audioFormat: \"wav\",\n sampleRate: 0,\n channels: 0,\n bitsPerSample: 0,\n byteRate: 0,\n blockAlign: 0,\n dataOffset: 0,\n dataBytes: 0,\n containerFormatTag: 0,\n validBitsPerSample: 0,\n channelMask: 0,\n channelLayout: \"unspecified\",\n durationSeconds: 0\n };\n while (offset + 8 <= bytes.byteLength)\n {\n const id = readFourCc(bytes, offset), size = readU32LE(bytes, offset + 4), dataOffset = offset + 8;\n if (id === \"fmt \" && dataOffset + 16 <= bytes.byteLength)\n {\n const containerFormatTag = readU16LE(bytes, dataOffset);\n info.containerFormatTag = containerFormatTag;\n info.formatTag = containerFormatTag;\n info.channels = readU16LE(bytes, dataOffset + 2);\n info.sampleRate = readU32LE(bytes, dataOffset + 4);\n info.byteRate = readU32LE(bytes, dataOffset + 8);\n info.blockAlign = readU16LE(bytes, dataOffset + 12);\n info.bitsPerSample = readU16LE(bytes, dataOffset + 14);\n info.validBitsPerSample = info.bitsPerSample;\n if (containerFormatTag === 0xfffe && size >= 40 && dataOffset + 40 <= bytes.byteLength)\n {\n info.validBitsPerSample = readU16LE(bytes, dataOffset + 18) || info.bitsPerSample;\n info.channelMask = readU32LE(bytes, dataOffset + 20);\n info.subFormatTag = readU16LE(bytes, dataOffset + 24);\n info.formatTag = info.subFormatTag;\n info.channelLayout = channelLayoutFromMask(info.channelMask, info.channels);\n }\n info.sampleFormat = wavSampleFormat(info.formatTag, info.bitsPerSample);\n }\n if (id === \"data\")\n {\n info.dataOffset = dataOffset;\n info.dataBytes = size;\n }\n offset = dataOffset + size + (size & 1);\n }\n info.frameCount = info.blockAlign ? Math.floor(info.dataBytes / info.blockAlign) : 0;\n info.durationSeconds = info.sampleRate ? info.frameCount / info.sampleRate : 0;\n return info;\n}\n\nfunction inspectMP3(bytes)\n{\n return {\n sourceFormat: \"mp3\",\n audioFormat: \"mp3\",\n hasId3: readFourCc(bytes, 0, 3) === \"ID3\"\n };\n}\n\n\nfunction canEmitWavPcm(metadata)\n{\n return metadata.dataOffset > 0 &&\n [ 1, 3 ].includes(metadata.formatTag) &&\n metadata.channels > 0 &&\n metadata.sampleRate > 0 &&\n canReadWavSampleWidth(metadata);\n}\n\nfunction readWavPcm(bytes, metadata, emit)\n{\n if (!canEmitWavPcm(metadata))\n {\n const error = new Error(\"wav: only PCM and IEEE-float WAV data chunks can be emitted as PCM\");\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n }\n\n const end = metadata.dataOffset + metadata.dataBytes;\n if (end > bytes.byteLength)\n {\n const error = new Error(\"wav: data chunk is truncated\");\n error.code = \"CJS_FORMAT_TRUNCATED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n }\n\n const data = decodeWavSamples(bytes, metadata, end);\n\n return {\n payloadType: emit === OUTPUT_AUDIO ? OUTPUT_AUDIO : OUTPUT_PCM,\n sourceFormat: \"wav\",\n audioFormat: metadata.sampleFormat,\n sampleFormat: metadata.sampleFormat,\n sampleRate: metadata.sampleRate,\n channels: metadata.channels,\n interleaving: \"interleaved\",\n channelLayout: metadata.channelLayout || \"unspecified\",\n bitsPerSample: metadata.bitsPerSample,\n blockAlign: metadata.blockAlign,\n frameCount: metadata.frameCount,\n durationSeconds: metadata.sampleRate ? metadata.frameCount / metadata.sampleRate : 0,\n metadata,\n data\n };\n}\n\nfunction decodeWavSamples(bytes, metadata, end)\n{\n const bytesPerSample = metadata.bitsPerSample / 8;\n if (!Number.isInteger(bytesPerSample) || bytesPerSample <= 0 || metadata.dataBytes % bytesPerSample !== 0)\n {\n const error = new Error(`wav: unsupported sample width ${metadata.bitsPerSample}`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n }\n\n const sampleCount = metadata.dataBytes / bytesPerSample;\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n if (metadata.formatTag === 1)\n {\n if (metadata.bitsPerSample === 8) return Uint8Array.from(bytes.subarray(metadata.dataOffset, end));\n if (metadata.bitsPerSample === 16)\n {\n const data = new Int16Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getInt16(metadata.dataOffset + i * 2, true);\n return data;\n }\n if (metadata.bitsPerSample === 24)\n {\n const data = new Int32Array(sampleCount);\n for (let i = 0; i < sampleCount; i++)\n {\n const offset = metadata.dataOffset + i * 3;\n let value = view.getUint8(offset) | (view.getUint8(offset + 1) << 8) | (view.getUint8(offset + 2) << 16);\n if (value & 0x800000) value |= 0xff000000;\n data[i] = value;\n }\n return data;\n }\n if (metadata.bitsPerSample === 32)\n {\n const data = new Int32Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getInt32(metadata.dataOffset + i * 4, true);\n return data;\n }\n }\n if (metadata.formatTag === 3 && metadata.bitsPerSample === 32)\n {\n const data = new Float32Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getFloat32(metadata.dataOffset + i * 4, true);\n return data;\n }\n if (metadata.formatTag === 3 && metadata.bitsPerSample === 64)\n {\n const data = new Float64Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getFloat64(metadata.dataOffset + i * 8, true);\n return data;\n }\n\n const error = new Error(`wav: unsupported ${metadata.sampleFormat} sample data`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n}\n\nfunction canReadWavSampleWidth(metadata)\n{\n if (metadata.formatTag === 1) return [ 8, 16, 24, 32 ].includes(metadata.bitsPerSample);\n if (metadata.formatTag === 3) return [ 32, 64 ].includes(metadata.bitsPerSample);\n return false;\n}\n\nfunction wavSampleFormat(formatTag, bitsPerSample)\n{\n if (formatTag === 3) return `float${bitsPerSample}`;\n if (formatTag === 1) return `pcm${bitsPerSample}`;\n return `wav-format-${formatTag}`;\n}\n\nfunction channelLayoutFromMask(mask, channels)\n{\n const names = [\n [ 0x001, \"front-left\" ], [ 0x002, \"front-right\" ], [ 0x004, \"front-center\" ],\n [ 0x008, \"low-frequency\" ], [ 0x010, \"back-left\" ], [ 0x020, \"back-right\" ],\n [ 0x040, \"front-left-of-center\" ], [ 0x080, \"front-right-of-center\" ], [ 0x100, \"back-center\" ],\n [ 0x200, \"side-left\" ], [ 0x400, \"side-right\" ], [ 0x800, \"top-center\" ],\n [ 0x1000, \"top-front-left\" ], [ 0x2000, \"top-front-center\" ], [ 0x4000, \"top-front-right\" ],\n [ 0x8000, \"top-back-left\" ], [ 0x10000, \"top-back-center\" ], [ 0x20000, \"top-back-right\" ]\n ];\n const layout = names.filter(([ bit ]) => mask & bit).map(([ , name ]) => name);\n return layout.length === channels ? layout : layout.length ? layout : \"unspecified\";\n}\n\n"],"names":["OUTPUT_AUDIO","OUTPUT_PCM","OUTPUT_RAW","OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","inputType","source","DEBUG_OUTPUTS","wav","mp3","normalizeValues","base","options","readerName","values","normalizeInputType","normalizeEmit","String","replace","toLowerCase","undefined","includes","TypeError","JSON","stringify","inspectWithValues","input","expectedType","bytes","asUint8Array","metadata","inspectBytes","sourceFormat","payloadType","mediaTypes","byteLength","probeSupportWithValues","canEmitPcm","canEmitWavPcm","mimeType","getAudioMimeType","format","supported","confidence","preferredOutput","reason","variants","kind","codec","audioFormat","sampleFormat","warnings","errors","error","message","readWithValues","readWavPcm","Error","code","toJsonValue","value","Uint8Array","Array","isArray","map","output","key","entry","entries","isWAV","inspectWAV","isMP3","inspectMP3","readFourCc","offset","info","sampleRate","channels","bitsPerSample","byteRate","blockAlign","dataOffset","dataBytes","containerFormatTag","validBitsPerSample","channelMask","channelLayout","durationSeconds","id","size","readU32LE","readU16LE","formatTag","subFormatTag","channelLayoutFromMask","wavSampleFormat","frameCount","Math","floor","hasId3","canReadWavSampleWidth","end","data","decodeWavSamples","interleaving","bytesPerSample","Number","isInteger","sampleCount","view","DataView","buffer","byteOffset","from","subarray","Int16Array","i","getInt16","Int32Array","getUint8","getInt32","Float32Array","getFloat32","Float64Array","getFloat64","mask","names","layout","filter","bit","name","length"],"mappings":";;AACO,MAAMA,YAAY,GAAG;AACrB,MAAMC,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;MAEdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEL,UAAU;AAChBM,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,aAAa,GAAGL,MAAM,CAACC,MAAM,CAAC;AAChCK,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,GAAG,EAAE;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACC,IAAI,GAAGV,cAAc,EAAEW,OAAO,GAAG,EAAE,EAAEC,UAAU,GAAG,gBAAgB,EAClG;AACI,EAAA,MAAMC,MAAM,GAAG;AAAE,IAAA,GAAGb,cAAc;AAAE,IAAA,IAAIU,IAAI,IAAI,EAAE,CAAC;IAAE,IAAIC,OAAO,IAAI,EAAE;GAAG;EACzEE,MAAM,CAACT,SAAS,GAAGU,kBAAkB,CAACD,MAAM,CAACT,SAAS,CAAC;AACvDS,EAAAA,MAAM,CAACV,IAAI,GAAGY,aAAa,CAACF,MAAM,CAACV,IAAI,EAAEU,MAAM,CAACT,SAAS,EAAEQ,UAAU,CAAC;AACtE,EAAA,OAAOC,MAAM;AACjB;;AAEA;AACO,SAASC,kBAAkBA,CAACV,SAAS,EAC5C;AACI,EAAA,OAAOA,SAAS,GAAGY,MAAM,CAACZ,SAAS,CAAC,CAACa,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAACC,WAAW,EAAE,GAAG,EAAE;AAC/E;;AAEA;AACO,SAASH,aAAaA,CAACZ,IAAI,EAAEC,SAAS,EAAEQ,UAAU,EACzD;EACI,IAAIT,IAAI,KAAKgB,SAAS,I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AE,KAAK,EAAE,eAAe,CAAE,EAAE,CAAE,KAAK,EAAE,WAAW,CAAE,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,EAC3E,CAAE,KAAK,EAAE,sBAAsB,CAAE,EAAE,CAAE,KAAK,EAAE,uBAAuB,CAAE,EAAE,CAAE,KAAK,EAAE,aAAa,CAAE,EAC/F,CAAE,KAAK,EAAE,WAAW,CAAE,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,EACxE,CAAE,MAAM,EAAE,gBAAgB,CAAE,EAAE,CAAE,MAAM,EAAE,kBAAkB,CAAE,EAAE,CAAE,MAAM,EAAE,iBAAiB,CAAE,EAC3F,CAAE,MAAM,EAAE,eAAe,CAAE,EAAE,CAAE,OAAO,EAAE,iBAAiB,CAAE,EAAE,CAAE,OAAO,EAAE,gBAAgB,CAAE,CAC7F;EACD,MAAMC,MAAM,GAAGD,KAAK,CAACE,MAAM,CAAC,CAAC,CAAEC,GAAG,CAAE,KAAKJ,IAAI,GAAGI,GAAG,CAAC,CAACjE,GAAG,CAAC,CAAC,GAAIkE,IAAI,CAAE,KAAKA,IAAI,CAAC;AAC9E,EAAA,OAAOH,MAAM,CAACI,MAAM,KAAKtD,QAAQ,GAAGkD,MAAM,GAAGA,MAAM,CAACI,MAAM,GAAGJ,MAAM,GAAG,aAAa;AACvF;;;;"}
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../../src/resource/formats/wav/core/helpers.js"],"sourcesContent":["import { toJsonWithByteSummary as toJsonValue } from \"../../../format/jsonPolicies.js\";\nimport { asUint8Array, readFourCc, readU16LE, readU32LE } from \"#utils/bytes\";\nexport const OUTPUT_AUDIO = \"audio\";\nexport const OUTPUT_PCM = \"pcm\";\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_JSON = \"json\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"\",\n source: \"\"\n});\n\nconst DEBUG_OUTPUTS = Object.freeze({\n wav: \"wavJson\",\n mp3: \"mp3Json\"\n});\n\n/**\n * Normalizes reader options against their supported defaults for the WAV format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsAudioFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = normalizeInputType(values.inputType);\n values.emit = normalizeEmit(values.emit, values.inputType, readerName);\n return values;\n}\n\n/** Normalizes the requested input representation for the WAV format reader. */\nexport function normalizeInputType(inputType)\n{\n return inputType ? String(inputType).replace(/^\\./u, \"\").toLowerCase() : \"\";\n}\n\n/** Normalizes the requested output representation for the WAV format reader. */\nexport function normalizeEmit(emit, inputType, readerName)\n{\n if (emit === undefined || emit === null) return OUTPUT_RAW;\n if (emit === OUTPUT_JSON && inputType) return DEBUG_OUTPUTS[inputType] || OUTPUT_JSON;\n if ([ OUTPUT_AUDIO, OUTPUT_PCM, OUTPUT_RAW, OUTPUT_JSON ].includes(emit)) return emit;\n if (Object.values(DEBUG_OUTPUTS).includes(emit)) return emit;\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);\n}\n\n/** Returns a byte view over the supplied binary input for the WAV format reader. */\n/** Inspects input using normalized format options for the WAV format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = asUint8Array(input, \"Audio input\");\n const metadata = inspectBytes(bytes);\n if (expectedType && metadata.sourceFormat && metadata.sourceFormat !== expectedType)\n {\n throw new TypeError(`CjsAudioFormat: expected ${expectedType}, got ${metadata.sourceFormat}`);\n }\n return {\n payloadType: \"audio\",\n mediaTypes: [ \"audio\" ],\n byteLength: bytes.byteLength,\n sourceFormat: expectedType || values.inputType || metadata.sourceFormat,\n ...metadata\n };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the WAV\n * format reader.\n */\nexport function probeSupportWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n try\n {\n const metadata = inspectWithValues(input, values, expectedType);\n const canEmitPcm = metadata.sourceFormat === \"wav\" && canEmitWavPcm(metadata);\n const mimeType = getAudioMimeType(metadata);\n return {\n format: metadata.sourceFormat,\n source: values.source || \"buffer\",\n supported: metadata.sourceFormat ? (canEmitPcm ? \"full\" : \"partial\") : \"none\",\n confidence: metadata.sourceFormat ? 1 : 0,\n preferredOutput: canEmitPcm ? \"pcm\" : \"raw\",\n reason: metadata.sourceFormat ? \"Container/header recognized.\" : \"Unrecognized audio format.\",\n metadata,\n variants: [\n {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: metadata.audioFormat || metadata.sourceFormat,\n mimeType,\n supported: true,\n },\n {\n kind: \"pcm\",\n codec: metadata.sampleFormat || \"pcm\",\n supported: canEmitPcm,\n payloadType: canEmitPcm ? \"pcm\" : \"pcm\",\n reason: canEmitPcm ? \"\" : \"Only WAV PCM/IEEE-float data chunks can be emitted as PCM.\"\n }\n ],\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: expectedType || values.inputType || \"\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferredOutput: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n/** Reads input using normalized format options for the WAV format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = asUint8Array(input, \"Audio input\");\n const metadata = inspectWithValues(bytes, values, expectedType);\n if (values.emit === OUTPUT_RAW)\n {\n return {\n payloadType: \"raw\",\n sourceFormat: metadata.sourceFormat,\n mimeType: getAudioMimeType(metadata),\n metadata,\n bytes\n };\n }\n if (values.emit === OUTPUT_JSON || values.emit === DEBUG_OUTPUTS[metadata.sourceFormat]) return metadata;\n if ((values.emit === OUTPUT_PCM || values.emit === OUTPUT_AUDIO) && metadata.sourceFormat === \"wav\")\n {\n return readWavPcm(bytes, metadata, values.emit);\n }\n\n const error = new Error(`${metadata.sourceFormat}: emit \"${values.emit}\" is not implemented yet`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = metadata.sourceFormat;\n error.emit = values.emit;\n throw error;\n}\n\nfunction getAudioMimeType(metadata)\n{\n if (metadata.sourceFormat === \"mp3\") return \"audio/mpeg\";\n return \"audio/wav\";\n}\n\n/** Converts a parsed payload into a JSON-safe value for the WAV format reader. */\n/** The shared JSON policy for this reader, under the name its callers use. */\nexport { toJsonValue };\n\n/**\n * Inspects the supplied bytes without decoding their payload for the WAV format\n * reader.\n */\nexport function inspectBytes(bytes)\n{\n if (isWAV(bytes)) return inspectWAV(bytes);\n if (isMP3(bytes)) return inspectMP3(bytes);\n return { sourceFormat: \"\", audioFormat: \"\" };\n}\n\n/**\n * Reports whether the supplied bytes have a RIFF/WAVE header for the WAV format\n * reader.\n */\nexport function isWAV(bytes)\n{\n return bytes.byteLength >= 12 && readFourCc(bytes, 0) === \"RIFF\" && readFourCc(bytes, 8) === \"WAVE\";\n}\n\n/**\n * Reports whether the supplied bytes have a supported MP3 header for the WAV\n * format reader.\n */\nexport function isMP3(bytes)\n{\n return bytes.byteLength >= 3 &&\n (readFourCc(bytes, 0, 3) === \"ID3\" || (bytes[0] === 0xff && (bytes[1] & 0xe0) === 0xe0));\n}\n\nfunction inspectWAV(bytes)\n{\n let offset = 12;\n const info = {\n sourceFormat: \"wav\",\n audioFormat: \"wav\",\n sampleRate: 0,\n channels: 0,\n bitsPerSample: 0,\n byteRate: 0,\n blockAlign: 0,\n dataOffset: 0,\n dataBytes: 0,\n containerFormatTag: 0,\n validBitsPerSample: 0,\n channelMask: 0,\n channelLayout: \"unspecified\",\n durationSeconds: 0\n };\n while (offset + 8 <= bytes.byteLength)\n {\n const id = readFourCc(bytes, offset), size = readU32LE(bytes, offset + 4), dataOffset = offset + 8;\n if (id === \"fmt \" && dataOffset + 16 <= bytes.byteLength)\n {\n const containerFormatTag = readU16LE(bytes, dataOffset);\n info.containerFormatTag = containerFormatTag;\n info.formatTag = containerFormatTag;\n info.channels = readU16LE(bytes, dataOffset + 2);\n info.sampleRate = readU32LE(bytes, dataOffset + 4);\n info.byteRate = readU32LE(bytes, dataOffset + 8);\n info.blockAlign = readU16LE(bytes, dataOffset + 12);\n info.bitsPerSample = readU16LE(bytes, dataOffset + 14);\n info.validBitsPerSample = info.bitsPerSample;\n if (containerFormatTag === 0xfffe && size >= 40 && dataOffset + 40 <= bytes.byteLength)\n {\n info.validBitsPerSample = readU16LE(bytes, dataOffset + 18) || info.bitsPerSample;\n info.channelMask = readU32LE(bytes, dataOffset + 20);\n info.subFormatTag = readU16LE(bytes, dataOffset + 24);\n info.formatTag = info.subFormatTag;\n info.channelLayout = channelLayoutFromMask(info.channelMask, info.channels);\n }\n info.sampleFormat = wavSampleFormat(info.formatTag, info.bitsPerSample);\n }\n if (id === \"data\")\n {\n info.dataOffset = dataOffset;\n info.dataBytes = size;\n }\n offset = dataOffset + size + (size & 1);\n }\n info.frameCount = info.blockAlign ? Math.floor(info.dataBytes / info.blockAlign) : 0;\n info.durationSeconds = info.sampleRate ? info.frameCount / info.sampleRate : 0;\n return info;\n}\n\nfunction inspectMP3(bytes)\n{\n return {\n sourceFormat: \"mp3\",\n audioFormat: \"mp3\",\n hasId3: readFourCc(bytes, 0, 3) === \"ID3\"\n };\n}\n\n\nfunction canEmitWavPcm(metadata)\n{\n return metadata.dataOffset > 0 &&\n [ 1, 3 ].includes(metadata.formatTag) &&\n metadata.channels > 0 &&\n metadata.sampleRate > 0 &&\n canReadWavSampleWidth(metadata);\n}\n\nfunction readWavPcm(bytes, metadata, emit)\n{\n if (!canEmitWavPcm(metadata))\n {\n const error = new Error(\"wav: only PCM and IEEE-float WAV data chunks can be emitted as PCM\");\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n }\n\n const end = metadata.dataOffset + metadata.dataBytes;\n if (end > bytes.byteLength)\n {\n const error = new Error(\"wav: data chunk is truncated\");\n error.code = \"CJS_FORMAT_TRUNCATED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n }\n\n const data = decodeWavSamples(bytes, metadata, end);\n\n return {\n payloadType: emit === OUTPUT_AUDIO ? OUTPUT_AUDIO : OUTPUT_PCM,\n sourceFormat: \"wav\",\n audioFormat: metadata.sampleFormat,\n sampleFormat: metadata.sampleFormat,\n sampleRate: metadata.sampleRate,\n channels: metadata.channels,\n interleaving: \"interleaved\",\n channelLayout: metadata.channelLayout || \"unspecified\",\n bitsPerSample: metadata.bitsPerSample,\n blockAlign: metadata.blockAlign,\n frameCount: metadata.frameCount,\n durationSeconds: metadata.sampleRate ? metadata.frameCount / metadata.sampleRate : 0,\n metadata,\n data\n };\n}\n\nfunction decodeWavSamples(bytes, metadata, end)\n{\n const bytesPerSample = metadata.bitsPerSample / 8;\n if (!Number.isInteger(bytesPerSample) || bytesPerSample <= 0 || metadata.dataBytes % bytesPerSample !== 0)\n {\n const error = new Error(`wav: unsupported sample width ${metadata.bitsPerSample}`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n }\n\n const sampleCount = metadata.dataBytes / bytesPerSample;\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n if (metadata.formatTag === 1)\n {\n if (metadata.bitsPerSample === 8) return Uint8Array.from(bytes.subarray(metadata.dataOffset, end));\n if (metadata.bitsPerSample === 16)\n {\n const data = new Int16Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getInt16(metadata.dataOffset + i * 2, true);\n return data;\n }\n if (metadata.bitsPerSample === 24)\n {\n const data = new Int32Array(sampleCount);\n for (let i = 0; i < sampleCount; i++)\n {\n const offset = metadata.dataOffset + i * 3;\n let value = view.getUint8(offset) | (view.getUint8(offset + 1) << 8) | (view.getUint8(offset + 2) << 16);\n if (value & 0x800000) value |= 0xff000000;\n data[i] = value;\n }\n return data;\n }\n if (metadata.bitsPerSample === 32)\n {\n const data = new Int32Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getInt32(metadata.dataOffset + i * 4, true);\n return data;\n }\n }\n if (metadata.formatTag === 3 && metadata.bitsPerSample === 32)\n {\n const data = new Float32Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getFloat32(metadata.dataOffset + i * 4, true);\n return data;\n }\n if (metadata.formatTag === 3 && metadata.bitsPerSample === 64)\n {\n const data = new Float64Array(sampleCount);\n for (let i = 0; i < sampleCount; i++) data[i] = view.getFloat64(metadata.dataOffset + i * 8, true);\n return data;\n }\n\n const error = new Error(`wav: unsupported ${metadata.sampleFormat} sample data`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = metadata.sourceFormat;\n throw error;\n}\n\nfunction canReadWavSampleWidth(metadata)\n{\n if (metadata.formatTag === 1) return [ 8, 16, 24, 32 ].includes(metadata.bitsPerSample);\n if (metadata.formatTag === 3) return [ 32, 64 ].includes(metadata.bitsPerSample);\n return false;\n}\n\nfunction wavSampleFormat(formatTag, bitsPerSample)\n{\n if (formatTag === 3) return `float${bitsPerSample}`;\n if (formatTag === 1) return `pcm${bitsPerSample}`;\n return `wav-format-${formatTag}`;\n}\n\nfunction channelLayoutFromMask(mask, channels)\n{\n const names = [\n [ 0x001, \"front-left\" ], [ 0x002, \"front-right\" ], [ 0x004, \"front-center\" ],\n [ 0x008, \"low-frequency\" ], [ 0x010, \"back-left\" ], [ 0x020, \"back-right\" ],\n [ 0x040, \"front-left-of-center\" ], [ 0x080, \"front-right-of-center\" ], [ 0x100, \"back-center\" ],\n [ 0x200, \"side-left\" ], [ 0x400, \"side-right\" ], [ 0x800, \"top-center\" ],\n [ 0x1000, \"top-front-left\" ], [ 0x2000, \"top-front-center\" ], [ 0x4000, \"top-front-right\" ],\n [ 0x8000, \"top-back-left\" ], [ 0x10000, \"top-back-center\" ], [ 0x20000, \"top-back-right\" ]\n ];\n const layout = names.filter(([ bit ]) => mask & bit).map(([ , name ]) => name);\n return layout.length === channels ? layout : layout.length ? layout : \"unspecified\";\n}\n\n"],"names":["OUTPUT_AUDIO","OUTPUT_PCM","OUTPUT_RAW","OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","inputType","source","DEBUG_OUTPUTS","wav","mp3","normalizeValues","base","options","readerName","values","normalizeInputType","normalizeEmit","String","replace","toLowerCase","undefined","includes","TypeError","JSON","stringify","inspectWithValues","input","expectedType","bytes","asUint8Array","metadata","inspectBytes","sourceFormat","payloadType","mediaTypes","byteLength","probeSupportWithValues","canEmitPcm","canEmitWavPcm","mimeType","getAudioMimeType","format","supported","confidence","preferredOutput","reason","variants","kind","codec","audioFormat","sampleFormat","warnings","errors","error","message","readWithValues","readWavPcm","Error","code","isWAV","inspectWAV","isMP3","inspectMP3","readFourCc","offset","info","sampleRate","channels","bitsPerSample","byteRate","blockAlign","dataOffset","dataBytes","containerFormatTag","validBitsPerSample","channelMask","channelLayout","durationSeconds","id","size","readU32LE","readU16LE","formatTag","subFormatTag","channelLayoutFromMask","wavSampleFormat","frameCount","Math","floor","hasId3","canReadWavSampleWidth","end","data","decodeWavSamples","interleaving","bytesPerSample","Number","isInteger","sampleCount","view","DataView","buffer","byteOffset","Uint8Array","from","subarray","Int16Array","i","getInt16","Int32Array","value","getUint8","getInt32","Float32Array","getFloat32","Float64Array","getFloat64","mask","names","layout","filter","bit","map","name","length"],"mappings":";;AAEO,MAAMA,YAAY,GAAG;AACrB,MAAMC,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;MAEdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEL,UAAU;AAChBM,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,aAAa,GAAGL,MAAM,CAACC,MAAM,CAAC;AAChCK,EAAAA,GAAG,EAAE,SAAS;AACdC,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AACiC,IAAI,EAAElD,QAAQ,EAC7C;EACI,MAAMmD,KAAK,GAAG,CACV,CAAE,KAAK,EAAE,YAAY,CAAE,EAAE,CAAE,KAAK,EAAE,aAAa,CAAE,EAAE,CAAE,KAAK,EAAE,cAAc,CAAE,EAC5E,CAAE,KAAK,EAAE,eAAe,CAAE,EAAE,CAAE,KAAK,EAAE,WAAW,CAAE,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,EAC3E,CAAE,KAAK,EAAE,sBAAsB,CAAE,EAAE,CAAE,KAAK,EAAE,uBAAuB,CAAE,EAAE,CAAE,KAAK,EAAE,aAAa,CAAE,EAC/F,CAAE,KAAK,EAAE,WAAW,CAAE,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,EAAE,CAAE,KAAK,EAAE,YAAY,CAAE,EACxE,CAAE,MAAM,EAAE,gBAAgB,CAAE,EAAE,CAAE,MAAM,EAAE,kBAAkB,CAAE,EAAE,CAAE,MAAM,EAAE,iBAAiB,CAAE,EAC3F,CAAE,MAAM,EAAE,eAAe,CAAE,EAAE,CAAE,OAAO,EAAE,iBAAiB,CAAE,EAAE,CAAE,OAAO,EAAE,gBAAgB,CAAE,CAC7F;EACD,MAAMC,MAAM,GAAGD,KAAK,CAACE,MAAM,CAAC,CAAC,CAAEC,GAAG,CAAE,KAAKJ,IAAI,GAAGI,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,GAAIC,IAAI,CAAE,KAAKA,IAAI,CAAC;AAC9E,EAAA,OAAOJ,MAAM,CAACK,MAAM,KAAKzD,QAAQ,GAAGoD,MAAM,GAAGA,MAAM,CAACK,MAAM,GAAGL,MAAM,GAAG,aAAa;AACvF;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CjsFormat } from '../../format/CjsFormat.js';
|
|
2
|
-
import { DEFAULT_VALUES, normalizeValues, emitGlslWithOptions,
|
|
2
|
+
import { DEFAULT_VALUES, normalizeValues, emitGlslWithOptions, isWebglEffectContainer, OUTPUT_JSON } from './core/helpers.js';
|
|
3
3
|
import { buildEffectPackage } from './core/effectPackage.js';
|
|
4
4
|
import { readGlslEffectContainer } from './core/readGlslEffectContainer.js';
|
|
5
5
|
import { inspectGlslEffectContainer } from './core/inspectGlslEffectContainer.js';
|
|
6
|
+
import { toJsonWithCollections } from '../../format/jsonPolicies.js';
|
|
6
7
|
|
|
7
8
|
const FORMAT_NAME = "CjsWebglFormat";
|
|
8
9
|
|
|
@@ -109,7 +110,7 @@ class CjsWebglFormat extends CjsFormat {
|
|
|
109
110
|
* @returns {any} Plain JSON-compatible data.
|
|
110
111
|
*/
|
|
111
112
|
ToJSON(value) {
|
|
112
|
-
return
|
|
113
|
+
return toJsonWithCollections(value);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
/**
|
|
@@ -178,7 +179,7 @@ class CjsWebglFormat extends CjsFormat {
|
|
|
178
179
|
* @returns {any} Plain JSON-compatible data.
|
|
179
180
|
*/
|
|
180
181
|
static toJSON(value) {
|
|
181
|
-
return
|
|
182
|
+
return toJsonWithCollections(value);
|
|
182
183
|
}
|
|
183
184
|
static OUTPUT_JSON = OUTPUT_JSON;
|
|
184
185
|
static id = "webgl";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsWebglFormat.js","sources":["../../../../../src/resource/formats/webgl/CjsWebglFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\r\n/**\r\n * Exposed CarbonEngineJS-facing WebGL format class.\r\n *\r\n * Keep this file small and reviewable: container decoding lives in\r\n * core/readGlslEffectContainer.js, summarising in\r\n * core/inspectGlslEffectContainer.js, the DXBC-to-GLSL ES 3.00 emitter under\r\n * core/glsl, and option normalization in core/helpers.js.\r\n */\r\n\r\nimport {\r\n DEFAULT_VALUES,\r\n OUTPUT_JSON,\r\n emitGlslWithOptions,\r\n isWebglEffectContainer,\r\n normalizeValues,\r\n toJsonValue\r\n} from \"./core/helpers.js\";\r\nimport { buildEffectPackage } from \"./core/effectPackage.js\";\r\nimport { readGlslEffectContainer } from \"./core/readGlslEffectContainer.js\";\r\nimport { inspectGlslEffectContainer } from \"./core/inspectGlslEffectContainer.js\";\r\n\r\nconst FORMAT_NAME = \"CjsWebglFormat\";\r\n\r\n/**\r\n * CarbonEngineJS-facing format surface for `.carbonwebgl` WebGL shader packages, and\r\n * a DXBC -> GLSL ES 3.00 emitter for the WebGL2 vertex/pixel/map-style-compute\r\n * stages ccpwgl targets.\r\n *\r\n * The Cjs prefix marks this as a JavaScript format/construction boundary. A\r\n * WebGL effect is a stock Carbon effect container whose stored programs are\r\n * GLSL ES 3.00 - the same file shape Carbon ships for its own backends, and the\r\n * same one WebGPU emits with WGSL. `Read` decodes one into stage and shader\r\n * records; `Inspect` is a cheap structural summary; `BuildEffect` translates a\r\n * compiled Tr2 effect into one; `EmitGlsl` translates a single DXBC stage.\r\n */\r\nexport class CjsWebglFormat extends CjsFormat\r\n{\r\n\r\n #emit = DEFAULT_VALUES.emit;\r\n #source = DEFAULT_VALUES.source;\r\n\r\n /**\r\n * Create a reusable format profile.\r\n *\r\n * @param {object} [options] Default format values.\r\n */\r\n constructor(options = {})\r\n {\r\n super();\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Set format values for this reusable profile.\r\n *\r\n * @param {object} [options] Values to merge into the profile.\r\n * @returns {CjsWebglFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\r\n\r\n this.#emit = values.emit;\r\n this.#source = values.source;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Get this profile's current values, optionally with per-call overrides.\r\n *\r\n * @param {object} [options] Optional values to merge into a copy.\r\n * @returns {object} A copy of the effective values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues({\r\n emit: this.#emit,\r\n source: this.#source\r\n }, options, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Decode an effect container into stage and shader records.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Stage graph in the completeness rules' vocabulary.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readGlslEffectContainer(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Summarise an effect container without decoding every body's records.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Plain summary data.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectGlslEffectContainer(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Translates one DXBC vertex/pixel/map-style-compute stage into GLSL ES 3.00.\r\n *\r\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} dxbcBytes DXBC container bytes.\r\n * @param {object} [options] Combined ccpwgl-profile/emit options. See {@link CjsWebglFormat.emitGlsl}.\r\n * @returns {object} GLSL text plus the IO contract the packaging layer records.\r\n */\r\n EmitGlsl(dxbcBytes, options = {})\r\n {\r\n return emitGlslWithOptions(dxbcBytes, options);\r\n }\r\n\r\n /**\r\n * Builds a complete effect container from compiled Tr2 effect bytes.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Selection, provenance, and emitter policy.\r\n * @returns {object} Package bytes plus inspection and qualification records.\r\n */\r\n BuildEffect(input, options = {})\r\n {\r\n return buildEffectPackage(input, options);\r\n }\r\n\r\n /**\r\n * Instance JSON-compatible conversion.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Static payload sniff. Static methods use camelCase by convention.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate bytes.\r\n * @returns {boolean} True when the payload has the container shape.\r\n */\r\n static isWebglEffectContainer(input)\r\n {\r\n return isWebglEffectContainer(input);\r\n }\r\n\r\n /**\r\n * Static one-shot container decode.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Stage graph in the completeness rules' vocabulary.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readGlslEffectContainer(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static one-shot inspection.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Plain summary data.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectGlslEffectContainer(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static one-shot DXBC-to-GLSL emission.\r\n *\r\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} dxbcBytes DXBC container bytes.\r\n * @param {object} [options] Combined ccpwgl-profile/emit options: `constantBufferStyle`\r\n * (`\"array\"` (default) uniform `vec4[]` for ccpwgl's uniform4fv path, or `\"std140\"`),\r\n * `pixelConstantBufferRemap` (default `{ 0: 7 }`, pixel-stage cb slot renames),\r\n * `samplerName(register, stageName)` (naming function), `vertexStructuredCapacity`\r\n * (default 69, bone-array element capacity), `dataTextureWidth` (default 2048),\r\n * `pairVaryings` (per-call varying zero-fill list), `source` (per-call error-detail name).\r\n * @returns {object} GLSL text plus the IO contract the packaging layer records.\r\n */\r\n static emitGlsl(dxbcBytes, options = {})\r\n {\r\n return emitGlslWithOptions(dxbcBytes, options);\r\n }\r\n\r\n /**\r\n * Static whole-effect container builder.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Selection, provenance, and emitter policy.\r\n * @returns {object} Package bytes plus inspection and qualification records.\r\n */\r\n static buildEffect(input, options = {})\r\n {\r\n return buildEffectPackage(input, options);\r\n }\r\n\r\n /**\r\n * Static JSON-compatible conversion.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n static OUTPUT_JSON = OUTPUT_JSON;\r\n static id = \"webgl\";\r\n static mediaTypes = Object.freeze([ \"shader\" ]);\r\n static outputs = CjsFormat.defineOutputs({\r\n json: { default: true, decoded: true }\r\n });\r\n static extensions = Object.freeze([]);\r\n static packageVersion = \"0.2.0\";\r\n\r\n}\r\n\r\nexport default CjsWebglFormat;\r\n"],"names":["FORMAT_NAME","CjsWebglFormat","CjsFormat","DEFAULT_VALUES","emit","source","constructor","options","SetValues","values","normalizeValues","GetValues","Read","input","readGlslEffectContainer","Inspect","inspectGlslEffectContainer","EmitGlsl","dxbcBytes","emitGlslWithOptions","BuildEffect","buildEffectPackage","ToJSON","value","toJsonValue","isWebglEffectContainer","read","inspect","emitGlsl","buildEffect","toJSON","OUTPUT_JSON","id","mediaTypes","Object","freeze","outputs","defineOutputs","json","default","decoded","extensions","packageVersion"],"mappings":";;;;;;AAsBA,MAAMA,WAAW,GAAG,gBAAgB;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,SAASC,SAAS,CAC7C;AAEI,EAAA,KAAK,GAAGC,cAAc,CAACC,IAAI;AAC3B,EAAA,OAAO,GAAGD,cAAc,CAACE,MAAM;;AAE/B;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,MAAME,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACC,SAAS,EAAE,EAAEJ,OAAO,EAAEP,WAAW,CAAC;AAEtE,IA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ACmC,aAAa,CAAC;AACrCC,IAAAA,IAAI,EAAE;AAAEC,MAAAA,OAAO,EAAE,IAAI;AAAEC,MAAAA,OAAO,EAAE;AAAK;AACzC,GAAC,CAAC;AACF,EAAA,OAAOC,UAAU,GAAGP,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;EACrC,OAAOO,cAAc,GAAG,OAAO;AAEnC;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsWebglFormat.js","sources":["../../../../../src/resource/formats/webgl/CjsWebglFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\r\n/**\r\n * Exposed CarbonEngineJS-facing WebGL format class.\r\n *\r\n * Keep this file small and reviewable: container decoding lives in\r\n * core/readGlslEffectContainer.js, summarising in\r\n * core/inspectGlslEffectContainer.js, the DXBC-to-GLSL ES 3.00 emitter under\r\n * core/glsl, and option normalization in core/helpers.js.\r\n */\r\n\r\nimport {\r\n DEFAULT_VALUES,\r\n OUTPUT_JSON,\r\n emitGlslWithOptions,\r\n isWebglEffectContainer,\r\n normalizeValues,\r\n toJsonValue\r\n} from \"./core/helpers.js\";\r\nimport { buildEffectPackage } from \"./core/effectPackage.js\";\r\nimport { readGlslEffectContainer } from \"./core/readGlslEffectContainer.js\";\r\nimport { inspectGlslEffectContainer } from \"./core/inspectGlslEffectContainer.js\";\r\n\r\nconst FORMAT_NAME = \"CjsWebglFormat\";\r\n\r\n/**\r\n * CarbonEngineJS-facing format surface for `.carbonwebgl` WebGL shader packages, and\r\n * a DXBC -> GLSL ES 3.00 emitter for the WebGL2 vertex/pixel/map-style-compute\r\n * stages ccpwgl targets.\r\n *\r\n * The Cjs prefix marks this as a JavaScript format/construction boundary. A\r\n * WebGL effect is a stock Carbon effect container whose stored programs are\r\n * GLSL ES 3.00 - the same file shape Carbon ships for its own backends, and the\r\n * same one WebGPU emits with WGSL. `Read` decodes one into stage and shader\r\n * records; `Inspect` is a cheap structural summary; `BuildEffect` translates a\r\n * compiled Tr2 effect into one; `EmitGlsl` translates a single DXBC stage.\r\n */\r\nexport class CjsWebglFormat extends CjsFormat\r\n{\r\n\r\n #emit = DEFAULT_VALUES.emit;\r\n #source = DEFAULT_VALUES.source;\r\n\r\n /**\r\n * Create a reusable format profile.\r\n *\r\n * @param {object} [options] Default format values.\r\n */\r\n constructor(options = {})\r\n {\r\n super();\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Set format values for this reusable profile.\r\n *\r\n * @param {object} [options] Values to merge into the profile.\r\n * @returns {CjsWebglFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\r\n\r\n this.#emit = values.emit;\r\n this.#source = values.source;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Get this profile's current values, optionally with per-call overrides.\r\n *\r\n * @param {object} [options] Optional values to merge into a copy.\r\n * @returns {object} A copy of the effective values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues({\r\n emit: this.#emit,\r\n source: this.#source\r\n }, options, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Decode an effect container into stage and shader records.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Stage graph in the completeness rules' vocabulary.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readGlslEffectContainer(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Summarise an effect container without decoding every body's records.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Plain summary data.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectGlslEffectContainer(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Translates one DXBC vertex/pixel/map-style-compute stage into GLSL ES 3.00.\r\n *\r\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} dxbcBytes DXBC container bytes.\r\n * @param {object} [options] Combined ccpwgl-profile/emit options. See {@link CjsWebglFormat.emitGlsl}.\r\n * @returns {object} GLSL text plus the IO contract the packaging layer records.\r\n */\r\n EmitGlsl(dxbcBytes, options = {})\r\n {\r\n return emitGlslWithOptions(dxbcBytes, options);\r\n }\r\n\r\n /**\r\n * Builds a complete effect container from compiled Tr2 effect bytes.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Selection, provenance, and emitter policy.\r\n * @returns {object} Package bytes plus inspection and qualification records.\r\n */\r\n BuildEffect(input, options = {})\r\n {\r\n return buildEffectPackage(input, options);\r\n }\r\n\r\n /**\r\n * Instance JSON-compatible conversion.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Static payload sniff. Static methods use camelCase by convention.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate bytes.\r\n * @returns {boolean} True when the payload has the container shape.\r\n */\r\n static isWebglEffectContainer(input)\r\n {\r\n return isWebglEffectContainer(input);\r\n }\r\n\r\n /**\r\n * Static one-shot container decode.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Stage graph in the completeness rules' vocabulary.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readGlslEffectContainer(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static one-shot inspection.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Plain summary data.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectGlslEffectContainer(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static one-shot DXBC-to-GLSL emission.\r\n *\r\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} dxbcBytes DXBC container bytes.\r\n * @param {object} [options] Combined ccpwgl-profile/emit options: `constantBufferStyle`\r\n * (`\"array\"` (default) uniform `vec4[]` for ccpwgl's uniform4fv path, or `\"std140\"`),\r\n * `pixelConstantBufferRemap` (default `{ 0: 7 }`, pixel-stage cb slot renames),\r\n * `samplerName(register, stageName)` (naming function), `vertexStructuredCapacity`\r\n * (default 69, bone-array element capacity), `dataTextureWidth` (default 2048),\r\n * `pairVaryings` (per-call varying zero-fill list), `source` (per-call error-detail name).\r\n * @returns {object} GLSL text plus the IO contract the packaging layer records.\r\n */\r\n static emitGlsl(dxbcBytes, options = {})\r\n {\r\n return emitGlslWithOptions(dxbcBytes, options);\r\n }\r\n\r\n /**\r\n * Static whole-effect container builder.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Selection, provenance, and emitter policy.\r\n * @returns {object} Package bytes plus inspection and qualification records.\r\n */\r\n static buildEffect(input, options = {})\r\n {\r\n return buildEffectPackage(input, options);\r\n }\r\n\r\n /**\r\n * Static JSON-compatible conversion.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n static OUTPUT_JSON = OUTPUT_JSON;\r\n static id = \"webgl\";\r\n static mediaTypes = Object.freeze([ \"shader\" ]);\r\n static outputs = CjsFormat.defineOutputs({\r\n json: { default: true, decoded: true }\r\n });\r\n static extensions = Object.freeze([]);\r\n static packageVersion = \"0.2.0\";\r\n\r\n}\r\n\r\nexport default CjsWebglFormat;\r\n"],"names":["FORMAT_NAME","CjsWebglFormat","CjsFormat","DEFAULT_VALUES","emit","source","constructor","options","SetValues","values","normalizeValues","GetValues","Read","input","readGlslEffectContainer","Inspect","inspectGlslEffectContainer","EmitGlsl","dxbcBytes","emitGlslWithOptions","BuildEffect","buildEffectPackage","ToJSON","value","toJsonValue","isWebglEffectContainer","read","inspect","emitGlsl","buildEffect","toJSON","OUTPUT_JSON","id","mediaTypes","Object","freeze","outputs","defineOutputs","json","default","decoded","extensions","packageVersion"],"mappings":";;;;;;;AAsBA,MAAMA,WAAW,GAAG,gBAAgB;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,SAASC,SAAS,CAC7C;AAEI,EAAA,KAAK,GAAGC,cAAc,CAACC,IAAI;AAC3B,EAAA,OAAO,GAAGD,cAAc,CAACE,MAAM;;AAE/B;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,MAAME,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACC,SAAS,EAAE,EAAEJ,OAAO,EAAEP,WAAW,CAAC;AAEtE,IAAA,IAAI,CAAC,KAAK,GAAGS,MAAM,CAACL,IAAI;AACxB,IAAA,IAAI,CAAC,OAAO,GAAGK,MAAM,CAACJ,MAAM;AAE5B,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIM,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOG,eAAe,CAAC;AACnBN,MAAAA,IAAI,EAAE,IAAI,CAAC,KAAK;MAChBC,MAAM,EAAE,IAAI,CAAC;AACjB,KAAC,EAAEE,OAAO,EAAEP,WAAW,CAAC;AAC5B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIY,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EACxB;IACI,OAAOO,uBAAuB,CAACD,K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I,OAAO,EAAEP,WAAW,CAAC,CAAC;AACnG,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,OAAO4B,QAAQA,CAACV,SAAS,EAAEX,OAAO,GAAG,EAAE,EACvC;AACI,IAAA,OAAOY,mBAAmB,CAACD,SAAS,EAAEX,OAAO,CAAC;AAClD,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,OAAOsB,WAAWA,CAAChB,KAAK,EAAEN,OAAO,GAAG,EAAE,EACtC;AACI,IAAA,OAAOc,kBAAkB,CAACR,KAAK,EAAEN,OAAO,CAAC;AAC7C,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;EACI,OAAOuB,MAAMA,CAACP,KAAK,EACnB;IACI,OAAOC,qBAAW,CAACD,KAAK,CAAC;AAC7B,EAAA;EAEA,OAAOQ,WAAW,GAAGA,WAAW;EAChC,OAAOC,EAAE,GAAG,OAAO;EACnB,OAAOC,UAAU,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,QAAQ,CAAE,CAAC;AAC/C,EAAA,OAAOC,OAAO,GAAGlC,SAAS,CAACmC,aAAa,CAAC;AACrCC,IAAAA,IAAI,EAAE;AAAEC,MAAAA,OAAO,EAAE,IAAI;AAAEC,MAAAA,OAAO,EAAE;AAAK;AACzC,GAAC,CAAC;AACF,EAAA,OAAOC,UAAU,GAAGP,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;EACrC,OAAOO,cAAc,GAAG,OAAO;AAEnC;;;;"}
|
|
@@ -139,6 +139,12 @@ class DxbcGlslEmitter {
|
|
|
139
139
|
//
|
|
140
140
|
// "reversed" (default) z_clip [w, 0] -> gl_Position.z = w - 2z
|
|
141
141
|
// "forward" z_clip [0, w] -> gl_Position.z = 2z - w
|
|
142
|
+
// "none" no fixup: clip z passes through unchanged,
|
|
143
|
+
// for a consumer whose clip range already is
|
|
144
|
+
// the D3D [0, w] one (EXT_clip_control
|
|
145
|
+
// ZERO_TO_ONE), where z/w is the window depth
|
|
146
|
+
// and the float round trip through [-1, 1]
|
|
147
|
+
// that costs reversed-Z its precision is gone
|
|
142
148
|
//
|
|
143
149
|
// The default is "reversed" because that is what the shaders this
|
|
144
150
|
// emitter translates were compiled against, and it is a property of
|
|
@@ -156,13 +162,38 @@ class DxbcGlslEmitter {
|
|
|
156
162
|
// whole observable difference, and it is what makes the wrong
|
|
157
163
|
// choice so hard to see.
|
|
158
164
|
depthRange: "reversed",
|
|
165
|
+
// WebGL platform adaptation, not a Carbon concept: D3D's framebuffer
|
|
166
|
+
// origin is top-left and GL's is bottom-left, so every shader that
|
|
167
|
+
// turns a projected position into a screen coordinate the D3D way
|
|
168
|
+
// (`* (0.5, -0.5) + 0.5`) or reads SV_Position.y samples the
|
|
169
|
+
// vertically mirrored texel of a render target in GL.
|
|
170
|
+
//
|
|
171
|
+
// `true` appends CCP's own gles2 tail to every vertex stage that
|
|
172
|
+
// writes a position, ahead of the depth fixup:
|
|
173
|
+
//
|
|
174
|
+
// gl_Position.xy += ssyf.xy * gl_Position.w;
|
|
175
|
+
// gl_Position.y *= ssyf.z;
|
|
176
|
+
//
|
|
177
|
+
// with `uniform vec3 ssyf`. The CONSUMER owns the value per render
|
|
178
|
+
// target: `(0, 0, -1)` while drawing into an offscreen target (so it
|
|
179
|
+
// is stored top-down, as D3D stores it) and `(0, 0, 1)` otherwise,
|
|
180
|
+
// flipping once at present. Same name and form as CCP's shipped
|
|
181
|
+
// gles2 bodies, so one uniform serves both shader families.
|
|
182
|
+
//
|
|
183
|
+
// An unset uniform reads (0, 0, 0) and collapses every vertex onto
|
|
184
|
+
// y = 0. That is the contract failing loudly, and is not defended
|
|
185
|
+
// against here.
|
|
186
|
+
clipYFlip: false,
|
|
159
187
|
...options.profile
|
|
160
188
|
};
|
|
189
|
+
if (typeof this.profile.clipYFlip !== "boolean") {
|
|
190
|
+
throw new TypeError(`DxbcGlslEmitter: clipYFlip must be a boolean, got ${JSON.stringify(this.profile.clipYFlip)}`);
|
|
191
|
+
}
|
|
161
192
|
if (typeof this.profile.packedLightProfiles !== "boolean") {
|
|
162
193
|
throw new TypeError("packedLightProfiles must be a boolean");
|
|
163
194
|
}
|
|
164
|
-
if (
|
|
165
|
-
throw new TypeError(`DxbcGlslEmitter: depthRange must be "reversed" or "
|
|
195
|
+
if (!Object.hasOwn(DEPTH_RANGE_FIXUP, this.profile.depthRange)) {
|
|
196
|
+
throw new TypeError(`DxbcGlslEmitter: depthRange must be "reversed", "forward" or "none", got ${JSON.stringify(this.profile.depthRange)}`);
|
|
166
197
|
}
|
|
167
198
|
}
|
|
168
199
|
|
|
@@ -364,13 +395,23 @@ class DxbcGlslEmitter {
|
|
|
364
395
|
this._analyzeUavStores(state);
|
|
365
396
|
}
|
|
366
397
|
state.integerVertexInputs = new Map();
|
|
398
|
+
// Register -> GLSL integer built-in (`gl_VertexID`/`gl_InstanceID`) for
|
|
399
|
+
// system-value inputs; filled by _declareSystemInput.
|
|
400
|
+
state.systemIntegerInputs = new Map();
|
|
401
|
+
// Integer companions for temporaries. Small integers held as float bit
|
|
402
|
+
// patterns are denormals, and ANGLE/D3D11 hardware does not preserve
|
|
403
|
+
// them in float storage: a vertex-id corner index `r0.x = uintBitsToFloat(id & 3u)`
|
|
404
|
+
// reads back 0 for ids 1..3, collapsing every quad (plane sets, the sprite
|
|
405
|
+
// pool). Packed-light shaders need the same companions for their words.
|
|
406
|
+
state.integerTemps = !!state.lightPackedTexture || state.decoder.instructions.some(instruction => (instruction.opcodeName === "dcl_input_sgv" || instruction.opcodeName === "dcl_input_ps_sgv") && (instruction.declaration?.systemValueName === "vertex_id" || instruction.declaration?.systemValueName === "instance_id"));
|
|
367
407
|
state.formatter = new DxbcGlslOperandFormatter({
|
|
368
408
|
// Populated during vertex-input declaration (the declaration loop
|
|
369
409
|
// runs before any body emission, so the map is complete before the
|
|
370
410
|
// first operand is formatted). Integer reads of these registers
|
|
371
411
|
// value-convert instead of bitcast - see _declareVertexInput.
|
|
372
412
|
integerInputs: state.integerVertexInputs,
|
|
373
|
-
integerTemps:
|
|
413
|
+
integerTemps: state.integerTemps,
|
|
414
|
+
systemIntegerInputs: state.systemIntegerInputs,
|
|
374
415
|
componentMap: operand => {
|
|
375
416
|
if (operand.type === 1) return state.inputMasks.get(operand.registerIndex) || null;
|
|
376
417
|
if (operand.type === 2) return state.outputMasks.get(operand.registerIndex) || null;
|
|
@@ -1078,7 +1119,7 @@ class DxbcGlslEmitter {
|
|
|
1078
1119
|
case "dcl_temps":
|
|
1079
1120
|
for (let index = 0; index < declaration.tempCount; index += 1) {
|
|
1080
1121
|
state.declarationLines.push(`vec4 r${index};`);
|
|
1081
|
-
if (state.
|
|
1122
|
+
if (state.integerTemps) state.declarationLines.push(`uvec4 cjsBitsR${index};`);
|
|
1082
1123
|
}
|
|
1083
1124
|
break;
|
|
1084
1125
|
case "dcl_indexable_temp":
|
|
@@ -1484,9 +1525,11 @@ class DxbcGlslEmitter {
|
|
|
1484
1525
|
break;
|
|
1485
1526
|
case "vertex_id":
|
|
1486
1527
|
state.inputNames.set(register, "vec4(intBitsToFloat(gl_VertexID))");
|
|
1528
|
+
state.systemIntegerInputs.set(register, "gl_VertexID");
|
|
1487
1529
|
break;
|
|
1488
1530
|
case "instance_id":
|
|
1489
1531
|
state.inputNames.set(register, "vec4(intBitsToFloat(gl_InstanceID))");
|
|
1532
|
+
state.systemIntegerInputs.set(register, "gl_InstanceID");
|
|
1490
1533
|
break;
|
|
1491
1534
|
default:
|
|
1492
1535
|
throw new WebglReadError("System-generated input is not supported by the WebGL2 emitter", {
|
|
@@ -1728,7 +1771,7 @@ class DxbcGlslEmitter {
|
|
|
1728
1771
|
// Centralize writes here because several lowerings emit lane writes
|
|
1729
1772
|
// directly rather than going through _assign. This is per assignment,
|
|
1730
1773
|
// not a shader/register-number pattern or a control-flow dataflow guess.
|
|
1731
|
-
const assignment = state.
|
|
1774
|
+
const assignment = state.integerTemps && /^(r(\d+)(?:\.[xyzw]+)?) = ([\s\S]+);$/.exec(text);
|
|
1732
1775
|
if (assignment) {
|
|
1733
1776
|
const [, target, index, value] = assignment;
|
|
1734
1777
|
const suffix = target.slice(`r${index}`.length);
|
|
@@ -2097,7 +2140,7 @@ class DxbcGlslEmitter {
|
|
|
2097
2140
|
} = this._destMask(state, instruction);
|
|
2098
2141
|
if (!target) return;
|
|
2099
2142
|
const aliases = instruction.operands.slice(1).some(operand => operand.type === destOperand.type && operand.registerIndex === destOperand.registerIndex);
|
|
2100
|
-
const rawMove =
|
|
2143
|
+
const rawMove = state.integerTemps && destOperand.type === 0;
|
|
2101
2144
|
if (aliases) {
|
|
2102
2145
|
this._line(state, "{");
|
|
2103
2146
|
state.indent += 1;
|
|
@@ -2472,7 +2515,7 @@ DxbcGlslEmitter.LOWERINGS = {
|
|
|
2472
2515
|
const {
|
|
2473
2516
|
mask
|
|
2474
2517
|
} = this._destMask(state, instruction);
|
|
2475
|
-
if (state.
|
|
2518
|
+
if (state.integerTemps && instruction.operands[0].type === 0 && !instruction.saturate && !["neg", "abs", "absneg"].includes(instruction.operands[1].modifierName)) {
|
|
2476
2519
|
const raw = this._vecArg(state, instruction.operands[1], mask, "uint");
|
|
2477
2520
|
this._assign(state, instruction, `uintBitsToFloat(${raw})`);
|
|
2478
2521
|
return;
|
|
@@ -3290,9 +3333,21 @@ DxbcGlslEmitter.prototype._gather4Channel = function _gather4Channel(operand) {
|
|
|
3290
3333
|
* unchanged either way. See `profile.depthRange`.
|
|
3291
3334
|
* @type {Object.<string,string>}
|
|
3292
3335
|
*/
|
|
3336
|
+
/**
|
|
3337
|
+
* The clip-space Y flip uniform and tail emitted when `profile.clipYFlip` is set.
|
|
3338
|
+
* Name and statements match CCP's shipped gles2 vertex bodies exactly, so a
|
|
3339
|
+
* consumer drives translated and legacy stages through the one uniform.
|
|
3340
|
+
* @type {string}
|
|
3341
|
+
*/
|
|
3342
|
+
const CLIP_Y_FLIP_UNIFORM = "ssyf";
|
|
3343
|
+
|
|
3344
|
+
/** @type {ReadonlyArray<string>} */
|
|
3345
|
+
const CLIP_Y_FLIP_TAIL = Object.freeze([`gl_Position.xy += ${CLIP_Y_FLIP_UNIFORM}.xy * gl_Position.w;`, `gl_Position.y *= ${CLIP_Y_FLIP_UNIFORM}.z;`]);
|
|
3293
3346
|
const DEPTH_RANGE_FIXUP = Object.freeze({
|
|
3294
3347
|
reversed: "gl_Position.z = gl_Position.w - 2.0 * gl_Position.z;",
|
|
3295
|
-
forward: "gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;"
|
|
3348
|
+
forward: "gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;",
|
|
3349
|
+
// No statement: the consumer's clip range already matches the source's.
|
|
3350
|
+
none: null
|
|
3296
3351
|
});
|
|
3297
3352
|
DxbcGlslEmitter.prototype._assemble = function _assemble(state) {
|
|
3298
3353
|
const lines = ["#version 300 es"];
|
|
@@ -3327,12 +3382,17 @@ DxbcGlslEmitter.prototype._assemble = function _assemble(state) {
|
|
|
3327
3382
|
// skip the fixup.
|
|
3328
3383
|
const writesPosition = [...state.outputNames.values()].includes("gl_Position");
|
|
3329
3384
|
if (!state.isPixel && !state.isCompute && writesPosition) {
|
|
3385
|
+
// See `profile.clipYFlip`. The flip runs before the depth fixup, the
|
|
3386
|
+
// order CCP's gles2 tail uses; the two touch different components.
|
|
3387
|
+
if (this.profile.clipYFlip) {
|
|
3388
|
+
lines.push("", `uniform vec3 ${CLIP_Y_FLIP_UNIFORM};`);
|
|
3389
|
+
}
|
|
3330
3390
|
lines.push("", "void dxbc_main() {");
|
|
3331
3391
|
for (const early of state.earlyMainLines) {
|
|
3332
3392
|
lines.push(` ${early}`);
|
|
3333
3393
|
}
|
|
3334
3394
|
lines.push(...state.bodyLines, "}");
|
|
3335
|
-
lines.push("", "void main() {", " dxbc_main();", ` ${DEPTH_RANGE_FIXUP[this.profile.depthRange]}
|
|
3395
|
+
lines.push("", "void main() {", " dxbc_main();", ...(this.profile.clipYFlip ? CLIP_Y_FLIP_TAIL.map(line => ` ${line}`) : []), ...(DEPTH_RANGE_FIXUP[this.profile.depthRange] ? [` ${DEPTH_RANGE_FIXUP[this.profile.depthRange]}`] : []), "}");
|
|
3336
3396
|
return `${lines.join("\n")}\n`;
|
|
3337
3397
|
}
|
|
3338
3398
|
lines.push("", "void main() {");
|