@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.
Files changed (384) hide show
  1. package/dist/global/blue/BlueClasses.js +200 -0
  2. package/dist/global/blue/BlueClasses.js.map +1 -0
  3. package/dist/global/blue/IBlueClasses.js +79 -0
  4. package/dist/global/blue/IBlueClasses.js.map +1 -0
  5. package/dist/global/blue/IBlueDynamicResourceConstructor.js +16 -0
  6. package/dist/global/blue/IBlueDynamicResourceConstructor.js.map +1 -1
  7. package/dist/global/blue/blue.js +8 -2
  8. package/dist/global/blue/blue.js.map +1 -1
  9. package/dist/global/blue/index.js +2 -0
  10. package/dist/global/blue/index.js.map +1 -1
  11. package/dist/global/consts/index.js +0 -1
  12. package/dist/global/consts/index.js.map +1 -1
  13. package/dist/global/consts/renderContext/formats.js +26 -25
  14. package/dist/global/consts/renderContext/formats.js.map +1 -1
  15. package/dist/{trinityal/Tr2BitmapDimensions.js → global/imageio/BitmapDimensions.js} +19 -15
  16. package/dist/global/imageio/BitmapDimensions.js.map +1 -0
  17. package/dist/global/imageio/Cutout.js +28 -0
  18. package/dist/global/imageio/Cutout.js.map +1 -0
  19. package/dist/global/imageio/HostBitmap.js +1106 -0
  20. package/dist/global/imageio/HostBitmap.js.map +1 -0
  21. package/dist/global/imageio/ImageIOResult.js +99 -0
  22. package/dist/global/imageio/ImageIOResult.js.map +1 -0
  23. package/dist/global/imageio/ImageUtility.js +205 -0
  24. package/dist/global/imageio/ImageUtility.js.map +1 -0
  25. package/dist/global/imageio/LoadParameters.js +86 -0
  26. package/dist/global/imageio/LoadParameters.js.map +1 -0
  27. package/dist/global/imageio/Metadata.js +22 -0
  28. package/dist/global/imageio/Metadata.js.map +1 -0
  29. package/dist/global/imageio/index.js +8 -0
  30. package/dist/global/{consts/webgpu → imageio}/index.js.map +1 -1
  31. package/dist/global/index.js +2 -1
  32. package/dist/global/index.js.map +1 -1
  33. package/dist/global/math/color.js +1 -1
  34. package/dist/global/math/color.js.map +1 -1
  35. package/dist/global/schema/CjsSchema.js +8 -0
  36. package/dist/global/schema/CjsSchema.js.map +1 -1
  37. package/dist/index.js +12 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/resource/CjsResMan.js +47 -7
  40. package/dist/resource/CjsResMan.js.map +1 -1
  41. package/dist/resource/Tr2LightProfileRes.js +37 -0
  42. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  43. package/dist/resource/format/CjsByteWriter.js +46 -46
  44. package/dist/resource/format/CjsByteWriter.js.map +1 -1
  45. package/dist/resource/format/CjsFormat.js +7 -8
  46. package/dist/resource/format/CjsFormat.js.map +1 -1
  47. package/dist/resource/format/CjsFormatStore.js +8 -8
  48. package/dist/resource/format/CjsFormatStore.js.map +1 -1
  49. package/dist/resource/format/CjsGeometryFormat.js +114 -0
  50. package/dist/resource/format/CjsGeometryFormat.js.map +1 -0
  51. package/dist/resource/format/CjsImageFormat.js +282 -0
  52. package/dist/resource/format/CjsImageFormat.js.map +1 -0
  53. package/dist/resource/format/CjsResourceProbe.js +12 -48
  54. package/dist/resource/format/CjsResourceProbe.js.map +1 -1
  55. package/dist/resource/format/CjsStringTable.js +37 -37
  56. package/dist/resource/format/CjsStringTable.js.map +1 -1
  57. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js +10 -10
  58. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
  59. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js +37 -37
  60. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -1
  61. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +35 -7
  62. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  63. package/dist/resource/format/index.js +3 -1
  64. package/dist/resource/format/index.js.map +1 -1
  65. package/dist/resource/formats/black/CjsBlackFormat.js +130 -137
  66. package/dist/resource/formats/black/CjsBlackFormat.js.map +1 -1
  67. package/dist/resource/formats/bnk/CjsBnkFormat.js +12 -19
  68. package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
  69. package/dist/resource/formats/bnk/core/helpers.js +1 -3
  70. package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
  71. package/dist/resource/formats/cmf/CjsCmfFormat.js +19 -82
  72. package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
  73. package/dist/resource/formats/cmf/core/constants.js +1 -2
  74. package/dist/resource/formats/cmf/core/constants.js.map +1 -1
  75. package/dist/resource/formats/{stl/core/targets.js → cmf/core/flatShared.js} +9 -8
  76. package/dist/resource/formats/cmf/core/flatShared.js.map +1 -0
  77. package/dist/resource/formats/cmf/core/helpers.js +13 -13
  78. package/dist/resource/formats/cmf/core/helpers.js.map +1 -1
  79. package/dist/resource/formats/cmf/core/writer.js +24 -24
  80. package/dist/resource/formats/cmf/core/writer.js.map +1 -1
  81. package/dist/resource/formats/dds/CjsDdsFormat.js +134 -17
  82. package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
  83. package/dist/resource/formats/dds/core/helpers.js +125 -40
  84. package/dist/resource/formats/dds/core/helpers.js.map +1 -1
  85. package/dist/resource/formats/dxbc/CjsDxbcFormat.js +14 -16
  86. package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  87. package/dist/resource/formats/dxbc/core/{container.js → DxbcContainer.js} +2 -2
  88. package/dist/resource/formats/dxbc/core/DxbcContainer.js.map +1 -0
  89. package/dist/resource/formats/dxbc/core/{errors.js → DxbcReadError.js} +1 -1
  90. package/dist/resource/formats/dxbc/core/DxbcReadError.js.map +1 -0
  91. package/dist/resource/formats/dxbc/core/DxbcReader.js +1 -1
  92. package/dist/resource/formats/dxbc/core/DxbcReader.js.map +1 -1
  93. package/dist/resource/formats/dxbc/core/{program.js → DxbcShaderProgram.js} +2 -2
  94. package/dist/resource/formats/dxbc/core/DxbcShaderProgram.js.map +1 -0
  95. package/dist/resource/formats/dxbc/core/{signature.js → DxbcSignatureChunk.js} +2 -2
  96. package/dist/resource/formats/dxbc/core/DxbcSignatureChunk.js.map +1 -0
  97. package/dist/resource/formats/dxbc/core/decoder.js +2 -2
  98. package/dist/resource/formats/dxbc/core/decoder.js.map +1 -1
  99. package/dist/resource/formats/dxbc/core/helpers.js +3 -3
  100. package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
  101. package/dist/resource/formats/fbx/CjsFbxFormat.js +18 -20
  102. package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
  103. package/dist/resource/formats/flac/CjsFlacFormat.js +7 -13
  104. package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
  105. package/dist/resource/formats/fsd/32/CjsFsd32Format.js +29 -29
  106. package/dist/resource/formats/fsd/32/CjsFsd32Format.js.map +1 -1
  107. package/dist/resource/formats/fsd/64/CjsFsd64Format.js +3 -3
  108. package/dist/resource/formats/fsd/64/CjsFsd64Format.js.map +1 -1
  109. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js +23 -23
  110. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -1
  111. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js +8 -8
  112. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -1
  113. package/dist/resource/formats/fsd/CjsFsdFormat.js +23 -23
  114. package/dist/resource/formats/fsd/CjsFsdFormat.js.map +1 -1
  115. package/dist/resource/formats/gif/CjsGifFormat.js +24 -15
  116. package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
  117. package/dist/resource/formats/gltf/CjsGltfFormat.js +33 -98
  118. package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
  119. package/dist/resource/formats/gltf/core/helpers.js +3 -12
  120. package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
  121. package/dist/resource/formats/gr2/CjsGr2Format.js +27 -91
  122. package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
  123. package/dist/resource/formats/hlsl/CjsHlslFormat.js +22 -25
  124. package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
  125. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js +1 -1
  126. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
  127. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +3 -3
  128. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -1
  129. package/dist/resource/formats/ies/CjsIESFormat.js +29 -29
  130. package/dist/resource/formats/ies/CjsIESFormat.js.map +1 -1
  131. package/dist/resource/formats/jpeg/CjsJpegFormat.js +24 -15
  132. package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
  133. package/dist/resource/formats/jpeg/core/helpers.js +3 -5
  134. package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
  135. package/dist/resource/formats/jpeg/core/jpeg.js +58 -58
  136. package/dist/resource/formats/jpeg/core/jpeg.js.map +1 -1
  137. package/dist/resource/formats/jsonl/CjsJsonlFormat.js +3 -3
  138. package/dist/resource/formats/jsonl/CjsJsonlFormat.js.map +1 -1
  139. package/dist/resource/formats/mp3/CjsMp3Format.js +7 -14
  140. package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
  141. package/dist/resource/formats/mp3/core/helpers.js +3 -5
  142. package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
  143. package/dist/resource/formats/mp4/CjsMp4Format.js +7 -13
  144. package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
  145. package/dist/resource/formats/mp4/core/helpers.js +3 -5
  146. package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
  147. package/dist/resource/formats/obj/CjsObjFormat.js +92 -157
  148. package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
  149. package/dist/resource/formats/obj/core/helpers.js +5 -113
  150. package/dist/resource/formats/obj/core/helpers.js.map +1 -1
  151. package/dist/resource/formats/ogg/CjsOggFormat.js +7 -14
  152. package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
  153. package/dist/resource/formats/pickle/CjsPickleFormat.js +7 -12
  154. package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
  155. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js +7 -7
  156. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -1
  157. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js +7 -7
  158. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js.map +1 -1
  159. package/dist/resource/formats/png/CjsPngFormat.js +40 -15
  160. package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
  161. package/dist/resource/formats/png/core/helpers.js +4 -6
  162. package/dist/resource/formats/png/core/helpers.js.map +1 -1
  163. package/dist/resource/formats/red/CjsRedFormat.js +22 -28
  164. package/dist/resource/formats/red/CjsRedFormat.js.map +1 -1
  165. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js +3 -7
  166. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
  167. package/dist/resource/formats/schemabound/core/schemaBoundValues.js +5 -0
  168. package/dist/resource/formats/schemabound/core/schemaBoundValues.js.map +1 -1
  169. package/dist/resource/formats/sqlite/CjsSqliteFormat.js +4 -9
  170. package/dist/resource/formats/sqlite/CjsSqliteFormat.js.map +1 -1
  171. package/dist/resource/formats/static/CjsStaticFormat.js +4 -4
  172. package/dist/resource/formats/static/CjsStaticFormat.js.map +1 -1
  173. package/dist/resource/formats/stl/CjsStlFormat.js +39 -104
  174. package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
  175. package/dist/resource/formats/stl/core/helpers.js +5 -19
  176. package/dist/resource/formats/stl/core/helpers.js.map +1 -1
  177. package/dist/resource/formats/tga/CjsTgaFormat.js +26 -15
  178. package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
  179. package/dist/resource/formats/tga/core/helpers.js +3 -5
  180. package/dist/resource/formats/tga/core/helpers.js.map +1 -1
  181. package/dist/resource/formats/vta/CjsVtaFormat.js +8 -15
  182. package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
  183. package/dist/resource/formats/wav/CjsWavFormat.js +7 -14
  184. package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
  185. package/dist/resource/formats/wav/core/helpers.js +3 -5
  186. package/dist/resource/formats/wav/core/helpers.js.map +1 -1
  187. package/dist/resource/formats/webgl/CjsWebglFormat.js +103 -105
  188. package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
  189. package/dist/resource/formats/webgl/core/{errors.js → WebglReadError.js} +1 -1
  190. package/dist/resource/formats/webgl/core/WebglReadError.js.map +1 -0
  191. package/dist/resource/formats/webgl/core/effectPackage.js +1 -1
  192. package/dist/resource/formats/webgl/core/effectPackage.js.map +1 -1
  193. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +3 -3
  194. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  195. package/dist/resource/formats/webgl/core/glsl/{DxbcGlslHelpers.js → DxbcGlslHelperRegistry.js} +2 -2
  196. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelperRegistry.js.map +1 -0
  197. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +1 -1
  198. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  199. package/dist/resource/formats/webgl/core/glslBackendBlock.js +1 -1
  200. package/dist/resource/formats/webgl/core/glslBackendBlock.js.map +1 -1
  201. package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
  202. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +28 -29
  203. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  204. package/dist/resource/formats/webgpu/core/{errors.js → WebgpuReadError.js} +1 -1
  205. package/dist/resource/formats/webgpu/core/WebgpuReadError.js.map +1 -0
  206. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js +1 -1
  207. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -1
  208. package/dist/resource/formats/webgpu/core/helpers.js +1 -1
  209. package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
  210. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js +1 -1
  211. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -1
  212. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js +18 -6
  213. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  214. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +39 -13
  215. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
  216. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +16 -14
  217. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -1
  218. package/dist/resource/formats/webm/CjsWebmFormat.js +8 -13
  219. package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
  220. package/dist/resource/formats/webm/core/helpers.js +3 -5
  221. package/dist/resource/formats/webm/core/helpers.js.map +1 -1
  222. package/dist/resource/formats/webp/CjsWebpFormat.js +8 -12
  223. package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
  224. package/dist/resource/formats/wem/CjsWemFormat.js +9 -17
  225. package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
  226. package/dist/resource/formats/wem/core/bitStream.js +35 -35
  227. package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
  228. package/dist/resource/formats/wem/core/helpers.js +1 -3
  229. package/dist/resource/formats/wem/core/helpers.js.map +1 -1
  230. package/dist/resource/formats/yaml/CjsYamlFormat.js +28 -37
  231. package/dist/resource/formats/yaml/CjsYamlFormat.js.map +1 -1
  232. package/dist/resource/imageio/ImageIO.js +142 -0
  233. package/dist/resource/imageio/ImageIO.js.map +1 -0
  234. package/dist/resource/imageio/index.js +17 -0
  235. package/dist/resource/imageio/index.js.map +1 -0
  236. package/dist/resource/index.js +7 -0
  237. package/dist/resource/index.js.map +1 -1
  238. package/dist/resource/shader/reflection/Tr2EffectResource.js +24 -2
  239. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  240. package/dist/resource/shader/reflection/Tr2Pass.js +76 -5
  241. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  242. package/dist/resource/texture/CjsTextureArrayConstructor.js +97 -0
  243. package/dist/resource/texture/CjsTextureArrayConstructor.js.map +1 -0
  244. package/dist/resource/texture/CjsTexturePackConstructor.js +160 -0
  245. package/dist/resource/texture/CjsTexturePackConstructor.js.map +1 -0
  246. package/dist/resource/texture/CjsTexturePipelineStepArray.js +72 -0
  247. package/dist/resource/texture/CjsTexturePipelineStepArray.js.map +1 -0
  248. package/dist/resource/texture/CjsTexturePipelineStepConvert.js +73 -0
  249. package/dist/resource/texture/CjsTexturePipelineStepConvert.js.map +1 -0
  250. package/dist/resource/texture/CjsTexturePipelineStepPack.js +71 -0
  251. package/dist/resource/texture/CjsTexturePipelineStepPack.js.map +1 -0
  252. package/dist/resource/texture/CjsTexturePipelineStepResize.js +123 -0
  253. package/dist/resource/texture/CjsTexturePipelineStepResize.js.map +1 -0
  254. package/dist/resource/texture/SolidColorTextureConstructor.js +11 -1
  255. package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -1
  256. package/dist/resource/texture/Tr2ImageRes.js +100 -68
  257. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  258. package/dist/resource/texture/Tr2TexturePipeline.js +45 -25
  259. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
  260. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +34 -1
  261. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
  262. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +30 -3
  263. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
  264. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +81 -1
  265. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
  266. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +36 -1
  267. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
  268. package/dist/resource/texture/Tr2TexturePipelineStepPack.js +146 -24
  269. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
  270. package/dist/resource/texture/TriTextureRes.js +151 -29
  271. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  272. package/dist/resource/texture/index.js +7 -0
  273. package/dist/resource/texture/index.js.map +1 -1
  274. package/dist/resource/texture/registerTextureResources.js +83 -0
  275. package/dist/resource/texture/registerTextureResources.js.map +1 -0
  276. package/dist/resource/texture/solidColorTexture.js +10 -19
  277. package/dist/resource/texture/solidColorTexture.js.map +1 -1
  278. package/dist/sof/EveSOF.js +39 -7
  279. package/dist/sof/EveSOF.js.map +1 -1
  280. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js +2 -2
  281. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -1
  282. package/dist/trinity/core/Tr2ImageIOHelpers.js +80 -17
  283. package/dist/trinity/core/Tr2ImageIOHelpers.js.map +1 -1
  284. package/dist/trinity/core/Tr2RenderUtils.js +1 -1
  285. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js +49 -62
  286. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -1
  287. package/dist/trinity/core/Tr2TextureReference.js +114 -0
  288. package/dist/trinity/core/Tr2TextureReference.js.map +1 -0
  289. package/dist/trinity/core/device/Tr2DepthStencil.js +2 -2
  290. package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
  291. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js +1 -1
  292. package/dist/trinity/core/index.js +1 -0
  293. package/dist/trinity/core/index.js.map +1 -1
  294. package/dist/trinity/core/lighting/Tr2LightManager.js +5 -4
  295. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  296. package/dist/trinity/core/procedural/GradientTextureConstructor.js +5 -4
  297. package/dist/trinity/core/procedural/GradientTextureConstructor.js.map +1 -1
  298. package/dist/trinity/core/procedural/gradientTexture.js +10 -13
  299. package/dist/trinity/core/procedural/gradientTexture.js.map +1 -1
  300. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +1 -1
  301. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
  302. package/dist/trinity/eve/EveImpactOverlay.js +102 -50
  303. package/dist/trinity/eve/EveImpactOverlay.js.map +1 -1
  304. package/dist/trinity/eve/EveModularObjectModifier.js +9 -18
  305. package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
  306. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +175 -157
  307. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
  308. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js +100 -83
  309. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js.map +1 -1
  310. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +26 -20
  311. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -1
  312. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js +368 -179
  313. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -1
  314. package/dist/trinity/eve/child/EveChildMesh.js +242 -234
  315. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  316. package/dist/trinity/eve/child/EveChildTurret.js +57 -16
  317. package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
  318. package/dist/trinity/eve/child/EveSpaceObjectChild.js +28 -1
  319. package/dist/trinity/eve/child/EveSpaceObjectChild.js.map +1 -1
  320. package/dist/trinity/eve/index.js +2 -2
  321. package/dist/trinity/eve/overlays/EveDamageOverlay.js +5 -1
  322. package/dist/trinity/eve/overlays/EveDamageOverlay.js.map +1 -1
  323. package/dist/trinity/eve/scene/EveSpaceScene.js +234 -233
  324. package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
  325. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +2 -0
  326. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
  327. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +492 -437
  328. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  329. package/dist/trinity/generated/index.js +0 -1
  330. package/dist/trinity/generated/index.js.map +1 -1
  331. package/dist/trinity/generated/trinityCore/index.js +0 -1
  332. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  333. package/dist/trinity/index.js +3 -3
  334. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +10 -1
  335. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
  336. package/dist/trinity/shader/Tr2DataTextureManager.js +152 -66
  337. package/dist/trinity/shader/Tr2DataTextureManager.js.map +1 -1
  338. package/dist/trinity/shader/Tr2Material.js +1 -1
  339. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js +5 -5
  340. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -1
  341. package/dist/trinityal/index.js +1 -1
  342. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js +2 -2
  343. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -1
  344. package/dist/trinityal/stub/Tr2SwapChainALStub.js +45 -45
  345. package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
  346. package/dist/trinityal/stub/Tr2TextureALStub.js +170 -170
  347. package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
  348. package/dist/trinityal/webgpu/CjsWebgpuDevice.js +234 -164
  349. package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
  350. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +7 -0
  351. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  352. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +78 -14
  353. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  354. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +94 -0
  355. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -0
  356. package/dist/trinityal/webgpu/internal.js +1 -0
  357. package/dist/trinityal/webgpu/internal.js.map +1 -1
  358. package/docs/global/reference/classes/README.md +90 -0
  359. package/docs/resource/concepts/format-capabilities.md +3 -3
  360. package/docs/resource/formats/README.md +1 -1
  361. package/docs/resource/reference/classes/core.md +31 -1
  362. package/docs/resource/reference/classes/formats.md +7 -7
  363. package/docs/resource/reference/classes/resources.md +76 -16
  364. package/docs/trinity/reference/classes/generated.md +0 -10
  365. package/docs/trinity/reference/classes/trinity-core.md +1692 -1682
  366. package/docs/trinityal/reference/classes/README.md +0 -10
  367. package/docs/trinityal/webgpu/reference/classes/README.md +276 -266
  368. package/package.json +4 -3
  369. package/dist/global/consts/webgpu/index.js +0 -2
  370. package/dist/global/consts/webgpu/textureFormats.js +0 -180
  371. package/dist/global/consts/webgpu/textureFormats.js.map +0 -1
  372. package/dist/resource/formats/dxbc/core/container.js.map +0 -1
  373. package/dist/resource/formats/dxbc/core/errors.js.map +0 -1
  374. package/dist/resource/formats/dxbc/core/program.js.map +0 -1
  375. package/dist/resource/formats/dxbc/core/signature.js.map +0 -1
  376. package/dist/resource/formats/stl/core/targets.js.map +0 -1
  377. package/dist/resource/formats/webgl/core/errors.js.map +0 -1
  378. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +0 -1
  379. package/dist/resource/formats/webgpu/core/errors.js.map +0 -1
  380. package/dist/resource/texture/texturePipelineBehavior.js +0 -332
  381. package/dist/resource/texture/texturePipelineBehavior.js.map +0 -1
  382. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js +0 -40
  383. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js.map +0 -1
  384. 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 { validateRgbaPayload } from '../format/payloadContract.js';
