@carbonenginejs/runtime 0.1.0-alpha.4 → 0.1.0-alpha.5
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/dist/global/blue/BlueClasses.js +200 -0
- package/dist/global/blue/BlueClasses.js.map +1 -0
- package/dist/global/blue/IBlueClasses.js +79 -0
- package/dist/global/blue/IBlueClasses.js.map +1 -0
- package/dist/global/blue/IBlueDynamicResourceConstructor.js +16 -0
- package/dist/global/blue/IBlueDynamicResourceConstructor.js.map +1 -1
- package/dist/global/blue/blue.js +8 -2
- package/dist/global/blue/blue.js.map +1 -1
- package/dist/global/blue/index.js +2 -0
- package/dist/global/blue/index.js.map +1 -1
- package/dist/global/consts/index.js +0 -1
- package/dist/global/consts/index.js.map +1 -1
- package/dist/global/consts/renderContext/formats.js +26 -25
- package/dist/global/consts/renderContext/formats.js.map +1 -1
- package/dist/{trinityal/Tr2BitmapDimensions.js → global/imageio/BitmapDimensions.js} +19 -15
- package/dist/global/imageio/BitmapDimensions.js.map +1 -0
- package/dist/global/imageio/Cutout.js +28 -0
- package/dist/global/imageio/Cutout.js.map +1 -0
- package/dist/global/imageio/HostBitmap.js +1106 -0
- package/dist/global/imageio/HostBitmap.js.map +1 -0
- package/dist/global/imageio/ImageIOResult.js +99 -0
- package/dist/global/imageio/ImageIOResult.js.map +1 -0
- package/dist/global/imageio/ImageUtility.js +205 -0
- package/dist/global/imageio/ImageUtility.js.map +1 -0
- package/dist/global/imageio/LoadParameters.js +86 -0
- package/dist/global/imageio/LoadParameters.js.map +1 -0
- package/dist/global/imageio/Metadata.js +22 -0
- package/dist/global/imageio/Metadata.js.map +1 -0
- package/dist/global/imageio/index.js +8 -0
- package/dist/global/{consts/webgpu → imageio}/index.js.map +1 -1
- package/dist/global/index.js +2 -1
- package/dist/global/index.js.map +1 -1
- package/dist/global/math/color.js +1 -1
- package/dist/global/math/color.js.map +1 -1
- package/dist/global/schema/CjsSchema.js +8 -0
- package/dist/global/schema/CjsSchema.js.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsResMan.js +47 -7
- package/dist/resource/CjsResMan.js.map +1 -1
- package/dist/resource/Tr2LightProfileRes.js +37 -0
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/format/CjsByteWriter.js +46 -46
- package/dist/resource/format/CjsByteWriter.js.map +1 -1
- package/dist/resource/format/CjsFormat.js +7 -8
- package/dist/resource/format/CjsFormat.js.map +1 -1
- package/dist/resource/format/CjsFormatStore.js +8 -8
- package/dist/resource/format/CjsFormatStore.js.map +1 -1
- package/dist/resource/format/CjsGeometryFormat.js +114 -0
- package/dist/resource/format/CjsGeometryFormat.js.map +1 -0
- package/dist/resource/format/CjsImageFormat.js +282 -0
- package/dist/resource/format/CjsImageFormat.js.map +1 -0
- package/dist/resource/format/CjsResourceProbe.js +12 -48
- package/dist/resource/format/CjsResourceProbe.js.map +1 -1
- package/dist/resource/format/CjsStringTable.js +37 -37
- package/dist/resource/format/CjsStringTable.js.map +1 -1
- package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js +10 -10
- package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
- package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js +37 -37
- package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -1
- package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +35 -7
- package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/resource/format/index.js +3 -1
- package/dist/resource/format/index.js.map +1 -1
- package/dist/resource/formats/black/CjsBlackFormat.js +130 -137
- package/dist/resource/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/resource/formats/bnk/CjsBnkFormat.js +12 -19
- package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/resource/formats/bnk/core/helpers.js +1 -3
- package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
- package/dist/resource/formats/cmf/CjsCmfFormat.js +19 -82
- package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/resource/formats/cmf/core/constants.js +1 -2
- package/dist/resource/formats/cmf/core/constants.js.map +1 -1
- package/dist/resource/formats/{stl/core/targets.js → cmf/core/flatShared.js} +9 -8
- package/dist/resource/formats/cmf/core/flatShared.js.map +1 -0
- package/dist/resource/formats/cmf/core/helpers.js +13 -13
- package/dist/resource/formats/cmf/core/helpers.js.map +1 -1
- package/dist/resource/formats/cmf/core/writer.js +24 -24
- package/dist/resource/formats/cmf/core/writer.js.map +1 -1
- package/dist/resource/formats/dds/CjsDdsFormat.js +134 -17
- package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/resource/formats/dds/core/helpers.js +125 -40
- package/dist/resource/formats/dds/core/helpers.js.map +1 -1
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js +14 -16
- package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/resource/formats/dxbc/core/{container.js → DxbcContainer.js} +2 -2
- package/dist/resource/formats/dxbc/core/DxbcContainer.js.map +1 -0
- package/dist/resource/formats/dxbc/core/{errors.js → DxbcReadError.js} +1 -1
- package/dist/resource/formats/dxbc/core/DxbcReadError.js.map +1 -0
- package/dist/resource/formats/dxbc/core/DxbcReader.js +1 -1
- package/dist/resource/formats/dxbc/core/DxbcReader.js.map +1 -1
- package/dist/resource/formats/dxbc/core/{program.js → DxbcShaderProgram.js} +2 -2
- package/dist/resource/formats/dxbc/core/DxbcShaderProgram.js.map +1 -0
- package/dist/resource/formats/dxbc/core/{signature.js → DxbcSignatureChunk.js} +2 -2
- package/dist/resource/formats/dxbc/core/DxbcSignatureChunk.js.map +1 -0
- package/dist/resource/formats/dxbc/core/decoder.js +2 -2
- package/dist/resource/formats/dxbc/core/decoder.js.map +1 -1
- package/dist/resource/formats/dxbc/core/helpers.js +3 -3
- package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
- package/dist/resource/formats/fbx/CjsFbxFormat.js +18 -20
- package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/resource/formats/flac/CjsFlacFormat.js +7 -13
- package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/resource/formats/fsd/32/CjsFsd32Format.js +29 -29
- package/dist/resource/formats/fsd/32/CjsFsd32Format.js.map +1 -1
- package/dist/resource/formats/fsd/64/CjsFsd64Format.js +3 -3
- package/dist/resource/formats/fsd/64/CjsFsd64Format.js.map +1 -1
- package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js +23 -23
- package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -1
- package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js +8 -8
- package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -1
- package/dist/resource/formats/fsd/CjsFsdFormat.js +23 -23
- package/dist/resource/formats/fsd/CjsFsdFormat.js.map +1 -1
- package/dist/resource/formats/gif/CjsGifFormat.js +24 -15
- package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/resource/formats/gltf/CjsGltfFormat.js +33 -98
- package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/resource/formats/gltf/core/helpers.js +3 -12
- package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
- package/dist/resource/formats/gr2/CjsGr2Format.js +27 -91
- package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/resource/formats/hlsl/CjsHlslFormat.js +22 -25
- package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js +1 -1
- package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
- package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +3 -3
- package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -1
- package/dist/resource/formats/ies/CjsIESFormat.js +29 -29
- package/dist/resource/formats/ies/CjsIESFormat.js.map +1 -1
- package/dist/resource/formats/jpeg/CjsJpegFormat.js +24 -15
- package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/resource/formats/jpeg/core/helpers.js +3 -5
- package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/resource/formats/jpeg/core/jpeg.js +58 -58
- package/dist/resource/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/resource/formats/jsonl/CjsJsonlFormat.js +3 -3
- package/dist/resource/formats/jsonl/CjsJsonlFormat.js.map +1 -1
- package/dist/resource/formats/mp3/CjsMp3Format.js +7 -14
- package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/resource/formats/mp3/core/helpers.js +3 -5
- package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
- package/dist/resource/formats/mp4/CjsMp4Format.js +7 -13
- package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/resource/formats/mp4/core/helpers.js +3 -5
- package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
- package/dist/resource/formats/obj/CjsObjFormat.js +92 -157
- package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/resource/formats/obj/core/helpers.js +5 -113
- package/dist/resource/formats/obj/core/helpers.js.map +1 -1
- package/dist/resource/formats/ogg/CjsOggFormat.js +7 -14
- package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/resource/formats/pickle/CjsPickleFormat.js +7 -12
- package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js +7 -7
- package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -1
- package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js +7 -7
- package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js.map +1 -1
- package/dist/resource/formats/png/CjsPngFormat.js +40 -15
- package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/resource/formats/png/core/helpers.js +4 -6
- package/dist/resource/formats/png/core/helpers.js.map +1 -1
- package/dist/resource/formats/red/CjsRedFormat.js +22 -28
- package/dist/resource/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js +3 -7
- package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
- package/dist/resource/formats/schemabound/core/schemaBoundValues.js +5 -0
- package/dist/resource/formats/schemabound/core/schemaBoundValues.js.map +1 -1
- package/dist/resource/formats/sqlite/CjsSqliteFormat.js +4 -9
- package/dist/resource/formats/sqlite/CjsSqliteFormat.js.map +1 -1
- package/dist/resource/formats/static/CjsStaticFormat.js +4 -4
- package/dist/resource/formats/static/CjsStaticFormat.js.map +1 -1
- package/dist/resource/formats/stl/CjsStlFormat.js +39 -104
- package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/resource/formats/stl/core/helpers.js +5 -19
- package/dist/resource/formats/stl/core/helpers.js.map +1 -1
- package/dist/resource/formats/tga/CjsTgaFormat.js +26 -15
- package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/resource/formats/tga/core/helpers.js +3 -5
- package/dist/resource/formats/tga/core/helpers.js.map +1 -1
- package/dist/resource/formats/vta/CjsVtaFormat.js +8 -15
- package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
- package/dist/resource/formats/wav/CjsWavFormat.js +7 -14
- package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/resource/formats/wav/core/helpers.js +3 -5
- package/dist/resource/formats/wav/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgl/CjsWebglFormat.js +103 -105
- package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/resource/formats/webgl/core/{errors.js → WebglReadError.js} +1 -1
- package/dist/resource/formats/webgl/core/WebglReadError.js.map +1 -0
- package/dist/resource/formats/webgl/core/effectPackage.js +1 -1
- package/dist/resource/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +3 -3
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/{DxbcGlslHelpers.js → DxbcGlslHelperRegistry.js} +2 -2
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelperRegistry.js.map +1 -0
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glslBackendBlock.js +1 -1
- package/dist/resource/formats/webgl/core/glslBackendBlock.js.map +1 -1
- package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +28 -29
- package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/resource/formats/webgpu/core/{errors.js → WebgpuReadError.js} +1 -1
- package/dist/resource/formats/webgpu/core/WebgpuReadError.js.map +1 -0
- package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js +1 -1
- package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -1
- package/dist/resource/formats/webgpu/core/helpers.js +1 -1
- package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js +1 -1
- package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js +18 -6
- package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +39 -13
- package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +16 -14
- package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -1
- package/dist/resource/formats/webm/CjsWebmFormat.js +8 -13
- package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/resource/formats/webm/core/helpers.js +3 -5
- package/dist/resource/formats/webm/core/helpers.js.map +1 -1
- package/dist/resource/formats/webp/CjsWebpFormat.js +8 -12
- package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/resource/formats/wem/CjsWemFormat.js +9 -17
- package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/resource/formats/wem/core/bitStream.js +35 -35
- package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
- package/dist/resource/formats/wem/core/helpers.js +1 -3
- package/dist/resource/formats/wem/core/helpers.js.map +1 -1
- package/dist/resource/formats/yaml/CjsYamlFormat.js +28 -37
- package/dist/resource/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/resource/imageio/ImageIO.js +142 -0
- package/dist/resource/imageio/ImageIO.js.map +1 -0
- package/dist/resource/imageio/index.js +17 -0
- package/dist/resource/imageio/index.js.map +1 -0
- package/dist/resource/index.js +7 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +24 -2
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +76 -5
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayConstructor.js +97 -0
- package/dist/resource/texture/CjsTextureArrayConstructor.js.map +1 -0
- package/dist/resource/texture/CjsTexturePackConstructor.js +160 -0
- package/dist/resource/texture/CjsTexturePackConstructor.js.map +1 -0
- package/dist/resource/texture/CjsTexturePipelineStepArray.js +72 -0
- package/dist/resource/texture/CjsTexturePipelineStepArray.js.map +1 -0
- package/dist/resource/texture/CjsTexturePipelineStepConvert.js +73 -0
- package/dist/resource/texture/CjsTexturePipelineStepConvert.js.map +1 -0
- package/dist/resource/texture/CjsTexturePipelineStepPack.js +71 -0
- package/dist/resource/texture/CjsTexturePipelineStepPack.js.map +1 -0
- package/dist/resource/texture/CjsTexturePipelineStepResize.js +123 -0
- package/dist/resource/texture/CjsTexturePipelineStepResize.js.map +1 -0
- package/dist/resource/texture/SolidColorTextureConstructor.js +11 -1
- package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +100 -68
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipeline.js +45 -25
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +34 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +30 -3
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +81 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +36 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js +146 -24
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +151 -29
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/dist/resource/texture/index.js +7 -0
- package/dist/resource/texture/index.js.map +1 -1
- package/dist/resource/texture/registerTextureResources.js +83 -0
- package/dist/resource/texture/registerTextureResources.js.map +1 -0
- package/dist/resource/texture/solidColorTexture.js +10 -19
- package/dist/resource/texture/solidColorTexture.js.map +1 -1
- package/dist/sof/EveSOF.js +39 -7
- package/dist/sof/EveSOF.js.map +1 -1
- package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js +2 -2
- package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -1
- package/dist/trinity/core/Tr2ImageIOHelpers.js +80 -17
- package/dist/trinity/core/Tr2ImageIOHelpers.js.map +1 -1
- package/dist/trinity/core/Tr2RenderUtils.js +1 -1
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js +49 -62
- package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -1
- package/dist/trinity/core/Tr2TextureReference.js +114 -0
- package/dist/trinity/core/Tr2TextureReference.js.map +1 -0
- package/dist/trinity/core/device/Tr2DepthStencil.js +2 -2
- package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
- package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js +1 -1
- package/dist/trinity/core/index.js +1 -0
- package/dist/trinity/core/index.js.map +1 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js +5 -4
- package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
- package/dist/trinity/core/procedural/GradientTextureConstructor.js +5 -4
- package/dist/trinity/core/procedural/GradientTextureConstructor.js.map +1 -1
- package/dist/trinity/core/procedural/gradientTexture.js +10 -13
- package/dist/trinity/core/procedural/gradientTexture.js.map +1 -1
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +1 -1
- package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
- package/dist/trinity/eve/EveImpactOverlay.js +102 -50
- package/dist/trinity/eve/EveImpactOverlay.js.map +1 -1
- package/dist/trinity/eve/EveModularObjectModifier.js +9 -18
- package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +175 -157
- package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
- package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js +100 -83
- package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js.map +1 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +26 -20
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -1
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js +368 -179
- package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -1
- package/dist/trinity/eve/child/EveChildMesh.js +242 -234
- package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
- package/dist/trinity/eve/child/EveChildTurret.js +57 -16
- package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
- package/dist/trinity/eve/child/EveSpaceObjectChild.js +28 -1
- package/dist/trinity/eve/child/EveSpaceObjectChild.js.map +1 -1
- package/dist/trinity/eve/index.js +2 -2
- package/dist/trinity/eve/overlays/EveDamageOverlay.js +5 -1
- package/dist/trinity/eve/overlays/EveDamageOverlay.js.map +1 -1
- package/dist/trinity/eve/scene/EveSpaceScene.js +234 -233
- package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
- package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +2 -0
- package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +492 -437
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
- package/dist/trinity/generated/index.js +0 -1
- package/dist/trinity/generated/index.js.map +1 -1
- package/dist/trinity/generated/trinityCore/index.js +0 -1
- package/dist/trinity/generated/trinityCore/index.js.map +1 -1
- package/dist/trinity/index.js +3 -3
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +10 -1
- package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
- package/dist/trinity/shader/Tr2DataTextureManager.js +152 -66
- package/dist/trinity/shader/Tr2DataTextureManager.js.map +1 -1
- package/dist/trinity/shader/Tr2Material.js +1 -1
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js +5 -5
- package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -1
- package/dist/trinityal/index.js +1 -1
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js +2 -2
- package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2SwapChainALStub.js +45 -45
- package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
- package/dist/trinityal/stub/Tr2TextureALStub.js +170 -170
- package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js +234 -164
- package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +7 -0
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +78 -14
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +94 -0
- package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -0
- package/dist/trinityal/webgpu/internal.js +1 -0
- package/dist/trinityal/webgpu/internal.js.map +1 -1
- package/docs/global/reference/classes/README.md +90 -0
- package/docs/resource/concepts/format-capabilities.md +3 -3
- package/docs/resource/formats/README.md +1 -1
- package/docs/resource/reference/classes/core.md +31 -1
- package/docs/resource/reference/classes/formats.md +7 -7
- package/docs/resource/reference/classes/resources.md +76 -16
- package/docs/trinity/reference/classes/generated.md +0 -10
- package/docs/trinity/reference/classes/trinity-core.md +1692 -1682
- package/docs/trinityal/reference/classes/README.md +0 -10
- package/docs/trinityal/webgpu/reference/classes/README.md +276 -266
- package/package.json +4 -3
- package/dist/global/consts/webgpu/index.js +0 -2
- package/dist/global/consts/webgpu/textureFormats.js +0 -180
- package/dist/global/consts/webgpu/textureFormats.js.map +0 -1
- package/dist/resource/formats/dxbc/core/container.js.map +0 -1
- package/dist/resource/formats/dxbc/core/errors.js.map +0 -1
- package/dist/resource/formats/dxbc/core/program.js.map +0 -1
- package/dist/resource/formats/dxbc/core/signature.js.map +0 -1
- package/dist/resource/formats/stl/core/targets.js.map +0 -1
- package/dist/resource/formats/webgl/core/errors.js.map +0 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +0 -1
- package/dist/resource/formats/webgpu/core/errors.js.map +0 -1
- package/dist/resource/texture/texturePipelineBehavior.js +0 -332
- package/dist/resource/texture/texturePipelineBehavior.js.map +0 -1
- package/dist/trinity/generated/trinityCore/Tr2TextureReference.js +0 -40
- package/dist/trinity/generated/trinityCore/Tr2TextureReference.js.map +0 -1
- package/dist/trinityal/Tr2BitmapDimensions.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CjsSchema, carbon, impl, type, edit } from '#schema';
|
|
2
|
+
import { HostBitmap } from '#imageio';
|
|
2
3
|
import { CjsResource } from '../CjsResource.js';
|
|
3
4
|
import { IsSolidColorTexturePath, RasterizeSolidColor } from './solidColorTexture.js';
|
|
4
5
|
import { ResourceRequirement } from '../ResourceRequirement.js';
|
|
5
|
-
import {
|
|
6
|
+
import { ResourcePayloadType, validateVideoPayload } from '../format/payloadContract.js';
|
|
6
7
|
import { resourcePayloadError, validateResourcePayload, resourceFormatRequiredError, resourceBoundaryError } from '../resourceBoundary.js';
|
|
7
8
|
|
|
8
9
|
// Source: trinity/trinity/Resources/TriTextureRes.h
|
|
@@ -72,13 +73,13 @@ class TriTextureRes extends CjsResource {
|
|
|
72
73
|
* so it publishes the bitmap as the payload and Trinity makes the texture at
|
|
73
74
|
* first bind, as it does for every other texture.
|
|
74
75
|
*
|
|
75
|
-
* @param {Function} rasterize `(path) =>
|
|
76
|
+
* @param {Function} rasterize `(path) => HostBitmap | null`.
|
|
76
77
|
* @returns {void}
|
|
77
78
|
*/
|
|
78
79
|
#RasterizeProceduralTexture(rasterize) {
|
|
79
80
|
this.MarkLoading();
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
81
|
+
const bitmap = rasterize(this.path);
|
|
82
|
+
if (!bitmap) {
|
|
82
83
|
// Carbon: "Failed to parse dynamic:/color/%s texture path", and the
|
|
83
84
|
// texture is never prepared.
|
|
84
85
|
const error = new Error(`Failed to parse ${this.path} texture path`);
|
|
@@ -87,7 +88,7 @@ class TriTextureRes extends CjsResource {
|
|
|
87
88
|
this.SetError(error);
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
|
-
this.SetPayload(
|
|
91
|
+
this.SetPayload(bitmap);
|
|
91
92
|
this.MarkPrepared();
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -101,6 +102,9 @@ class TriTextureRes extends CjsResource {
|
|
|
101
102
|
*/
|
|
102
103
|
texture = null;
|
|
103
104
|
|
|
105
|
+
/** m_loadedBitmap: the decoded image the texture is made from, or null. */
|
|
106
|
+
loadedBitmap = null;
|
|
107
|
+
|
|
104
108
|
/**
|
|
105
109
|
* The live texture, or null while there is none - Carbon returns nullptr
|
|
106
110
|
* until the load finishes and the parameter substitutes the fallback
|
|
@@ -124,6 +128,117 @@ class TriTextureRes extends CjsResource {
|
|
|
124
128
|
return this;
|
|
125
129
|
}
|
|
126
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Build this texture from a texture pipeline: Carbon's `.ctr` route
|
|
133
|
+
* (`TriTextureRes.cpp:238-258` then `ResourcePrepFinished`, `:296-340`).
|
|
134
|
+
*
|
|
135
|
+
* Every path the pipeline names is loaded as a raw `Tr2ImageRes` (Carbon asks
|
|
136
|
+
* for the `"raw"` requirement; ours is `ResourceRequirement.IMAGE`), the
|
|
137
|
+
* pipeline runs once they have all settled, and the result becomes this
|
|
138
|
+
* texture's bitmap. An input that failed to load reaches the pipeline as
|
|
139
|
+
* null, exactly as Carbon passes it, so the step that needed it fails.
|
|
140
|
+
*
|
|
141
|
+
* adapted: Carbon reads the pipeline from a `.ctr` file with
|
|
142
|
+
* `BeResMan->LoadObject` and waits on a fence. No shipped build contains a
|
|
143
|
+
* `.ctr` (checked across 45 resfileindexes, 2026-09-24), so the pipeline is
|
|
144
|
+
* handed in - built in memory by the `dynamic:/` constructors that use this
|
|
145
|
+
* route - and the fence is a promise. The manager is passed because the
|
|
146
|
+
* resource layer has no global `BeResMan`.
|
|
147
|
+
*
|
|
148
|
+
* quirk: Carbon marks the resource good even when the pipeline fails
|
|
149
|
+
* (`m_isGood = true` after the branch, `:337`), so the texture is simply
|
|
150
|
+
* absent and the parameter binds its fallback. Reproduced: the resource is
|
|
151
|
+
* prepared either way, with no bitmap when the pipeline failed.
|
|
152
|
+
*
|
|
153
|
+
* @param {import("./Tr2TexturePipeline.js").Tr2TexturePipeline} pipeline The recipe.
|
|
154
|
+
* @param {object} resourceManager The `CjsResMan` that loads its inputs.
|
|
155
|
+
* @returns {Promise<boolean>} Whether the pipeline produced a bitmap.
|
|
156
|
+
*/
|
|
157
|
+
async LoadPipeline(pipeline, resourceManager) {
|
|
158
|
+
this.MarkLoading();
|
|
159
|
+
const images = new Map();
|
|
160
|
+
for (const path of pipeline.GetResourceDependencies()) {
|
|
161
|
+
images.set(path, resourceManager.GetResource(path, {
|
|
162
|
+
requirement: ResourceRequirement.IMAGE
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Carbon's m_pipelineFence: wait for every input, whatever became of it.
|
|
167
|
+
await Promise.allSettled([...images.values()].map(image => image.Ready()));
|
|
168
|
+
|
|
169
|
+
// Carbon: it->second && it->second->IsGood() ? &it->second->GetBitmap() : nullptr
|
|
170
|
+
const inputs = new Map();
|
|
171
|
+
for (const [path, image] of images) {
|
|
172
|
+
inputs.set(path, image.IsGood() ? image.GetBitmap() : null);
|
|
173
|
+
}
|
|
174
|
+
const result = new HostBitmap();
|
|
175
|
+
const executed = pipeline.Execute(result, inputs);
|
|
176
|
+
if (executed) this.SetPayload(result);
|
|
177
|
+
this.MarkPrepared();
|
|
178
|
+
return executed;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Adopt the cutout an image declared (Carbon reads ImageIO::Metadata's
|
|
183
|
+
* cutout in DoPrepare and stores it as m_cutoutX/Y/Width/Height).
|
|
184
|
+
*
|
|
185
|
+
* @param {{x: number, y: number, width: number, height: number}} cutout The rectangle.
|
|
186
|
+
* @returns {TriTextureRes} This resource.
|
|
187
|
+
*/
|
|
188
|
+
SetCutout(cutout) {
|
|
189
|
+
this.SetValues({
|
|
190
|
+
cutoutX: cutout.x,
|
|
191
|
+
cutoutY: cutout.y,
|
|
192
|
+
cutoutWidth: cutout.width,
|
|
193
|
+
cutoutHeight: cutout.height
|
|
194
|
+
});
|
|
195
|
+
return this;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The decoded bitmap this resource was loaded from, or null.
|
|
200
|
+
*
|
|
201
|
+
* Carbon's `m_loadedBitmap` (`TriTextureRes.cpp:606`): the CPU-side image
|
|
202
|
+
* the texture is made from, kept so the texture can be remade - for a device
|
|
203
|
+
* reset, a LOD change or a save.
|
|
204
|
+
*
|
|
205
|
+
* @returns {import("#imageio").HostBitmap|null} The bitmap.
|
|
206
|
+
*/
|
|
207
|
+
GetBitmap() {
|
|
208
|
+
return this.loadedBitmap;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Adopt a decoded bitmap as this resource's image
|
|
213
|
+
* (`TriTextureRes::CreateFromHostBitmap`, `TriTextureRes.cpp:960-978`).
|
|
214
|
+
*
|
|
215
|
+
* adapted: Carbon creates the texture here, on the main thread's render
|
|
216
|
+
* context (`USE_MAIN_THREAD_RENDER_CONTEXT`). The resource layer may not
|
|
217
|
+
* reach a render context (layers.json), so the texture is made on first bind
|
|
218
|
+
* instead - `Tr2ImageIOHelpers.RealizeTexture` - and this only adopts the
|
|
219
|
+
* bitmap and drops any texture made from the previous one.
|
|
220
|
+
*
|
|
221
|
+
* @param {import("#imageio").HostBitmap|null} bitmap The decoded bitmap.
|
|
222
|
+
* @returns {boolean} Whether the bitmap was adopted.
|
|
223
|
+
*/
|
|
224
|
+
CreateFromHostBitmap(bitmap) {
|
|
225
|
+
this.SetTexture(null);
|
|
226
|
+
if (!bitmap || !bitmap.IsValid()) {
|
|
227
|
+
this.loadedBitmap = null;
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
this.loadedBitmap = bitmap;
|
|
231
|
+
this.SetValues({
|
|
232
|
+
format: bitmap.GetFormat(),
|
|
233
|
+
width: bitmap.GetWidth(),
|
|
234
|
+
height: bitmap.GetHeight(),
|
|
235
|
+
depth: bitmap.GetDepth(),
|
|
236
|
+
arraySize: bitmap.GetArraySize(),
|
|
237
|
+
cpuMip: bitmap.GetTrueMipCount()
|
|
238
|
+
});
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
|
|
127
242
|
/**
|
|
128
243
|
* Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed
|
|
129
244
|
* metadata. Invalid payloads are rejected before replacing the current one.
|
|
@@ -136,17 +251,27 @@ class TriTextureRes extends CjsResource {
|
|
|
136
251
|
if (payload === null) {
|
|
137
252
|
// The bytes are gone; so is the texture made from them.
|
|
138
253
|
this.SetTexture(null);
|
|
254
|
+
this.loadedBitmap = null;
|
|
139
255
|
super.SetPayload(null);
|
|
140
256
|
return this;
|
|
141
257
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
258
|
+
|
|
259
|
+
// Carbon's resource IS its bitmap (TriTextureRes.cpp:606, 960-978).
|
|
260
|
+
const bitmap = CjsSchema.cast(payload, HostBitmap);
|
|
261
|
+
if (bitmap) {
|
|
262
|
+
this.CreateFromHostBitmap(bitmap);
|
|
263
|
+
super.SetPayload(bitmap, options);
|
|
264
|
+
if (options) this.SetValues(options);
|
|
265
|
+
if (bitmap.metadata?.cutout) this.SetCutout(bitmap.metadata.cutout);
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// A video frame source is the one payload left: it is not an image the
|
|
270
|
+
// CPU decoded, it is a playing element the backend samples.
|
|
271
|
+
if (payload?.payloadType !== ResourcePayloadType.VIDEO) {
|
|
272
|
+
throw resourcePayloadError("TriTextureRes", 'Expected an ImageIO::HostBitmap, or payloadType "video".', "payloadType");
|
|
149
273
|
}
|
|
274
|
+
const validator = validateVideoPayload;
|
|
150
275
|
validateResourcePayload("TriTextureRes", payload, validator);
|
|
151
276
|
const values = {
|
|
152
277
|
...(options || {})
|
|
@@ -217,8 +342,9 @@ class TriTextureRes extends CjsResource {
|
|
|
217
342
|
* @returns {number}
|
|
218
343
|
*/
|
|
219
344
|
GetMsaaType() {
|
|
220
|
-
|
|
221
|
-
|
|
345
|
+
// Carbon: m_texture ? m_texture->GetMsaaDesc().samples : 1 (cpp:1214-1216).
|
|
346
|
+
const texture = this.GetTexture();
|
|
347
|
+
return texture ? texture.GetMsaaDesc().samples : 1;
|
|
222
348
|
}
|
|
223
349
|
|
|
224
350
|
/**
|
|
@@ -227,8 +353,9 @@ class TriTextureRes extends CjsResource {
|
|
|
227
353
|
* @returns {number}
|
|
228
354
|
*/
|
|
229
355
|
GetMsaaQuality() {
|
|
230
|
-
|
|
231
|
-
|
|
356
|
+
// Carbon: m_texture ? m_texture->GetMsaaDesc().quality : 0 (cpp:1219-1222).
|
|
357
|
+
const texture = this.GetTexture();
|
|
358
|
+
return texture ? texture.GetMsaaDesc().quality : 0;
|
|
232
359
|
}
|
|
233
360
|
|
|
234
361
|
/**
|
|
@@ -332,15 +459,6 @@ class TriTextureRes extends CjsResource {
|
|
|
332
459
|
throw resourceBoundaryError("TriTextureRes", "CreateAndCopyFromRenderTarget", "Runtime-resource does not own render targets.");
|
|
333
460
|
}
|
|
334
461
|
|
|
335
|
-
/**
|
|
336
|
-
* Create a device texture from a host bitmap.
|
|
337
|
-
*
|
|
338
|
-
* @throws {Error}
|
|
339
|
-
*/
|
|
340
|
-
CreateFromHostBitmap() {
|
|
341
|
-
throw resourceBoundaryError("TriTextureRes", "CreateFromHostBitmap", "Use engine-gpu to allocate and upload texture data.");
|
|
342
|
-
}
|
|
343
|
-
|
|
344
462
|
/**
|
|
345
463
|
* Create this texture from another texture resource.
|
|
346
464
|
*
|
|
@@ -445,13 +563,14 @@ CjsSchema.define(TriTextureRes, {
|
|
|
445
563
|
cutoutWidth: [type.float32, edit.readwrite],
|
|
446
564
|
width: [type.uint32, edit.read],
|
|
447
565
|
cutoutX: [type.float32, edit.readwrite],
|
|
448
|
-
cutoutY: [type.float32, edit.readwrite]
|
|
566
|
+
cutoutY: [type.float32, edit.readwrite],
|
|
567
|
+
loadedBitmap: [type.unknown, edit.read]
|
|
449
568
|
},
|
|
450
569
|
methods: {
|
|
451
570
|
Initialize: [carbon.method, impl.adapted, impl.reason("Carbon rasterizes a procedural path into a half-float HostBitmap and creates the GPU texture inside Initialize; this resource cannot reach a render context, so it publishes the half-float-quantized colour as an rgba32float payload. The gradient_1d branch is not ported.")],
|
|
452
571
|
GetMipCount: [carbon.method, impl.adapted],
|
|
453
|
-
GetMsaaType: [carbon.method, impl.
|
|
454
|
-
GetMsaaQuality: [carbon.method, impl.
|
|
572
|
+
GetMsaaType: [carbon.method, impl.implemented],
|
|
573
|
+
GetMsaaQuality: [carbon.method, impl.implemented],
|
|
455
574
|
HadLodRequests: [carbon.method, impl.adapted],
|
|
456
575
|
GetSrvIndexInHeap: [carbon.method, impl.notSupported],
|
|
457
576
|
GetTexture: [carbon.method, impl.implemented],
|
|
@@ -465,7 +584,10 @@ CjsSchema.define(TriTextureRes, {
|
|
|
465
584
|
CreateEmptyTexture: [carbon.method, impl.notSupported],
|
|
466
585
|
SetFromRenderTarget: [carbon.method, impl.notSupported],
|
|
467
586
|
CreateAndCopyFromRenderTarget: [carbon.method, impl.notSupported],
|
|
468
|
-
CreateFromHostBitmap: [carbon.method, impl.
|
|
587
|
+
CreateFromHostBitmap: [carbon.method, impl.adapted, impl.reason("Carbon creates the texture here on the main thread's render context; the resource layer may not reach one, so this adopts the bitmap and the texture is made on first bind (Tr2ImageIOHelpers.RealizeTexture).")],
|
|
588
|
+
LoadPipeline: [impl.adapted, impl.reason("Carbon's .ctr branch reads the pipeline from a file through the global BeResMan and waits on a fence; no shipped build has a .ctr, so the pipeline is handed in, the manager passed, and the fence is a promise.")],
|
|
589
|
+
SetCutout: [impl.custom, impl.reason("Carbon reads the cutout from ImageIO::Metadata inside DoPrepare; the read happens in the loader here, so the resource is told.")],
|
|
590
|
+
GetBitmap: [impl.custom, impl.reason("Carbon keeps m_loadedBitmap private and uploads it inside CreateFromHostBitmap; the upload happens at bind time here, so the bitmap has to be readable.")],
|
|
469
591
|
CreateFromTexture: [carbon.method, impl.notSupported],
|
|
470
592
|
HasALObject: [carbon.method, impl.adapted],
|
|
471
593
|
GetPipeline: [carbon.method, impl.adapted],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriTextureRes.js","sources":["../../../../src/resource/texture/TriTextureRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.h\n// Source: trinity/trinity/Resources/TriTextureRes.cpp\n// Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp\nimport { CjsSchema, carbon, impl, edit, type } from \"#schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { IsSolidColorTexturePath, RasterizeSolidColor } from \"./solidColorTexture.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\nimport {\n ResourcePayloadType,\n validateRgbaPayload,\n validateTexturePayload,\n validateVideoPayload\n} from \"../format/payloadContract.js\";\nimport {\n resourceBoundaryError,\n resourceFormatRequiredError,\n resourcePayloadError,\n validateResourcePayload\n} from \"../resourceBoundary.js\";\n\n/**\n * Resource record that owns Carbon-style texture identity and validated\n * texture, RGBA, or video payload facts with mirrored dimension/format\n * metadata, while engine packages decide what those facts become on a device.\n *\n * The resource never CREATES a backend texture - it cannot reach a render\n * context - but it RETAINS the one Trinity makes for it, as Carbon's does\n * (`m_texture`), so every parameter sharing the resource binds one texture.\n */\nexport class TriTextureRes extends CjsResource\n{\n format = null;\n type = null;\n averageColor = [0, 0, 0, 0];\n depth = 0;\n cutoutHeight = 1;\n height = 0;\n lodEnabled = false;\n hadLodRequests = false;\n cpuMip = 0;\n gpuMip = 0;\n wrappedRenderTarget = null;\n originalResolution = 0;\n originalMemoryUsage = 0;\n name = \"\";\n arraySize = 0;\n cutoutWidth = 1;\n width = 0;\n cutoutX = 0;\n cutoutY = 0;\n\n /** Creates a TriTextureRes with caller-provided initial state. */\n constructor(values = null) {\n super();\n this.SetValues(values || {}, {\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Carbon's Initialize, with its procedural branch (TriTextureRes.cpp:223-236):\n * a `dynamic:/color/` path is rasterized here rather than loaded from source.\n * The `dynamic:/gradient_1d/` branch Carbon checks first is rasterized by\n * trinity's GradientTextureConstructor instead: a gradient needs Tr2CurveScalar,\n * which this layer may not import.\n *\n * @param {string} path Resource path.\n * @param {string|null} [ext] Extension override.\n * @param {string} [requirement] Semantic requirement.\n * @returns {TriTextureRes} This resource.\n */\n Initialize(path, ext = null, requirement = \"\") {\n super.Initialize(path, ext, requirement);\n if (IsSolidColorTexturePath(this.path)) this.#RasterizeProceduralTexture(RasterizeSolidColor);\n return this;\n }\n\n /**\n * `RasterizeProceduralTexture` (TriTextureRes.cpp:181-212). Carbon creates the\n * GPU texture from the bitmap here; this layer cannot reach a render context,\n * so it publishes the bitmap as the payload and Trinity makes the texture at\n * first bind, as it does for every other texture.\n *\n * @param {Function} rasterize `(path) => payload | null`.\n * @returns {void}\n */\n #RasterizeProceduralTexture(rasterize) {\n this.MarkLoading();\n const payload = rasterize(this.path);\n if (!payload) {\n // Carbon: \"Failed to parse dynamic:/color/%s texture path\", and the\n // texture is never prepared.\n const error = new Error(`Failed to parse ${this.path} texture path`);\n error.code = \"CJS_TEXTURE_PROCEDURAL_PATH_INVALID\";\n error.path = this.path;\n this.SetError(error);\n return;\n }\n this.SetPayload(payload);\n this.MarkPrepared();\n }\n\n /**\n * m_texture: the live `Tr2TextureAL`, or null until an engine makes one.\n *\n * Carbon creates it in `DoPrepare` through the main-thread context and\n * stores it here (`TriTextureRes.cpp:690-704`). This layer cannot reach a\n * render context, so Trinity creates it at first bind and stores it here,\n * where every parameter sharing the resource finds the one texture.\n */\n texture = null;\n\n /**\n * The live texture, or null while there is none - Carbon returns nullptr\n * until the load finishes and the parameter substitutes the fallback\n * (`TriTextureRes.cpp:394-405`).\n *\n * @returns {object|null} A `Tr2TextureAL`.\n */\n GetTexture() {\n return this.texture && this.texture.IsValid() ? this.texture : null;\n }\n\n /**\n * Adopts a texture as this resource's (`TriTextureRes.cpp:1159-1195`).\n *\n * @param {object|null} texture A `Tr2TextureAL`, or null to drop it.\n * @returns {TriTextureRes} This resource.\n */\n SetTexture(texture) {\n if (this.texture && this.texture !== texture) this.texture.Destroy();\n this.texture = texture ?? null;\n return this;\n }\n\n /**\n * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed\n * metadata. Invalid payloads are rejected before replacing the current one.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {TriTextureRes}\n */\n SetPayload(payload = null, options = null) {\n if (payload === null) {\n // The bytes are gone; so is the texture made from them.\n this.SetTexture(null);\n super.SetPayload(null);\n return this;\n }\n\n const validator = {\n [ResourcePayloadType.RGBA]: validateRgbaPayload,\n [ResourcePayloadType.TEXTURE]: validateTexturePayload,\n [ResourcePayloadType.VIDEO]: validateVideoPayload\n }[payload?.payloadType];\n if (!validator) {\n throw resourcePayloadError(\n \"TriTextureRes\",\n 'Expected payloadType \"rgba\", \"texture\", or \"video\".',\n \"payloadType\"\n );\n }\n validateResourcePayload(\"TriTextureRes\", payload, validator);\n\n const values = { ...(options || {}) };\n if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;\n if (payload.width !== undefined) values.width = payload.width;\n if (payload.height !== undefined) values.height = payload.height;\n if (payload.depth !== undefined) values.depth = payload.depth;\n if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;\n else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;\n if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;\n else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;\n if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;\n values.originalMemoryUsage = getPayloadMemoryUsage(payload);\n values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);\n\n super.SetPayload(payload);\n this.SetValues(values);\n return this;\n }\n\n /**\n * Turn source bytes into this texture.\n *\n * This is the family the route design exists for. One `.dds` is readable as a\n * compressed `texture` or decoded `rgba`, and six formats — dds, png, jpeg,\n * tga, gif, webp — populate this same resource. Which reader and which\n * representation is a registration decision, so neither is written here.\n *\n * The resource imports none of them. A texture resource that imported its\n * formats would drag all six into anything that touches a texture, which is\n * the whole reason the store exists.\n *\n * @param {ArrayBuffer|ArrayBufferView|object} data Source bytes, or a payload already read.\n * @param {object|null} [options] `{ format, read, output }` plus values applied after the read.\n * @returns {TriTextureRes} This resource.\n */\n DoLoad(data, options = null) {\n const { format = null, read = null, output = null, ...values } = options || {};\n\n // Already a payload: the manager read it, and there is nothing to route.\n if (data?.payloadType !== undefined) return this.SetPayload(data, values);\n\n const route = this.ResolveFormat(data, format ? { format, read, output } : { output });\n if (!route) throw resourceFormatRequiredError(\"TriTextureRes\", this.ext, output);\n return this.SetPayload(route.Read(data), values);\n }\n\n /**\n * Return the number of mip levels known to this texture resource.\n *\n * @returns {number}\n */\n GetMipCount() {\n return this.GetPayload()?.mipCount || this.cpuMip || 0;\n }\n\n /**\n * Return the multisample type for this texture.\n *\n * @returns {number}\n */\n GetMsaaType() {\n const payload = this.GetPayload();\n return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;\n }\n\n /**\n * Return the multisample quality for this texture.\n *\n * @returns {number}\n */\n GetMsaaQuality() {\n const payload = this.GetPayload();\n return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;\n }\n\n /**\n * Return true if this texture has received LOD requests.\n *\n * @returns {boolean}\n */\n HadLodRequests() {\n return this.hadLodRequests;\n }\n\n /**\n * Return the shader-resource-view heap index when a backend owns one.\n *\n * @returns {number}\n */\n GetSrvIndexInHeap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"GetSrvIndexInHeap\", \"Runtime-resource does not own descriptor heaps.\");\n }\n\n /**\n * Save this texture asynchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n SaveAsync(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"SaveAsync\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Save this texture synchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n Save(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"Save\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Return true if an asynchronous save is active.\n *\n * @returns {boolean}\n */\n IsSaving() {\n return false;\n }\n\n /**\n * Return true if the asynchronous save operation has completed.\n *\n * @returns {boolean}\n */\n IsSaveCompleted() {\n return true;\n }\n\n /**\n * Return true if the asynchronous save operation succeeded.\n *\n * @returns {boolean}\n */\n IsSaveSucceeded() {\n return false;\n }\n\n /**\n * Wait for an asynchronous save operation.\n *\n * @returns {boolean}\n */\n WaitForSave() {\n return this.IsSaveCompleted();\n }\n\n /**\n * Device texture allocation belongs to engine-gpu.\n *\n * @throws {Error}\n */\n CreateEmptyTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateEmptyTexture\", \"Use engine-gpu to allocate device textures.\");\n }\n\n /**\n * Render-target wrapping belongs to engine-gpu.\n *\n * @throws {Error}\n */\n SetFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"SetFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a texture copy from a render target.\n *\n * @throws {Error}\n */\n CreateAndCopyFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateAndCopyFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a device texture from a host bitmap.\n *\n * @throws {Error}\n */\n CreateFromHostBitmap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromHostBitmap\", \"Use engine-gpu to allocate and upload texture data.\");\n }\n\n /**\n * Create this texture from another texture resource.\n *\n * @throws {Error}\n */\n CreateFromTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromTexture\", \"Use engine-gpu to copy device textures.\");\n }\n\n /**\n * Return true if this texture owns a backend allocation object.\n *\n * @param {string|number} type\n * @param {string|number} object\n * @returns {boolean}\n */\n HasALObject(type, object) {\n return this.HasAdapterResource(`${type}:${object}`);\n }\n\n /**\n * Return an engine-owned texture pipeline object when attached.\n *\n * @returns {*}\n */\n GetPipeline() {\n return this.GetAdapterResource(\"pipeline\");\n }\n\n /**\n * Return memory size for the original non-LODed texture.\n *\n * @returns {number}\n */\n GetOriginalMemoryUsage() {\n return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());\n }\n\n /**\n * Store the average color reported by decoded texture data.\n *\n * @param {number} red\n * @param {number} green\n * @param {number} blue\n * @param {number} alpha\n * @returns {TriTextureRes}\n */\n SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {\n this.averageColor = [red, green, blue, alpha];\n return this;\n }\n\n /**\n * Update a texture subresource.\n *\n * @throws {Error}\n */\n UpdateSubresource() {\n throw resourceBoundaryError(\"TriTextureRes\", \"UpdateSubresource\", \"Use engine-gpu to upload texture bytes.\");\n }\n\n /**\n * Resource preparation does not decide device upload policy.\n *\n * @returns {boolean}\n */\n PrepareResources() {\n return this.IsPrepared();\n }\n\n static payload = ResourceRequirement.TEXTURE;\n}\n\nfunction getPayloadMemoryUsage(payload)\n{\n if (!payload || typeof payload !== \"object\") return 0;\n if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0)\n {\n return payload.originalMemoryUsage;\n }\n return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer\n ? payload.data.byteLength\n : 0;\n}\n\n// Declared as data rather than with decorators, so the resource tree loads from\n// source without a transform. Field order is key order, and GetValues() exports\n// in that order.\nCjsSchema.define(TriTextureRes, {\n className: \"TriTextureRes\",\n family: \"resources\",\n fields: {\n format: [ type.unknown, edit.read ],\n type: [ type.unknown, edit.persist ],\n averageColor: [ type.color, edit.read ],\n depth: [ type.uint32, edit.read ],\n cutoutHeight: [ type.float32, edit.readwrite ],\n height: [ type.uint32, edit.read ],\n lodEnabled: [ type.boolean, edit.read ],\n hadLodRequests: [ type.boolean, edit.read ],\n cpuMip: [ type.uint32, edit.read ],\n gpuMip: [ type.uint32, edit.read ],\n wrappedRenderTarget: [ type.unknown, edit.read ],\n originalResolution: [ type.uint32, edit.read ],\n originalMemoryUsage: [ type.uint64, edit.read ],\n name: [ type.string, edit.readwrite ],\n arraySize: [ type.uint32, edit.read ],\n cutoutWidth: [ type.float32, edit.readwrite ],\n width: [ type.uint32, edit.read ],\n cutoutX: [ type.float32, edit.readwrite ],\n cutoutY: [ type.float32, edit.readwrite ]\n },\n methods: {\n Initialize: [ carbon.method, impl.adapted, impl.reason(\"Carbon rasterizes a procedural path into a half-float HostBitmap and creates the GPU texture inside Initialize; this resource cannot reach a render context, so it publishes the half-float-quantized colour as an rgba32float payload. The gradient_1d branch is not ported.\") ],\n GetMipCount: [ carbon.method, impl.adapted ],\n GetMsaaType: [ carbon.method, impl.adapted ],\n GetMsaaQuality: [ carbon.method, impl.adapted ],\n HadLodRequests: [ carbon.method, impl.adapted ],\n GetSrvIndexInHeap: [ carbon.method, impl.notSupported ],\n GetTexture: [ carbon.method, impl.implemented ],\n SetTexture: [ carbon.method, impl.adapted, impl.reason(\"Carbon also copies the texture's dimensions onto the resource and fires m_onTextureChange; the payload already carries the dimensions here, and the binding parameter arms the resource's completion instead.\") ],\n SaveAsync: [ carbon.method, impl.notSupported ],\n Save: [ carbon.method, impl.notSupported ],\n IsSaving: [ carbon.method, impl.noop ],\n IsSaveCompleted: [ carbon.method, impl.noop ],\n IsSaveSucceeded: [ carbon.method, impl.noop ],\n WaitForSave: [ carbon.method, impl.noop ],\n CreateEmptyTexture: [ carbon.method, impl.notSupported ],\n SetFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateAndCopyFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateFromHostBitmap: [ carbon.method, impl.notSupported ],\n CreateFromTexture: [ carbon.method, impl.notSupported ],\n HasALObject: [ carbon.method, impl.adapted ],\n GetPipeline: [ carbon.method, impl.adapted ],\n GetOriginalMemoryUsage: [ carbon.method, impl.adapted ],\n SetAverageColor: [ carbon.method, impl.adapted ],\n UpdateSubresource: [ carbon.method, impl.notSupported ],\n PrepareResources: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["TriTextureRes","CjsResource","format","type","averageColor","depth","cutoutHeight","height","lodEnabled","hadLodRequests","cpuMip","gpuMip","wrappedRenderTarget","originalResolution","originalMemoryUsage","name","arraySize","cutoutWidth","width","cutoutX","cutoutY","constructor","values","SetValues","skipUpdate","skipEvents","Initialize","path","ext","requirement","IsSolidColorTexturePath","RasterizeSolidColor","#RasterizeProceduralTexture","rasterize","MarkLoading","payload","error","Error","code","SetError","SetPayload","MarkPrepared","texture","GetTexture","IsValid","SetTexture","Destroy","options","validator","ResourcePayloadType","RGBA","validateRgbaPayload","TEXTURE","validateTexturePayload","VIDEO","validateVideoPayload","payloadType","resourcePayloadError","validateResourcePayload","pixelFormat","undefined","Array","isArray","faces","length","mipCount","getPayloadMemoryUsage","Math","max","DoLoad","data","read","output","route","ResolveFormat","resourceFormatRequiredError","Read","GetMipCount","GetPayload","GetMsaaType","multiSampleType","msaaType","samples","GetMsaaQuality","multiSampleQuality","msaaQuality","HadLodRequests","GetSrvIndexInHeap","resourceBoundaryError","SaveAsync","Save","IsSaving","IsSaveCompleted","IsSaveSucceeded","WaitForSave","CreateEmptyTexture","SetFromRenderTarget","CreateAndCopyFromRenderTarget","CreateFromHostBitmap","CreateFromTexture","HasALObject","object","HasAdapterResource","GetPipeline","GetAdapterResource","GetOriginalMemoryUsage","SetAverageColor","red","green","blue","alpha","UpdateSubresource","PrepareResources","IsPrepared","ResourceRequirement","Number","isSafeInteger","ArrayBuffer","isView","byteLength","CjsSchema","define","className","family","fields","unknown","edit","persist","color","uint32","float32","readwrite","boolean","uint64","string","methods","carbon","method","impl","adapted","reason","notSupported","implemented","noop"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,WAAW,CAC9C;AACEC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3BC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,YAAY,GAAG,CAAC;AAChBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,UAAU,GAAG,KAAK;AAClBC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,kBAAkB,GAAG,CAAC;AACtBC,EAAAA,mBAAmB,GAAG,CAAC;AACvBC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,CAAC;AACbC,EAAAA,WAAW,GAAG,CAAC;AACfC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,OAAO,GAAG,CAAC;AACXC,EAAAA,OAAO,GAAG,CAAC;;AAEX;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EAAE;AACzB,IAAA,KAAK,EAAE;A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B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACG,YAAY,CAAE;IACvD7B,gBAAgB,EAAE,CAAEwB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AACjD;AACF,CAAC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TriTextureRes.js","sources":["../../../../src/resource/texture/TriTextureRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.h\n// Source: trinity/trinity/Resources/TriTextureRes.cpp\n// Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp\nimport { CjsSchema, carbon, impl, edit, type } from \"#schema\";\nimport { HostBitmap } from \"#imageio\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { IsSolidColorTexturePath, RasterizeSolidColor } from \"./solidColorTexture.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\nimport {\n ResourcePayloadType,\n validateRgbaPayload,\n validateTexturePayload,\n validateVideoPayload\n} from \"../format/payloadContract.js\";\nimport {\n resourceBoundaryError,\n resourceFormatRequiredError,\n resourcePayloadError,\n validateResourcePayload\n} from \"../resourceBoundary.js\";\n\n/**\n * Resource record that owns Carbon-style texture identity and validated\n * texture, RGBA, or video payload facts with mirrored dimension/format\n * metadata, while engine packages decide what those facts become on a device.\n *\n * The resource never CREATES a backend texture - it cannot reach a render\n * context - but it RETAINS the one Trinity makes for it, as Carbon's does\n * (`m_texture`), so every parameter sharing the resource binds one texture.\n */\nexport class TriTextureRes extends CjsResource\n{\n format = null;\n type = null;\n averageColor = [0, 0, 0, 0];\n depth = 0;\n cutoutHeight = 1;\n height = 0;\n lodEnabled = false;\n hadLodRequests = false;\n cpuMip = 0;\n gpuMip = 0;\n wrappedRenderTarget = null;\n originalResolution = 0;\n originalMemoryUsage = 0;\n name = \"\";\n arraySize = 0;\n cutoutWidth = 1;\n width = 0;\n cutoutX = 0;\n cutoutY = 0;\n\n /** Creates a TriTextureRes with caller-provided initial state. */\n constructor(values = null) {\n super();\n this.SetValues(values || {}, {\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Carbon's Initialize, with its procedural branch (TriTextureRes.cpp:223-236):\n * a `dynamic:/color/` path is rasterized here rather than loaded from source.\n * The `dynamic:/gradient_1d/` branch Carbon checks first is rasterized by\n * trinity's GradientTextureConstructor instead: a gradient needs Tr2CurveScalar,\n * which this layer may not import.\n *\n * @param {string} path Resource path.\n * @param {string|null} [ext] Extension override.\n * @param {string} [requirement] Semantic requirement.\n * @returns {TriTextureRes} This resource.\n */\n Initialize(path, ext = null, requirement = \"\") {\n super.Initialize(path, ext, requirement);\n if (IsSolidColorTexturePath(this.path)) this.#RasterizeProceduralTexture(RasterizeSolidColor);\n return this;\n }\n\n /**\n * `RasterizeProceduralTexture` (TriTextureRes.cpp:181-212). Carbon creates the\n * GPU texture from the bitmap here; this layer cannot reach a render context,\n * so it publishes the bitmap as the payload and Trinity makes the texture at\n * first bind, as it does for every other texture.\n *\n * @param {Function} rasterize `(path) => HostBitmap | null`.\n * @returns {void}\n */\n #RasterizeProceduralTexture(rasterize) {\n this.MarkLoading();\n const bitmap = rasterize(this.path);\n if (!bitmap) {\n // Carbon: \"Failed to parse dynamic:/color/%s texture path\", and the\n // texture is never prepared.\n const error = new Error(`Failed to parse ${this.path} texture path`);\n error.code = \"CJS_TEXTURE_PROCEDURAL_PATH_INVALID\";\n error.path = this.path;\n this.SetError(error);\n return;\n }\n this.SetPayload(bitmap);\n this.MarkPrepared();\n }\n\n /**\n * m_texture: the live `Tr2TextureAL`, or null until an engine makes one.\n *\n * Carbon creates it in `DoPrepare` through the main-thread context and\n * stores it here (`TriTextureRes.cpp:690-704`). This layer cannot reach a\n * render context, so Trinity creates it at first bind and stores it here,\n * where every parameter sharing the resource finds the one texture.\n */\n texture = null;\n\n /** m_loadedBitmap: the decoded image the texture is made from, or null. */\n loadedBitmap = null;\n\n /**\n * The live texture, or null while there is none - Carbon returns nullptr\n * until the load finishes and the parameter substitutes the fallback\n * (`TriTextureRes.cpp:394-405`).\n *\n * @returns {object|null} A `Tr2TextureAL`.\n */\n GetTexture() {\n return this.texture && this.texture.IsValid() ? this.texture : null;\n }\n\n /**\n * Adopts a texture as this resource's (`TriTextureRes.cpp:1159-1195`).\n *\n * @param {object|null} texture A `Tr2TextureAL`, or null to drop it.\n * @returns {TriTextureRes} This resource.\n */\n SetTexture(texture) {\n if (this.texture && this.texture !== texture) this.texture.Destroy();\n this.texture = texture ?? null;\n return this;\n }\n\n /**\n * Build this texture from a texture pipeline: Carbon's `.ctr` route\n * (`TriTextureRes.cpp:238-258` then `ResourcePrepFinished`, `:296-340`).\n *\n * Every path the pipeline names is loaded as a raw `Tr2ImageRes` (Carbon asks\n * for the `\"raw\"` requirement; ours is `ResourceRequirement.IMAGE`), the\n * pipeline runs once they have all settled, and the result becomes this\n * texture's bitmap. An input that failed to load reaches the pipeline as\n * null, exactly as Carbon passes it, so the step that needed it fails.\n *\n * adapted: Carbon reads the pipeline from a `.ctr` file with\n * `BeResMan->LoadObject` and waits on a fence. No shipped build contains a\n * `.ctr` (checked across 45 resfileindexes, 2026-09-24), so the pipeline is\n * handed in - built in memory by the `dynamic:/` constructors that use this\n * route - and the fence is a promise. The manager is passed because the\n * resource layer has no global `BeResMan`.\n *\n * quirk: Carbon marks the resource good even when the pipeline fails\n * (`m_isGood = true` after the branch, `:337`), so the texture is simply\n * absent and the parameter binds its fallback. Reproduced: the resource is\n * prepared either way, with no bitmap when the pipeline failed.\n *\n * @param {import(\"./Tr2TexturePipeline.js\").Tr2TexturePipeline} pipeline The recipe.\n * @param {object} resourceManager The `CjsResMan` that loads its inputs.\n * @returns {Promise<boolean>} Whether the pipeline produced a bitmap.\n */\n async LoadPipeline(pipeline, resourceManager) {\n this.MarkLoading();\n\n const images = new Map();\n\n for (const path of pipeline.GetResourceDependencies()) {\n images.set(path, resourceManager.GetResource(path, { requirement: ResourceRequirement.IMAGE }));\n }\n\n // Carbon's m_pipelineFence: wait for every input, whatever became of it.\n await Promise.allSettled([ ...images.values() ].map(image => image.Ready()));\n\n // Carbon: it->second && it->second->IsGood() ? &it->second->GetBitmap() : nullptr\n const inputs = new Map();\n\n for (const [ path, image ] of images) {\n inputs.set(path, image.IsGood() ? image.GetBitmap() : null);\n }\n\n const result = new HostBitmap();\n const executed = pipeline.Execute(result, inputs);\n\n if (executed) this.SetPayload(result);\n\n this.MarkPrepared();\n return executed;\n }\n\n /**\n * Adopt the cutout an image declared (Carbon reads ImageIO::Metadata's\n * cutout in DoPrepare and stores it as m_cutoutX/Y/Width/Height).\n *\n * @param {{x: number, y: number, width: number, height: number}} cutout The rectangle.\n * @returns {TriTextureRes} This resource.\n */\n SetCutout(cutout) {\n this.SetValues({\n cutoutX: cutout.x,\n cutoutY: cutout.y,\n cutoutWidth: cutout.width,\n cutoutHeight: cutout.height\n });\n return this;\n }\n\n /**\n * The decoded bitmap this resource was loaded from, or null.\n *\n * Carbon's `m_loadedBitmap` (`TriTextureRes.cpp:606`): the CPU-side image\n * the texture is made from, kept so the texture can be remade - for a device\n * reset, a LOD change or a save.\n *\n * @returns {import(\"#imageio\").HostBitmap|null} The bitmap.\n */\n GetBitmap() {\n return this.loadedBitmap;\n }\n\n /**\n * Adopt a decoded bitmap as this resource's image\n * (`TriTextureRes::CreateFromHostBitmap`, `TriTextureRes.cpp:960-978`).\n *\n * adapted: Carbon creates the texture here, on the main thread's render\n * context (`USE_MAIN_THREAD_RENDER_CONTEXT`). The resource layer may not\n * reach a render context (layers.json), so the texture is made on first bind\n * instead - `Tr2ImageIOHelpers.RealizeTexture` - and this only adopts the\n * bitmap and drops any texture made from the previous one.\n *\n * @param {import(\"#imageio\").HostBitmap|null} bitmap The decoded bitmap.\n * @returns {boolean} Whether the bitmap was adopted.\n */\n CreateFromHostBitmap(bitmap) {\n this.SetTexture(null);\n\n if (!bitmap || !bitmap.IsValid()) {\n this.loadedBitmap = null;\n return false;\n }\n\n this.loadedBitmap = bitmap;\n this.SetValues({\n format: bitmap.GetFormat(),\n width: bitmap.GetWidth(),\n height: bitmap.GetHeight(),\n depth: bitmap.GetDepth(),\n arraySize: bitmap.GetArraySize(),\n cpuMip: bitmap.GetTrueMipCount()\n });\n return true;\n }\n\n /**\n * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed\n * metadata. Invalid payloads are rejected before replacing the current one.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {TriTextureRes}\n */\n SetPayload(payload = null, options = null) {\n if (payload === null) {\n // The bytes are gone; so is the texture made from them.\n this.SetTexture(null);\n this.loadedBitmap = null;\n super.SetPayload(null);\n return this;\n }\n\n // Carbon's resource IS its bitmap (TriTextureRes.cpp:606, 960-978).\n const bitmap = CjsSchema.cast(payload, HostBitmap);\n\n if (bitmap) {\n this.CreateFromHostBitmap(bitmap);\n super.SetPayload(bitmap, options);\n if (options) this.SetValues(options);\n if (bitmap.metadata?.cutout) this.SetCutout(bitmap.metadata.cutout);\n return this;\n }\n\n // A video frame source is the one payload left: it is not an image the\n // CPU decoded, it is a playing element the backend samples.\n if (payload?.payloadType !== ResourcePayloadType.VIDEO) {\n throw resourcePayloadError(\n \"TriTextureRes\",\n 'Expected an ImageIO::HostBitmap, or payloadType \"video\".',\n \"payloadType\"\n );\n }\n const validator = validateVideoPayload;\n validateResourcePayload(\"TriTextureRes\", payload, validator);\n\n const values = { ...(options || {}) };\n if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;\n if (payload.width !== undefined) values.width = payload.width;\n if (payload.height !== undefined) values.height = payload.height;\n if (payload.depth !== undefined) values.depth = payload.depth;\n if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;\n else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;\n if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;\n else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;\n if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;\n values.originalMemoryUsage = getPayloadMemoryUsage(payload);\n values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);\n\n super.SetPayload(payload);\n this.SetValues(values);\n return this;\n }\n\n /**\n * Turn source bytes into this texture.\n *\n * This is the family the route design exists for. One `.dds` is readable as a\n * compressed `texture` or decoded `rgba`, and six formats — dds, png, jpeg,\n * tga, gif, webp — populate this same resource. Which reader and which\n * representation is a registration decision, so neither is written here.\n *\n * The resource imports none of them. A texture resource that imported its\n * formats would drag all six into anything that touches a texture, which is\n * the whole reason the store exists.\n *\n * @param {ArrayBuffer|ArrayBufferView|object} data Source bytes, or a payload already read.\n * @param {object|null} [options] `{ format, read, output }` plus values applied after the read.\n * @returns {TriTextureRes} This resource.\n */\n DoLoad(data, options = null) {\n const { format = null, read = null, output = null, ...values } = options || {};\n\n // Already a payload: the manager read it, and there is nothing to route.\n if (data?.payloadType !== undefined) return this.SetPayload(data, values);\n\n const route = this.ResolveFormat(data, format ? { format, read, output } : { output });\n if (!route) throw resourceFormatRequiredError(\"TriTextureRes\", this.ext, output);\n return this.SetPayload(route.Read(data), values);\n }\n\n /**\n * Return the number of mip levels known to this texture resource.\n *\n * @returns {number}\n */\n GetMipCount() {\n return this.GetPayload()?.mipCount || this.cpuMip || 0;\n }\n\n /**\n * Return the multisample type for this texture.\n *\n * @returns {number}\n */\n GetMsaaType() {\n // Carbon: m_texture ? m_texture->GetMsaaDesc().samples : 1 (cpp:1214-1216).\n const texture = this.GetTexture();\n return texture ? texture.GetMsaaDesc().samples : 1;\n }\n\n /**\n * Return the multisample quality for this texture.\n *\n * @returns {number}\n */\n GetMsaaQuality() {\n // Carbon: m_texture ? m_texture->GetMsaaDesc().quality : 0 (cpp:1219-1222).\n const texture = this.GetTexture();\n return texture ? texture.GetMsaaDesc().quality : 0;\n }\n\n /**\n * Return true if this texture has received LOD requests.\n *\n * @returns {boolean}\n */\n HadLodRequests() {\n return this.hadLodRequests;\n }\n\n /**\n * Return the shader-resource-view heap index when a backend owns one.\n *\n * @returns {number}\n */\n GetSrvIndexInHeap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"GetSrvIndexInHeap\", \"Runtime-resource does not own descriptor heaps.\");\n }\n\n /**\n * Save this texture asynchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n SaveAsync(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"SaveAsync\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Save this texture synchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n Save(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"Save\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Return true if an asynchronous save is active.\n *\n * @returns {boolean}\n */\n IsSaving() {\n return false;\n }\n\n /**\n * Return true if the asynchronous save operation has completed.\n *\n * @returns {boolean}\n */\n IsSaveCompleted() {\n return true;\n }\n\n /**\n * Return true if the asynchronous save operation succeeded.\n *\n * @returns {boolean}\n */\n IsSaveSucceeded() {\n return false;\n }\n\n /**\n * Wait for an asynchronous save operation.\n *\n * @returns {boolean}\n */\n WaitForSave() {\n return this.IsSaveCompleted();\n }\n\n /**\n * Device texture allocation belongs to engine-gpu.\n *\n * @throws {Error}\n */\n CreateEmptyTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateEmptyTexture\", \"Use engine-gpu to allocate device textures.\");\n }\n\n /**\n * Render-target wrapping belongs to engine-gpu.\n *\n * @throws {Error}\n */\n SetFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"SetFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a texture copy from a render target.\n *\n * @throws {Error}\n */\n CreateAndCopyFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateAndCopyFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create this texture from another texture resource.\n *\n * @throws {Error}\n */\n CreateFromTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromTexture\", \"Use engine-gpu to copy device textures.\");\n }\n\n /**\n * Return true if this texture owns a backend allocation object.\n *\n * @param {string|number} type\n * @param {string|number} object\n * @returns {boolean}\n */\n HasALObject(type, object) {\n return this.HasAdapterResource(`${type}:${object}`);\n }\n\n /**\n * Return an engine-owned texture pipeline object when attached.\n *\n * @returns {*}\n */\n GetPipeline() {\n return this.GetAdapterResource(\"pipeline\");\n }\n\n /**\n * Return memory size for the original non-LODed texture.\n *\n * @returns {number}\n */\n GetOriginalMemoryUsage() {\n return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());\n }\n\n /**\n * Store the average color reported by decoded texture data.\n *\n * @param {number} red\n * @param {number} green\n * @param {number} blue\n * @param {number} alpha\n * @returns {TriTextureRes}\n */\n SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {\n this.averageColor = [red, green, blue, alpha];\n return this;\n }\n\n /**\n * Update a texture subresource.\n *\n * @throws {Error}\n */\n UpdateSubresource() {\n throw resourceBoundaryError(\"TriTextureRes\", \"UpdateSubresource\", \"Use engine-gpu to upload texture bytes.\");\n }\n\n /**\n * Resource preparation does not decide device upload policy.\n *\n * @returns {boolean}\n */\n PrepareResources() {\n return this.IsPrepared();\n }\n\n static payload = ResourceRequirement.TEXTURE;\n}\n\nfunction getPayloadMemoryUsage(payload)\n{\n if (!payload || typeof payload !== \"object\") return 0;\n if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0)\n {\n return payload.originalMemoryUsage;\n }\n return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer\n ? payload.data.byteLength\n : 0;\n}\n\n// Declared as data rather than with decorators, so the resource tree loads from\n// source without a transform. Field order is key order, and GetValues() exports\n// in that order.\nCjsSchema.define(TriTextureRes, {\n className: \"TriTextureRes\",\n family: \"resources\",\n fields: {\n format: [ type.unknown, edit.read ],\n type: [ type.unknown, edit.persist ],\n averageColor: [ type.color, edit.read ],\n depth: [ type.uint32, edit.read ],\n cutoutHeight: [ type.float32, edit.readwrite ],\n height: [ type.uint32, edit.read ],\n lodEnabled: [ type.boolean, edit.read ],\n hadLodRequests: [ type.boolean, edit.read ],\n cpuMip: [ type.uint32, edit.read ],\n gpuMip: [ type.uint32, edit.read ],\n wrappedRenderTarget: [ type.unknown, edit.read ],\n originalResolution: [ type.uint32, edit.read ],\n originalMemoryUsage: [ type.uint64, edit.read ],\n name: [ type.string, edit.readwrite ],\n arraySize: [ type.uint32, edit.read ],\n cutoutWidth: [ type.float32, edit.readwrite ],\n width: [ type.uint32, edit.read ],\n cutoutX: [ type.float32, edit.readwrite ],\n cutoutY: [ type.float32, edit.readwrite ],\n loadedBitmap: [ type.unknown, edit.read ]\n },\n methods: {\n Initialize: [ carbon.method, impl.adapted, impl.reason(\"Carbon rasterizes a procedural path into a half-float HostBitmap and creates the GPU texture inside Initialize; this resource cannot reach a render context, so it publishes the half-float-quantized colour as an rgba32float payload. The gradient_1d branch is not ported.\") ],\n GetMipCount: [ carbon.method, impl.adapted ],\n GetMsaaType: [ carbon.method, impl.implemented ],\n GetMsaaQuality: [ carbon.method, impl.implemented ],\n HadLodRequests: [ carbon.method, impl.adapted ],\n GetSrvIndexInHeap: [ carbon.method, impl.notSupported ],\n GetTexture: [ carbon.method, impl.implemented ],\n SetTexture: [ carbon.method, impl.adapted, impl.reason(\"Carbon also copies the texture's dimensions onto the resource and fires m_onTextureChange; the payload already carries the dimensions here, and the binding parameter arms the resource's completion instead.\") ],\n SaveAsync: [ carbon.method, impl.notSupported ],\n Save: [ carbon.method, impl.notSupported ],\n IsSaving: [ carbon.method, impl.noop ],\n IsSaveCompleted: [ carbon.method, impl.noop ],\n IsSaveSucceeded: [ carbon.method, impl.noop ],\n WaitForSave: [ carbon.method, impl.noop ],\n CreateEmptyTexture: [ carbon.method, impl.notSupported ],\n SetFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateAndCopyFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateFromHostBitmap: [ carbon.method, impl.adapted, impl.reason(\"Carbon creates the texture here on the main thread's render context; the resource layer may not reach one, so this adopts the bitmap and the texture is made on first bind (Tr2ImageIOHelpers.RealizeTexture).\") ],\n LoadPipeline: [ impl.adapted, impl.reason(\"Carbon's .ctr branch reads the pipeline from a file through the global BeResMan and waits on a fence; no shipped build has a .ctr, so the pipeline is handed in, the manager passed, and the fence is a promise.\") ],\n SetCutout: [ impl.custom, impl.reason(\"Carbon reads the cutout from ImageIO::Metadata inside DoPrepare; the read happens in the loader here, so the resource is told.\") ],\n GetBitmap: [ impl.custom, impl.reason(\"Carbon keeps m_loadedBitmap private and uploads it inside CreateFromHostBitmap; the upload happens at bind time here, so the bitmap has to be readable.\") ],\n CreateFromTexture: [ carbon.method, impl.notSupported ],\n HasALObject: [ carbon.method, impl.adapted ],\n GetPipeline: [ carbon.method, impl.adapted ],\n GetOriginalMemoryUsage: [ carbon.method, impl.adapted ],\n SetAverageColor: [ carbon.method, impl.adapted ],\n UpdateSubresource: [ carbon.method, impl.notSupported ],\n PrepareResources: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["TriTextureRes","CjsResource","format","type","averageColor","depth","cutoutHeight","height","lodEnabled","hadLodRequests","cpuMip","gpuMip","wrappedRenderTarget","originalResolution","originalMemoryUsage","name","arraySize","cutoutWidth","width","cutoutX","cutoutY","constructor","values","SetValues","skipUpdate","skipEvents","Initialize","path","ext","requirement","IsSolidColorTexturePath","RasterizeSolidColor","#RasterizeProceduralTexture","rasterize","MarkLoading","bitmap","error","Error","code","SetError","SetPayload","MarkPrepared","texture","loadedBitmap","GetTexture","IsValid","SetTexture","Destroy","LoadPipeline","pipeline","resourceManager","images","Map","GetResourceDependencies","set","GetResource","ResourceRequirement","IMAGE","Promise","allSettled","map","image","Ready","inputs","IsGood","GetBitmap","result","HostBitmap","executed","Execute","SetCutout","cutout","x","y","CreateFromHostBitmap","GetFormat","GetWidth","GetHeight","GetDepth","GetArraySize","GetTrueMipCount","payload","options","CjsSchema","cast","metadata","payloadType","ResourcePayloadType","VIDEO","resourcePayloadError","validator","validateVideoPayload","validateResourcePayload","pixelFormat","undefined","Array","isArray","faces","length","mipCount","RGBA","getPayloadMemoryUsage","Math","max","DoLoad","data","read","output","route","ResolveFormat","resourceFormatRequiredError","Read","GetMipCount","GetPayload","GetMsaaType","GetMsaaDesc","samples","GetMsaaQuality","quality","HadLodRequests","GetSrvIndexInHeap","resourceBoundaryError","SaveAsync","Save","IsSaving","IsSaveCompleted","IsSaveSucceeded","WaitForSave","CreateEmptyTexture","SetFromRenderTarget","CreateAndCopyFromRenderTarget","CreateFromTexture","HasALObject","object","HasAdapterResource","GetPipeline","GetAdapterResource","GetOriginalMemoryUsage","SetAverageColor","red","green","blue","alpha","UpdateSubresource","PrepareResources","IsPrepared","TEXTURE","Number","isSafeInteger","ArrayBuffer","isView","byteLength","define","className","family","fields","unknown","edit","persist","color","uint32","float32","readwrite","boolean","uint64","string","methods","carbon","method","impl","adapted","reason","implemented","notSupported","noop","custom"],"mappings":";;;;;;;;AAAA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,WAAW,CAC9C;AACEC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3BC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,YAAY,GAAG,CAAC;AAChBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,UAAU,GAAG,KAAK;AAClBC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,kBAAkB,GAAG,CAAC;AACtBC,EAAAA,mBAAmB,GAAG,CAAC;AACvBC,E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M,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,gNAAgN,CAAC,CAAE;AACpR3H,IAAAA,YAAY,EAAE,CAAEyH,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,kNAAkN,CAAC,CAAE;AAC/PrG,IAAAA,SAAS,EAAE,CAAEmG,IAAI,CAACM,MAAM,EAAEN,IAAI,CAACE,MAAM,CAAC,gIAAgI,CAAC,CAAE;AACzK1G,IAAAA,SAAS,EAAE,CAAEwG,IAAI,CAACM,MAAM,EAAEN,IAAI,CAACE,MAAM,CAAC,yJAAyJ,CAAC,CAAE;IAClMxC,iBAAiB,EAAE,CAAEoC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACI,YAAY,CAAE;IACvDzC,WAAW,EAAE,CAAEmC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC5CnC,WAAW,EAAE,CAAEgC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC5CjC,sBAAsB,EAAE,CAAE8B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACvDhC,eAAe,EAAE,CAAE6B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAChD3B,iBAAiB,EAAE,CAAEwB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACI,YAAY,CAAE;IACvD7B,gBAAgB,EAAE,CAAEuB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AACjD;AACF,CAAC,CAAC;;;;"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export { CjsTextureArrayConstructor, RegisterTextureArray, TextureArrayPrefix } from './CjsTextureArrayConstructor.js';
|
|
2
|
+
export { CjsTexturePipelineStepArray } from './CjsTexturePipelineStepArray.js';
|
|
3
|
+
export { CjsTexturePipelineStepPack } from './CjsTexturePipelineStepPack.js';
|
|
4
|
+
export { CjsTexturePackConstructor, RegisterTexturePack, TexturePackPrefix } from './CjsTexturePackConstructor.js';
|
|
5
|
+
export { CjsTexturePipelineStepConvert } from './CjsTexturePipelineStepConvert.js';
|
|
6
|
+
export { CjsTexturePipelineStepResize } from './CjsTexturePipelineStepResize.js';
|
|
7
|
+
export { RegisterTextureResources, TextureResourceExtensions } from './registerTextureResources.js';
|
|
1
8
|
export { CjsTextureArrayRes } from './CjsTextureArrayRes.js';
|
|
2
9
|
export { CjsTextureArrayResParameterProxy } from './CjsTextureArrayResParameterProxy.js';
|
|
3
10
|
export { RegisterSolidColorTexture, SolidColorTextureConstructor } from './SolidColorTextureConstructor.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { HostBitmap, Metadata, LoadParameters } from '#imageio';
|
|
2
|
+
import { ImageIO } from '../imageio/ImageIO.js';
|
|
3
|
+
import { TriTextureRes } from './TriTextureRes.js';
|
|
4
|
+
import { Tr2ImageRes } from './Tr2ImageRes.js';
|
|
5
|
+
import { ResourceRequirement } from '../ResourceRequirement.js';
|
|
6
|
+
|
|
7
|
+
// Source: trinity/trinity/Resources/TriTextureRes.cpp:39-55
|
|
8
|
+
// BLUE_REGISTER_RESOURCE_EXTENSION for each image extension -> CreateTextureResource.
|
|
9
|
+
// Source: trinity/trinity/Resources/Tr2ImageRes.cpp:39-52 (DoLoad reads into m_bitmap)
|
|
10
|
+
//
|
|
11
|
+
// Carbon registers at static-initialisation time inside the class's own
|
|
12
|
+
// translation unit, and its resource reads the file with `ImageIO::ReadImage`
|
|
13
|
+
// into its own `HostBitmap`. We do not self-register at module scope - the same
|
|
14
|
+
// reason `RegisterShaderResources` does not - so this is an explicit call made
|
|
15
|
+
// by whoever composes a manager.
|
|
16
|
+
//
|
|
17
|
+
// The read is the loader rather than the resource's own `DoLoad` because one
|
|
18
|
+
// format needs it: PNG decodes through `DecompressionStream`, which is
|
|
19
|
+
// asynchronous, and `SetPayload` is not. The loader therefore does what
|
|
20
|
+
// Carbon's DoLoad does, and hands the resource the finished bitmap.
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The image extensions Carbon routes to a texture resource
|
|
24
|
+
* (`TriTextureRes.cpp:46-55`).
|
|
25
|
+
*
|
|
26
|
+
* Carbon lists dds, png, sdd, tga, jpg, jpeg, bmp, ecs, ctr and vta. These are
|
|
27
|
+
* the ones an image handler is registered for here; `bmp`, `ecs`, `sdd`,
|
|
28
|
+
* `ctr` and `vta` join their handlers as those land.
|
|
29
|
+
*/
|
|
30
|
+
const TextureResourceExtensions = Object.freeze(["dds", "png", "jpg", "jpeg", "tga", "gif"]);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Read one image into a bitmap, as Carbon's `DoLoad` does.
|
|
34
|
+
*
|
|
35
|
+
* @param {Uint8Array|ArrayBuffer} bytes The file's bytes.
|
|
36
|
+
* @param {object} context The manager's prepare context.
|
|
37
|
+
* @returns {Promise<HostBitmap>} The decoded bitmap.
|
|
38
|
+
*/
|
|
39
|
+
async function ReadImageResource(bytes, context) {
|
|
40
|
+
const bitmap = new HostBitmap();
|
|
41
|
+
const metadata = new Metadata();
|
|
42
|
+
const path = context.path;
|
|
43
|
+
const result = await ImageIO.readImageAsync(bytes, new LoadParameters(path), bitmap, metadata);
|
|
44
|
+
|
|
45
|
+
// Carbon: CCP_LOGWARN("Tr2ImageRes: error reading '%S' - %s") and LR_FAILED.
|
|
46
|
+
if (!result.IsOk()) {
|
|
47
|
+
const error = new Error(`${path || "image"}: ${result.GetErrorMessage()}`);
|
|
48
|
+
error.code = "CJS_RESOURCE_IMAGE_READ_FAILED";
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
bitmap.metadata = metadata;
|
|
52
|
+
return bitmap;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Routes every image extension to a texture resource on one manager.
|
|
57
|
+
*
|
|
58
|
+
* @param {object} resourceManager Manager to register on.
|
|
59
|
+
* @param {object} [options] `{ Handler }` to route to `Tr2ImageRes` instead.
|
|
60
|
+
* @returns {object} The same manager, for chaining.
|
|
61
|
+
*/
|
|
62
|
+
function RegisterTextureResources(resourceManager, options = {}) {
|
|
63
|
+
if (typeof resourceManager?.RegisterExtension !== "function" || typeof resourceManager?.RegisterObjectLoader !== "function") {
|
|
64
|
+
throw new TypeError("RegisterTextureResources requires a CjsResMan.");
|
|
65
|
+
}
|
|
66
|
+
const Handler = options.Handler ?? TriTextureRes;
|
|
67
|
+
if (Handler !== TriTextureRes && Handler !== Tr2ImageRes) {
|
|
68
|
+
throw new TypeError("RegisterTextureResources routes to TriTextureRes or Tr2ImageRes.");
|
|
69
|
+
}
|
|
70
|
+
for (const extension of TextureResourceExtensions) {
|
|
71
|
+
resourceManager.RegisterObjectLoader(extension, ReadImageResource);
|
|
72
|
+
resourceManager.RegisterExtension(extension, Handler);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Carbon asks for the same file as a texture or as a "raw" image; the
|
|
76
|
+
// requirement picks the class and keeps a separate cache entry for each.
|
|
77
|
+
resourceManager.RegisterResourceType(ResourceRequirement.TEXTURE, TriTextureRes);
|
|
78
|
+
resourceManager.RegisterResourceType(ResourceRequirement.IMAGE, Tr2ImageRes);
|
|
79
|
+
return resourceManager;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { RegisterTextureResources, TextureResourceExtensions };
|
|
83
|
+
//# sourceMappingURL=registerTextureResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerTextureResources.js","sources":["../../../../src/resource/texture/registerTextureResources.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.cpp:39-55\n// BLUE_REGISTER_RESOURCE_EXTENSION for each image extension -> CreateTextureResource.\n// Source: trinity/trinity/Resources/Tr2ImageRes.cpp:39-52 (DoLoad reads into m_bitmap)\n//\n// Carbon registers at static-initialisation time inside the class's own\n// translation unit, and its resource reads the file with `ImageIO::ReadImage`\n// into its own `HostBitmap`. We do not self-register at module scope - the same\n// reason `RegisterShaderResources` does not - so this is an explicit call made\n// by whoever composes a manager.\n//\n// The read is the loader rather than the resource's own `DoLoad` because one\n// format needs it: PNG decodes through `DecompressionStream`, which is\n// asynchronous, and `SetPayload` is not. The loader therefore does what\n// Carbon's DoLoad does, and hands the resource the finished bitmap.\nimport { HostBitmap, LoadParameters, Metadata } from \"#imageio\";\nimport { ImageIO } from \"../imageio/ImageIO.js\";\nimport { TriTextureRes } from \"./TriTextureRes.js\";\nimport { Tr2ImageRes } from \"./Tr2ImageRes.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\n\n\n/**\n * The image extensions Carbon routes to a texture resource\n * (`TriTextureRes.cpp:46-55`).\n *\n * Carbon lists dds, png, sdd, tga, jpg, jpeg, bmp, ecs, ctr and vta. These are\n * the ones an image handler is registered for here; `bmp`, `ecs`, `sdd`,\n * `ctr` and `vta` join their handlers as those land.\n */\nexport const TextureResourceExtensions = Object.freeze([\n \"dds\",\n \"png\",\n \"jpg\",\n \"jpeg\",\n \"tga\",\n \"gif\"\n]);\n\n\n/**\n * Read one image into a bitmap, as Carbon's `DoLoad` does.\n *\n * @param {Uint8Array|ArrayBuffer} bytes The file's bytes.\n * @param {object} context The manager's prepare context.\n * @returns {Promise<HostBitmap>} The decoded bitmap.\n */\nasync function ReadImageResource(bytes, context)\n{\n const bitmap = new HostBitmap();\n const metadata = new Metadata();\n const path = context.path;\n const result = await ImageIO.readImageAsync(bytes, new LoadParameters(path), bitmap, metadata);\n\n // Carbon: CCP_LOGWARN(\"Tr2ImageRes: error reading '%S' - %s\") and LR_FAILED.\n if (!result.IsOk())\n {\n const error = new Error(`${path || \"image\"}: ${result.GetErrorMessage()}`);\n error.code = \"CJS_RESOURCE_IMAGE_READ_FAILED\";\n throw error;\n }\n\n bitmap.metadata = metadata;\n return bitmap;\n}\n\n\n/**\n * Routes every image extension to a texture resource on one manager.\n *\n * @param {object} resourceManager Manager to register on.\n * @param {object} [options] `{ Handler }` to route to `Tr2ImageRes` instead.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterTextureResources(resourceManager, options = {})\n{\n if (typeof resourceManager?.RegisterExtension !== \"function\"\n || typeof resourceManager?.RegisterObjectLoader !== \"function\")\n {\n throw new TypeError(\"RegisterTextureResources requires a CjsResMan.\");\n }\n\n const Handler = options.Handler ?? TriTextureRes;\n\n if (Handler !== TriTextureRes && Handler !== Tr2ImageRes)\n {\n throw new TypeError(\"RegisterTextureResources routes to TriTextureRes or Tr2ImageRes.\");\n }\n\n for (const extension of TextureResourceExtensions)\n {\n resourceManager.RegisterObjectLoader(extension, ReadImageResource);\n resourceManager.RegisterExtension(extension, Handler);\n }\n\n // Carbon asks for the same file as a texture or as a \"raw\" image; the\n // requirement picks the class and keeps a separate cache entry for each.\n resourceManager.RegisterResourceType(ResourceRequirement.TEXTURE, TriTextureRes);\n resourceManager.RegisterResourceType(ResourceRequirement.IMAGE, Tr2ImageRes);\n\n return resourceManager;\n}\n"],"names":["TextureResourceExtensions","Object","freeze","ReadImageResource","bytes","context","bitmap","HostBitmap","metadata","Metadata","path","result","ImageIO","readImageAsync","LoadParameters","IsOk","error","Error","GetErrorMessage","code","RegisterTextureResources","resourceManager","options","RegisterExtension","RegisterObjectLoader","TypeError","Handler","TriTextureRes","Tr2ImageRes","extension","RegisterResourceType","ResourceRequirement","TEXTURE","IMAGE"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,GAAGC,MAAM,CAACC,MAAM,CAAC,CACrD,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,E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AAA,KAAK,MAAMI,SAAS,IAAI7B,yBAAyB,EACjD;AACEqB,IAAAA,eAAe,CAACG,oBAAoB,CAACK,SAAS,EAAE1B,iBAAiB,CAAC;AAClEkB,IAAAA,eAAe,CAACE,iBAAiB,CAACM,SAAS,EAAEH,OAAO,CAAC;AACvD,EAAA;;AAEA;AACA;EACAL,eAAe,CAACS,oBAAoB,CAACC,mBAAmB,CAACC,OAAO,EAAEL,aAAa,CAAC;EAChFN,eAAe,CAACS,oBAAoB,CAACC,mBAAmB,CAACE,KAAK,EAAEL,WAAW,CAAC;AAE5E,EAAA,OAAOP,eAAe;AACxB;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { HostBitmap } from '#imageio';
|
|
2
|
+
import { PixelFormat } from '#consts/render-context';
|
|
1
3
|
import { num } from '#math/num';
|
|
2
4
|
|
|
3
5
|
// Source: trinity/trinity/Resources/Procedural/SolidColorTexture.h
|
|
@@ -77,34 +79,23 @@ function IsSolidColorTexturePath(path) {
|
|
|
77
79
|
* Carbon's `RasterizeSolidColor` (SolidColorTexture.cpp:104-126): a 1x1 bitmap of
|
|
78
80
|
* the parsed colour, or null where Carbon leaves the bitmap invalid.
|
|
79
81
|
*
|
|
80
|
-
* Carbon
|
|
81
|
-
* carries float colour as `rgba32float` only, so each component is quantized
|
|
82
|
-
* through the half-float codec first - the stored values are Carbon's, in a
|
|
83
|
-
* wider container.
|
|
82
|
+
* Carbon's format exactly: a 1x1 `PIXEL_FORMAT_R16G16B16A16_FLOAT` bitmap.
|
|
84
83
|
*
|
|
85
84
|
* @param {string} path `dynamic:/color/...` path.
|
|
86
|
-
* @returns {
|
|
85
|
+
* @returns {HostBitmap|null} The bitmap, or null where Carbon leaves it invalid.
|
|
87
86
|
*/
|
|
88
87
|
function RasterizeSolidColor(path) {
|
|
89
88
|
if (!IsSolidColorTexturePath(path)) return null;
|
|
90
89
|
const color = ParseColor(String(path).slice(ColorPrefix.length));
|
|
91
90
|
if (!color) return null;
|
|
92
|
-
const
|
|
91
|
+
const bitmap = new HostBitmap();
|
|
92
|
+
if (!bitmap.Create(1, 1, 1, PixelFormat.PIXEL_FORMAT_R16G16B16A16_FLOAT)) return null;
|
|
93
|
+
const raw = bitmap.GetRawData();
|
|
94
|
+
const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
|
|
93
95
|
for (let index = 0; index < 4; index++) {
|
|
94
|
-
|
|
96
|
+
view.setUint16(index * 2, num.toHalfFloat(color[index]), true);
|
|
95
97
|
}
|
|
96
|
-
return
|
|
97
|
-
payloadType: "rgba",
|
|
98
|
-
sourceFormat: "dynamic-color",
|
|
99
|
-
width: 1,
|
|
100
|
-
height: 1,
|
|
101
|
-
pixelFormat: "rgba32float",
|
|
102
|
-
data,
|
|
103
|
-
strideBytes: 16,
|
|
104
|
-
origin: "top-left",
|
|
105
|
-
colorSpace: "linear",
|
|
106
|
-
alphaMode: "straight"
|
|
107
|
-
};
|
|
98
|
+
return bitmap;
|
|
108
99
|
}
|
|
109
100
|
|
|
110
101
|
export { ColorPrefix, IsSolidColorTexturePath, ParseColor, RasterizeSolidColor };
|