@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
@@ -0,0 +1,160 @@
1
+ import { IBlueDynamicResourceConstructor } from '#blue';
2
+ import { PixelFormat } from '#consts/render-context';
3
+ import { TriTextureRes } from './TriTextureRes.js';
4
+ import { Tr2TexturePipeline } from './Tr2TexturePipeline.js';
5
+ import { CjsTexturePipelineStepPack } from './CjsTexturePipelineStepPack.js';
6
+ import { Tr2TexturePackChannel } from './Tr2TexturePackChannel.js';
7
+ import { Tr2TexturePipelineStepGenerateMips } from './Tr2TexturePipelineStepGenerateMips.js';
8
+ import { CjsTexturePipelineStepConvert } from './CjsTexturePipelineStepConvert.js';
9
+ import { CjsTexturePipelineStepResize } from './CjsTexturePipelineStepResize.js';
10
+
11
+ // Not Carbon: `dynamic:/texturepack` is ours, registered in
12
+ // /docs/architecture/non-carbon-extensions.md. Carbon's dynamic constructors
13
+ // (SolidColorTexture.cpp, GradientTexture.cpp) rasterize from values in the
14
+ // query; this one composes other resources.
15
+
16
+ /** The prefix a pack path starts with. */
17
+ const TexturePackPrefix = "dynamic:/texturepack/";
18
+
19
+ /** Authored channel letters, in Carbon's RGBA authoring order. */
20
+ const CHANNEL_INDEX = {
21
+ r: 0,
22
+ g: 1,
23
+ b: 2,
24
+ a: 3
25
+ };
26
+
27
+ /**
28
+ * `dynamic:/texturepack/<source>;<source>...` - up to four channels packed
29
+ * from separate images into one texture.
30
+ *
31
+ * Each source is a resource path, optionally followed by the channels to take
32
+ * from it: `res:/a.dds:rg;res:/b.dds:rg` puts a's red and green into red and
33
+ * green, and b's into blue and alpha. Without a suffix a source gives its red
34
+ * channel, as the scalar maps this exists for store their value there. The
35
+ * query becomes a Carbon texture-pipeline recipe - Convert, Resize, Pack,
36
+ * GenerateMips - which the texture runs through Carbon's `.ctr` route.
37
+ *
38
+ * Kept in the cache after release: rebuilding means downloading and decoding
39
+ * every source again.
40
+ */
41
+ class CjsTexturePackConstructor extends IBlueDynamicResourceConstructor {
42
+ /**
43
+ * @param {object} resourceManager The `CjsResMan` that loads the sources.
44
+ */
45
+ constructor(resourceManager) {
46
+ super();
47
+ this._resourceManager = resourceManager;
48
+ }
49
+
50
+ /**
51
+ * A generated pack costs downloads and decodes to rebuild, so it is kept.
52
+ *
53
+ * @returns {boolean} Always true.
54
+ */
55
+ IsCacheable() {
56
+ return true;
57
+ }
58
+
59
+ /**
60
+ * Build the texture a pack query describes. The recipe starts running at
61
+ * once; the texture is prepared when it finishes.
62
+ *
63
+ * @param {string} query Text after `dynamic:/texturepack/`.
64
+ * @returns {TriTextureRes} The texture resource.
65
+ */
66
+ GetResource(query) {
67
+ const texture = new TriTextureRes();
68
+ texture.Initialize(TexturePackPrefix + query, "");
69
+ const pipeline = CjsTexturePackConstructor.buildRecipe(query);
70
+ if (!pipeline) {
71
+ const error = new Error(`Failed to parse ${TexturePackPrefix}${query} texture path`);
72
+ error.code = "CJS_TEXTURE_PROCEDURAL_PATH_INVALID";
73
+ texture.SetError(error);
74
+ return texture;
75
+ }
76
+ texture.LoadPipeline(pipeline, this._resourceManager);
77
+ return texture;
78
+ }
79
+
80
+ /**
81
+ * The recipe for a pack query, or null when it is malformed.
82
+ *
83
+ * @param {string} query `source[:channels];source[:channels]...`
84
+ * @returns {Tr2TexturePipeline|null} The recipe.
85
+ */
86
+ static buildRecipe(query) {
87
+ const sources = CjsTexturePackConstructor.parseQuery(query);
88
+ if (!sources) return null;
89
+ const channelCount = sources.reduce((sum, source) => sum + source.channels.length, 0);
90
+ const pack = new CjsTexturePipelineStepPack();
91
+
92
+ // The narrowest output that holds the channels: one byte a texel for one,
93
+ // two for two, BGRA for three or four.
94
+ pack.format = channelCount === 1 ? PixelFormat.PIXEL_FORMAT_R8_UNORM : channelCount === 2 ? PixelFormat.PIXEL_FORMAT_R8G8_UNORM : PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM;
95
+
96
+ // Output channels fill red, green, blue, alpha in order; alpha defaults opaque.
97
+ const outputs = ["r", "g", "b", "a"];
98
+ let slot = 0;
99
+ for (const {
100
+ path,
101
+ channels
102
+ } of sources) {
103
+ for (const letter of channels) {
104
+ pack[outputs[slot++]] = Object.assign(new Tr2TexturePackChannel(), {
105
+ path,
106
+ channel: CHANNEL_INDEX[letter]
107
+ });
108
+ }
109
+ }
110
+ for (; slot < 4; slot++) {
111
+ pack[outputs[slot]] = Object.assign(new Tr2TexturePackChannel(), {
112
+ fill: outputs[slot] === "a" ? 255 : 0
113
+ });
114
+ }
115
+ const pipeline = new Tr2TexturePipeline();
116
+ pipeline.steps = [new CjsTexturePipelineStepConvert(), new CjsTexturePipelineStepResize(), pack, new Tr2TexturePipelineStepGenerateMips()];
117
+ return pipeline;
118
+ }
119
+
120
+ /**
121
+ * Split a pack query into sources and the channels each gives.
122
+ *
123
+ * A path contains `:` itself (`res:/...`), so only a trailing `:` followed by
124
+ * one to four channel letters is read as a channel selection.
125
+ *
126
+ * @param {string} query The query.
127
+ * @returns {{path: string, channels: string[]}[]|null} Sources, or null when
128
+ * malformed or when they add up to more than four channels.
129
+ */
130
+ static parseQuery(query) {
131
+ const sources = String(query).split(";").map(part => part.trim()).filter(part => part);
132
+ if (sources.length === 0) return null;
133
+ const parsed = sources.map(part => {
134
+ const match = /^(.*):([rgba]{1,4})$/i.exec(part);
135
+ return match ? {
136
+ path: match[1],
137
+ channels: [...match[2].toLowerCase()]
138
+ } : {
139
+ path: part,
140
+ channels: ["r"]
141
+ };
142
+ });
143
+ const total = parsed.reduce((sum, source) => sum + source.channels.length, 0);
144
+ return total >= 1 && total <= 4 && parsed.every(source => source.path) ? parsed : null;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Registers `dynamic:/texturepack` on a manager.
150
+ *
151
+ * @param {object} resourceManager Manager to register on.
152
+ * @returns {object} The same manager, for chaining.
153
+ */
154
+ function RegisterTexturePack(resourceManager) {
155
+ resourceManager.RegisterResourceConstructor("texturepack", new CjsTexturePackConstructor(resourceManager));
156
+ return resourceManager;
157
+ }
158
+
159
+ export { CjsTexturePackConstructor, RegisterTexturePack, TexturePackPrefix };
160
+ //# sourceMappingURL=CjsTexturePackConstructor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsTexturePackConstructor.js","sources":["../../../../src/resource/texture/CjsTexturePackConstructor.js"],"sourcesContent":["// Not Carbon: `dynamic:/texturepack` is ours, registered in\n// /docs/architecture/non-carbon-extensions.md. Carbon's dynamic constructors\n// (SolidColorTexture.cpp, GradientTexture.cpp) rasterize from values in the\n// query; this one composes other resources.\nimport { IBlueDynamicResourceConstructor } from \"#blue\";\nimport { PixelFormat } from \"#consts/render-context\";\nimport { TriTextureRes } from \"./TriTextureRes.js\";\nimport { Tr2TexturePipeline } from \"./Tr2TexturePipeline.js\";\nimport { CjsTexturePipelineStepPack } from \"./CjsTexturePipelineStepPack.js\";\nimport { Tr2TexturePackChannel } from \"./Tr2TexturePackChannel.js\";\nimport { Tr2TexturePipelineStepGenerateMips } from \"./Tr2TexturePipelineStepGenerateMips.js\";\nimport { CjsTexturePipelineStepConvert } from \"./CjsTexturePipelineStepConvert.js\";\nimport { CjsTexturePipelineStepResize } from \"./CjsTexturePipelineStepResize.js\";\n\n/** The prefix a pack path starts with. */\nexport const TexturePackPrefix = \"dynamic:/texturepack/\";\n\n/** Authored channel letters, in Carbon's RGBA authoring order. */\nconst CHANNEL_INDEX = { r: 0, g: 1, b: 2, a: 3 };\n\n/**\n * `dynamic:/texturepack/<source>;<source>...` - up to four channels packed\n * from separate images into one texture.\n *\n * Each source is a resource path, optionally followed by the channels to take\n * from it: `res:/a.dds:rg;res:/b.dds:rg` puts a's red and green into red and\n * green, and b's into blue and alpha. Without a suffix a source gives its red\n * channel, as the scalar maps this exists for store their value there. The\n * query becomes a Carbon texture-pipeline recipe - Convert, Resize, Pack,\n * GenerateMips - which the texture runs through Carbon's `.ctr` route.\n *\n * Kept in the cache after release: rebuilding means downloading and decoding\n * every source again.\n */\nexport class CjsTexturePackConstructor extends IBlueDynamicResourceConstructor\n{\n\n /**\n * @param {object} resourceManager The `CjsResMan` that loads the sources.\n */\n constructor(resourceManager)\n {\n super();\n this._resourceManager = resourceManager;\n }\n\n /**\n * A generated pack costs downloads and decodes to rebuild, so it is kept.\n *\n * @returns {boolean} Always true.\n */\n IsCacheable()\n {\n return true;\n }\n\n /**\n * Build the texture a pack query describes. The recipe starts running at\n * once; the texture is prepared when it finishes.\n *\n * @param {string} query Text after `dynamic:/texturepack/`.\n * @returns {TriTextureRes} The texture resource.\n */\n GetResource(query)\n {\n const texture = new TriTextureRes();\n texture.Initialize(TexturePackPrefix + query, \"\");\n\n const pipeline = CjsTexturePackConstructor.buildRecipe(query);\n\n if (!pipeline)\n {\n const error = new Error(`Failed to parse ${TexturePackPrefix}${query} texture path`);\n error.code = \"CJS_TEXTURE_PROCEDURAL_PATH_INVALID\";\n texture.SetError(error);\n return texture;\n }\n\n texture.LoadPipeline(pipeline, this._resourceManager);\n return texture;\n }\n\n /**\n * The recipe for a pack query, or null when it is malformed.\n *\n * @param {string} query `source[:channels];source[:channels]...`\n * @returns {Tr2TexturePipeline|null} The recipe.\n */\n static buildRecipe(query)\n {\n const sources = CjsTexturePackConstructor.parseQuery(query);\n\n if (!sources) return null;\n\n const channelCount = sources.reduce((sum, source) => sum + source.channels.length, 0);\n const pack = new CjsTexturePipelineStepPack();\n\n // The narrowest output that holds the channels: one byte a texel for one,\n // two for two, BGRA for three or four.\n pack.format = channelCount === 1 ? PixelFormat.PIXEL_FORMAT_R8_UNORM\n : channelCount === 2 ? PixelFormat.PIXEL_FORMAT_R8G8_UNORM\n : PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM;\n\n // Output channels fill red, green, blue, alpha in order; alpha defaults opaque.\n const outputs = [ \"r\", \"g\", \"b\", \"a\" ];\n let slot = 0;\n\n for (const { path, channels } of sources)\n {\n for (const letter of channels)\n {\n pack[outputs[slot++]] = Object.assign(new Tr2TexturePackChannel(), { path, channel: CHANNEL_INDEX[letter] });\n }\n }\n\n for (; slot < 4; slot++)\n {\n pack[outputs[slot]] = Object.assign(new Tr2TexturePackChannel(), { fill: outputs[slot] === \"a\" ? 255 : 0 });\n }\n\n const pipeline = new Tr2TexturePipeline();\n pipeline.steps = [\n new CjsTexturePipelineStepConvert(),\n new CjsTexturePipelineStepResize(),\n pack,\n new Tr2TexturePipelineStepGenerateMips()\n ];\n return pipeline;\n }\n\n /**\n * Split a pack query into sources and the channels each gives.\n *\n * A path contains `:` itself (`res:/...`), so only a trailing `:` followed by\n * one to four channel letters is read as a channel selection.\n *\n * @param {string} query The query.\n * @returns {{path: string, channels: string[]}[]|null} Sources, or null when\n * malformed or when they add up to more than four channels.\n */\n static parseQuery(query)\n {\n const sources = String(query).split(\";\").map(part => part.trim()).filter(part => part);\n\n if (sources.length === 0) return null;\n\n const parsed = sources.map(part =>\n {\n const match = /^(.*):([rgba]{1,4})$/i.exec(part);\n return match\n ? { path: match[1], channels: [ ...match[2].toLowerCase() ] }\n : { path: part, channels: [ \"r\" ] };\n });\n\n const total = parsed.reduce((sum, source) => sum + source.channels.length, 0);\n return total >= 1 && total <= 4 && parsed.every(source => source.path) ? parsed : null;\n }\n\n}\n\n/**\n * Registers `dynamic:/texturepack` on a manager.\n *\n * @param {object} resourceManager Manager to register on.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterTexturePack(resourceManager)\n{\n resourceManager.RegisterResourceConstructor(\"texturepack\", new CjsTexturePackConstructor(resourceManager));\n return resourceManager;\n}\n"],"names":["TexturePackPrefix","CHANNEL_INDEX","r","g","b","a","CjsTexturePackConstructor","IBlueDynamicResourceConstructor","constructor","resourceManager","_resourceManager","IsCacheable","GetResource","query","texture","TriTextureRes","Initialize","pipeline","buildRecipe","error","Error","code","SetError","LoadPipeline","sources","parseQuery","channelCount","reduce","sum","source","channels","length","pack","CjsTexturePipelineStepPack","format","PixelFormat","PIXEL_FORMAT_R8_UNORM","PIXEL_FORMAT_R8G8_UNORM","PIXEL_FORMAT_B8G8R8A8_UNORM","outputs","slot","path","letter","Object","assign","Tr2TexturePackChannel","channel","fill","Tr2TexturePipeline","steps","CjsTexturePipelineStepConvert","CjsTexturePipelineStepResize","Tr2TexturePipelineStepGenerateMips","String","split","map","part","trim","filter","parsed","match","exec","toLowerCase","total","every","RegisterTexturePack","RegisterResourceConstructor"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;;AAWA;AACO,MAAMA,iBAAiB,GAAG;;AAEjC;AACA,MAAMC,aAAa,GAAG;AAAEC,EAAAA,CAAC,EAAE,CAAC;AAAEC,EAAAA,CAAC,EAAE,CAAC;AAAEC,EAAAA,CAAC,EAAE,CAAC;AAAEC,EAAAA,CAAC,EAAE;AAAE,CAAC;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,yBAAyB,SAASC,+BAA+B,CAC9E;AAEE;AACF;AACA;EACEC,WAAWA,CAACC,eAAe,EAC3B;AACE,IAAA,KAAK,EAAE;IACP,IAAI,CAACC,gBAAgB,GAAGD,eAAe;AACzC,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEE,EAAAA,WAAWA,GACX;AACE,IAAA,OAAO,IAAI;AACb,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,KAAK,EACjB;AACE,IAAA,MAAMC,OAAO,GAAG,IAAIC,aAAa,EAAE;IACnCD,OAAO,CAACE,UAAU,CAAChB,iBAAiB,GAAGa,KAAK,EAAE,EAAE,CAAC;AAEjD,IAAA,MAAMI,QAAQ,GAAGX,yBAAyB,CAACY,WAAW,CAACL,KAAK,CAAC;IAE7D,IAAI,CAACI,QAAQ,EACb;MACE,MAAME,KAAK,GAAG,IAAIC,KAAK,CAAC,mBAAmBpB,iBAAiB,CAAA,EAAGa,KAA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E;AAAG,OAAC,GAC3D;AAAErB,QAAAA,IAAI,EAAEe,IAAI;QAAE1B,QAAQ,EAAE,CAAE,GAAG;OAAI;AACvC,IAAA,CAAC,CAAC;IAEF,MAAMiC,KAAK,GAAGJ,MAAM,CAAChC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAKD,GAAG,GAAGC,MAAM,CAACC,QAAQ,CAACC,MAAM,EAAE,CAAC,CAAC;IAC7E,OAAOgC,KAAK,IAAI,CAAC,IAAIA,KAAK,IAAI,CAAC,IAAIJ,MAAM,CAACK,KAAK,CAACnC,MAAM,IAAIA,MAAM,CAACY,IAAI,CAAC,GAAGkB,MAAM,GAAG,IAAI;AACxF,EAAA;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,mBAAmBA,CAACxD,eAAe,EACnD;EACEA,eAAe,CAACyD,2BAA2B,CAAC,aAAa,EAAE,IAAI5D,yBAAyB,CAACG,eAAe,CAAC,CAAC;AAC1G,EAAA,OAAOA,eAAe;AACxB;;;;"}
@@ -0,0 +1,72 @@
1
+ import { CjsSchema, impl, edit, type } from '#schema';
2
+ import { CjsModel } from '#model';
3
+
4
+ // Not Carbon. A texture-pipeline step of our own, registered in
5
+ // /docs/architecture/non-carbon-extensions.md.
6
+
7
+ /**
8
+ * Stacks the named inputs, in order, into one 2D texture array: layer 0 is the
9
+ * first path.
10
+ *
11
+ * Carbon's pipeline has no array step - Carbon's arrays arrive as authored
12
+ * files or are grown element by element (`Tr2TextureArray`). We assemble one
13
+ * from separate images for `dynamic:/texturearray`, so a family of maps (the
14
+ * Detail1Map..Detail3Map kind) binds as one sampler on WebGL2's 16-unit budget
15
+ * while the effect keeps its named parameters.
16
+ *
17
+ * The layers must already match in format, size and mip count - run
18
+ * `CjsTexturePipelineStepConvert` and `CjsTexturePipelineStepResize` first.
19
+ */
20
+ class CjsTexturePipelineStepArray extends CjsModel {
21
+ /** Layer paths, layer 0 first. */
22
+ paths = [];
23
+
24
+ /**
25
+ * Every layer is a resource this step reads.
26
+ *
27
+ * @param {Set<string>} [resources] Caller-owned; allocated when omitted.
28
+ * @returns {Set<string>} The set.
29
+ */
30
+ GetResourceDependencies(resources = new Set()) {
31
+ for (const path of this.paths) resources.add(String(path));
32
+ return resources;
33
+ }
34
+
35
+ /**
36
+ * Build the array into the pipeline's bitmap.
37
+ *
38
+ * @param {import("#imageio").HostBitmap} bitmap The pipeline's bitmap.
39
+ * @param {Map<string, import("#imageio").HostBitmap>} inputs Loaded inputs by path.
40
+ * @returns {boolean} False when a layer is missing or the layers do not match.
41
+ */
42
+ Execute(bitmap, inputs) {
43
+ const layers = this.paths.map(path => inputs.get(String(path)));
44
+ if (!layers.length || layers.some(layer => !layer)) return false;
45
+ const [first] = layers;
46
+ const mips = first.GetTrueMipCount();
47
+ for (const layer of layers) {
48
+ if (layer.GetFormat() !== first.GetFormat() || layer.GetWidth() !== first.GetWidth() || layer.GetHeight() !== first.GetHeight() || layer.GetTrueMipCount() !== mips || layer.GetArraySize() > 1) return false;
49
+ }
50
+ if (!bitmap.Create2DArray(first.GetWidth(), first.GetHeight(), mips, layers.length, first.GetFormat())) return false;
51
+ for (let index = 0; index < layers.length; index++) {
52
+ for (let mip = 0; mip < mips; mip++) {
53
+ bitmap.GetMipRawData(mip, index).set(layers[index].GetMipRawData(mip).subarray(0, layers[index].GetMipSize(mip)));
54
+ }
55
+ }
56
+ return true;
57
+ }
58
+ }
59
+ CjsSchema.define(CjsTexturePipelineStepArray, {
60
+ className: "CjsTexturePipelineStepArray",
61
+ family: "resources",
62
+ fields: {
63
+ paths: [edit.persist, type.list("string")]
64
+ },
65
+ methods: {
66
+ GetResourceDependencies: impl.custom,
67
+ Execute: impl.custom
68
+ }
69
+ });
70
+
71
+ export { CjsTexturePipelineStepArray };
72
+ //# sourceMappingURL=CjsTexturePipelineStepArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsTexturePipelineStepArray.js","sources":["../../../../src/resource/texture/CjsTexturePipelineStepArray.js"],"sourcesContent":["// Not Carbon. A texture-pipeline step of our own, registered in\n// /docs/architecture/non-carbon-extensions.md.\nimport { CjsSchema, edit, impl, type } from \"#schema\";\nimport { CjsModel } from \"#model\";\n\n/**\n * Stacks the named inputs, in order, into one 2D texture array: layer 0 is the\n * first path.\n *\n * Carbon's pipeline has no array step - Carbon's arrays arrive as authored\n * files or are grown element by element (`Tr2TextureArray`). We assemble one\n * from separate images for `dynamic:/texturearray`, so a family of maps (the\n * Detail1Map..Detail3Map kind) binds as one sampler on WebGL2's 16-unit budget\n * while the effect keeps its named parameters.\n *\n * The layers must already match in format, size and mip count - run\n * `CjsTexturePipelineStepConvert` and `CjsTexturePipelineStepResize` first.\n */\nexport class CjsTexturePipelineStepArray extends CjsModel\n{\n\n /** Layer paths, layer 0 first. */\n paths = [];\n\n /**\n * Every layer is a resource this step reads.\n *\n * @param {Set<string>} [resources] Caller-owned; allocated when omitted.\n * @returns {Set<string>} The set.\n */\n GetResourceDependencies(resources = new Set())\n {\n for (const path of this.paths) resources.add(String(path));\n return resources;\n }\n\n /**\n * Build the array into the pipeline's bitmap.\n *\n * @param {import(\"#imageio\").HostBitmap} bitmap The pipeline's bitmap.\n * @param {Map<string, import(\"#imageio\").HostBitmap>} inputs Loaded inputs by path.\n * @returns {boolean} False when a layer is missing or the layers do not match.\n */\n Execute(bitmap, inputs)\n {\n const layers = this.paths.map(path => inputs.get(String(path)));\n\n if (!layers.length || layers.some(layer => !layer)) return false;\n\n const [ first ] = layers;\n const mips = first.GetTrueMipCount();\n\n for (const layer of layers)\n {\n if (layer.GetFormat() !== first.GetFormat()\n || layer.GetWidth() !== first.GetWidth()\n || layer.GetHeight() !== first.GetHeight()\n || layer.GetTrueMipCount() !== mips\n || layer.GetArraySize() > 1) return false;\n }\n\n if (!bitmap.Create2DArray(first.GetWidth(), first.GetHeight(), mips, layers.length, first.GetFormat())) return false;\n\n for (let index = 0; index < layers.length; index++)\n {\n for (let mip = 0; mip < mips; mip++)\n {\n bitmap.GetMipRawData(mip, index).set(layers[index].GetMipRawData(mip).subarray(0, layers[index].GetMipSize(mip)));\n }\n }\n return true;\n }\n\n}\n\nCjsSchema.define(CjsTexturePipelineStepArray, {\n className: \"CjsTexturePipelineStepArray\", family: \"resources\",\n fields: {\n paths: [ edit.persist, type.list(\"string\") ]\n },\n methods: {\n GetResourceDependencies: impl.custom,\n Execute: impl.custom\n }\n});\n"],"names":["CjsTexturePipelineStepArray","CjsModel","paths","GetResourceDependencies","resources","Set","path","add","String","Execute","bitmap","inputs","layers","map","get","length","some","layer","first","mips","GetTrueMipCount","GetFormat","GetWidth","GetHeight","GetArraySize","Create2DArray","index","mip","GetMipRawData","set","subarray","GetMipSize","CjsSchema","define","className","family","fields","edit","persist","type","list","methods","impl","custom"],"mappings":";;;AAAA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,SAASC,QAAQ,CACzD;AAEE;AACAC,EAAAA,KAAK,GAAG,EAAE;;AAEV;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,uBAAuBA,CAACC,SAAS,GAAG,IAAIC,GAAG,EAAE,EAC7C;AACE,IAAA,KAAK,MAAMC,IAAI,IAAI,IAAI,CAACJ,KAAK,EAAEE,SAAS,CAACG,GAAG,CAACC,MAAM,CAACF,IAAI,CAAC,CAAC;AAC1D,IAAA,OAAOF,SAAS;AAClB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACEK,EAAAA,OAAOA,CAACC,MAAM,EAAEC,MAAM,EACtB;AACE,IAAA,MAAMC,MAAM,GAAG,IAAI,CAACV,KAAK,CAACW,GAAG,CAACP,IAAI,IAAIK,MAAM,CAACG,GAAG,CAACN,MAAM,CAACF,IAAI,CAAC,CAAC,CAAC;AAE/D,IAAA,IAAI,CAACM,MAAM,CAACG,MAAM,IAAIH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI,CAACA,KAAK,CAAC,EAA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AAE;AAC5CkC,EAAAA,SAAS,EAAE,6BAA6B;AAAEC,EAAAA,MAAM,EAAE,WAAW;AAC7DC,EAAAA,MAAM,EAAE;IACNlC,KAAK,EAAE,CAAEmC,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,IAAI,CAAC,QAAQ,CAAC;GAC3C;AACDC,EAAAA,OAAO,EAAE;IACPtC,uBAAuB,EAAEuC,IAAI,CAACC,MAAM;IACpClC,OAAO,EAAEiC,IAAI,CAACC;AAChB;AACF,CAAC,CAAC;;;;"}
@@ -0,0 +1,73 @@
1
+ import { CjsSchema, impl, edit, type } from '#schema';
2
+ import { CjsModel } from '#model';
3
+ import { HostBitmap } from '#imageio';
4
+ import { PixelFormat } from '#consts/render-context';
5
+ import { CjsImageFormat } from '../format/CjsImageFormat.js';
6
+
7
+ // Not Carbon. A texture-pipeline step of our own, registered in
8
+ // /docs/architecture/non-carbon-extensions.md.
9
+
10
+ /**
11
+ * Converts the pipeline's INPUTS to one pixel format before a later step reads
12
+ * them - block formats decoded - so a `Pack` over EVE's compressed maps works.
13
+ *
14
+ * Carbon's `Tr2TexturePipelineStepPack` reads raw bytes and refuses block
15
+ * formats, so in Carbon a pack of DXT1/BC4 sources fails. We decode on the CPU
16
+ * because a browser cannot read a compressed texture back from the GPU.
17
+ *
18
+ * Each converted input is a COPY that replaces its entry in the pipeline's
19
+ * `inputs` map, so the cached source bitmap is never changed.
20
+ */
21
+ class CjsTexturePipelineStepConvert extends CjsModel {
22
+ /** The pixel format every named input is converted to. */
23
+ format = PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM;
24
+
25
+ /** Input paths to convert; empty converts every input. */
26
+ paths = [];
27
+
28
+ /**
29
+ * Names no resources: it works on inputs other steps name.
30
+ *
31
+ * @param {Set<string>} [resources] Caller-owned; allocated when omitted.
32
+ * @returns {Set<string>} The set, unchanged.
33
+ */
34
+ GetResourceDependencies(resources = new Set()) {
35
+ return resources;
36
+ }
37
+
38
+ /**
39
+ * Replace each named input with a converted copy.
40
+ *
41
+ * @param {HostBitmap} _bitmap The pipeline's bitmap (unused).
42
+ * @param {Map<string, HostBitmap>} inputs Loaded inputs by path; entries are replaced.
43
+ * @returns {boolean} False when an input is missing or cannot be converted.
44
+ */
45
+ Execute(_bitmap, inputs) {
46
+ for (const path of this.paths.length ? this.paths : [...inputs.keys()]) {
47
+ const source = inputs.get(path);
48
+ if (!source) return false;
49
+ if (source.GetFormat() === this.format) continue;
50
+ const copy = new HostBitmap();
51
+ if (!copy.CreateFromBitmapDimensions(source)) return false;
52
+ copy.GetRawData().set(source.GetRawData());
53
+ if (!CjsImageFormat.convertImage(copy, this.format)) return false;
54
+ inputs.set(path, copy);
55
+ }
56
+ return true;
57
+ }
58
+ }
59
+ CjsSchema.define(CjsTexturePipelineStepConvert, {
60
+ className: "CjsTexturePipelineStepConvert",
61
+ family: "resources",
62
+ fields: {
63
+ format: [edit.persist, type.int32, type.enum("PixelFormat")],
64
+ paths: [edit.persist, type.list("string")]
65
+ },
66
+ methods: {
67
+ GetResourceDependencies: impl.custom,
68
+ Execute: impl.custom
69
+ }
70
+ });
71
+
72
+ export { CjsTexturePipelineStepConvert };
73
+ //# sourceMappingURL=CjsTexturePipelineStepConvert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsTexturePipelineStepConvert.js","sources":["../../../../src/resource/texture/CjsTexturePipelineStepConvert.js"],"sourcesContent":["// Not Carbon. A texture-pipeline step of our own, registered in\n// /docs/architecture/non-carbon-extensions.md.\nimport { CjsSchema, edit, impl, type } from \"#schema\";\nimport { CjsModel } from \"#model\";\nimport { HostBitmap } from \"#imageio\";\nimport { PixelFormat } from \"#consts/render-context\";\nimport { CjsImageFormat } from \"../format/CjsImageFormat.js\";\n\n/**\n * Converts the pipeline's INPUTS to one pixel format before a later step reads\n * them - block formats decoded - so a `Pack` over EVE's compressed maps works.\n *\n * Carbon's `Tr2TexturePipelineStepPack` reads raw bytes and refuses block\n * formats, so in Carbon a pack of DXT1/BC4 sources fails. We decode on the CPU\n * because a browser cannot read a compressed texture back from the GPU.\n *\n * Each converted input is a COPY that replaces its entry in the pipeline's\n * `inputs` map, so the cached source bitmap is never changed.\n */\nexport class CjsTexturePipelineStepConvert extends CjsModel\n{\n\n /** The pixel format every named input is converted to. */\n format = PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM;\n\n /** Input paths to convert; empty converts every input. */\n paths = [];\n\n /**\n * Names no resources: it works on inputs other steps name.\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 * Replace each named input with a converted copy.\n *\n * @param {HostBitmap} _bitmap The pipeline's bitmap (unused).\n * @param {Map<string, HostBitmap>} inputs Loaded inputs by path; entries are replaced.\n * @returns {boolean} False when an input is missing or cannot be converted.\n */\n Execute(_bitmap, inputs)\n {\n for (const path of this.paths.length ? this.paths : [ ...inputs.keys() ])\n {\n const source = inputs.get(path);\n\n if (!source) return false;\n if (source.GetFormat() === this.format) continue;\n\n const copy = new HostBitmap();\n if (!copy.CreateFromBitmapDimensions(source)) return false;\n copy.GetRawData().set(source.GetRawData());\n\n if (!CjsImageFormat.convertImage(copy, this.format)) return false;\n\n inputs.set(path, copy);\n }\n return true;\n }\n\n}\n\nCjsSchema.define(CjsTexturePipelineStepConvert, {\n className: \"CjsTexturePipelineStepConvert\", family: \"resources\",\n fields: {\n format: [ edit.persist, type.int32, type.enum(\"PixelFormat\") ],\n paths: [ edit.persist, type.list(\"string\") ]\n },\n methods: {\n GetResourceDependencies: impl.custom,\n Execute: impl.custom\n }\n});\n"],"names":["CjsTexturePipelineStepConvert","CjsModel","format","PixelFormat","PIXEL_FORMAT_B8G8R8A8_UNORM","paths","GetResourceDependencies","resources","Set","Execute","_bitmap","inputs","path","length","keys","source","get","GetFormat","copy","HostBitmap","CreateFromBitmapDimensions","GetRawData","set","CjsImageFormat","convertImage","CjsSchema","define","className","family","fields","edit","persist","type","int32","enum","list","methods","impl","custom"],"mappings":";;;;;;AAAA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,6BAA6B,SAASC,QAAQ,CAC3D;AAEE;EACAC,MAAM,GAAGC,WAAW,CAACC,2BAA2B;;AAEhD;AACAC,EAAAA,KAAK,GAAG,EAAE;;AAEV;AACF;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;AACEE,EAAAA,OAAOA,CAACC,OAAO,EAAEC,MAAM,EACvB;IACE,KAAK,MAAMC,IAAI,IAAI,IAAI,CAACP,KAAK,CAACQ,MAAM,GAAG,IAAI,CAACR,KAAK,GAAG,CAAE,GAAGM,MAAM,CAACG,IAAI,EAAE,CAAE,EACxE;AACE,MAAA,MAAMC,MAAM,GAAGJ,MAAM,CAACK,GAAG,CAACJ,IAAI,CAAC;AAE/B,MAAA,IAAI,CAACG,MAAM,EAAE,OAAO,KAAK;MACzB,IAAIA,MAAM,CAACE,SAAS,EAAE,KAAK,IAAI,CAACf,MAAM,EAAE;AAExC,MAAA,MAAMgB,IAAI,GAAG,IAAIC,UAAU,EAAE;MAC7B,IAAI,CAACD,IAAI,CAACE,0BAA0B,CAACL,MAAM,CAAC,EAAE,OAAO,KAAK;AAC1DG,MAAAA,IAAI,CAACG,UAAU,EAAE,CAACC,GAAG,CAACP,MAAM,CAACM,UAAU,EAAE,CAAC;AAE1C,MAAA,IAAI,CAACE,cAAc,CAACC,YAAY,CAACN,IAAI,EAAE,IAAI,CAAChB,MAAM,CAAC,EAAE,OAAO,KAAK;AAEjES,MAAAA,MAAM,CAACW,GAAG,CAACV,IAAI,EAAEM,IAAI,CAAC;AACxB,IAAA;AACA,IAAA,OAAO,IAAI;AACb,EAAA;AAEF;AAEAO,SAAS,CAACC,MAAM,CAAC1B,6BAA6B,EAAE;AAC9C2B,EAAAA,SAAS,EAAE,+BAA+B;AAAEC,EAAAA,MAAM,EAAE,WAAW;AAC/DC,EAAAA,MAAM,EAAE;AACN3B,IAAAA,MAAM,EAAE,CAAE4B,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,KAAK,EAAED,IAAI,CAACE,IAAI,CAAC,aAAa,CAAC,CAAE;IAC9D7B,KAAK,EAAE,CAAEyB,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACG,IAAI,CAAC,QAAQ,CAAC;GAC3C;AACDC,EAAAA,OAAO,EAAE;IACP9B,uBAAuB,EAAE+B,IAAI,CAACC,MAAM;IACpC7B,OAAO,EAAE4B,IAAI,CAACC;AAChB;AACF,CAAC,CAAC;;;;"}
@@ -0,0 +1,71 @@
1
+ import { CjsSchema, impl, edit, type } from '#schema';
2
+ import { HostBitmap } from '#imageio';
3
+ import { PixelFormat } from '#consts/render-context';
4
+ import { Tr2TexturePipelineStepPack } from './Tr2TexturePipelineStepPack.js';
5
+
6
+ // Not Carbon. A texture-pipeline step of our own, registered in
7
+ // /docs/architecture/non-carbon-extensions.md.
8
+
9
+ /**
10
+ * Our packer: Carbon's `Tr2TexturePipelineStepPack`, plus output formats
11
+ * Carbon's does not write.
12
+ *
13
+ * Carbon's Pack writes BGRA, BGRX or R8. A pair of channels packed into BGRA
14
+ * costs four bytes a texel to carry two; this writes `PIXEL_FORMAT_R8G8_UNORM`
15
+ * at two (operator ruling, 2026-09-24). Carbon's formats pass straight through
16
+ * to Carbon's step, which is left exactly as Carbon has it.
17
+ *
18
+ * Same records as Carbon's: r, g, b and a are `Tr2TexturePackChannel`s. For RG8
19
+ * only r and g are written.
20
+ */
21
+ class CjsTexturePipelineStepPack extends Tr2TexturePipelineStepPack {
22
+ /**
23
+ * Pack the channels; RG8 here, every other format by Carbon's step.
24
+ *
25
+ * RG8 is built from Carbon's own BGRA pack - whose red and green bytes are
26
+ * the r and g channels - so input lookup, size checks and mips are Carbon's.
27
+ *
28
+ * @param {HostBitmap} bitmap The pipeline's bitmap.
29
+ * @param {Map<string, HostBitmap>} inputs Loaded inputs by path.
30
+ * @param {object} [params] Pipeline parameters.
31
+ * @returns {boolean} Whether the step succeeded.
32
+ */
33
+ Execute(bitmap, inputs, params) {
34
+ if (this.format !== PixelFormat.PIXEL_FORMAT_R8G8_UNORM) return super.Execute(bitmap, inputs, params);
35
+ const bgra = new HostBitmap();
36
+ const format = this.format;
37
+ this.format = PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM;
38
+ const packed = super.Execute(bgra, inputs, params);
39
+ this.format = format;
40
+ if (!packed) return false;
41
+ const mips = bgra.GetTrueMipCount();
42
+ if (!bitmap.Create(bgra.GetWidth(), bgra.GetHeight(), mips, format)) return false;
43
+ for (let mip = 0; mip < mips; mip++) {
44
+ const from = bgra.GetMipRawData(mip);
45
+ const fromPitch = bgra.GetMipPitch(mip);
46
+ const to = bitmap.GetMipRawData(mip);
47
+ const toPitch = bitmap.GetMipPitch(mip);
48
+ for (let y = 0; y < bgra.GetMipHeight(mip); y++) {
49
+ for (let x = 0; x < bgra.GetMipWidth(mip); x++) {
50
+ // BGRA memory: red is byte 2, green byte 1.
51
+ to[y * toPitch + x * 2] = from[y * fromPitch + x * 4 + 2];
52
+ to[y * toPitch + x * 2 + 1] = from[y * fromPitch + x * 4 + 1];
53
+ }
54
+ }
55
+ }
56
+ return true;
57
+ }
58
+ }
59
+ CjsSchema.define(CjsTexturePipelineStepPack, {
60
+ className: "CjsTexturePipelineStepPack",
61
+ family: "resources",
62
+ fields: {
63
+ format: [edit.persist, type.int32, type.enum("PixelFormat")]
64
+ },
65
+ methods: {
66
+ Execute: impl.custom
67
+ }
68
+ });
69
+
70
+ export { CjsTexturePipelineStepPack };
71
+ //# sourceMappingURL=CjsTexturePipelineStepPack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsTexturePipelineStepPack.js","sources":["../../../../src/resource/texture/CjsTexturePipelineStepPack.js"],"sourcesContent":["// Not Carbon. A texture-pipeline step of our own, registered in\n// /docs/architecture/non-carbon-extensions.md.\nimport { CjsSchema, edit, impl, type } from \"#schema\";\nimport { HostBitmap } from \"#imageio\";\nimport { PixelFormat } from \"#consts/render-context\";\nimport { Tr2TexturePipelineStepPack } from \"./Tr2TexturePipelineStepPack.js\";\n\n/**\n * Our packer: Carbon's `Tr2TexturePipelineStepPack`, plus output formats\n * Carbon's does not write.\n *\n * Carbon's Pack writes BGRA, BGRX or R8. A pair of channels packed into BGRA\n * costs four bytes a texel to carry two; this writes `PIXEL_FORMAT_R8G8_UNORM`\n * at two (operator ruling, 2026-09-24). Carbon's formats pass straight through\n * to Carbon's step, which is left exactly as Carbon has it.\n *\n * Same records as Carbon's: r, g, b and a are `Tr2TexturePackChannel`s. For RG8\n * only r and g are written.\n */\nexport class CjsTexturePipelineStepPack extends Tr2TexturePipelineStepPack\n{\n\n /**\n * Pack the channels; RG8 here, every other format by Carbon's step.\n *\n * RG8 is built from Carbon's own BGRA pack - whose red and green bytes are\n * the r and g channels - so input lookup, size checks and mips are Carbon's.\n *\n * @param {HostBitmap} bitmap The pipeline's bitmap.\n * @param {Map<string, HostBitmap>} inputs Loaded inputs by path.\n * @param {object} [params] Pipeline parameters.\n * @returns {boolean} Whether the step succeeded.\n */\n Execute(bitmap, inputs, params)\n {\n if (this.format !== PixelFormat.PIXEL_FORMAT_R8G8_UNORM) return super.Execute(bitmap, inputs, params);\n\n const bgra = new HostBitmap();\n const format = this.format;\n\n this.format = PixelFormat.PIXEL_FORMAT_B8G8R8A8_UNORM;\n const packed = super.Execute(bgra, inputs, params);\n this.format = format;\n\n if (!packed) return false;\n\n const mips = bgra.GetTrueMipCount();\n\n if (!bitmap.Create(bgra.GetWidth(), bgra.GetHeight(), mips, format)) return false;\n\n for (let mip = 0; mip < mips; mip++)\n {\n const from = bgra.GetMipRawData(mip);\n const fromPitch = bgra.GetMipPitch(mip);\n const to = bitmap.GetMipRawData(mip);\n const toPitch = bitmap.GetMipPitch(mip);\n\n for (let y = 0; y < bgra.GetMipHeight(mip); y++)\n {\n for (let x = 0; x < bgra.GetMipWidth(mip); x++)\n {\n // BGRA memory: red is byte 2, green byte 1.\n to[y * toPitch + x * 2] = from[y * fromPitch + x * 4 + 2];\n to[y * toPitch + x * 2 + 1] = from[y * fromPitch + x * 4 + 1];\n }\n }\n }\n return true;\n }\n\n}\n\nCjsSchema.define(CjsTexturePipelineStepPack, {\n className: \"CjsTexturePipelineStepPack\", family: \"resources\",\n fields: {\n format: [ edit.persist, type.int32, type.enum(\"PixelFormat\") ]\n },\n methods: {\n Execute: impl.custom\n }\n});\n"],"names":["CjsTexturePipelineStepPack","Tr2TexturePipelineStepPack","Execute","bitmap","inputs","params","format","PixelFormat","PIXEL_FORMAT_R8G8_UNORM","bgra","HostBitmap","PIXEL_FORMAT_B8G8R8A8_UNORM","packed","mips","GetTrueMipCount","Create","GetWidth","GetHeight","mip","from","GetMipRawData","fromPitch","GetMipPitch","to","toPitch","y","GetMipHeight","x","GetMipWidth","CjsSchema","define","className","family","fields","edit","persist","type","int32","enum","methods","impl","custom"],"mappings":";;;;;AAAA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,0BAA0B,SAASC,0BAA0B,CAC1E;AAEE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAOA,CAACC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAC9B;AACE,IAAA,IAAI,IAAI,CAACC,MAAM,KAAKC,WAAW,CAACC,uBAAuB,EAAE,OAAO,KAAK,CAACN,OAAO,CAACC,MAAM,EAAEC,MAAM,EAAEC,MAAM,CAAC;AAErG,IAAA,MAAMI,IAAI,GAAG,IAAIC,UAAU,EAAE;AAC7B,IAAA,MAAMJ,MAAM,GAAG,IAAI,CAACA,MAAM;AAE1B,IAAA,IAAI,CAACA,MAAM,GAAG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O,GAAGG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGR,IAAI,CAACM,CAAC,GAAGJ,SAAS,GAAGM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC/D,QAAA;AACF,MAAA;AACF,IAAA;AACA,IAAA,OAAO,IAAI;AACb,EAAA;AAEF;AAEAE,SAAS,CAACC,MAAM,CAAC9B,0BAA0B,EAAE;AAC3C+B,EAAAA,SAAS,EAAE,4BAA4B;AAAEC,EAAAA,MAAM,EAAE,WAAW;AAC5DC,EAAAA,MAAM,EAAE;AACN3B,IAAAA,MAAM,EAAE,CAAE4B,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,KAAK,EAAED,IAAI,CAACE,IAAI,CAAC,aAAa,CAAC;GAC7D;AACDC,EAAAA,OAAO,EAAE;IACPrC,OAAO,EAAEsC,IAAI,CAACC;AAChB;AACF,CAAC,CAAC;;;;"}
@@ -0,0 +1,123 @@
1
+ import { CjsSchema, impl, edit, type } from '#schema';
2
+ import { CjsModel } from '#model';
3
+ import { HostBitmap } from '#imageio';
4
+ import { IsCompressedFormat, GetBytesPerPixel } from '#consts/render-context';
5
+
6
+ // Not Carbon. A texture-pipeline step of our own, registered in
7
+ // /docs/architecture/non-carbon-extensions.md.
8
+
9
+ /**
10
+ * Resamples the pipeline's INPUTS to one size before a later step reads them.
11
+ *
12
+ * Carbon's `Tr2TexturePipelineStepPack` refuses inputs of different sizes: CCP
13
+ * packs in a controlled pipeline over sources it authors. We join files we do
14
+ * not control, by our own choice, so matching their sizes is our job. With no
15
+ * size set, every input is resampled up to the largest one.
16
+ *
17
+ * Bilinear, on the top mip, for uncompressed byte formats - run
18
+ * `CjsTexturePipelineStepConvert` first for block formats. The result has one
19
+ * mip; add `Tr2TexturePipelineStepGenerateMips` after the pack for a chain.
20
+ * Each resized input is a COPY that replaces its entry in the pipeline's
21
+ * `inputs` map, so the cached source bitmap is never changed.
22
+ */
23
+ class CjsTexturePipelineStepResize extends CjsModel {
24
+ /** Target width; 0 takes the widest input. */
25
+ width = 0;
26
+
27
+ /** Target height; 0 takes the tallest input. */
28
+ height = 0;
29
+
30
+ /** Input paths to resize; empty resizes every input. */
31
+ paths = [];
32
+
33
+ /**
34
+ * Names no resources: it works on inputs other steps name.
35
+ *
36
+ * @param {Set<string>} [resources] Caller-owned; allocated when omitted.
37
+ * @returns {Set<string>} The set, unchanged.
38
+ */
39
+ GetResourceDependencies(resources = new Set()) {
40
+ return resources;
41
+ }
42
+
43
+ /**
44
+ * Replace each named input with a copy at the target size.
45
+ *
46
+ * @param {HostBitmap} _bitmap The pipeline's bitmap (unused).
47
+ * @param {Map<string, HostBitmap>} inputs Loaded inputs by path; entries are replaced.
48
+ * @returns {boolean} False when an input is missing or cannot be resampled.
49
+ */
50
+ Execute(_bitmap, inputs) {
51
+ const paths = this.paths.length ? this.paths : [...inputs.keys()];
52
+ const sources = paths.map(path => inputs.get(path));
53
+ if (sources.some(source => !source)) return false;
54
+ const width = this.width || Math.max(...sources.map(source => source.GetWidth()));
55
+ const height = this.height || Math.max(...sources.map(source => source.GetHeight()));
56
+ for (let index = 0; index < paths.length; index++) {
57
+ const source = sources[index];
58
+ if (source.GetWidth() === width && source.GetHeight() === height && source.GetTrueMipCount() === 1) continue;
59
+ const resized = CjsTexturePipelineStepResize.resample(source, width, height);
60
+ if (!resized) return false;
61
+ inputs.set(paths[index], resized);
62
+ }
63
+ return true;
64
+ }
65
+
66
+ /**
67
+ * Bilinear resample of a bitmap's top mip into a new one-mip bitmap.
68
+ *
69
+ * @param {HostBitmap} source Uncompressed byte-per-channel bitmap.
70
+ * @param {number} width Target width.
71
+ * @param {number} height Target height.
72
+ * @returns {HostBitmap|null} The resampled copy, or null for an unsupported format.
73
+ */
74
+ static resample(source, width, height) {
75
+ const format = source.GetFormat();
76
+ if (IsCompressedFormat(format)) return null;
77
+ const channels = GetBytesPerPixel(format);
78
+ const result = new HostBitmap();
79
+ if (!result.Create(width, height, 1, format)) return null;
80
+ const sourceWidth = source.GetWidth();
81
+ const sourceHeight = source.GetHeight();
82
+ const from = source.GetMipRawData(0);
83
+ const fromPitch = source.GetMipPitch(0);
84
+ const to = result.GetMipRawData(0);
85
+ const toPitch = result.GetMipPitch(0);
86
+ for (let y = 0; y < height; y++) {
87
+ // Pixel centres map to pixel centres.
88
+ const sy = Math.min(Math.max((y + 0.5) * sourceHeight / height - 0.5, 0), sourceHeight - 1);
89
+ const y0 = Math.floor(sy);
90
+ const y1 = Math.min(y0 + 1, sourceHeight - 1);
91
+ const fy = sy - y0;
92
+ for (let x = 0; x < width; x++) {
93
+ const sx = Math.min(Math.max((x + 0.5) * sourceWidth / width - 0.5, 0), sourceWidth - 1);
94
+ const x0 = Math.floor(sx);
95
+ const x1 = Math.min(x0 + 1, sourceWidth - 1);
96
+ const fx = sx - x0;
97
+ for (let c = 0; c < channels; c++) {
98
+ const top = from[y0 * fromPitch + x0 * channels + c] * (1 - fx) + from[y0 * fromPitch + x1 * channels + c] * fx;
99
+ const bottom = from[y1 * fromPitch + x0 * channels + c] * (1 - fx) + from[y1 * fromPitch + x1 * channels + c] * fx;
100
+ to[y * toPitch + x * channels + c] = Math.round(top * (1 - fy) + bottom * fy);
101
+ }
102
+ }
103
+ }
104
+ return result;
105
+ }
106
+ }
107
+ CjsSchema.define(CjsTexturePipelineStepResize, {
108
+ className: "CjsTexturePipelineStepResize",
109
+ family: "resources",
110
+ fields: {
111
+ width: [edit.persist, type.uint32],
112
+ height: [edit.persist, type.uint32],
113
+ paths: [edit.persist, type.list("string")]
114
+ },
115
+ methods: {
116
+ GetResourceDependencies: impl.custom,
117
+ Execute: impl.custom,
118
+ resample: impl.custom
119
+ }
120
+ });
121
+
122
+ export { CjsTexturePipelineStepResize };
123
+ //# sourceMappingURL=CjsTexturePipelineStepResize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsTexturePipelineStepResize.js","sources":["../../../../src/resource/texture/CjsTexturePipelineStepResize.js"],"sourcesContent":["// Not Carbon. A texture-pipeline step of our own, registered in\n// /docs/architecture/non-carbon-extensions.md.\nimport { CjsSchema, edit, impl, type } from \"#schema\";\nimport { CjsModel } from \"#model\";\nimport { HostBitmap } from \"#imageio\";\nimport { GetBytesPerPixel, IsCompressedFormat } from \"#consts/render-context\";\n\n/**\n * Resamples the pipeline's INPUTS to one size before a later step reads them.\n *\n * Carbon's `Tr2TexturePipelineStepPack` refuses inputs of different sizes: CCP\n * packs in a controlled pipeline over sources it authors. We join files we do\n * not control, by our own choice, so matching their sizes is our job. With no\n * size set, every input is resampled up to the largest one.\n *\n * Bilinear, on the top mip, for uncompressed byte formats - run\n * `CjsTexturePipelineStepConvert` first for block formats. The result has one\n * mip; add `Tr2TexturePipelineStepGenerateMips` after the pack for a chain.\n * Each resized input is a COPY that replaces its entry in the pipeline's\n * `inputs` map, so the cached source bitmap is never changed.\n */\nexport class CjsTexturePipelineStepResize extends CjsModel\n{\n\n /** Target width; 0 takes the widest input. */\n width = 0;\n\n /** Target height; 0 takes the tallest input. */\n height = 0;\n\n /** Input paths to resize; empty resizes every input. */\n paths = [];\n\n /**\n * Names no resources: it works on inputs other steps name.\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 * Replace each named input with a copy at the target size.\n *\n * @param {HostBitmap} _bitmap The pipeline's bitmap (unused).\n * @param {Map<string, HostBitmap>} inputs Loaded inputs by path; entries are replaced.\n * @returns {boolean} False when an input is missing or cannot be resampled.\n */\n Execute(_bitmap, inputs)\n {\n const paths = this.paths.length ? this.paths : [ ...inputs.keys() ];\n const sources = paths.map(path => inputs.get(path));\n\n if (sources.some(source => !source)) return false;\n\n const width = this.width || Math.max(...sources.map(source => source.GetWidth()));\n const height = this.height || Math.max(...sources.map(source => source.GetHeight()));\n\n for (let index = 0; index < paths.length; index++)\n {\n const source = sources[index];\n\n if (source.GetWidth() === width && source.GetHeight() === height && source.GetTrueMipCount() === 1) continue;\n\n const resized = CjsTexturePipelineStepResize.resample(source, width, height);\n if (!resized) return false;\n\n inputs.set(paths[index], resized);\n }\n return true;\n }\n\n /**\n * Bilinear resample of a bitmap's top mip into a new one-mip bitmap.\n *\n * @param {HostBitmap} source Uncompressed byte-per-channel bitmap.\n * @param {number} width Target width.\n * @param {number} height Target height.\n * @returns {HostBitmap|null} The resampled copy, or null for an unsupported format.\n */\n static resample(source, width, height)\n {\n const format = source.GetFormat();\n\n if (IsCompressedFormat(format)) return null;\n\n const channels = GetBytesPerPixel(format);\n const result = new HostBitmap();\n\n if (!result.Create(width, height, 1, format)) return null;\n\n const sourceWidth = source.GetWidth();\n const sourceHeight = source.GetHeight();\n const from = source.GetMipRawData(0);\n const fromPitch = source.GetMipPitch(0);\n const to = result.GetMipRawData(0);\n const toPitch = result.GetMipPitch(0);\n\n for (let y = 0; y < height; y++)\n {\n // Pixel centres map to pixel centres.\n const sy = Math.min(Math.max((y + 0.5) * sourceHeight / height - 0.5, 0), sourceHeight - 1);\n const y0 = Math.floor(sy);\n const y1 = Math.min(y0 + 1, sourceHeight - 1);\n const fy = sy - y0;\n\n for (let x = 0; x < width; x++)\n {\n const sx = Math.min(Math.max((x + 0.5) * sourceWidth / width - 0.5, 0), sourceWidth - 1);\n const x0 = Math.floor(sx);\n const x1 = Math.min(x0 + 1, sourceWidth - 1);\n const fx = sx - x0;\n\n for (let c = 0; c < channels; c++)\n {\n const top = from[y0 * fromPitch + x0 * channels + c] * (1 - fx) + from[y0 * fromPitch + x1 * channels + c] * fx;\n const bottom = from[y1 * fromPitch + x0 * channels + c] * (1 - fx) + from[y1 * fromPitch + x1 * channels + c] * fx;\n to[y * toPitch + x * channels + c] = Math.round(top * (1 - fy) + bottom * fy);\n }\n }\n }\n return result;\n }\n\n}\n\nCjsSchema.define(CjsTexturePipelineStepResize, {\n className: \"CjsTexturePipelineStepResize\", family: \"resources\",\n fields: {\n width: [ edit.persist, type.uint32 ],\n height: [ edit.persist, type.uint32 ],\n paths: [ edit.persist, type.list(\"string\") ]\n },\n methods: {\n GetResourceDependencies: impl.custom,\n Execute: impl.custom,\n resample: impl.custom\n }\n});\n"],"names":["CjsTexturePipelineStepResize","CjsModel","width","height","paths","GetResourceDependencies","resources","Set","Execute","_bitmap","inputs","length","keys","sources","map","path","get","some","source","Math","max","GetWidth","GetHeight","index","GetTrueMipCount","resized","resample","set","format","GetFormat","IsCompressedFormat","channels","GetBytesPerPixel","result","HostBitmap","Create","sourceWidth","sourceHeight","from","GetMipRawData","fromPitch","GetMipPitch","to","toPitch","y","sy","min","y0","floor","y1","fy","x","sx","x0","x1","fx","c","top","bottom","round","CjsSchema","define","className","family","fields","edit","persist","type","uint32","list","methods","impl","custom"],"mappings":";;;;;AAAA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,4BAA4B,SAASC,QAAQ,CAC1D;AAEE;AACAC,EAAAA,KAAK,GAAG,CAAC;;AAET;AACAC,EAAAA,MAAM,GAAG,CAAC;;AAEV;AACAC,EAAAA,KAAK,GAAG,EAAE;;AAEV;AACF;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;AACEE,EAAAA,OAAOA,CAACC,OAAO,EAAEC,MAAM,EACvB;AACE,IAAA,MAAMN,KAAK,GAAG,IAAI,CAACA,KAAK,CAACO,MAAM,GAAG,IAAI,CAACP,KAAK,GAAG,CAAE,GAAGM,MAAM,CAACE,IAAI,EAAE,CAAE;AACnE,IAAA,MAAMC,OAAO,GAAGT,KAAK,CAACU,GAAG,CAACC,IAAI,IAAIL,MAAM,CAACM,GAAG,CAACD,IAAI,CAAC,CAAC;IAEnD,IAAIF,OAAO,CAACI,IAAI,CAACC,MAAM,IAAI,CAACA,MAAM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AACf,EAAA;AAEF;AAEA2B,SAAS,CAACC,MAAM,CAAC7D,4BAA4B,EAAE;AAC7C8D,EAAAA,SAAS,EAAE,8BAA8B;AAAEC,EAAAA,MAAM,EAAE,WAAW;AAC9DC,EAAAA,MAAM,EAAE;IACN9D,KAAK,EAAE,CAAE+D,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,MAAM,CAAE;IACpCjE,MAAM,EAAE,CAAE8D,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACC,MAAM,CAAE;IACrChE,KAAK,EAAE,CAAE6D,IAAI,CAACC,OAAO,EAAEC,IAAI,CAACE,IAAI,CAAC,QAAQ,CAAC;GAC3C;AACDC,EAAAA,OAAO,EAAE;IACPjE,uBAAuB,EAAEkE,IAAI,CAACC,MAAM;IACpChE,OAAO,EAAE+D,IAAI,CAACC,MAAM;IACpB9C,QAAQ,EAAE6C,IAAI,CAACC;AACjB;AACF,CAAC,CAAC;;;;"}
@@ -1,3 +1,4 @@
1
+ import { IBlueDynamicResourceConstructor } from '#blue';
1
2
  import { TriTextureRes } from './TriTextureRes.js';
2
3
  import { ColorPrefix } from './solidColorTexture.js';
3
4
 
@@ -14,13 +15,22 @@ import { ColorPrefix } from './solidColorTexture.js';
14
15
  * `dynamic:/color/<query>` path names. TriTextureRes.Initialize recognises the
15
16
  * prefix and rasterizes the colour itself.
16
17
  */
17
- class SolidColorTextureConstructor {
18
+ class SolidColorTextureConstructor extends IBlueDynamicResourceConstructor {
18
19
  /**
19
20
  * `IBlueDynamicResourceConstructor::GetResource` (SolidColorTexture.cpp:23-29).
20
21
  *
21
22
  * @param {string} query Text after `dynamic:/color/`.
22
23
  * @returns {TriTextureRes} The texture resource.
23
24
  */
25
+ /**
26
+ * A solid colour is four numbers in its own path; kept for good once built
27
+ * (operator, 2026-09-24).
28
+ *
29
+ * @returns {boolean} Always true.
30
+ */
31
+ IsCacheable() {
32
+ return true;
33
+ }
24
34
  GetResource(query) {
25
35
  const texture = new TriTextureRes();
26
36
  texture.Initialize(ColorPrefix + query, "");
@@ -1 +1 @@
1
- {"version":3,"file":"SolidColorTextureConstructor.js","sources":["../../../../src/resource/texture/SolidColorTextureConstructor.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Procedural/SolidColorTexture.cpp\n//\n// Carbon registers this constructor at static-initialisation time, inside its\n// own translation unit (SolidColorTexture.cpp:17-32). As with\n// RegisterShaderResources, we do not self-register at module scope: a module\n// side effect fires on import rather than on composition and cannot be tested in\n// isolation. Whoever composes a manager calls RegisterSolidColorTexture.\nimport { TriTextureRes } from \"./TriTextureRes.js\";\nimport { ColorPrefix } from \"./solidColorTexture.js\";\n\n/**\n * Carbon's `SolidColorTextureConstructor`: builds the texture a\n * `dynamic:/color/<query>` path names. TriTextureRes.Initialize recognises the\n * prefix and rasterizes the colour itself.\n */\nexport class SolidColorTextureConstructor\n{\n /**\n * `IBlueDynamicResourceConstructor::GetResource` (SolidColorTexture.cpp:23-29).\n *\n * @param {string} query Text after `dynamic:/color/`.\n * @returns {TriTextureRes} The texture resource.\n */\n GetResource(query)\n {\n const texture = new TriTextureRes();\n texture.Initialize(ColorPrefix + query, \"\");\n return texture;\n }\n}\n\n/**\n * Registers the `color` dynamic constructor on one manager.\n *\n * @param {object} resourceManager Manager to register on.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterSolidColorTexture(resourceManager)\n{\n if (typeof resourceManager?.RegisterResourceConstructor !== \"function\")\n {\n throw new TypeError(\"RegisterSolidColorTexture requires a CjsResMan.\");\n }\n resourceManager.RegisterResourceConstructor(\"color\", new SolidColorTextureConstructor());\n return resourceManager;\n}\n"],"names":["SolidColorTextureConstructor","GetResource","query","texture","TriTextureRes","Initialize","ColorPrefix","RegisterSolidColorTexture","resourceManager","RegisterResourceConstructor","TypeError"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,4BAA4B,CACzC;AACE;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,KAAK,EACjB;AACE,IAAA,MAAMC,OAAO,GAAG,IAAIC,aAAa,EAAE;IACnCD,OAAO,CAACE,UAAU,CAACC,WAAW,GAAGJ,KAAK,EAAE,EAAE,CAAC;AAC3C,IAAA,OAAOC,OAAO;AAChB,EAAA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,yBAAyBA,CAACC,eAAe,EACzD;AACE,EAAA,IAAI,OAAOA,eAAe,EAAEC,2BAA2B,KAAK,UAAU,EACtE;AACE,IAAA,MAAM,IAAIC,SAAS,CAAC,iDAAiD,CAAC;AACxE,EAAA;EACAF,eAAe,CAACC,2BAA2B,CAAC,OAAO,EAAE,IAAIT,4BAA4B,EAAE,CAAC;AACxF,EAAA,OAAOQ,eAAe;AACxB;;;;"}
1
+ {"version":3,"file":"SolidColorTextureConstructor.js","sources":["../../../../src/resource/texture/SolidColorTextureConstructor.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Procedural/SolidColorTexture.cpp\n//\n// Carbon registers this constructor at static-initialisation time, inside its\n// own translation unit (SolidColorTexture.cpp:17-32). As with\n// RegisterShaderResources, we do not self-register at module scope: a module\n// side effect fires on import rather than on composition and cannot be tested in\n// isolation. Whoever composes a manager calls RegisterSolidColorTexture.\nimport { IBlueDynamicResourceConstructor } from \"#blue\";\nimport { TriTextureRes } from \"./TriTextureRes.js\";\nimport { ColorPrefix } from \"./solidColorTexture.js\";\n\n/**\n * Carbon's `SolidColorTextureConstructor`: builds the texture a\n * `dynamic:/color/<query>` path names. TriTextureRes.Initialize recognises the\n * prefix and rasterizes the colour itself.\n */\nexport class SolidColorTextureConstructor extends IBlueDynamicResourceConstructor\n{\n /**\n * `IBlueDynamicResourceConstructor::GetResource` (SolidColorTexture.cpp:23-29).\n *\n * @param {string} query Text after `dynamic:/color/`.\n * @returns {TriTextureRes} The texture resource.\n */\n /**\n * A solid colour is four numbers in its own path; kept for good once built\n * (operator, 2026-09-24).\n *\n * @returns {boolean} Always true.\n */\n IsCacheable()\n {\n return true;\n }\n\n GetResource(query)\n {\n const texture = new TriTextureRes();\n texture.Initialize(ColorPrefix + query, \"\");\n return texture;\n }\n}\n\n/**\n * Registers the `color` dynamic constructor on one manager.\n *\n * @param {object} resourceManager Manager to register on.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterSolidColorTexture(resourceManager)\n{\n if (typeof resourceManager?.RegisterResourceConstructor !== \"function\")\n {\n throw new TypeError(\"RegisterSolidColorTexture requires a CjsResMan.\");\n }\n resourceManager.RegisterResourceConstructor(\"color\", new SolidColorTextureConstructor());\n return resourceManager;\n}\n"],"names":["SolidColorTextureConstructor","IBlueDynamicResourceConstructor","IsCacheable","GetResource","query","texture","TriTextureRes","Initialize","ColorPrefix","RegisterSolidColorTexture","resourceManager","RegisterResourceConstructor","TypeError"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMA,4BAA4B,SAASC,+BAA+B,CACjF;AACE;AACF;AACA;AACA;AACA;AACA;AACE;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,WAAWA,GACX;AACE,IAAA,OAAO,IAAI;AACb,EAAA;EAEAC,WAAWA,CAACC,KAAK,EACjB;AACE,IAAA,MAAMC,OAAO,GAAG,IAAIC,aAAa,EAAE;IACnCD,OAAO,CAACE,UAAU,CAACC,WAAW,GAAGJ,KAAK,EAAE,EAAE,CAAC;AAC3C,IAAA,OAAOC,OAAO;AAChB,EAAA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,yBAAyBA,CAACC,eAAe,EACzD;AACE,EAAA,IAAI,OAAOA,eAAe,EAAEC,2BAA2B,KAAK,UAAU,EACtE;AACE,IAAA,MAAM,IAAIC,SAAS,CAAC,iDAAiD,CAAC;AACxE,EAAA;EACAF,eAAe,CAACC,2BAA2B,CAAC,OAAO,EAAE,IAAIX,4BAA4B,EAAE,CAAC;AACxF,EAAA,OAAOU,eAAe;AACxB;;;;"}