@carbonenginejs/runtime-resource 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/NOTICE +3 -2
  2. package/README.md +47 -6
  3. package/dist/CjsMotherLode.js +88 -88
  4. package/dist/CjsMotherLode.js.map +1 -1
  5. package/dist/CjsResMan.js +718 -229
  6. package/dist/CjsResMan.js.map +1 -1
  7. package/dist/CjsResManFetchProvider.js +94 -0
  8. package/dist/CjsResManFetchProvider.js.map +1 -0
  9. package/dist/{CjsResManQueue.js → CjsResManWorkQueue.js} +112 -25
  10. package/dist/CjsResManWorkQueue.js.map +1 -0
  11. package/dist/format/CjsBlueReader.js +91 -2
  12. package/dist/format/CjsBlueReader.js.map +1 -1
  13. package/dist/format/CjsFormat.js +47 -21
  14. package/dist/format/CjsFormat.js.map +1 -1
  15. package/dist/format/CjsReader.js +4 -0
  16. package/dist/format/CjsReader.js.map +1 -1
  17. package/dist/format/CjsResourceProbe.js +4 -2
  18. package/dist/format/CjsResourceProbe.js.map +1 -1
  19. package/dist/format/payloadContract.js +20 -0
  20. package/dist/format/payloadContract.js.map +1 -1
  21. package/dist/formats/black/CjsBlackFormat.js +15 -1
  22. package/dist/formats/black/CjsBlackFormat.js.map +1 -1
  23. package/dist/formats/black/core/CjsBlackBinaryReader.js +103 -0
  24. package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -1
  25. package/dist/formats/black/core/CjsBlackPropertyReaders.js +62 -1
  26. package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -1
  27. package/dist/formats/black/core/CjsBlackReader.js +127 -2
  28. package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
  29. package/dist/formats/black/core/CjsBlackSchemaRegistry.js +103 -0
  30. package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -1
  31. package/dist/formats/black/core/helpers.js +17 -0
  32. package/dist/formats/black/core/helpers.js.map +1 -1
  33. package/dist/formats/bnk/CjsBnkFormat.js +8 -0
  34. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  35. package/dist/formats/bnk/core/helpers.js +20 -0
  36. package/dist/formats/bnk/core/helpers.js.map +1 -1
  37. package/dist/formats/bnk/core/musicNodes.js +40 -3
  38. package/dist/formats/bnk/core/musicNodes.js.map +1 -1
  39. package/dist/formats/bnk/core/soundbanksInfo.js +2 -0
  40. package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
  41. package/dist/formats/cmf/core/binary.js +71 -0
  42. package/dist/formats/cmf/core/binary.js.map +1 -1
  43. package/dist/formats/cmf/core/buffers.js +4 -0
  44. package/dist/formats/cmf/core/buffers.js.map +1 -1
  45. package/dist/formats/cmf/core/helpers.js +31 -0
  46. package/dist/formats/cmf/core/helpers.js.map +1 -1
  47. package/dist/formats/cmf/core/schema.js +10 -0
  48. package/dist/formats/cmf/core/schema.js.map +1 -1
  49. package/dist/formats/cmf/core/shared.js +9 -0
  50. package/dist/formats/cmf/core/shared.js.map +1 -1
  51. package/dist/formats/cmf/core/writer.js +54 -0
  52. package/dist/formats/cmf/core/writer.js.map +1 -1
  53. package/dist/formats/dds/core/bc6h.js +10 -0
  54. package/dist/formats/dds/core/bc6h.js.map +1 -1
  55. package/dist/formats/dds/core/bc7.js +16 -0
  56. package/dist/formats/dds/core/bc7.js.map +1 -1
  57. package/dist/formats/dds/core/helpers.js +47 -0
  58. package/dist/formats/dds/core/helpers.js.map +1 -1
  59. package/dist/formats/fbx/core/helpers.js +22 -1
  60. package/dist/formats/fbx/core/helpers.js.map +1 -1
  61. package/dist/formats/flac/CjsFlacFormat.js +49 -0
  62. package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
  63. package/dist/formats/flac/core/helpers.js +20 -0
  64. package/dist/formats/flac/core/helpers.js.map +1 -1
  65. package/dist/formats/gif/CjsGifFormat.js +49 -0
  66. package/dist/formats/gif/CjsGifFormat.js.map +1 -1
  67. package/dist/formats/gif/core/helpers.js +20 -0
  68. package/dist/formats/gif/core/helpers.js.map +1 -1
  69. package/dist/formats/gltf/core/helpers.js +18 -3
  70. package/dist/formats/gltf/core/helpers.js.map +1 -1
  71. package/dist/formats/gltf/core/parser.js +13 -0
  72. package/dist/formats/gltf/core/parser.js.map +1 -1
  73. package/dist/formats/gltf/core/targets.js +10 -0
  74. package/dist/formats/gltf/core/targets.js.map +1 -1
  75. package/dist/formats/gr2/core/bitknit2.js +2 -0
  76. package/dist/formats/gr2/core/bitknit2.js.map +1 -1
  77. package/dist/formats/gr2/core/helpers.js +20 -0
  78. package/dist/formats/gr2/core/helpers.js.map +1 -1
  79. package/dist/formats/gr2/core/tangents.js +9 -9
  80. package/dist/formats/gr2/core/tangents.js.map +1 -1
  81. package/dist/formats/gr2/core/targets.js +10 -0
  82. package/dist/formats/gr2/core/targets.js.map +1 -1
  83. package/dist/formats/index.js +4 -4
  84. package/dist/formats/jpeg/core/helpers.js +52 -0
  85. package/dist/formats/jpeg/core/helpers.js.map +1 -1
  86. package/dist/formats/jpeg/core/jpeg.js +93 -0
  87. package/dist/formats/jpeg/core/jpeg.js.map +1 -1
  88. package/dist/formats/mp3/core/helpers.js +37 -0
  89. package/dist/formats/mp3/core/helpers.js.map +1 -1
  90. package/dist/formats/mp4/core/helpers.js +35 -0
  91. package/dist/formats/mp4/core/helpers.js.map +1 -1
  92. package/dist/formats/obj/core/helpers.js +2 -2
  93. package/dist/formats/obj/core/helpers.js.map +1 -1
  94. package/dist/formats/ogg/CjsOggFormat.js +49 -0
  95. package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
  96. package/dist/formats/ogg/core/helpers.js +23 -0
  97. package/dist/formats/ogg/core/helpers.js.map +1 -1
  98. package/dist/formats/ogg/core/vorbis.js +13 -0
  99. package/dist/formats/ogg/core/vorbis.js.map +1 -1
  100. package/dist/formats/png/core/helpers.js +52 -0
  101. package/dist/formats/png/core/helpers.js.map +1 -1
  102. package/dist/formats/red/CjsRedFormat.js +3 -1
  103. package/dist/formats/red/CjsRedFormat.js.map +1 -1
  104. package/dist/formats/red/core/CjsRedReader.js +52 -0
  105. package/dist/formats/red/core/CjsRedReader.js.map +1 -1
  106. package/dist/formats/red/core/helpers.js +19 -0
  107. package/dist/formats/red/core/helpers.js.map +1 -1
  108. package/dist/formats/stl/core/stl.js +10 -2
  109. package/dist/formats/stl/core/stl.js.map +1 -1
  110. package/dist/formats/stl/core/targets.js +10 -0
  111. package/dist/formats/stl/core/targets.js.map +1 -1
  112. package/dist/formats/tga/core/helpers.js +47 -0
  113. package/dist/formats/tga/core/helpers.js.map +1 -1
  114. package/dist/formats/wav/core/helpers.js +37 -0
  115. package/dist/formats/wav/core/helpers.js.map +1 -1
  116. package/dist/formats/webm/core/helpers.js +35 -0
  117. package/dist/formats/webm/core/helpers.js.map +1 -1
  118. package/dist/formats/webp/CjsWebpFormat.js +49 -0
  119. package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
  120. package/dist/formats/webp/core/helpers.js +23 -0
  121. package/dist/formats/webp/core/helpers.js.map +1 -1
  122. package/dist/formats/wem/CjsWemFormat.js +8 -0
  123. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  124. package/dist/formats/wem/core/bitStream.js +2 -0
  125. package/dist/formats/wem/core/bitStream.js.map +1 -1
  126. package/dist/formats/wem/core/helpers.js +20 -0
  127. package/dist/formats/wem/core/helpers.js.map +1 -1
  128. package/dist/formats/yaml/CjsYamlFormat.js +45 -0
  129. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
  130. package/dist/formats/yaml/core/CjsYamlReader.js +91 -0
  131. package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
  132. package/dist/formats/yaml/core/helpers.js +10 -0
  133. package/dist/formats/yaml/core/helpers.js.map +1 -1
  134. package/dist/index.js +57 -44
  135. package/dist/index.js.map +1 -1
  136. package/dist/{CjsResource.js → resource/CjsResource.js} +234 -19
  137. package/dist/resource/CjsResource.js.map +1 -0
  138. package/dist/{resources → resource}/Tr2LightProfileRes.js +5 -4
  139. package/dist/resource/Tr2LightProfileRes.js.map +1 -0
  140. package/dist/{resources → resource/audio}/AudioGeometryResData.js +4 -4
  141. package/dist/resource/audio/AudioGeometryResData.js.map +1 -0
  142. package/dist/resource/audio/CjsAudioBufferRes.js +86 -0
  143. package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -0
  144. package/dist/resource/audio/CjsAudioRes.js +213 -0
  145. package/dist/resource/audio/CjsAudioRes.js.map +1 -0
  146. package/dist/resource/audio/index.js +4 -0
  147. package/dist/resource/audio/index.js.map +1 -0
  148. package/dist/{resources → resource/geometry}/MeshDecalData.js +3 -3
  149. package/dist/resource/geometry/MeshDecalData.js.map +1 -0
  150. package/dist/{resources → resource/geometry}/MeshDecalLodData.js +3 -3
  151. package/dist/resource/geometry/MeshDecalLodData.js.map +1 -0
  152. package/dist/resource/geometry/TriGeometryRes.js +656 -0
  153. package/dist/resource/geometry/TriGeometryRes.js.map +1 -0
  154. package/dist/{resources → resource/geometry}/TriGeometryResAreaData.js +4 -4
  155. package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -0
  156. package/dist/{resources → resource/geometry}/TriGeometryResJointData.js +4 -4
  157. package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -0
  158. package/dist/{resources → resource/geometry}/TriGeometryResLodData.js +3 -3
  159. package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -0
  160. package/dist/{resources → resource/geometry}/TriGeometryResMeshData.js +5 -5
  161. package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -0
  162. package/dist/{resources → resource/geometry}/TriGeometryResSkeletonData.js +3 -3
  163. package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -0
  164. package/dist/{resources → resource/geometry}/TriJointBinding.js +4 -4
  165. package/dist/resource/geometry/TriJointBinding.js.map +1 -0
  166. package/dist/{resources → resource/geometry}/TriMorphTargetGeometryConstants.js +3 -3
  167. package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -0
  168. package/dist/{resources → resource/geometry}/TriRtGeometryConstants.js +3 -3
  169. package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -0
  170. package/dist/{resources → resource/geometry/granny}/GStateBindingCallbackData.js +3 -3
  171. package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -0
  172. package/dist/{resources → resource/geometry/granny}/Tr2GrannyIntersectionResult.js +5 -5
  173. package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -0
  174. package/dist/{resources → resource/geometry/granny}/Tr2GrannyStateRes.js +7 -6
  175. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -0
  176. package/dist/{resources → resource/geometry/granny}/TriGrannyRes.js +7 -6
  177. package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -0
  178. package/dist/{resources → resource/geometry/granny}/enums.js +1 -9
  179. package/dist/resource/geometry/granny/enums.js.map +1 -0
  180. package/dist/resource/geometry/granny/index.js +6 -0
  181. package/dist/resource/geometry/granny/index.js.map +1 -0
  182. package/dist/resource/geometry/index.js +17 -0
  183. package/dist/resource/geometry/index.js.map +1 -0
  184. package/dist/resource/index.js +52 -0
  185. package/dist/resource/index.js.map +1 -0
  186. package/dist/resource/resourceBoundary.js +64 -0
  187. package/dist/resource/resourceBoundary.js.map +1 -0
  188. package/dist/resource/shader/Tr2EffectRes.js +420 -0
  189. package/dist/resource/shader/Tr2EffectRes.js.map +1 -0
  190. package/dist/{resources → resource/shader}/Tr2MaterialArea.js +11 -6
  191. package/dist/resource/shader/Tr2MaterialArea.js.map +1 -0
  192. package/dist/{resources → resource/shader}/Tr2MaterialMesh.js +10 -5
  193. package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -0
  194. package/dist/{resources → resource/shader}/Tr2MaterialRes.js +12 -6
  195. package/dist/resource/shader/Tr2MaterialRes.js.map +1 -0
  196. package/dist/resource/shader/Tr2Shader.js +250 -0
  197. package/dist/resource/shader/Tr2Shader.js.map +1 -0
  198. package/dist/{resources → resource/shader}/Tr2ShaderPermutation.js +15 -9
  199. package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -0
  200. package/dist/resource/shader/index.js +17 -0
  201. package/dist/resource/shader/index.js.map +1 -0
  202. package/dist/resource/shader/portable.js +33 -0
  203. package/dist/resource/shader/portable.js.map +1 -0
  204. package/dist/resource/shader/portableValidation.js +461 -0
  205. package/dist/resource/shader/portableValidation.js.map +1 -0
  206. package/dist/resource/shader/reflection/Tr2EffectConstant.js +100 -0
  207. package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -0
  208. package/dist/resource/shader/reflection/Tr2EffectDefine.js +34 -0
  209. package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -0
  210. package/dist/resource/shader/reflection/Tr2EffectDescription.js +113 -0
  211. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -0
  212. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +141 -0
  213. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -0
  214. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +107 -0
  215. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -0
  216. package/dist/resource/shader/reflection/Tr2EffectResource.js +90 -0
  217. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -0
  218. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +235 -0
  219. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -0
  220. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +71 -0
  221. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -0
  222. package/dist/resource/shader/reflection/Tr2Pass.js +111 -0
  223. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -0
  224. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +80 -0
  225. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -0
  226. package/dist/{texture → resource/texture}/CjsTextureArrayRes.js +84 -7
  227. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -0
  228. package/dist/{texture/CjsTextureParameterProxy.js → resource/texture/CjsTextureArrayResParameterProxy.js} +57 -11
  229. package/dist/resource/texture/CjsTextureArrayResParameterProxy.js.map +1 -0
  230. package/dist/{resources → resource/texture}/Tr2ImageRes.js +7 -5
  231. package/dist/resource/texture/Tr2ImageRes.js.map +1 -0
  232. package/dist/{resources → resource/texture}/Tr2TextureLodManager.js +5 -3
  233. package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -0
  234. package/dist/{resources → resource/texture}/Tr2TextureLodUpdateRequest.js +3 -3
  235. package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -0
  236. package/dist/{resources → resource/texture}/Tr2TexturePackChannel.js +3 -3
  237. package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -0
  238. package/dist/{resources → resource/texture}/Tr2TexturePipeline.js +8 -6
  239. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -0
  240. package/dist/{resources → resource/texture}/Tr2TexturePipelineParams.js +3 -3
  241. package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -0
  242. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepCompress.js +3 -3
  243. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -0
  244. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepGenerateMips.js +3 -3
  245. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -0
  246. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLimitSize.js +3 -3
  247. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -0
  248. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLoad.js +3 -3
  249. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -0
  250. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepPack.js +3 -3
  251. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -0
  252. package/dist/{resources → resource/texture}/TriTextureRes.js +43 -27
  253. package/dist/resource/texture/TriTextureRes.js.map +1 -0
  254. package/dist/resource/texture/index.js +15 -0
  255. package/dist/resource/texture/index.js.map +1 -0
  256. package/dist/{resources → resource/texture}/texturePipelineBehavior.js +61 -61
  257. package/dist/resource/texture/texturePipelineBehavior.js.map +1 -0
  258. package/dist/worker/CjsResManMainThreadLoader.js +87 -0
  259. package/dist/worker/CjsResManMainThreadLoader.js.map +1 -0
  260. package/dist/worker/CjsResManWorker.js +217 -0
  261. package/dist/worker/CjsResManWorker.js.map +1 -0
  262. package/dist/worker/CjsResManWorkerLoader.js +434 -0
  263. package/dist/worker/CjsResManWorkerLoader.js.map +1 -0
  264. package/dist/worker/protocol.js +12 -0
  265. package/dist/worker/protocol.js.map +1 -0
  266. package/docs/README.md +18 -5
  267. package/docs/architecture.md +40 -17
  268. package/docs/concepts/resource-lifecycle.md +2 -1
  269. package/docs/formats/README.md +4 -0
  270. package/docs/reference/classes/README.md +6 -4
  271. package/docs/reference/classes/audio.md +30 -0
  272. package/docs/reference/classes/core.md +31 -11
  273. package/docs/reference/classes/formats.md +1 -1
  274. package/docs/reference/classes/resources.md +151 -41
  275. package/docs/reference/classes/texture.md +7 -7
  276. package/docs/reference/events.md +1 -1
  277. package/docs/reference/motherlode-cache.md +17 -0
  278. package/docs/reference/queues.md +9 -1
  279. package/docs/reference/workers.md +135 -0
  280. package/docs/roadmap.md +27 -1
  281. package/format-notices/black/NOTICE +1 -1
  282. package/package.json +9 -4
  283. package/dist/CjsResManQueue.js.map +0 -1
  284. package/dist/CjsResource.js.map +0 -1
  285. package/dist/CjsResourceSource.js +0 -68
  286. package/dist/CjsResourceSource.js.map +0 -1
  287. package/dist/resourcePath.js +0 -18
  288. package/dist/resourcePath.js.map +0 -1
  289. package/dist/resourceStates.js +0 -9
  290. package/dist/resourceStates.js.map +0 -1
  291. package/dist/resources/AudioGeometryResData.js.map +0 -1
  292. package/dist/resources/GStateBindingCallbackData.js.map +0 -1
  293. package/dist/resources/MeshDecalData.js.map +0 -1
  294. package/dist/resources/MeshDecalLodData.js.map +0 -1
  295. package/dist/resources/Tr2EffectRes.js +0 -71
  296. package/dist/resources/Tr2EffectRes.js.map +0 -1
  297. package/dist/resources/Tr2GrannyIntersectionResult.js.map +0 -1
  298. package/dist/resources/Tr2GrannyStateRes.js.map +0 -1
  299. package/dist/resources/Tr2ImageRes.js.map +0 -1
  300. package/dist/resources/Tr2LightProfileRes.js.map +0 -1
  301. package/dist/resources/Tr2MaterialArea.js.map +0 -1
  302. package/dist/resources/Tr2MaterialMesh.js.map +0 -1
  303. package/dist/resources/Tr2MaterialRes.js.map +0 -1
  304. package/dist/resources/Tr2ShaderPermutation.js.map +0 -1
  305. package/dist/resources/Tr2TextureLodManager.js.map +0 -1
  306. package/dist/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
  307. package/dist/resources/Tr2TexturePackChannel.js.map +0 -1
  308. package/dist/resources/Tr2TexturePipeline.js.map +0 -1
  309. package/dist/resources/Tr2TexturePipelineParams.js.map +0 -1
  310. package/dist/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
  311. package/dist/resources/Tr2TexturePipelineStepGenerateMips.js.map +0 -1
  312. package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
  313. package/dist/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
  314. package/dist/resources/Tr2TexturePipelineStepPack.js.map +0 -1
  315. package/dist/resources/TriGeometryRes.js +0 -239
  316. package/dist/resources/TriGeometryRes.js.map +0 -1
  317. package/dist/resources/TriGeometryResAreaData.js.map +0 -1
  318. package/dist/resources/TriGeometryResJointData.js.map +0 -1
  319. package/dist/resources/TriGeometryResLodData.js.map +0 -1
  320. package/dist/resources/TriGeometryResMeshData.js.map +0 -1
  321. package/dist/resources/TriGeometryResSkeletonData.js.map +0 -1
  322. package/dist/resources/TriGrannyRes.js.map +0 -1
  323. package/dist/resources/TriJointBinding.js.map +0 -1
  324. package/dist/resources/TriMorphTargetGeometryConstants.js.map +0 -1
  325. package/dist/resources/TriRtGeometryConstants.js.map +0 -1
  326. package/dist/resources/TriTextureRes.js.map +0 -1
  327. package/dist/resources/enums.js.map +0 -1
  328. package/dist/resources/resourceBoundary.js +0 -47
  329. package/dist/resources/resourceBoundary.js.map +0 -1
  330. package/dist/resources/texturePipelineBehavior.js.map +0 -1
  331. package/dist/texture/CjsTextureArrayRes.js.map +0 -1
  332. package/dist/texture/CjsTextureParameterProxy.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsResManWorkerLoader.js","sources":["../../../src/worker/CjsResManWorkerLoader.js"],"sourcesContent":["import { Message, Operation } from \"./protocol.js\";\nimport { CjsResManMainThreadLoader } from \"./CjsResManMainThreadLoader.js\";\n\nconst DEFAULT_WORKER_OPTIONS = Object.freeze({\n type: \"module\",\n name: \"CjsResManWorker\"\n});\n\n/**\n * Browser module-worker strategy that correlates source/format requests, transfers owned buffers, propagates cancellation and fatal failure, and delegates unsupported operations to a main-thread loader.\n *\n * One module worker can overlap fetch requests and serializes synchronous\n * reader work on its own event loop. Sources opt in through\n * `CreateWorkerRequest(path, options)`. Formats opt in through a static\n * `worker` declaration containing their module URL and export name.\n */\nexport class CjsResManWorkerLoader\n{\n #boundError;\n #boundMessage;\n #nextId = 1;\n #pending = new Map();\n\n /**\n * @param {object} [options={}] Worker construction and fallback options.\n * @param {CjsResManMainThreadLoader|object} [options.fallback] Unsupported-operation fallback.\n * @param {Worker|object} [options.worker] Existing Worker-compatible instance.\n * @param {(url: string|URL, options: object) => Worker|object} [options.workerFactory] Worker factory.\n * @param {string|URL} [options.workerUrl] Module worker entry URL.\n * @param {object} [options.workerOptions] Options passed to the Worker constructor.\n * @param {boolean} [options.enabled=true] Whether worker execution may be used.\n */\n constructor(options = {}) {\n if (!options || typeof options !== \"object\" || Array.isArray(options)) {\n throw new TypeError(\"CjsResManWorkerLoader options must be an object.\");\n }\n\n this.fallback = options.fallback || new CjsResManMainThreadLoader();\n assertResourceLoader(this.fallback, \"fallback\");\n this.workerFactory = options.workerFactory || defaultWorkerFactory;\n if (typeof this.workerFactory !== \"function\") {\n throw new TypeError(\"CjsResManWorkerLoader workerFactory must be a function.\");\n }\n this.workerUrl = options.workerUrl\n || new URL(\"./CjsResManWorker.js\", import.meta.url);\n this.workerOptions = Object.freeze({\n ...DEFAULT_WORKER_OPTIONS,\n ...(options.workerOptions || {})\n });\n this.enabled = options.enabled !== false;\n this.failed = false;\n this.worker = options.worker || null;\n this.#boundMessage = event => this.#OnMessage(event);\n this.#boundError = event => this.#OnError(event);\n if (this.worker) this.#Attach(this.worker);\n }\n\n /**\n * Enable and lazily create the configured worker.\n *\n * @param {string|URL} [workerUrl] Optional replacement worker URL.\n * @returns {boolean} Whether a worker is ready.\n */\n Enable(workerUrl = this.workerUrl) {\n this.enabled = true;\n if (workerUrl !== undefined && workerUrl !== null) this.workerUrl = workerUrl;\n if (this.worker) return true;\n if (this.failed) return false;\n\n try {\n const worker = this.workerFactory(this.workerUrl, this.workerOptions);\n if (!worker || typeof worker.postMessage !== \"function\") {\n throw new TypeError(\"Worker factory did not return a Worker-compatible object.\");\n }\n this.worker = worker;\n this.#Attach(worker);\n return true;\n } catch {\n this.worker = null;\n this.failed = true;\n return false;\n }\n }\n\n /**\n * Stop worker use and reject every pending request.\n *\n * @param {*} [reason] Optional failure reason.\n * @returns {CjsResManWorkerLoader} This loader.\n */\n Disable(reason = null) {\n const worker = this.worker;\n if (worker) {\n this.#Detach(worker);\n worker.terminate?.();\n }\n this.worker = null;\n this.enabled = false;\n this.failed = reason !== null && reason !== undefined;\n\n if (this.#pending.size) {\n const error = normalizeWorkerError(\n reason || createWorkerUnavailableError(\"Resource worker was disabled.\")\n );\n for (const request of this.#pending.values()) {\n cleanupPendingRequest(request);\n request.reject(error);\n }\n this.#pending.clear();\n }\n return this;\n }\n\n /**\n * Clear a previous creation/fatal failure so a later enable can retry.\n *\n * @returns {CjsResManWorkerLoader} This loader.\n */\n Reset() {\n this.failed = false;\n this.enabled = true;\n return this;\n }\n\n /**\n * Replace the unsupported-operation fallback.\n *\n * @param {CjsResManMainThreadLoader|object} fallback Loader exposing Read and ReadFormat.\n * @returns {CjsResManWorkerLoader} This loader.\n */\n SetFallback(fallback) {\n assertResourceLoader(fallback, \"fallback\");\n this.fallback = fallback;\n return this;\n }\n\n /**\n * Report whether worker execution is configured and constructible.\n *\n * @returns {boolean}\n */\n IsAvailable() {\n return this.enabled && (Boolean(this.worker) || this.Enable());\n }\n\n /**\n * Read a source through its declared worker request, falling back when the\n * source is not worker-aware or a worker cannot be created.\n *\n * @param {object|Function} source Source implementation.\n * @param {string} path Normalized resource path.\n * @param {object} [options={}] Source options.\n * @returns {Promise<*>|*} Source result.\n */\n Read(source, path, options = {}) {\n assertResourceSource(source);\n if (typeof source.CreateWorkerRequest !== \"function\") {\n return this.fallback.Read(source, path, options);\n }\n\n const request = normalizeWorkerRequest(source.CreateWorkerRequest(path, options));\n if (!request || !this.IsAvailable()) {\n return this.fallback.Read(source, path, options);\n }\n return this.Execute(request.operation, request.payload, {\n signal: request.signal || options.signal,\n transfer: request.transfer\n });\n }\n\n /**\n * Test whether a registered format can be safely dispatched to this worker.\n *\n * @param {object} descriptor Registered format descriptor.\n * @param {object} [formatOptions={}] Normalized format options.\n * @returns {boolean}\n */\n CanReadFormat(descriptor, formatOptions = {}) {\n const declaration = normalizeFormatWorkerDeclaration(descriptor);\n return Boolean(\n declaration\n && isWorkerFormatOutputSupported(declaration, formatOptions)\n && canCloneWorkerValue(formatOptions)\n && this.IsAvailable()\n );\n }\n\n /**\n * Execute a worker-safe format reader or use the main-thread fallback.\n *\n * Inputs are cloned by default so shared source-cache ownership is not\n * detached. A format may explicitly declare `transferInput: true` when its\n * caller guarantees exclusive ownership.\n *\n * @param {object} descriptor Registered format descriptor.\n * @param {*} input Reader input.\n * @param {object} [formatOptions={}] Normalized format options.\n * @returns {Promise<*>} Format result.\n */\n ReadFormat(descriptor, input, formatOptions = {}) {\n const declaration = normalizeFormatWorkerDeclaration(descriptor);\n if (!declaration\n || !isWorkerFormatOutputSupported(declaration, formatOptions)\n || !canCloneWorkerValue(formatOptions)\n || !this.IsAvailable()) {\n return this.fallback.ReadFormat(descriptor, input, formatOptions);\n }\n\n const transfer = declaration.transferInput\n ? getExclusiveInputTransferables(input)\n : [];\n return this.Execute(Operation.FORMAT_READ, {\n module: declaration.module,\n exportName: declaration.exportName,\n input,\n options: formatOptions\n }, { transfer });\n }\n\n /**\n * Dispatch one operation using the stable worker message protocol.\n *\n * @param {string} operation Operation name.\n * @param {*} payload Structured-cloneable operation payload.\n * @param {object} [options={}] Transfer and cancellation options.\n * @returns {Promise<*>} Worker result.\n */\n Execute(operation, payload, options = {}) {\n if (typeof operation !== \"string\" || operation.trim() === \"\") {\n return Promise.reject(new TypeError(\"Worker operation must be a non-empty string.\"));\n }\n if (!this.IsAvailable()) {\n return Promise.reject(createWorkerUnavailableError());\n }\n const signal = options.signal || null;\n if (signal?.aborted) return Promise.reject(createAbortError(signal.reason));\n\n const id = this.#nextId++;\n let resolve;\n let reject;\n const promise = new Promise((onResolve, onReject) => {\n resolve = onResolve;\n reject = onReject;\n });\n const request = {\n id,\n resolve,\n reject,\n signal,\n onAbort: null\n };\n if (signal && typeof signal.addEventListener === \"function\") {\n request.onAbort = () => {\n if (!this.#pending.delete(id)) return;\n cleanupPendingRequest(request);\n try {\n this.worker?.postMessage({\n type: Message.CANCEL,\n id\n });\n } catch {\n // The local abort remains authoritative if the worker is already gone.\n }\n reject(createAbortError(signal.reason));\n };\n signal.addEventListener(\"abort\", request.onAbort, { once: true });\n }\n this.#pending.set(id, request);\n\n try {\n this.worker.postMessage({\n type: Message.EXECUTE,\n id,\n operation,\n payload\n }, normalizeTransferList(options.transfer));\n } catch (error) {\n this.#pending.delete(id);\n cleanupPendingRequest(request);\n reject(error);\n }\n return promise;\n }\n\n /**\n * Return the number of unresolved worker requests.\n *\n * @returns {number}\n */\n GetPendingCount() {\n return this.#pending.size;\n }\n\n /** Attach this loader's result and failure listeners to a worker. */\n #Attach(worker) {\n if (typeof worker.addEventListener === \"function\") {\n worker.addEventListener(\"message\", this.#boundMessage);\n worker.addEventListener(\"error\", this.#boundError);\n worker.addEventListener(\"messageerror\", this.#boundError);\n } else {\n worker.onmessage = this.#boundMessage;\n worker.onerror = this.#boundError;\n worker.onmessageerror = this.#boundError;\n }\n }\n\n /** Detach this loader's result and failure listeners from a worker. */\n #Detach(worker) {\n if (typeof worker.removeEventListener === \"function\") {\n worker.removeEventListener(\"message\", this.#boundMessage);\n worker.removeEventListener(\"error\", this.#boundError);\n worker.removeEventListener(\"messageerror\", this.#boundError);\n } else {\n if (worker.onmessage === this.#boundMessage) worker.onmessage = null;\n if (worker.onerror === this.#boundError) worker.onerror = null;\n if (worker.onmessageerror === this.#boundError) worker.onmessageerror = null;\n }\n }\n\n /** Settle the pending request identified by one worker result message. */\n #OnMessage(event) {\n const data = event?.data;\n if (!data || data.type !== Message.RESULT) return;\n const request = this.#pending.get(data.id);\n if (!request) return;\n this.#pending.delete(data.id);\n cleanupPendingRequest(request);\n if (data.ok) request.resolve(data.result);\n else request.reject(normalizeWorkerError(data.error));\n }\n\n /** Disable worker execution after a fatal worker or message failure. */\n #OnError(event) {\n const reason = event?.error || event || new Error(\"Resource worker failed.\");\n this.Disable(reason);\n }\n}\n\nfunction assertResourceSource(source) {\n if (!source || (typeof source !== \"object\" && typeof source !== \"function\")\n || typeof source.Read !== \"function\") {\n throw new TypeError(\"Resource source must provide Read(path, options).\");\n }\n}\n\nfunction assertResourceLoader(loader, name = \"loader\") {\n if (!loader || typeof loader.Read !== \"function\" || typeof loader.ReadFormat !== \"function\") {\n throw new TypeError(`CjsResManWorkerLoader ${name} must provide Read and ReadFormat.`);\n }\n}\n\nfunction defaultWorkerFactory(url, options) {\n if (typeof Worker === \"undefined\") {\n throw new ReferenceError(\"Browser Worker is not available.\");\n }\n return new Worker(url, options);\n}\n\nfunction normalizeWorkerRequest(request) {\n if (request === null || request === undefined || request === false) return null;\n if (!request || typeof request !== \"object\" || Array.isArray(request)) {\n throw new TypeError(\"CreateWorkerRequest must return an object or null.\");\n }\n if (typeof request.operation !== \"string\" || request.operation.trim() === \"\") {\n throw new TypeError(\"Worker source request requires a non-empty operation.\");\n }\n return {\n operation: request.operation,\n payload: request.payload,\n signal: request.signal || null,\n transfer: normalizeTransferList(request.transfer)\n };\n}\n\nfunction normalizeFormatWorkerDeclaration(descriptor) {\n const Format = descriptor?.Format;\n const declaration = descriptor?.worker || Format?.worker;\n if (!declaration) return null;\n\n const value = typeof declaration === \"string\"\n ? { module: declaration }\n : declaration;\n if (!value || typeof value !== \"object\" || !value.module) return null;\n return Object.freeze({\n module: String(value.module),\n exportName: String(value.exportName || Format?.name || \"default\"),\n outputTypes: Array.isArray(value.outputTypes)\n ? Object.freeze(value.outputTypes.map(String))\n : null,\n defaultOutput: value.defaultOutput === undefined\n ? undefined\n : String(value.defaultOutput),\n transferInput: value.transferInput === true\n });\n}\n\nfunction isWorkerFormatOutputSupported(declaration, formatOptions) {\n if (!declaration.outputTypes) return true;\n const output = formatOptions.emit ?? declaration.defaultOutput;\n return output !== undefined && declaration.outputTypes.includes(String(output));\n}\n\nfunction normalizeTransferList(value) {\n if (value === null || value === undefined) return [];\n if (!Array.isArray(value)) {\n throw new TypeError(\"Worker transfer list must be an array.\");\n }\n return value;\n}\n\nfunction getExclusiveInputTransferables(input) {\n if (input instanceof ArrayBuffer) return [ input ];\n if (ArrayBuffer.isView(input)\n && input.byteOffset === 0\n && input.byteLength === input.buffer.byteLength) {\n return [ input.buffer ];\n }\n return [];\n}\n\nfunction canCloneWorkerValue(value, seen = new Set()) {\n if (value === null || value === undefined) return true;\n const type = typeof value;\n if (type === \"string\" || type === \"number\" || type === \"boolean\" || type === \"bigint\") {\n return true;\n }\n if (type !== \"object\") return false;\n if (value instanceof ArrayBuffer || ArrayBuffer.isView(value) || value instanceof Date) {\n return true;\n }\n if (seen.has(value)) return false;\n seen.add(value);\n if (Array.isArray(value)) {\n return value.every(entry => canCloneWorkerValue(entry, seen));\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return false;\n return Object.values(value).every(entry => canCloneWorkerValue(entry, seen));\n}\n\nfunction cleanupPendingRequest(request) {\n if (request.signal && request.onAbort\n && typeof request.signal.removeEventListener === \"function\") {\n request.signal.removeEventListener(\"abort\", request.onAbort);\n }\n}\n\nfunction createWorkerUnavailableError(message = \"Resource worker is unavailable.\") {\n const error = new Error(message);\n error.name = \"CjsResManWorkerUnavailableError\";\n error.code = \"CJS_RESOURCE_WORKER_UNAVAILABLE\";\n return error;\n}\n\nfunction createAbortError(reason) {\n if (reason instanceof Error) return reason;\n const error = new Error(reason === undefined ? \"Resource worker request was aborted.\" : String(reason));\n error.name = \"AbortError\";\n error.code = \"ABORT_ERR\";\n return error;\n}\n\nfunction normalizeWorkerError(value) {\n if (value instanceof Error) return value;\n const error = new Error(value?.message || \"Resource worker operation failed.\");\n error.name = value?.name || \"CjsResManWorkerError\";\n for (const key of [ \"code\", \"operation\", \"path\", \"status\", \"statusText\" ]) {\n if (value?.[key] !== undefined) error[key] = value[key];\n }\n return error;\n}\n"],"names":["DEFAULT_WORKER_OPTIONS","Object","freeze","type","name","CjsResManWorkerLoader","Map","constructor","options","Array","isArray","TypeError","fallback","CjsResManMainThreadLoader","assertResourceLoader","workerFactory","defaultWorkerFactory","workerUrl","URL","import","meta","url","workerOptions","enabled","failed","worker","event","Enable","undefined","postMessage","Disable","reason","terminate","size","error","normalizeWorkerError","createWorkerUnavailableError","request","values","cleanupPendingRequest","reject","clear","Reset","SetFallback","IsAvailable","Boolean","Read","source","path","assertResourceSource","CreateWorkerRequest","normalizeWorkerRequest","Execute","operation","payload","signal","transfer","CanReadFormat","descriptor","formatOptions","declaration","normalizeFormatWorkerDeclaration","isWorkerFormatOutputSupported","canCloneWorkerValue","ReadFormat","input","transferInput","getExclusiveInputTransferables","Operation","FORMAT_READ","module","exportName","trim","Promise","aborted","createAbortError","id","resolve","promise","onResolve","onReject","onAbort","addEventListener","delete","Message","CANCEL","once","set","EXECUTE","normalizeTransferList","GetPendingCount","#Attach","onmessage","onerror","onmessageerror","#Detach","removeEventListener","#OnMessage","data","RESULT","get","ok","result","#OnError","Error","loader","Worker","ReferenceError","Format","value","String","outputTypes","map","defaultOutput","output","emit","includes","ArrayBuffer","isView","byteOffset","byteLength","buffer","seen","Set","Date","has","add","every","entry","prototype","getPrototypeOf","message","code","key"],"mappings":";;;AAGA,MAAMA,sBAAsB,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC3CC,EAAAA,IAAI,EAAE,QAAQ;AACdC,EAAAA,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,CAClC;AACE,EAAA,WAAW;AACX,EAAA,aAAa;EACb,OAAO,GAAG,CAAC;AACX,EAAA,QAAQ,GAAG,IAAIC,GAAG,EAAE;;AAEpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EAAE;AACxB,IAAA,IAAI,CAACA,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;AACrE,MAAA,MAAM,IAAIG,SAAS,CAAC,kDAAkD,CAAC;AACzE,IAAA;IAEA,IAAI,CAACC,QAAQ,GAAGJ,OAAO,CAACI,QAAQ,IAAI,IAAIC,yBAAyB,EAAE;AACnEC,IAAAA,oBAAoB,CAAC,IAAI,CAACF,QAAQ,EAAE,UAAU,CAAC;AAC/C,IAAA,IAAI,CAACG,aAAa,GAAGP,OAAO,CAACO,aAAa,IAAIC,oBAAoB;AAClE,IAAA,IAAI,OAAO,IAAI,CAACD,aAAa,KAAK,UAAU,EAAE;AAC5C,MAAA,MAAM,IAAIJ,SAAS,CAAC,yDAAyD,CAAC;AAChF,IAAA;AACA,IAAA,IAAI,CAACM,SAAS,GAAGT,OAAO,CAACS,S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A,IAAIA,KAAK,YAAYL,KAAK,EAAE,OAAOK,KAAK;EACxC,MAAM3E,KAAK,GAAG,IAAIsE,KAAK,CAACK,KAAK,EAAEsB,OAAO,IAAI,mCAAmC,CAAC;AAC9EjG,EAAAA,KAAK,CAAC9B,IAAI,GAAGyG,KAAK,EAAEzG,IAAI,IAAI,sBAAsB;AAClD,EAAA,KAAK,MAAMiI,GAAG,IAAI,CAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAE,EAAE;AACzE,IAAA,IAAIxB,KAAK,GAAGwB,GAAG,CAAC,KAAKzG,SAAS,EAAEM,KAAK,CAACmG,GAAG,CAAC,GAAGxB,KAAK,CAACwB,GAAG,CAAC;AACzD,EAAA;AACA,EAAA,OAAOnG,KAAK;AACd;;;;"}