4
- import { validateResourcePayload } from '../resourceBoundary.js';
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
- validateResourcePayload("Tr2ImageRes", payload, validateRgbaPayload);
43
- const values = {
44
- ...(options || {})
45
- };
46
- values.width = payload.width;
47
- values.height = payload.height;
48
- super.SetPayload(payload);
49
- this.SetValues(values);
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
- * Read pixel color from payload metadata when a simple pixel accessor exists.
73
- *
74
- * @param {number} x
75
- * @param {number} y
76
- * @returns {*}
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 payload = this.GetPayload();
80
- if (!payload || !Number.isInteger(x) || !Number.isInteger(y) || x < 0 || y < 0 || x >= payload.width || y >= payload.height) return null;
81
- const elementsPerRow = payload.strideBytes / payload.data.BYTES_PER_ELEMENT;
82
- const offset = y * elementsPerRow + x * 4;
83
- return Array.from(payload.data.subarray(offset, offset + 4));
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
- * Return true when a pixel alpha channel is absent or non-zero.
88
- *
89
- * @param {number} x
90
- * @param {number} y
91
- * @returns {boolean}
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
- const color = this.GetPixelColor(x, y);
95
- if (!Array.isArray(color)) return false;
96
- return color.length < 4 || color[3] > 0;
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:138): the host bitmap DoLoad decoded.
101
- * The canonical RGBA payload IS that bitmap here.
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.GetPayload();
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,IAAI;AAChBC,MAAAA,UAAU,EAAE;AACd,KAAC,CAAC;AACJ,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,UAAUA,CAACC,OAAO,GAAG,IAAI,EAAEC,OAAO,GAAG,IAAI,EACzC;I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BC,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,IAAIC,UAAU,EAAE;;AAEzB;AACAC,EAAAA,KAAK,GAAG,CAAC;;AAET;AACAC,EAAAA,MAAM,GAAG,CAAC;;AAEV;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EAAE;AACzB,IAAA,KAAK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,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 { executeTexturePipeline, getTexturePipelineDependencies } from './texturePipelineBehavior.js';
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
- * Inputs are supplied explicitly, through a load callback, or through an
17
- * injected CjsResMan. The result is a canonical plain RGBA payload.
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 the CPU pipeline and return a canonical RGBA payload.
37
- *
38
- * @param {number} maxWidth Optional caller width limit.
39
- * @param {number} maxHeight Optional caller height limit.
40
- * @param {object|null} options Input map, load callback, or CjsResMan.
41
- * @returns {Promise<object>} Canonical RGBA payload.
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
- async Execute(maxWidth = 0, maxHeight = 0, options = null) {
44
- return executeTexturePipeline(this.steps, {
45
- maxWidth,
46
- maxHeight
47
- }, options);
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
- * Return sorted unique resource paths consumed by load and pack steps.
52
- *
53
- * @returns {string[]} Resource dependency paths.
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
- return getTexturePipelineDependencies(this.steps);
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 fills an ImageIO::HostBitmap through blocking file reads; JavaScript resolves inputs asynchronously and returns the runtime resource layer's plain CPU payload.")],
68
- GetResourceDependencies: [carbon.method, impl.implemented]
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\r\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipeline.cpp\r\n// Source: trinity/trinity/Resources/TexturePipeline/ITr2TexturePipelineStep.h\r\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepLoad.cpp\r\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepLimitSize.cpp\r\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepCompress.cpp\r\n// Source: trinity/trinity/Resources/TexturePipeline/Tr2TexturePipelineStepPack.cpp\r\nimport { carbon, CjsSchema, impl, edit, type } from \"#schema\";\r\nimport { CjsModel } from \"#model\";\r\nimport {\r\n executeTexturePipeline,\r\n getTexturePipelineDependencies\r\n} from \"./texturePipelineBehavior.js\";\r\n\r\n/**\r\n * Carbon texture-specific CPU bitmap transformation pipeline.\r\n *\r\n * Inputs are supplied explicitly, through a load callback, or through an\r\n * injected CjsResMan. The result is a canonical plain RGBA payload.\r\n */\r\nexport class Tr2TexturePipeline extends CjsModel\r\n{\r\n\r\n /** m_pipelineType (std::string) [READWRITE, PERSIST] */\r\n pipelineType = \"\";\r\n\r\n /** m_steps (PITr2TexturePipelineStepVector) [READ, PERSIST] */\r\n steps = [];\r\n\r\n /** Creates a Tr2TexturePipeline with caller-provided initial state. */\r\n constructor(values = null)\r\n {\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 * Execute the CPU pipeline and return a canonical RGBA payload.\r\n *\r\n * @param {number} maxWidth Optional caller width limit.\r\n * @param {number} maxHeight Optional caller height limit.\r\n * @param {object|null} options Input map, load callback, or CjsResMan.\r\n * @returns {Promise<object>} Canonical RGBA payload.\r\n */\r\n async Execute(maxWidth = 0, maxHeight = 0, options = null)\r\n {\r\n return executeTexturePipeline(this.steps, { maxWidth, maxHeight }, options);\r\n }\r\n\r\n /**\r\n * Return sorted unique resource paths consumed by load and pack steps.\r\n *\r\n * @returns {string[]} Resource dependency paths.\r\n */\r\n GetResourceDependencies()\r\n {\r\n return getTexturePipelineDependencies(this.steps);\r\n }\r\n\r\n}\r\n\r\nCjsSchema.define(Tr2TexturePipeline, {\r\n className: \"Tr2TexturePipeline\", family: \"resources\",\r\n fields: {\r\n pipelineType: [ edit.persist, type.string ],\n steps: [ edit.persist, type.list(\"ITr2TexturePipelineStep\") ]\r\n },\r\n methods: {\r\n Execute: [ carbon.method, impl.adapted, impl.reason(\"Carbon fills an ImageIO::HostBitmap through blocking file reads; JavaScript resolves inputs asynchronously and returns the runtime resource layer's plain CPU payload.\") ],\n GetResourceDependencies: [ carbon.method, impl.implemented ]\r\n }\r\n});\r\n"],"names":["Tr2TexturePipeline","CjsModel","pipelineType","steps","constructor","values","SetValues","skipUpdate","skipEvents","Execute","maxWidth","maxHeight","options","executeTexturePipeline","GetResourceDependencies","getTexturePipelineDependencies","CjsSchema","define","className","family","fields","edit","persist","type","string","list","methods","carbon","method","impl","adapted","reason","implemented"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;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;AACE,EAAA,MAAMC,OAAOA,CAACC,QAAQ,GAAG,CAAC,EAAEC,SAAS,GAAG,CAAC,EAAEC,OAAO,GAAG,IAAI,EACzD;AACE,IAAA,OAAOC,sBAAsB,CAAC,IAAI,CAACV,KAAK,EAAE;MAAEO,QAAQ;AAAEC,MAAAA;KAAW,EAAEC,OAAO,CAAC;AAC7E,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEE,EAAAA,uBAAuBA,GACvB;AACE,IAAA,OAAOC,8BAA8B,CAAC,IAAI,CAACZ,KAAK,CAAC;AACnD,EAAA;AAEF;AAEAa,SAAS,CAACC,MAAM,CAACjB,kBAAkB,EAAE;AACnCkB,EAAAA,SAAS,EAAE,oBAAoB;AAAEC,EAAAA,MAAM,EAAE,WAAW;AACpDC,EAAAA,MAAM,EAAE;IACNlB,YAAY,EAAE,CAAEmB,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,MAAM,CAAE;IAC3CrB,KAAK,EAAE,CAAEkB,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACE,IAAI,CAAC,yBAAyB,CAAC;GAC5D;AACDC,EAAAA,OAAO,EAAE;AACPjB,IAAAA,OAAO,EAAE,CAAEkB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,wKAAwK,CAAC,CAAE;IAC/NjB,uBAAuB,EAAE,CAAEa,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACG,WAAW;AAC5D;AACF,CAAC,CAAC;;;;"}
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,CA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'#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\r\n// Schema: format-carbon resources/Tr2TexturePipelineStepCompress.json; maintained by the runtime resource layer.\r\nimport { CjsSchema, edit, type } from \"#schema\";\r\nimport { CjsModel } from \"#model\";\r\n\r\n/** Tr2TexturePipelineStepCompress (resources) - maintained from schema shapeHash 4d367f1c.... */\r\nexport class Tr2TexturePipelineStepCompress extends CjsModel\r\n{\r\n\r\n /** m_format (Tr2RenderContextEnum::PixelFormat - enum PixelFormat) [READWRITE, PERSIST, ENUM] */\r\n format = 71;\r\n\r\n /** m_bWeight (float) [READWRITE, PERSIST] */\r\n b = 1;\r\n\r\n /** m_gWeight (float) [READWRITE, PERSIST] */\r\n g = 1;\r\n\r\n /** m_rWeight (float) [READWRITE, PERSIST] */\r\n r = 1;\r\n\r\n}\r\n\r\nCjsSchema.define(Tr2TexturePipelineStepCompress, {\r\n className: \"Tr2TexturePipelineStepCompress\", family: \"resources\",\r\n fields: {\r\n format: [ edit.persist, type.int32, type.enum(\"PixelFormat\") ],\r\n b: [ edit.persist, type.float32 ],\r\n g: [ edit.persist, type.float32 ],\r\n r: [ edit.persist, type.float32 ]\r\n }\r\n});\r\n"],"names":["Tr2TexturePipelineStepCompress","CjsModel","format","b","g","r","CjsSchema","define","className","family","fields","edit","persist","type","int32","enum","float32"],"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;AAEP;AAEAC,SAAS,CAACC,MAAM,CAACP,8BAA8B,EAAE;AAC/CQ,EAAAA,SAAS,EAAE,gCAAgC;AAAEC,EAAAA,MAAM,EAAE,WAAW;AAChEC,EAAAA,MAAM,EAAE;AACNR,IAAAA,MAAM,EAAE,CAAES,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,KAAK,EAAED,IAAI,CAACE,IAAI,CAAC,aAAa,CAAC,CAAE;IAC9DZ,CAAC,EAAE,CAAEQ,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,OAAO,CAAE;IACjCZ,CAAC,EAAE,CAAEO,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,OAAO,CAAE;IACjCX,CAAC,EAAE,CAAEM,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,OAAO;AACjC;AACF,CAAC,CAAC;;;;"}
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\r\n// Marker step: Carbon registers the class with zero attributes; the mip\r\n// generation itself happens where the pipeline is executed.\r\nimport { CjsSchema, type } from \"#schema\";\r\nimport { CjsModel } from \"#model\";\r\n\r\n/** Tr2TexturePipelineStepGenerateMips (resources) - attribute-free Blue marker class. */\r\nexport class Tr2TexturePipelineStepGenerateMips extends CjsModel\r\n{\r\n}\r\n\r\nCjsSchema.define(Tr2TexturePipelineStepGenerateMips, {\r\n className: \"Tr2TexturePipelineStepGenerateMips\", family: \"resources\",\r\n fields: {\r\n\r\n }\r\n});\r\n"],"names":["Tr2TexturePipelineStepGenerateMips","CjsModel","CjsSchema","define","className","family","fields"],"mappings":";;;AAAA;AACA;AACA;;AAIA;AACO,MAAMA,kCAAkC,SAASC,QAAQ,CAChE;AAGAC,SAAS,CAACC,MAAM,CAACH,kCAAkC,EAAE;AACnDI,EAAAA,SAAS,EAAE,oCAAoC;AAAEC,EAAAA,MAAM,EAAE,WAAW;AACpEC,EAAAA,MAAM,EAAE;AAGV,CAAC,CAAC;;;;"}
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;;;;"}