@carbonenginejs/runtime-resource 0.9.1 → 0.10.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 +3 -2
- package/README.md +47 -6
- package/dist/CjsMotherLode.js +88 -88
- package/dist/CjsMotherLode.js.map +1 -1
- package/dist/CjsResMan.js +718 -229
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManFetchProvider.js +94 -0
- package/dist/CjsResManFetchProvider.js.map +1 -0
- package/dist/{CjsResManQueue.js → CjsResManWorkQueue.js} +112 -25
- package/dist/CjsResManWorkQueue.js.map +1 -0
- package/dist/format/CjsBlueReader.js +91 -2
- package/dist/format/CjsBlueReader.js.map +1 -1
- package/dist/format/CjsFormat.js +47 -21
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsReader.js +4 -0
- package/dist/format/CjsReader.js.map +1 -1
- package/dist/format/CjsResourceProbe.js +4 -2
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +20 -0
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +15 -1
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +103 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +62 -1
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -1
- package/dist/formats/black/core/CjsBlackReader.js +127 -2
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +103 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -1
- package/dist/formats/black/core/helpers.js +17 -0
- package/dist/formats/black/core/helpers.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +8 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +20 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +40 -3
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/soundbanksInfo.js +2 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
- package/dist/formats/cmf/core/binary.js +71 -0
- package/dist/formats/cmf/core/binary.js.map +1 -1
- package/dist/formats/cmf/core/buffers.js +4 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -1
- package/dist/formats/cmf/core/helpers.js +31 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -1
- package/dist/formats/cmf/core/schema.js +10 -0
- package/dist/formats/cmf/core/schema.js.map +1 -1
- package/dist/formats/cmf/core/shared.js +9 -0
- package/dist/formats/cmf/core/shared.js.map +1 -1
- package/dist/formats/cmf/core/writer.js +54 -0
- package/dist/formats/cmf/core/writer.js.map +1 -1
- package/dist/formats/dds/core/bc6h.js +10 -0
- package/dist/formats/dds/core/bc6h.js.map +1 -1
- package/dist/formats/dds/core/bc7.js +16 -0
- package/dist/formats/dds/core/bc7.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +47 -0
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +22 -1
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +49 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +20 -0
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/gif/CjsGifFormat.js +49 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +20 -0
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +18 -3
- package/dist/formats/gltf/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/parser.js +13 -0
- package/dist/formats/gltf/core/parser.js.map +1 -1
- package/dist/formats/gltf/core/targets.js +10 -0
- package/dist/formats/gltf/core/targets.js.map +1 -1
- package/dist/formats/gr2/core/bitknit2.js +2 -0
- package/dist/formats/gr2/core/bitknit2.js.map +1 -1
- package/dist/formats/gr2/core/helpers.js +20 -0
- package/dist/formats/gr2/core/helpers.js.map +1 -1
- package/dist/formats/gr2/core/tangents.js +9 -9
- package/dist/formats/gr2/core/tangents.js.map +1 -1
- package/dist/formats/gr2/core/targets.js +10 -0
- package/dist/formats/gr2/core/targets.js.map +1 -1
- package/dist/formats/index.js +4 -4
- package/dist/formats/jpeg/core/helpers.js +52 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +93 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +37 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +35 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/obj/core/helpers.js +2 -2
- package/dist/formats/obj/core/helpers.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +49 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +23 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/ogg/core/vorbis.js +13 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/formats/png/core/helpers.js +52 -0
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +3 -1
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/red/core/CjsRedReader.js +52 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -1
- package/dist/formats/red/core/helpers.js +19 -0
- package/dist/formats/red/core/helpers.js.map +1 -1
- package/dist/formats/stl/core/stl.js +10 -2
- package/dist/formats/stl/core/stl.js.map +1 -1
- package/dist/formats/stl/core/targets.js +10 -0
- package/dist/formats/stl/core/targets.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +47 -0
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +37 -0
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +35 -0
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +49 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +23 -0
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +8 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/bitStream.js +2 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +20 -0
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/yaml/CjsYamlFormat.js +45 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +91 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +10 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/index.js +57 -44
- package/dist/index.js.map +1 -1
- package/dist/{CjsResource.js → resource/CjsResource.js} +234 -19
- package/dist/resource/CjsResource.js.map +1 -0
- package/dist/{resources → resource}/Tr2LightProfileRes.js +5 -4
- package/dist/resource/Tr2LightProfileRes.js.map +1 -0
- package/dist/{resources → resource/audio}/AudioGeometryResData.js +4 -4
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -0
- package/dist/resource/audio/CjsAudioBufferRes.js +86 -0
- package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -0
- package/dist/resource/audio/CjsAudioRes.js +213 -0
- package/dist/resource/audio/CjsAudioRes.js.map +1 -0
- package/dist/resource/audio/index.js +4 -0
- package/dist/resource/audio/index.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalData.js +3 -3
- package/dist/resource/geometry/MeshDecalData.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalLodData.js +3 -3
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -0
- package/dist/resource/geometry/TriGeometryRes.js +656 -0
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResAreaData.js +4 -4
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResJointData.js +4 -4
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResLodData.js +3 -3
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResMeshData.js +5 -5
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResSkeletonData.js +3 -3
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriJointBinding.js +4 -4
- package/dist/resource/geometry/TriJointBinding.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriMorphTargetGeometryConstants.js +3 -3
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriRtGeometryConstants.js +3 -3
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/GStateBindingCallbackData.js +3 -3
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyIntersectionResult.js +5 -5
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyStateRes.js +7 -6
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/TriGrannyRes.js +7 -6
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/enums.js +1 -9
- package/dist/resource/geometry/granny/enums.js.map +1 -0
- package/dist/resource/geometry/granny/index.js +6 -0
- package/dist/resource/geometry/granny/index.js.map +1 -0
- package/dist/resource/geometry/index.js +17 -0
- package/dist/resource/geometry/index.js.map +1 -0
- package/dist/resource/index.js +52 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource/resourceBoundary.js +64 -0
- package/dist/resource/resourceBoundary.js.map +1 -0
- package/dist/resource/shader/Tr2EffectRes.js +420 -0
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialArea.js +11 -6
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialMesh.js +10 -5
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2MaterialRes.js +12 -6
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -0
- package/dist/resource/shader/Tr2Shader.js +250 -0
- package/dist/resource/shader/Tr2Shader.js.map +1 -0
- package/dist/{resources → resource/shader}/Tr2ShaderPermutation.js +15 -9
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -0
- package/dist/resource/shader/index.js +17 -0
- package/dist/resource/shader/index.js.map +1 -0
- package/dist/resource/shader/portable.js +33 -0
- package/dist/resource/shader/portable.js.map +1 -0
- package/dist/resource/shader/portableValidation.js +461 -0
- package/dist/resource/shader/portableValidation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +100 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +34 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +113 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +141 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +107 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js +90 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +235 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +71 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2Pass.js +111 -0
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +80 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -0
- package/dist/{texture → resource/texture}/CjsTextureArrayRes.js +84 -7
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/{texture/CjsTextureParameterProxy.js → resource/texture/CjsTextureArrayResParameterProxy.js} +57 -11
- package/dist/resource/texture/CjsTextureArrayResParameterProxy.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2ImageRes.js +7 -5
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodManager.js +5 -3
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodUpdateRequest.js +3 -3
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePackChannel.js +3 -3
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipeline.js +8 -6
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineParams.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepCompress.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepGenerateMips.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLimitSize.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLoad.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepPack.js +3 -3
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/{resources → resource/texture}/TriTextureRes.js +43 -27
- package/dist/resource/texture/TriTextureRes.js.map +1 -0
- package/dist/resource/texture/index.js +15 -0
- package/dist/resource/texture/index.js.map +1 -0
- package/dist/{resources → resource/texture}/texturePipelineBehavior.js +61 -61
- package/dist/resource/texture/texturePipelineBehavior.js.map +1 -0
- package/dist/worker/CjsResManMainThreadLoader.js +87 -0
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -0
- package/dist/worker/CjsResManWorker.js +217 -0
- package/dist/worker/CjsResManWorker.js.map +1 -0
- package/dist/worker/CjsResManWorkerLoader.js +434 -0
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -0
- package/dist/worker/protocol.js +12 -0
- package/dist/worker/protocol.js.map +1 -0
- package/docs/README.md +18 -5
- package/docs/architecture.md +40 -17
- package/docs/concepts/resource-lifecycle.md +2 -1
- package/docs/formats/README.md +4 -0
- package/docs/reference/classes/README.md +6 -4
- package/docs/reference/classes/audio.md +30 -0
- package/docs/reference/classes/core.md +31 -11
- package/docs/reference/classes/formats.md +1 -1
- package/docs/reference/classes/resources.md +151 -41
- package/docs/reference/classes/texture.md +7 -7
- package/docs/reference/events.md +1 -1
- package/docs/reference/motherlode-cache.md +17 -0
- package/docs/reference/queues.md +9 -1
- package/docs/reference/workers.md +135 -0
- package/docs/roadmap.md +27 -1
- package/format-notices/black/NOTICE +1 -1
- package/package.json +9 -4
- package/dist/CjsResManQueue.js.map +0 -1
- package/dist/CjsResource.js.map +0 -1
- package/dist/CjsResourceSource.js +0 -68
- package/dist/CjsResourceSource.js.map +0 -1
- package/dist/resourcePath.js +0 -18
- package/dist/resourcePath.js.map +0 -1
- package/dist/resourceStates.js +0 -9
- package/dist/resourceStates.js.map +0 -1
- package/dist/resources/AudioGeometryResData.js.map +0 -1
- package/dist/resources/GStateBindingCallbackData.js.map +0 -1
- package/dist/resources/MeshDecalData.js.map +0 -1
- package/dist/resources/MeshDecalLodData.js.map +0 -1
- package/dist/resources/Tr2EffectRes.js +0 -71
- package/dist/resources/Tr2EffectRes.js.map +0 -1
- package/dist/resources/Tr2GrannyIntersectionResult.js.map +0 -1
- package/dist/resources/Tr2GrannyStateRes.js.map +0 -1
- package/dist/resources/Tr2ImageRes.js.map +0 -1
- package/dist/resources/Tr2LightProfileRes.js.map +0 -1
- package/dist/resources/Tr2MaterialArea.js.map +0 -1
- package/dist/resources/Tr2MaterialMesh.js.map +0 -1
- package/dist/resources/Tr2MaterialRes.js.map +0 -1
- package/dist/resources/Tr2ShaderPermutation.js.map +0 -1
- package/dist/resources/Tr2TextureLodManager.js.map +0 -1
- package/dist/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
- package/dist/resources/Tr2TexturePackChannel.js.map +0 -1
- package/dist/resources/Tr2TexturePipeline.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineParams.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepGenerateMips.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepPack.js.map +0 -1
- package/dist/resources/TriGeometryRes.js +0 -239
- package/dist/resources/TriGeometryRes.js.map +0 -1
- package/dist/resources/TriGeometryResAreaData.js.map +0 -1
- package/dist/resources/TriGeometryResJointData.js.map +0 -1
- package/dist/resources/TriGeometryResLodData.js.map +0 -1
- package/dist/resources/TriGeometryResMeshData.js.map +0 -1
- package/dist/resources/TriGeometryResSkeletonData.js.map +0 -1
- package/dist/resources/TriGrannyRes.js.map +0 -1
- package/dist/resources/TriJointBinding.js.map +0 -1
- package/dist/resources/TriMorphTargetGeometryConstants.js.map +0 -1
- package/dist/resources/TriRtGeometryConstants.js.map +0 -1
- package/dist/resources/TriTextureRes.js.map +0 -1
- package/dist/resources/enums.js.map +0 -1
- package/dist/resources/resourceBoundary.js +0 -47
- package/dist/resources/resourceBoundary.js.map +0 -1
- package/dist/resources/texturePipelineBehavior.js.map +0 -1
- package/dist/texture/CjsTextureArrayRes.js.map +0 -1
- package/dist/texture/CjsTextureParameterProxy.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '
|
|
2
|
-
import { CjsEventEmitter } from '@carbonenginejs/
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { CjsEventEmitter } from '@carbonenginejs/runtime-utils/model';
|
|
3
|
+
import { normalizeResourcePath, normalizeResourceExtension, getResourceExtension } from '@carbonenginejs/runtime-utils/path';
|
|
4
|
+
import { type, carbon, impl, CjsSchema } from '@carbonenginejs/runtime-utils/schema';
|
|
5
5
|
|
|
6
6
|
let _initProto, _initClass, _init_path, _init_extra_path, _init_ext, _init_extra_ext, _init_requirement, _init_extra_requirement, _init_state, _init_extra_state;
|
|
7
7
|
|
|
@@ -14,8 +14,10 @@ let _initProto, _initClass, _init_path, _init_extra_path, _init_ext, _init_extra
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Manager-owned callbacks attached while a resource has canonical ownership
|
|
18
|
-
* The controller
|
|
17
|
+
* Manager-owned callbacks attached while a resource has canonical ownership,
|
|
18
|
+
* and detached the moment it ends. The controller carries no load, fetch, or
|
|
19
|
+
* prepare hook; recovery lives in the separate reload hook, which deliberately
|
|
20
|
+
* outlives ownership because losing ownership is exactly when it is needed.
|
|
19
21
|
*
|
|
20
22
|
* @typedef {object} CjsResourceLifecycleController
|
|
21
23
|
* @property {Function} [isCurrent] Tests exact canonical manager ownership without renewing activity.
|
|
@@ -37,12 +39,34 @@ new class extends _identity {
|
|
|
37
39
|
})], [[[type, type.path], 16, "path"], [[type, type.string], 16, "ext"], [[type, type.string], 16, "requirement"], [[type, type.string], 16, "state"], [[carbon, carbon.method, impl, impl.adapted], 18, "Initialize"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetPath"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetExt"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsLoading"], [[carbon, carbon.method, impl, impl.adapted], 18, "HasLoaded"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsPrepared"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsGood"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsFailed"]], 0, void 0, CjsEventEmitter));
|
|
38
40
|
}
|
|
39
41
|
#payload = (_initProto(this), null);
|
|
42
|
+
|
|
43
|
+
/** Reloads attempted since the last successful load. */
|
|
44
|
+
#reloadAttempts = 0;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* How many times a purged or failed resource reloads itself before giving up.
|
|
48
|
+
*
|
|
49
|
+
* Per class so a subclass can be more or less patient. Counted per resource
|
|
50
|
+
* and reset on every successful load, so this bounds consecutive failures,
|
|
51
|
+
* not the lifetime total.
|
|
52
|
+
*/
|
|
53
|
+
|
|
40
54
|
path = _init_path(this, "");
|
|
41
55
|
ext = (_init_extra_path(this), _init_ext(this, ""));
|
|
42
56
|
requirement = (_init_extra_ext(this), _init_requirement(this, ""));
|
|
43
57
|
state = (_init_extra_requirement(this), _init_state(this, _CjsResource.State.EMPTY));
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Identifies this class as a runtime resource.
|
|
61
|
+
*
|
|
62
|
+
* Static, so a schema field declared as `@type.objectRef("TriGeometryRes")`
|
|
63
|
+
* can be known to hold a resource without an instance existing - the
|
|
64
|
+
* declaration alone is enough, resolved through `CjsSchema.GetConstructor`.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/** Identifies this handle as a runtime resource. */
|
|
44
68
|
get isResource() {
|
|
45
|
-
return true;
|
|
69
|
+
return this.constructor.isResource === true;
|
|
46
70
|
}
|
|
47
71
|
|
|
48
72
|
/**
|
|
@@ -78,6 +102,12 @@ new class extends _identity {
|
|
|
78
102
|
configurable: true,
|
|
79
103
|
writable: true
|
|
80
104
|
});
|
|
105
|
+
Object.defineProperty(this, "__reloadHook", {
|
|
106
|
+
value: null,
|
|
107
|
+
enumerable: false,
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true
|
|
110
|
+
});
|
|
81
111
|
if (values) {
|
|
82
112
|
this.SetValues(values);
|
|
83
113
|
}
|
|
@@ -124,7 +154,7 @@ new class extends _identity {
|
|
|
124
154
|
*/
|
|
125
155
|
Initialize(path, ext = null, requirement = "") {
|
|
126
156
|
this.path = normalizeResourcePath(path);
|
|
127
|
-
this.ext = ext ?
|
|
157
|
+
this.ext = ext ? normalizeResourceExtension(ext) : getResourceExtension(this.path);
|
|
128
158
|
this.requirement = requirement === null || requirement === undefined ? "" : String(requirement).trim().toLowerCase();
|
|
129
159
|
this.state = _CjsResource.State.EMPTY;
|
|
130
160
|
this.error = null;
|
|
@@ -187,11 +217,35 @@ new class extends _identity {
|
|
|
187
217
|
}
|
|
188
218
|
|
|
189
219
|
/**
|
|
190
|
-
* Return true when
|
|
220
|
+
* Return true when this resource finished trying to load, either way.
|
|
221
|
+
*
|
|
222
|
+
* The pull form of the `completed` event. Carbon expresses this as a
|
|
223
|
+
* predicate because it has no events - `m_isPrepared` is set on the failure
|
|
224
|
+
* path too (`BlueAsyncRes.cpp:183`) - so `IsPrepared()` there means "finished
|
|
225
|
+
* trying" while ours keeps the narrower "succeeded".
|
|
226
|
+
*
|
|
227
|
+
* `PURGED` is not completion: nothing was tried and nothing concluded, the
|
|
228
|
+
* payload was simply taken away.
|
|
229
|
+
*
|
|
230
|
+
* @returns {boolean}
|
|
231
|
+
*/
|
|
232
|
+
HasCompleted() {
|
|
233
|
+
return this.state === _CjsResource.State.PREPARED || this.state === _CjsResource.State.FAILED;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Return true when preparation completed successfully, and renew this
|
|
238
|
+
* resource.
|
|
239
|
+
*
|
|
240
|
+
* Every caller of `IsGood()` is about to use the resource, so renewal always
|
|
241
|
+
* follows the query. Merging them - as ccpwgl does in `Tw2Resource.js:108` -
|
|
242
|
+
* closes that gap permanently instead of relying on call-site discipline, and
|
|
243
|
+
* means a purged resource reloads itself the moment anything asks for it.
|
|
191
244
|
*
|
|
192
245
|
* @returns {boolean}
|
|
193
246
|
*/
|
|
194
247
|
IsGood() {
|
|
248
|
+
this.KeepAlive();
|
|
195
249
|
return this.IsPrepared();
|
|
196
250
|
}
|
|
197
251
|
|
|
@@ -203,32 +257,91 @@ new class extends _identity {
|
|
|
203
257
|
IsFailed() {
|
|
204
258
|
return this.state === _CjsResource.State.FAILED;
|
|
205
259
|
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Changes state and emits the state-specific, statechange, and - on reaching
|
|
263
|
+
* a load outcome - completed events.
|
|
264
|
+
*/
|
|
206
265
|
SetState(state, ...details) {
|
|
207
|
-
if (!_CjsResource.
|
|
266
|
+
if (!_CjsResource.isValidState(state)) {
|
|
208
267
|
throw new TypeError(`Invalid CjsResource state: ${state}`);
|
|
209
268
|
}
|
|
210
269
|
const previous = this.state;
|
|
211
270
|
if (previous === state) return this;
|
|
212
271
|
this.state = state;
|
|
272
|
+
// A successful load clears the budget, so the cap bounds consecutive
|
|
273
|
+
// failures rather than how many times a resource may ever be purged.
|
|
274
|
+
if (state === _CjsResource.State.PREPARED) this.#reloadAttempts = 0;
|
|
213
275
|
this.EmitEvent?.(state, this, ...details);
|
|
214
276
|
this.EmitEvent?.("statechange", this, state, previous);
|
|
277
|
+
// Fires again after a purge and reload, so subscribers rebuild whatever
|
|
278
|
+
// they derived from the payload that was deleted.
|
|
279
|
+
if (this.HasCompleted()) this.EmitEvent?.("completed", this, ...details);
|
|
215
280
|
return this;
|
|
216
281
|
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Subscribe to this resource finishing, firing immediately when it already
|
|
285
|
+
* has.
|
|
286
|
+
*
|
|
287
|
+
* The immediate call is the point. A plain emitter drops late subscribers on
|
|
288
|
+
* the floor - subscribe after `PREPARED` and nothing ever arrives - which is
|
|
289
|
+
* why callers end up doing work synchronously "just in case" instead of
|
|
290
|
+
* subscribing. ccpwgl solves this by replaying current state at registration
|
|
291
|
+
* (`Tw2Resource.onNotification`), and a subscriber satisfied that way is
|
|
292
|
+
* never stored at all, so only subscriptions genuinely still waiting
|
|
293
|
+
* accumulate.
|
|
294
|
+
*
|
|
295
|
+
* The listener runs for both outcomes and branches itself:
|
|
296
|
+
*
|
|
297
|
+
* ```js
|
|
298
|
+
* res.OnCompleted(res => { if (res.IsPrepared()) something; else somethingElse; });
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* It may run more than once - a purge and reload completes again - so
|
|
302
|
+
* handlers must be written to be re-entered rather than assuming first load.
|
|
303
|
+
*
|
|
304
|
+
* @param {Function} listener Called with this resource once it has finished.
|
|
305
|
+
* @param {*} [source=null] Optional owner used for bulk removal.
|
|
306
|
+
* @returns {CjsResource} This resource.
|
|
307
|
+
*/
|
|
308
|
+
OnCompleted(listener, source = null) {
|
|
309
|
+
if (typeof listener !== "function") {
|
|
310
|
+
throw new TypeError("CjsResource.OnCompleted requires a function.");
|
|
311
|
+
}
|
|
312
|
+
if (this.HasCompleted()) {
|
|
313
|
+
listener(this);
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
return this.OnEvent("completed", listener, source);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Marks this resource as requested. */
|
|
217
320
|
MarkRequested() {
|
|
218
321
|
return this.SetState(_CjsResource.State.REQUESTED);
|
|
219
322
|
}
|
|
323
|
+
|
|
324
|
+
/** Marks this resource as actively loading. */
|
|
220
325
|
MarkLoading() {
|
|
221
326
|
return this.SetState(_CjsResource.State.LOADING);
|
|
222
327
|
}
|
|
328
|
+
|
|
329
|
+
/** Marks this resource's CPU payload as loaded. */
|
|
223
330
|
MarkLoaded() {
|
|
224
331
|
return this.SetState(_CjsResource.State.LOADED);
|
|
225
332
|
}
|
|
333
|
+
|
|
334
|
+
/** Marks this resource as preparing its semantic result. */
|
|
226
335
|
MarkPreparing() {
|
|
227
336
|
return this.SetState(_CjsResource.State.PREPARING);
|
|
228
337
|
}
|
|
338
|
+
|
|
339
|
+
/** Marks this resource as successfully prepared. */
|
|
229
340
|
MarkPrepared() {
|
|
230
341
|
return this.SetState(_CjsResource.State.PREPARED);
|
|
231
342
|
}
|
|
343
|
+
|
|
344
|
+
/** Marks this resource as successfully prepared. */
|
|
232
345
|
MarkGood() {
|
|
233
346
|
return this.MarkPrepared();
|
|
234
347
|
}
|
|
@@ -253,6 +366,8 @@ new class extends _identity {
|
|
|
253
366
|
IsPurged() {
|
|
254
367
|
return this.state === _CjsResource.State.PURGED;
|
|
255
368
|
}
|
|
369
|
+
|
|
370
|
+
/** Stores a load failure and marks this resource as failed. */
|
|
256
371
|
SetError(error) {
|
|
257
372
|
this.error = error || null;
|
|
258
373
|
return this.SetState(_CjsResource.State.FAILED, this.error);
|
|
@@ -351,10 +466,15 @@ new class extends _identity {
|
|
|
351
466
|
}
|
|
352
467
|
|
|
353
468
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
469
|
+
* Renew this resource's canonical identity activity, and reload it when
|
|
470
|
+
* it has been purged.
|
|
471
|
+
*
|
|
472
|
+
* Purge is deletion - the payload is gone and nothing restores it - so
|
|
473
|
+
* revival is an ordinary reload along the first-load path. Consumers
|
|
474
|
+
* therefore never have to know a purge happened: they ask for what they need
|
|
475
|
+
* and this makes it be there.
|
|
476
|
+
*
|
|
477
|
+
* `IsGood()` calls this, so most callers never invoke it directly.
|
|
358
478
|
*
|
|
359
479
|
* @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.
|
|
360
480
|
* @returns {CjsResource} This resource, whether bound or detached.
|
|
@@ -362,6 +482,86 @@ new class extends _identity {
|
|
|
362
482
|
*/
|
|
363
483
|
KeepAlive(options = {}) {
|
|
364
484
|
this.__lifecycleController?.keepAlive?.(options);
|
|
485
|
+
if (this.IsPurged()) this.Reload(options);
|
|
486
|
+
return this;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Re-register this handle with its manager and reload it into itself.
|
|
491
|
+
*
|
|
492
|
+
* Runs only from `PURGED` or `FAILED` - the two states where the payload is
|
|
493
|
+
* absent but recoverable. It does nothing to a resource that is loaded or
|
|
494
|
+
* still loading, so it is not a way to force a refetch of something already
|
|
495
|
+
* there.
|
|
496
|
+
*
|
|
497
|
+
* Bounded by `maxReloadAttempts`, because `KeepAlive()` calls this and the
|
|
498
|
+
* render path calls that every frame: without a cap, one missing texture
|
|
499
|
+
* becomes a permanent retry storm against the thing least likely to succeed.
|
|
500
|
+
* Attempts are spaced by real load round-trips rather than frames - starting
|
|
501
|
+
* one leaves `PURGED`/`FAILED`, so nothing re-enters until it settles - and
|
|
502
|
+
* the count resets on any successful load.
|
|
503
|
+
*
|
|
504
|
+
* The distinction that matters: the reload must fill THIS handle, not resolve
|
|
505
|
+
* whatever the manager currently caches for the same path. A consumer holding
|
|
506
|
+
* a purged handle has no way to discover a replacement, so handing it a fresh
|
|
507
|
+
* instance elsewhere leaves it dead forever.
|
|
508
|
+
*
|
|
509
|
+
* Detached handles have no manager to re-register with and stay as they are.
|
|
510
|
+
*
|
|
511
|
+
* @param {CjsResourceActivityOptions} [options={}] Optional deterministic activity values.
|
|
512
|
+
* @returns {boolean} Whether a reload was started.
|
|
513
|
+
*/
|
|
514
|
+
Reload(options = {}) {
|
|
515
|
+
if (!this.IsPurged() && !this.IsFailed()) return false;
|
|
516
|
+
if (this.#reloadAttempts >= this.constructor.maxReloadAttempts) return false;
|
|
517
|
+
if (typeof this.__reloadHook !== "function") return false;
|
|
518
|
+
this.#reloadAttempts += 1;
|
|
519
|
+
return this.__reloadHook(options) !== false;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Bind the manager callback that restores this handle after it loses its
|
|
524
|
+
* payload.
|
|
525
|
+
*
|
|
526
|
+
* Deliberately separate from the lifecycle controller, which is detached the
|
|
527
|
+
* moment canonical ownership ends. Recovery has to survive exactly that
|
|
528
|
+
* event: a purged handle with no route back to its manager is unrecoverable,
|
|
529
|
+
* which is the failure this whole contract exists to prevent.
|
|
530
|
+
*
|
|
531
|
+
* @param {Function|null} hook Manager callback, or `null` to detach it.
|
|
532
|
+
* @returns {CjsResource} This resource.
|
|
533
|
+
* @throws {TypeError} If the hook is neither a function nor null.
|
|
534
|
+
*/
|
|
535
|
+
SetReloadHook(hook = null) {
|
|
536
|
+
if (hook !== null && typeof hook !== "function") {
|
|
537
|
+
throw new TypeError("CjsResource.SetReloadHook requires a function or null.");
|
|
538
|
+
}
|
|
539
|
+
this.__reloadHook = hook;
|
|
540
|
+
return this;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Return how many reloads have been attempted since the last successful load.
|
|
545
|
+
*
|
|
546
|
+
* @returns {number}
|
|
547
|
+
*/
|
|
548
|
+
GetReloadAttempts() {
|
|
549
|
+
return this.#reloadAttempts;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Clear the reload attempt count, so a resource that exhausted its attempts
|
|
554
|
+
* can be asked again.
|
|
555
|
+
*
|
|
556
|
+
* This is the deliberate "try it again" gesture - a user retrying a failed
|
|
557
|
+
* load, say. It is separate from `Reload()` because the cap exists precisely
|
|
558
|
+
* to stop the automatic path retrying forever, so lifting it has to be a
|
|
559
|
+
* decision someone made.
|
|
560
|
+
*
|
|
561
|
+
* @returns {CjsResource} This resource.
|
|
562
|
+
*/
|
|
563
|
+
ResetReloadAttempts() {
|
|
564
|
+
this.#reloadAttempts = 0;
|
|
365
565
|
return this;
|
|
366
566
|
}
|
|
367
567
|
|
|
@@ -440,8 +640,9 @@ new class extends _identity {
|
|
|
440
640
|
* Concurrent callers share one in-flight operation. A resident payload is
|
|
441
641
|
* returned without source work; after explicit payload release, this call is
|
|
442
642
|
* an explicit reconstruction request and may load/prepare through the bound
|
|
443
|
-
* manager.
|
|
444
|
-
*
|
|
643
|
+
* manager. This loader resolves the manager's current canonical identity, so
|
|
644
|
+
* on a purged handle it may answer with a different instance - use
|
|
645
|
+
* `KeepAlive()`/`Reload()` to revive this handle itself.
|
|
445
646
|
*
|
|
446
647
|
* Promised-output fields retained by the handle take precedence over fields
|
|
447
648
|
* supplied here; operation policy such as cache/reload controls may still be
|
|
@@ -517,7 +718,7 @@ new class extends _identity {
|
|
|
517
718
|
const name = String(key);
|
|
518
719
|
const value = this.__adapterResources[name];
|
|
519
720
|
if (value && options.destroy !== false) {
|
|
520
|
-
|
|
721
|
+
destroyAdapterValue(value);
|
|
521
722
|
}
|
|
522
723
|
delete this.__adapterResources[name];
|
|
523
724
|
return this;
|
|
@@ -535,10 +736,24 @@ new class extends _identity {
|
|
|
535
736
|
}
|
|
536
737
|
return this;
|
|
537
738
|
}
|
|
538
|
-
|
|
739
|
+
/** Returns true when a value belongs to the resource state vocabulary. */
|
|
740
|
+
static isValidState(state) {
|
|
539
741
|
return Object.values(_CjsResource.State).includes(state);
|
|
540
742
|
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Returns true when a resource state cannot continue its current operation.
|
|
746
|
+
*
|
|
747
|
+
* `PURGED` is deliberately absent: a purged resource reloads itself
|
|
748
|
+
* through `KeepAlive()`, so purge is a transition out of a settled state
|
|
749
|
+
* rather than a resting place.
|
|
750
|
+
*/
|
|
751
|
+
static isTerminalState(state) {
|
|
752
|
+
return state === _CjsResource.State.PREPARED || state === _CjsResource.State.FAILED || state === _CjsResource.State.UNLOADED;
|
|
753
|
+
}
|
|
541
754
|
}];
|
|
755
|
+
maxReloadAttempts = 3;
|
|
756
|
+
isResource = true;
|
|
542
757
|
State = Object.freeze({
|
|
543
758
|
EMPTY: "empty",
|
|
544
759
|
REQUESTED: "requested",
|
|
@@ -554,7 +769,7 @@ new class extends _identity {
|
|
|
554
769
|
super(_CjsResource), _initClass();
|
|
555
770
|
}
|
|
556
771
|
}();
|
|
557
|
-
function
|
|
772
|
+
function destroyAdapterValue(value) {
|
|
558
773
|
if (!value || typeof value !== "object") return;
|
|
559
774
|
const destroy = value.Destroy || value.Dispose || value.destroy || value.dispose;
|
|
560
775
|
if (typeof destroy === "function") {
|
|
@@ -0,0 +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\";\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@type.define({ className: \"CjsResource\", family: \"resource\" })\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 @type.path\n path = \"\";\n\n @type.string\n ext = \"\";\n\n @type.string\n requirement = \"\";\n\n @type.string\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 /** 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 @carbon.method\n @impl.adapted\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 @carbon.method\n @impl.adapted\n GetPath() {\n return this.path;\n }\n\n /**\n * Get the normalized resource extension.\n *\n * @returns {string}\n */\n @carbon.method\n @impl.adapted\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 @carbon.method\n @impl.adapted\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 @carbon.method\n @impl.adapted\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 @carbon.method\n @impl.adapted\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 @carbon.method\n @impl.adapted\n IsGood() {\n this.KeepAlive();\n return this.IsPrepared();\n }\n\n /**\n * Return true when preparation failed.\n *\n * @returns {boolean}\n */\n @carbon.method\n @impl.adapted\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\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","_identity","CjsResource","CjsEventEmitter","e","_init_path","_init_extra_path","_init_ext","_init_extra_ext","_init_requirement","_init_extra_requirement","_init_state","_init_extra_state","_initProto","c","_initClass","_applyDecs","type","define","className","family","path","string","carbon","method","impl","adapted","ext","requirement","state","State","EMPTY","isResource","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","maxReloadAttempts","__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","includes","isTerminalState","UNLOADED","Destroy","Dispose","dispose"],"mappings":";;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AAC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|
|
|
1
1
|
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { type } from '@carbonenginejs/
|
|
3
|
-
import { CjsResource as _CjsResource } from '
|
|
4
|
-
import {
|
|
2
|
+
import { type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsResource as _CjsResource } from './CjsResource.js';
|
|
4
|
+
import { assertResourcePayloadObject } from './resourceBoundary.js';
|
|
5
5
|
|
|
6
6
|
let _initClass;
|
|
7
7
|
|
|
@@ -20,12 +20,13 @@ new class extends _identity {
|
|
|
20
20
|
family: "resources"
|
|
21
21
|
})], [], 0, void 0, _CjsResource).c;
|
|
22
22
|
}
|
|
23
|
+
/** Updates payload in the current resource payload lifecycle. */
|
|
23
24
|
SetPayload(payload = null) {
|
|
24
25
|
if (payload === null) {
|
|
25
26
|
super.SetPayload(null);
|
|
26
27
|
return this;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
assertResourcePayloadObject("Tr2LightProfileRes", payload);
|
|
29
30
|
super.SetPayload(payload);
|
|
30
31
|
return this;
|
|
31
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2LightProfileRes.js","sources":["../../../src/resource/Tr2LightProfileRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2LightProfileRes.h\nimport { type } 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 */\n@type.define({ className: \"Tr2LightProfileRes\", family: \"resources\" })\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 = \"light-profile\";\n}\n"],"names":["_Tr2LightProfileRes","_identity","Tr2LightProfileRes","CjsResource","_initClass","_applyDecs","type","define","className","family","c","SetPayload","payload","assertResourcePayloadObject","constructor"],"mappings":";;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AALA,IAAAA;AAAA,IAAA,cAAAC,SAAA,CAAA;AAAA,EAAA,QAMA,MAAAC,kBAAA,SACwCC,YAAW,CACnD;AAAA,IAAA;MAAA,CAAAH,mBAAA,EAAAI,UAAA,CAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,QAAAA,SAAS,EAAE,oBAAoB;AAAEC,QAAAA,MAAM,EAAE;AAAY,OAAC,CAAC,CAAA,EAAA,EAAA,EAAA,CAAA,EAAA,MAAA,EAC9BN,YAAW,CAAA,CAAAO,CAAA;AAAA;AAEjD;AACAC,IAAAA,UAAUA,CAACC,OAAO,GAAG,IAAI,EACzB;MACE,IAAIA,OAAO,KAAK,IAAI,EACpB;AACE,QAAA,KAAK,CAACD,UAAU,CAAC,IAAI,CAAC;AACtB,QAAA,OAAO,IAAI;AACb,MAAA;AACAE,MAAAA,2BAA2B,CAAC,oBAAoB,EAAED,OAAO,CAAC;AAC1D,MAAA,KAAK,CAACD,UAAU,CAACC,OAAO,CAAC;AACzB,MAAA,OAAO,IAAI;AACb,IAAA;GAGD;AADQA,EAAAA,OAAO,GAAG,eAAe;EAACE,WAAAA,GAAA;IAAA,KAAA,CAAAd,mBAAA,GAAAI,UAAA,EAAA;AAAA,EAAA;AAAA,CAAA,EAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { applyDecs2311 as _applyDecs2311 } from '
|
|
2
|
-
import { type } from '@carbonenginejs/
|
|
3
|
-
import { CjsModel } from '@carbonenginejs/
|
|
4
|
-
import { vec3 } from '@carbonenginejs/
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
import { vec3 } from '@carbonenginejs/runtime-utils/vec3';
|
|
5
5
|
|
|
6
6
|
let _initClass, _init_id, _init_extra_id, _init_vertices, _init_extra_vertices, _init_indices, _init_extra_indices, _init_minBounds, _init_extra_minBounds, _init_maxBounds, _init_extra_maxBounds, _init_s_nextId, _init_extra_s_nextId;
|
|
7
7
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioGeometryResData.js","sources":["../../../../src/resource/audio/AudioGeometryResData.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriGeometryRes.h\r\n// Schema: format-carbon resources/AudioGeometryResData.json; maintained by runtime-resource.\r\nimport { type } from \"@carbonenginejs/runtime-utils/schema\";\r\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\r\nimport { vec3 } from \"@carbonenginejs/runtime-utils/vec3\";\r\n\r\n/** AudioGeometryResData (resources) - maintained from schema shapeHash 89e7ddb7.... */\r\n@type.define({ className: \"AudioGeometryResData\", family: \"resources\" })\r\nexport class AudioGeometryResData extends CjsModel\r\n{\r\n\r\n /** m_id (uint64_t) */\r\n @type.uint64\r\n id = 0;\r\n\r\n /** m_vertices (std::vector<Vector3>) */\r\n @type.list(\"Vector3\")\r\n vertices = [];\r\n\r\n /** m_indices (std::vector<uint32_t>) */\r\n @type.list(\"uint32_t\")\r\n indices = [];\r\n\r\n /** m_minBounds (Vector3) */\r\n @type.vec3\r\n minBounds = vec3.create();\r\n\r\n /** m_maxBounds (Vector3) */\r\n @type.vec3\r\n maxBounds = vec3.create();\r\n\r\n /** s_nextId (static std::atomic<uint64_t>) */\r\n @type.rawStruct(\"static std::atomic<uint64_t>\")\r\n s_nextId = null;\r\n\r\n}\r\n"],"names":["_AudioGeometryResData","AudioGeometryResData","CjsModel","e","_init_id","_init_extra_id","_init_vertices","_init_extra_vertices","_init_indices","_init_extra_indices","_init_minBounds","_init_extra_minBounds","_init_maxBounds","_init_extra_maxBounds","_init_s_nextId","_init_extra_s_nextId","c","_initClass","_applyDecs","type","define","className","family","uint64","list","vec3","rawStruct","constructor","args","id","vertices","indices","minBounds","create","maxBounds","s_nextId"],"mappings":";;;;;;;AAMA;AAAA,IAAAA;AACA,MAAAC,oBAAA,SAC0CC,QAAQ,CAClD;AAAA,EAAA;AAAA,IAAA,CAAA;MAAAC,CAAA,EAAA,CAAAC,QAAA,EAAAC,cAAA,EAAAC,cAAA,EAAAC,oBAAA,EAAAC,aAAA,EAAAC,mBAAA,EAAAC,eAAA,EAAAC,qBAAA,EAAAC,eAAA,EAAAC,qBAAA,EAAAC,cAAA,EAAAC,oBAAA,CAAA;MAAAC,CAAA,EAAA,CAAAhB,qBAAA,EAAAiB,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,sBAAsB;AAAEC,MAAAA,MAAM,EAAE;AAAY,KAAC,CAAC,CAAA,EAAA,CAAA,CAAA,CAKrEH,IAAI,EAAJA,IAAI,CAACI,MAAM,CAAA,EAAA,EAAA,EAAA,IAAA,CAAA,EAAA,CAIXJ,IAAI,CAACK,IAAI,CAAC,SAAS,CAAC,mBAIpBL,IAAI,CAACK,IAAI,CAAC,UAAU,CAAC,EAAA,CAAA,EAAA,SAAA,CAAA,EAAA,CAAA,CAIrBL,IAAI,EAAJA,IAAI,CAACM,IAAI,CAAA,EAAA,EAAA,EAAA,WAAA,CAAA,EAAA,CAAA,CAITN,IAAI,EAAJA,IAAI,CAACM,IAAI,CAAA,EAAA,EAAA,EAAA,WAAA,CAAA,EAAA,CAITN,IAAI,CAACO,SAAS,CAAC,8BAA8B,CAAC,8BAxBPxB,QAAQ,CAAA;AAAA;AAAAyB,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAb,oBAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAGhD;EAEAc,EAAE,GAAAzB,QAAA,CAAA,IAAA,EAAG,CAAC,CAAA;;AAEN;AAEA0B,EAAAA,QAAQ,IAAAzB,cAAA,CAAA,IAAA,CAAA,EAAAC,cAAA,OAAG,EAAE,CAAA;;AAEb;AAEAyB,EAAAA,OAAO,IAAAxB,oBAAA,CAAA,IAAA,CAAA,EAAAC,aAAA,OAAG,EAAE,CAAA;;AAEZ;EAEAwB,SAAS,IAAAvB,mBAAA,CAAA,IAAA,CAAA,EAAAC,eAAA,OAAGe,IAAI,CAACQ,MAAM,EAAE,CAAA;;AAEzB;EAEAC,SAAS,IAAAvB,qBAAA,CAAA,IAAA,CAAA,EAAAC,eAAA,OAAGa,IAAI,CAACQ,MAAM,EAAE,CAAA;;AAEzB;AAEAE,EAAAA,QAAQ,IAAAtB,qBAAA,CAAA,IAAA,CAAA,EAAAC,cAAA,OAAG,IAAI,CAAA;AAAC,EAAA;IAAAG,UAAA,EAAA;AAAA;AAElB;;;;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { CjsError } from '@carbonenginejs/runtime-utils/errors';
|
|
2
|
+
import { CjsResource as _CjsResource } from '../CjsResource.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Physical audio byte-owner resource whose payload may back one complete file or several logical audio files.
|
|
6
|
+
*
|
|
7
|
+
* CjsResMan owns loading, canonical identity, and payload retention. This
|
|
8
|
+
* class only exposes the loaded payload as bytes without interpreting BNK or
|
|
9
|
+
* media semantics.
|
|
10
|
+
*/
|
|
11
|
+
class CjsAudioBufferRes extends _CjsResource {
|
|
12
|
+
#audioInfo = Object.freeze({});
|
|
13
|
+
|
|
14
|
+
/** Creates an unregistered physical audio resource with optional metadata. */
|
|
15
|
+
constructor(values = null) {
|
|
16
|
+
super();
|
|
17
|
+
this.SetAudioInfo(values);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Replaces immutable physical-source metadata before the resource loads. */
|
|
21
|
+
SetAudioInfo(values = null) {
|
|
22
|
+
if (values === null || values === undefined) {
|
|
23
|
+
this.#audioInfo = Object.freeze({});
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
if (!values || typeof values !== "object" || Array.isArray(values)) {
|
|
27
|
+
throw new TypeError("CjsAudioBufferRes info must be an object");
|
|
28
|
+
}
|
|
29
|
+
this.#audioInfo = Object.freeze({
|
|
30
|
+
...values
|
|
31
|
+
});
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Returns immutable physical-source metadata supplied by an audio library. */
|
|
36
|
+
GetAudioInfo() {
|
|
37
|
+
return this.#audioInfo;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns a view of the manager-owned payload while the caller holds a lock.
|
|
42
|
+
*
|
|
43
|
+
* The returned view may retain a complete bank buffer. Public media reads
|
|
44
|
+
* should use CjsAudioRes.GetBytes(), which copies only the requested window.
|
|
45
|
+
*/
|
|
46
|
+
async GetByteView(options = {}) {
|
|
47
|
+
await super.GetObject(options);
|
|
48
|
+
this.KeepPayloadAlive();
|
|
49
|
+
return CjsAudioBufferRes.toUint8Array(this.GetPayload(), this.GetPath());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Returns a detached copy of the complete physical source. */
|
|
53
|
+
async GetBytes(options = {}) {
|
|
54
|
+
this.Lock();
|
|
55
|
+
try {
|
|
56
|
+
const view = await this.GetByteView(options);
|
|
57
|
+
return view.slice().buffer;
|
|
58
|
+
} finally {
|
|
59
|
+
this.Unlock();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Extracts bytes from raw reader payloads used by registered audio formats. */
|
|
64
|
+
static toUint8Array(value, path = "") {
|
|
65
|
+
if (value instanceof Uint8Array) {
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
if (value instanceof ArrayBuffer) {
|
|
69
|
+
return new Uint8Array(value);
|
|
70
|
+
}
|
|
71
|
+
if (ArrayBuffer.isView(value)) {
|
|
72
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
73
|
+
}
|
|
74
|
+
if (value && typeof value === "object" && "bytes" in value) {
|
|
75
|
+
return this.toUint8Array(value.bytes, path);
|
|
76
|
+
}
|
|
77
|
+
throw new CjsError("CJS_AUDIO_BYTES_UNAVAILABLE", `Audio resource did not produce bytes: ${path}`, {
|
|
78
|
+
details: {
|
|
79
|
+
path: String(path ?? "")
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { CjsAudioBufferRes };
|
|
86
|
+
//# sourceMappingURL=CjsAudioBufferRes.js.map
|