@@ -0,0 +1,12 @@
1
+ const Operation = Object.freeze({
2
+ FETCH: "source.fetch",
3
+ FORMAT_READ: "format.read"
4
+ });
5
+ const Message = Object.freeze({
6
+ CANCEL: "cancel",
7
+ EXECUTE: "execute",
8
+ RESULT: "result"
9
+ });
10
+
11
+ export { Message, Operation };
12
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sources":["../../../src/worker/protocol.js"],"sourcesContent":["export const Operation = Object.freeze({\n FETCH: \"source.fetch\",\n FORMAT_READ: \"format.read\"\n});\n\nexport const Message = Object.freeze({\n CANCEL: \"cancel\",\n EXECUTE: \"execute\",\n RESULT: \"result\"\n});\n"],"names":["Operation","Object","freeze","FETCH","FORMAT_READ","Message","CANCEL","EXECUTE","RESULT"],"mappings":"MAAaA,SAAS,GAAGC,MAAM,CAACC,MAAM,CAAC;AACrCC,EAAAA,KAAK,EAAE,cAAc;AACrBC,EAAAA,WAAW,EAAE;AACf,CAAC;MAEYC,OAAO,GAAGJ,MAAM,CAACC,MAAM,CAAC;AACnCI,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,MAAM,EAAE;AACV,CAAC;;;;"}
package/docs/README.md CHANGED
@@ -9,9 +9,11 @@ Summary: Documentation home for the GPU-free resource lifecycle, cache, format,
9
9
 
