@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":"TriTextureRes.js","sources":["../../../../src/resource/texture/TriTextureRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.h\n// Source: trinity/trinity/Resources/TriTextureRes.cpp\n// Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp\nimport { CjsSchema, carbon, impl, io, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport {\n ResourcePayloadType,\n validateRgbaPayload,\n validateTexturePayload,\n validateVideoPayload\n} from \"../../format/payloadContract.js\";\nimport {\n resourceBoundaryError,\n resourcePayloadError,\n validateResourcePayload\n} from \"../resourceBoundary.js\";\n\n/**\n * Resource record that owns Carbon-style texture identity and validated\n * texture, RGBA, or video payload facts with mirrored dimension/format\n * metadata, while engine packages decide what those facts become on a device.\n *\n * The resource never creates or retains a backend texture.\n */\nexport class TriTextureRes extends CjsResource\n{\n format = null;\n type = null;\n averageColor = [0, 0, 0, 0];\n depth = 0;\n cutoutHeight = 1;\n height = 0;\n lodEnabled = false;\n hadLodRequests = false;\n cpuMip = 0;\n gpuMip = 0;\n wrappedRenderTarget = null;\n originalResolution = 0;\n originalMemoryUsage = 0;\n name = \"\";\n arraySize = 0;\n cutoutWidth = 1;\n width = 0;\n cutoutX = 0;\n cutoutY = 0;\n\n /** Creates a TriTextureRes with caller-provided initial state. */\n constructor(values = null) {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed\n * metadata. Invalid payloads are rejected before replacing the current one.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {TriTextureRes}\n */\n SetPayload(payload = null, options = null) {\n if (payload === null) {\n super.SetPayload(null);\n return this;\n }\n\n const validator = {\n [ResourcePayloadType.RGBA]: validateRgbaPayload,\n [ResourcePayloadType.TEXTURE]: validateTexturePayload,\n [ResourcePayloadType.VIDEO]: validateVideoPayload\n }[payload?.payloadType];\n if (!validator) {\n throw resourcePayloadError(\n \"TriTextureRes\",\n 'Expected payloadType \"rgba\", \"texture\", or \"video\".',\n \"payloadType\"\n );\n }\n validateResourcePayload(\"TriTextureRes\", payload, validator);\n\n const values = { ...(options || {}) };\n if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;\n if (payload.width !== undefined) values.width = payload.width;\n if (payload.height !== undefined) values.height = payload.height;\n if (payload.depth !== undefined) values.depth = payload.depth;\n if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;\n else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;\n if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;\n else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;\n if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;\n values.originalMemoryUsage = getPayloadMemoryUsage(payload);\n values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);\n\n super.SetPayload(payload);\n this.SetValues(values);\n return this;\n }\n\n /**\n * Return the number of mip levels known to this texture resource.\n *\n * @returns {number}\n */\n GetMipCount() {\n return this.GetPayload()?.mipCount || this.cpuMip || 0;\n }\n\n /**\n * Return the multisample type for this texture.\n *\n * @returns {number}\n */\n GetMsaaType() {\n const payload = this.GetPayload();\n return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;\n }\n\n /**\n * Return the multisample quality for this texture.\n *\n * @returns {number}\n */\n GetMsaaQuality() {\n const payload = this.GetPayload();\n return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;\n }\n\n /**\n * Return true if this texture has received LOD requests.\n *\n * @returns {boolean}\n */\n HadLodRequests() {\n return this.hadLodRequests;\n }\n\n /**\n * Return the shader-resource-view heap index when a backend owns one.\n *\n * @returns {number}\n */\n GetSrvIndexInHeap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"GetSrvIndexInHeap\", \"Runtime-resource does not own descriptor heaps.\");\n }\n\n /**\n * Save this texture asynchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n SaveAsync(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"SaveAsync\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Save this texture synchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n Save(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"Save\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Return true if an asynchronous save is active.\n *\n * @returns {boolean}\n */\n IsSaving() {\n return false;\n }\n\n /**\n * Return true if the asynchronous save operation has completed.\n *\n * @returns {boolean}\n */\n IsSaveCompleted() {\n return true;\n }\n\n /**\n * Return true if the asynchronous save operation succeeded.\n *\n * @returns {boolean}\n */\n IsSaveSucceeded() {\n return false;\n }\n\n /**\n * Wait for an asynchronous save operation.\n *\n * @returns {boolean}\n */\n WaitForSave() {\n return this.IsSaveCompleted();\n }\n\n /**\n * Device texture allocation belongs to engine-gpu.\n *\n * @throws {Error}\n */\n CreateEmptyTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateEmptyTexture\", \"Use engine-gpu to allocate device textures.\");\n }\n\n /**\n * Render-target wrapping belongs to engine-gpu.\n *\n * @throws {Error}\n */\n SetFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"SetFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a texture copy from a render target.\n *\n * @throws {Error}\n */\n CreateAndCopyFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateAndCopyFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a device texture from a host bitmap.\n *\n * @throws {Error}\n */\n CreateFromHostBitmap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromHostBitmap\", \"Use engine-gpu to allocate and upload texture data.\");\n }\n\n /**\n * Create this texture from another texture resource.\n *\n * @throws {Error}\n */\n CreateFromTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromTexture\", \"Use engine-gpu to copy device textures.\");\n }\n\n /**\n * Return true if this texture owns a backend allocation object.\n *\n * @param {string|number} type\n * @param {string|number} object\n * @returns {boolean}\n */\n HasALObject(type, object) {\n return this.HasAdapterResource(`${type}:${object}`);\n }\n\n /**\n * Return an engine-owned texture pipeline object when attached.\n *\n * @returns {*}\n */\n GetPipeline() {\n return this.GetAdapterResource(\"pipeline\");\n }\n\n /**\n * Return memory size for the original non-LODed texture.\n *\n * @returns {number}\n */\n GetOriginalMemoryUsage() {\n return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());\n }\n\n /**\n * Store the average color reported by decoded texture data.\n *\n * @param {number} red\n * @param {number} green\n * @param {number} blue\n * @param {number} alpha\n * @returns {TriTextureRes}\n */\n SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {\n this.averageColor = [red, green, blue, alpha];\n return this;\n }\n\n /**\n * Update a texture subresource.\n *\n * @throws {Error}\n */\n UpdateSubresource() {\n throw resourceBoundaryError(\"TriTextureRes\", \"UpdateSubresource\", \"Use engine-gpu to upload texture bytes.\");\n }\n\n /**\n * Resource preparation does not decide device upload policy.\n *\n * @returns {boolean}\n */\n PrepareResources() {\n return this.IsPrepared();\n }\n\n static payload = \"texture\";\n}\n\nfunction getPayloadMemoryUsage(payload)\n{\n if (!payload || typeof payload !== \"object\") return 0;\n if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0)\n {\n return payload.originalMemoryUsage;\n }\n return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer\n ? payload.data.byteLength\n : 0;\n}\n\n// Declared as data rather than with decorators, so the resource tree loads from\n// source without a transform. Field order is key order, and GetValues() exports\n// in that order.\nCjsSchema.define(TriTextureRes, {\n className: \"TriTextureRes\",\n family: \"resources\",\n fields: {\n format: [ type.unknown, io.read ],\n type: [ type.unknown, io.persist ],\n averageColor: [ type.color, io.read ],\n depth: [ type.uint32, io.read ],\n cutoutHeight: [ type.float32, io.readwrite ],\n height: [ type.uint32, io.read ],\n lodEnabled: [ type.boolean, io.read ],\n hadLodRequests: [ type.boolean, io.read ],\n cpuMip: [ type.uint32, io.read ],\n gpuMip: [ type.uint32, io.read ],\n wrappedRenderTarget: [ type.unknown, io.read ],\n originalResolution: [ type.uint32, io.read ],\n originalMemoryUsage: [ type.uint64, io.read ],\n name: [ type.string, io.readwrite ],\n arraySize: [ type.uint32, io.read ],\n cutoutWidth: [ type.float32, io.readwrite ],\n width: [ type.uint32, io.read ],\n cutoutX: [ type.float32, io.readwrite ],\n cutoutY: [ type.float32, io.readwrite ]\n },\n methods: {\n GetMipCount: [ carbon.method, impl.adapted ],\n GetMsaaType: [ carbon.method, impl.adapted ],\n GetMsaaQuality: [ carbon.method, impl.adapted ],\n HadLodRequests: [ carbon.method, impl.adapted ],\n GetSrvIndexInHeap: [ carbon.method, impl.notSupported ],\n SaveAsync: [ carbon.method, impl.notSupported ],\n Save: [ carbon.method, impl.notSupported ],\n IsSaving: [ carbon.method, impl.noop ],\n IsSaveCompleted: [ carbon.method, impl.noop ],\n IsSaveSucceeded: [ carbon.method, impl.noop ],\n WaitForSave: [ carbon.method, impl.noop ],\n CreateEmptyTexture: [ carbon.method, impl.notSupported ],\n SetFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateAndCopyFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateFromHostBitmap: [ carbon.method, impl.notSupported ],\n CreateFromTexture: [ carbon.method, impl.notSupported ],\n HasALObject: [ carbon.method, impl.adapted ],\n GetPipeline: [ carbon.method, impl.adapted ],\n GetOriginalMemoryUsage: [ carbon.method, impl.adapted ],\n SetAverageColor: [ carbon.method, impl.adapted ],\n UpdateSubresource: [ carbon.method, impl.notSupported ],\n PrepareResources: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["TriTextureRes","CjsResource","format","type","averageColor","depth","cutoutHeight","height","lodEnabled","hadLodRequests","cpuMip","gpuMip","wrappedRenderTarget","originalResolution","originalMemoryUsage","name","arraySize","cutoutWidth","width","cutoutX","cutoutY","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","SetPayload","payload","options","validator","ResourcePayloadType","RGBA","validateRgbaPayload","TEXTURE","validateTexturePayload","VIDEO","validateVideoPayload","payloadType","resourcePayloadError","validateResourcePayload","pixelFormat","undefined","Array","isArray","faces","length","mipCount","getPayloadMemoryUsage","Math","max","GetMipCount","GetPayload","GetMsaaType","multiSampleType","msaaType","samples","GetMsaaQuality","multiSampleQuality","msaaQuality","HadLodRequests","GetSrvIndexInHeap","resourceBoundaryError","SaveAsync","path","Save","IsSaving","IsSaveCompleted","IsSaveSucceeded","WaitForSave","CreateEmptyTexture","SetFromRenderTarget","CreateAndCopyFromRenderTarget","CreateFromHostBitmap","CreateFromTexture","HasALObject","object","HasAdapterResource","GetPipeline","GetAdapterResource","GetOriginalMemoryUsage","SetAverageColor","red","green","blue","alpha","UpdateSubresource","PrepareResources","IsPrepared","Number","isSafeInteger","ArrayBuffer","isView","data","byteLength","CjsSchema","define","className","family","fields","unknown","io","read","persist","color","uint32","float32","readwrite","boolean","uint64","string","methods","carbon","method","impl","adapted","notSupported","noop"],"mappings":";;;;;AAAA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,WAAW,CAC9C;AACEC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3BC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,YAAY,GAAG,CAAC;AAChBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,UAAU,GAAG,KAAK;AAClBC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,kBAAkB,GAAG,CAAC;AACtBC,EAAAA,mBAAmB,GAAG,CAAC;AACvBC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,CAAC;AACbC,EAAAA,WAAW,GAAG,CAAC;AACfC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,OAAO,GAAG,CAAC;AACXC,EAAAA,OAAO,GAAG,CAAC;;AAEX;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EAAE;AACzB,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,MAAM,IAAI,EAAE,EAAE;AAC3BE,MAAAA,SAAS,EAAE,KAAK;AAChBC,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,UAAU,EAAE;AACd,KAAC,CAAC;AACJ,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,UAAUA,CAACC,OAAO,GAAG,IAAI,EAAE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D7C,mBAAmB,EAAE,CAAEyC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,YAAY,CAAE;IACzD5C,6BAA6B,EAAE,CAAEwC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,YAAY,CAAE;IACnE3C,oBAAoB,EAAE,CAAEuC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,YAAY,CAAE;IAC1D1C,iBAAiB,EAAE,CAAEsC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,YAAY,CAAE;IACvDzC,WAAW,EAAE,CAAEqC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC5CrC,WAAW,EAAE,CAAEkC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC5CnC,sBAAsB,EAAE,CAAEgC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACvDlC,eAAe,EAAE,CAAE+B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAChD7B,iBAAiB,EAAE,CAAE0B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,YAAY,CAAE;IACvD7B,gBAAgB,EAAE,CAAEyB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AACjD;AACF,CAAC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TriTextureRes.js","sources":["../../../../src/resource/texture/TriTextureRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.h\n// Source: trinity/trinity/Resources/TriTextureRes.cpp\n// Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp\nimport { CjsSchema, carbon, impl, io, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\nimport {\n ResourcePayloadType,\n validateRgbaPayload,\n validateTexturePayload,\n validateVideoPayload\n} from \"../../format/payloadContract.js\";\nimport {\n resourceBoundaryError,\n resourceFormatRequiredError,\n resourcePayloadError,\n validateResourcePayload\n} from \"../resourceBoundary.js\";\n\n/**\n * Resource record that owns Carbon-style texture identity and validated\n * texture, RGBA, or video payload facts with mirrored dimension/format\n * metadata, while engine packages decide what those facts become on a device.\n *\n * The resource never creates or retains a backend texture.\n */\nexport class TriTextureRes extends CjsResource\n{\n format = null;\n type = null;\n averageColor = [0, 0, 0, 0];\n depth = 0;\n cutoutHeight = 1;\n height = 0;\n lodEnabled = false;\n hadLodRequests = false;\n cpuMip = 0;\n gpuMip = 0;\n wrappedRenderTarget = null;\n originalResolution = 0;\n originalMemoryUsage = 0;\n name = \"\";\n arraySize = 0;\n cutoutWidth = 1;\n width = 0;\n cutoutX = 0;\n cutoutY = 0;\n\n /** Creates a TriTextureRes with caller-provided initial state. */\n constructor(values = null) {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed\n * metadata. Invalid payloads are rejected before replacing the current one.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {TriTextureRes}\n */\n SetPayload(payload = null, options = null) {\n if (payload === null) {\n super.SetPayload(null);\n return this;\n }\n\n const validator = {\n [ResourcePayloadType.RGBA]: validateRgbaPayload,\n [ResourcePayloadType.TEXTURE]: validateTexturePayload,\n [ResourcePayloadType.VIDEO]: validateVideoPayload\n }[payload?.payloadType];\n if (!validator) {\n throw resourcePayloadError(\n \"TriTextureRes\",\n 'Expected payloadType \"rgba\", \"texture\", or \"video\".',\n \"payloadType\"\n );\n }\n validateResourcePayload(\"TriTextureRes\", payload, validator);\n\n const values = { ...(options || {}) };\n if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;\n if (payload.width !== undefined) values.width = payload.width;\n if (payload.height !== undefined) values.height = payload.height;\n if (payload.depth !== undefined) values.depth = payload.depth;\n if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;\n else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;\n if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;\n else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;\n if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;\n values.originalMemoryUsage = getPayloadMemoryUsage(payload);\n values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);\n\n super.SetPayload(payload);\n this.SetValues(values);\n return this;\n }\n\n /**\n * Turn source bytes into this texture.\n *\n * This is the family the route design exists for. One `.dds` is readable as a\n * compressed `texture` or decoded `rgba`, and six formats — dds, png, jpeg,\n * tga, gif, webp — populate this same resource. Which reader and which\n * representation is a registration decision, so neither is written here.\n *\n * The resource imports none of them. A texture resource that imported its\n * formats would drag all six into anything that touches a texture, which is\n * the whole reason the store exists.\n *\n * @param {ArrayBuffer|ArrayBufferView|object} data Source bytes, or a payload already read.\n * @param {object|null} [options] `{ format, read, output }` plus values applied after the read.\n * @returns {TriTextureRes} This resource.\n */\n DoLoad(data, options = null) {\n const { format = null, read = null, output = null, ...values } = options || {};\n\n // Already a payload: the manager read it, and there is nothing to route.\n if (data?.payloadType !== undefined) return this.SetPayload(data, values);\n\n const route = this.ResolveFormat(data, format ? { format, read, output } : { output });\n if (!route) throw resourceFormatRequiredError(\"TriTextureRes\", this.ext, output);\n return this.SetPayload(route.Read(data), values);\n }\n\n /**\n * Return the number of mip levels known to this texture resource.\n *\n * @returns {number}\n */\n GetMipCount() {\n return this.GetPayload()?.mipCount || this.cpuMip || 0;\n }\n\n /**\n * Return the multisample type for this texture.\n *\n * @returns {number}\n */\n GetMsaaType() {\n const payload = this.GetPayload();\n return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;\n }\n\n /**\n * Return the multisample quality for this texture.\n *\n * @returns {number}\n */\n GetMsaaQuality() {\n const payload = this.GetPayload();\n return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;\n }\n\n /**\n * Return true if this texture has received LOD requests.\n *\n * @returns {boolean}\n */\n HadLodRequests() {\n return this.hadLodRequests;\n }\n\n /**\n * Return the shader-resource-view heap index when a backend owns one.\n *\n * @returns {number}\n */\n GetSrvIndexInHeap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"GetSrvIndexInHeap\", \"Runtime-resource does not own descriptor heaps.\");\n }\n\n /**\n * Save this texture asynchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n SaveAsync(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"SaveAsync\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Save this texture synchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n Save(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"Save\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Return true if an asynchronous save is active.\n *\n * @returns {boolean}\n */\n IsSaving() {\n return false;\n }\n\n /**\n * Return true if the asynchronous save operation has completed.\n *\n * @returns {boolean}\n */\n IsSaveCompleted() {\n return true;\n }\n\n /**\n * Return true if the asynchronous save operation succeeded.\n *\n * @returns {boolean}\n */\n IsSaveSucceeded() {\n return false;\n }\n\n /**\n * Wait for an asynchronous save operation.\n *\n * @returns {boolean}\n */\n WaitForSave() {\n return this.IsSaveCompleted();\n }\n\n /**\n * Device texture allocation belongs to engine-gpu.\n *\n * @throws {Error}\n */\n CreateEmptyTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateEmptyTexture\", \"Use engine-gpu to allocate device textures.\");\n }\n\n /**\n * Render-target wrapping belongs to engine-gpu.\n *\n * @throws {Error}\n */\n SetFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"SetFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a texture copy from a render target.\n *\n * @throws {Error}\n */\n CreateAndCopyFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateAndCopyFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a device texture from a host bitmap.\n *\n * @throws {Error}\n */\n CreateFromHostBitmap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromHostBitmap\", \"Use engine-gpu to allocate and upload texture data.\");\n }\n\n /**\n * Create this texture from another texture resource.\n *\n * @throws {Error}\n */\n CreateFromTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromTexture\", \"Use engine-gpu to copy device textures.\");\n }\n\n /**\n * Return true if this texture owns a backend allocation object.\n *\n * @param {string|number} type\n * @param {string|number} object\n * @returns {boolean}\n */\n HasALObject(type, object) {\n return this.HasAdapterResource(`${type}:${object}`);\n }\n\n /**\n * Return an engine-owned texture pipeline object when attached.\n *\n * @returns {*}\n */\n GetPipeline() {\n return this.GetAdapterResource(\"pipeline\");\n }\n\n /**\n * Return memory size for the original non-LODed texture.\n *\n * @returns {number}\n */\n GetOriginalMemoryUsage() {\n return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());\n }\n\n /**\n * Store the average color reported by decoded texture data.\n *\n * @param {number} red\n * @param {number} green\n * @param {number} blue\n * @param {number} alpha\n * @returns {TriTextureRes}\n */\n SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {\n this.averageColor = [red, green, blue, alpha];\n return this;\n }\n\n /**\n * Update a texture subresource.\n *\n * @throws {Error}\n */\n UpdateSubresource() {\n throw resourceBoundaryError(\"TriTextureRes\", \"UpdateSubresource\", \"Use engine-gpu to upload texture bytes.\");\n }\n\n /**\n * Resource preparation does not decide device upload policy.\n *\n * @returns {boolean}\n */\n PrepareResources() {\n return this.IsPrepared();\n }\n\n static payload = ResourceRequirement.TEXTURE;\n}\n\nfunction getPayloadMemoryUsage(payload)\n{\n if (!payload || typeof payload !== \"object\") return 0;\n if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0)\n {\n return payload.originalMemoryUsage;\n }\n return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer\n ? payload.data.byteLength\n : 0;\n}\n\n// Declared as data rather than with decorators, so the resource tree loads from\n// source without a transform. Field order is key order, and GetValues() exports\n// in that order.\nCjsSchema.define(TriTextureRes, {\n className: \"TriTextureRes\",\n family: \"resources\",\n fields: {\n format: [ type.unknown, io.read ],\n type: [ type.unknown, io.persist ],\n averageColor: [ type.color, io.read ],\n depth: [ type.uint32, io.read ],\n cutoutHeight: [ type.float32, io.readwrite ],\n height: [ type.uint32, io.read ],\n lodEnabled: [ type.boolean, io.read ],\n hadLodRequests: [ type.boolean, io.read ],\n cpuMip: [ type.uint32, io.read ],\n gpuMip: [ type.uint32, io.read ],\n wrappedRenderTarget: [ type.unknown, io.read ],\n originalResolution: [ type.uint32, io.read ],\n originalMemoryUsage: [ type.uint64, io.read ],\n name: [ type.string, io.readwrite ],\n arraySize: [ type.uint32, io.read ],\n cutoutWidth: [ type.float32, io.readwrite ],\n width: [ type.uint32, io.read ],\n cutoutX: [ type.float32, io.readwrite ],\n cutoutY: [ type.float32, io.readwrite ]\n },\n methods: {\n GetMipCount: [ carbon.method, impl.adapted ],\n GetMsaaType: [ carbon.method, impl.adapted ],\n GetMsaaQuality: [ carbon.method, impl.adapted ],\n HadLodRequests: [ carbon.method, impl.adapted ],\n GetSrvIndexInHeap: [ carbon.method, impl.notSupported ],\n SaveAsync: [ carbon.method, impl.notSupported ],\n Save: [ carbon.method, impl.notSupported ],\n IsSaving: [ carbon.method, impl.noop ],\n IsSaveCompleted: [ carbon.method, impl.noop ],\n IsSaveSucceeded: [ carbon.method, impl.noop ],\n WaitForSave: [ carbon.method, impl.noop ],\n CreateEmptyTexture: [ carbon.method, impl.notSupported ],\n SetFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateAndCopyFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateFromHostBitmap: [ carbon.method, impl.notSupported ],\n CreateFromTexture: [ carbon.method, impl.notSupported ],\n HasALObject: [ carbon.method, impl.adapted ],\n GetPipeline: [ carbon.method, impl.adapted ],\n GetOriginalMemoryUsage: [ carbon.method, impl.adapted ],\n SetAverageColor: [ carbon.method, impl.adapted ],\n UpdateSubresource: [ carbon.method, impl.notSupported ],\n PrepareResources: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["TriTextureRes","CjsResource","format","type","averageColor","depth","cutoutHeight","height","lodEnabled","hadLodRequests","cpuMip","gpuMip","wrappedRenderTarget","originalResolution","originalMemoryUsage","name","arraySize","cutoutWidth","width","cutoutX","cutoutY","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","SetPayload","payload","options","validator","ResourcePayloadType","RGBA","validateRgbaPayload","TEXTURE","validateTexturePayload","VIDEO","validateVideoPayload","payloadType","resourcePayloadError","validateResourcePayload","pixelFormat","undefined","Array","isArray","faces","length","mipCount","getPayloadMemoryUsage","Math","max","DoLoad","data","read","output","route","ResolveFormat","resourceFormatRequiredError","ext","Read","GetMipCount","GetPayload","GetMsaaType","multiSampleType","msaaType","samples","GetMsaaQuality","multiSampleQuality","msaaQuality","HadLodRequests","GetSrvIndexInHeap","resourceBoundaryError","SaveAsync","path","Save","IsSaving","IsSaveCompleted","IsSaveSucceeded","WaitForSave","CreateEmptyTexture","SetFromRenderTarget","CreateAndCopyFromRenderTarget","CreateFromHostBitmap","CreateFromTexture","HasALObject","object","HasAdapterResource","GetPipeline","GetAdapterResource","GetOriginalMemoryUsage","SetAverageColor","red","green","blue","alpha","UpdateSubresource","PrepareResources","IsPrepared","ResourceRequirement","Number","isSafeInteger","ArrayBuffer","isView","byteLength","CjsSchema","define","className","family","fields","unknown","io","persist","color","uint32","float32","readwrite","boolean","uint64","string","methods","carbon","method","impl","adapted","notSupported","noop"],"mappings":";;;;;;AAAA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,WAAW,CAC9C;AACEC,EAAAA,MAAM,GAAG,IAAI;AACbC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CAACC,OAAO,CAAE;IAChD5B,iBAAiB,EAAE,CAAEyB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,YAAY,CAAE;IACvD5B,gBAAgB,EAAE,CAAEwB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AACjD;AACF,CAAC,CAAC;;;;"}
|
package/docs/architecture.md
CHANGED
|
@@ -1,118 +1,123 @@
|
|
|
1
|
-
# Architecture and boundaries
|
|
2
|
-
|
|
3
|
-
Status: Evolving
|
|
4
|
-
Scope: `@carbonenginejs/runtime-resource`
|
|
5
|
-
Audience: Users and integrators
|
|
6
|
-
Summary: Defines the GPU-free boundary this package owns and how engine and runtime packages relate to it.
|
|
7
|
-
|
|
8
|
-
## The GPU-free split
|
|
9
|
-
|
|
10
|
-
`runtime-resource` owns the GPU-free half of the Carbon resource lifecycle:
|
|
11
|
-
|
|
12
|
-
```text
|
|
13
|
-
EMPTY -> REQUESTED/LOADING -> LOADED
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Engine adapters own device realization:
|
|
17
|
-
|
|
18
|
-
```text
|
|
19
|
-
LOADED -> PREPARING -> PREPARED
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
The package selects and runs registered readers, hydrates or returns the
|
|
23
|
-
promised CPU outcome, and stores lifecycle state, cache entries, and loaded
|
|
24
|
-
payloads. For compiled effects it independently validates complete permutation
|
|
25
|
-
topology and the Carbon v15 container records it read itself, selects a
|
|
26
|
-
permutation, and hydrates a canonical device-free `Tr2Shader` graph. It never
|
|
27
|
-
creates WebGL/WebGPU textures, buffers, shader modules, pipelines, or bind
|
|
28
|
-
groups, and it never inspects backend capability.
|
|
29
|
-
A realization failure destroys its candidate and returns the resource to
|
|
30
|
-
`LOADED` without discarding the valid CPU payload.
|
|
31
|
-
|
|
32
|
-
This deliberately differs from Carbon and ccpwgl, whose resource classes live
|
|
33
|
-
inside an engine that can prepare GPU objects directly. Keeping the
|
|
34
|
-
format/resource layer reusable means stopping before GPU work; see
|
|
35
|
-
[resource lifecycle concepts](concepts/resource-lifecycle.md) for the
|
|
36
|
-
historical mapping.
|
|
37
|
-
|
|
38
|
-
## What the package owns
|
|
39
|
-
|
|
40
|
-
- `CjsResource` state and Carbon-style resource methods.
|
|
41
|
-
- `CjsMotherLode` canonical identity, explicit replacement results, activity
|
|
42
|
-
and lock metadata, deterministic payload/adapter cleanup, and cache stats.
|
|
43
|
-
- `CjsResMan` extension-selected resource/object handlers, semantic resource
|
|
44
|
-
overrides, ordered and legacy registered-format selection,
|
|
45
|
-
concurrency-limited source loading, staged prepare queues, layered
|
|
46
|
-
source/read/resource deduplication, object loader dispatch, and prefetch.
|
|
47
|
-
- Main-thread and browser-worker resource execution strategies, including
|
|
48
|
-
transferable fetch results and declared worker-safe CPU readers.
|
|
49
|
-
- `CjsTextureArrayRes` and `CjsTextureArrayResParameterProxy` for material-facing,
|
|
50
|
-
frame-coalesced texture-array inputs.
|
|
51
|
-
- `CjsAudioBufferRes` for physical audio-byte ownership and `CjsAudioRes` for
|
|
52
|
-
complete or windowed individually addressable audio files.
|
|
53
|
-
- Raw `CjsEventEmitter` (from `runtime-utils/model`) for manager/runtime events
|
|
54
|
-
without requiring `CjsModel` inheritance.
|
|
55
|
-
- Resource-path normalization and URL resolution, including prefix bases and
|
|
56
|
-
an injectable complete resolver, with fetch execution delegated to a
|
|
57
|
-
URL-only provider.
|
|
58
|
-
- Resource-specific geometry traversal and payload adaptation, composed with
|
|
59
|
-
shared vector, matrix, bounds, sphere, ray, and mesh math from
|
|
60
|
-
`runtime-utils` rather than maintaining another math implementation here.
|
|
61
|
-
- Plain reader/converter payload objects with focused shared validators.
|
|
62
|
-
- Canonical Carbon resource classes that validate and hold CPU payloads
|
|
63
|
-
privately: `TriTextureRes`, `TriGeometryRes`, `Tr2EffectRes`, `Tr2ImageRes`,
|
|
64
|
-
`TriGrannyRes`, `Tr2GrannyStateRes`, and `Tr2LightProfileRes`.
|
|
65
|
-
- Canonical device-free shader/reflection classes: `Tr2Shader`, its effect,
|
|
66
|
-
technique, pass, stage, constant, resource, sampler, annotation, and library
|
|
67
|
-
records; Carbon-binary hydration; permutation selection; and per-index caching.
|
|
68
|
-
- `Tr2TexturePipeline` CPU-only texture steps and `Tr2TextureLodManager`
|
|
69
|
-
membership.
|
|
70
|
-
- Opaque engine-owned subobject slots for backend adapters.
|
|
1
|
+
# Architecture and boundaries
|
|
2
|
+
|
|
3
|
+
Status: Evolving
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource`
|
|
5
|
+
Audience: Users and integrators
|
|
6
|
+
Summary: Defines the GPU-free boundary this package owns and how engine and runtime packages relate to it.
|
|
7
|
+
|
|
8
|
+
## The GPU-free split
|
|
9
|
+
|
|
10
|
+
`runtime-resource` owns the GPU-free half of the Carbon resource lifecycle:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
EMPTY -> REQUESTED/LOADING -> LOADED
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Engine adapters own device realization:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
LOADED -> PREPARING -> PREPARED
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The package selects and runs registered readers, hydrates or returns the
|
|
23
|
+
promised CPU outcome, and stores lifecycle state, cache entries, and loaded
|
|
24
|
+
payloads. For compiled effects it independently validates complete permutation
|
|
25
|
+
topology and the Carbon v15 container records it read itself, selects a
|
|
26
|
+
permutation, and hydrates a canonical device-free `Tr2Shader` graph. It never
|
|
27
|
+
creates WebGL/WebGPU textures, buffers, shader modules, pipelines, or bind
|
|
28
|
+
groups, and it never inspects backend capability.
|
|
29
|
+
A realization failure destroys its candidate and returns the resource to
|
|
30
|
+
`LOADED` without discarding the valid CPU payload.
|
|
31
|
+
|
|
32
|
+
This deliberately differs from Carbon and ccpwgl, whose resource classes live
|
|
33
|
+
inside an engine that can prepare GPU objects directly. Keeping the
|
|
34
|
+
format/resource layer reusable means stopping before GPU work; see
|
|
35
|
+
[resource lifecycle concepts](concepts/resource-lifecycle.md) for the
|
|
36
|
+
historical mapping.
|
|
37
|
+
|
|
38
|
+
## What the package owns
|
|
39
|
+
|
|
40
|
+
- `CjsResource` state and Carbon-style resource methods.
|
|
41
|
+
- `CjsMotherLode` canonical identity, explicit replacement results, activity
|
|
42
|
+
and lock metadata, deterministic payload/adapter cleanup, and cache stats.
|
|
43
|
+
- `CjsResMan` extension-selected resource/object handlers, semantic resource
|
|
44
|
+
overrides, ordered and legacy registered-format selection,
|
|
45
|
+
concurrency-limited source loading, staged prepare queues, layered
|
|
46
|
+
source/read/resource deduplication, object loader dispatch, and prefetch.
|
|
47
|
+
- Main-thread and browser-worker resource execution strategies, including
|
|
48
|
+
transferable fetch results and declared worker-safe CPU readers.
|
|
49
|
+
- `CjsTextureArrayRes` and `CjsTextureArrayResParameterProxy` for material-facing,
|
|
50
|
+
frame-coalesced texture-array inputs.
|
|
51
|
+
- `CjsAudioBufferRes` for physical audio-byte ownership and `CjsAudioRes` for
|
|
52
|
+
complete or windowed individually addressable audio files.
|
|
53
|
+
- Raw `CjsEventEmitter` (from `runtime-utils/model`) for manager/runtime events
|
|
54
|
+
without requiring `CjsModel` inheritance.
|
|
55
|
+
- Resource-path normalization and URL resolution, including prefix bases and
|
|
56
|
+
an injectable complete resolver, with fetch execution delegated to a
|
|
57
|
+
URL-only provider.
|
|
58
|
+
- Resource-specific geometry traversal and payload adaptation, composed with
|
|
59
|
+
shared vector, matrix, bounds, sphere, ray, and mesh math from
|
|
60
|
+
`runtime-utils` rather than maintaining another math implementation here.
|
|
61
|
+
- Plain reader/converter payload objects with focused shared validators.
|
|
62
|
+
- Canonical Carbon resource classes that validate and hold CPU payloads
|
|
63
|
+
privately: `TriTextureRes`, `TriGeometryRes`, `Tr2EffectRes`, `Tr2ImageRes`,
|
|
64
|
+
`TriGrannyRes`, `Tr2GrannyStateRes`, and `Tr2LightProfileRes`.
|
|
65
|
+
- Canonical device-free shader/reflection classes: `Tr2Shader`, its effect,
|
|
66
|
+
technique, pass, stage, constant, resource, sampler, annotation, and library
|
|
67
|
+
records; Carbon-binary hydration; permutation selection; and per-index caching.
|
|
68
|
+
- `Tr2TexturePipeline` CPU-only texture steps and `Tr2TextureLodManager`
|
|
69
|
+
membership.
|
|
70
|
+
- Opaque engine-owned subobject slots for backend adapters.
|
|
71
71
|
- Format implementations as explicit tree-shakeable subpaths under
|
|
72
72
|
`@carbonenginejs/runtime-resource/formats/<name>`.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- `
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
73
|
+
- Acquisition-free FSD byte validation, schema decoding, and approved dataset
|
|
74
|
+
readers under `formats/fsd`. The format keeps separate `32` and `64`
|
|
75
|
+
implementation directories: legacy headerless FSD is identified explicitly
|
|
76
|
+
but is not yet decoded, while modern cFSD uses the 64-bit implementation.
|
|
77
|
+
|
|
78
|
+
## What the package does not own
|
|
79
|
+
|
|
80
|
+
- WebGL/WebGPU realization, allocations, upload accounting, device budgets,
|
|
81
|
+
capability limits, and device-loss recovery (engine packages).
|
|
82
|
+
- Shader binary decoding, backend translation, and package serialization live
|
|
83
|
+
in the explicit `runtime-resource/formats/{hlsl,dxbc,webgl,webgpu}` subpaths.
|
|
84
|
+
Backend shader objects remain in engine packages.
|
|
85
|
+
- AudioBuffer construction, playback, or audio manager behavior.
|
|
86
|
+
- Audio-library document construction, enrichment, media-ID interpretation,
|
|
87
|
+
and delivery-route selection.
|
|
88
|
+
|
|
89
|
+
## Package relationships
|
|
90
|
+
|
|
91
|
+
- `runtime-core` may configure and expose a `CjsResMan`, but does not own its
|
|
92
|
+
implementation.
|
|
93
|
+
- `runtime-trinity` and `runtime-sof` may request GPU-free objects and
|
|
94
|
+
resources without selecting an engine. Trinity owns the mutable
|
|
95
|
+
`Tr2Effect`/`Tr2Material` facade, parameters, options, and sampler overrides;
|
|
96
|
+
it consumes the resource-owned shader graph.
|
|
97
|
+
- `engine-webgpu` and future WebGL engines consume loaded resources and own
|
|
98
|
+
all backend allocations, preparation, replacement, and destruction.
|
|
99
|
+
|
|
100
|
+
Concrete formats are not imported or registered by the package root; see
|
|
101
|
+
[formats/README.md](formats/README.md) for the import rule and map.
|
|
102
|
+
Worker-safe formats provide their own exact module declaration and remain
|
|
103
|
+
explicit registrations; see [browser worker execution](reference/workers.md).
|
|
104
|
+
|
|
105
|
+
Extension routes are manager-local configuration. They bind an extension to a
|
|
106
|
+
handler plus one format or an ordered format chain. The handler's
|
|
107
|
+
`ResourceHandlerMode` declaration determines whether path-only `Fetch()`
|
|
108
|
+
returns the stable resource or the constructed object. The route snapshot is
|
|
109
|
+
captured by the canonical handle, so later registration changes affect only a
|
|
110
|
+
new identity after explicit deletion or clearing. Target construction and
|
|
111
|
+
dynamic identification run after any worker decode on the main thread.
|
|
112
|
+
|
|
113
|
+
## Source layout
|
|
114
|
+
|
|
115
|
+
Authoring source is decorated JavaScript; published output is built ESM in
|
|
116
|
+
`npm/dist`. Resource owners and their direct Carbon data records live under
|
|
117
|
+
`src/resource`, grouped as `audio`, `geometry`, `geometry/granny`, `shader`,
|
|
118
|
+
and `texture`; worker execution and its message protocol live under `src/worker`.
|
|
119
|
+
Reviewed, unresolved active ports live under `src/generated` and are exposed
|
|
120
|
+
only through the explicit `./generated` package subpath until promotion. Native
|
|
121
|
+
shapes that JavaScript replaces or does not use are retained only under
|
|
122
|
+
`src/dropped`, with their disposition documented there, and are never exported
|
|
123
|
+
or bundled.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Format identification and capabilities
|
|
2
|
+
|
|
3
|
+
Status: Stable
|
|
4
|
+
Scope: `CjsFormat`, `CjsResourceProbe`, and every concrete format facade
|
|
5
|
+
Audience: Format authors, runtime integrators, and diagnostics tooling
|
|
6
|
+
Summary: Separates synchronous routing facts from advisory output support and exact asynchronous proof.
|
|
7
|
+
|
|
8
|
+
## One format contract
|
|
9
|
+
|
|
10
|
+
Every concrete format extends the decorator-free `CjsFormat` base and declares:
|
|
11
|
+
|
|
12
|
+
- `id`: stable format identity;
|
|
13
|
+
- `mediaTypes`: canonical runtime-utils media categories;
|
|
14
|
+
- `extensions`: lowercase dotted file suffixes used for routing;
|
|
15
|
+
- `outputs`: a frozen map of exact output selectors and their capabilities;
|
|
16
|
+
- `requestResponseType`: source acquisition response type; and
|
|
17
|
+
- `worker`: `null` or a frozen browser-worker execution descriptor.
|
|
18
|
+
|
|
19
|
+
An output descriptor records `output`, `payloadType`, `role`, `readMode`,
|
|
20
|
+
`decoded`, `passthrough`, `default`, `probes`, and `requires`. It declares a
|
|
21
|
+
reader path; it never claims that path has run for a particular input.
|
|
22
|
+
|
|
23
|
+
The former parallel statics and result flags are retired. In particular,
|
|
24
|
+
formats do not declare `type`, `inputTypes`, `outputTypes`,
|
|
25
|
+
`debugOutputTypes`, or `implementationStatus`, and payloads do not use
|
|
26
|
+
`containerOnly`, `isDecoded`, or codec-specific decode booleans. Consumers ask
|
|
27
|
+
the format for the relevant output capability instead.
|
|
28
|
+
|
|
29
|
+
## The four questions
|
|
30
|
+
|
|
31
|
+
`Format.is(input, options)` is a synchronous routing predicate. It returns only
|
|
32
|
+
a boolean and answers whether this format recognizes the input. It does not
|
|
33
|
+
claim that a requested decoder output works.
|
|
34
|
+
|
|
35
|
+
`Format.inspect(input, options)` is synchronous and returns structural
|
|
36
|
+
metadata. It describes what the bytes contain without making runtime support
|
|
37
|
+
or verification claims.
|
|
38
|
+
|
|
39
|
+
`Format.getSupport(input, options)` is synchronous advice. It combines the
|
|
40
|
+
format's structural probe with its declared output map and returns a plain,
|
|
41
|
+
frozen report. `options.emit` selects one exact output; omitting it selects the
|
|
42
|
+
declared default. Every returned capability has `verified: false` because no
|
|
43
|
+
decode has been executed.
|
|
44
|
+
|
|
45
|
+
`await Format.verifySupport(input, options)` is exact proof. It calls the real
|
|
46
|
+
`readAsync(input, { ...options, emit })` path for the selected output. Success
|
|
47
|
+
returns `supported: true` and `verified: true`. Failure returns
|
|
48
|
+
`supported: false`, `verified: true`, and a structured error with name, code,
|
|
49
|
+
message, details, and cause.
|
|
50
|
+
|
|
51
|
+
Normal resource loading does not call `verifySupport()` and then decode again.
|
|
52
|
+
A successful ordinary `readAsync()` is already proof for that load;
|
|
53
|
+
`verifySupport()` exists for diagnostics, setup checks, and consumers that need
|
|
54
|
+
to establish capability before committing to a route.
|
|
55
|
+
|
|
56
|
+
For example, runtime-core can prove that the actual DDS RGBA path works for a
|
|
57
|
+
specific payload and environment:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
const report = await CjsDdsFormat.verifySupport(bytes, { emit: "rgba" });
|
|
61
|
+
|
|
62
|
+
if (!report.supported)
|
|
63
|
+
{
|
|
64
|
+
throw new Error(report.error.message);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That result says nothing about DDS `texture`, `image`, or `raw`; support is
|
|
69
|
+
always output-specific.
|
|
70
|
+
|
|
71
|
+
## Decorator boundary
|
|
72
|
+
|
|
73
|
+
Format subpaths must remain importable from authored source, so they return
|
|
74
|
+
plain report objects and never import decorated model code. A resource-layer
|
|
75
|
+
consumer that needs persistence or model metadata calls
|
|
76
|
+
`CjsResourceProbe.from(report)`. The model exposes `canUseSelected()` and
|
|
77
|
+
`canUse(output)` without changing the format-layer contract.
|
|
78
|
+
|
|
79
|
+
## Routing rule
|
|
80
|
+
|
|
81
|
+
`CjsFormatStore` and `CjsResMan` use `Format.is()` only when content must break
|
|
82
|
+
an extension tie. Support reports do not select routes: a truthy report object
|
|
83
|
+
must never become an accidental match, and a decoder limitation must not make
|
|
84
|
+
the system forget which format the bytes are.
|
|
85
|
+
|
|
86
|
+
## Related documentation
|
|
87
|
+
|
|
88
|
+
- [Format subpaths](../formats/README.md)
|
|
89
|
+
- [Resource lifecycle](resource-lifecycle.md)
|
|
90
|
+
- [Browser worker execution](../reference/workers.md)
|
package/docs/formats/README.md
CHANGED
|
@@ -15,11 +15,17 @@ touches one stops being loadable from source. Every consumer reading `src/`
|
|
|
15
15
|
directly then fails with a bare syntax error pointing at the decorator rather
|
|
16
16
|
than at the import that reached it, which is a long way from the mistake.
|
|
17
17
|
|
|
18
|
-
The practical consequence is that
|
|
19
|
-
|
|
20
|
-
`CjsResourceProbe
|
|
21
|
-
|
|
22
|
-
[format
|
|
18
|
+
The practical consequence is that `inspect()`, `getSupport()`, and
|
|
19
|
+
`verifySupport()` return plain objects rather than constructing a decorated
|
|
20
|
+
`CjsResourceProbe`. `CjsResourceProbe.from()` is the optional resource-layer
|
|
21
|
+
normalization boundary. `is()` remains the boolean-only synchronous routing
|
|
22
|
+
predicate. See [format capabilities](../concepts/format-capabilities.md).
|
|
23
|
+
|
|
24
|
+
Every format extends `CjsFormat` and exposes one normalized static contract:
|
|
25
|
+
`id`, frozen `mediaTypes`, frozen dotted `extensions`, a frozen `outputs` map,
|
|
26
|
+
`requestResponseType`, and `worker`. `getSupport()` is synchronous structural
|
|
27
|
+
advice and always reports `verified: false`; `verifySupport()` asynchronously
|
|
28
|
+
executes the real `readAsync()` path for one exact output.
|
|
23
29
|
|
|
24
30
|
## Import rule
|
|
25
31
|
|
|
@@ -60,9 +66,10 @@ metadata. Worker eligibility never changes the format's direct API; see
|
|
|
60
66
|
| DXBC (shader bytecode) | `CjsDxbcFormat` | `@carbonenginejs/runtime-resource/formats/dxbc` |
|
|
61
67
|
| Compiled effect (`.sm_hi`, `.sm_lo`, `.sm_depth`) | `CjsHlslFormat` | `@carbonenginejs/runtime-resource/formats/hlsl` |
|
|
62
68
|
| Carbon WebGL WebGL effect package | `CjsWebglFormat` | `@carbonenginejs/runtime-resource/formats/webgl` |
|
|
63
|
-
| Carbon WebGPU
|
|
69
|
+
| Carbon WebGPU effect package (`.carbonwebgpu`) | `CjsWebgpuFormat` | `@carbonenginejs/runtime-resource/formats/webgpu` |
|
|
64
70
|
| FBX (`.fbx`) | `CjsFbxFormat` | `@carbonenginejs/runtime-resource/formats/fbx` |
|
|
65
71
|
| FLAC (`.flac`) | `CjsFlacFormat` | `@carbonenginejs/runtime-resource/formats/flac` |
|
|
72
|
+
| FSD (`.fsdbinary`; legacy 32-bit and modern 64-bit cFSD) | `CjsFsdFormat` | `@carbonenginejs/runtime-resource/formats/fsd` |
|
|
66
73
|
| GIF (`.gif`) | `CjsGifFormat` | `@carbonenginejs/runtime-resource/formats/gif` |
|
|
67
74
|
| glTF (`.gltf`/`.glb`) | `CjsGltfFormat` | `@carbonenginejs/runtime-resource/formats/gltf` |
|
|
68
75
|
| Granny GR2/GSF (`.gr2`/`.gsf`) | `CjsGr2Format` | `@carbonenginejs/runtime-resource/formats/gr2` |
|
|
@@ -86,6 +93,7 @@ metadata. Worker eligibility never changes the format's direct API; see
|
|
|
86
93
|
| YAML (`.yaml`/`.yml`) | `CjsYamlFormat` | `@carbonenginejs/runtime-resource/formats/yaml` |
|
|
87
94
|
|
|
88
95
|
Detailed pages: [Granny GR2 and GSF](gr2.md),
|
|
96
|
+
[FSD and cFSD](fsd.md),
|
|
89
97
|
[data-only pickle protocol 0](pickle.md),
|
|
90
98
|
[client `.static` container identification](static.md),
|
|
91
99
|
[schema-bound containers](schemabound.md),
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# FSD and cFSD
|
|
2
|
+
|
|
3
|
+
Status: Experimental
|
|
4
|
+
Scope: `@carbonenginejs/runtime-resource/formats/fsd`
|
|
5
|
+
Audience: Runtime and tooling integrators decoding caller-supplied static data
|
|
6
|
+
Summary: Distinguishes legacy 32-bit FSD from modern 64-bit cFSD and owns the browser-safe decoder for the modern format.
|
|
7
|
+
|
|
8
|
+
## Two related formats
|
|
9
|
+
|
|
10
|
+
The FSD facade deliberately keeps two implementation directories:
|
|
11
|
+
|
|
12
|
+
| Variant | Directory | Identification | Reading |
|
|
13
|
+
|---|---|---|---|
|
|
14
|
+
| Legacy Carbon FSD | `formats/fsd/32` | Caller/profile declaration (`bitWidth: 32` or `variant: "fsd32"`) | Reserved; throws `CJS_FSD_32_UNSUPPORTED` |
|
|
15
|
+
| Modern cFSD | `formats/fsd/64` | Valid 32-byte envelope whose 64-bit payload length matches the supplied bytes | Supported through an explicit dataset reader |
|
|
16
|
+
|
|
17
|
+
Legacy FSD is headerless and its layout is supplied separately, so arbitrary
|
|
18
|
+
bytes cannot identify themselves as that format. `CjsFsdFormat` never treats a
|
|
19
|
+
failed modern probe as legacy. The `32` directory is the stable home for a
|
|
20
|
+
future schema-driven implementation without flattening two layouts into one
|
|
21
|
+
reader or changing public subpaths.
|
|
22
|
+
|
|
23
|
+
## Use through the format pipeline
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { CjsFormatStore } from "@carbonenginejs/runtime-resource/format";
|
|
27
|
+
import { CjsFsdFormat } from "@carbonenginejs/runtime-resource/formats/fsd";
|
|
28
|
+
import { CjsFsd64Reader } from "@carbonenginejs/runtime-resource/formats/fsd/64";
|
|
29
|
+
import {
|
|
30
|
+
CjsFsd64ReaderSetCharacterStaticData
|
|
31
|
+
} from "@carbonenginejs/runtime-resource/formats/fsd/64/readers";
|
|
32
|
+
|
|
33
|
+
const reader = CjsFsd64ReaderSetCharacterStaticData.registerAll(new CjsFsd64Reader());
|
|
34
|
+
const route = new CjsFormatStore()
|
|
35
|
+
.Register(CjsFsdFormat)
|
|
36
|
+
.Resolve(".fsdbinary", bytes);
|
|
37
|
+
|
|
38
|
+
const records = await route.Read(bytes, {
|
|
39
|
+
path: "res:/staticdata/ancestries.fsdbinary",
|
|
40
|
+
reader
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`readJSON()` or `emit: "json"` requests plain JSON-compatible output. Wide
|
|
45
|
+
identifiers remain lossless decimal strings. The ordinary `Read()` path keeps
|
|
46
|
+
the typed `Map` representation exposed by the lower-level readers.
|
|
47
|
+
|
|
48
|
+
## Dataset layouts
|
|
49
|
+
|
|
50
|
+
Each reviewed layout is a JSON-shaped JavaScript object defined directly on
|
|
51
|
+
its owning, namespaced class. The class and file share one identity, such as
|
|
52
|
+
`CjsFsd64SchemaRaces` in `CjsFsd64SchemaRaces.js`. No separate schema sidecar
|
|
53
|
+
has to remain paired with the reader.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import {
|
|
57
|
+
CjsFsd64SchemaRaces
|
|
58
|
+
} from "@carbonenginejs/runtime-resource/formats/fsd/64/readers";
|
|
59
|
+
|
|
60
|
+
const definition = CjsFsd64SchemaRaces.getFsdSchema();
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`getFsdSchema()` returns the same validated JSON-shaped object on every call.
|
|
64
|
+
There is no public backing `fsdSchema` property. The FSD-specific name is
|
|
65
|
+
deliberate: `schema` and `getSchema` remain free for the `CjsModel` schema
|
|
66
|
+
namespace and are not defined by these reader classes.
|
|
67
|
+
|
|
68
|
+
To report identified legacy bytes without decoding them:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
const metadata = CjsFsdFormat.inspect(bytes, { bitWidth: 32 });
|
|
72
|
+
// metadata.variant === "fsd32"; metadata.decodable === false
|
|
73
|
+
|
|
74
|
+
CjsFsdFormat.read(bytes, { bitWidth: 32 });
|
|
75
|
+
// throws CJS_FSD_32_UNSUPPORTED
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Ownership boundary
|
|
79
|
+
|
|
80
|
+
This format owns byte validation, declarative layouts, schema decoding, exact-path
|
|
81
|
+
reader registration, and approved dataset readers. It performs no filesystem
|
|
82
|
+
discovery, network access, provider selection, build selection, caching, native
|
|
83
|
+
loader inspection, localization enrichment, or output-tree construction.
|
|
84
|
+
|
|
85
|
+
Acquisition and target/build profiles belong to tooling. Runtime packages own
|
|
86
|
+
interpretation and construction of prepared domain libraries. The reader
|
|
87
|
+
subpath contains no acquired `.fsdbinary` files, native modules, decoded
|
|
88
|
+
datasets, or generated game tables.
|
|
89
|
+
|
|
90
|
+
## Errors
|
|
91
|
+
|
|
92
|
+
| Code | When |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `CJS_FSD_32_UNSUPPORTED` | The caller identified legacy 32-bit FSD, whose future reader belongs in `formats/fsd/32` |
|
|
95
|
+
| `CJS_FSD_VARIANT_UNKNOWN` | Bytes are neither explicitly declared legacy FSD nor a valid modern cFSD container |
|
|
96
|
+
| `CJS_FSD_READER_REQUIRED` | Modern cFSD was recognized but no reader/registry exposing `Read` or `ReadJSON` was supplied |
|
|
97
|
+
| `CJS_FSD_READER_NOT_FOUND` | A registry has no reader for the normalized logical path |
|
|
98
|
+
| `CJS_FSD_SCHEMA_UNSUPPORTED` | A dataset reader does not accept the container's layout identity |
|
|
99
|
+
|
|
100
|
+
## Related documentation
|
|
101
|
+
|
|
102
|
+
- [Formats](README.md)
|
|
103
|
+
- [Format ownership and fork provenance](provenance.md)
|
|
104
|
+
- [Format capabilities](../concepts/format-capabilities.md)
|
package/docs/formats/gr2.md
CHANGED
|
@@ -33,7 +33,7 @@ const asynchronousGraph = await CjsGr2Format.readAsync(bytes);
|
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
`CjsGr2Format` is the one public class: the reader engine plus the normal
|
|
36
|
-
runtime-resource format metadata and the `
|
|
36
|
+
runtime-resource format metadata and the boolean `is(bytes)` magic probe.
|
|
37
37
|
The barrel exports nothing else.
|
|
38
38
|
|
|
39
39
|
Register it with `CjsResMan` when GR2/GSF should participate in ordinary
|