@carbonenginejs/runtime-resource 0.19.2 → 0.22.0
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/NOTICE +6 -0
- package/dist/CjsResMan.js +1374 -1318
- package/dist/CjsResMan.js.map +1 -1
- package/dist/format/CjsFormat.js +393 -164
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsFormatStore.js +315 -0
- package/dist/format/CjsFormatStore.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +66 -234
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +47 -6
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +23 -6
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +122 -120
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +5 -15
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/cmf/CjsCmfFormat.js +31 -14
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/formats/dds/CjsDdsFormat.js +29 -19
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +4 -5
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +15 -13
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/formats/fbx/CjsFbxFormat.js +27 -19
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +4 -4
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +19 -17
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +5 -11
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/fsd/32/CjsFsd32Format.js +55 -0
- package/dist/formats/fsd/32/CjsFsd32Format.js.map +1 -0
- package/dist/formats/fsd/32/index.js +2 -0
- package/dist/formats/fsd/32/index.js.map +1 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js +119 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js +393 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js +138 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js +389 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js +43 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js.map +1 -0
- package/dist/formats/fsd/64/core/fsd64Records.js +60 -0
- package/dist/formats/fsd/64/core/fsd64Records.js.map +1 -0
- package/dist/formats/fsd/64/index.js +7 -0
- package/dist/formats/fsd/64/index.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js +33 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js +35 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js +50 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js +75 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js +57 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js +201 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js +53 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js +81 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js +41 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js +76 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js +59 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js +46 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js +133 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js +236 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js +60 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js +95 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js +106 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js +117 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js +70 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js +173 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js +62 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js +72 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js +326 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js +279 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js +64 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js +40 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js +113 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js +130 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js +45 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js +163 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js +120 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js +49 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js +122 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js +83 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js +194 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/index.js +58 -0
- package/dist/formats/fsd/64/readers/index.js.map +1 -0
- package/dist/formats/fsd/CjsFsdFormat.js +62 -0
- package/dist/formats/fsd/CjsFsdFormat.js.map +1 -0
- package/dist/formats/fsd/index.js +9 -0
- package/dist/formats/fsd/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +26 -16
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +6 -18
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/CjsGltfFormat.js +25 -13
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gr2/CjsGr2Format.js +27 -6
- package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +20 -16
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/formats/hlsl/core/analysis.js +1 -1
- package/dist/formats/index.js +5 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/jpeg/CjsJpegFormat.js +26 -19
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +6 -15
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +0 -3
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/CjsMp3Format.js +19 -19
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +5 -11
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/CjsMp4Format.js +20 -19
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +6 -15
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/obj/CjsObjFormat.js +25 -12
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +26 -17
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +5 -16
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/pickle/CjsPickleFormat.js +64 -5
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/formats/png/CjsPngFormat.js +28 -19
- package/dist/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/formats/png/core/helpers.js +5 -14
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +19 -5
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js +48 -38
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
- package/dist/formats/sqlite/CjsSqliteFormat.js +49 -41
- package/dist/formats/sqlite/CjsSqliteFormat.js.map +1 -1
- package/dist/formats/static/CjsStaticFormat.js +15 -57
- package/dist/formats/static/CjsStaticFormat.js.map +1 -1
- package/dist/formats/static/staticContainers.js +6 -6
- package/dist/formats/static/staticContainers.js.map +1 -1
- package/dist/formats/stl/CjsStlFormat.js +25 -12
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/tga/CjsTgaFormat.js +26 -19
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +7 -22
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/CjsWavFormat.js +26 -19
- package/dist/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +7 -16
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +11 -13
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +90 -12
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/helpers.js +2 -2
- package/dist/formats/webgl/core/helpers.js.map +1 -1
- package/dist/formats/webgl/core/readGlslEffectContainer.js +8 -8
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +11 -5
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webm/CjsWebmFormat.js +20 -19
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +6 -15
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +19 -17
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +5 -11
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +128 -141
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +1 -114
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/wem/core/{resolve.js → probeCodecSupport.js} +11 -18
- package/dist/formats/wem/core/probeCodecSupport.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +20 -5
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/generated/index.js +2 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js +34 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js.map +1 -0
- package/dist/generated/resources/index.js +2 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsResource.js +134 -0
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceRequirement.js +42 -0
- package/dist/resource/ResourceRequirement.js.map +1 -0
- package/dist/resource/Tr2LightProfileRes.js +2 -1
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +34 -7
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +184 -7
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
- package/dist/resource/geometry/granny/TriGrannyRes.js +20 -8
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
- package/dist/resource/index.js +1 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/resourceBoundary.js +24 -1
- package/dist/resource/resourceBoundary.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +2 -1
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +2 -1
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +2 -1
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +40 -2
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/docs/architecture.md +121 -116
- package/docs/concepts/format-capabilities.md +90 -0
- package/docs/formats/README.md +14 -6
- package/docs/formats/fsd.md +104 -0
- package/docs/formats/gr2.md +1 -1
- package/docs/formats/hlsl/reference/api.md +6 -4
- package/docs/formats/provenance.md +18 -0
- package/docs/formats/schemabound.md +10 -4
- package/docs/formats/static.md +26 -26
- package/docs/formats/webgpu/reference/api.md +4 -3
- package/docs/reference/classes/core.md +22 -2
- package/docs/reference/classes/formats.md +643 -1
- package/docs/reference/classes/resources.md +463 -453
- package/docs/reference/queues.md +205 -194
- package/docs/roadmap.md +14 -18
- package/format-notices/fsd/LICENSE +21 -0
- package/format-notices/fsd/NOTICE +11 -0
- package/package.json +70 -64
- package/dist/formats/wem/core/resolve.js.map +0 -1
- package/docs/concepts/format-type-resolution.md +0 -79
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticContainers.js","sources":["../../../../src/formats/static/staticContainers.js"],"sourcesContent":["import { CjsPickleFormat } from \"../pickle/index.js\";\nimport { CjsSchemaBoundFormat } from \"../schemabound/index.js\";\nimport { CjsSqliteFormat } from \"../sqlite/index.js\";\nimport { CJS_STATIC_FAMILIES, CjsStaticFormat } from \"./CjsStaticFormat.js\";\n\n/**\n * Reads a client `.static` container of whichever family it holds.\n *\n * `.static` names a role rather than a format, and three unrelated containers\n * wear the extension, so identification and decoding are separate jobs done by\n * separate formats. `CjsStaticFormat` says which family the bytes hold and\n * decodes nothing; these functions take that answer to the format that owns the\n * family. Nothing routes on the extension, which proves nothing.\n *\n * Reading a `.static` needs the three formats that own its families, so this\n * module imports them. That is the format depending on formats, which is what a\n * container format that wraps other containers has to do; what a format must not\n * do is drag the rest of the library in behind it, and nothing here reaches\n * outside `formats/`.\n *\n * It is a sibling of `CjsStaticFormat` rather than part of it, which keeps the\n * 2026-08-15 decision intact: that class dispatched to two other formats and was\n * cut back to identifying only, so that identification is not also the routing\n * table. Routing lives here and the identification stays clean.\n *\n * Nothing here is specific to one publisher or one export. Measured 2026-08-16\n * across three publishers at builds 3466501, 3466054 and 3466057: 45 `.static`\n * files on each, split 14 SQLite, 25 embedded-schema and 6 schema-companion,\n * with not one file unique to a publisher and not one that changes family\n * between them.\n */\n\nconst CACHE_TABLE = \"cache\";\n\n/** Raises a family mismatch, naming what was found and what was wanted. */\nfunction FamilyError(path, found, wanted, reason)\n{\n const error = new TypeError(\n `${path} is a ${found} .static container, not a ${wanted} one.${reason ? ` ${reason}` : \"\"}`,\n );\n\n error.code = \"CJS_STATIC_FORMAT_FAMILY_UNSUPPORTED\";\n error.family = found;\n error.path = path;\n\n return error;\n}\n\n/**\n * Reads the SQLite family into records keyed by their container key.\n *\n * The record shape is the container's own: a `cache` table of `key`, `value`\n * and `time`, where every `value` is a JSON document.\n *\n * @param {Uint8Array|ArrayBuffer} bytes Container bytes.\n * @param {string} [path] Logical path, for error messages.\n * @returns {Promise<object>} Records keyed by their container key.\n */\nexport async function ReadStaticContainer(bytes, path = \".static input\")\n{\n const probe = await CjsStaticFormat.resolveType(bytes);\n\n if (probe.preferred !== CJS_STATIC_FAMILIES.SQLITE)\n {\n throw FamilyError(path, probe.preferred, CJS_STATIC_FAMILIES.SQLITE, probe.reason);\n }\n\n const tables = CjsSqliteFormat.readJSON(bytes, { tables: [ CACHE_TABLE ] });\n const rows = tables[CACHE_TABLE];\n\n if (!Array.isArray(rows))\n {\n const error = new TypeError(`${path} has no ${CACHE_TABLE} table.`);\n\n error.code = \"CJS_STATIC_FORMAT_SHAPE_INVALID\";\n error.path = path;\n throw error;\n }\n\n const records = {};\n\n for (const row of rows)\n {\n records[String(row.key)] = ParseRecord(row.value, row.key, path);\n }\n\n return records;\n}\n\n/**\n * Reads the family whose schema is embedded ahead of the payload.\n *\n * The framing is a `uint32` schema length, the schema as a protocol-0 pickle,\n * and then a payload in exactly the container `CjsSchemaBoundFormat` reads. It\n * is the same format as the `.schema` sibling family; only the schema's encoding\n * differs.\n *\n * **Slice the schema exactly.** Handing the whole file to a pickle reader fails,\n * but it fails on the payload's bytes long after the schema has parsed, so the\n * error names an opcode and points nowhere near the real boundary. That reading\n * is what left this family classified as a separate self-describing format for\n * as long as it was.\n *\n * @param {Uint8Array|ArrayBuffer} bytes Container bytes.\n * @param {string} [path] Logical path, for error messages.\n * @returns {object|Array} Decoded records.\n */\nexport function ReadEmbeddedSchemaContainer(bytes, path = \".static input\")\n{\n const source = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);\n\n if (source.byteLength < 4)\n {\n const error = new TypeError(`${path} is too short to carry a schema length.`);\n\n error.code = \"CJS_STATIC_FORMAT_SHAPE_INVALID\";\n error.path = path;\n throw error;\n }\n\n const view = new DataView(source.buffer, source.byteOffset, source.byteLength);\n const length = view.getUint32(0, true);\n\n if (length <= 0 || length + 4 > source.byteLength)\n {\n const error = new TypeError(`${path} does not begin with a usable schema length.`);\n\n error.code = \"CJS_STATIC_FORMAT_SHAPE_INVALID\";\n error.path = path;\n throw error;\n }\n\n return CjsSchemaBoundFormat.read(source.subarray(4 + length), {\n schema: CjsPickleFormat.read(source.subarray(4, 4 + length)),\n });\n}\n\n/**\n * Reads the family whose layout lives in a `.schema` sibling.\n *\n * The family check is worth keeping even though the caller already fetched a\n * `.schema` alongside the payload, because these bytes carry no signature at\n * all - given the wrong schema they decode into plausible nonsense rather than\n * failing, so the one cheap guard there is belongs in the path.\n *\n * @param {Uint8Array|ArrayBuffer} bytes Container bytes.\n * @param {Uint8Array|ArrayBuffer|string|object} schema The sibling `.schema`.\n * @param {string} [path] Logical path, for error messages.\n * @returns {Promise<object|Array>} Decoded records.\n */\nexport async function ReadSchemaBoundContainer(bytes, schema, path = \".static input\")\n{\n const probe = await CjsStaticFormat.resolveType(bytes);\n\n // The schema-bound family is the one with nothing to recognize, so it is\n // reported as `unknown` with `requires: \"schema\"` rather than named outright.\n if (probe.preferred !== CJS_STATIC_FAMILIES.UNKNOWN)\n {\n throw FamilyError(path, probe.preferred, \"schema-bound\", null);\n }\n\n return CjsSchemaBoundFormat.read(bytes, { schema });\n}\n\n/** Parses one stored JSON document, naming the record that failed. */\nfunction ParseRecord(value, key, path)\n{\n try\n {\n return JSON.parse(value);\n }\n catch (cause)\n {\n const error = new TypeError(`${path} record ${key} is not JSON.`, { cause });\n\n error.code = \"CJS_STATIC_FORMAT_RECORD_INVALID\";\n error.key = String(key);\n error.path = path;\n throw error;\n }\n}\n"],"names":["CACHE_TABLE","FamilyError","path","found","wanted","reason","error","TypeError","code","family","ReadStaticContainer","bytes","probe","CjsStaticFormat","resolveType","preferred","CJS_STATIC_FAMILIES","SQLITE","tables","CjsSqliteFormat","readJSON","rows","Array","isArray","records","row","String","key","ParseRecord","value","ReadEmbeddedSchemaContainer","source","Uint8Array","byteLength","view","DataView","buffer","byteOffset","length","getUint32","CjsSchemaBoundFormat","read","subarray","schema","CjsPickleFormat","ReadSchemaBoundContainer","UNKNOWN","JSON","parse","cause"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,WAAW,GAAG,OAAO;;AAE3B;AACA,SAASC,WAAWA,CAACC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAChD;EACI,MAAMC,KAAK,GAAG,IAAIC,SAAS,CACvB,CAAA,EAAGL,IAAI,SAASC,KAAK,CAAA,0BAAA,EAA6BC,MAAM,CAAA,KAAA,EAAQC,MAAM,GAAG,CAAA,CAAA,EAAIA,MAAM,EAAE,GAAG,EAAE,EAC9F,CAAC;EAEDC,KAAK,CAACE,IAAI,GAAG,sCAAsC;EACnDF,KAAK,CAACG,MAAM,GAAGN,KAAK;EACpBG,KAAK,CAACJ,IAAI,GAAGA,IAAI;AAEjB,EAAA,OAAOI,KAAK;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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,eAAe,EACpF;EACI,MAAMU,KAAK,GAAG,MAAMC,eAAe,CAACC,WAAW,CAACH,KAAK,CAAC;;AAEtD;AACA;AACA,EAAA,IAAIC,KAAK,CAACG,SAAS,KAAKC,mBAAmB,CAAC8B,OAAO,EACnD;IACI,MAAM7C,WAAW,CAACC,IAAI,EAAEU,KAAK,CAACG,SAAS,EAAE,cAAc,EAAE,IAAI,CAAC;AAClE,EAAA;AAEA,EAAA,OAAOyB,oBAAoB,CAACC,IAAI,CAAC9B,KAAK,EAAE;AAAEgC,IAAAA;AAAO,GAAC,CAAC;AACvD;;AAEA;AACA,SAASf,WAAWA,CAACC,KAAK,EAAEF,GAAG,EAAEzB,IAAI,EACrC;EACI,IACA;AACI,IAAA,OAAO6C,IAAI,CAACC,KAAK,CAACnB,KAAK,CAAC;EAC5B,CAAC,CACD,OAAOoB,KAAK,EACZ;IACI,MAAM3C,KAAK,GAAG,IAAIC,SAAS,CAAC,GAAGL,IAAI,CAAA,QAAA,EAAWyB,GAAG,CAAA,aAAA,CAAe,EAAE;AAAEsB,MAAAA;AAAM,KAAC,CAAC;IAE5E3C,KAAK,CAACE,IAAI,GAAG,kCAAkC;AAC/CF,IAAAA,KAAK,CAACqB,GAAG,GAAGD,MAAM,CAACC,GAAG,CAAC;IACvBrB,KAAK,CAACJ,IAAI,GAAGA,IAAI;AACjB,IAAA,MAAMI,KAAK;AACf,EAAA;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"staticContainers.js","sources":["../../../../src/formats/static/staticContainers.js"],"sourcesContent":["import { CjsPickleFormat } from \"../pickle/index.js\";\nimport { CjsSchemaBoundFormat } from \"../schemabound/index.js\";\nimport { CjsSqliteFormat } from \"../sqlite/index.js\";\nimport { CJS_STATIC_FAMILIES, CjsStaticFormat } from \"./CjsStaticFormat.js\";\n\n/**\n * Reads a client `.static` container of whichever family it holds.\n *\n * `.static` names a role rather than a format, and three unrelated containers\n * wear the extension, so identification and decoding are separate jobs done by\n * separate formats. `CjsStaticFormat` says which family the bytes hold and\n * decodes nothing; these functions take that answer to the format that owns the\n * family. Nothing routes on the extension, which proves nothing.\n *\n * Reading a `.static` needs the three formats that own its families, so this\n * module imports them. That is the format depending on formats, which is what a\n * container format that wraps other containers has to do; what a format must not\n * do is drag the rest of the library in behind it, and nothing here reaches\n * outside `formats/`.\n *\n * It is a sibling of `CjsStaticFormat` rather than part of it, which keeps the\n * 2026-08-15 decision intact: that class dispatched to two other formats and was\n * cut back to identifying only, so that identification is not also the routing\n * table. Routing lives here and the identification stays clean.\n *\n * Nothing here is specific to one publisher or one export. Measured 2026-08-16\n * across three publishers at builds 3466501, 3466054 and 3466057: 45 `.static`\n * files on each, split 14 SQLite, 25 embedded-schema and 6 schema-companion,\n * with not one file unique to a publisher and not one that changes family\n * between them.\n */\n\nconst CACHE_TABLE = \"cache\";\n\n/** Raises a family mismatch, naming what was found and what was wanted. */\nfunction FamilyError(path, found, wanted, reason)\n{\n const error = new TypeError(\n `${path} is a ${found} .static container, not a ${wanted} one.${reason ? ` ${reason}` : \"\"}`,\n );\n\n error.code = \"CJS_STATIC_FORMAT_FAMILY_UNSUPPORTED\";\n error.family = found;\n error.path = path;\n\n return error;\n}\n\n/**\n * Reads the SQLite family into records keyed by their container key.\n *\n * The record shape is the container's own: a `cache` table of `key`, `value`\n * and `time`, where every `value` is a JSON document.\n *\n * @param {Uint8Array|ArrayBuffer} bytes Container bytes.\n * @param {string} [path] Logical path, for error messages.\n * @returns {Promise<object>} Records keyed by their container key.\n */\nexport async function ReadStaticContainer(bytes, path = \".static input\")\n{\n const detected = CjsStaticFormat.inspect(bytes);\n\n if (detected.family !== CJS_STATIC_FAMILIES.SQLITE)\n {\n throw FamilyError(path, detected.family, CJS_STATIC_FAMILIES.SQLITE, detected.reason);\n }\n\n const tables = CjsSqliteFormat.readJSON(bytes, { tables: [ CACHE_TABLE ] });\n const rows = tables[CACHE_TABLE];\n\n if (!Array.isArray(rows))\n {\n const error = new TypeError(`${path} has no ${CACHE_TABLE} table.`);\n\n error.code = \"CJS_STATIC_FORMAT_SHAPE_INVALID\";\n error.path = path;\n throw error;\n }\n\n const records = {};\n\n for (const row of rows)\n {\n records[String(row.key)] = ParseRecord(row.value, row.key, path);\n }\n\n return records;\n}\n\n/**\n * Reads the family whose schema is embedded ahead of the payload.\n *\n * The framing is a `uint32` schema length, the schema as a protocol-0 pickle,\n * and then a payload in exactly the container `CjsSchemaBoundFormat` reads. It\n * is the same format as the `.schema` sibling family; only the schema's encoding\n * differs.\n *\n * **Slice the schema exactly.** Handing the whole file to a pickle reader fails,\n * but it fails on the payload's bytes long after the schema has parsed, so the\n * error names an opcode and points nowhere near the real boundary. That reading\n * is what left this family classified as a separate self-describing format for\n * as long as it was.\n *\n * @param {Uint8Array|ArrayBuffer} bytes Container bytes.\n * @param {string} [path] Logical path, for error messages.\n * @returns {object|Array} Decoded records.\n */\nexport function ReadEmbeddedSchemaContainer(bytes, path = \".static input\")\n{\n const source = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);\n\n if (source.byteLength < 4)\n {\n const error = new TypeError(`${path} is too short to carry a schema length.`);\n\n error.code = \"CJS_STATIC_FORMAT_SHAPE_INVALID\";\n error.path = path;\n throw error;\n }\n\n const view = new DataView(source.buffer, source.byteOffset, source.byteLength);\n const length = view.getUint32(0, true);\n\n if (length <= 0 || length + 4 > source.byteLength)\n {\n const error = new TypeError(`${path} does not begin with a usable schema length.`);\n\n error.code = \"CJS_STATIC_FORMAT_SHAPE_INVALID\";\n error.path = path;\n throw error;\n }\n\n return CjsSchemaBoundFormat.read(source.subarray(4 + length), {\n schema: CjsPickleFormat.read(source.subarray(4, 4 + length)),\n });\n}\n\n/**\n * Reads the family whose layout lives in a `.schema` sibling.\n *\n * The family check is worth keeping even though the caller already fetched a\n * `.schema` alongside the payload, because these bytes carry no signature at\n * all - given the wrong schema they decode into plausible nonsense rather than\n * failing, so the one cheap guard there is belongs in the path.\n *\n * @param {Uint8Array|ArrayBuffer} bytes Container bytes.\n * @param {Uint8Array|ArrayBuffer|string|object} schema The sibling `.schema`.\n * @param {string} [path] Logical path, for error messages.\n * @returns {Promise<object|Array>} Decoded records.\n */\nexport async function ReadSchemaBoundContainer(bytes, schema, path = \".static input\")\n{\n const detected = CjsStaticFormat.inspect(bytes);\n\n // The schema-bound family is the one with nothing to recognize, so it is\n // reported as `unknown` with `requires: \"schema\"` rather than named outright.\n if (detected.family !== CJS_STATIC_FAMILIES.UNKNOWN)\n {\n throw FamilyError(path, detected.family, \"schema-bound\", null);\n }\n\n return CjsSchemaBoundFormat.read(bytes, { schema });\n}\n\n/** Parses one stored JSON document, naming the record that failed. */\nfunction ParseRecord(value, key, path)\n{\n try\n {\n return JSON.parse(value);\n }\n catch (cause)\n {\n const error = new TypeError(`${path} record ${key} is not JSON.`, { cause });\n\n error.code = \"CJS_STATIC_FORMAT_RECORD_INVALID\";\n error.key = String(key);\n error.path = path;\n throw error;\n }\n}\n"],"names":["CACHE_TABLE","FamilyError","path","found","wanted","reason","error","TypeError","code","family","ReadStaticContainer","bytes","detected","CjsStaticFormat","inspect","CJS_STATIC_FAMILIES","SQLITE","tables","CjsSqliteFormat","readJSON","rows","Array","isArray","records","row","String","key","ParseRecord","value","ReadEmbeddedSchemaContainer","source","Uint8Array","byteLength","view","DataView","buffer","byteOffset","length","getUint32","CjsSchemaBoundFormat","read","subarray","schema","CjsPickleFormat","ReadSchemaBoundContainer","UNKNOWN","JSON","parse","cause"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,WAAW,GAAG,OAAO;;AAE3B;AACA,SAASC,WAAWA,CAACC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAChD;EACI,MAAMC,KAAK,GAAG,IAAIC,SAAS,CACvB,CAAA,EAAGL,IAAI,SAASC,KAAK,CAAA,0BA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
import { CjsFormat } from '../../format/CjsFormat.js';
|
|
1
2
|
import { DEFAULT_VALUES, normalizeValues, validateClassKey, validateClass, readWithValues, writeWithValues, inspectWithValues, toJsonValue, OUTPUT_CMF, OUTPUT_GR2, OUTPUT_SHARED, OUTPUT_STL_JSON, OUTPUT_JSON, CLASS_KEYS } from './core/helpers.js';
|
|
2
3
|
import { isStl, isBinaryStl } from './core/stl.js';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
* Exposed CarbonEngineJS-facing STL format class.
|
|
6
|
-
*
|
|
7
|
-
* Keep this file small and reviewable: STL parsing, writing, printability
|
|
8
|
-
* inspection, option normalization, and JSON hydration live under src/core.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
5
|
const FORMAT_NAME = "CjsStlFormat";
|
|
12
6
|
|
|
13
7
|
/**
|
|
@@ -52,7 +46,7 @@ const FORMAT_NAME = "CjsStlFormat";
|
|
|
52
46
|
* STL is a triangle-only import/export format; the JSON contract is the shared
|
|
53
47
|
* CarbonEngineJS mesh schema.
|
|
54
48
|
*/
|
|
55
|
-
class CjsStlFormat {
|
|
49
|
+
class CjsStlFormat extends CjsFormat {
|
|
56
50
|
#emit = DEFAULT_VALUES.emit;
|
|
57
51
|
#source = DEFAULT_VALUES.source;
|
|
58
52
|
#binary = DEFAULT_VALUES.binary;
|
|
@@ -75,6 +69,7 @@ class CjsStlFormat {
|
|
|
75
69
|
* @throws {TypeError} If an option, output mode, numeric value, or class map is invalid.
|
|
76
70
|
*/
|
|
77
71
|
constructor(options = {}) {
|
|
72
|
+
super();
|
|
78
73
|
this.SetValues(options);
|
|
79
74
|
}
|
|
80
75
|
|
|
@@ -309,11 +304,29 @@ class CjsStlFormat {
|
|
|
309
304
|
CMF: OUTPUT_CMF
|
|
310
305
|
});
|
|
311
306
|
static CLASS_KEYS = CLASS_KEYS;
|
|
312
|
-
static
|
|
307
|
+
static id = "stl";
|
|
313
308
|
static mediaTypes = Object.freeze(["geometry"]);
|
|
314
|
-
static
|
|
315
|
-
|
|
316
|
-
|
|
309
|
+
static outputs = CjsFormat.defineOutputs({
|
|
310
|
+
shared: {
|
|
311
|
+
decoded: true
|
|
312
|
+
},
|
|
313
|
+
gr2: {
|
|
314
|
+
decoded: true
|
|
315
|
+
},
|
|
316
|
+
cmf: {
|
|
317
|
+
decoded: true
|
|
318
|
+
},
|
|
319
|
+
json: {
|
|
320
|
+
role: "debug",
|
|
321
|
+
decoded: true
|
|
322
|
+
},
|
|
323
|
+
stlJson: {
|
|
324
|
+
role: "debug",
|
|
325
|
+
default: true,
|
|
326
|
+
decoded: true
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
static extensions = Object.freeze([".stl"]);
|
|
317
330
|
}
|
|
318
331
|
|
|
319
332
|
export { CjsStlFormat, CjsStlFormat as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsStlFormat.js","sources":["../../../../src/formats/stl/CjsStlFormat.js"],"sourcesContent":["/**\n * Exposed CarbonEngineJS-facing STL format class.\n *\n * Keep this file small and reviewable: STL parsing, writing, printability\n * inspection, option normalization, and JSON hydration live under src/core.\n */\n\nimport {\n CLASS_KEYS,\n DEFAULT_VALUES,\n OUTPUT_CMF,\n OUTPUT_GR2,\n OUTPUT_JSON,\n OUTPUT_SHARED,\n OUTPUT_STL_JSON,\n inspectWithValues,\n isBinaryStl,\n isStl,\n normalizeValues,\n readWithValues,\n toJsonValue,\n validateClass,\n validateClassKey,\n writeWithValues\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsStlFormat\";\n\n/**\n * Shared mesh accepted by the STL writer. STL exports only `vertex.position`\n * and triangular `indices[].faces`; all other shared channels are ignored.\n *\n * @typedef {object} CjsStlSharedMesh\n * @property {string} [name] Diagnostic mesh name; `solidName` controls the STL header.\n * @property {{position: ArrayLike<number>, normal?: ArrayLike<number>}} vertex Shared vertex channels.\n * @property {Array<{name?: string, faces: ArrayLike<number>}>} indices Triangle index groups.\n */\n\n/**\n * Shared geometry root accepted by the STL writer.\n *\n * @typedef {object} CjsStlSharedRoot\n * @property {Array<CjsStlSharedMesh>} meshes Meshes flattened into one STL solid.\n * @property {string} [grannyFileSource] Optional source label used by inspection.\n */\n\n/**\n * Reusable STL read, write, and inspection options.\n *\n * @typedef {object} CjsStlFormatOptions\n * @property {\"shared\"|\"stlJson\"|\"json\"|\"gr2\"|\"cmf\"} [emit=\"stlJson\"] Read output contract.\n * @property {string} [source=\"memory\"] Source label stored in read/inspection output.\n * @property {boolean} [binary=true] Whether writes return binary bytes instead of ASCII text.\n * @property {string} [solidName=\"carbonenginejs\"] Sanitized ASCII solid name and binary header label.\n * @property {number} [scale=1] Positive finite multiplier applied to exported positions.\n * @property {boolean} [recalculateNormals=true] Derive facet normals from winding instead of vertex normals.\n * @property {boolean} [weldVertices=false] Weld equal positions while reading STL.\n * @property {number} [weldTolerance=1e-5] Non-negative read/inspection position tolerance.\n * @property {boolean} [skipDegenerate=true] Omit degenerate shared triangles during writes.\n * @property {boolean} [requireWatertight=false] Reject writes with printability topology issues.\n * @property {Record<string, Function>} [classes] Caller constructors used for read hydration.\n */\n\n/**\n * CarbonEngineJS-facing STL format surface.\n *\n * The Cjs prefix marks this as a JavaScript format/construction boundary.\n * STL is a triangle-only import/export format; the JSON contract is the shared\n * CarbonEngineJS mesh schema.\n */\nexport class CjsStlFormat\n{\n\n #emit = DEFAULT_VALUES.emit;\n #source = DEFAULT_VALUES.source;\n #binary = DEFAULT_VALUES.binary;\n #solidName = DEFAULT_VALUES.solidName;\n #scale = DEFAULT_VALUES.scale;\n #recalculateNormals = DEFAULT_VALUES.recalculateNormals;\n #weldVertices = DEFAULT_VALUES.weldVertices;\n #weldTolerance = DEFAULT_VALUES.weldTolerance;\n #skipDegenerate = DEFAULT_VALUES.skipDegenerate;\n #requireWatertight = DEFAULT_VALUES.requireWatertight;\n #classes = DEFAULT_VALUES.classes;\n\n /**\n * Create a reusable format profile.\n *\n * The instance stores only normalized options; each `Read`, `Write`, or\n * `Inspect` call may provide non-mutating overrides.\n *\n * @param {CjsStlFormatOptions} [options={}] Default format values.\n * @throws {TypeError} If an option, output mode, numeric value, or class map is invalid.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Set format values for this reusable profile.\n *\n * @param {CjsStlFormatOptions} [options={}] Values to merge into the profile.\n * @returns {CjsStlFormat} This format profile.\n * @throws {TypeError} If an option, output mode, numeric value, or class map is invalid.\n */\n SetValues(options = {})\n {\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\n\n this.#emit = values.emit;\n this.#source = values.source;\n this.#binary = values.binary;\n this.#solidName = values.solidName;\n this.#scale = values.scale;\n this.#recalculateNormals = values.recalculateNormals;\n this.#weldVertices = values.weldVertices;\n this.#weldTolerance = values.weldTolerance;\n this.#skipDegenerate = values.skipDegenerate;\n this.#requireWatertight = values.requireWatertight;\n this.#classes = values.classes;\n\n return this;\n }\n\n /**\n * Get this profile's current values, optionally with per-call overrides.\n *\n * @param {CjsStlFormatOptions} [options={}] Optional values to merge into a copy.\n * @returns {CjsStlFormatOptions} A validated copy of the effective values.\n * @throws {TypeError} If an override is invalid.\n */\n GetValues(options = {})\n {\n return normalizeValues({\n emit: this.#emit,\n source: this.#source,\n binary: this.#binary,\n solidName: this.#solidName,\n scale: this.#scale,\n recalculateNormals: this.#recalculateNormals,\n weldVertices: this.#weldVertices,\n weldTolerance: this.#weldTolerance,\n skipDegenerate: this.#skipDegenerate,\n requireWatertight: this.#requireWatertight,\n classes: this.#classes\n }, options, FORMAT_NAME);\n }\n\n /**\n * Set multiple node-class constructors for this profile.\n *\n * @param {object} [classes] Map of node class keys to constructors.\n * @returns {CjsStlFormat} This format profile.\n */\n SetClasses(classes = {})\n {\n return this.SetValues({ classes });\n }\n\n /**\n * Set one node-class constructor for this profile.\n *\n * @param {string} type Node class key.\n * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.\n * @returns {CjsStlFormat} This format profile.\n */\n SetClass(type, Class)\n {\n if (Class === null || Class === undefined)\n {\n validateClassKey(type, FORMAT_NAME);\n const classes = { ...this.#classes };\n delete classes[type];\n this.#classes = classes;\n return this;\n }\n\n validateClass(type, Class, FORMAT_NAME);\n return this.SetValues({ classes: { [type]: Class } });\n }\n\n /**\n * Get a configured node-class constructor.\n *\n * @param {string} type Node class key.\n * @returns {Function|undefined} The registered constructor, if any.\n */\n GetClass(type)\n {\n validateClassKey(type, FORMAT_NAME);\n return this.#classes[type];\n }\n\n /**\n * Whether this format profile has a constructor registered for a node class key.\n *\n * @param {string} type Node class key.\n * @returns {boolean} True when a constructor is registered.\n */\n HasClass(type)\n {\n return !!this.GetClass(type);\n }\n\n /**\n * Read STL text/bytes with this profile's values.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n Read(input, options = {})\n {\n return readWithValues(this, input, this.GetValues(options));\n }\n\n /**\n * Write shared JSON geometry as STL with this profile's values.\n *\n * Multiple meshes and index groups are flattened in encounter order because\n * STL has no portable material or scene hierarchy. Degenerate triangles are\n * skipped by default. Binary output validates that every coordinate is\n * representable as float32 rather than silently writing infinities.\n *\n * @param {CjsStlSharedRoot|CjsStlSharedMesh} input Shared JSON root or mesh.\n * @param {CjsStlFormatOptions} [options={}] Per-call writer overrides.\n * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.\n * @throws {TypeError|RangeError|Error} If geometry, indices, coordinates, topology, or options are invalid.\n */\n Write(input, options = {})\n {\n return writeWithValues(input, this.GetValues(options));\n }\n\n /**\n * Inspect STL text/bytes or shared JSON geometry for printability blockers.\n *\n * @param {any} input STL text/bytes or shared JSON root/mesh.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain printability report.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Convert format output to JSON-compatible data.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Static one-shot read. Static methods use camelCase by convention.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.\n * @param {object} [options] Format values.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n static read(input, options = {})\n {\n return readWithValues(CjsStlFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static one-shot write.\n *\n * The call is one-shot and does not mutate `input`. Multiple meshes and\n * index groups are flattened into a single STL solid in encounter order.\n *\n * @param {CjsStlSharedRoot|CjsStlSharedMesh} input Shared JSON root or mesh.\n * @param {CjsStlFormatOptions} [options={}] Writer values.\n * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.\n * @throws {TypeError|RangeError|Error} If geometry, indices, coordinates, topology, or options are invalid.\n */\n static write(input, options = {})\n {\n return writeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static one-shot inspection.\n *\n * @param {any} input STL text/bytes or shared JSON root/mesh.\n * @param {object} [options] Format values.\n * @returns {object} Plain printability report.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static JSON-compatible conversion.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Cheap sniff for STL-like input.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.\n * @returns {boolean} True when input looks like STL.\n */\n static isStl(input)\n {\n return isStl(input);\n }\n\n /**\n * Check whether byte-like input has an exact binary STL layout.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.\n * @returns {boolean} True when input is binary STL bytes.\n */\n static isBinaryStl(input)\n {\n return isBinaryStl(input);\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n JSON: OUTPUT_JSON,\n STL_JSON: OUTPUT_STL_JSON,\n SHARED: OUTPUT_SHARED,\n GR2: OUTPUT_GR2,\n CMF: OUTPUT_CMF\n });\n static CLASS_KEYS = CLASS_KEYS;\n static type = Object.freeze([ \"geometry\" ]);\n static mediaTypes = Object.freeze([ \"geometry\" ]);\n static inputTypes = Object.freeze([ \"stl\" ]);\n static outputTypes = Object.freeze([ OUTPUT_SHARED, OUTPUT_GR2, OUTPUT_CMF ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_JSON, OUTPUT_STL_JSON ]);\n\n}\n\nexport default CjsStlFormat;\n"],"names":["FORMAT_NAME","CjsStlFormat","DEFAULT_VALUES","emit","source","binary","solidName","scale","recalculateNormals","weldVertices","weldTolerance","skipDegenerate","requireWatertight","classes","constructor","options","SetValues","values","normalizeValues","GetValues","SetClasses","SetClass","type","Class","undefined","validateClassKey","validateClass","GetClass","HasClass","Read","input","readWithValues","Write","writeWithValues","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","write","inspect","toJSON","isStl","isBinaryStl","Output","Object","freeze","JSON","OUTPUT_JSON","STL_JSON","OUTPUT_STL_JSON","SHARED","OUTPUT_SHARED","GR2","OUTPUT_GR2","CMF","OUTPUT_CMF","CLASS_KEYS","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAqBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;AAEI,EAAA,KAAK,GAAGC,cAAc,CAACC,IAAI;AAC3B,EAAA,OAAO,GAAGD,cAAc,CAACE,MAAM;AAC/B,EAAA,OAAO,GAAGF,cA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C7B,EAAA;;AAEA;AACJ;AACA;AACI,EAAA,OAAOe,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,IAAI,EAAEC,WAAW;AACjBC,IAAAA,QAAQ,EAAEC,eAAe;AACzBC,IAAAA,MAAM,EAAEC,aAAa;AACrBC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,GAAG,EAAEC;AACT,GAAC,CAAC;EACF,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOpC,IAAI,GAAGwB,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,CAAE,CAAC;EAC3C,OAAOY,UAAU,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,CAAE,CAAC;EACjD,OAAOa,UAAU,GAAGd,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;AAC5C,EAAA,OAAOc,WAAW,GAAGf,MAAM,CAACC,MAAM,CAAC,CAAEM,aAAa,EAAEE,UAAU,EAAEE,UAAU,CAAE,CAAC;EAC7E,OAAOK,gBAAgB,GAAGhB,MAAM,CAACC,MAAM,CAAC,CAAEE,WAAW,EAAEE,eAAe,CAAE,CAAC;AAE7E;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsStlFormat.js","sources":["../../../../src/formats/stl/CjsStlFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\n/**\n * Exposed CarbonEngineJS-facing STL format class.\n *\n * Keep this file small and reviewable: STL parsing, writing, printability\n * inspection, option normalization, and JSON hydration live under src/core.\n */\n\nimport {\n CLASS_KEYS,\n DEFAULT_VALUES,\n OUTPUT_CMF,\n OUTPUT_GR2,\n OUTPUT_JSON,\n OUTPUT_SHARED,\n OUTPUT_STL_JSON,\n inspectWithValues,\n isBinaryStl,\n isStl,\n normalizeValues,\n readWithValues,\n toJsonValue,\n validateClass,\n validateClassKey,\n writeWithValues\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsStlFormat\";\n\n/**\n * Shared mesh accepted by the STL writer. STL exports only `vertex.position`\n * and triangular `indices[].faces`; all other shared channels are ignored.\n *\n * @typedef {object} CjsStlSharedMesh\n * @property {string} [name] Diagnostic mesh name; `solidName` controls the STL header.\n * @property {{position: ArrayLike<number>, normal?: ArrayLike<number>}} vertex Shared vertex channels.\n * @property {Array<{name?: string, faces: ArrayLike<number>}>} indices Triangle index groups.\n */\n\n/**\n * Shared geometry root accepted by the STL writer.\n *\n * @typedef {object} CjsStlSharedRoot\n * @property {Array<CjsStlSharedMesh>} meshes Meshes flattened into one STL solid.\n * @property {string} [grannyFileSource] Optional source label used by inspection.\n */\n\n/**\n * Reusable STL read, write, and inspection options.\n *\n * @typedef {object} CjsStlFormatOptions\n * @property {\"shared\"|\"stlJson\"|\"json\"|\"gr2\"|\"cmf\"} [emit=\"stlJson\"] Read output contract.\n * @property {string} [source=\"memory\"] Source label stored in read/inspection output.\n * @property {boolean} [binary=true] Whether writes return binary bytes instead of ASCII text.\n * @property {string} [solidName=\"carbonenginejs\"] Sanitized ASCII solid name and binary header label.\n * @property {number} [scale=1] Positive finite multiplier applied to exported positions.\n * @property {boolean} [recalculateNormals=true] Derive facet normals from winding instead of vertex normals.\n * @property {boolean} [weldVertices=false] Weld equal positions while reading STL.\n * @property {number} [weldTolerance=1e-5] Non-negative read/inspection position tolerance.\n * @property {boolean} [skipDegenerate=true] Omit degenerate shared triangles during writes.\n * @property {boolean} [requireWatertight=false] Reject writes with printability topology issues.\n * @property {Record<string, Function>} [classes] Caller constructors used for read hydration.\n */\n\n/**\n * CarbonEngineJS-facing STL format surface.\n *\n * The Cjs prefix marks this as a JavaScript format/construction boundary.\n * STL is a triangle-only import/export format; the JSON contract is the shared\n * CarbonEngineJS mesh schema.\n */\nexport class CjsStlFormat extends CjsFormat\n{\n\n #emit = DEFAULT_VALUES.emit;\n #source = DEFAULT_VALUES.source;\n #binary = DEFAULT_VALUES.binary;\n #solidName = DEFAULT_VALUES.solidName;\n #scale = DEFAULT_VALUES.scale;\n #recalculateNormals = DEFAULT_VALUES.recalculateNormals;\n #weldVertices = DEFAULT_VALUES.weldVertices;\n #weldTolerance = DEFAULT_VALUES.weldTolerance;\n #skipDegenerate = DEFAULT_VALUES.skipDegenerate;\n #requireWatertight = DEFAULT_VALUES.requireWatertight;\n #classes = DEFAULT_VALUES.classes;\n\n /**\n * Create a reusable format profile.\n *\n * The instance stores only normalized options; each `Read`, `Write`, or\n * `Inspect` call may provide non-mutating overrides.\n *\n * @param {CjsStlFormatOptions} [options={}] Default format values.\n * @throws {TypeError} If an option, output mode, numeric value, or class map is invalid.\n */\n constructor(options = {})\n {\n super();\n this.SetValues(options);\n }\n\n /**\n * Set format values for this reusable profile.\n *\n * @param {CjsStlFormatOptions} [options={}] Values to merge into the profile.\n * @returns {CjsStlFormat} This format profile.\n * @throws {TypeError} If an option, output mode, numeric value, or class map is invalid.\n */\n SetValues(options = {})\n {\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\n\n this.#emit = values.emit;\n this.#source = values.source;\n this.#binary = values.binary;\n this.#solidName = values.solidName;\n this.#scale = values.scale;\n this.#recalculateNormals = values.recalculateNormals;\n this.#weldVertices = values.weldVertices;\n this.#weldTolerance = values.weldTolerance;\n this.#skipDegenerate = values.skipDegenerate;\n this.#requireWatertight = values.requireWatertight;\n this.#classes = values.classes;\n\n return this;\n }\n\n /**\n * Get this profile's current values, optionally with per-call overrides.\n *\n * @param {CjsStlFormatOptions} [options={}] Optional values to merge into a copy.\n * @returns {CjsStlFormatOptions} A validated copy of the effective values.\n * @throws {TypeError} If an override is invalid.\n */\n GetValues(options = {})\n {\n return normalizeValues({\n emit: this.#emit,\n source: this.#source,\n binary: this.#binary,\n solidName: this.#solidName,\n scale: this.#scale,\n recalculateNormals: this.#recalculateNormals,\n weldVertices: this.#weldVertices,\n weldTolerance: this.#weldTolerance,\n skipDegenerate: this.#skipDegenerate,\n requireWatertight: this.#requireWatertight,\n classes: this.#classes\n }, options, FORMAT_NAME);\n }\n\n /**\n * Set multiple node-class constructors for this profile.\n *\n * @param {object} [classes] Map of node class keys to constructors.\n * @returns {CjsStlFormat} This format profile.\n */\n SetClasses(classes = {})\n {\n return this.SetValues({ classes });\n }\n\n /**\n * Set one node-class constructor for this profile.\n *\n * @param {string} type Node class key.\n * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.\n * @returns {CjsStlFormat} This format profile.\n */\n SetClass(type, Class)\n {\n if (Class === null || Class === undefined)\n {\n validateClassKey(type, FORMAT_NAME);\n const classes = { ...this.#classes };\n delete classes[type];\n this.#classes = classes;\n return this;\n }\n\n validateClass(type, Class, FORMAT_NAME);\n return this.SetValues({ classes: { [type]: Class } });\n }\n\n /**\n * Get a configured node-class constructor.\n *\n * @param {string} type Node class key.\n * @returns {Function|undefined} The registered constructor, if any.\n */\n GetClass(type)\n {\n validateClassKey(type, FORMAT_NAME);\n return this.#classes[type];\n }\n\n /**\n * Whether this format profile has a constructor registered for a node class key.\n *\n * @param {string} type Node class key.\n * @returns {boolean} True when a constructor is registered.\n */\n HasClass(type)\n {\n return !!this.GetClass(type);\n }\n\n /**\n * Read STL text/bytes with this profile's values.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n Read(input, options = {})\n {\n return readWithValues(this, input, this.GetValues(options));\n }\n\n /**\n * Write shared JSON geometry as STL with this profile's values.\n *\n * Multiple meshes and index groups are flattened in encounter order because\n * STL has no portable material or scene hierarchy. Degenerate triangles are\n * skipped by default. Binary output validates that every coordinate is\n * representable as float32 rather than silently writing infinities.\n *\n * @param {CjsStlSharedRoot|CjsStlSharedMesh} input Shared JSON root or mesh.\n * @param {CjsStlFormatOptions} [options={}] Per-call writer overrides.\n * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.\n * @throws {TypeError|RangeError|Error} If geometry, indices, coordinates, topology, or options are invalid.\n */\n Write(input, options = {})\n {\n return writeWithValues(input, this.GetValues(options));\n }\n\n /**\n * Inspect STL text/bytes or shared JSON geometry for printability blockers.\n *\n * @param {any} input STL text/bytes or shared JSON root/mesh.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain printability report.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Convert format output to JSON-compatible data.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Static one-shot read. Static methods use camelCase by convention.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.\n * @param {object} [options] Format values.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n static read(input, options = {})\n {\n return readWithValues(CjsStlFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static one-shot write.\n *\n * The call is one-shot and does not mutate `input`. Multiple meshes and\n * index groups are flattened into a single STL solid in encounter order.\n *\n * @param {CjsStlSharedRoot|CjsStlSharedMesh} input Shared JSON root or mesh.\n * @param {CjsStlFormatOptions} [options={}] Writer values.\n * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.\n * @throws {TypeError|RangeError|Error} If geometry, indices, coordinates, topology, or options are invalid.\n */\n static write(input, options = {})\n {\n return writeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static one-shot inspection.\n *\n * @param {any} input STL text/bytes or shared JSON root/mesh.\n * @param {object} [options] Format values.\n * @returns {object} Plain printability report.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static JSON-compatible conversion.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Cheap sniff for STL-like input.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.\n * @returns {boolean} True when input looks like STL.\n */\n static isStl(input)\n {\n return isStl(input);\n }\n\n /**\n * Check whether byte-like input has an exact binary STL layout.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.\n * @returns {boolean} True when input is binary STL bytes.\n */\n static isBinaryStl(input)\n {\n return isBinaryStl(input);\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n JSON: OUTPUT_JSON,\n STL_JSON: OUTPUT_STL_JSON,\n SHARED: OUTPUT_SHARED,\n GR2: OUTPUT_GR2,\n CMF: OUTPUT_CMF\n });\n static CLASS_KEYS = CLASS_KEYS;\n static id = \"stl\";\n static mediaTypes = Object.freeze([ \"geometry\" ]);\n static outputs = CjsFormat.defineOutputs({\n shared: { decoded: true },\n gr2: { decoded: true },\n cmf: { decoded: true },\n json: { role: \"debug\", decoded: true },\n stlJson: { role: \"debug\", default: true, decoded: true }\n });\n static extensions = Object.freeze([ \".stl\" ]);\n\n}\n\nexport default CjsStlFormat;\n"],"names":["FORMAT_NAME","CjsStlFormat","CjsFormat","DEFAULT_VALUES","emit","source","binary","solidName","scale","recalculateNormals","weldVertices","weldTolerance","skipDegenerate","requireWatertight","classes","constructor","options","SetValues","values","normalizeValues","GetValues","SetClasses","SetClass","type","Class","undefined","validateClassKey","validateClass","GetClass","HasClass","Read","input","readWithValues","Write","writeWithValues","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","write","inspect","toJSON","isStl","isBinaryStl","Output","Object","freeze","JSON","OUTPUT_JSON","STL_JSON","OUTPUT_STL_JSON","SHARED","OUTPUT_SHARED","GR2","OUTPUT_GR2","CMF","OUTPUT_CMF","CLASS_KEYS","id","mediaTypes","outputs","defineOutputs","shared","decoded","gr2","cmf","json","role","stlJson","default","extensions"],"mappings":";;;;AA2BA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA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CAAE,MAAM,CAAE,CAAC;AAEjD;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CjsFormat } from '../../format/CjsFormat.js';
|
|
2
|
+
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, toJsonValue, probeSupportWithValues, isTGA, toBytes, OUTPUT_JSON, OUTPUT_RAW, OUTPUT_RGBA, OUTPUT_IMAGE } from './core/helpers.js';
|
|
2
3
|
|
|
3
4
|
const FORMAT_NAME = "CjsTgaFormat";
|
|
4
5
|
|
|
@@ -6,7 +7,7 @@ const FORMAT_NAME = "CjsTgaFormat";
|
|
|
6
7
|
* TGA format profile that inspects header metadata and reads TGA bytes into
|
|
7
8
|
* raw, debug JSON, or decoded RGBA image payloads.
|
|
8
9
|
*/
|
|
9
|
-
class CjsTgaFormat {
|
|
10
|
+
class CjsTgaFormat extends CjsFormat {
|
|
10
11
|
#values = DEFAULT_VALUES;
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -15,6 +16,7 @@ class CjsTgaFormat {
|
|
|
15
16
|
* @param {object} [options] Default read/inspect options.
|
|
16
17
|
*/
|
|
17
18
|
constructor(options = {}) {
|
|
19
|
+
super();
|
|
18
20
|
this.SetValues(options);
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -78,17 +80,6 @@ class CjsTgaFormat {
|
|
|
78
80
|
return inspectWithValues(input, this.GetValues(options), "tga");
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
/**
|
|
82
|
-
* Report whether TGA input and requested output variants are supported.
|
|
83
|
-
*
|
|
84
|
-
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
85
|
-
* @param {object} [options] Per-call values.
|
|
86
|
-
* @returns {object} Support/probe report.
|
|
87
|
-
*/
|
|
88
|
-
IsSupported(input, options = {}) {
|
|
89
|
-
return isSupportedWithValues(input, this.GetValues(options), "tga");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
83
|
/**
|
|
93
84
|
* Convert format output into JSON-compatible debug data.
|
|
94
85
|
*
|
|
@@ -145,8 +136,8 @@ class CjsTgaFormat {
|
|
|
145
136
|
* @param {object} [options] Probe options.
|
|
146
137
|
* @returns {object} Support/probe report.
|
|
147
138
|
*/
|
|
148
|
-
static
|
|
149
|
-
return
|
|
139
|
+
static probeSupport(input, options = {}) {
|
|
140
|
+
return probeSupportWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
150
141
|
inputType: "tga",
|
|
151
142
|
...options
|
|
152
143
|
}, FORMAT_NAME), "tga");
|
|
@@ -186,11 +177,27 @@ class CjsTgaFormat {
|
|
|
186
177
|
JSON: OUTPUT_JSON
|
|
187
178
|
});
|
|
188
179
|
static OUTPUT_TGA_JSON = "tgaJson";
|
|
189
|
-
static
|
|
180
|
+
static id = "tga";
|
|
190
181
|
static mediaTypes = Object.freeze(["image"]);
|
|
191
|
-
static
|
|
192
|
-
|
|
193
|
-
|
|
182
|
+
static outputs = CjsFormat.defineOutputs({
|
|
183
|
+
image: {
|
|
184
|
+
decoded: true,
|
|
185
|
+
probes: ["image", "rgba"]
|
|
186
|
+
},
|
|
187
|
+
rgba: {
|
|
188
|
+
decoded: true
|
|
189
|
+
},
|
|
190
|
+
tgaJson: {
|
|
191
|
+
role: "debug",
|
|
192
|
+
probes: ["tgaJson", "raw"]
|
|
193
|
+
},
|
|
194
|
+
raw: {
|
|
195
|
+
role: "debug",
|
|
196
|
+
default: true,
|
|
197
|
+
passthrough: true
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
static extensions = Object.freeze([".tga"]);
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
export { CjsTgaFormat };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsTgaFormat.js","sources":["../../../../src/formats/tga/CjsTgaFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n isSupportedWithValues,\n isTGA,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsTgaFormat\";\n\n/**\n * TGA format profile that inspects header metadata and reads TGA bytes into\n * raw, debug JSON, or decoded RGBA image payloads.\n */\nexport class CjsTgaFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable TGA format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsTgaFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"tga\", ...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: \"tga\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read TGA bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Read TGA bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect TGA bytes without decoding full image data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} TGA header metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Report whether TGA input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"tga\");\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 TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot asynchronous TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsTgaFormat.read(input, options);\n }\n\n /**\n * One-shot TGA inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} TGA header metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot TGA support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\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 TGA file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate TGA bytes.\n * @returns {boolean} True when the TGA header looks valid.\n */\n static isTGA(input)\n {\n try\n {\n return isTGA(toBytes(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 IMAGE: OUTPUT_IMAGE,\n RGBA: OUTPUT_RGBA,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n\n static OUTPUT_TGA_JSON = \"tgaJson\";\n\n static type = Object.freeze([ \"image\" ]);\n\n static mediaTypes = Object.freeze([ \"image\" ]);\n\n static inputTypes = Object.freeze([ \"tga\" ]);\n\n static outputTypes = Object.freeze([ OUTPUT_IMAGE, OUTPUT_RGBA ]);\n\n static debugOutputTypes = Object.freeze([ \"tgaJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsTgaFormat;\n"],"names":["FORMAT_NAME","CjsTgaFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isTGA","toBytes","Output","Object","freeze","IMAGE","OUTPUT_IMAGE","RGBA","OUTPUT_RGBA","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_TGA_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,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,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A;AACJ;AACA;AACA;AACA;AACA;EACI,OAAOO,KAAKA,CAACf,KAAK,EAClB;IACI,IACA;AACI,MAAA,OAAOe,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC;AAChC,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;;AAEA;AACJ;AACA;AACI,EAAA,OAAOiB,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,KAAK,EAAEC,YAAY;AACnBC,IAAAA,IAAI,EAAEC,WAAW;AACjBC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,IAAI,EAAEC;AACV,GAAC,CAAC;EAEF,OAAOC,eAAe,GAAG,SAAS;EAElC,OAAOC,IAAI,GAAGX,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAExC,OAAOW,UAAU,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAE9C,OAAOY,UAAU,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAE5C,OAAOa,WAAW,GAAGd,MAAM,CAACC,MAAM,CAAC,CAAEE,YAAY,EAAEE,WAAW,CAAE,CAAC;EAEjE,OAAOU,gBAAgB,GAAGf,MAAM,CAACC,MAAM,CAAC,CAAE,SAAS,EAAEM,UAAU,CAAE,CAAC;AACtE;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsTgaFormat.js","sources":["../../../../src/formats/tga/CjsTgaFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n probeSupportWithValues,\n isTGA,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsTgaFormat\";\n\n/**\n * TGA format profile that inspects header metadata and reads TGA bytes into\n * raw, debug JSON, or decoded RGBA image payloads.\n */\nexport class CjsTgaFormat extends CjsFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable TGA 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 {CjsTgaFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"tga\", ...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: \"tga\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read TGA bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Read TGA bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect TGA bytes without decoding full image data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} TGA header metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"tga\");\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 TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot asynchronous TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsTgaFormat.read(input, options);\n }\n\n /**\n * One-shot TGA inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} TGA header metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot TGA support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA 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: \"tga\", ...options }, FORMAT_NAME), \"tga\");\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 TGA file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate TGA bytes.\n * @returns {boolean} True when the TGA header looks valid.\n */\n static isTGA(input)\n {\n try\n {\n return isTGA(toBytes(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 IMAGE: OUTPUT_IMAGE,\n RGBA: OUTPUT_RGBA,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n\n static OUTPUT_TGA_JSON = \"tgaJson\";\n\n static id = \"tga\";\n\n static mediaTypes = Object.freeze([ \"image\" ]);\n\n static outputs = CjsFormat.defineOutputs({\n\n image: { decoded: true, probes: [ \"image\", \"rgba\" ] },\n\n rgba: { decoded: true },\n\n tgaJson: { role: \"debug\", probes: [ \"tgaJson\", \"raw\" ] },\n\n raw: { role: \"debug\", default: true, passthrough: true }\n\n });\n\n static extensions = Object.freeze([ \".tga\" ]);\n}\n\nexport default CjsTgaFormat;\n"],"names":["FORMAT_NAME","CjsTgaFormat","CjsFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","probeSupport","probeSupportWithValues","toJSON","isTGA","toBytes","Output","Object","freeze","IMAGE","OUTPUT_IMAGE","RGBA","OUTPUT_RGBA","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_TGA_JSON","id","mediaTypes","outputs","defineOutputs","image","decoded","probes","rgba","tgaJson","role","raw","default","passthrough","extensions"],"mappings":";;;AAgBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;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;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AA,IAAI,EAAEC;AACV,GAAC,CAAC;EAEF,OAAOC,eAAe,GAAG,SAAS;EAElC,OAAOC,EAAE,GAAG,KAAK;EAEjB,OAAOC,UAAU,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;AAE9C,EAAA,OAAOY,OAAO,GAAGvC,SAAS,CAACwC,aAAa,CAAC;AAErCC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,OAAO,EAAE,IAAI;AAAEC,MAAAA,MAAM,EAAE,CAAE,OAAO,EAAE,MAAM;KAAI;AAErDC,IAAAA,IAAI,EAAE;AAAEF,MAAAA,OAAO,EAAE;KAAM;AAEvBG,IAAAA,OAAO,EAAE;AAAEC,MAAAA,IAAI,EAAE,OAAO;AAAEH,MAAAA,MAAM,EAAE,CAAE,SAAS,EAAE,KAAK;KAAI;AAExDI,IAAAA,GAAG,EAAE;AAAED,MAAAA,IAAI,EAAE,OAAO;AAAEE,MAAAA,OAAO,EAAE,IAAI;AAAEC,MAAAA,WAAW,EAAE;AAAK;AAE3D,GAAC,CAAC;EAEF,OAAOC,UAAU,GAAGxB,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AACjD;;;;"}
|
|
@@ -82,7 +82,7 @@ function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
|
82
82
|
* Reports whether input is supported under normalized format options for the TGA
|
|
83
83
|
* format reader.
|
|
84
84
|
*/
|
|
85
|
-
function
|
|
85
|
+
function probeSupportWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
86
86
|
try {
|
|
87
87
|
const metadata = inspectWithValues(input, values, expectedType);
|
|
88
88
|
const canDecodeTga = metadata.sourceFormat === "tga" && canDecodeTgaToRgba(metadata);
|
|
@@ -93,10 +93,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
93
93
|
payloadType: "rgba",
|
|
94
94
|
codec: "rgba8unorm",
|
|
95
95
|
supported: canDecodeTga,
|
|
96
|
-
reason: canDecodeTga ? "" : "Only supported true-color, grayscale, and indexed TGA images are decoded to RGBA."
|
|
97
|
-
containerOnly: false,
|
|
98
|
-
isDecoded: canDecodeTga,
|
|
99
|
-
rgbaDecodeSupported: canDecodeTga
|
|
96
|
+
reason: canDecodeTga ? "" : "Only supported true-color, grayscale, and indexed TGA images are decoded to RGBA."
|
|
100
97
|
}, rawVariant(metadata, canDecodeTga)];
|
|
101
98
|
} else {
|
|
102
99
|
variants = [rawVariant(metadata, false), {
|
|
@@ -104,10 +101,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
104
101
|
payloadType: "rgba",
|
|
105
102
|
codec: "rgba8unorm",
|
|
106
103
|
supported: false,
|
|
107
|
-
reason: `${metadata.sourceFormat.toUpperCase()} RGBA decode is not implemented yet
|
|
108
|
-
containerOnly: false,
|
|
109
|
-
isDecoded: false,
|
|
110
|
-
rgbaDecodeSupported: false
|
|
104
|
+
reason: `${metadata.sourceFormat.toUpperCase()} RGBA decode is not implemented yet.`
|
|
111
105
|
}];
|
|
112
106
|
}
|
|
113
107
|
return {
|
|
@@ -115,7 +109,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
115
109
|
source: values.source || "buffer",
|
|
116
110
|
supported: metadata.sourceFormat ? variants.some(v => v.supported && v.kind === "rgba") ? "full" : "partial" : "none",
|
|
117
111
|
confidence: metadata.sourceFormat ? 1 : 0,
|
|
118
|
-
|
|
112
|
+
preferredOutput: variants.find(v => v.supported)?.kind || "",
|
|
119
113
|
reason: metadata.sourceFormat ? "Container/header recognized." : "Unrecognized image format.",
|
|
120
114
|
metadata,
|
|
121
115
|
variants,
|
|
@@ -128,7 +122,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
128
122
|
source: values.source || "buffer",
|
|
129
123
|
supported: "none",
|
|
130
124
|
confidence: 0,
|
|
131
|
-
|
|
125
|
+
preferredOutput: "",
|
|
132
126
|
reason: error.message,
|
|
133
127
|
metadata: null,
|
|
134
128
|
variants: [],
|
|
@@ -147,9 +141,6 @@ function readWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
|
147
141
|
payloadType: "raw",
|
|
148
142
|
sourceFormat: metadata.sourceFormat,
|
|
149
143
|
mimeType: imageMimeType(metadata.sourceFormat),
|
|
150
|
-
containerOnly: true,
|
|
151
|
-
isDecoded: false,
|
|
152
|
-
rgbaDecodeSupported: metadata.sourceFormat === "tga" && canDecodeTgaToRgba(metadata),
|
|
153
144
|
metadata,
|
|
154
145
|
bytes
|
|
155
146
|
};
|
|
@@ -366,9 +357,6 @@ function decodeTgaToRgba(bytes, metadata) {
|
|
|
366
357
|
payloadType: OUTPUT_RGBA,
|
|
367
358
|
sourceFormat: "tga",
|
|
368
359
|
mimeType: "image/x-tga",
|
|
369
|
-
containerOnly: false,
|
|
370
|
-
isDecoded: true,
|
|
371
|
-
rgbaDecodeSupported: true,
|
|
372
360
|
width: metadata.width,
|
|
373
361
|
height: metadata.height,
|
|
374
362
|
pixelFormat: "rgba8unorm",
|
|
@@ -386,10 +374,7 @@ function rawVariant(metadata, canDecode) {
|
|
|
386
374
|
payloadType: "raw",
|
|
387
375
|
codec: metadata.sourceFormat,
|
|
388
376
|
mimeType: imageMimeType(metadata.sourceFormat),
|
|
389
|
-
supported: true
|
|
390
|
-
containerOnly: true,
|
|
391
|
-
isDecoded: false,
|
|
392
|
-
rgbaDecodeSupported: metadata.sourceFormat === "tga" && canDecode === true
|
|
377
|
+
supported: true
|
|
393
378
|
};
|
|
394
379
|
}
|
|
395
380
|
function imageMimeType(sourceFormat) {
|
|
@@ -489,5 +474,5 @@ function capitalize(value) {
|
|
|
489
474
|
return value ? value[0].toUpperCase() + value.slice(1) : "Image";
|
|
490
475
|
}
|
|
491
476
|
|
|
492
|
-
export { DEFAULT_VALUES, OUTPUT_IMAGE, OUTPUT_JSON, OUTPUT_RAW, OUTPUT_RGBA, inspectBytes, inspectWithValues, isDDS, isJPEG, isPNG,
|
|
477
|
+
export { DEFAULT_VALUES, OUTPUT_IMAGE, OUTPUT_JSON, OUTPUT_RAW, OUTPUT_RGBA, inspectBytes, inspectWithValues, isDDS, isJPEG, isPNG, isTGA, normalizeEmit, normalizeInputType, normalizeValues, probeSupportWithValues, readWithValues, toBytes, toJsonValue };
|
|
493
478
|
//# sourceMappingURL=helpers.js.map
|