10
10
  `@carbonenginejs/runtime-resource` owns the GPU-free resource layer of
11
11
  CarbonEngineJS: resource identity and state, the MotherLode cache, semantic
12
- resource classes, registered format readers, source adapters, and the queued
12
+ resource classes, registered format readers, fetch providers, and the queued
13
13
  CPU load/publication pipeline. It stops at a published CPU payload; engine
14
- packages realize that payload into backend objects.
14
+ packages realize that payload into backend objects. It also owns the canonical
15
+ device-free `Tr2EffectRes`/`Tr2Shader` reflection graph and portable-reflection
16
+ hydration boundary.
15
17
 
16
18
  ## Use this package when
17
19
 
@@ -19,19 +21,24 @@ packages realize that payload into backend objects.
19
21
  selection, `Ready()`/`GetObject()`) without choosing a GPU backend;
20
22
  - you need one of the non-shader format readers as a tree-shakeable subpath
21
23
  (`@carbonenginejs/runtime-resource/formats/<name>`);
24
+ - you need canonical effect permutation selection or immutable shader
25
+ reflection records from `@carbonenginejs/runtime-resource/resource/shader`;
26
+ - you need canonical raw audio resources for complete files or byte windows
27
+ over shared physical sources;
22
28
  - you are writing an engine adapter that consumes published CPU payloads and
