@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,21 +1,28 @@
|
|
|
1
1
|
import { CjsSchema, carbon, impl, type, edit } from '#schema';
|
|
2
2
|
import { CjsResource } from '../CjsResource.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { HostBitmap } from '#imageio';
|
|
4
|
+
import { PixelFormat } from '#consts/render-context';
|
|
5
|
+
import { resourcePayloadError } from '../resourceBoundary.js';
|
|
5
6
|
import { ResourceRequirement } from '../ResourceRequirement.js';
|
|
6
7
|
|
|
7
8
|
// Source: trinity/trinity/Resources/Tr2ImageRes.h
|
|
8
9
|
// Source: trinity/trinity/Resources/Tr2ImageRes.cpp
|
|
9
10
|
// Source: trinity/trinity/Resources/Tr2ImageRes_Blue.cpp
|
|
10
11
|
|
|
11
|
-
/**
|
|
12
|
-
* Tr2ImageRes resource record.
|
|
13
|
-
*
|
|
14
|
-
* Carbon treats this as image payload data. Engine-gpu decides whether it ever
|
|
15
|
-
* becomes device texture state.
|
|
12
|
+
/**
|
|
13
|
+
* Tr2ImageRes resource record.
|
|
14
|
+
*
|
|
15
|
+
* Carbon treats this as image payload data. Engine-gpu decides whether it ever
|
|
16
|
+
* becomes device texture state.
|
|
16
17
|
*/
|
|
17
18
|
class Tr2ImageRes extends CjsResource {
|
|
19
|
+
/** m_bitmap: the decoded image (Tr2ImageRes.h:38). */
|
|
20
|
+
bitmap = new HostBitmap();
|
|
21
|
+
|
|
22
|
+
/** Mirrors the bitmap's width, so the schema and tools can read it. */
|
|
18
23
|
width = 0;
|
|
24
|
+
|
|
25
|
+
/** Mirrors the bitmap's height. */
|
|
19
26
|
height = 0;
|
|
20
27
|
|
|
21
28
|
/** Creates a Tr2ImageRes with caller-provided initial state. */
|
|
@@ -27,103 +34,128 @@ class Tr2ImageRes extends CjsResource {
|
|
|
27
34
|
});
|
|
28
35
|
}
|
|
29
36
|
|
|
30
|
-
/**
|
|
31
|
-
* Attach a plain canonical RGBA payload and mirror Carbon-exposed metadata.
|
|
32
|
-
*
|
|
33
|
-
* @param {object|null} payload
|
|
34
|
-
* @param {object|null} options
|
|
35
|
-
* @returns {Tr2ImageRes}
|
|
37
|
+
/**
|
|
38
|
+
* Attach a plain canonical RGBA payload and mirror Carbon-exposed metadata.
|
|
39
|
+
*
|
|
40
|
+
* @param {object|null} payload
|
|
41
|
+
* @param {object|null} options
|
|
42
|
+
* @returns {Tr2ImageRes}
|
|
36
43
|
*/
|
|
37
44
|
SetPayload(payload = null, options = null) {
|
|
38
45
|
if (payload === null) {
|
|
46
|
+
this.bitmap.Destroy();
|
|
39
47
|
super.SetPayload(null);
|
|
40
48
|
return this;
|
|
41
49
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
+
|
|
51
|
+
// Carbon's DoLoad reads straight into m_bitmap (Tr2ImageRes.cpp:39-52),
|
|
52
|
+
// so a HostBitmap is what this resource is made of.
|
|
53
|
+
const bitmap = CjsSchema.cast(payload, HostBitmap);
|
|
54
|
+
if (!bitmap) {
|
|
55
|
+
throw resourcePayloadError("Tr2ImageRes", "Expected an ImageIO::HostBitmap.", "payload");
|
|
56
|
+
}
|
|
57
|
+
this.bitmap = bitmap;
|
|
58
|
+
super.SetPayload(bitmap);
|
|
59
|
+
this.SetValues({
|
|
60
|
+
...(options || {}),
|
|
61
|
+
width: bitmap.GetWidth(),
|
|
62
|
+
height: bitmap.GetHeight()
|
|
63
|
+
});
|
|
50
64
|
return this;
|
|
51
65
|
}
|
|
52
66
|
|
|
53
|
-
/**
|
|
54
|
-
* Return image width in pixels.
|
|
55
|
-
*
|
|
56
|
-
* @returns {number}
|
|
67
|
+
/**
|
|
68
|
+
* Return image width in pixels.
|
|
69
|
+
*
|
|
70
|
+
* @returns {number}
|
|
57
71
|
*/
|
|
58
72
|
GetWidth() {
|
|
59
|
-
return this.width || 0;
|
|
73
|
+
return this.bitmap.IsValid() ? this.bitmap.GetWidth() : this.width || 0;
|
|
60
74
|
}
|
|
61
75
|
|
|
62
|
-
/**
|
|
63
|
-
* Return image height in pixels.
|
|
64
|
-
*
|
|
65
|
-
* @returns {number}
|
|
76
|
+
/**
|
|
77
|
+
* Return image height in pixels.
|
|
78
|
+
*
|
|
79
|
+
* @returns {number}
|
|
66
80
|
*/
|
|
67
81
|
GetHeight() {
|
|
68
|
-
return this.height || 0;
|
|
82
|
+
return this.bitmap.IsValid() ? this.bitmap.GetHeight() : this.height || 0;
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
85
|
+
/**
|
|
86
|
+
* Carbon GetPixelColor (Tr2ImageRes.cpp:72-108): the pixel as a colour,
|
|
87
|
+
* BGRA or BGRX only. A BGRX pixel reports alpha 1.
|
|
88
|
+
*
|
|
89
|
+
* adapted: Carbon returns a `Color`; this returns `{r, g, b, a}` in 0..1,
|
|
90
|
+
* the shape `HostBitmap.GetPixel` already answers in.
|
|
91
|
+
*
|
|
92
|
+
* @param {number} x Pixel column.
|
|
93
|
+
* @param {number} y Pixel row.
|
|
94
|
+
* @returns {{r: number, g: number, b: number, a: number}} The colour.
|
|
77
95
|
*/
|
|
78
96
|
GetPixelColor(x = 0, y = 0) {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
const transparent = {
|
|
98
|
+
r: 0,
|
|
99
|
+
g: 0,
|
|
100
|
+
b: 0,
|
|
101
|
+
a: 0
|
|
102
|
+
};
|
|
103
|
+
if (!this.bitmap.IsValid()) return transparent;
|
|
104
|
+
const format = this.bitmap.GetFormat();
|
|
105
|
+
|
|
106
|
+
// Carbon: CCP_LOGERR("Tr2ImageRes::GetPixelColor currently only supports ...")
|
|
107
|
+
if (format !== PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM && format !== PixelFormat.PIXEL_FORMAT_B8G8R8X8_UNORM) return transparent;
|
|
108
|
+
const color = this.bitmap.GetPixel(x, y);
|
|
109
|
+
if (!color) return transparent;
|
|
110
|
+
return format === PixelFormat.PIXEL_FORMAT_B8G8R8X8_UNORM ? {
|
|
111
|
+
...color,
|
|
112
|
+
a: 1
|
|
113
|
+
} : color;
|
|
84
114
|
}
|
|
85
115
|
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* @param {number}
|
|
91
|
-
* @
|
|
116
|
+
/**
|
|
117
|
+
* Carbon IsPixelOpaque (Tr2ImageRes.cpp:54-70): BGRA only, and "opaque"
|
|
118
|
+
* means an alpha byte above 0x7f.
|
|
119
|
+
*
|
|
120
|
+
* @param {number} x Pixel column.
|
|
121
|
+
* @param {number} y Pixel row.
|
|
122
|
+
* @returns {boolean} Whether the pixel is opaque.
|
|
92
123
|
*/
|
|
93
124
|
IsPixelOpaque(x = 0, y = 0) {
|
|
94
|
-
|
|
95
|
-
if (!
|
|
96
|
-
|
|
125
|
+
// Carbon: CCP_LOGERR("Tr2ImageRes::IsPixelOpaque currently only supports PIXEL_FORMAT_B8G8R8A8_UNORM")
|
|
126
|
+
if (!this.bitmap.IsValid() || this.bitmap.GetFormat() !== PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM) return false;
|
|
127
|
+
const color = this.bitmap.GetPixel(x, y);
|
|
128
|
+
return !!color && color.a > 0x7f / 255;
|
|
97
129
|
}
|
|
98
130
|
|
|
99
|
-
/**
|
|
100
|
-
* Carbon GetBitmap (Tr2ImageRes.cpp:
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* @returns {object|null}
|
|
131
|
+
/**
|
|
132
|
+
* Carbon GetBitmap (Tr2ImageRes.cpp:110-113): the bitmap DoLoad decoded.
|
|
133
|
+
*
|
|
134
|
+
* @returns {HostBitmap} The bitmap, valid once the image has loaded.
|
|
104
135
|
*/
|
|
105
136
|
GetBitmap() {
|
|
106
|
-
return this.
|
|
137
|
+
return this.bitmap;
|
|
107
138
|
}
|
|
108
139
|
|
|
109
|
-
/**
|
|
110
|
-
* Carbon IsMemoryUsageKnown (cpp:14): usage is only trustworthy once the
|
|
111
|
-
* async load has settled.
|
|
112
|
-
*
|
|
113
|
-
* @returns {boolean}
|
|
140
|
+
/**
|
|
141
|
+
* Carbon IsMemoryUsageKnown (cpp:14): usage is only trustworthy once the
|
|
142
|
+
* async load has settled.
|
|
143
|
+
*
|
|
144
|
+
* @returns {boolean}
|
|
114
145
|
*/
|
|
115
146
|
IsMemoryUsageKnown() {
|
|
116
147
|
return !this.IsLoading();
|
|
117
148
|
}
|
|
118
149
|
|
|
119
|
-
/**
|
|
120
|
-
* Carbon GetMemoryUsage (cpp:19): the bitmap's raw byte size, or a
|
|
121
|
-
* 1024-byte placeholder so an unloaded resource still has nonzero
|
|
122
|
-
* accounted cost.
|
|
123
|
-
*
|
|
124
|
-
* @returns {number}
|
|
150
|
+
/**
|
|
151
|
+
* Carbon GetMemoryUsage (cpp:19): the bitmap's raw byte size, or a
|
|
152
|
+
* 1024-byte placeholder so an unloaded resource still has nonzero
|
|
153
|
+
* accounted cost.
|
|
154
|
+
*
|
|
155
|
+
* @returns {number}
|
|
125
156
|
*/
|
|
126
157
|
GetMemoryUsage() {
|
|
158
|
+
if (this.bitmap.IsValid()) return this.bitmap.GetRawDataSize();
|
|
127
159
|
const payload = this.GetPayload();
|
|
128
160
|
return payload?.data?.byteLength ? payload.data.byteLength : 1024;
|
|
129
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2ImageRes.js","sources":["../../../../src/resource/texture/Tr2ImageRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2ImageRes.h\r\n// Source: trinity/trinity/Resources/Tr2ImageRes.cpp\r\n// Source: trinity/trinity/Resources/Tr2ImageRes_Blue.cpp\r\nimport { CjsSchema, carbon, impl, edit, type } from \"#schema\";\r\nimport { CjsResource } from \"../CjsResource.js\";\r\nimport { validateRgbaPayload } from \"../format/payloadContract.js\";\r\nimport { validateResourcePayload } from \"../resourceBoundary.js\";\r\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\r\n\r\n/**\r\n * Tr2ImageRes resource record.\r\n *\r\n * Carbon treats this as image payload data. Engine-gpu decides whether it ever\r\n * becomes device texture state.\r\n */\r\nexport class Tr2ImageRes extends CjsResource\r\n{\r\n\r\n width = 0;\r\n\r\n height = 0;\r\n\r\n /** Creates a Tr2ImageRes with caller-provided initial state. */\r\n constructor(values = null) {\r\n super();\r\n this.SetValues(values || {}, {\r\n skipUpdate: true,\r\n skipEvents: true\r\n });\r\n }\r\n\r\n /**\r\n * Attach a plain canonical RGBA payload and mirror Carbon-exposed metadata.\r\n *\r\n * @param {object|null} payload\r\n * @param {object|null} options\r\n * @returns {Tr2ImageRes}\r\n */\r\n SetPayload(payload = null, options = null)\r\n {\r\n if (payload === null)\r\n {\r\n super.SetPayload(null);\r\n return this;\r\n }\r\n validateResourcePayload(\"Tr2ImageRes\", payload, validateRgbaPayload);\r\n const values = { ...(options || {}) };\r\n values.width = payload.width;\r\n values.height = payload.height;\r\n super.SetPayload(payload);\r\n this.SetValues(values);\r\n return this;\r\n }\r\n\r\n /**\r\n * Return image width in pixels.\r\n *\r\n * @returns {number}\r\n */\r\n GetWidth()\r\n {\r\n return this.width || 0;\r\n }\r\n\r\n /**\r\n * Return image height in pixels.\r\n *\r\n * @returns {number}\r\n */\r\n GetHeight()\r\n {\r\n return this.height || 0;\r\n }\r\n\r\n /**\r\n * Read pixel color from payload metadata when a simple pixel accessor exists.\r\n *\r\n * @param {number} x\r\n * @param {number} y\r\n * @returns {*}\r\n */\r\n GetPixelColor(x = 0, y = 0)\r\n {\r\n const payload = this.GetPayload();\r\n if (!payload || !Number.isInteger(x) || !Number.isInteger(y)\r\n || x < 0 || y < 0 || x >= payload.width || y >= payload.height) return null;\r\n\r\n const elementsPerRow = payload.strideBytes / payload.data.BYTES_PER_ELEMENT;\r\n const offset = y * elementsPerRow + x * 4;\r\n return Array.from(payload.data.subarray(offset, offset + 4));\r\n }\r\n\r\n /**\r\n * Return true when a pixel alpha channel is absent or non-zero.\r\n *\r\n * @param {number} x\r\n * @param {number} y\r\n * @returns {boolean}\r\n */\r\n IsPixelOpaque(x = 0, y = 0)\r\n {\r\n const color = this.GetPixelColor(x, y);\r\n if (!Array.isArray(color)) return false;\r\n return color.length < 4 || color[3] > 0;\r\n }\r\n\r\n /**\r\n * Carbon GetBitmap (Tr2ImageRes.cpp:138): the host bitmap DoLoad decoded.\r\n * The canonical RGBA payload IS that bitmap here.\r\n *\r\n * @returns {object|null}\r\n */\r\n GetBitmap()\r\n {\r\n return this.GetPayload();\r\n }\r\n\r\n /**\r\n * Carbon IsMemoryUsageKnown (cpp:14): usage is only trustworthy once the\r\n * async load has settled.\r\n *\r\n * @returns {boolean}\r\n */\r\n IsMemoryUsageKnown()\r\n {\r\n return !this.IsLoading();\r\n }\r\n\r\n /**\r\n * Carbon GetMemoryUsage (cpp:19): the bitmap's raw byte size, or a\r\n * 1024-byte placeholder so an unloaded resource still has nonzero\r\n * accounted cost.\r\n *\r\n * @returns {number}\r\n */\r\n GetMemoryUsage()\r\n {\r\n const payload = this.GetPayload();\r\n return payload?.data?.byteLength ? payload.data.byteLength : 1024;\r\n }\r\n\r\n static payload = ResourceRequirement.IMAGE;\r\n}\r\n\r\n// Declared as data rather than with decorators, so the resource tree loads from\r\n// source without a transform. Field order is key order, and GetValues() exports\r\n// in that order.\r\nCjsSchema.define(Tr2ImageRes, {\r\n className: \"Tr2ImageRes\",\r\n family: \"resources\",\r\n fields: {\r\n width: [ type.uint32, edit.persist ],\r\n height: [ type.uint32, edit.persist ]\r\n },\r\n methods: {\r\n GetWidth: [ carbon.method, impl.adapted ],\r\n GetHeight: [ carbon.method, impl.adapted ],\r\n GetPixelColor: [ carbon.method, impl.adapted ],\r\n IsPixelOpaque: [ carbon.method, impl.adapted ],\r\n GetBitmap: [ carbon.method, impl.adapted ],\r\n IsMemoryUsageKnown: [ carbon.method, impl.implemented ],\r\n GetMemoryUsage: [ carbon.method, impl.adapted ]\r\n }\r\n});\r\n"],"names":["Tr2ImageRes","CjsResource","width","height","constructor","values","SetValues","skipUpdate","skipEvents","SetPayload","payload","options","validateResourcePayload","validateRgbaPayload","GetWidth","GetHeight","GetPixelColor","x","y","GetPayload","Number","isInteger","elementsPerRow","strideBytes","data","BYTES_PER_ELEMENT","offset","Array","from","subarray","IsPixelOpaque","color","isArray","length","GetBitmap","IsMemoryUsageKnown","IsLoading","GetMemoryUsage","byteLength","ResourceRequirement","IMAGE","CjsSchema","define","className","family","fields","type","uint32","edit","persist","methods","carbon","method","impl","adapted","implemented"],"mappings":";;;;;;AAAA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,WAAW,CAC5C;AAEEC,EAAAA,KAAK,GAAG,CAAC;AAETC,EAAAA,MAAM,GAAG,CAAC;;AAEV;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EAAE;AACzB,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,MAAM,IAAI,EAAE,EAAE;AAC3BE,MAAAA,UAAU,EAAE,IA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G6B,mBAAmB,CAACC,KAAK;AAC5C;;AAEA;AACA;AACA;AACAC,SAAS,CAACC,MAAM,CAAC1C,WAAW,EAAE;AAC5B2C,EAAAA,SAAS,EAAE,aAAa;AACxBC,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,MAAM,EAAE;IACN3C,KAAK,EAAE,CAAE4C,IAAI,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACpC9C,MAAM,EAAE,CAAE2C,IAAI,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;GACpC;AACDC,EAAAA,OAAO,EAAE;IACPpC,QAAQ,EAAE,CAAEqC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACzCvC,SAAS,EAAE,CAAEoC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC1CtC,aAAa,EAAE,CAAEmC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC9CxB,aAAa,EAAE,CAAEqB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC9CpB,SAAS,EAAE,CAAEiB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC1CnB,kBAAkB,EAAE,CAAEgB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,WAAW,CAAE;IACvDlB,cAAc,EAAE,CAAEc,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AAC/C;AACF,CAAC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Tr2ImageRes.js","sources":["../../../../src/resource/texture/Tr2ImageRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Tr2ImageRes.h\n// Source: trinity/trinity/Resources/Tr2ImageRes.cpp\n// Source: trinity/trinity/Resources/Tr2ImageRes_Blue.cpp\nimport { CjsSchema, carbon, impl, edit, type } from \"#schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { HostBitmap } from \"#imageio\";\nimport { PixelFormat } from \"#consts/render-context\";\nimport { resourcePayloadError, validateResourcePayload } from \"../resourceBoundary.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\n\n/**\n * Tr2ImageRes resource record.\n *\n * Carbon treats this as image payload data. Engine-gpu decides whether it ever\n * becomes device texture state.\n */\nexport class Tr2ImageRes extends CjsResource\n{\n\n /** m_bitmap: the decoded image (Tr2ImageRes.h:38). */\n bitmap = new HostBitmap();\n\n /** Mirrors the bitmap's width, so the schema and tools can read it. */\n width = 0;\n\n /** Mirrors the bitmap's height. */\n height = 0;\n\n /** Creates a Tr2ImageRes 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 * Attach a plain canonical RGBA payload and mirror Carbon-exposed metadata.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {Tr2ImageRes}\n */\n SetPayload(payload = null, options = null)\n {\n if (payload === null)\n {\n this.bitmap.Destroy();\n super.SetPayload(null);\n return this;\n }\n\n // Carbon's DoLoad reads straight into m_bitmap (Tr2ImageRes.cpp:39-52),\n // so a HostBitmap is what this resource is made of.\n const bitmap = CjsSchema.cast(payload, HostBitmap);\n\n if (!bitmap)\n {\n throw resourcePayloadError(\"Tr2ImageRes\", \"Expected an ImageIO::HostBitmap.\", \"payload\");\n }\n\n this.bitmap = bitmap;\n super.SetPayload(bitmap);\n this.SetValues({ ...(options || {}), width: bitmap.GetWidth(), height: bitmap.GetHeight() });\n return this;\n }\n\n /**\n * Return image width in pixels.\n *\n * @returns {number}\n */\n GetWidth()\n {\n return this.bitmap.IsValid() ? this.bitmap.GetWidth() : (this.width || 0);\n }\n\n /**\n * Return image height in pixels.\n *\n * @returns {number}\n */\n GetHeight()\n {\n return this.bitmap.IsValid() ? this.bitmap.GetHeight() : (this.height || 0);\n }\n\n /**\n * Carbon GetPixelColor (Tr2ImageRes.cpp:72-108): the pixel as a colour,\n * BGRA or BGRX only. A BGRX pixel reports alpha 1.\n *\n * adapted: Carbon returns a `Color`; this returns `{r, g, b, a}` in 0..1,\n * the shape `HostBitmap.GetPixel` already answers in.\n *\n * @param {number} x Pixel column.\n * @param {number} y Pixel row.\n * @returns {{r: number, g: number, b: number, a: number}} The colour.\n */\n GetPixelColor(x = 0, y = 0)\n {\n const transparent = { r: 0, g: 0, b: 0, a: 0 };\n\n if (!this.bitmap.IsValid()) return transparent;\n\n const format = this.bitmap.GetFormat();\n\n // Carbon: CCP_LOGERR(\"Tr2ImageRes::GetPixelColor currently only supports ...\")\n if (format !== PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM && format !== PixelFormat.PIXEL_FORMAT_B8G8R8X8_UNORM) return transparent;\n\n const color = this.bitmap.GetPixel(x, y);\n\n if (!color) return transparent;\n\n return format === PixelFormat.PIXEL_FORMAT_B8G8R8X8_UNORM ? { ...color, a: 1 } : color;\n }\n\n /**\n * Carbon IsPixelOpaque (Tr2ImageRes.cpp:54-70): BGRA only, and \"opaque\"\n * means an alpha byte above 0x7f.\n *\n * @param {number} x Pixel column.\n * @param {number} y Pixel row.\n * @returns {boolean} Whether the pixel is opaque.\n */\n IsPixelOpaque(x = 0, y = 0)\n {\n // Carbon: CCP_LOGERR(\"Tr2ImageRes::IsPixelOpaque currently only supports PIXEL_FORMAT_B8G8R8A8_UNORM\")\n if (!this.bitmap.IsValid() || this.bitmap.GetFormat() !== PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM) return false;\n\n const color = this.bitmap.GetPixel(x, y);\n\n return !!color && color.a > 0x7f / 255;\n }\n\n /**\n * Carbon GetBitmap (Tr2ImageRes.cpp:110-113): the bitmap DoLoad decoded.\n *\n * @returns {HostBitmap} The bitmap, valid once the image has loaded.\n */\n GetBitmap()\n {\n return this.bitmap;\n }\n\n /**\n * Carbon IsMemoryUsageKnown (cpp:14): usage is only trustworthy once the\n * async load has settled.\n *\n * @returns {boolean}\n */\n IsMemoryUsageKnown()\n {\n return !this.IsLoading();\n }\n\n /**\n * Carbon GetMemoryUsage (cpp:19): the bitmap's raw byte size, or a\n * 1024-byte placeholder so an unloaded resource still has nonzero\n * accounted cost.\n *\n * @returns {number}\n */\n GetMemoryUsage()\n {\n if (this.bitmap.IsValid()) return this.bitmap.GetRawDataSize();\n\n const payload = this.GetPayload();\n\n return payload?.data?.byteLength ? payload.data.byteLength : 1024;\n }\n\n static payload = ResourceRequirement.IMAGE;\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(Tr2ImageRes, {\n className: \"Tr2ImageRes\",\n family: \"resources\",\n fields: {\n width: [ type.uint32, edit.persist ],\n height: [ type.uint32, edit.persist ]\n },\n methods: {\n GetWidth: [ carbon.method, impl.adapted ],\n GetHeight: [ carbon.method, impl.adapted ],\n GetPixelColor: [ carbon.method, impl.adapted ],\n IsPixelOpaque: [ carbon.method, impl.adapted ],\n GetBitmap: [ carbon.method, impl.adapted ],\n IsMemoryUsageKnown: [ carbon.method, impl.implemented ],\n GetMemoryUsage: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["Tr2ImageRes","CjsResource","bitmap","HostBitmap","width","height","constructor","values","SetValues","skipUpdate","skipEvents","SetPayload","payload","options","Destroy","CjsSchema","cast","resourcePayloadError","GetWidth","GetHeight","IsValid","GetPixelColor","x","y","transparent","r","g","b","a","format","GetFormat","PixelFormat","PIXEL_FORMAT_B8G8R8A8_UNORM","PIXEL_FORMAT_B8G8R8X8_UNORM","color","GetPixel","IsPixelOpaque","GetBitmap","IsMemoryUsageKnown","IsLoading","GetMemoryUsage","GetRawDataSize","GetPayload","data","byteLength","ResourceRequirement","IMAGE","define","className","family","fields","type","uint32","edit","persist","methods","carbon","method","impl","adapted","implemented"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,WAAW,CAC5C;AAEE;AACAC,EAAAA,MAAM,GAAG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AAI,CAACC,OAAO;GACpC;AACDC,EAAAA,OAAO,EAAE;IACPrC,QAAQ,EAAE,CAAEsC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACzCxC,SAAS,EAAE,CAAEqC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC1CtC,aAAa,EAAE,CAAEmC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC9CvB,aAAa,EAAE,CAAEoB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC9CtB,SAAS,EAAE,CAAEmB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC1CrB,kBAAkB,EAAE,CAAEkB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,WAAW,CAAE;IACvDpB,cAAc,EAAE,CAAEgB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AAC/C;AACF,CAAC,CAAC;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CjsSchema, carbon, impl, edit, type } from '#schema';
|
|
2
2
|
import { CjsModel } from '#model';
|
|
3
|
-
import {
|
|
3
|
+
import { Tr2TexturePipelineParams } from './Tr2TexturePipelineParams.js';
|
|
4
|
+
import { Tr2TexturePipelineStepLimitSize } from './Tr2TexturePipelineStepLimitSize.js';
|
|
4
5
|
|
|
5
6
|
// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipeline.h
|
|
6
7
|
// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipeline.cpp
|
|
@@ -10,11 +11,12 @@ import { executeTexturePipeline, getTexturePipelineDependencies } from './textur
|
|
|
10
11
|
// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepCompress.cpp
|
|
11
12
|
// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepPack.cpp
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
-
* Carbon texture-specific CPU bitmap transformation pipeline.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
/**
|
|
15
|
+
* Carbon texture-specific CPU bitmap transformation pipeline.
|
|
16
|
+
*
|
|
17
|
+
* The steps share one ImageIO::HostBitmap, exactly as Carbon does: each step
|
|
18
|
+
* reads and rewrites it, and the caller supplies every input bitmap the steps
|
|
19
|
+
* name, keyed by resource path.
|
|
18
20
|
*/
|
|
19
21
|
class Tr2TexturePipeline extends CjsModel {
|
|
20
22
|
/** m_pipelineType (std::string) [READWRITE, PERSIST] */
|
|
@@ -32,28 +34,46 @@ class Tr2TexturePipeline extends CjsModel {
|
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
/**
|
|
36
|
-
* Execute
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
/**
|
|
38
|
+
* Carbon Execute (cpp:24-45): run every step against one bitmap, then apply
|
|
39
|
+
* the caller's size limit.
|
|
40
|
+
*
|
|
41
|
+
* diverged: a failed step stops the pipeline. Carbon ignores each step's
|
|
42
|
+
* result and runs the next one as though it had succeeded, so a failed Load
|
|
43
|
+
* leaves the following steps working on an empty bitmap (issue 19,
|
|
44
|
+
* /docs/research/carbon-imageio-issue.md).
|
|
45
|
+
*
|
|
46
|
+
* @param {import("#imageio").HostBitmap} result Bitmap to fill; destroyed first.
|
|
47
|
+
* @param {Map<string, import("#imageio").HostBitmap>} inputs Loaded inputs by path.
|
|
48
|
+
* @param {Tr2TexturePipelineParams} params Caller size limits.
|
|
49
|
+
* @returns {boolean} Whether the pipeline succeeded.
|
|
42
50
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
Execute(result, inputs, params = new Tr2TexturePipelineParams()) {
|
|
52
|
+
result.Destroy();
|
|
53
|
+
|
|
54
|
+
// Carbon: CCP_LOGERR("Tr2TexturePipeline: no steps")
|
|
55
|
+
if (!this.steps.length) return false;
|
|
56
|
+
for (const step of this.steps) {
|
|
57
|
+
if (!step.Execute(result, inputs, params)) return false;
|
|
58
|
+
}
|
|
59
|
+
if (params.maxHeight || params.maxWidth) {
|
|
60
|
+
return Tr2TexturePipelineStepLimitSize.limitSize(result, params.maxWidth, params.maxHeight);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
48
63
|
}
|
|
49
64
|
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
65
|
+
/**
|
|
66
|
+
* Carbon GetResourceDependencies (cpp:15-22): every path the steps need.
|
|
67
|
+
*
|
|
68
|
+
* adapted: Carbon fills a caller-owned set; this returns the paths sorted,
|
|
69
|
+
* which the resource layer wants for a stable load order.
|
|
70
|
+
*
|
|
71
|
+
* @returns {string[]} Resource dependency paths.
|
|
54
72
|
*/
|
|
55
73
|
GetResourceDependencies() {
|
|
56
|
-
|
|
74
|
+
const resources = new Set();
|
|
75
|
+
for (const step of this.steps) step.GetResourceDependencies(resources);
|
|
76
|
+
return [...resources].sort();
|
|
57
77
|
}
|
|
58
78
|
}
|
|
59
79
|
CjsSchema.define(Tr2TexturePipeline, {
|
|
@@ -64,8 +84,8 @@ CjsSchema.define(Tr2TexturePipeline, {
|
|
|
64
84
|
steps: [edit.persist, type.list("ITr2TexturePipelineStep")]
|
|
65
85
|
},
|
|
66
86
|
methods: {
|
|
67
|
-
Execute: [carbon.method, impl.adapted, impl.reason("Carbon
|
|
68
|
-
GetResourceDependencies: [carbon.method, impl.
|
|
87
|
+
Execute: [carbon.method, impl.adapted, impl.reason("Carbon ignores each step's result and runs the next one regardless; ours stops on the first failure (issue 19).")],
|
|
88
|
+
GetResourceDependencies: [carbon.method, impl.adapted, impl.reason("Carbon fills a caller-owned set; ours returns the paths sorted, for a stable load order.")]
|
|
69
89
|
}
|
|
70
90
|
});
|
|
71
91
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2TexturePipeline.js","sources":["../../../../src/resource/texture/Tr2TexturePipeline.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipeline.h\
|
|
1
|
+
{"version":3,"file":"Tr2TexturePipeline.js","sources":["../../../../src/resource/texture/Tr2TexturePipeline.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipeline.h\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipeline.cpp\n// Source: trinity/trinity/Resources/TexturePipeline/ITr2TexturePipelineStep.h\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepLoad.cpp\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepLimitSize.cpp\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepCompress.cpp\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepPack.cpp\nimport { carbon, CjsSchema, impl, edit, type } from \"#schema\";\nimport { CjsModel } from \"#model\";\nimport { Tr2TexturePipelineParams } from \"./Tr2TexturePipelineParams.js\";\nimport { Tr2TexturePipelineStepLimitSize } from \"./Tr2TexturePipelineStepLimitSize.js\";\n\n/**\n * Carbon texture-specific CPU bitmap transformation pipeline.\n *\n * The steps share one ImageIO::HostBitmap, exactly as Carbon does: each step\n * reads and rewrites it, and the caller supplies every input bitmap the steps\n * name, keyed by resource path.\n */\nexport class Tr2TexturePipeline extends CjsModel\n{\n\n /** m_pipelineType (std::string) [READWRITE, PERSIST] */\n pipelineType = \"\";\n\n /** m_steps (PITr2TexturePipelineStepVector) [READ, PERSIST] */\n steps = [];\n\n /** Creates a Tr2TexturePipeline with caller-provided initial state. */\n constructor(values = null)\n {\n super();\n this.SetValues(values || {}, {\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Carbon Execute (cpp:24-45): run every step against one bitmap, then apply\n * the caller's size limit.\n *\n * diverged: a failed step stops the pipeline. Carbon ignores each step's\n * result and runs the next one as though it had succeeded, so a failed Load\n * leaves the following steps working on an empty bitmap (issue 19,\n * /docs/research/carbon-imageio-issue.md).\n *\n * @param {import(\"#imageio\").HostBitmap} result Bitmap to fill; destroyed first.\n * @param {Map<string, import(\"#imageio\").HostBitmap>} inputs Loaded inputs by path.\n * @param {Tr2TexturePipelineParams} params Caller size limits.\n * @returns {boolean} Whether the pipeline succeeded.\n */\n Execute(result, inputs, params = new Tr2TexturePipelineParams())\n {\n result.Destroy();\n\n // Carbon: CCP_LOGERR(\"Tr2TexturePipeline: no steps\")\n if (!this.steps.length) return false;\n\n for (const step of this.steps)\n {\n if (!step.Execute(result, inputs, params)) return false;\n }\n\n if (params.maxHeight || params.maxWidth)\n {\n return Tr2TexturePipelineStepLimitSize.limitSize(result, params.maxWidth, params.maxHeight);\n }\n\n return true;\n }\n\n /**\n * Carbon GetResourceDependencies (cpp:15-22): every path the steps need.\n *\n * adapted: Carbon fills a caller-owned set; this returns the paths sorted,\n * which the resource layer wants for a stable load order.\n *\n * @returns {string[]} Resource dependency paths.\n */\n GetResourceDependencies()\n {\n const resources = new Set();\n for (const step of this.steps) step.GetResourceDependencies(resources);\n return [ ...resources ].sort();\n }\n\n}\n\nCjsSchema.define(Tr2TexturePipeline, {\n className: \"Tr2TexturePipeline\", family: \"resources\",\n fields: {\n pipelineType: [ edit.persist, type.string ],\n steps: [ edit.persist, type.list(\"ITr2TexturePipelineStep\") ]\n },\n methods: {\n Execute: [ carbon.method, impl.adapted, impl.reason(\"Carbon ignores each step's result and runs the next one regardless; ours stops on the first failure (issue 19).\") ],\n GetResourceDependencies: [ carbon.method, impl.adapted, impl.reason(\"Carbon fills a caller-owned set; ours returns the paths sorted, for a stable load order.\") ]\n }\n});\n"],"names":["Tr2TexturePipeline","CjsModel","pipelineType","steps","constructor","values","SetValues","skipUpdate","skipEvents","Execute","result","inputs","params","Tr2TexturePipelineParams","Destroy","length","step","maxHeight","maxWidth","Tr2TexturePipelineStepLimitSize","limitSize","GetResourceDependencies","resources","Set","sort","CjsSchema","define","className","family","fields","edit","persist","type","string","list","methods","carbon","method","impl","adapted","reason"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,SAASC,QAAQ,CAChD;AAEE;AACAC,EAAAA,YAAY,GAAG,EAAE;;AAEjB;AACAC,EAAAA,KAAK,GAAG,EAAE;;AAEV;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EACzB;AACE,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,MAAM,IAAI,EAAE,EAAE;AAC3BE,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,UAAU,EAAE;AACd,KAAC,CAAC;AACJ,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACC,MAAM,EAAEC,MAAM,EAAEC,MAAM,GAAG,IAAIC,wBAAwB,EAAE,EAC/D;IACEH,MAAM,CAACI,OAAO,EAAE;;AAEhB;IACA,IAAI,CAAC,IAAI,CAACX,KAAK,CAACY,MAAM,EAAE,OAAO,KAAK;AAEpC,IAAA,KAAK,MAAMC,IAAI,IAAI,IAAI,CAACb,KAAK,EAC7B;AACE,MAAA,IAAI,CAACa,IAAI,CAACP,OAAO,CAACC,MAAM,EAAEC,MAAM,EAAEC,MAAM,CAAC,EAAE,OAAO,KAAK;AACzD,IAAA;AAEA,IAAA,IAAIA,MAAM,CAACK,SAAS,IAAIL,MAAM,CAACM,QAAQ,EACvC;AACE,MAAA,OAAOC,+BAA+B,CAACC,SAAS,CAACV,MAAM,EAAEE,MAAM,CAACM,QAAQ,EAAEN,MAAM,CAACK,SAAS,CAAC;AAC7F,IAAA;AAEA,IAAA,OAAO,IAAI;AACb,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEI,EAAAA,uBAAuBA,GACvB;AACE,IAAA,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAAE;AAC3B,IAAA,KAAK,MAAMP,IAAI,IAAI,IAAI,CAACb,KAAK,EAAEa,IAAI,CAACK,uBAAuB,CAACC,SAAS,CAAC;AACtE,IAAA,OAAO,CAAE,GAAGA,SAAS,CAAE,CAACE,IAAI,EAAE;AAChC,EAAA;AAEF;AAEAC,SAAS,CAACC,MAAM,CAAC1B,kBAAkB,EAAE;AACnC2B,EAAAA,SAAS,EAAE,oBAAoB;AAAEC,EAAAA,MAAM,EAAE,WAAW;AACpDC,EAAAA,MAAM,EAAE;IACN3B,YAAY,EAAE,CAAE4B,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,MAAM,CAAE;IAC3C9B,KAAK,EAAE,CAAE2B,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACE,IAAI,CAAC,yBAAyB,CAAC;GAC5D;AACDC,EAAAA,OAAO,EAAE;AACP1B,IAAAA,OAAO,EAAE,CAAE2B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,iHAAiH,CAAC,CAAE;AACxKnB,IAAAA,uBAAuB,EAAE,CAAEe,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,0FAA0F,CAAC;AACjK;AACF,CAAC,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CjsSchema, edit, type } from '#schema';
|
|
1
|
+
import { CjsSchema, carbon, impl, edit, type } from '#schema';
|
|
2
2
|
import { CjsModel } from '#model';
|
|
3
3
|
|
|
4
4
|
// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepCompress.h
|
|
@@ -17,6 +17,35 @@ class Tr2TexturePipelineStepCompress extends CjsModel {
|
|
|
17
17
|
|
|
18
18
|
/** m_rWeight (float) [READWRITE, PERSIST] */
|
|
19
19
|
r = 1;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Carbon's ITr2TexturePipelineStep default (ITr2TexturePipelineStep.h:21):
|
|
23
|
+
* this step names no resources.
|
|
24
|
+
*
|
|
25
|
+
* @param {Set<string>} [resources] Caller-owned; allocated when omitted.
|
|
26
|
+
* @returns {Set<string>} The set, unchanged.
|
|
27
|
+
*/
|
|
28
|
+
GetResourceDependencies(resources = new Set()) {
|
|
29
|
+
return resources;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Carbon Execute (cpp:15-21) checks validity and returns true, compressing
|
|
34
|
+
* nothing, so a pipeline asking for compression silently gets uncompressed
|
|
35
|
+
* output (issue 20, /docs/research/carbon-imageio-issue.md).
|
|
36
|
+
*
|
|
37
|
+
* diverged: this refuses instead of lying. When the bitmap is already in the
|
|
38
|
+
* requested format there is nothing to do and it succeeds; otherwise it
|
|
39
|
+
* fails until a block encoder exists, which is the hook this step becomes
|
|
40
|
+
* (/docs/projects/hostbitmap-port.md).
|
|
41
|
+
*
|
|
42
|
+
* @param {import("#imageio").HostBitmap} bitmap The pipeline's bitmap.
|
|
43
|
+
* @returns {boolean} Whether the step succeeded.
|
|
44
|
+
*/
|
|
45
|
+
Execute(bitmap) {
|
|
46
|
+
if (!bitmap.IsValid()) return false;
|
|
47
|
+
return bitmap.GetFormat() === this.format;
|
|
48
|
+
}
|
|
20
49
|
}
|
|
21
50
|
CjsSchema.define(Tr2TexturePipelineStepCompress, {
|
|
22
51
|
className: "Tr2TexturePipelineStepCompress",
|
|
@@ -26,6 +55,10 @@ CjsSchema.define(Tr2TexturePipelineStepCompress, {
|
|
|
26
55
|
b: [edit.persist, type.float32],
|
|
27
56
|
g: [edit.persist, type.float32],
|
|
28
57
|
r: [edit.persist, type.float32]
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
GetResourceDependencies: [carbon.method, impl.implemented],
|
|
61
|
+
Execute: [carbon.method, impl.adapted, impl.reason("Carbon's step compresses nothing and returns true; ours refuses rather than pass uncompressed data off as compressed (issue 20).")]
|
|
29
62
|
}
|
|
30
63
|
});
|
|
31
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2TexturePipelineStepCompress.js","sources":["../../../../src/resource/texture/Tr2TexturePipelineStepCompress.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepCompress.h\
|
|
1
|
+
{"version":3,"file":"Tr2TexturePipelineStepCompress.js","sources":["../../../../src/resource/texture/Tr2TexturePipelineStepCompress.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepCompress.h\n// Schema: format-carbon resources/Tr2TexturePipelineStepCompress.json; maintained by the runtime resource layer.\nimport { carbon, CjsSchema, edit, impl, type } from \"#schema\";\nimport { CjsModel } from \"#model\";\n\n/** Tr2TexturePipelineStepCompress (resources) - maintained from schema shapeHash 4d367f1c.... */\nexport class Tr2TexturePipelineStepCompress extends CjsModel\n{\n\n /** m_format (Tr2RenderContextEnum::PixelFormat - enum PixelFormat) [READWRITE, PERSIST, ENUM] */\n format = 71;\n\n /** m_bWeight (float) [READWRITE, PERSIST] */\n b = 1;\n\n /** m_gWeight (float) [READWRITE, PERSIST] */\n g = 1;\n\n /** m_rWeight (float) [READWRITE, PERSIST] */\n r = 1;\n\n /**\n * Carbon's ITr2TexturePipelineStep default (ITr2TexturePipelineStep.h:21):\n * this step names no resources.\n *\n * @param {Set<string>} [resources] Caller-owned; allocated when omitted.\n * @returns {Set<string>} The set, unchanged.\n */\n GetResourceDependencies(resources = new Set())\n {\n return resources;\n }\n\n /**\n * Carbon Execute (cpp:15-21) checks validity and returns true, compressing\n * nothing, so a pipeline asking for compression silently gets uncompressed\n * output (issue 20, /docs/research/carbon-imageio-issue.md).\n *\n * diverged: this refuses instead of lying. When the bitmap is already in the\n * requested format there is nothing to do and it succeeds; otherwise it\n * fails until a block encoder exists, which is the hook this step becomes\n * (/docs/projects/hostbitmap-port.md).\n *\n * @param {import(\"#imageio\").HostBitmap} bitmap The pipeline's bitmap.\n * @returns {boolean} Whether the step succeeded.\n */\n Execute(bitmap)\n {\n if (!bitmap.IsValid()) return false;\n\n return bitmap.GetFormat() === this.format;\n }\n\n}\n\nCjsSchema.define(Tr2TexturePipelineStepCompress, {\n className: \"Tr2TexturePipelineStepCompress\", family: \"resources\",\n fields: {\n format: [ edit.persist, type.int32, type.enum(\"PixelFormat\") ],\n b: [ edit.persist, type.float32 ],\n g: [ edit.persist, type.float32 ],\n r: [ edit.persist, type.float32 ]\n },\n methods: {\n GetResourceDependencies: [ carbon.method, impl.implemented ],\n Execute: [ carbon.method, impl.adapted, impl.reason(\"Carbon's step compresses nothing and returns true; ours refuses rather than pass uncompressed data off as compressed (issue 20).\") ]\n }\n});\n"],"names":["Tr2TexturePipelineStepCompress","CjsModel","format","b","g","r","GetResourceDependencies","resources","Set","Execute","bitmap","IsValid","GetFormat","CjsSchema","define","className","family","fields","edit","persist","type","int32","enum","float32","methods","carbon","method","impl","implemented","adapted","reason"],"mappings":";;;AAAA;AACA;;AAIA;AACO,MAAMA,8BAA8B,SAASC,QAAQ,CAC5D;AAEE;AACAC,EAAAA,MAAM,GAAG,EAAE;;AAEX;AACAC,EAAAA,CAAC,GAAG,CAAC;;AAEL;AACAC,EAAAA,CAAC,GAAG,CAAC;;AAEL;AACAC,EAAAA,CAAC,GAAG,CAAC;;AAEL;AACF;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,uBAAuBA,CAACC,SAAS,GAAG,IAAIC,GAAG,EAAE,EAC7C;AACE,IAAA,OAAOD,SAAS;AAClB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,OAAOA,CAACC,MAAM,EACd;IACE,IAAI,CAACA,MAAM,CAACC,OAAO,EAAE,EAAE,OAAO,KAAK;IAEnC,OAAOD,MAAM,CAACE,SAAS,EAAE,KAAK,IAAI,CAACV,MAAM;AAC3C,EAAA;AAEF;AAEAW,SAAS,CAACC,MAAM,CAACd,8BAA8B,EAAE;AAC/Ce,EAAAA,SAAS,EAAE,gCAAgC;AAAEC,EAAAA,MAAM,EAAE,WAAW;AAChEC,EAAAA,MAAM,EAAE;AACNf,IAAAA,MAAM,EAAE,CAAEgB,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,KAAK,EAAED,IAAI,CAACE,IAAI,CAAC,aAAa,CAAC,CAAE;IAC9DnB,CAAC,EAAE,CAAEe,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,OAAO,CAAE;IACjCnB,CAAC,EAAE,CAAEc,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,OAAO,CAAE;IACjClB,CAAC,EAAE,CAAEa,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,OAAO;GAChC;AACDC,EAAAA,OAAO,EAAE;IACPlB,uBAAuB,EAAE,CAAEmB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,WAAW,CAAE;AAC5DnB,IAAAA,OAAO,EAAE,CAAEgB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACE,OAAO,EAAEF,IAAI,CAACG,MAAM,CAAC,kIAAkI,CAAC;AACzL;AACF,CAAC,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CjsSchema } from '#schema';
|
|
1
|
+
import { CjsSchema, carbon, impl } from '#schema';
|
|
2
2
|
import { CjsModel } from '#model';
|
|
3
3
|
|
|
4
4
|
// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepGenerateMips.h
|
|
@@ -6,11 +6,38 @@ import { CjsModel } from '#model';
|
|
|
6
6
|
// generation itself happens where the pipeline is executed.
|
|
7
7
|
|
|
8
8
|
/** Tr2TexturePipelineStepGenerateMips (resources) - attribute-free Blue marker class. */
|
|
9
|
-
class Tr2TexturePipelineStepGenerateMips extends CjsModel {
|
|
9
|
+
class Tr2TexturePipelineStepGenerateMips extends CjsModel {
|
|
10
|
+
/**
|
|
11
|
+
* Carbon's ITr2TexturePipelineStep default (ITr2TexturePipelineStep.h:21):
|
|
12
|
+
* this step names no resources.
|
|
13
|
+
*
|
|
14
|
+
* @param {Set<string>} [resources] Caller-owned; allocated when omitted.
|
|
15
|
+
* @returns {Set<string>} The set, unchanged.
|
|
16
|
+
*/
|
|
17
|
+
GetResourceDependencies(resources = new Set()) {
|
|
18
|
+
return resources;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Carbon Execute (cpp:9-15): generate the bitmap's full mip chain.
|
|
23
|
+
*
|
|
24
|
+
* @param {import("#imageio").HostBitmap} bitmap The pipeline's bitmap.
|
|
25
|
+
* @returns {boolean} Whether the step succeeded.
|
|
26
|
+
*/
|
|
27
|
+
Execute(bitmap) {
|
|
28
|
+
// Carbon: CCP_LOGERR("Tr2TexturePipelineStepGenerateMips: invalid input bitmap")
|
|
29
|
+
if (!bitmap.IsValid()) return false;
|
|
30
|
+
return bitmap.GenerateMipMaps();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
10
33
|
CjsSchema.define(Tr2TexturePipelineStepGenerateMips, {
|
|
11
34
|
className: "Tr2TexturePipelineStepGenerateMips",
|
|
12
35
|
family: "resources",
|
|
13
|
-
fields: {}
|
|
36
|
+
fields: {},
|
|
37
|
+
methods: {
|
|
38
|
+
GetResourceDependencies: [carbon.method, impl.implemented],
|
|
39
|
+
Execute: [carbon.method, impl.implemented]
|
|
40
|
+
}
|
|
14
41
|
});
|
|
15
42
|
|
|
16
43
|
export { Tr2TexturePipelineStepGenerateMips };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2TexturePipelineStepGenerateMips.js","sources":["../../../../src/resource/texture/Tr2TexturePipelineStepGenerateMips.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepGenerateMips.h\
|
|
1
|
+
{"version":3,"file":"Tr2TexturePipelineStepGenerateMips.js","sources":["../../../../src/resource/texture/Tr2TexturePipelineStepGenerateMips.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepGenerateMips.h\n// Marker step: Carbon registers the class with zero attributes; the mip\n// generation itself happens where the pipeline is executed.\nimport { carbon, CjsSchema, impl, type } from \"#schema\";\nimport { CjsModel } from \"#model\";\n\n/** Tr2TexturePipelineStepGenerateMips (resources) - attribute-free Blue marker class. */\nexport class Tr2TexturePipelineStepGenerateMips extends CjsModel\n{\n\n /**\n * Carbon's ITr2TexturePipelineStep default (ITr2TexturePipelineStep.h:21):\n * this step names no resources.\n *\n * @param {Set<string>} [resources] Caller-owned; allocated when omitted.\n * @returns {Set<string>} The set, unchanged.\n */\n GetResourceDependencies(resources = new Set())\n {\n return resources;\n }\n\n /**\n * Carbon Execute (cpp:9-15): generate the bitmap's full mip chain.\n *\n * @param {import(\"#imageio\").HostBitmap} bitmap The pipeline's bitmap.\n * @returns {boolean} Whether the step succeeded.\n */\n Execute(bitmap)\n {\n // Carbon: CCP_LOGERR(\"Tr2TexturePipelineStepGenerateMips: invalid input bitmap\")\n if (!bitmap.IsValid()) return false;\n\n return bitmap.GenerateMipMaps();\n }\n\n}\n\nCjsSchema.define(Tr2TexturePipelineStepGenerateMips, {\n className: \"Tr2TexturePipelineStepGenerateMips\", family: \"resources\",\n fields: {\n\n },\n methods: {\n GetResourceDependencies: [ carbon.method, impl.implemented ],\n Execute: [ carbon.method, impl.implemented ]\n }\n});\n"],"names":["Tr2TexturePipelineStepGenerateMips","CjsModel","GetResourceDependencies","resources","Set","Execute","bitmap","IsValid","GenerateMipMaps","CjsSchema","define","className","family","fields","methods","carbon","method","impl","implemented"],"mappings":";;;AAAA;AACA;AACA;;AAIA;AACO,MAAMA,kCAAkC,SAASC,QAAQ,CAChE;AAEE;AACF;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,uBAAuBA,CAACC,SAAS,GAAG,IAAIC,GAAG,EAAE,EAC7C;AACE,IAAA,OAAOD,SAAS;AAClB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACEE,OAAOA,CAACC,MAAM,EACd;AACE;IACA,IAAI,CAACA,MAAM,CAACC,OAAO,EAAE,EAAE,OAAO,KAAK;AAEnC,IAAA,OAAOD,MAAM,CAACE,eAAe,EAAE;AACjC,EAAA;AAEF;AAEAC,SAAS,CAACC,MAAM,CAACV,kCAAkC,EAAE;AACnDW,EAAAA,SAAS,EAAE,oCAAoC;AAAEC,EAAAA,MAAM,EAAE,WAAW;EACpEC,MAAM,EAAE,EAEP;AACDC,EAAAA,OAAO,EAAE;IACPZ,uBAAuB,EAAE,CAAEa,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,WAAW,CAAE;IAC5Db,OAAO,EAAE,CAAEU,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,WAAW;AAC5C;AACF,CAAC,CAAC;;;;"}
|