@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":"CjsResource.js","sources":["../../../src/resource/CjsResource.js"],"sourcesContent":["import { CjsEventEmitter } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n getResourceExtension,\n normalizeResourceExtension,\n normalizeResourcePath\n} from \"@carbonenginejs/runtime-utils/path\";\nimport { CjsSchema, carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { ResourceHandlerMode } from \"./ResourceHandlerMode.js\";\n\n/**\n * Deterministic activity values accepted by resource-facing lease methods.\n *\n * @typedef {object} CjsResourceActivityOptions\n * @property {number} [frame] Explicit non-negative activity frame.\n * @property {number} [time] Explicit non-negative activity timestamp in milliseconds.\n */\n\n/**\n * Manager-owned callbacks attached while a resource has canonical ownership,\n * and detached the moment it ends. The controller carries no load, fetch, or\n * prepare hook; recovery lives in the separate reload hook, which deliberately\n * outlives ownership because losing ownership is exactly when it is needed.\n *\n * @typedef {object} CjsResourceLifecycleController\n * @property {Function} [isCurrent] Tests exact canonical manager ownership without renewing activity.\n * @property {Function} [keepAlive] Renews canonical identity activity.\n * @property {Function} [keepPayloadAlive] Renews identity and CPU-payload activity.\n * @property {Function} [lock] Adds one inactivity-purge lock and returns its count.\n * @property {Function} [unlock] Releases one inactivity-purge lock and returns its count.\n */\n\n/**\n * ResMan-owned runtime resource.\n *\n * Resources are not model graph objects: BLACK/RED graphs persist resource\n * paths (including empty paths), while CjsResMan constructs, initializes,\n * caches, and hydrates the corresponding runtime resource instances.\n */\nexport class CjsResource extends CjsEventEmitter\n{\n #payload = null;\n\n /** Reloads attempted since the last successful load. */\n #reloadAttempts = 0;\n\n /**\n * How many times a purged or failed resource reloads itself before giving up.\n *\n * Per class so a subclass can be more or less patient. Counted per resource\n * and reset on every successful load, so this bounds consecutive failures,\n * not the lifetime total.\n */\n static maxReloadAttempts = 3;\n\n path = \"\";\n\n ext = \"\";\n\n requirement = \"\";\n\n state = CjsResource.State.EMPTY;\n\n /**\n * Identifies this class as a runtime resource.\n *\n * Static, so a schema field declared as `@type.objectRef(\"TriGeometryRes\")`\n * can be known to hold a resource without an instance existing - the\n * declaration alone is enough, resolved through `CjsSchema.GetConstructor`.\n */\n static isResource = true;\n\n /** Declares that extension routes using this handler publish the resource. */\n static handlerMode = ResourceHandlerMode.RESOURCE;\n\n /** Identifies this handle as a runtime resource. */\n get isResource() {\n return this.constructor.isResource === true;\n }\n\n /**\n * Create a detached runtime resource with empty identity and payload state.\n * Schema values are applied without attaching manager lifecycle callbacks;\n * CjsResMan supplies those callbacks after canonical insertion.\n *\n * @param {object|null} [values=null] Initial decorated schema-field values.\n */\n constructor(values = null) {\n super();\n Object.defineProperty(this, \"__adapterResources\", {\n value: Object.create(null),\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__objectLoader\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__objectRequest\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__lifecycleController\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__reloadHook\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n if (values)\n {\n this.SetValues(values);\n }\n }\n\n /**\n * Apply resource identity or metadata values without model graph semantics.\n *\n * @param {object|null} values\n * @returns {CjsResource}\n */\n SetValues(values = null) {\n if (!values || typeof values !== \"object\") return this;\n const fields = CjsSchema.getSchema(this.constructor).fields;\n for (const field of fields) {\n if (Object.prototype.hasOwnProperty.call(values, field.name)) {\n this[field.name] = values[field.name];\n }\n }\n return this;\n }\n\n /**\n * Export resource identity and schema metadata. Runtime state is not a model\n * graph node; graph fields normally persist only their resource path.\n *\n * @returns {object}\n */\n GetValues() {\n const result = {};\n for (const field of CjsSchema.getSchema(this.constructor).fields) {\n result[field.name] = this[field.name];\n }\n return result;\n }\n\n /**\n * Initialize the resource identity from a path and optional extension.\n *\n * @param {string} path\n * @param {string|null} ext\n * @param {string|null} requirement\n * @returns {CjsResource}\n */\n Initialize(path, ext = null, requirement = \"\") {\n this.path = normalizeResourcePath(path);\n this.ext = ext ? normalizeResourceExtension(ext) : getResourceExtension(this.path);\n this.requirement = requirement === null || requirement === undefined\n ? \"\"\n : String(requirement).trim().toLowerCase();\n this.state = CjsResource.State.EMPTY;\n this.error = null;\n return this;\n }\n\n /**\n * Get the normalized resource path.\n *\n * @returns {string}\n */\n GetPath() {\n return this.path;\n }\n\n /**\n * Get the normalized resource extension.\n *\n * @returns {string}\n */\n GetExt() {\n return this.ext;\n }\n\n /**\n * Return the normalized semantic outcome requested from this source path.\n * This metadata query is pure and does not renew manager activity.\n *\n * @returns {string} Lowercase requirement name, or an empty string.\n */\n GetRequirement() {\n return this.requirement;\n }\n\n /**\n * Return true when the resource is currently loading.\n *\n * @returns {boolean}\n */\n IsLoading() {\n return this.state === CjsResource.State.REQUESTED || this.state === CjsResource.State.LOADING;\n }\n\n /**\n * Return true when CPU resource payload data has been loaded.\n *\n * @returns {boolean}\n */\n HasLoaded() {\n return this.state === CjsResource.State.LOADED\n || this.state === CjsResource.State.PREPARING\n || this.state === CjsResource.State.PREPARED;\n }\n\n /**\n * Return true when preparation has completed or produced a good resource.\n *\n * @returns {boolean}\n */\n IsPrepared() {\n return this.state === CjsResource.State.PREPARED;\n }\n\n /**\n * Return true when this resource finished trying to load, either way.\n *\n * The pull form of the `completed` event. Carbon expresses this as a\n * predicate because it has no events - `m_isPrepared` is set on the failure\n * path too (`BlueAsyncRes.cpp:183`) - so `IsPrepared()` there means \"finished\n * trying\" while ours keeps the narrower \"succeeded\".\n *\n * `PURGED` is not completion: nothing was tried and nothing concluded, the\n * payload was simply taken away.\n *\n * @returns {boolean}\n */\n HasCompleted() {\n return this.state === CjsResource.State.PREPARED\n || this.state === CjsResource.State.FAILED;\n }\n\n /**\n * Return true when preparation completed successfully, and renew this\n * resource.\n *\n * Every caller of `IsGood()` is about to use the resource, so renewal always\n * follows the query. Merging them - as ccpwgl does in `Tw2Resource.js:108` -\n * closes that gap permanently instead of relying on call-site discipline, and\n * means a purged resource reloads itself the moment anything asks for it.\n *\n * @returns {boolean}\n */\n IsGood() {\n this.KeepAlive();\n return this.IsPrepared();\n }\n\n /**\n * Return true when preparation failed.\n *\n * @returns {boolean}\n */\n IsFailed() {\n return this.state === CjsResource.State.FAILED;\n }\n\n /**\n * Changes state and emits the state-specific, statechange, and - on reaching\n * a load outcome - completed events.\n */\n SetState(state, ...details) {\n if (!CjsResource.isValidState(state)) {\n throw new TypeError(`Invalid CjsResource state: ${state}`);\n }\n const previous = this.state;\n if (previous === state) return this;\n this.state = state;\n // A successful load clears the budget, so the cap bounds consecutive\n // failures rather than how many times a resource may ever be purged.\n if (state === CjsResource.State.PREPARED) this.#reloadAttempts = 0;\n this.EmitEvent?.(state, this, ...details);\n this.EmitEvent?.(\"statechange\", this, state, previous);\n // Fires again after a purge and reload, so subscribers rebuild whatever\n // they derived from the payload that was deleted.\n if (this.HasCompleted()) this.EmitEvent?.(\"completed\", this, ...details);\n return this;\n }\n\n /**\n * Subscribe to this resource finishing, firing immediately when it already\n * has.\n *\n * The immediate call is the point. A plain emitter drops late subscribers on\n * the floor - subscribe after `PREPARED` and nothing ever arrives - which is\n * why callers end up doing work synchronously \"just in case\" instead of\n * subscribing. ccpwgl solves this by replaying current state at registration\n * (`Tw2Resource.onNotification`), and a subscriber satisfied that way is\n * never stored at all, so only subscriptions genuinely still waiting\n * accumulate.\n *\n * The listener runs for both outcomes and branches itself:\n *\n * ```js\n * res.OnCompleted(res => { if (res.IsPrepared()) something; else somethingElse; });\n * ```\n *\n * It may run more than once - a purge and reload completes again - so\n * handlers must be written to be re-entered rather than assuming first load.\n *\n * @param {Function} listener Called with this resource once it has finished.\n * @param {*} [source=null] Optional owner used for bulk removal.\n * @returns {CjsResource} This resource.\n */\n OnCompleted(listener, source = null)\n {\n if (typeof listener !== \"function\")\n {\n throw new TypeError(\"CjsResource.OnCompleted requires a function.\");\n }\n if (this.HasCompleted())\n {\n listener(this);\n return this;\n }\n return this.OnEvent(\"completed\", listener, source);\n }\n\n /** Marks this resource as requested. */\n MarkRequested() {\n return this.SetState(CjsResource.State.REQUESTED);\n }\n\n /** Marks this resource as actively loading. */\n MarkLoading() {\n return this.SetState(CjsResource.State.LOADING);\n }\n\n /** Marks this resource's CPU payload as loaded. */\n MarkLoaded() {\n return this.SetState(CjsResource.State.LOADED);\n }\n\n /** Marks this resource as preparing its semantic result. */\n MarkPreparing() {\n return this.SetState(CjsResource.State.PREPARING);\n }\n\n /** Marks this resource as successfully prepared. */\n MarkPrepared() {\n return this.SetState(CjsResource.State.PREPARED);\n }\n\n /** Marks this resource as successfully prepared. */\n MarkGood() {\n return this.MarkPrepared();\n }\n\n /**\n * Mark this detached resource handle as purged after a successful\n * manager-owned policy eviction, such as inactivity or recorded-byte cache\n * pressure, released its adapter allocations and payload.\n *\n * @returns {CjsResource} This purged resource.\n */\n MarkPurged()\n {\n return this.SetState(CjsResource.State.PURGED);\n }\n\n /**\n * Return whether deterministic manager cleanup has purged this handle.\n * This is a pure state query and never renews resource activity.\n *\n * @returns {boolean} `true` when the current state is `PURGED`.\n */\n IsPurged()\n {\n return this.state === CjsResource.State.PURGED;\n }\n\n /** Stores a load failure and marks this resource as failed. */\n SetError(error) {\n this.error = error || null;\n return this.SetState(CjsResource.State.FAILED, this.error);\n }\n\n /**\n * Store the plain CPU payload associated with this resource.\n * Concrete resource classes validate the fields they require before calling\n * this method. If the compatibility `object` property still aliases the\n * previous payload, it is updated to the replacement; semantic resources\n * whose `object` points to the resource itself are unaffected. A non-null\n * payload explicitly renews its manager-owned identity and payload leases;\n * payload reads remain pure and do not renew either lease.\n *\n * @param {*} payload Plain reader/converter output, or `null` to clear it.\n * @returns {CjsResource} This resource with the supplied payload reference.\n */\n SetPayload(payload = null) {\n const previous = this.#payload;\n this.#payload = payload;\n if (this.object === previous) this.object = payload;\n if (this.HasPayload()) this.KeepPayloadAlive();\n return this;\n }\n\n /**\n * Read the plain CPU payload associated with this resource.\n *\n * The query is pure and does not renew the payload lease.\n *\n * @returns {*} Current payload reference, or `null` after release.\n */\n GetPayload() {\n return this.#payload;\n }\n\n /**\n * Return whether a payload has been explicitly assigned. This query is pure\n * and does not renew the payload lease.\n *\n * @returns {boolean} Whether a non-null payload is attached.\n */\n HasPayload() {\n return this.#payload !== null && this.#payload !== undefined;\n }\n\n /**\n * Release the complete payload reference after consumers have retained the\n * scalars and typed-array views they require. When the compatibility\n * `object` property still aliases that exact payload, it is cleared as part\n * of the same ownership release. Semantic resources whose `object` property\n * points to the resource itself are unaffected.\n *\n * @returns {CjsResource} This resource without its former payload reference.\n */\n ReleasePayload() {\n const payload = this.#payload;\n this.#payload = null;\n if (this.object === payload) this.object = null;\n return this;\n }\n\n /**\n * Bind or detach the manager callbacks used by explicit resource-facing\n * liveness operations. Runtime resources remain usable when unbound; their\n * liveness methods then become deterministic no-ops.\n *\n * @param {CjsResourceLifecycleController|null} controller Manager callbacks, or `null` after canonical ownership ends.\n * @returns {CjsResource} This resource.\n * @throws {TypeError} If the controller or any supplied callback is invalid.\n */\n SetLifecycleController(controller = null)\n {\n if (controller !== null && (typeof controller !== \"object\" || Array.isArray(controller)))\n {\n throw new TypeError(\"CjsResource lifecycle controller must be an object or null.\");\n }\n for (const name of [ \"isCurrent\", \"keepAlive\", \"keepPayloadAlive\", \"lock\", \"unlock\" ])\n {\n if (controller?.[name] !== undefined && typeof controller[name] !== \"function\")\n {\n throw new TypeError(`CjsResource lifecycle controller ${name} must be a function.`);\n }\n }\n this.__lifecycleController = controller;\n return this;\n }\n\n /**\n * Return whether this handle is still the manager's canonical resource.\n *\n * Engine adapters use this immediately before synchronously attaching a\n * completed backend candidate. Detached resources return `false`; the query\n * never renews activity, reloads data, or mutates lifecycle state.\n *\n * @returns {boolean} Whether the bound manager still owns this exact handle.\n */\n IsCurrent()\n {\n return Boolean(this.__lifecycleController?.isCurrent?.());\n }\n\n /**\n * Renew this resource's canonical identity activity, and reload it when\n * it has been purged.\n *\n * Purge is deletion - the payload is gone and nothing restores it - so\n * revival is an ordinary reload along the first-load path. Consumers\n * therefore never have to know a purge happened: they ask for what they need\n * and this makes it be there.\n *\n * `IsGood()` calls this, so most callers never invoke it directly.\n *\n * @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.\n * @returns {CjsResource} This resource, whether bound or detached.\n * @throws {TypeError} If the bound manager rejects invalid activity values.\n */\n KeepAlive(options = {})\n {\n this.__lifecycleController?.keepAlive?.(options);\n if (this.IsPurged()) this.Reload(options);\n return this;\n }\n\n /**\n * Re-register this handle with its manager and reload it into itself.\n *\n * Runs only from `PURGED` or `FAILED` - the two states where the payload is\n * absent but recoverable. It does nothing to a resource that is loaded or\n * still loading, so it is not a way to force a refetch of something already\n * there.\n *\n * Bounded by `maxReloadAttempts`, because `KeepAlive()` calls this and the\n * render path calls that every frame: without a cap, one missing texture\n * becomes a permanent retry storm against the thing least likely to succeed.\n * Attempts are spaced by real load round-trips rather than frames - starting\n * one leaves `PURGED`/`FAILED`, so nothing re-enters until it settles - and\n * the count resets on any successful load.\n *\n * The distinction that matters: the reload must fill THIS handle, not resolve\n * whatever the manager currently caches for the same path. A consumer holding\n * a purged handle has no way to discover a replacement, so handing it a fresh\n * instance elsewhere leaves it dead forever.\n *\n * Detached handles have no manager to re-register with and stay as they are.\n *\n * @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.\n * @returns {boolean} Whether a reload was started.\n */\n Reload(options = {})\n {\n if (!this.IsPurged() && !this.IsFailed()) return false;\n if (this.#reloadAttempts >= this.constructor.maxReloadAttempts) return false;\n if (typeof this.__reloadHook !== \"function\") return false;\n\n this.#reloadAttempts += 1;\n return this.__reloadHook(options) !== false;\n }\n\n /**\n * Bind the manager callback that restores this handle after it loses its\n * payload.\n *\n * Deliberately separate from the lifecycle controller, which is detached the\n * moment canonical ownership ends. Recovery has to survive exactly that\n * event: a purged handle with no route back to its manager is unrecoverable,\n * which is the failure this whole contract exists to prevent.\n *\n * @param {Function|null} hook Manager callback, or `null` to detach it.\n * @returns {CjsResource} This resource.\n * @throws {TypeError} If the hook is neither a function nor null.\n */\n SetReloadHook(hook = null)\n {\n if (hook !== null && typeof hook !== \"function\")\n {\n throw new TypeError(\"CjsResource.SetReloadHook requires a function or null.\");\n }\n this.__reloadHook = hook;\n return this;\n }\n\n /**\n * Return how many reloads have been attempted since the last successful load.\n *\n * @returns {number}\n */\n GetReloadAttempts()\n {\n return this.#reloadAttempts;\n }\n\n /**\n * Clear the reload attempt count, so a resource that exhausted its attempts\n * can be asked again.\n *\n * This is the deliberate \"try it again\" gesture - a user retrying a failed\n * load, say. It is separate from `Reload()` because the cap exists precisely\n * to stop the automatic path retrying forever, so lifting it has to be a\n * decision someone made.\n *\n * @returns {CjsResource} This resource.\n */\n ResetReloadAttempts()\n {\n this.#reloadAttempts = 0;\n return this;\n }\n\n /**\n * Explicitly renew both canonical identity activity and the attached CPU\n * payload lease. Reading the payload through `GetPayload()` or\n * `HasPayload()` remains pure.\n *\n * @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.\n * @returns {CjsResource} This resource, whether a payload exists or not.\n * @throws {TypeError} If the bound manager rejects invalid activity values.\n */\n KeepPayloadAlive(options = {})\n {\n this.__lifecycleController?.keepPayloadAlive?.(options);\n return this;\n }\n\n /**\n * Add one explicit purge lock through the bound manager and renew identity\n * activity. Locking never reloads or prepares a resource.\n *\n * @returns {number} New lock count, or `0` when this resource is detached.\n */\n Lock()\n {\n return this.__lifecycleController?.lock?.() || 0;\n }\n\n /**\n * Release one explicit purge lock without allowing the count to underflow.\n * Unlocking does not immediately purge or release a payload.\n *\n * @returns {number} Remaining lock count, or `0` when detached or unlocked.\n */\n Unlock()\n {\n return this.__lifecycleController?.unlock?.() || 0;\n }\n\n /**\n * Bind the manager-owned object operation and compact reconstruction request\n * for this shared resource handle. The request contains source provenance\n * and requested-output defaults, not reader implementations or registry\n * history.\n *\n * @param {Function|null} loader Manager callback, or `null` to detach it.\n * @param {object|null} [request=null] Compact reconstruction defaults retained with the handle.\n * @returns {CjsResource} This resource with the supplied loader binding.\n * @throws {TypeError} If the loader or reconstruction request is invalid.\n */\n SetObjectLoader(loader = null, request = null)\n {\n if (loader !== null && typeof loader !== \"function\")\n {\n throw new TypeError(\"CjsResource.SetObjectLoader requires a function or null.\");\n }\n if (request !== null && (!request || typeof request !== \"object\" || Array.isArray(request)))\n {\n throw new TypeError(\"CjsResource.SetObjectLoader request must be an object or null.\");\n }\n this.__objectLoader = loader;\n this.__objectRequest = request === null ? null : Object.freeze({ ...request });\n return this;\n }\n\n /**\n * Return the compact manager request retained for explicit reconstruction.\n * This query is pure and exposes no reader, constructor, or implementation\n * identity.\n *\n * @returns {Readonly<object>|null} Frozen reconstruction defaults, or `null` when unbound.\n */\n GetObjectRequest()\n {\n return this.__objectRequest;\n }\n\n /**\n * Return the manager-owned object outcome for this resource identity.\n * Concurrent callers share one in-flight operation. A resident payload is\n * returned without source work; after explicit payload release, this call is\n * an explicit reconstruction request and may load/prepare through the bound\n * manager. This loader resolves the manager's current canonical identity, so\n * on a purged handle it may answer with a different instance - use\n * `KeepAlive()`/`Reload()` to revive this handle itself.\n *\n * Promised-output fields retained by the handle take precedence over fields\n * supplied here; operation policy such as cache/reload controls may still be\n * overridden.\n *\n * @param {object} [options={}] Source, format, semantic outcome, and queue options forwarded to the manager.\n * @returns {Promise<*>} In-flight, resident, or reconstructed object outcome.\n */\n GetObject(options = {})\n {\n if (!this.__objectLoader)\n {\n const error = new Error(`Resource has no object loader: ${this.path}`);\n error.code = \"CJS_RESOURCE_LOADER_UNBOUND\";\n return Promise.reject(error);\n }\n return this.__objectLoader(options);\n }\n\n /**\n * Promise-shaped alias for {@link CjsResource#GetObject}. Readiness shares an\n * in-flight operation, returns resident payload without loading, and treats a\n * call after payload release as an explicit reconstruction request.\n *\n * @param {object} [options={}] Source, format, semantic outcome, and queue options forwarded to the manager.\n * @returns {Promise<*>} In-flight, resident, or reconstructed object outcome.\n */\n Ready(options = {})\n {\n return this.GetObject(options);\n }\n\n /**\n * Attach an opaque engine-owned resource object.\n *\n * Runtime-resource stores this value but does not inspect GPU APIs.\n *\n * @param {string} key\n * @param {*} value\n * @returns {CjsResource}\n */\n SetAdapterResource(key, value) {\n if (!key) throw new TypeError(\"CjsResource.SetAdapterResource requires a key.\");\n this.__adapterResources[String(key)] = value;\n return this;\n }\n\n /**\n * Get an opaque engine-owned resource object.\n *\n * @param {string} key\n * @returns {*}\n */\n GetAdapterResource(key) {\n return this.__adapterResources[String(key)] ?? null;\n }\n\n /**\n * Returns true when an adapter resource exists for the given key.\n *\n * @param {string} key\n * @returns {boolean}\n */\n HasAdapterResource(key) {\n return Object.prototype.hasOwnProperty.call(this.__adapterResources, String(key));\n }\n\n /**\n * Remove an adapter resource and optionally call its destroy/dispose method.\n *\n * @param {string} key\n * @param {object} options\n * @returns {CjsResource}\n */\n DestroyAdapterResource(key, options = {}) {\n const name = String(key);\n const value = this.__adapterResources[name];\n if (value && options.destroy !== false) {\n destroyAdapterValue(value);\n }\n delete this.__adapterResources[name];\n return this;\n }\n\n /**\n * Remove all adapter resources and optionally call their destroy/dispose methods.\n *\n * @param {object} options\n * @returns {CjsResource}\n */\n DestroyAdapterResources(options = {}) {\n for (const key of Object.keys(this.__adapterResources)) {\n this.DestroyAdapterResource(key, options);\n }\n return this;\n }\n\n static State = Object.freeze({\n EMPTY: \"empty\",\n REQUESTED: \"requested\",\n LOADING: \"loading\",\n LOADED: \"loaded\",\n PREPARING: \"preparing\",\n PREPARED: \"prepared\",\n FAILED: \"failed\",\n UNLOADED: \"unloaded\",\n PURGED: \"purged\"\n });\n\n /** Returns true when a value belongs to the resource state vocabulary. */\n static isValidState(state)\n {\n return Object.values(CjsResource.State).includes(state);\n }\n\n /**\n * Returns true when a resource state cannot continue its current operation.\n *\n * `PURGED` is deliberately absent: a purged resource reloads itself\n * through `KeepAlive()`, so purge is a transition out of a settled state\n * rather than a resting place.\n */\n static isTerminalState(state)\n {\n return state === CjsResource.State.PREPARED\n || state === CjsResource.State.FAILED\n || state === CjsResource.State.UNLOADED;\n }\n}\n\n// Declared as data rather than with decorators, so the resource tree stays\n// plain ESM that loads from source without a transform. Resources are not model\n// graph nodes - there is no Copy or Clone here, and SetValues/GetValues are a\n// flat schema-driven property copy - so nothing here needed the decorator form.\n// Field order is key order, and GetValues() exports in that order.\nCjsSchema.define(CjsResource, {\n className: \"CjsResource\",\n family: \"resource\",\n fields: {\n path: type.path,\n ext: type.string,\n requirement: type.string,\n state: type.string\n },\n methods: {\n Initialize: [ carbon.method, impl.adapted ],\n GetPath: [ carbon.method, impl.adapted ],\n GetExt: [ carbon.method, impl.adapted ],\n IsLoading: [ carbon.method, impl.adapted ],\n HasLoaded: [ carbon.method, impl.adapted ],\n IsPrepared: [ carbon.method, impl.adapted ],\n IsGood: [ carbon.method, impl.adapted ],\n IsFailed: [ carbon.method, impl.adapted ]\n }\n});\n\nfunction destroyAdapterValue(value) {\n if (!value || typeof value !== \"object\") return;\n const destroy = value.Destroy || value.Dispose || value.destroy || value.dispose;\n if (typeof destroy === \"function\") {\n destroy.call(value);\n }\n}\n"],"names":["CjsResource","CjsEventEmitter","maxReloadAttempts","path","ext","requirement","state","State","EMPTY","isResource","handlerMode","ResourceHandlerMode","RESOURCE","constructor","values","Object","defineProperty","value","create","enumerable","configurable","writable","SetValues","fields","CjsSchema","getSchema","field","prototype","hasOwnProperty","call","name","GetValues","result","Initialize","normalizeResourcePath","normalizeResourceExtension","getResourceExtension","undefined","String","trim","toLowerCase","error","GetPath","GetExt","GetRequirement","IsLoading","REQUESTED","LOADING","HasLoaded","LOADED","PREPARING","PREPARED","IsPrepared","HasCompleted","FAILED","IsGood","KeepAlive","IsFailed","SetState","details","isValidState","TypeError","previous","EmitEvent","OnCompleted","listener","source","OnEvent","MarkRequested","MarkLoading","MarkLoaded","MarkPreparing","MarkPrepared","MarkGood","MarkPurged","PURGED","IsPurged","SetError","SetPayload","payload","object","HasPayload","KeepPayloadAlive","GetPayload","ReleasePayload","SetLifecycleController","controller","Array","isArray","__lifecycleController","IsCurrent","Boolean","isCurrent","options","keepAlive","Reload","__reloadHook","SetReloadHook","hook","GetReloadAttempts","ResetReloadAttempts","keepPayloadAlive","Lock","lock","Unlock","unlock","SetObjectLoader","loader","request","__objectLoader","__objectRequest","freeze","GetObjectRequest","GetObject","Error","code","Promise","reject","Ready","SetAdapterResource","key","__adapterResources","GetAdapterResource","HasAdapterResource","DestroyAdapterResource","destroy","destroyAdapterValue","DestroyAdapterResources","keys","UNLOADED","includes","isTerminalState","define","className","family","type","string","methods","carbon","method","impl","adapted","Destroy","Dispose","dispose"],"mappings":";;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,eAAe,CAChD;EACE,QAAQ,GAAG,IAAI;;AAEf;EACA,eAAe,GAAG,CAAC;;AAEnB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC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AI,CAACC,MAAM;IACxBlI,KAAK,EAAEiI,IAAI,CAACC;GACb;AACDC,EAAAA,OAAO,EAAE;IACPxG,UAAU,EAAE,CAAEyG,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC3CnG,OAAO,EAAE,CAAEgG,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACxClG,MAAM,EAAE,CAAE+F,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACvChG,SAAS,EAAE,CAAE6F,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC1C7F,SAAS,EAAE,CAAE0F,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC1CzF,UAAU,EAAE,CAAEsF,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC3CtF,MAAM,EAAE,CAAEmF,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACvCpF,QAAQ,EAAE,CAAEiF,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AACzC;AACF,CAAC,CAAC;AAEF,SAASf,mBAAmBA,CAAC7G,KAAK,EAAE;AAClC,EAAA,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AACzC,EAAA,MAAM4G,OAAO,GAAG5G,KAAK,CAAC6H,OAAO,IAAI7H,KAAK,CAAC8H,OAAO,IAAI9H,KAAK,CAAC4G,OAAO,IAAI5G,KAAK,CAAC+H,OAAO;AAChF,EAAA,IAAI,OAAOnB,OAAO,KAAK,UAAU,EAAE;AACjCA,IAAAA,OAAO,CAAChG,IAAI,CAACZ,KAAK,CAAC;AACrB,EAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsResource.js","sources":["../../../src/resource/CjsResource.js"],"sourcesContent":["import { CjsEventEmitter } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n getResourceExtension,\n normalizeResourceExtension,\n normalizeResourcePath\n} from \"@carbonenginejs/runtime-utils/path\";\nimport { CjsSchema, carbon, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsFormatRoute } from \"../format/CjsFormatStore.js\";\nimport { ResourceHandlerMode } from \"./ResourceHandlerMode.js\";\n\n/**\n * Deterministic activity values accepted by resource-facing lease methods.\n *\n * @typedef {object} CjsResourceActivityOptions\n * @property {number} [frame] Explicit non-negative activity frame.\n * @property {number} [time] Explicit non-negative activity timestamp in milliseconds.\n */\n\n/**\n * Manager-owned callbacks attached while a resource has canonical ownership,\n * and detached the moment it ends. The controller carries no load, fetch, or\n * prepare hook; recovery lives in the separate reload hook, which deliberately\n * outlives ownership because losing ownership is exactly when it is needed.\n *\n * @typedef {object} CjsResourceLifecycleController\n * @property {Function} [isCurrent] Tests exact canonical manager ownership without renewing activity.\n * @property {Function} [keepAlive] Renews canonical identity activity.\n * @property {Function} [keepPayloadAlive] Renews identity and CPU-payload activity.\n * @property {Function} [lock] Adds one inactivity-purge lock and returns its count.\n * @property {Function} [unlock] Releases one inactivity-purge lock and returns its count.\n */\n\n/**\n * ResMan-owned runtime resource.\n *\n * Resources are not model graph objects: BLACK/RED graphs persist resource\n * paths (including empty paths), while CjsResMan constructs, initializes,\n * caches, and hydrates the corresponding runtime resource instances.\n */\nexport class CjsResource extends CjsEventEmitter\n{\n #payload = null;\n\n /** Reloads attempted since the last successful load. */\n #reloadAttempts = 0;\n\n /**\n * How many times a purged or failed resource reloads itself before giving up.\n *\n * Per class so a subclass can be more or less patient. Counted per resource\n * and reset on every successful load, so this bounds consecutive failures,\n * not the lifetime total.\n */\n static maxReloadAttempts = 3;\n\n path = \"\";\n\n ext = \"\";\n\n requirement = \"\";\n\n state = CjsResource.State.EMPTY;\n\n /**\n * Identifies this class as a runtime resource.\n *\n * Static, so a schema field declared as `@type.objectRef(\"TriGeometryRes\")`\n * can be known to hold a resource without an instance existing - the\n * declaration alone is enough, resolved through `CjsSchema.GetConstructor`.\n */\n static isResource = true;\n\n /** Declares that extension routes using this handler publish the resource. */\n static handlerMode = ResourceHandlerMode.RESOURCE;\n\n /** Identifies this handle as a runtime resource. */\n get isResource() {\n return this.constructor.isResource === true;\n }\n\n /**\n * Create a detached runtime resource with empty identity and payload state.\n * Schema values are applied without attaching manager lifecycle callbacks;\n * CjsResMan supplies those callbacks after canonical insertion.\n *\n * @param {object|null} [values=null] Initial decorated schema-field values.\n */\n constructor(values = null) {\n super();\n Object.defineProperty(this, \"__adapterResources\", {\n value: Object.create(null),\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__formatStore\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__objectLoader\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__objectRequest\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__lifecycleController\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__reloadHook\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n if (values)\n {\n this.SetValues(values);\n }\n }\n\n /**\n * Apply resource identity or metadata values without model graph semantics.\n *\n * @param {object|null} values\n * @returns {CjsResource}\n */\n SetValues(values = null) {\n if (!values || typeof values !== \"object\") return this;\n const fields = CjsSchema.getSchema(this.constructor).fields;\n for (const field of fields) {\n if (Object.prototype.hasOwnProperty.call(values, field.name)) {\n this[field.name] = values[field.name];\n }\n }\n return this;\n }\n\n /**\n * Export resource identity and schema metadata. Runtime state is not a model\n * graph node; graph fields normally persist only their resource path.\n *\n * @returns {object}\n */\n GetValues() {\n const result = {};\n for (const field of CjsSchema.getSchema(this.constructor).fields) {\n result[field.name] = this[field.name];\n }\n return result;\n }\n\n /**\n * Initialize the resource identity from a path and optional extension.\n *\n * @param {string} path\n * @param {string|null} ext\n * @param {string|null} requirement\n * @returns {CjsResource}\n */\n Initialize(path, ext = null, requirement = \"\") {\n this.path = normalizeResourcePath(path);\n this.ext = ext ? normalizeResourceExtension(ext) : getResourceExtension(this.path);\n this.requirement = requirement === null || requirement === undefined\n ? \"\"\n : String(requirement).trim().toLowerCase();\n this.state = CjsResource.State.EMPTY;\n this.error = null;\n return this;\n }\n\n /**\n * Get the normalized resource path.\n *\n * @returns {string}\n */\n GetPath() {\n return this.path;\n }\n\n /**\n * Get the normalized resource extension.\n *\n * @returns {string}\n */\n GetExt() {\n return this.ext;\n }\n\n /**\n * Return the normalized semantic outcome requested from this source path.\n * This metadata query is pure and does not renew manager activity.\n *\n * @returns {string} Lowercase requirement name, or an empty string.\n */\n GetRequirement() {\n return this.requirement;\n }\n\n /**\n * Return true when the resource is currently loading.\n *\n * @returns {boolean}\n */\n IsLoading() {\n return this.state === CjsResource.State.REQUESTED || this.state === CjsResource.State.LOADING;\n }\n\n /**\n * Return true when CPU resource payload data has been loaded.\n *\n * @returns {boolean}\n */\n HasLoaded() {\n return this.state === CjsResource.State.LOADED\n || this.state === CjsResource.State.PREPARING\n || this.state === CjsResource.State.PREPARED;\n }\n\n /**\n * Return true when preparation has completed or produced a good resource.\n *\n * @returns {boolean}\n */\n IsPrepared() {\n return this.state === CjsResource.State.PREPARED;\n }\n\n /**\n * Return true when this resource finished trying to load, either way.\n *\n * The pull form of the `completed` event. Carbon expresses this as a\n * predicate because it has no events - `m_isPrepared` is set on the failure\n * path too (`BlueAsyncRes.cpp:183`) - so `IsPrepared()` there means \"finished\n * trying\" while ours keeps the narrower \"succeeded\".\n *\n * `PURGED` is not completion: nothing was tried and nothing concluded, the\n * payload was simply taken away.\n *\n * @returns {boolean}\n */\n HasCompleted() {\n return this.state === CjsResource.State.PREPARED\n || this.state === CjsResource.State.FAILED;\n }\n\n /**\n * Return true when preparation completed successfully, and renew this\n * resource.\n *\n * Every caller of `IsGood()` is about to use the resource, so renewal always\n * follows the query. Merging them - as ccpwgl does in `Tw2Resource.js:108` -\n * closes that gap permanently instead of relying on call-site discipline, and\n * means a purged resource reloads itself the moment anything asks for it.\n *\n * @returns {boolean}\n */\n IsGood() {\n this.KeepAlive();\n return this.IsPrepared();\n }\n\n /**\n * Return true when preparation failed.\n *\n * @returns {boolean}\n */\n IsFailed() {\n return this.state === CjsResource.State.FAILED;\n }\n\n /**\n * Changes state and emits the state-specific, statechange, and - on reaching\n * a load outcome - completed events.\n */\n SetState(state, ...details) {\n if (!CjsResource.isValidState(state)) {\n throw new TypeError(`Invalid CjsResource state: ${state}`);\n }\n const previous = this.state;\n if (previous === state) return this;\n this.state = state;\n // A successful load clears the budget, so the cap bounds consecutive\n // failures rather than how many times a resource may ever be purged.\n if (state === CjsResource.State.PREPARED) this.#reloadAttempts = 0;\n this.EmitEvent?.(state, this, ...details);\n this.EmitEvent?.(\"statechange\", this, state, previous);\n // Fires again after a purge and reload, so subscribers rebuild whatever\n // they derived from the payload that was deleted.\n if (this.HasCompleted()) this.EmitEvent?.(\"completed\", this, ...details);\n return this;\n }\n\n /**\n * Subscribe to this resource finishing, firing immediately when it already\n * has.\n *\n * The immediate call is the point. A plain emitter drops late subscribers on\n * the floor - subscribe after `PREPARED` and nothing ever arrives - which is\n * why callers end up doing work synchronously \"just in case\" instead of\n * subscribing. ccpwgl solves this by replaying current state at registration\n * (`Tw2Resource.onNotification`), and a subscriber satisfied that way is\n * never stored at all, so only subscriptions genuinely still waiting\n * accumulate.\n *\n * The listener runs for both outcomes and branches itself:\n *\n * ```js\n * res.OnCompleted(res => { if (res.IsPrepared()) something; else somethingElse; });\n * ```\n *\n * It may run more than once - a purge and reload completes again - so\n * handlers must be written to be re-entered rather than assuming first load.\n *\n * @param {Function} listener Called with this resource once it has finished.\n * @param {*} [source=null] Optional owner used for bulk removal.\n * @returns {CjsResource} This resource.\n */\n OnCompleted(listener, source = null)\n {\n if (typeof listener !== \"function\")\n {\n throw new TypeError(\"CjsResource.OnCompleted requires a function.\");\n }\n if (this.HasCompleted())\n {\n listener(this);\n return this;\n }\n return this.OnEvent(\"completed\", listener, source);\n }\n\n /** Marks this resource as requested. */\n MarkRequested() {\n return this.SetState(CjsResource.State.REQUESTED);\n }\n\n /** Marks this resource as actively loading. */\n MarkLoading() {\n return this.SetState(CjsResource.State.LOADING);\n }\n\n /** Marks this resource's CPU payload as loaded. */\n MarkLoaded() {\n return this.SetState(CjsResource.State.LOADED);\n }\n\n /** Marks this resource as preparing its semantic result. */\n MarkPreparing() {\n return this.SetState(CjsResource.State.PREPARING);\n }\n\n /** Marks this resource as successfully prepared. */\n MarkPrepared() {\n return this.SetState(CjsResource.State.PREPARED);\n }\n\n /** Marks this resource as successfully prepared. */\n MarkGood() {\n return this.MarkPrepared();\n }\n\n /**\n * Mark this detached resource handle as purged after a successful\n * manager-owned policy eviction, such as inactivity or recorded-byte cache\n * pressure, released its adapter allocations and payload.\n *\n * @returns {CjsResource} This purged resource.\n */\n MarkPurged()\n {\n return this.SetState(CjsResource.State.PURGED);\n }\n\n /**\n * Return whether deterministic manager cleanup has purged this handle.\n * This is a pure state query and never renews resource activity.\n *\n * @returns {boolean} `true` when the current state is `PURGED`.\n */\n IsPurged()\n {\n return this.state === CjsResource.State.PURGED;\n }\n\n /** Stores a load failure and marks this resource as failed. */\n SetError(error) {\n this.error = error || null;\n return this.SetState(CjsResource.State.FAILED, this.error);\n }\n\n /**\n * Store the plain CPU payload associated with this resource.\n * Concrete resource classes validate the fields they require before calling\n * this method. If the compatibility `object` property still aliases the\n * previous payload, it is updated to the replacement; semantic resources\n * whose `object` points to the resource itself are unaffected. A non-null\n * payload explicitly renews its manager-owned identity and payload leases;\n * payload reads remain pure and do not renew either lease.\n *\n * @param {*} payload Plain reader/converter output, or `null` to clear it.\n * @returns {CjsResource} This resource with the supplied payload reference.\n */\n SetPayload(payload = null) {\n const previous = this.#payload;\n this.#payload = payload;\n if (this.object === previous) this.object = payload;\n if (this.HasPayload()) this.KeepPayloadAlive();\n return this;\n }\n\n /**\n * Take over loading entirely, before the manager fetches anything.\n *\n * Returning `true` means this resource handled its own acquisition and the\n * manager stands down: no fetch, no queue entry. Returning `false` — the\n * default — means load it the ordinary way.\n *\n * This one IS optional, unlike `DoLoad`, and that is why it has a default\n * instead of a refusal. Most resources never take it. Declaring it here\n * rather than optional-chaining at the call site keeps the caller honest:\n * absence is a supported answer, so the base states the answer.\n *\n * @param {string} url Resolved source url.\n * @param {string} extension Lowercased extension including its dot.\n * @returns {boolean} Whether this resource handled its own load.\n */\n DoCustomLoad(url, extension) {\n return false;\n }\n\n /**\n * Bind the format store this resource may resolve its own reader from.\n *\n * A resource must not import its formats - every one of them is a\n * tree-shakeable subpath, so importing one here would drag it into every\n * consumer of this resource. Nor can it hardcode a list, because which\n * formats exist is a property of the composed application. The store is the\n * link that lets both stay true: the composition root registers what it\n * wants, and the resource asks.\n *\n * Optional. A resource loaded through `CjsResMan` never needs it, because the\n * manager resolves the reader from its own extension routes and hands the\n * outcome over as a payload. This is for the resource driving its own load.\n *\n * @param {import(\"../format/CjsFormatStore.js\").CjsFormatStore|null} store\n * @returns {CjsResource} This resource.\n */\n SetFormatStore(store = null) {\n if (store !== null && typeof store?.Resolve !== \"function\") {\n throw new TypeError(\"CjsResource.SetFormatStore requires a format store or null.\");\n }\n this.__formatStore = store;\n return this;\n }\n\n /** The bound format store, or `null`. */\n GetFormatStore() {\n return this.__formatStore || null;\n }\n\n /**\n * The route that should read this resource's source data.\n *\n * An explicitly supplied format always wins: a caller naming a reader knows\n * something the extension does not. It is wrapped in a route so callers have\n * one shape to handle either way.\n *\n * Otherwise the bound store answers from this resource's own extension, and\n * from an `output` only when the caller asks for one.\n *\n * `requirement` IS NOT THE OUTPUT, though it reads like it. It selects the\n * resource class — `CjsResMan.RegisterResourceType` keys on it. A format's\n * outputs are a different axis entirely: `texture` and `rgba` are two\n * representations of one DDS. Conflating them makes a resource loaded with\n * `requirement: \"geometry\"` filter for routes declaring an output named\n * `geometry`, find none, and resolve to null.\n *\n * Returns `null` when nothing answers, so the caller reports what it could\n * not read rather than handing bytes to a reader that never claimed them.\n *\n * @param {*} [data] Source data, used to separate routes sharing an extension.\n * @param {object|null} [options] May carry an explicit `format`, `read` and `output`.\n * @returns {import(\"../format/CjsFormatStore.js\").CjsFormatRoute|null}\n */\n ResolveFormat(data, options = null) {\n if (options?.format) {\n return new CjsFormatRoute(options.format, {\n read: options.read,\n output: options.output || null\n });\n }\n return this.GetFormatStore()?.Resolve(this.ext, data, {\n output: options?.output || null\n }) || null;\n }\n\n /**\n * How this resource wants its source bytes delivered.\n *\n * The manager must fetch before it knows the format, so the resource states\n * what shape it needs. Defaults to the format-side default, which is what\n * every transport hardcodes today.\n *\n * @returns {string} A fetch response type.\n */\n GetRequestResponseType() {\n return \"arraybuffer\";\n }\n\n /**\n * Turn raw source bytes into this resource.\n *\n * Declared here rather than left to each subclass because it is the load\n * contract, not an optional capability. The base refuses rather than\n * silently succeeding: a resource reached by the loader that has not been\n * taught to read its own bytes is a registration mistake, and returning\n * quietly would publish an empty resource and mark it prepared.\n *\n * `Tr2EffectRes` already implements exactly this shape, and it is the only\n * resource that does. It takes container bytes and keeps the reader it\n * builds, because a shader body cannot be read later without it — strings\n * are offsets into an arena that lives in the header it consumed. No payload\n * hand-off could have carried that, which is why it bypassed the manager.\n *\n * @param {ArrayBuffer|ArrayBufferView|string} data Raw source data.\n * @param {object|null} [options] Model values applied after the read.\n * @returns {CjsResource} This resource.\n * @throws {Error} When the concrete resource does not implement it.\n */\n DoLoad(data, options = null) {\n const className = this.constructor?.name || \"CjsResource\";\n const error = new Error(\n `${className}.DoLoad is not implemented. A resource reached by the loader `\n + \"must turn its own source bytes into itself; implement DoLoad, or register \"\n + \"a format that populates this resource.\"\n );\n error.code = \"CJS_RESOURCE_LOAD_NOT_IMPLEMENTED\";\n error.className = className;\n throw error;\n }\n\n /**\n * Read the plain CPU payload associated with this resource.\n *\n * The query is pure and does not renew the payload lease.\n *\n * @returns {*} Current payload reference, or `null` after release.\n */\n GetPayload() {\n return this.#payload;\n }\n\n /**\n * Return whether a payload has been explicitly assigned. This query is pure\n * and does not renew the payload lease.\n *\n * @returns {boolean} Whether a non-null payload is attached.\n */\n HasPayload() {\n return this.#payload !== null && this.#payload !== undefined;\n }\n\n /**\n * Release the complete payload reference after consumers have retained the\n * scalars and typed-array views they require. When the compatibility\n * `object` property still aliases that exact payload, it is cleared as part\n * of the same ownership release. Semantic resources whose `object` property\n * points to the resource itself are unaffected.\n *\n * @returns {CjsResource} This resource without its former payload reference.\n */\n ReleasePayload() {\n const payload = this.#payload;\n this.#payload = null;\n if (this.object === payload) this.object = null;\n return this;\n }\n\n /**\n * Bind or detach the manager callbacks used by explicit resource-facing\n * liveness operations. Runtime resources remain usable when unbound; their\n * liveness methods then become deterministic no-ops.\n *\n * @param {CjsResourceLifecycleController|null} controller Manager callbacks, or `null` after canonical ownership ends.\n * @returns {CjsResource} This resource.\n * @throws {TypeError} If the controller or any supplied callback is invalid.\n */\n SetLifecycleController(controller = null)\n {\n if (controller !== null && (typeof controller !== \"object\" || Array.isArray(controller)))\n {\n throw new TypeError(\"CjsResource lifecycle controller must be an object or null.\");\n }\n for (const name of [ \"isCurrent\", \"keepAlive\", \"keepPayloadAlive\", \"lock\", \"unlock\" ])\n {\n if (controller?.[name] !== undefined && typeof controller[name] !== \"function\")\n {\n throw new TypeError(`CjsResource lifecycle controller ${name} must be a function.`);\n }\n }\n this.__lifecycleController = controller;\n return this;\n }\n\n /**\n * Return whether this handle is still the manager's canonical resource.\n *\n * Engine adapters use this immediately before synchronously attaching a\n * completed backend candidate. Detached resources return `false`; the query\n * never renews activity, reloads data, or mutates lifecycle state.\n *\n * @returns {boolean} Whether the bound manager still owns this exact handle.\n */\n IsCurrent()\n {\n return Boolean(this.__lifecycleController?.isCurrent?.());\n }\n\n /**\n * Renew this resource's canonical identity activity, and reload it when\n * it has been purged.\n *\n * Purge is deletion - the payload is gone and nothing restores it - so\n * revival is an ordinary reload along the first-load path. Consumers\n * therefore never have to know a purge happened: they ask for what they need\n * and this makes it be there.\n *\n * `IsGood()` calls this, so most callers never invoke it directly.\n *\n * @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.\n * @returns {CjsResource} This resource, whether bound or detached.\n * @throws {TypeError} If the bound manager rejects invalid activity values.\n */\n KeepAlive(options = {})\n {\n this.__lifecycleController?.keepAlive?.(options);\n if (this.IsPurged()) this.Reload(options);\n return this;\n }\n\n /**\n * Re-register this handle with its manager and reload it into itself.\n *\n * Runs only from `PURGED` or `FAILED` - the two states where the payload is\n * absent but recoverable. It does nothing to a resource that is loaded or\n * still loading, so it is not a way to force a refetch of something already\n * there.\n *\n * Bounded by `maxReloadAttempts`, because `KeepAlive()` calls this and the\n * render path calls that every frame: without a cap, one missing texture\n * becomes a permanent retry storm against the thing least likely to succeed.\n * Attempts are spaced by real load round-trips rather than frames - starting\n * one leaves `PURGED`/`FAILED`, so nothing re-enters until it settles - and\n * the count resets on any successful load.\n *\n * The distinction that matters: the reload must fill THIS handle, not resolve\n * whatever the manager currently caches for the same path. A consumer holding\n * a purged handle has no way to discover a replacement, so handing it a fresh\n * instance elsewhere leaves it dead forever.\n *\n * Detached handles have no manager to re-register with and stay as they are.\n *\n * @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.\n * @returns {boolean} Whether a reload was started.\n */\n Reload(options = {})\n {\n if (!this.IsPurged() && !this.IsFailed()) return false;\n if (this.#reloadAttempts >= this.constructor.maxReloadAttempts) return false;\n if (typeof this.__reloadHook !== \"function\") return false;\n\n this.#reloadAttempts += 1;\n return this.__reloadHook(options) !== false;\n }\n\n /**\n * Bind the manager callback that restores this handle after it loses its\n * payload.\n *\n * Deliberately separate from the lifecycle controller, which is detached the\n * moment canonical ownership ends. Recovery has to survive exactly that\n * event: a purged handle with no route back to its manager is unrecoverable,\n * which is the failure this whole contract exists to prevent.\n *\n * @param {Function|null} hook Manager callback, or `null` to detach it.\n * @returns {CjsResource} This resource.\n * @throws {TypeError} If the hook is neither a function nor null.\n */\n SetReloadHook(hook = null)\n {\n if (hook !== null && typeof hook !== \"function\")\n {\n throw new TypeError(\"CjsResource.SetReloadHook requires a function or null.\");\n }\n this.__reloadHook = hook;\n return this;\n }\n\n /**\n * Return how many reloads have been attempted since the last successful load.\n *\n * @returns {number}\n */\n GetReloadAttempts()\n {\n return this.#reloadAttempts;\n }\n\n /**\n * Clear the reload attempt count, so a resource that exhausted its attempts\n * can be asked again.\n *\n * This is the deliberate \"try it again\" gesture - a user retrying a failed\n * load, say. It is separate from `Reload()` because the cap exists precisely\n * to stop the automatic path retrying forever, so lifting it has to be a\n * decision someone made.\n *\n * @returns {CjsResource} This resource.\n */\n ResetReloadAttempts()\n {\n this.#reloadAttempts = 0;\n return this;\n }\n\n /**\n * Explicitly renew both canonical identity activity and the attached CPU\n * payload lease. Reading the payload through `GetPayload()` or\n * `HasPayload()` remains pure.\n *\n * @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.\n * @returns {CjsResource} This resource, whether a payload exists or not.\n * @throws {TypeError} If the bound manager rejects invalid activity values.\n */\n KeepPayloadAlive(options = {})\n {\n this.__lifecycleController?.keepPayloadAlive?.(options);\n return this;\n }\n\n /**\n * Add one explicit purge lock through the bound manager and renew identity\n * activity. Locking never reloads or prepares a resource.\n *\n * @returns {number} New lock count, or `0` when this resource is detached.\n */\n Lock()\n {\n return this.__lifecycleController?.lock?.() || 0;\n }\n\n /**\n * Release one explicit purge lock without allowing the count to underflow.\n * Unlocking does not immediately purge or release a payload.\n *\n * @returns {number} Remaining lock count, or `0` when detached or unlocked.\n */\n Unlock()\n {\n return this.__lifecycleController?.unlock?.() || 0;\n }\n\n /**\n * Bind the manager-owned object operation and compact reconstruction request\n * for this shared resource handle. The request contains source provenance\n * and requested-output defaults, not reader implementations or registry\n * history.\n *\n * @param {Function|null} loader Manager callback, or `null` to detach it.\n * @param {object|null} [request=null] Compact reconstruction defaults retained with the handle.\n * @returns {CjsResource} This resource with the supplied loader binding.\n * @throws {TypeError} If the loader or reconstruction request is invalid.\n */\n SetObjectLoader(loader = null, request = null)\n {\n if (loader !== null && typeof loader !== \"function\")\n {\n throw new TypeError(\"CjsResource.SetObjectLoader requires a function or null.\");\n }\n if (request !== null && (!request || typeof request !== \"object\" || Array.isArray(request)))\n {\n throw new TypeError(\"CjsResource.SetObjectLoader request must be an object or null.\");\n }\n this.__objectLoader = loader;\n this.__objectRequest = request === null ? null : Object.freeze({ ...request });\n return this;\n }\n\n /**\n * Return the compact manager request retained for explicit reconstruction.\n * This query is pure and exposes no reader, constructor, or implementation\n * identity.\n *\n * @returns {Readonly<object>|null} Frozen reconstruction defaults, or `null` when unbound.\n */\n GetObjectRequest()\n {\n return this.__objectRequest;\n }\n\n /**\n * Return the manager-owned object outcome for this resource identity.\n * Concurrent callers share one in-flight operation. A resident payload is\n * returned without source work; after explicit payload release, this call is\n * an explicit reconstruction request and may load/prepare through the bound\n * manager. This loader resolves the manager's current canonical identity, so\n * on a purged handle it may answer with a different instance - use\n * `KeepAlive()`/`Reload()` to revive this handle itself.\n *\n * Promised-output fields retained by the handle take precedence over fields\n * supplied here; operation policy such as cache/reload controls may still be\n * overridden.\n *\n * @param {object} [options={}] Source, format, semantic outcome, and queue options forwarded to the manager.\n * @returns {Promise<*>} In-flight, resident, or reconstructed object outcome.\n */\n GetObject(options = {})\n {\n if (!this.__objectLoader)\n {\n const error = new Error(`Resource has no object loader: ${this.path}`);\n error.code = \"CJS_RESOURCE_LOADER_UNBOUND\";\n return Promise.reject(error);\n }\n return this.__objectLoader(options);\n }\n\n /**\n * Promise-shaped alias for {@link CjsResource#GetObject}. Readiness shares an\n * in-flight operation, returns resident payload without loading, and treats a\n * call after payload release as an explicit reconstruction request.\n *\n * @param {object} [options={}] Source, format, semantic outcome, and queue options forwarded to the manager.\n * @returns {Promise<*>} In-flight, resident, or reconstructed object outcome.\n */\n Ready(options = {})\n {\n return this.GetObject(options);\n }\n\n /**\n * Attach an opaque engine-owned resource object.\n *\n * Runtime-resource stores this value but does not inspect GPU APIs.\n *\n * @param {string} key\n * @param {*} value\n * @returns {CjsResource}\n */\n SetAdapterResource(key, value) {\n if (!key) throw new TypeError(\"CjsResource.SetAdapterResource requires a key.\");\n this.__adapterResources[String(key)] = value;\n return this;\n }\n\n /**\n * Get an opaque engine-owned resource object.\n *\n * @param {string} key\n * @returns {*}\n */\n GetAdapterResource(key) {\n return this.__adapterResources[String(key)] ?? null;\n }\n\n /**\n * Returns true when an adapter resource exists for the given key.\n *\n * @param {string} key\n * @returns {boolean}\n */\n HasAdapterResource(key) {\n return Object.prototype.hasOwnProperty.call(this.__adapterResources, String(key));\n }\n\n /**\n * Remove an adapter resource and optionally call its destroy/dispose method.\n *\n * @param {string} key\n * @param {object} options\n * @returns {CjsResource}\n */\n DestroyAdapterResource(key, options = {}) {\n const name = String(key);\n const value = this.__adapterResources[name];\n if (value && options.destroy !== false) {\n destroyAdapterValue(value);\n }\n delete this.__adapterResources[name];\n return this;\n }\n\n /**\n * Remove all adapter resources and optionally call their destroy/dispose methods.\n *\n * @param {object} options\n * @returns {CjsResource}\n */\n DestroyAdapterResources(options = {}) {\n for (const key of Object.keys(this.__adapterResources)) {\n this.DestroyAdapterResource(key, options);\n }\n return this;\n }\n\n static State = Object.freeze({\n EMPTY: \"empty\",\n REQUESTED: \"requested\",\n LOADING: \"loading\",\n LOADED: \"loaded\",\n PREPARING: \"preparing\",\n PREPARED: \"prepared\",\n FAILED: \"failed\",\n UNLOADED: \"unloaded\",\n PURGED: \"purged\"\n });\n\n /** Returns true when a value belongs to the resource state vocabulary. */\n static isValidState(state)\n {\n return Object.values(CjsResource.State).includes(state);\n }\n\n /**\n * Returns true when a resource state cannot continue its current operation.\n *\n * `PURGED` is deliberately absent: a purged resource reloads itself\n * through `KeepAlive()`, so purge is a transition out of a settled state\n * rather than a resting place.\n */\n static isTerminalState(state)\n {\n return state === CjsResource.State.PREPARED\n || state === CjsResource.State.FAILED\n || state === CjsResource.State.UNLOADED;\n }\n}\n\n// Declared as data rather than with decorators, so the resource tree stays\n// plain ESM that loads from source without a transform. Resources are not model\n// graph nodes - there is no Copy or Clone here, and SetValues/GetValues are a\n// flat schema-driven property copy - so nothing here needed the decorator form.\n// Field order is key order, and GetValues() exports in that order.\nCjsSchema.define(CjsResource, {\n className: \"CjsResource\",\n family: \"resource\",\n fields: {\n path: type.path,\n ext: type.string,\n requirement: type.string,\n state: type.string\n },\n methods: {\n Initialize: [ carbon.method, impl.adapted ],\n GetPath: [ carbon.method, impl.adapted ],\n GetExt: [ carbon.method, impl.adapted ],\n IsLoading: [ carbon.method, impl.adapted ],\n HasLoaded: [ carbon.method, impl.adapted ],\n IsPrepared: [ carbon.method, impl.adapted ],\n IsGood: [ carbon.method, impl.adapted ],\n IsFailed: [ carbon.method, impl.adapted ]\n }\n});\n\nfunction destroyAdapterValue(value) {\n if (!value || typeof value !== \"object\") return;\n const destroy = value.Destroy || value.Dispose || value.destroy || value.dispose;\n if (typeof destroy === \"function\") {\n destroy.call(value);\n }\n}\n"],"names":["CjsResource","CjsEventEmitter","maxReloadAttempts","path","ext","requirement","state","State","EMPTY","isResource","handlerMode","ResourceHandlerMode","RESOURCE","constructor","values","Object","defineProperty","value","create","enumerable","configurable","writable","SetValues","fields","CjsSchema","getSchema","field","prototype","hasOwnProperty","call","name","GetValues","result","Initialize","normalizeResourcePath","normalizeResourceExtension","getResourceExtension","undefined","String","trim","toLowerCase","error","GetPath","GetExt","GetRequirement","IsLoading","REQUESTED","LOADING","HasLoaded","LOADED","PREPARING","PREPARED","IsPrepared","HasCompleted","FAILED","IsGood","KeepAlive","IsFailed","SetState","details","isValidState","TypeError","previous","EmitEvent","OnCompleted","listener","source","OnEvent","MarkRequested","MarkLoading","MarkLoaded","MarkPreparing","MarkPrepared","MarkGood","MarkPurged","PURGED","IsPurged","SetError","SetPayload","payload","object","HasPayload","KeepPayloadAlive","DoCustomLoad","url","extension","SetFormatStore","store","Resolve","__formatStore","GetFormatStore","ResolveFormat","data","options","format","CjsFormatRoute","read","output","GetRequestResponseType","DoLoad","className","Error","code","GetPayload","ReleasePayload","SetLifecycleController","controller","Array","isArray","__lifecycleController","IsCurrent","Boolean","isCurrent","keepAlive","Reload","__reloadHook","SetReloadHook","hook","GetReloadAttempts","ResetReloadAttempts","keepPayloadAlive","Lock","lock","Unlock","unlock","SetObjectLoader","loader","request","__objectLoader","__objectRequest","freeze","GetObjectRequest","GetObject","Promise","reject","Ready","SetAdapterResource","key","__adapterResources","GetAdapterResource","HasAdapterResource","DestroyAdapterResource","destroy","destroyAdapterValue","DestroyAdapterResources","keys","UNLOADED","includes","isTerminalState","define","family","type","string","methods","carbon","method","impl","adapted","Destroy","Dispose","dispose"],"mappings":";;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,eAAe,CAChD;EACE,QAAQ,GAAG,IAAI;;AAEf;EACA,eAAe,GAAG,CAAC;;AAEnB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,iBAAiB,GAAG,CAAC;AAE5BC,EAAAA,IAAI,GAAG,EAAE;AAETC,EAAAA,GAAG,GAAG,EAAE;AAERC,EAAAA,WAAW,GAAG,EAAE;AAEhBC,EAAAA,KAAK,GAAGN,WAAW,CAACO,KAAK,CAACC,KAAK;;AAE/B;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,GAAG,IAAI;;AAExB;AACA,EAAA,OAAOC,WAAW,GAAGC,mBAAmB,CAACC,QAAQ;;AAEjD;EACA,IAAIH,UAAUA,GAAG;AACf,IAAA,OAAO,IAAI,CAACI,WAAW,CAACJ,UAAU,KAAK,IAAI;AAC7C,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACEI,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EAAE;AACzB,IAAA,KAAK,EAAE;AACPC,IAAAA,MAAM,CAACC,cAAc,C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AChF,EAAA,IAAI,OAAOlB,OAAO,KAAK,UAAU,EAAE;AACjCA,IAAAA,OAAO,CAACjH,IAAI,CAACZ,KAAK,CAAC;AACrB,EAAA;AACF;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The key that selects which resource class a path becomes.
|
|
3
|
+
*
|
|
4
|
+
* Carried by `CjsResource.requirement`, declared by each resource as
|
|
5
|
+
* `static payload`, and matched by `CjsResMan.RegisterResourceType` and
|
|
6
|
+
* `GetResource({ requirement })` — one vocabulary in three places, previously a
|
|
7
|
+
* bare literal in each, with nothing catching a typo between them.
|
|
8
|
+
*
|
|
9
|
+
* Not to be confused with a format's `outputs`, which declare each available
|
|
10
|
+
* representation rather than a class: one DDS read as `texture` or as `rgba` is
|
|
11
|
+
* the same file in the same resource.
|
|
12
|
+
*
|
|
13
|
+
* @readonly
|
|
14
|
+
* @enum {string}
|
|
15
|
+
*/
|
|
16
|
+
const ResourceRequirement = Object.freeze({
|
|
17
|
+
/** `TriTextureRes` */
|
|
18
|
+
TEXTURE: "texture",
|
|
19
|
+
/** `Tr2ImageRes` */
|
|
20
|
+
IMAGE: "image",
|
|
21
|
+
/** `CjsTextureArrayRes` */
|
|
22
|
+
TEXTURE_ARRAY: "texture-array",
|
|
23
|
+
/** `TriGeometryRes`, and `TriGrannyRes` — a `.gr2` is geometry, and which
|
|
24
|
+
* geometry resource reads it is the extension route's decision. */
|
|
25
|
+
GEOMETRY: "geometry",
|
|
26
|
+
/** `Tr2GrannyStateRes` */
|
|
27
|
+
GRANNY_STATE: "granny-state",
|
|
28
|
+
/** `Tr2EffectRes` */
|
|
29
|
+
SHADER: "shader",
|
|
30
|
+
/** `Tr2LightProfileRes` */
|
|
31
|
+
LIGHT_PROFILE: "light-profile",
|
|
32
|
+
/** The audio resources. */
|
|
33
|
+
AUDIO: "audio"
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/** Whether a value belongs to the requirement vocabulary. */
|
|
37
|
+
function isResourceRequirement(value) {
|
|
38
|
+
return Object.values(ResourceRequirement).includes(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { ResourceRequirement, isResourceRequirement };
|
|
42
|
+
//# sourceMappingURL=ResourceRequirement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceRequirement.js","sources":["../../../src/resource/ResourceRequirement.js"],"sourcesContent":["/**\r\n * The key that selects which resource class a path becomes.\r\n *\r\n * Carried by `CjsResource.requirement`, declared by each resource as\r\n * `static payload`, and matched by `CjsResMan.RegisterResourceType` and\r\n * `GetResource({ requirement })` — one vocabulary in three places, previously a\r\n * bare literal in each, with nothing catching a typo between them.\r\n *\r\n * Not to be confused with a format's `outputs`, which declare each available\n * representation rather than a class: one DDS read as `texture` or as `rgba` is\n * the same file in the same resource.\r\n *\r\n * @readonly\r\n * @enum {string}\r\n */\r\nexport const ResourceRequirement = Object.freeze({\r\n /** `TriTextureRes` */\r\n TEXTURE: \"texture\",\r\n /** `Tr2ImageRes` */\r\n IMAGE: \"image\",\r\n /** `CjsTextureArrayRes` */\r\n TEXTURE_ARRAY: \"texture-array\",\r\n /** `TriGeometryRes`, and `TriGrannyRes` — a `.gr2` is geometry, and which\n * geometry resource reads it is the extension route's decision. */\n GEOMETRY: \"geometry\",\r\n /** `Tr2GrannyStateRes` */\r\n GRANNY_STATE: \"granny-state\",\r\n /** `Tr2EffectRes` */\r\n SHADER: \"shader\",\r\n /** `Tr2LightProfileRes` */\r\n LIGHT_PROFILE: \"light-profile\",\r\n /** The audio resources. */\r\n AUDIO: \"audio\"\r\n});\r\n\r\n/** Whether a value belongs to the requirement vocabulary. */\r\nexport function isResourceRequirement(value)\r\n{\r\n return Object.values(ResourceRequirement).includes(value);\r\n}\r\n\r\nexport default ResourceRequirement;\r\n"],"names":["ResourceRequirement","Object","freeze","TEXTURE","IMAGE","TEXTURE_ARRAY","GEOMETRY","GRANNY_STATE","SHADER","LIGHT_PROFILE","AUDIO","isResourceRequirement","value","values","includes"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACaA,mBAAmB,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC/C;AACAC,EAAAA,OAAO,EAAE,SAAS;AAClB;AACAC,EAAAA,KAAK,EAAE,OAAO;AACd;AACAC,EAAAA,aAAa,EAAE,eAAe;AAC9B;AACF;AACEC,EAAAA,QAAQ,EAAE,UAAU;AACpB;AACAC,EAAAA,YAAY,EAAE,cAAc;AAC5B;AACAC,EAAAA,MAAM,EAAE,QAAQ;AAChB;AACAC,EAAAA,aAAa,EAAE,eAAe;AAC9B;AACAC,EAAAA,KAAK,EAAE;AACT,CAAC;;AAED;AACO,SAASC,qBAAqBA,CAACC,KAAK,EAC3C;EACE,OAAOX,MAAM,CAACY,MAAM,CAACb,mBAAmB,CAAC,CAACc,QAAQ,CAACF,KAAK,CAAC;AAC3D;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CjsSchema } from '@carbonenginejs/runtime-utils/schema';
|
|
2
2
|
import { CjsResource } from './CjsResource.js';
|
|
3
3
|
import { assertResourcePayloadObject } from './resourceBoundary.js';
|
|
4
|
+
import { ResourceRequirement } from './ResourceRequirement.js';
|
|
4
5
|
|
|
5
6
|
// Source: trinity/trinity/Resources/Tr2LightProfileRes.h
|
|
6
7
|
|
|
@@ -21,7 +22,7 @@ class Tr2LightProfileRes extends CjsResource {
|
|
|
21
22
|
super.SetPayload(payload);
|
|
22
23
|
return this;
|
|
23
24
|
}
|
|
24
|
-
static payload =
|
|
25
|
+
static payload = ResourceRequirement.LIGHT_PROFILE;
|
|
25
26
|
}
|
|
26
27
|
CjsSchema.define(Tr2LightProfileRes, {
|
|
27
28
|
className: "Tr2LightProfileRes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2LightProfileRes.js","sources":["../../../src/resource/Tr2LightProfileRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2LightProfileRes.h\nimport { CjsSchema } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"./CjsResource.js\";\nimport { assertResourcePayloadObject } from \"./resourceBoundary.js\";\n\n/**\n * Runtime-owned light-profile resource.\n *\n * The attached plain payload may be richer than the data retained by the\n * resource or active engine adapter.\n */\nexport class Tr2LightProfileRes extends CjsResource\n{\n /** Updates payload in the current resource payload lifecycle. */\n SetPayload(payload = null)\n {\n if (payload === null)\n {\n super.SetPayload(null);\n return this;\n }\n assertResourcePayloadObject(\"Tr2LightProfileRes\", payload);\n super.SetPayload(payload);\n return this;\n }\n\n static payload =
|
|
1
|
+
{"version":3,"file":"Tr2LightProfileRes.js","sources":["../../../src/resource/Tr2LightProfileRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2LightProfileRes.h\nimport { CjsSchema } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsResource } from \"./CjsResource.js\";\nimport { assertResourcePayloadObject } from \"./resourceBoundary.js\";\nimport { ResourceRequirement } from \"./ResourceRequirement.js\";\n\n/**\n * Runtime-owned light-profile resource.\n *\n * The attached plain payload may be richer than the data retained by the\n * resource or active engine adapter.\n */\nexport class Tr2LightProfileRes extends CjsResource\n{\n /** Updates payload in the current resource payload lifecycle. */\n SetPayload(payload = null)\n {\n if (payload === null)\n {\n super.SetPayload(null);\n return this;\n }\n assertResourcePayloadObject(\"Tr2LightProfileRes\", payload);\n super.SetPayload(payload);\n return this;\n }\n\n static payload = ResourceRequirement.LIGHT_PROFILE;\n}\n\nCjsSchema.define(Tr2LightProfileRes, {\n className: \"Tr2LightProfileRes\",\n family: \"resources\"\n});\n"],"names":["Tr2LightProfileRes","CjsResource","SetPayload","payload","assertResourcePayloadObject","ResourceRequirement","LIGHT_PROFILE","CjsSchema","define","className","family"],"mappings":";;;;;AAAA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,SAASC,WAAW,CACnD;AACE;AACAC,EAAAA,UAAUA,CAACC,OAAO,GAAG,IAAI,EACzB;IACE,IAAIA,OAAO,KAAK,IAAI,EACpB;AACE,MAAA,KAAK,CAACD,UAAU,CAAC,IAAI,CAAC;AACtB,MAAA,OAAO,IAAI;AACb,IAAA;AACAE,IAAAA,2BAA2B,CAAC,oBAAoB,EAAED,OAAO,CAAC;AAC1D,IAAA,KAAK,CAACD,UAAU,CAACC,OAAO,CAAC;AACzB,IAAA,OAAO,IAAI;AACb,EAAA;AAEA,EAAA,OAAOA,OAAO,GAAGE,mBAAmB,CAACC,aAAa;AACpD;AAEAC,SAAS,CAACC,MAAM,CAACR,kBAAkB,EAAE;AACnCS,EAAAA,SAAS,EAAE,oBAAoB;AAC/BC,EAAAA,MAAM,EAAE;AACV,CAAC,CAAC;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResourceRequirement } from '../ResourceRequirement.js';
|
|
1
2
|
import { CjsSchema, carbon, impl, type, io } from '@carbonenginejs/runtime-utils/schema';
|
|
2
3
|
import { box3 } from '@carbonenginejs/runtime-utils/box3';
|
|
3
4
|
import { triangleNormalTo } from '@carbonenginejs/runtime-utils/mesh';
|
|
@@ -8,10 +9,6 @@ import { vec4 } from '@carbonenginejs/runtime-utils/vec4';
|
|
|
8
9
|
import { CjsResource } from '../CjsResource.js';
|
|
9
10
|
import { assertResourcePayloadObject, assertResourcePayloadArray, resourcePayloadError, resourceBoundaryError } from '../resourceBoundary.js';
|
|
10
11
|
|
|
11
|
-
// Source: trinity/trinity/Resources/TriGeometryRes.h
|
|
12
|
-
// Source: trinity/trinity/Resources/TriGeometryRes.cpp
|
|
13
|
-
// Source: trinity/trinity/Resources/TriGeometryRes_Blue.cpp
|
|
14
|
-
|
|
15
12
|
/**
|
|
16
13
|
* Resource record that owns geometry payload facts (meshes, optional
|
|
17
14
|
* skeletons and animations) and LOD-force metadata, while engine packages
|
|
@@ -319,7 +316,7 @@ class TriGeometryRes extends CjsResource {
|
|
|
319
316
|
* @returns {object}
|
|
320
317
|
*/
|
|
321
318
|
GetIntersectionPointNormalBone(position, direction) {
|
|
322
|
-
return TriGeometryRes.intersectGeometry(this.
|
|
319
|
+
return TriGeometryRes.intersectGeometry(this.RequireIntersectionMeshes(), position, direction, -1);
|
|
323
320
|
}
|
|
324
321
|
|
|
325
322
|
/**
|
|
@@ -334,7 +331,37 @@ class TriGeometryRes extends CjsResource {
|
|
|
334
331
|
if (!Number.isInteger(areaIndex) || areaIndex < -1) {
|
|
335
332
|
throw new RangeError("TriGeometryRes area index must be -1 or a non-negative integer.");
|
|
336
333
|
}
|
|
337
|
-
return TriGeometryRes.intersectGeometry(this.
|
|
334
|
+
return TriGeometryRes.intersectGeometry(this.RequireIntersectionMeshes(), position, direction, areaIndex);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* The CPU triangle data an intersection query needs, or a loud failure.
|
|
339
|
+
*
|
|
340
|
+
* A ray query used to read `GetPayload()?.meshes`, and `intersectGeometry`
|
|
341
|
+
* loops over `meshes?.length || 0`. So an absent payload produced a clean
|
|
342
|
+
* MISS: `hit: false`, no error, indistinguishable from the ray genuinely
|
|
343
|
+
* passing the object by. Picking would appear to work and simply stop
|
|
344
|
+
* hitting things, and the symptom reads as a maths bug rather than a
|
|
345
|
+
* residency one.
|
|
346
|
+
*
|
|
347
|
+
* Carbon never has to answer this, because it holds the loaded file for the
|
|
348
|
+
* resource's lifetime and its CPU data is always resident. Ours is
|
|
349
|
+
* releasable, so the unavailable case is real and must be named.
|
|
350
|
+
*
|
|
351
|
+
* Throwing is the interim answer, not the final one: once accuracy tiers
|
|
352
|
+
* exist a query degrades to bounds or sphere and reports which produced it.
|
|
353
|
+
* What it must never do again is report absence as a miss. See
|
|
354
|
+
* `/docs/contracts/cpu-geometry-residency.md`.
|
|
355
|
+
*
|
|
356
|
+
* @returns {Array<*>} Canonical CPU meshes.
|
|
357
|
+
* @throws {Error} When the CPU geometry is not resident.
|
|
358
|
+
*/
|
|
359
|
+
RequireIntersectionMeshes() {
|
|
360
|
+
const meshes = this.GetPayload()?.meshes;
|
|
361
|
+
if (!Array.isArray(meshes)) {
|
|
362
|
+
throw new Error("TriGeometryRes cannot answer an intersection query: CPU geometry is " + "not resident. The payload was never loaded or has been released. " + "Reload through CjsResMan before querying.");
|
|
363
|
+
}
|
|
364
|
+
return meshes;
|
|
338
365
|
}
|
|
339
366
|
|
|
340
367
|
/**
|
|
@@ -360,7 +387,7 @@ class TriGeometryRes extends CjsResource {
|
|
|
360
387
|
SaveMesh() {
|
|
361
388
|
throw resourceBoundaryError("TriGeometryRes", "SaveMesh", "Use a geometry format writer with the resource payload and a caller-owned destination.");
|
|
362
389
|
}
|
|
363
|
-
static payload =
|
|
390
|
+
static payload = ResourceRequirement.GEOMETRY;
|
|
364
391
|
|
|
365
392
|
// Carbon TriGeometryRes.cpp:158-178, declared beside the class
|
|
366
393
|
// (TriGeometryRes.h:202) because it reads LOD data rather than resource
|