23
29
  needs the documented retention, reload, and texture-array contracts.
24
30
 
25
31
  ## Where it fits
26
32
 
27
- - Foundations consumed: `@carbonenginejs/core-types` (event emitter, model
28
- contracts) and `@carbonenginejs/core-math` where formats need math values.
33
+ - Foundations consumed: `@carbonenginejs/runtime-utils` (event emitter, model
34
+ contracts) and `@carbonenginejs/runtime-utils` where formats need math values.
29
35
  - Normal consumers: `runtime-core` (configures and exposes a `CjsResMan`),
30
36
  `runtime-trinity` and `runtime-sof` (request GPU-free objects), and engine
31
37
  packages (`engine-webgpu`, future WebGL engines) that realize prepared
32
38
  resources.
33
39
  - Owned responsibility: resource identity, cache, CPU payload lifecycle,
34
- format selection and conversion, and load/publication queues.
40
+ format selection and conversion, load/publication queues, and canonical
41
+ device-free effect/shader reflection hydration and selection.
35
42
  - Owned elsewhere: WebGL/WebGPU realization, device budgets, and device-loss
36
43
  recovery belong to engine packages; shader formats belong to the dedicated
37
44
  shader format packages.
@@ -54,6 +61,12 @@ packages realize that payload into backend objects.
54
61
  reload contract.
