@carbonenginejs/runtime-resource 0.1.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/FORMAT-PROVENANCE.md +135 -0
- package/LICENSE +21 -0
- package/NOTICE +29 -0
- package/README.md +241 -0
- package/dist/CjsMotherLode.js +56 -0
- package/dist/CjsMotherLode.js.map +1 -0
- package/dist/CjsResMan.js +740 -0
- package/dist/CjsResMan.js.map +1 -0
- package/dist/CjsResManQueue.js +214 -0
- package/dist/CjsResManQueue.js.map +1 -0
- package/dist/CjsResource.js +366 -0
- package/dist/CjsResource.js.map +1 -0
- package/dist/CjsResourceSource.js +59 -0
- package/dist/CjsResourceSource.js.map +1 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/format/CjsFormat.js +178 -0
- package/dist/format/CjsFormat.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +269 -0
- package/dist/format/CjsResourceProbe.js.map +1 -0
- package/dist/format/payloadContract.js +173 -0
- package/dist/format/payloadContract.js.map +1 -0
- package/dist/formats/black/CjsBlackFormat.js +272 -0
- package/dist/formats/black/CjsBlackFormat.js.map +1 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -0
- package/dist/formats/black/core/CjsBlackReader.js +760 -0
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -0
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -0
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js.map +1 -0
- package/dist/formats/black/core/blackConstants.js +7 -0
- package/dist/formats/black/core/blackConstants.js.map +1 -0
- package/dist/formats/black/core/blackDefinitions.js +10 -0
- package/dist/formats/black/core/blackDefinitions.js.map +1 -0
- package/dist/formats/black/core/blackEnums.js +6 -0
- package/dist/formats/black/core/blackEnums.js.map +1 -0
- package/dist/formats/black/core/blackSchema.js +3 -0
- package/dist/formats/black/core/blackSchema.js.map +1 -0
- package/dist/formats/black/core/blackVersion.js +22 -0
- package/dist/formats/black/core/blackVersion.js.map +1 -0
- package/dist/formats/black/core/helpers.js +182 -0
- package/dist/formats/black/core/helpers.js.map +1 -0
- package/dist/formats/black/core/schema.js +4 -0
- package/dist/formats/black/core/schema.js.map +1 -0
- package/dist/formats/black/index.js +2 -0
- package/dist/formats/black/index.js.map +1 -0
- package/dist/formats/bnk/CjsBnkFormat.js +245 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +354 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +246 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -0
- package/dist/formats/bnk/index.js +3 -0
- package/dist/formats/bnk/index.js.map +1 -0
- package/dist/formats/cmf/CjsCmfFormat.js +491 -0
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -0
- package/dist/formats/cmf/core/binary.js +118 -0
- package/dist/formats/cmf/core/binary.js.map +1 -0
- package/dist/formats/cmf/core/buffers.js +233 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -0
- package/dist/formats/cmf/core/constants.js +47 -0
- package/dist/formats/cmf/core/constants.js.map +1 -0
- package/dist/formats/cmf/core/gr2Anim.js +453 -0
- package/dist/formats/cmf/core/gr2Anim.js.map +1 -0
- package/dist/formats/cmf/core/helpers.js +287 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -0
- package/dist/formats/cmf/core/pack.js +276 -0
- package/dist/formats/cmf/core/pack.js.map +1 -0
- package/dist/formats/cmf/core/schema.js +364 -0
- package/dist/formats/cmf/core/schema.js.map +1 -0
- package/dist/formats/cmf/core/shared.js +268 -0
- package/dist/formats/cmf/core/shared.js.map +1 -0
- package/dist/formats/cmf/core/writer.js +517 -0
- package/dist/formats/cmf/core/writer.js.map +1 -0
- package/dist/formats/cmf/index.js +2 -0
- package/dist/formats/cmf/index.js.map +1 -0
- package/dist/formats/dds/CjsDdsFormat.js +187 -0
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -0
- package/dist/formats/dds/core/helpers.js +812 -0
- package/dist/formats/dds/core/helpers.js.map +1 -0
- package/dist/formats/dds/index.js +2 -0
- package/dist/formats/dds/index.js.map +1 -0
- package/dist/formats/fbx/CjsFbxFormat.js +260 -0
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -0
- package/dist/formats/fbx/core/helpers.js +3901 -0
- package/dist/formats/fbx/core/helpers.js.map +1 -0
- package/dist/formats/fbx/index.js +2 -0
- package/dist/formats/fbx/index.js.map +1 -0
- package/dist/formats/flac/CjsFlacFormat.js +81 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -0
- package/dist/formats/flac/core/helpers.js +295 -0
- package/dist/formats/flac/core/helpers.js.map +1 -0
- package/dist/formats/flac/index.js +2 -0
- package/dist/formats/flac/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +81 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -0
- package/dist/formats/gif/core/helpers.js +360 -0
- package/dist/formats/gif/core/helpers.js.map +1 -0
- package/dist/formats/gif/index.js +2 -0
- package/dist/formats/gif/index.js.map +1 -0
- package/dist/formats/gltf/CjsGltfFormat.js +284 -0
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -0
- package/dist/formats/gltf/core/helpers.js +292 -0
- package/dist/formats/gltf/core/helpers.js.map +1 -0
- package/dist/formats/gltf/core/json.js +79 -0
- package/dist/formats/gltf/core/json.js.map +1 -0
- package/dist/formats/gltf/core/parser.js +666 -0
- package/dist/formats/gltf/core/parser.js.map +1 -0
- package/dist/formats/gltf/core/targets.js +163 -0
- package/dist/formats/gltf/core/targets.js.map +1 -0
- package/dist/formats/gltf/index.js +2 -0
- package/dist/formats/gltf/index.js.map +1 -0
- package/dist/formats/index.js +23 -0
- package/dist/formats/index.js.map +1 -0
- package/dist/formats/jpeg/CjsJpegFormat.js +200 -0
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -0
- package/dist/formats/jpeg/core/helpers.js +350 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -0
- package/dist/formats/jpeg/core/jpeg.js +377 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -0
- package/dist/formats/jpeg/index.js +2 -0
- package/dist/formats/jpeg/index.js.map +1 -0
- package/dist/formats/mp3/CjsMp3Format.js +186 -0
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -0
- package/dist/formats/mp3/core/helpers.js +338 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -0
- package/dist/formats/mp3/index.js +2 -0
- package/dist/formats/mp3/index.js.map +1 -0
- package/dist/formats/mp4/CjsMp4Format.js +185 -0
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -0
- package/dist/formats/mp4/core/helpers.js +449 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -0
- package/dist/formats/mp4/index.js +2 -0
- package/dist/formats/mp4/index.js.map +1 -0
- package/dist/formats/obj/CjsObjFormat.js +247 -0
- package/dist/formats/obj/CjsObjFormat.js.map +1 -0
- package/dist/formats/obj/core/helpers.js +573 -0
- package/dist/formats/obj/core/helpers.js.map +1 -0
- package/dist/formats/obj/core/json.js +64 -0
- package/dist/formats/obj/core/json.js.map +1 -0
- package/dist/formats/obj/core/parser.js +321 -0
- package/dist/formats/obj/core/parser.js.map +1 -0
- package/dist/formats/obj/index.js +2 -0
- package/dist/formats/obj/index.js.map +1 -0
- package/dist/formats/ogg/CjsOggFormat.js +82 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -0
- package/dist/formats/ogg/core/helpers.js +387 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -0
- package/dist/formats/ogg/core/imdct.js +178 -0
- package/dist/formats/ogg/core/imdct.js.map +1 -0
- package/dist/formats/ogg/core/vorbis.js +999 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -0
- package/dist/formats/ogg/index.js +2 -0
- package/dist/formats/ogg/index.js.map +1 -0
- package/dist/formats/png/CjsPngFormat.js +189 -0
- package/dist/formats/png/CjsPngFormat.js.map +1 -0
- package/dist/formats/png/core/helpers.js +583 -0
- package/dist/formats/png/core/helpers.js.map +1 -0
- package/dist/formats/png/index.js +2 -0
- package/dist/formats/png/index.js.map +1 -0
- package/dist/formats/red/CjsRedFormat.js +247 -0
- package/dist/formats/red/CjsRedFormat.js.map +1 -0
- package/dist/formats/red/core/CjsRedReader.js +201 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -0
- package/dist/formats/red/core/blackDefinitions.js +3 -0
- package/dist/formats/red/core/blackDefinitions.js.map +1 -0
- package/dist/formats/red/core/helpers.js +136 -0
- package/dist/formats/red/core/helpers.js.map +1 -0
- package/dist/formats/red/core/redGraph.js +68 -0
- package/dist/formats/red/core/redGraph.js.map +1 -0
- package/dist/formats/red/core/schema.js +4 -0
- package/dist/formats/red/core/schema.js.map +1 -0
- package/dist/formats/red/index.js +2 -0
- package/dist/formats/red/index.js.map +1 -0
- package/dist/formats/stl/CjsStlFormat.js +304 -0
- package/dist/formats/stl/CjsStlFormat.js.map +1 -0
- package/dist/formats/stl/core/helpers.js +257 -0
- package/dist/formats/stl/core/helpers.js.map +1 -0
- package/dist/formats/stl/core/json.js +51 -0
- package/dist/formats/stl/core/json.js.map +1 -0
- package/dist/formats/stl/core/stl.js +544 -0
- package/dist/formats/stl/core/stl.js.map +1 -0
- package/dist/formats/stl/core/targets.js +163 -0
- package/dist/formats/stl/core/targets.js.map +1 -0
- package/dist/formats/stl/index.js +2 -0
- package/dist/formats/stl/index.js.map +1 -0
- package/dist/formats/tga/CjsTgaFormat.js +186 -0
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -0
- package/dist/formats/tga/core/helpers.js +446 -0
- package/dist/formats/tga/core/helpers.js.map +1 -0
- package/dist/formats/tga/index.js +2 -0
- package/dist/formats/tga/index.js.map +1 -0
- package/dist/formats/wav/CjsWavFormat.js +186 -0
- package/dist/formats/wav/CjsWavFormat.js.map +1 -0
- package/dist/formats/wav/core/helpers.js +328 -0
- package/dist/formats/wav/core/helpers.js.map +1 -0
- package/dist/formats/wav/index.js +2 -0
- package/dist/formats/wav/index.js.map +1 -0
- package/dist/formats/webm/CjsWebmFormat.js +185 -0
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -0
- package/dist/formats/webm/core/helpers.js +537 -0
- package/dist/formats/webm/core/helpers.js.map +1 -0
- package/dist/formats/webm/index.js +2 -0
- package/dist/formats/webm/index.js.map +1 -0
- package/dist/formats/webp/CjsWebpFormat.js +80 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -0
- package/dist/formats/webp/core/helpers.js +214 -0
- package/dist/formats/webp/core/helpers.js.map +1 -0
- package/dist/formats/webp/index.js +2 -0
- package/dist/formats/webp/index.js.map +1 -0
- package/dist/formats/wem/CjsWemFormat.js +197 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -0
- package/dist/formats/wem/core/bitStream.js +259 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -0
- package/dist/formats/wem/core/codebookLibrary.js +164 -0
- package/dist/formats/wem/core/codebookLibrary.js.map +1 -0
- package/dist/formats/wem/core/helpers.js +336 -0
- package/dist/formats/wem/core/helpers.js.map +1 -0
- package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -0
- package/dist/formats/wem/core/packedCodebooksAotuv603.js.map +1 -0
- package/dist/formats/wem/core/wemToOgg.js +485 -0
- package/dist/formats/wem/core/wemToOgg.js.map +1 -0
- package/dist/formats/wem/index.js +2 -0
- package/dist/formats/wem/index.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +77 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -0
- package/dist/formats/yaml/core/CjsYamlReader.js +304 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -0
- package/dist/formats/yaml/core/helpers.js +160 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -0
- package/dist/formats/yaml/index.js +2 -0
- package/dist/formats/yaml/index.js.map +1 -0
- package/dist/generated/resources/AudioGeometryResData.js +47 -0
- package/dist/generated/resources/AudioGeometryResData.js.map +1 -0
- package/dist/generated/resources/CmfVertexReader.js +46 -0
- package/dist/generated/resources/CmfVertexReader.js.map +1 -0
- package/dist/generated/resources/GStateBindingCallbackData.js +31 -0
- package/dist/generated/resources/GStateBindingCallbackData.js.map +1 -0
- package/dist/generated/resources/MeshDecalData.js +37 -0
- package/dist/generated/resources/MeshDecalData.js.map +1 -0
- package/dist/generated/resources/MeshDecalLodData.js +34 -0
- package/dist/generated/resources/MeshDecalLodData.js.map +1 -0
- package/dist/generated/resources/Tr2AsyncSave.js +46 -0
- package/dist/generated/resources/Tr2AsyncSave.js.map +1 -0
- package/dist/generated/resources/Tr2CmfContents.js +37 -0
- package/dist/generated/resources/Tr2CmfContents.js.map +1 -0
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js +58 -0
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/generated/resources/Tr2LoadPrepareFence.js +37 -0
- package/dist/generated/resources/Tr2LoadPrepareFence.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialArea.js +34 -0
- package/dist/generated/resources/Tr2MaterialArea.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialMesh.js +31 -0
- package/dist/generated/resources/Tr2MaterialMesh.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialRes.js +34 -0
- package/dist/generated/resources/Tr2MaterialRes.js.map +1 -0
- package/dist/generated/resources/Tr2ShaderPermutation.js +43 -0
- package/dist/generated/resources/Tr2ShaderPermutation.js.map +1 -0
- package/dist/generated/resources/Tr2TextureLodManager.js +60 -0
- package/dist/generated/resources/Tr2TextureLodManager.js.map +1 -0
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js +37 -0
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePackChannel.js +37 -0
- package/dist/generated/resources/Tr2TexturePackChannel.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipeline.js +44 -0
- package/dist/generated/resources/Tr2TexturePipeline.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineParams.js +34 -0
- package/dist/generated/resources/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js +40 -0
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js +34 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js +31 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js +43 -0
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/generated/resources/TriGeometryResAreaData.js +59 -0
- package/dist/generated/resources/TriGeometryResAreaData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResJointData.js +38 -0
- package/dist/generated/resources/TriGeometryResJointData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResLodData.js +88 -0
- package/dist/generated/resources/TriGeometryResLodData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResMeshData.js +63 -0
- package/dist/generated/resources/TriGeometryResMeshData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResSkeletonData.js +34 -0
- package/dist/generated/resources/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/generated/resources/TriJointBinding.js +38 -0
- package/dist/generated/resources/TriJointBinding.js.map +1 -0
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js +46 -0
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/generated/resources/TriRtGeometryConstants.js +88 -0
- package/dist/generated/resources/TriRtGeometryConstants.js.map +1 -0
- package/dist/generated/resources/enums.js +18 -0
- package/dist/generated/resources/enums.js.map +1 -0
- package/dist/generated/resources/index.js +32 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/resourcePath.js +18 -0
- package/dist/resourcePath.js.map +1 -0
- package/dist/resourceStates.js +9 -0
- package/dist/resourceStates.js.map +1 -0
- package/dist/resources/Tr2EffectRes.js +71 -0
- package/dist/resources/Tr2EffectRes.js.map +1 -0
- package/dist/resources/Tr2GrannyStateRes.js +44 -0
- package/dist/resources/Tr2GrannyStateRes.js.map +1 -0
- package/dist/resources/Tr2ImageRes.js +114 -0
- package/dist/resources/Tr2ImageRes.js.map +1 -0
- package/dist/resources/Tr2LightProfileRes.js +40 -0
- package/dist/resources/Tr2LightProfileRes.js.map +1 -0
- package/dist/resources/TriGeometryRes.js +216 -0
- package/dist/resources/TriGeometryRes.js.map +1 -0
- package/dist/resources/TriGrannyRes.js +43 -0
- package/dist/resources/TriGrannyRes.js.map +1 -0
- package/dist/resources/TriTextureRes.js +304 -0
- package/dist/resources/TriTextureRes.js.map +1 -0
- package/dist/resources/resourceBoundary.js +47 -0
- package/dist/resources/resourceBoundary.js.map +1 -0
- package/dist/texture/CjsTextureArrayRes.js +406 -0
- package/dist/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/texture/CjsTextureParameterProxy.js +133 -0
- package/dist/texture/CjsTextureParameterProxy.js.map +1 -0
- package/format-notices/black/LICENSE +21 -0
- package/format-notices/black/NOTICE +47 -0
- package/format-notices/bnk/LICENSE +21 -0
- package/format-notices/bnk/NOTICE +17 -0
- package/format-notices/cmf/LICENSE +21 -0
- package/format-notices/cmf/NOTICE +36 -0
- package/format-notices/dds/LICENSE +21 -0
- package/format-notices/dds/NOTICE +14 -0
- package/format-notices/fbx/LICENSE +21 -0
- package/format-notices/fbx/NOTICE +14 -0
- package/format-notices/flac/LICENSE +21 -0
- package/format-notices/flac/NOTICE +14 -0
- package/format-notices/gif/LICENSE +21 -0
- package/format-notices/gif/NOTICE +14 -0
- package/format-notices/gltf/LICENSE +21 -0
- package/format-notices/gltf/NOTICE +27 -0
- package/format-notices/jpeg/LICENSE +21 -0
- package/format-notices/jpeg/NOTICE +14 -0
- package/format-notices/mp3/LICENSE +21 -0
- package/format-notices/mp3/NOTICE +14 -0
- package/format-notices/mp4/LICENSE +21 -0
- package/format-notices/mp4/NOTICE +14 -0
- package/format-notices/obj/LICENSE +21 -0
- package/format-notices/obj/NOTICE +26 -0
- package/format-notices/ogg/LICENSE +21 -0
- package/format-notices/ogg/NOTICE +28 -0
- package/format-notices/png/LICENSE +21 -0
- package/format-notices/png/NOTICE +14 -0
- package/format-notices/red/LICENSE +21 -0
- package/format-notices/red/NOTICE +31 -0
- package/format-notices/stl/LICENSE +21 -0
- package/format-notices/stl/NOTICE +21 -0
- package/format-notices/tga/LICENSE +21 -0
- package/format-notices/tga/NOTICE +14 -0
- package/format-notices/wav/LICENSE +21 -0
- package/format-notices/wav/NOTICE +14 -0
- package/format-notices/webm/LICENSE +21 -0
- package/format-notices/webm/NOTICE +14 -0
- package/format-notices/webp/LICENSE +21 -0
- package/format-notices/webp/NOTICE +14 -0
- package/format-notices/wem/LICENSE +57 -0
- package/format-notices/wem/NOTICE +33 -0
- package/format-notices/yaml/LICENSE +21 -0
- package/format-notices/yaml/NOTICE +44 -0
- package/package.json +51 -0
- package/resource-lifecycle.md +487 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
const CMF_CLASS_KEYS = Object.freeze(["Root", "Section", "Metadata", "MetadataEntry", "Mesh", "IndexGroup", "VertexElement", "MeshLod", "MeshArea", "LodMeshArea", "BoneBinding", "MorphTargets", "MorphTarget", "LodMorphTarget", "AudioOcclusionMesh", "Skeleton", "BoneMask", "BoneWeight", "Animation", "AnimationChannel", "AnimationCurve"]);
|
|
2
|
+
function buildCmfFromShared(root) {
|
|
3
|
+
return {
|
|
4
|
+
version: 1,
|
|
5
|
+
metadata: null,
|
|
6
|
+
meshes: (root.meshes ?? []).map(mesh => buildMesh(mesh)),
|
|
7
|
+
skeletons: [],
|
|
8
|
+
animations: []
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function buildMesh(mesh) {
|
|
12
|
+
const vertex = mesh.vertex ?? {},
|
|
13
|
+
indices = mesh.indices ?? [],
|
|
14
|
+
stride = estimateVertexStride(vertex),
|
|
15
|
+
vertexCount = stride === 0 ? 0 : Math.floor((vertex.position ?? []).length / 3);
|
|
16
|
+
return {
|
|
17
|
+
name: mesh.name ?? "",
|
|
18
|
+
decl: buildDecl(vertex),
|
|
19
|
+
lods: [{
|
|
20
|
+
vb: {
|
|
21
|
+
index: 1,
|
|
22
|
+
offset: 0,
|
|
23
|
+
size: vertexCount * stride,
|
|
24
|
+
stride
|
|
25
|
+
},
|
|
26
|
+
ib: {
|
|
27
|
+
index: 2,
|
|
28
|
+
offset: 0,
|
|
29
|
+
size: totalIndexCount(indices) * bytesPerIndex(indices),
|
|
30
|
+
stride: bytesPerIndex(indices)
|
|
31
|
+
},
|
|
32
|
+
areas: indices.map((group, index) => ({
|
|
33
|
+
firstElement: firstTriangle(indices, index),
|
|
34
|
+
elementCount: Math.floor((group.faces ?? []).length / 3)
|
|
35
|
+
})),
|
|
36
|
+
morphTargets: [],
|
|
37
|
+
threshold: 0xffffffff,
|
|
38
|
+
vertex,
|
|
39
|
+
indices
|
|
40
|
+
}],
|
|
41
|
+
areas: indices.map(group => ({
|
|
42
|
+
name: group.name ?? "",
|
|
43
|
+
bounds: bounds(mesh),
|
|
44
|
+
bones: [],
|
|
45
|
+
affectedByBones: false,
|
|
46
|
+
affectedByMorphTargets: false
|
|
47
|
+
})),
|
|
48
|
+
boneBindings: [],
|
|
49
|
+
morphTargets: {
|
|
50
|
+
decl: [],
|
|
51
|
+
targets: []
|
|
52
|
+
},
|
|
53
|
+
uvDensities: [],
|
|
54
|
+
bounds: bounds(mesh),
|
|
55
|
+
audioOcclusionMesh: {
|
|
56
|
+
vertices: [],
|
|
57
|
+
indices: [],
|
|
58
|
+
bounds: {
|
|
59
|
+
min: [0, 0, 0],
|
|
60
|
+
max: [0, 0, 0]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
topology: "TriangleList",
|
|
64
|
+
skeleton: null,
|
|
65
|
+
vertex,
|
|
66
|
+
indices
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function buildDecl(vertex) {
|
|
70
|
+
const decl = [];
|
|
71
|
+
let offset = 0;
|
|
72
|
+
for (const channel of [["position", "Position", 3], ["normal", "Normal", 3], ["tangent", "Tangent", 3], ["binormal", "Binormal", 3], ["texcoord0", "TexCoord", 2, 0], ["texcoord1", "TexCoord", 2, 1], ["color0", "Color", 4, 0], ["blendIndice", "BoneIndices", 4, 0, "UInt16"], ["blendWeight", "BoneWeights", 4, 0]]) {
|
|
73
|
+
const [name, usage, elementCount, usageIndex = 0, type = "Float32"] = channel;
|
|
74
|
+
if (!Array.isArray(vertex[name]) || vertex[name].length === 0) continue;
|
|
75
|
+
decl.push({
|
|
76
|
+
usage,
|
|
77
|
+
usageIndex,
|
|
78
|
+
type,
|
|
79
|
+
elementCount,
|
|
80
|
+
offset
|
|
81
|
+
});
|
|
82
|
+
offset += elementCount * elementTypeSize(type);
|
|
83
|
+
}
|
|
84
|
+
return decl;
|
|
85
|
+
}
|
|
86
|
+
function estimateVertexStride(vertex) {
|
|
87
|
+
return buildDecl(vertex).reduce((stride, element) => Math.max(stride, element.offset + element.elementCount * elementTypeSize(element.type)), 0);
|
|
88
|
+
}
|
|
89
|
+
function elementTypeSize(type) {
|
|
90
|
+
return type === "Float32" ? 4 : type.includes("16") ? 2 : 1;
|
|
91
|
+
}
|
|
92
|
+
function totalIndexCount(indices) {
|
|
93
|
+
return indices.reduce((total, group) => total + (group.faces?.length ?? 0), 0);
|
|
94
|
+
}
|
|
95
|
+
function bytesPerIndex(indices) {
|
|
96
|
+
return indices.some(group => group.bytesPerIndex === 4 || (group.faces ?? []).some(index => index > 0xffff)) ? 4 : 2;
|
|
97
|
+
}
|
|
98
|
+
function firstTriangle(indices, areaIndex) {
|
|
99
|
+
let first = 0;
|
|
100
|
+
for (let i = 0; i < areaIndex; i++) first += Math.floor((indices[i].faces ?? []).length / 3);
|
|
101
|
+
return first;
|
|
102
|
+
}
|
|
103
|
+
function bounds(mesh) {
|
|
104
|
+
return {
|
|
105
|
+
min: mesh.minBounds ?? [0, 0, 0],
|
|
106
|
+
max: mesh.maxBounds ?? [0, 0, 0]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function hydrateCmf(root, classes, hydrationOptions = {}) {
|
|
110
|
+
const hydrationClasses = createHydrationClasses(classes, hydrationOptions);
|
|
111
|
+
return hydrate("Root", {
|
|
112
|
+
...root,
|
|
113
|
+
metadata: root.metadata ? hydrate("Metadata", root.metadata, hydrationClasses) : null,
|
|
114
|
+
meshes: root.meshes.map(mesh => hydrateMesh(mesh, hydrationClasses)),
|
|
115
|
+
skeletons: root.skeletons.map(skeleton => hydrate("Skeleton", skeleton, hydrationClasses)),
|
|
116
|
+
animations: root.animations.map(animation => hydrate("Animation", animation, hydrationClasses))
|
|
117
|
+
}, hydrationClasses, hydrationOptions);
|
|
118
|
+
}
|
|
119
|
+
function hydrateMesh(mesh, classes) {
|
|
120
|
+
return hydrate("Mesh", {
|
|
121
|
+
...mesh,
|
|
122
|
+
decl: mesh.decl.map(element => hydrate("VertexElement", element, classes)),
|
|
123
|
+
lods: mesh.lods.map(lod => hydrate("MeshLod", {
|
|
124
|
+
...lod,
|
|
125
|
+
areas: lod.areas.map(area => hydrate("LodMeshArea", area, classes)),
|
|
126
|
+
morphTargets: lod.morphTargets.map(target => hydrate("LodMorphTarget", target, classes))
|
|
127
|
+
}, classes)),
|
|
128
|
+
areas: mesh.areas.map(area => hydrate("MeshArea", area, classes)),
|
|
129
|
+
boneBindings: mesh.boneBindings.map(binding => hydrate("BoneBinding", binding, classes)),
|
|
130
|
+
morphTargets: hydrate("MorphTargets", {
|
|
131
|
+
decl: mesh.morphTargets.decl.map(element => hydrate("VertexElement", element, classes)),
|
|
132
|
+
targets: mesh.morphTargets.targets.map(target => hydrate("MorphTarget", target, classes))
|
|
133
|
+
}, classes),
|
|
134
|
+
audioOcclusionMesh: hydrate("AudioOcclusionMesh", mesh.audioOcclusionMesh, classes)
|
|
135
|
+
}, classes);
|
|
136
|
+
}
|
|
137
|
+
function hydrate(type, fields, classes, hydrationOptions = {}) {
|
|
138
|
+
const Class = classes?.[type];
|
|
139
|
+
const options = Object.keys(hydrationOptions).length > 0 ? hydrationOptions : classes?.__hydrationOptions || {};
|
|
140
|
+
return Class ? populate(new Class(), fields, options) : fields;
|
|
141
|
+
}
|
|
142
|
+
function populate(instance, fields, hydrationOptions = {}) {
|
|
143
|
+
if (!instance || typeof instance.SetValues !== "function") {
|
|
144
|
+
throw new TypeError("CjsStlFormat CMF class population requires classes to implement SetValues(values)");
|
|
145
|
+
}
|
|
146
|
+
instance.SetValues(fields, {
|
|
147
|
+
...hydrationOptions,
|
|
148
|
+
skipUpdate: true,
|
|
149
|
+
skipEvents: true
|
|
150
|
+
});
|
|
151
|
+
return instance;
|
|
152
|
+
}
|
|
153
|
+
function createHydrationClasses(classes, hydrationOptions) {
|
|
154
|
+
const map = Object.create(classes || null);
|
|
155
|
+
Object.defineProperty(map, "__hydrationOptions", {
|
|
156
|
+
value: hydrationOptions,
|
|
157
|
+
enumerable: false
|
|
158
|
+
});
|
|
159
|
+
return map;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export { CMF_CLASS_KEYS, buildCmfFromShared, hydrateCmf };
|
|
163
|
+
//# sourceMappingURL=targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.js","sources":["../../../../../src/formats/stl/core/targets.js"],"sourcesContent":["export const CMF_CLASS_KEYS = Object.freeze([\n \"Root\",\n \"Section\",\n \"Metadata\",\n \"MetadataEntry\",\n \"Mesh\",\n \"IndexGroup\",\n \"VertexElement\",\n \"MeshLod\",\n \"MeshArea\",\n \"LodMeshArea\",\n \"BoneBinding\",\n \"MorphTargets\",\n \"MorphTarget\",\n \"LodMorphTarget\",\n \"AudioOcclusionMesh\",\n \"Skeleton\",\n \"BoneMask\",\n \"BoneWeight\",\n \"Animation\",\n \"AnimationChannel\",\n \"AnimationCurve\"\n]);\n\nexport function buildCmfFromShared(root)\n{\n return {\n version: 1,\n metadata: null,\n meshes: (root.meshes ?? []).map((mesh) => buildMesh(mesh)),\n skeletons: [],\n animations: []\n };\n}\n\nfunction buildMesh(mesh)\n{\n const\n vertex = mesh.vertex ?? {},\n indices = mesh.indices ?? [],\n stride = estimateVertexStride(vertex),\n vertexCount = stride === 0 ? 0 : Math.floor((vertex.position ?? []).length / 3);\n\n return {\n name: mesh.name ?? \"\",\n decl: buildDecl(vertex),\n lods: [ {\n vb: { index: 1, offset: 0, size: vertexCount * stride, stride },\n ib: { index: 2, offset: 0, size: totalIndexCount(indices) * bytesPerIndex(indices), stride: bytesPerIndex(indices) },\n areas: indices.map((group, index) => ({\n firstElement: firstTriangle(indices, index),\n elementCount: Math.floor((group.faces ?? []).length / 3)\n })),\n morphTargets: [],\n threshold: 0xffffffff,\n vertex,\n indices\n } ],\n areas: indices.map((group) => ({\n name: group.name ?? \"\",\n bounds: bounds(mesh),\n bones: [],\n affectedByBones: false,\n affectedByMorphTargets: false\n })),\n boneBindings: [],\n morphTargets: { decl: [], targets: [] },\n uvDensities: [],\n bounds: bounds(mesh),\n audioOcclusionMesh: {\n vertices: [],\n indices: [],\n bounds: { min: [ 0, 0, 0 ], max: [ 0, 0, 0 ] }\n },\n topology: \"TriangleList\",\n skeleton: null,\n vertex,\n indices\n };\n}\n\nfunction buildDecl(vertex)\n{\n const decl = [];\n let offset = 0;\n for (const channel of [\n [ \"position\", \"Position\", 3 ],\n [ \"normal\", \"Normal\", 3 ],\n [ \"tangent\", \"Tangent\", 3 ],\n [ \"binormal\", \"Binormal\", 3 ],\n [ \"texcoord0\", \"TexCoord\", 2, 0 ],\n [ \"texcoord1\", \"TexCoord\", 2, 1 ],\n [ \"color0\", \"Color\", 4, 0 ],\n [ \"blendIndice\", \"BoneIndices\", 4, 0, \"UInt16\" ],\n [ \"blendWeight\", \"BoneWeights\", 4, 0 ]\n ])\n {\n const [ name, usage, elementCount, usageIndex = 0, type = \"Float32\" ] = channel;\n if (!Array.isArray(vertex[name]) || vertex[name].length === 0) continue;\n decl.push({ usage, usageIndex, type, elementCount, offset });\n offset += elementCount * elementTypeSize(type);\n }\n return decl;\n}\n\nfunction estimateVertexStride(vertex)\n{\n return buildDecl(vertex).reduce((stride, element) => Math.max(stride, element.offset + element.elementCount * elementTypeSize(element.type)), 0);\n}\n\nfunction elementTypeSize(type)\n{\n return type === \"Float32\" ? 4 : type.includes(\"16\") ? 2 : 1;\n}\n\nfunction totalIndexCount(indices)\n{\n return indices.reduce((total, group) => total + (group.faces?.length ?? 0), 0);\n}\n\nfunction bytesPerIndex(indices)\n{\n return indices.some((group) => group.bytesPerIndex === 4 || (group.faces ?? []).some((index) => index > 0xffff)) ? 4 : 2;\n}\n\nfunction firstTriangle(indices, areaIndex)\n{\n let first = 0;\n for (let i = 0; i < areaIndex; i++) first += Math.floor((indices[i].faces ?? []).length / 3);\n return first;\n}\n\nfunction bounds(mesh)\n{\n return {\n min: mesh.minBounds ?? [ 0, 0, 0 ],\n max: mesh.maxBounds ?? [ 0, 0, 0 ]\n };\n}\n\nexport function hydrateCmf(root, classes, hydrationOptions = {})\n{\n const hydrationClasses = createHydrationClasses(classes, hydrationOptions);\n return hydrate(\"Root\", {\n ...root,\n metadata: root.metadata ? hydrate(\"Metadata\", root.metadata, hydrationClasses) : null,\n meshes: root.meshes.map((mesh) => hydrateMesh(mesh, hydrationClasses)),\n skeletons: root.skeletons.map((skeleton) => hydrate(\"Skeleton\", skeleton, hydrationClasses)),\n animations: root.animations.map((animation) => hydrate(\"Animation\", animation, hydrationClasses))\n }, hydrationClasses, hydrationOptions);\n}\n\nfunction hydrateMesh(mesh, classes)\n{\n return hydrate(\"Mesh\", {\n ...mesh,\n decl: mesh.decl.map((element) => hydrate(\"VertexElement\", element, classes)),\n lods: mesh.lods.map((lod) => hydrate(\"MeshLod\", {\n ...lod,\n areas: lod.areas.map((area) => hydrate(\"LodMeshArea\", area, classes)),\n morphTargets: lod.morphTargets.map((target) => hydrate(\"LodMorphTarget\", target, classes))\n }, classes)),\n areas: mesh.areas.map((area) => hydrate(\"MeshArea\", area, classes)),\n boneBindings: mesh.boneBindings.map((binding) => hydrate(\"BoneBinding\", binding, classes)),\n morphTargets: hydrate(\"MorphTargets\", {\n decl: mesh.morphTargets.decl.map((element) => hydrate(\"VertexElement\", element, classes)),\n targets: mesh.morphTargets.targets.map((target) => hydrate(\"MorphTarget\", target, classes))\n }, classes),\n audioOcclusionMesh: hydrate(\"AudioOcclusionMesh\", mesh.audioOcclusionMesh, classes)\n }, classes);\n}\n\nfunction hydrate(type, fields, classes, hydrationOptions = {})\n{\n const Class = classes?.[type];\n const options = Object.keys(hydrationOptions).length > 0 ? hydrationOptions : classes?.__hydrationOptions || {};\n return Class ? populate(new Class(), fields, options) : fields;\n}\n\nfunction populate(instance, fields, hydrationOptions = {})\n{\n if (!instance || typeof instance.SetValues !== \"function\")\n {\n throw new TypeError(\"CjsStlFormat CMF class population requires classes to implement SetValues(values)\");\n }\n instance.SetValues(fields, { ...hydrationOptions, skipUpdate: true, skipEvents: true });\n return instance;\n}\n\nfunction createHydrationClasses(classes, hydrationOptions)\n{\n const map = Object.create(classes || null);\n Object.defineProperty(map, \"__hydrationOptions\", { value: hydrationOptions, enumerable: false });\n return map;\n}\n"],"names":["CMF_CLASS_KEYS","Object","freeze","buildCmfFromShared","root","version","metadata","meshes","map","mesh","buildMesh","skeletons","animations","vertex","indices","stride","estimateVertexStride","vertexCount","Math","floor","position","length","name","decl","buildDecl","lods","vb","index","offset","size","ib","totalIndexCount","bytesPerIndex","areas","group","firstElement","firstTriangle","elementCount","faces","morphTargets","threshold","bounds","bones","affectedByBones","affectedByMorphTargets","boneBindings","targets","uvDensities","audioOcclusionMesh","vertices","min","max","topology","skeleton","channel","usage","usageIndex","type","Array","isArray","push","elementTypeSize","reduce","element","includes","total","some","areaIndex","first","i","minBounds","maxBounds","hydrateCmf","classes","hydrationOptions","hydrationClasses","createHydrationClasses","hydrate","hydrateMesh","animation","lod","area","target","binding","fields","Class","options","keys","__hydrationOptions","populate","instance","SetValues","TypeError","skipUpdate","skipEvents","create","defineProperty","value","enumerable"],"mappings":"AAAO,MAAMA,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC,CACxC,MAAM,EACN,SAAS,EACT,UAAU,EACV,eAAe,EACf,MAAM,EACN,YAAY,EACZ,eAAe,EACf,SAAS,EACT,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,gBAAgB,CACnB;AAEM,SAASC,kBAAkBA,CAACC,IAAI,EACvC;EACI,OAAO;AACHC,IAAAA,OAAO,EAAE,CAAC;AACVC,IAAAA,QAAQ,EAAE,IAAI;AACdC,IAAAA,MAAM,EAAE,CAACH,IAAI,CAACG,MAAM,IAAI,EAAE,EAAEC,GAAG,CAAEC,IAAI,IAAKC,SAAS,CAACD,IAAI,CAAC,CAAC;AAC1DE,IAAAA,SAAS,EAAE,EAAE;AACbC,IAAAA,UAAU,EAAE;GACf;AACL;AAEA,SAASF,SAASA,CAACD,IAAI,EACvB;AACI,EAAA,MACII,MAAM,GAAGJ,IAAI,CAACI,MAAM,IAAI,EAAE;AAC1BC,IAAAA,OAAO,GAAGL,IAAI,CAACK,OAAO,IAAI,EAAE;AAC5BC,IAAAA,MAAM,G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AASK,QAAQA,CAACC,QAAQ,EAAEN,MAAM,EAAEV,gBAAgB,GAAG,EAAE,EACzD;EACI,IAAI,CAACgB,QAAQ,IAAI,OAAOA,QAAQ,CAACC,SAAS,KAAK,UAAU,EACzD;AACI,IAAA,MAAM,IAAIC,SAAS,CAAC,mFAAmF,CAAC;AAC5G,EAAA;AACAF,EAAAA,QAAQ,CAACC,SAAS,CAACP,MAAM,EAAE;AAAE,IAAA,GAAGV,gBAAgB;AAAEmB,IAAAA,UAAU,EAAE,IAAI;AAAEC,IAAAA,UAAU,EAAE;AAAK,GAAC,CAAC;AACvF,EAAA,OAAOJ,QAAQ;AACnB;AAEA,SAASd,sBAAsBA,CAACH,OAAO,EAAEC,gBAAgB,EACzD;EACI,MAAMlE,GAAG,GAAGP,MAAM,CAAC8F,MAAM,CAACtB,OAAO,IAAI,IAAI,CAAC;AAC1CxE,EAAAA,MAAM,CAAC+F,cAAc,CAACxF,GAAG,EAAE,oBAAoB,EAAE;AAAEyF,IAAAA,KAAK,EAAEvB,gBAAgB;AAAEwB,IAAAA,UAAU,EAAE;AAAM,GAAC,CAAC;AAChG,EAAA,OAAO1F,GAAG;AACd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isTGA, toBytes, OUTPUT_IMAGE, OUTPUT_RGBA, OUTPUT_RAW, OUTPUT_JSON } from './core/helpers.js';
|
|
2
|
+
|
|
3
|
+
const FORMAT_NAME = "CjsTgaFormat";
|
|
4
|
+
class CjsTgaFormat {
|
|
5
|
+
#values = DEFAULT_VALUES;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Create a reusable TGA format profile.
|
|
9
|
+
*
|
|
10
|
+
* @param {object} [options] Default read/inspect options.
|
|
11
|
+
*/
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.SetValues(options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Merge options into this profile.
|
|
18
|
+
*
|
|
19
|
+
* @param {object} [options] Values to merge.
|
|
20
|
+
* @returns {CjsTgaFormat} This format profile.
|
|
21
|
+
*/
|
|
22
|
+
SetValues(options = {}) {
|
|
23
|
+
this.#values = normalizeValues(this.#values, {
|
|
24
|
+
inputType: "tga",
|
|
25
|
+
...options
|
|
26
|
+
}, FORMAT_NAME);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get normalized profile values with optional per-call overrides.
|
|
32
|
+
*
|
|
33
|
+
* @param {object} [options] Per-call values.
|
|
34
|
+
* @returns {object} Normalized read values.
|
|
35
|
+
*/
|
|
36
|
+
GetValues(options = {}) {
|
|
37
|
+
return normalizeValues(this.#values, {
|
|
38
|
+
inputType: "tga",
|
|
39
|
+
...options
|
|
40
|
+
}, FORMAT_NAME);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Read TGA bytes with this profile.
|
|
45
|
+
*
|
|
46
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
47
|
+
* @param {object} [options] Per-call values.
|
|
48
|
+
* @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.
|
|
49
|
+
*/
|
|
50
|
+
Read(input, options = {}) {
|
|
51
|
+
return readWithValues(input, this.GetValues(options), "tga");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Read TGA bytes asynchronously with this profile.
|
|
56
|
+
*
|
|
57
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
58
|
+
* @param {object} [options] Per-call values.
|
|
59
|
+
* @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.
|
|
60
|
+
*/
|
|
61
|
+
async ReadAsync(input, options = {}) {
|
|
62
|
+
return this.Read(input, options);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Inspect TGA bytes without decoding full image data.
|
|
67
|
+
*
|
|
68
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
69
|
+
* @param {object} [options] Per-call values.
|
|
70
|
+
* @returns {object} TGA header metadata.
|
|
71
|
+
*/
|
|
72
|
+
Inspect(input, options = {}) {
|
|
73
|
+
return inspectWithValues(input, this.GetValues(options), "tga");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Report whether TGA input and requested output variants are supported.
|
|
78
|
+
*
|
|
79
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
80
|
+
* @param {object} [options] Per-call values.
|
|
81
|
+
* @returns {object} Support/probe report.
|
|
82
|
+
*/
|
|
83
|
+
IsSupported(input, options = {}) {
|
|
84
|
+
return isSupportedWithValues(input, this.GetValues(options), "tga");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Convert format output into JSON-compatible debug data.
|
|
89
|
+
*
|
|
90
|
+
* @param {any} value Format output.
|
|
91
|
+
* @returns {any} JSON-compatible value.
|
|
92
|
+
*/
|
|
93
|
+
ToJSON(value) {
|
|
94
|
+
return toJsonValue(value);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* One-shot TGA read.
|
|
99
|
+
*
|
|
100
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
101
|
+
* @param {object} [options] Read options.
|
|
102
|
+
* @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.
|
|
103
|
+
*/
|
|
104
|
+
static read(input, options = {}) {
|
|
105
|
+
return readWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
106
|
+
inputType: "tga",
|
|
107
|
+
...options
|
|
108
|
+
}, FORMAT_NAME), "tga");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* One-shot asynchronous TGA read.
|
|
113
|
+
*
|
|
114
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
115
|
+
* @param {object} [options] Read options.
|
|
116
|
+
* @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.
|
|
117
|
+
*/
|
|
118
|
+
static async readAsync(input, options = {}) {
|
|
119
|
+
return CjsTgaFormat.read(input, options);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* One-shot TGA inspection.
|
|
124
|
+
*
|
|
125
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
126
|
+
* @param {object} [options] Inspect options.
|
|
127
|
+
* @returns {object} TGA header metadata.
|
|
128
|
+
*/
|
|
129
|
+
static inspect(input, options = {}) {
|
|
130
|
+
return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
131
|
+
inputType: "tga",
|
|
132
|
+
...options
|
|
133
|
+
}, FORMAT_NAME), "tga");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* One-shot TGA support probe.
|
|
138
|
+
*
|
|
139
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.
|
|
140
|
+
* @param {object} [options] Probe options.
|
|
141
|
+
* @returns {object} Support/probe report.
|
|
142
|
+
*/
|
|
143
|
+
static isSupported(input, options = {}) {
|
|
144
|
+
return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
145
|
+
inputType: "tga",
|
|
146
|
+
...options
|
|
147
|
+
}, FORMAT_NAME), "tga");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Convert format output into JSON-compatible debug data.
|
|
152
|
+
*
|
|
153
|
+
* @param {any} value Format output.
|
|
154
|
+
* @returns {any} JSON-compatible value.
|
|
155
|
+
*/
|
|
156
|
+
static toJSON(value) {
|
|
157
|
+
return toJsonValue(value);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Test whether bytes look like a TGA file.
|
|
162
|
+
*
|
|
163
|
+
* @param {Uint8Array|ArrayBuffer|DataView} input Candidate TGA bytes.
|
|
164
|
+
* @returns {boolean} True when the TGA header looks valid.
|
|
165
|
+
*/
|
|
166
|
+
static isTGA(input) {
|
|
167
|
+
try {
|
|
168
|
+
return isTGA(toBytes(input));
|
|
169
|
+
} catch {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
static OUTPUT_IMAGE = OUTPUT_IMAGE;
|
|
174
|
+
static OUTPUT_RGBA = OUTPUT_RGBA;
|
|
175
|
+
static OUTPUT_RAW = OUTPUT_RAW;
|
|
176
|
+
static OUTPUT_JSON = OUTPUT_JSON;
|
|
177
|
+
static OUTPUT_TGA_JSON = "tgaJson";
|
|
178
|
+
static type = Object.freeze(["image"]);
|
|
179
|
+
static mediaTypes = Object.freeze(["image"]);
|
|
180
|
+
static inputTypes = Object.freeze(["tga"]);
|
|
181
|
+
static outputTypes = Object.freeze([OUTPUT_IMAGE, OUTPUT_RGBA]);
|
|
182
|
+
static debugOutputTypes = Object.freeze(["tgaJson", OUTPUT_RAW]);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { CjsTgaFormat };
|
|
186
|
+
//# sourceMappingURL=CjsTgaFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsTgaFormat.js","sources":["../../../../src/formats/tga/CjsTgaFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n isSupportedWithValues,\n isTGA,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsTgaFormat\";\n\nexport class CjsTgaFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable TGA format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsTgaFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"tga\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"tga\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read TGA bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Read TGA bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect TGA bytes without decoding full image data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} TGA header metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Report whether TGA input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot asynchronous TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsTgaFormat.read(input, options);\n }\n\n /**\n * One-shot TGA inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} TGA header metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot TGA support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a TGA file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate TGA bytes.\n * @returns {boolean} True when the TGA header looks valid.\n */\n static isTGA(input)\n {\n try\n {\n return isTGA(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n static OUTPUT_IMAGE = OUTPUT_IMAGE;\n static OUTPUT_RGBA = OUTPUT_RGBA;\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_TGA_JSON = \"tgaJson\";\n static type = Object.freeze([ \"image\" ]);\n static mediaTypes = Object.freeze([ \"image\" ]);\n static inputTypes = Object.freeze([ \"tga\" ]);\n static outputTypes = Object.freeze([ OUTPUT_IMAGE, OUTPUT_RGBA ]);\n static debugOutputTypes = Object.freeze([ \"tgaJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsTgaFormat;\n"],"names":["FORMAT_NAME","CjsTgaFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isTGA","toBytes","OUTPUT_IMAGE","OUTPUT_RGBA","OUTPUT_RAW","OUTPUT_JSON","OUTPUT_TGA_JSON","type","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;AAE3B,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC3F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EA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