55
62
  - [reference/queues.md](reference/queues.md): queued CPU load, publication,
56
63
  registration, and the `Wait()` fence.
64
+ - [reference/workers.md](reference/workers.md): browser-worker source and
65
+ declared worker-safe format execution.
66
+ - [reference/classes/audio.md](reference/classes/audio.md): complete/shared
67
+ audio byte owners and individually addressable audio resource views.
68
+ - [reference/classes/resources.md](reference/classes/resources.md): canonical
69
+ resource records, effect selection, and shader-reflection classes.
57
70
  - [reference/texture-arrays.md](reference/texture-arrays.md): texture-array
58
71
  proxies, update generations, and adapter commits.
59
72
  - [reference/texture-pipeline.md](reference/texture-pipeline.md):
@@ -19,10 +19,13 @@ Engine adapters own device realization:
19
19
  LOADED -> PREPARING -> PREPARED
20
20
  ```
21
21
 
22
- The package selects and runs registered non-shader readers, hydrates or
23
- returns the promised CPU outcome, and stores lifecycle state, cache entries,
24
- and loaded payloads. It never creates WebGL/WebGPU textures, buffers, shader
25
- modules, pipelines, or bind groups, and it never inspects backend capability.
22
+ The package selects and runs registered readers, hydrates or returns the
23
+ promised CPU outcome, and stores lifecycle state, cache entries, and loaded
24
+ payloads. For compiled effects it independently validates complete permutation
25
+ topology and the format package's plain portable reflection, selects a
26
+ permutation, and hydrates a canonical device-free `Tr2Shader` graph. It never
27
+ creates WebGL/WebGPU textures, buffers, shader modules, pipelines, or bind
28
+ groups, and it never inspects backend capability.
26
29
  A realization failure destroys its candidate and returns the resource to
27
30
  `LOADED` without discarding the valid CPU payload.
28
31
 
@@ -40,47 +43,67 @@ historical mapping.
40
43
  - `CjsResMan` semantic resource construction, registered-format selection,
41
44
  concurrency-limited source loading, staged prepare queues, layered
42
45
  source/read/resource deduplication, object loader dispatch, and prefetch.
43
- - `CjsTextureArrayRes` and `CjsTextureParameterProxy` for material-facing,
46
+ - Main-thread and browser-worker resource execution strategies, including
47
+ transferable fetch results and declared worker-safe CPU readers.
48
+ - `CjsTextureArrayRes` and `CjsTextureArrayResParameterProxy` for material-facing,
44
49
  frame-coalesced texture-array inputs.
45
- - Raw `CjsEventEmitter` (from `core-types/model`) for manager/runtime events
50
+ - `CjsAudioBufferRes` for physical audio-byte ownership and `CjsAudioRes` for
51
+ complete or windowed individually addressable audio files.
52
+ - Raw `CjsEventEmitter` (from `runtime-utils/model`) for manager/runtime events
46
53
  without requiring `CjsModel` inheritance.
47
- - Path normalization, extension helpers, and source adapters for memory and
48
- `fetch`.
54
+ - Resource-path normalization and URL resolution, including prefix bases and
55
+ an injectable complete resolver, with fetch execution delegated to a
56
+ URL-only provider.
57
+ - Resource-specific geometry traversal and payload adaptation, composed with
58
+ shared vector, matrix, bounds, sphere, ray, and mesh math from
59
+ `runtime-utils` rather than maintaining another math implementation here.
49
60
  - Plain reader/converter payload objects with focused shared validators.
50
61
  - Canonical Carbon resource classes that validate and hold CPU payloads
51
62
  privately: `TriTextureRes`, `TriGeometryRes`, `Tr2EffectRes`, `Tr2ImageRes`,
52
63
  `TriGrannyRes`, `Tr2GrannyStateRes`, and `Tr2LightProfileRes`.
64
+ - Canonical device-free shader/reflection classes: `Tr2Shader`, its effect,
65
+ technique, pass, stage, constant, resource, sampler, annotation, and library
66
+ records; portable hydration; permutation selection; and per-index caching.
53
67
  - `Tr2TexturePipeline` CPU-only texture steps and `Tr2TextureLodManager`
54
68
  membership.
55
69
  - Opaque engine-owned subobject slots for backend adapters.
56
- - Non-shader format implementations as explicit tree-shakeable subpaths under
70
+ - Format implementations as explicit tree-shakeable subpaths under
57
71
  `@carbonenginejs/runtime-resource/formats/<name>`.
58
72
 
59
73
  ## What the package does not own
60
74
 
61
75
  - WebGL/WebGPU realization, allocations, upload accounting, device budgets,
62
76
  capability limits, and device-loss recovery (engine packages).
63
- - Shader formats (`format-dxbc`, `format-hlsl`, `format-webgl`,
64
- `format-webgpu` remain separate packages).
77
+ - Shader binary decoding, backend translation, and package serialization remain
78
+ in the standalone shader-format packages. Backend shader objects remain in
79
+ engine packages.
65
80
  - AudioBuffer construction, playback, or audio manager behavior.
81
+ - Audio-library document construction, enrichment, media-ID interpretation,
82
+ and delivery-route selection.
66
83
 
67
84
  ## Package relationships
68
85
 
69
86
  - `runtime-core` may configure and expose a `CjsResMan`, but does not own its
70
87
  implementation.
71
88
  - `runtime-trinity` and `runtime-sof` may request GPU-free objects and
72
- resources without selecting an engine.
89
+ resources without selecting an engine. Trinity owns the mutable
90
+ `Tr2Effect`/`Tr2Material` facade, parameters, options, and sampler overrides;
91
+ it consumes the resource-owned shader graph.
73
92
  - `engine-webgpu` and future WebGL engines consume loaded resources and own
74
93
  all backend allocations, preparation, replacement, and destruction.
75
94
 
76
95
  Concrete formats are not imported or registered by the package root; see
77
96
  [formats/README.md](formats/README.md) for the import rule and map.
97
+ Worker-safe formats provide their own exact module declaration and remain
98
+ explicit registrations; see [browser worker execution](reference/workers.md).
78
99
 
79
100
  ## Source layout
80
101
 
81
102
  Authoring source is decorated JavaScript; published output is built ESM in
82
- `npm/dist`. Completed Carbon data classes live with maintained source under
83
- `src/resources`; `src/generated` is reserved for unresolved active ports and
84
- is currently absent. Native shapes that JavaScript replaces or does not use
85
- are retained only under `src/dropped`, with their disposition documented
86
- there, and are never exported or bundled.
103
+ `npm/dist`. Resource owners and their direct Carbon data records live under
104
+ `src/resource`, grouped as `audio`, `geometry`, `geometry/granny`, `shader`,
105
+ and `texture`; worker execution and its message protocol live under `src/worker`;
106
+ `src/generated` is reserved for unresolved active ports and is currently
107
+ absent. Native shapes that JavaScript replaces or does not use are retained
108
+ only under `src/dropped`, with their disposition documented there, and are
109
+ never exported or bundled.
@@ -116,7 +116,8 @@ Application / runtime object
116
116
  | - mark resource REQUESTED |
117
117
  | - share one source operation per source/path |
118
118
  | - obey maxConcurrentLoads |
119
- | - source.Read(path) |
119
+ | - CjsResMan builds URL when provider needs it |
120
+ | - provider.Read(sourcePath) |
120
121
  +===============================================+
121
122
  |
122
123
  | source bytes
@@ -29,6 +29,10 @@ through `SetPayload()`, validate their own required fields, and throw
29
29
  `GetPayload()`, `HasPayload()`, and `ReleasePayload()` manage transient CPU
30
30
  retention without introducing a parallel DTO class hierarchy.
31
31
 
32
+ Clone-safe formats may additionally declare browser-worker execution
33
+ metadata. Worker eligibility never changes the format's direct API; see
34
+ [browser worker execution](../reference/workers.md).
35
+
32
36
  ## Format map
33
37
 
34
38
  | Format | Class | Import |
@@ -21,12 +21,14 @@ documentation check against the actual source tree.
21
21
 
22
22
  ## Catalog pages
23
23
 
24
- - [core.md](core.md): the resource manager, MotherLode cache, resource and
25
- source classes, and the format/probe bases.
24
+ - [core.md](core.md): the resource manager, MotherLode cache, fetch provider,
25
+ core resource class, and the format/probe bases.
26
+ - [audio.md](audio.md): raw audio-byte owners and individually addressable
27
+ audio resource views.
26
28
  - [resources.md](resources.md): the Carbon-shaped semantic resource and data
27
- classes under `src/resources`.
29
+ classes in the `src/resource` family tree.
28
30
  - [texture.md](texture.md): texture-array aggregation classes under
29
- `src/texture`.
31
+ `src/resource/texture`.
30
32
  - [formats.md](formats.md): format entry classes and their internal reader
31
33
  machinery under `src/formats`.
32
34
  - [dropped.md](dropped.md): retained native shapes under `src/dropped` that
@@ -0,0 +1,30 @@
1
+ # Audio resource class catalog
2
+
3
+ Status: Evolving
4
+ Scope: `@carbonenginejs/runtime-resource/resource/audio` classes
5
+ Audience: Users, maintainers, and automated readers
6
+ Summary: Catalogs raw audio-byte owners and individually addressable audio resource views.
7
+
8
+ <!-- class:CjsAudioBufferRes -->
9
+ ## `CjsAudioBufferRes`
10
+
11
+ Physical audio byte-owner resource whose payload may back one complete file or several logical audio files.
12
+
13
+ - Export: `@carbonenginejs/runtime-resource/resource/audio`
14
+ - Source: `src/resource/audio/CjsAudioBufferRes.js`
15
+ - Visibility: Public
16
+ - Kind: Original CarbonEngineJS class
17
+ - Notes: Owns raw payload retention and locks without interpreting media IDs,
18
+ bank members, decoding, or playback.
19
+
20
+ <!-- class:CjsAudioRes -->
21
+ ## `CjsAudioRes`
22
+
23
+ Individually addressable audio resource representing one complete file over either a complete or windowed physical source.
24
+
25
+ - Export: `@carbonenginejs/runtime-resource/resource/audio`
26
+ - Source: `src/resource/audio/CjsAudioRes.js`
27
+ - Visibility: Public
28
+ - Kind: Original CarbonEngineJS class
29
+ - Notes: Carries immutable media metadata, returns detached byte windows, and
30
+ delegates locks and payload liveness to its backing resource.
@@ -1,7 +1,7 @@
1
1
  # Core class catalog
2
2
 
3
3
  Status: Evolving
4
- Scope: `@carbonenginejs/runtime-resource` classes under `src/` and `src/format/`
4
+ Scope: `@carbonenginejs/runtime-resource` classes under `src/`, `src/resource`, and `src/format/`
5
5
  Audience: Users, maintainers, and automated readers
6
6
  Summary: Provides one-sentence purpose descriptors for the resource manager, registry, resource, source, and format/probe base classes.
7
7
 
@@ -31,7 +31,7 @@ GPU-free resource manager that resolves paths through registered sources and for
31
31
  Small FIFO executor used inside `CjsResMan` that tracks item ids, pause state, concurrency, cancellation, and sync/async completion while queue policy stays in the manager.
32
32
 
33
33
  - Export: None
34
- - Source: `src/CjsResManQueue.js`
34
+ - Source: `src/CjsResManWorkQueue.js`
35
35
  - Visibility: Internal
36
36
  - Kind: Internal implementation class
37
37
 
@@ -41,27 +41,47 @@ Small FIFO executor used inside `CjsResMan` that tracks item ids, pause state, c
41
41
  Base runtime resource handle that carries normalized path/extension/requirement identity, load state, and an attached CPU payload, with manager lifecycle callbacks supplied by `CjsResMan` after canonical insertion.
42
42
 
43
43
  - Export: `@carbonenginejs/runtime-resource`
44
- - Source: `src/CjsResource.js`
44
+ - Source: `src/resource/CjsResource.js`
45
45
  - Visibility: Public
46
46
  - Kind: Adapted Carbon concept
47
47
 
48
- <!-- class:CjsMemoryResourceSource -->
49
- ## `CjsMemoryResourceSource`
48
+ <!-- class:CjsResManMainThreadLoader -->
49
+ ## `CjsResManMainThreadLoader`
50
50
 
51
- In-memory resource source that maps normalized resource paths to preset values and serves them to reads without any I/O.
51
+ Direct execution strategy that reads through a structural source and invokes registered format facades on the caller thread.
52
52
 
53
53
  - Export: `@carbonenginejs/runtime-resource`
54
- - Source: `src/CjsResourceSource.js`
54
+ - Source: `src/worker/CjsResManMainThreadLoader.js`
55
+ - Visibility: Public
56
+ - Kind: Adapted ccpwgl loader strategy
57
+
58
+ <!-- class:CjsResManWorkerLoader -->
59
+ ## `CjsResManWorkerLoader`
60
+
61
+ Browser module-worker strategy that correlates source/format requests, transfers owned buffers, propagates cancellation and fatal failure, and delegates unsupported operations to a main-thread loader.
62
+
63
+ - Export: `@carbonenginejs/runtime-resource`
64
+ - Source: `src/worker/CjsResManWorkerLoader.js`
65
+ - Visibility: Public
66
+ - Kind: Adapted ccpwgl loader strategy
67
+
68
+ <!-- class:CjsResManWorker -->
69
+ ## `CjsResManWorker`
70
+
71
+ Static browser-worker host that owns its operation/message vocabulary, executes clone-safe source and format operations, installs the message envelope, transfers owned buffers, and serializes failures for `CjsResMan`.
72
+
73
+ - Export: `@carbonenginejs/runtime-resource/worker`
74
+ - Source: `src/worker/CjsResManWorker.js`
55
75
  - Visibility: Public
56
76
  - Kind: Original CarbonEngineJS class
57
77
 
58
- <!-- class:CjsFetchResourceSource -->
59
- ## `CjsFetchResourceSource`
78
+ <!-- class:CjsResManFetchProvider -->
79
+ ## `CjsResManFetchProvider`
60
80
 
61
- Resource source that resolves a normalized path against an optional base URL and reads response bytes through an injected fetch implementation.
81
+ `CjsResMan` provider that fetches an already-resolved URL on the caller thread or through the resource worker.
62
82
 
63
83
  - Export: `@carbonenginejs/runtime-resource`
64
- - Source: `src/CjsResourceSource.js`
84
+ - Source: `src/CjsResManFetchProvider.js`
65
85
  - Visibility: Public
66
86
  - Kind: Original CarbonEngineJS class
67
87
 
@@ -380,7 +380,7 @@ PNG format profile that synchronously inspects chunk and header metadata and emi
380
380
  <!-- class:CjsRedFormat -->
381
381
  ## `CjsRedFormat`
382
382
 
383
- Red format profile that reads type-discriminated, self-referential Red YAML object graphs and emits a compact public payload, a neutral raw graph, or caller-supplied runtime classes through the core-types hydration adapter.
383
+ Red format profile that reads type-discriminated, self-referential Red YAML object graphs and emits a compact public payload, a neutral raw graph, or caller-supplied runtime classes through the runtime-utils hydration adapter.
384
384
 
385
385
  - Export: `@carbonenginejs/runtime-resource/formats/red`
386
386
  - Source: `src/formats/red/CjsRedFormat.js`