@carbonenginejs/runtime 0.1.0-alpha.4 → 0.1.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/dist/global/blue/BlueClasses.js +200 -0
  2. package/dist/global/blue/BlueClasses.js.map +1 -0
  3. package/dist/global/blue/IBlueClasses.js +79 -0
  4. package/dist/global/blue/IBlueClasses.js.map +1 -0
  5. package/dist/global/blue/IBlueDynamicResourceConstructor.js +16 -0
  6. package/dist/global/blue/IBlueDynamicResourceConstructor.js.map +1 -1
  7. package/dist/global/blue/blue.js +8 -2
  8. package/dist/global/blue/blue.js.map +1 -1
  9. package/dist/global/blue/index.js +2 -0
  10. package/dist/global/blue/index.js.map +1 -1
  11. package/dist/global/consts/index.js +0 -1
  12. package/dist/global/consts/index.js.map +1 -1
  13. package/dist/global/consts/renderContext/formats.js +26 -25
  14. package/dist/global/consts/renderContext/formats.js.map +1 -1
  15. package/dist/{trinityal/Tr2BitmapDimensions.js → global/imageio/BitmapDimensions.js} +19 -15
  16. package/dist/global/imageio/BitmapDimensions.js.map +1 -0
  17. package/dist/global/imageio/Cutout.js +28 -0
  18. package/dist/global/imageio/Cutout.js.map +1 -0
  19. package/dist/global/imageio/HostBitmap.js +1106 -0
  20. package/dist/global/imageio/HostBitmap.js.map +1 -0
  21. package/dist/global/imageio/ImageIOResult.js +99 -0
  22. package/dist/global/imageio/ImageIOResult.js.map +1 -0
  23. package/dist/global/imageio/ImageUtility.js +205 -0
  24. package/dist/global/imageio/ImageUtility.js.map +1 -0
  25. package/dist/global/imageio/LoadParameters.js +86 -0
  26. package/dist/global/imageio/LoadParameters.js.map +1 -0
  27. package/dist/global/imageio/Metadata.js +22 -0
  28. package/dist/global/imageio/Metadata.js.map +1 -0
  29. package/dist/global/imageio/index.js +8 -0
  30. package/dist/global/{consts/webgpu → imageio}/index.js.map +1 -1
  31. package/dist/global/index.js +2 -1
  32. package/dist/global/index.js.map +1 -1
  33. package/dist/global/math/color.js +1 -1
  34. package/dist/global/math/color.js.map +1 -1
  35. package/dist/global/schema/CjsSchema.js +8 -0
  36. package/dist/global/schema/CjsSchema.js.map +1 -1
  37. package/dist/index.js +12 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/resource/CjsResMan.js +47 -7
  40. package/dist/resource/CjsResMan.js.map +1 -1
  41. package/dist/resource/Tr2LightProfileRes.js +37 -0
  42. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  43. package/dist/resource/format/CjsByteWriter.js +46 -46
  44. package/dist/resource/format/CjsByteWriter.js.map +1 -1
  45. package/dist/resource/format/CjsFormat.js +7 -8
  46. package/dist/resource/format/CjsFormat.js.map +1 -1
  47. package/dist/resource/format/CjsFormatStore.js +8 -8
  48. package/dist/resource/format/CjsFormatStore.js.map +1 -1
  49. package/dist/resource/format/CjsGeometryFormat.js +114 -0
  50. package/dist/resource/format/CjsGeometryFormat.js.map +1 -0
  51. package/dist/resource/format/CjsImageFormat.js +282 -0
  52. package/dist/resource/format/CjsImageFormat.js.map +1 -0
  53. package/dist/resource/format/CjsResourceProbe.js +12 -48
  54. package/dist/resource/format/CjsResourceProbe.js.map +1 -1
  55. package/dist/resource/format/CjsStringTable.js +37 -37
  56. package/dist/resource/format/CjsStringTable.js.map +1 -1
  57. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js +10 -10
  58. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
  59. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js +37 -37
  60. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -1
  61. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +35 -7
  62. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  63. package/dist/resource/format/index.js +3 -1
  64. package/dist/resource/format/index.js.map +1 -1
  65. package/dist/resource/formats/black/CjsBlackFormat.js +130 -137
  66. package/dist/resource/formats/black/CjsBlackFormat.js.map +1 -1
  67. package/dist/resource/formats/bnk/CjsBnkFormat.js +12 -19
  68. package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
  69. package/dist/resource/formats/bnk/core/helpers.js +1 -3
  70. package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
  71. package/dist/resource/formats/cmf/CjsCmfFormat.js +19 -82
  72. package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
  73. package/dist/resource/formats/cmf/core/constants.js +1 -2
  74. package/dist/resource/formats/cmf/core/constants.js.map +1 -1
  75. package/dist/resource/formats/{stl/core/targets.js → cmf/core/flatShared.js} +9 -8
  76. package/dist/resource/formats/cmf/core/flatShared.js.map +1 -0
  77. package/dist/resource/formats/cmf/core/helpers.js +13 -13
  78. package/dist/resource/formats/cmf/core/helpers.js.map +1 -1
  79. package/dist/resource/formats/cmf/core/writer.js +24 -24
  80. package/dist/resource/formats/cmf/core/writer.js.map +1 -1
  81. package/dist/resource/formats/dds/CjsDdsFormat.js +134 -17
  82. package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
  83. package/dist/resource/formats/dds/core/helpers.js +125 -40
  84. package/dist/resource/formats/dds/core/helpers.js.map +1 -1
  85. package/dist/resource/formats/dxbc/CjsDxbcFormat.js +14 -16
  86. package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  87. package/dist/resource/formats/dxbc/core/{container.js → DxbcContainer.js} +2 -2
  88. package/dist/resource/formats/dxbc/core/DxbcContainer.js.map +1 -0
  89. package/dist/resource/formats/dxbc/core/{errors.js → DxbcReadError.js} +1 -1
  90. package/dist/resource/formats/dxbc/core/DxbcReadError.js.map +1 -0
  91. package/dist/resource/formats/dxbc/core/DxbcReader.js +1 -1
  92. package/dist/resource/formats/dxbc/core/DxbcReader.js.map +1 -1
  93. package/dist/resource/formats/dxbc/core/{program.js → DxbcShaderProgram.js} +2 -2
  94. package/dist/resource/formats/dxbc/core/DxbcShaderProgram.js.map +1 -0
  95. package/dist/resource/formats/dxbc/core/{signature.js → DxbcSignatureChunk.js} +2 -2
  96. package/dist/resource/formats/dxbc/core/DxbcSignatureChunk.js.map +1 -0
  97. package/dist/resource/formats/dxbc/core/decoder.js +2 -2
  98. package/dist/resource/formats/dxbc/core/decoder.js.map +1 -1
  99. package/dist/resource/formats/dxbc/core/helpers.js +3 -3
  100. package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
  101. package/dist/resource/formats/fbx/CjsFbxFormat.js +18 -20
  102. package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
  103. package/dist/resource/formats/flac/CjsFlacFormat.js +7 -13
  104. package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
  105. package/dist/resource/formats/fsd/32/CjsFsd32Format.js +29 -29
  106. package/dist/resource/formats/fsd/32/CjsFsd32Format.js.map +1 -1
  107. package/dist/resource/formats/fsd/64/CjsFsd64Format.js +3 -3
  108. package/dist/resource/formats/fsd/64/CjsFsd64Format.js.map +1 -1
  109. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js +23 -23
  110. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -1
  111. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js +8 -8
  112. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -1
  113. package/dist/resource/formats/fsd/CjsFsdFormat.js +23 -23
  114. package/dist/resource/formats/fsd/CjsFsdFormat.js.map +1 -1
  115. package/dist/resource/formats/gif/CjsGifFormat.js +24 -15
  116. package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
  117. package/dist/resource/formats/gltf/CjsGltfFormat.js +33 -98
  118. package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
  119. package/dist/resource/formats/gltf/core/helpers.js +3 -12
  120. package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
  121. package/dist/resource/formats/gr2/CjsGr2Format.js +27 -91
  122. package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
  123. package/dist/resource/formats/hlsl/CjsHlslFormat.js +22 -25
  124. package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
  125. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js +1 -1
  126. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
  127. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +3 -3
  128. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -1
  129. package/dist/resource/formats/ies/CjsIESFormat.js +29 -29
  130. package/dist/resource/formats/ies/CjsIESFormat.js.map +1 -1
  131. package/dist/resource/formats/jpeg/CjsJpegFormat.js +24 -15
  132. package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
  133. package/dist/resource/formats/jpeg/core/helpers.js +3 -5
  134. package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
  135. package/dist/resource/formats/jpeg/core/jpeg.js +58 -58
  136. package/dist/resource/formats/jpeg/core/jpeg.js.map +1 -1
  137. package/dist/resource/formats/jsonl/CjsJsonlFormat.js +3 -3
  138. package/dist/resource/formats/jsonl/CjsJsonlFormat.js.map +1 -1
  139. package/dist/resource/formats/mp3/CjsMp3Format.js +7 -14
  140. package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
  141. package/dist/resource/formats/mp3/core/helpers.js +3 -5
  142. package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
  143. package/dist/resource/formats/mp4/CjsMp4Format.js +7 -13
  144. package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
  145. package/dist/resource/formats/mp4/core/helpers.js +3 -5
  146. package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
  147. package/dist/resource/formats/obj/CjsObjFormat.js +92 -157
  148. package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
  149. package/dist/resource/formats/obj/core/helpers.js +5 -113
  150. package/dist/resource/formats/obj/core/helpers.js.map +1 -1
  151. package/dist/resource/formats/ogg/CjsOggFormat.js +7 -14
  152. package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
  153. package/dist/resource/formats/pickle/CjsPickleFormat.js +7 -12
  154. package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
  155. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js +7 -7
  156. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -1
  157. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js +7 -7
  158. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js.map +1 -1
  159. package/dist/resource/formats/png/CjsPngFormat.js +40 -15
  160. package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
  161. package/dist/resource/formats/png/core/helpers.js +4 -6
  162. package/dist/resource/formats/png/core/helpers.js.map +1 -1
  163. package/dist/resource/formats/red/CjsRedFormat.js +22 -28
  164. package/dist/resource/formats/red/CjsRedFormat.js.map +1 -1
  165. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js +3 -7
  166. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
  167. package/dist/resource/formats/schemabound/core/schemaBoundValues.js +5 -0
  168. package/dist/resource/formats/schemabound/core/schemaBoundValues.js.map +1 -1
  169. package/dist/resource/formats/sqlite/CjsSqliteFormat.js +4 -9
  170. package/dist/resource/formats/sqlite/CjsSqliteFormat.js.map +1 -1
  171. package/dist/resource/formats/static/CjsStaticFormat.js +4 -4
  172. package/dist/resource/formats/static/CjsStaticFormat.js.map +1 -1
  173. package/dist/resource/formats/stl/CjsStlFormat.js +39 -104
  174. package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
  175. package/dist/resource/formats/stl/core/helpers.js +5 -19
  176. package/dist/resource/formats/stl/core/helpers.js.map +1 -1
  177. package/dist/resource/formats/tga/CjsTgaFormat.js +26 -15
  178. package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
  179. package/dist/resource/formats/tga/core/helpers.js +3 -5
  180. package/dist/resource/formats/tga/core/helpers.js.map +1 -1
  181. package/dist/resource/formats/vta/CjsVtaFormat.js +8 -15
  182. package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
  183. package/dist/resource/formats/wav/CjsWavFormat.js +7 -14
  184. package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
  185. package/dist/resource/formats/wav/core/helpers.js +3 -5
  186. package/dist/resource/formats/wav/core/helpers.js.map +1 -1
  187. package/dist/resource/formats/webgl/CjsWebglFormat.js +103 -105
  188. package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
  189. package/dist/resource/formats/webgl/core/{errors.js → WebglReadError.js} +1 -1
  190. package/dist/resource/formats/webgl/core/WebglReadError.js.map +1 -0
  191. package/dist/resource/formats/webgl/core/effectPackage.js +1 -1
  192. package/dist/resource/formats/webgl/core/effectPackage.js.map +1 -1
  193. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +3 -3
  194. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  195. package/dist/resource/formats/webgl/core/glsl/{DxbcGlslHelpers.js → DxbcGlslHelperRegistry.js} +2 -2
  196. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelperRegistry.js.map +1 -0
  197. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +1 -1
  198. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  199. package/dist/resource/formats/webgl/core/glslBackendBlock.js +1 -1
  200. package/dist/resource/formats/webgl/core/glslBackendBlock.js.map +1 -1
  201. package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
  202. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +28 -29
  203. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  204. package/dist/resource/formats/webgpu/core/{errors.js → WebgpuReadError.js} +1 -1
  205. package/dist/resource/formats/webgpu/core/WebgpuReadError.js.map +1 -0
  206. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js +1 -1
  207. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -1
  208. package/dist/resource/formats/webgpu/core/helpers.js +1 -1
  209. package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
  210. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js +1 -1
  211. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -1
  212. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js +18 -6
  213. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  214. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +39 -13
  215. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
  216. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +16 -14
  217. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -1
  218. package/dist/resource/formats/webm/CjsWebmFormat.js +8 -13
  219. package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
  220. package/dist/resource/formats/webm/core/helpers.js +3 -5
  221. package/dist/resource/formats/webm/core/helpers.js.map +1 -1
  222. package/dist/resource/formats/webp/CjsWebpFormat.js +8 -12
  223. package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
  224. package/dist/resource/formats/wem/CjsWemFormat.js +9 -17
  225. package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
  226. package/dist/resource/formats/wem/core/bitStream.js +35 -35
  227. package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
  228. package/dist/resource/formats/wem/core/helpers.js +1 -3
  229. package/dist/resource/formats/wem/core/helpers.js.map +1 -1
  230. package/dist/resource/formats/yaml/CjsYamlFormat.js +28 -37
  231. package/dist/resource/formats/yaml/CjsYamlFormat.js.map +1 -1
  232. package/dist/resource/imageio/ImageIO.js +142 -0
  233. package/dist/resource/imageio/ImageIO.js.map +1 -0
  234. package/dist/resource/imageio/index.js +17 -0
  235. package/dist/resource/imageio/index.js.map +1 -0
  236. package/dist/resource/index.js +7 -0
  237. package/dist/resource/index.js.map +1 -1
  238. package/dist/resource/shader/reflection/Tr2EffectResource.js +24 -2
  239. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  240. package/dist/resource/shader/reflection/Tr2Pass.js +76 -5
  241. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  242. package/dist/resource/texture/CjsTextureArrayConstructor.js +97 -0
  243. package/dist/resource/texture/CjsTextureArrayConstructor.js.map +1 -0
  244. package/dist/resource/texture/CjsTexturePackConstructor.js +160 -0
  245. package/dist/resource/texture/CjsTexturePackConstructor.js.map +1 -0
  246. package/dist/resource/texture/CjsTexturePipelineStepArray.js +72 -0
  247. package/dist/resource/texture/CjsTexturePipelineStepArray.js.map +1 -0
  248. package/dist/resource/texture/CjsTexturePipelineStepConvert.js +73 -0
  249. package/dist/resource/texture/CjsTexturePipelineStepConvert.js.map +1 -0
  250. package/dist/resource/texture/CjsTexturePipelineStepPack.js +71 -0
  251. package/dist/resource/texture/CjsTexturePipelineStepPack.js.map +1 -0
  252. package/dist/resource/texture/CjsTexturePipelineStepResize.js +123 -0
  253. package/dist/resource/texture/CjsTexturePipelineStepResize.js.map +1 -0
  254. package/dist/resource/texture/SolidColorTextureConstructor.js +11 -1
  255. package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -1
  256. package/dist/resource/texture/Tr2ImageRes.js +100 -68
  257. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  258. package/dist/resource/texture/Tr2TexturePipeline.js +45 -25
  259. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
  260. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +34 -1
  261. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
  262. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +30 -3
  263. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
  264. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +81 -1
  265. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
  266. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +36 -1
  267. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
  268. package/dist/resource/texture/Tr2TexturePipelineStepPack.js +146 -24
  269. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
  270. package/dist/resource/texture/TriTextureRes.js +151 -29
  271. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  272. package/dist/resource/texture/index.js +7 -0
  273. package/dist/resource/texture/index.js.map +1 -1
  274. package/dist/resource/texture/registerTextureResources.js +83 -0
  275. package/dist/resource/texture/registerTextureResources.js.map +1 -0
  276. package/dist/resource/texture/solidColorTexture.js +10 -19
  277. package/dist/resource/texture/solidColorTexture.js.map +1 -1
  278. package/dist/sof/EveSOF.js +39 -7
  279. package/dist/sof/EveSOF.js.map +1 -1
  280. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js +2 -2
  281. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -1
  282. package/dist/trinity/core/Tr2ImageIOHelpers.js +80 -17
  283. package/dist/trinity/core/Tr2ImageIOHelpers.js.map +1 -1
  284. package/dist/trinity/core/Tr2RenderUtils.js +1 -1
  285. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js +49 -62
  286. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -1
  287. package/dist/trinity/core/Tr2TextureReference.js +114 -0
  288. package/dist/trinity/core/Tr2TextureReference.js.map +1 -0
  289. package/dist/trinity/core/device/Tr2DepthStencil.js +2 -2
  290. package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
  291. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js +1 -1
  292. package/dist/trinity/core/index.js +1 -0
  293. package/dist/trinity/core/index.js.map +1 -1
  294. package/dist/trinity/core/lighting/Tr2LightManager.js +5 -4
  295. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  296. package/dist/trinity/core/procedural/GradientTextureConstructor.js +5 -4
  297. package/dist/trinity/core/procedural/GradientTextureConstructor.js.map +1 -1
  298. package/dist/trinity/core/procedural/gradientTexture.js +10 -13
  299. package/dist/trinity/core/procedural/gradientTexture.js.map +1 -1
  300. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +1 -1
  301. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
  302. package/dist/trinity/eve/EveImpactOverlay.js +102 -50
  303. package/dist/trinity/eve/EveImpactOverlay.js.map +1 -1
  304. package/dist/trinity/eve/EveModularObjectModifier.js +9 -18
  305. package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
  306. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +175 -157
  307. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
  308. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js +100 -83
  309. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js.map +1 -1
  310. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +26 -20
  311. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -1
  312. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js +368 -179
  313. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -1
  314. package/dist/trinity/eve/child/EveChildMesh.js +242 -234
  315. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  316. package/dist/trinity/eve/child/EveChildTurret.js +57 -16
  317. package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
  318. package/dist/trinity/eve/child/EveSpaceObjectChild.js +28 -1
  319. package/dist/trinity/eve/child/EveSpaceObjectChild.js.map +1 -1
  320. package/dist/trinity/eve/index.js +2 -2
  321. package/dist/trinity/eve/overlays/EveDamageOverlay.js +5 -1
  322. package/dist/trinity/eve/overlays/EveDamageOverlay.js.map +1 -1
  323. package/dist/trinity/eve/scene/EveSpaceScene.js +234 -233
  324. package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
  325. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +2 -0
  326. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
  327. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +492 -437
  328. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  329. package/dist/trinity/generated/index.js +0 -1
  330. package/dist/trinity/generated/index.js.map +1 -1
  331. package/dist/trinity/generated/trinityCore/index.js +0 -1
  332. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  333. package/dist/trinity/index.js +3 -3
  334. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +10 -1
  335. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
  336. package/dist/trinity/shader/Tr2DataTextureManager.js +152 -66
  337. package/dist/trinity/shader/Tr2DataTextureManager.js.map +1 -1
  338. package/dist/trinity/shader/Tr2Material.js +1 -1
  339. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js +5 -5
  340. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -1
  341. package/dist/trinityal/index.js +1 -1
  342. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js +2 -2
  343. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -1
  344. package/dist/trinityal/stub/Tr2SwapChainALStub.js +45 -45
  345. package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
  346. package/dist/trinityal/stub/Tr2TextureALStub.js +170 -170
  347. package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
  348. package/dist/trinityal/webgpu/CjsWebgpuDevice.js +234 -164
  349. package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
  350. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +7 -0
  351. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  352. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +78 -14
  353. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  354. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +94 -0
  355. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -0
  356. package/dist/trinityal/webgpu/internal.js +1 -0
  357. package/dist/trinityal/webgpu/internal.js.map +1 -1
  358. package/docs/global/reference/classes/README.md +90 -0
  359. package/docs/resource/concepts/format-capabilities.md +3 -3
  360. package/docs/resource/formats/README.md +1 -1
  361. package/docs/resource/reference/classes/core.md +31 -1
  362. package/docs/resource/reference/classes/formats.md +7 -7
  363. package/docs/resource/reference/classes/resources.md +76 -16
  364. package/docs/trinity/reference/classes/generated.md +0 -10
  365. package/docs/trinity/reference/classes/trinity-core.md +1692 -1682
  366. package/docs/trinityal/reference/classes/README.md +0 -10
  367. package/docs/trinityal/webgpu/reference/classes/README.md +276 -266
  368. package/package.json +4 -3
  369. package/dist/global/consts/webgpu/index.js +0 -2
  370. package/dist/global/consts/webgpu/textureFormats.js +0 -180
  371. package/dist/global/consts/webgpu/textureFormats.js.map +0 -1
  372. package/dist/resource/formats/dxbc/core/container.js.map +0 -1
  373. package/dist/resource/formats/dxbc/core/errors.js.map +0 -1
  374. package/dist/resource/formats/dxbc/core/program.js.map +0 -1
  375. package/dist/resource/formats/dxbc/core/signature.js.map +0 -1
  376. package/dist/resource/formats/stl/core/targets.js.map +0 -1
  377. package/dist/resource/formats/webgl/core/errors.js.map +0 -1
  378. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +0 -1
  379. package/dist/resource/formats/webgpu/core/errors.js.map +0 -1
  380. package/dist/resource/texture/texturePipelineBehavior.js +0 -332
  381. package/dist/resource/texture/texturePipelineBehavior.js.map +0 -1
  382. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js +0 -40
  383. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js.map +0 -1
  384. package/dist/trinityal/Tr2BitmapDimensions.js.map +0 -1
@@ -1,201 +1,144 @@
1
1
  import { CjsFormat } from '../../format/CjsFormat.js';
2
- import { DEFAULT_VALUES, normalizeValues, validateClassKey, validateClass, readWithValues, inspectWithValues, toText, OUTPUT_CMF, OUTPUT_GR2, OUTPUT_SHARED, OUTPUT_OBJ_JSON, OUTPUT_JSON, CLASS_KEYS } from './core/helpers.js';
2
+ import { CjsGeometryFormat } from '../../format/CjsGeometryFormat.js';
3
+ import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, toText, CLASS_KEYS } from './core/helpers.js';
3
4
  import { toJsonWithArrayValues } from '../../format/jsonPolicies.js';
4
5
 
5
6
  const FORMAT_NAME = "CjsObjFormat";
6
7
 
7
- /**
8
- * CarbonEngineJS-facing Wavefront OBJ format surface.
9
- *
10
- * The Cjs prefix marks this as a JavaScript format/construction boundary.
11
- * OBJ is the current import source; the public read contract is the shared
12
- * CarbonEngineJS JSON mesh schema.
8
+ /**
9
+ * CarbonEngineJS-facing Wavefront OBJ format surface.
10
+ *
11
+ * The Cjs prefix marks this as a JavaScript format/construction boundary.
12
+ * OBJ is the current import source; the public read contract is the shared
13
+ * CarbonEngineJS JSON mesh schema.
13
14
  */
14
- class CjsObjFormat extends CjsFormat {
15
- #emit = DEFAULT_VALUES.emit;
16
- #source = DEFAULT_VALUES.source;
17
- #packTangents = DEFAULT_VALUES.packTangents;
18
- #uvHandedness = DEFAULT_VALUES.uvHandedness;
19
- #rebuildMissingNormals = DEFAULT_VALUES.rebuildMissingNormals;
20
- #rebuildMissingTangents = DEFAULT_VALUES.rebuildMissingTangents;
21
- #rebuildMissingBiNormals = DEFAULT_VALUES.rebuildMissingBiNormals;
22
- #classes = DEFAULT_VALUES.classes;
23
-
24
- /**
25
- * Create a reusable format profile.
26
- *
27
- * @param {object} [options] Default format values.
15
+ class CjsObjFormat extends CjsGeometryFormat {
16
+ _emit = DEFAULT_VALUES.emit;
17
+ _source = DEFAULT_VALUES.source;
18
+ _packTangents = DEFAULT_VALUES.packTangents;
19
+ _uvHandedness = DEFAULT_VALUES.uvHandedness;
20
+ _rebuildMissingNormals = DEFAULT_VALUES.rebuildMissingNormals;
21
+ _rebuildMissingTangents = DEFAULT_VALUES.rebuildMissingTangents;
22
+ _rebuildMissingBiNormals = DEFAULT_VALUES.rebuildMissingBiNormals;
23
+ _classes = DEFAULT_VALUES.classes;
24
+
25
+ /**
26
+ * Create a reusable format profile.
27
+ *
28
+ * @param {object} [options] Default format values.
28
29
  */
29
30
  constructor(options = {}) {
30
31
  super();
31
32
  this.SetValues(options);
32
33
  }
33
34
 
34
- /**
35
- * Set format values for this reusable profile.
36
- *
37
- * @param {object} [options] Values to merge into the profile.
38
- * @returns {CjsObjFormat} This format profile.
35
+ /**
36
+ * Set format values for this reusable profile.
37
+ *
38
+ * @param {object} [options] Values to merge into the profile.
39
+ * @returns {CjsObjFormat} This format profile.
39
40
  */
40
41
  SetValues(options = {}) {
41
42
  const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);
42
- this.#emit = values.emit;
43
- this.#source = values.source;
44
- this.#packTangents = values.packTangents;
45
- this.#uvHandedness = values.uvHandedness;
46
- this.#rebuildMissingNormals = values.rebuildMissingNormals;
47
- this.#rebuildMissingTangents = values.rebuildMissingTangents;
48
- this.#rebuildMissingBiNormals = values.rebuildMissingBiNormals;
49
- this.#classes = values.classes;
43
+ this._emit = values.emit;
44
+ this._source = values.source;
45
+ this._packTangents = values.packTangents;
46
+ this._uvHandedness = values.uvHandedness;
47
+ this._rebuildMissingNormals = values.rebuildMissingNormals;
48
+ this._rebuildMissingTangents = values.rebuildMissingTangents;
49
+ this._rebuildMissingBiNormals = values.rebuildMissingBiNormals;
50
+ this._classes = values.classes;
50
51
  return this;
51
52
  }
52
53
 
53
- /**
54
- * Get this profile's current values, optionally with per-call overrides.
55
- *
56
- * @param {object} [options] Optional values to merge into a copy.
57
- * @returns {object} A copy of the effective values.
54
+ /**
55
+ * Get this profile's current values, optionally with per-call overrides.
56
+ *
57
+ * @param {object} [options] Optional values to merge into a copy.
58
+ * @returns {object} A copy of the effective values.
58
59
  */
59
60
  GetValues(options = {}) {
60
61
  return normalizeValues({
61
- emit: this.#emit,
62
- source: this.#source,
63
- packTangents: this.#packTangents,
64
- uvHandedness: this.#uvHandedness,
65
- rebuildMissingNormals: this.#rebuildMissingNormals,
66
- rebuildMissingTangents: this.#rebuildMissingTangents,
67
- rebuildMissingBiNormals: this.#rebuildMissingBiNormals,
68
- classes: this.#classes
62
+ emit: this._emit,
63
+ source: this._source,
64
+ packTangents: this._packTangents,
65
+ uvHandedness: this._uvHandedness,
66
+ rebuildMissingNormals: this._rebuildMissingNormals,
67
+ rebuildMissingTangents: this._rebuildMissingTangents,
68
+ rebuildMissingBiNormals: this._rebuildMissingBiNormals,
69
+ classes: this._classes
69
70
  }, options, FORMAT_NAME);
70
71
  }
71
72
 
72
- /**
73
- * Set multiple node-class constructors for this profile.
74
- *
75
- * @param {object} [classes] Map of node class keys to constructors.
76
- * @returns {CjsObjFormat} This format profile.
77
- */
78
- SetClasses(classes = {}) {
79
- return this.SetValues({
80
- classes
81
- });
82
- }
83
-
84
- /**
85
- * Set one node-class constructor for this profile.
86
- *
87
- * @param {string} type Node class key.
88
- * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.
89
- * @returns {CjsObjFormat} This format profile.
90
- */
91
- SetClass(type, Class) {
92
- if (Class === null || Class === undefined) {
93
- validateClassKey(type, FORMAT_NAME);
94
- const classes = {
95
- ...this.#classes
96
- };
97
- delete classes[type];
98
- this.#classes = classes;
99
- return this;
100
- }
101
- validateClass(type, Class, FORMAT_NAME);
102
- return this.SetValues({
103
- classes: {
104
- [type]: Class
105
- }
106
- });
107
- }
108
-
109
- /**
110
- * Get a configured node-class constructor.
111
- *
112
- * @param {string} type Node class key.
113
- * @returns {Function|undefined} The registered constructor, if any.
114
- */
115
- GetClass(type) {
116
- validateClassKey(type, FORMAT_NAME);
117
- return this.#classes[type];
118
- }
119
-
120
- /**
121
- * Whether this format profile has a constructor registered for a node class key.
122
- *
123
- * @param {string} type Node class key.
124
- * @returns {boolean} True when a constructor is registered.
125
- */
126
- HasClass(type) {
127
- return !!this.GetClass(type);
128
- }
129
-
130
- /**
131
- * Read OBJ text with this profile's values.
132
- *
133
- * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
134
- * @param {object} [options] Per-call value overrides.
135
- * @returns {object} The shared CarbonEngineJS JSON mesh schema.
73
+ /**
74
+ * Read OBJ text with this profile's values.
75
+ *
76
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
77
+ * @param {object} [options] Per-call value overrides.
78
+ * @returns {object} The shared CarbonEngineJS JSON mesh schema.
136
79
  */
137
80
  Read(input, options = {}) {
138
81
  return readWithValues(this, input, this.GetValues(options), FORMAT_NAME);
139
82
  }
140
83
 
141
- /**
142
- * Inspect OBJ text without hydrating classes.
143
- *
144
- * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
145
- * @param {object} [options] Per-call value overrides.
146
- * @returns {object} Plain summary data.
84
+ /**
85
+ * Inspect OBJ text without hydrating classes.
86
+ *
87
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
88
+ * @param {object} [options] Per-call value overrides.
89
+ * @returns {object} Plain summary data.
147
90
  */
148
91
  Inspect(input, options = {}) {
149
92
  return inspectWithValues(input, this.GetValues(options));
150
93
  }
151
94
 
152
- /**
153
- * Convert format output to JSON-compatible data.
154
- *
155
- * @param {any} value Format output to convert.
156
- * @returns {any} Plain JSON-compatible data.
95
+ /**
96
+ * Convert format output to JSON-compatible data.
97
+ *
98
+ * @param {any} value Format output to convert.
99
+ * @returns {any} Plain JSON-compatible data.
157
100
  */
158
101
  ToJSON(value) {
159
102
  return toJsonWithArrayValues(value);
160
103
  }
161
104
 
162
- /**
163
- * Static one-shot read. Static methods use camelCase by convention.
164
- *
165
- * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
166
- * @param {object} [options] Format values.
167
- * @returns {object} The shared CarbonEngineJS JSON mesh schema.
105
+ /**
106
+ * Static one-shot read. Static methods use camelCase by convention.
107
+ *
108
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
109
+ * @param {object} [options] Format values.
110
+ * @returns {object} The shared CarbonEngineJS JSON mesh schema.
168
111
  */
169
112
  static read(input, options = {}) {
170
113
  return readWithValues(CjsObjFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME), FORMAT_NAME);
171
114
  }
172
115
 
173
- /**
174
- * Static one-shot inspection.
175
- *
176
- * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
177
- * @param {object} [options] Format values.
178
- * @returns {object} Plain summary data.
116
+ /**
117
+ * Static one-shot inspection.
118
+ *
119
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.
120
+ * @param {object} [options] Format values.
121
+ * @returns {object} Plain summary data.
179
122
  */
180
123
  static inspect(input, options = {}) {
181
124
  return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
182
125
  }
183
126
 
184
- /**
185
- * Static JSON-compatible conversion.
186
- *
187
- * @param {any} value Format output to convert.
188
- * @returns {any} Plain JSON-compatible data.
127
+ /**
128
+ * Static JSON-compatible conversion.
129
+ *
130
+ * @param {any} value Format output to convert.
131
+ * @returns {any} Plain JSON-compatible data.
189
132
  */
190
133
  static toJSON(value) {
191
134
  return toJsonWithArrayValues(value);
192
135
  }
193
136
 
194
- /**
195
- * Cheap text sniff for OBJ-like mesh data.
196
- *
197
- * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate OBJ text.
198
- * @returns {boolean} True when at least one vertex and face statement exist.
137
+ /**
138
+ * Cheap text sniff for OBJ-like mesh data.
139
+ *
140
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate OBJ text.
141
+ * @returns {boolean} True when at least one vertex and face statement exist.
199
142
  */
200
143
  static isObj(input) {
201
144
  try {
@@ -206,19 +149,11 @@ class CjsObjFormat extends CjsFormat {
206
149
  }
207
150
  }
208
151
 
209
- /**
210
- * Emit targets for this format (canonical frozen enum).
152
+ /**
153
+ * Emit targets for this format (canonical frozen enum).
211
154
  */
212
- static Output = Object.freeze({
213
- JSON: OUTPUT_JSON,
214
- OBJ_JSON: OUTPUT_OBJ_JSON,
215
- SHARED: OUTPUT_SHARED,
216
- GR2: OUTPUT_GR2,
217
- CMF: OUTPUT_CMF
218
- });
219
- static CLASS_KEYS = CLASS_KEYS;
220
- static id = "obj";
221
- static mediaTypes = Object.freeze(["geometry"]);
155
+ static classKeys = CLASS_KEYS;
156
+ static id = "CjsObjFormat";
222
157
  static outputs = CjsFormat.defineOutputs({
223
158
  shared: {
224
159
  decoded: true
@@ -239,7 +174,7 @@ class CjsObjFormat extends CjsFormat {
239
174
  decoded: true
240
175
  }
241
176
  });
242
- static extensions = Object.freeze([".obj"]);
177
+ static extensions = [".obj"];
243
178
  }
244
179
 
245
180
  export { CjsObjFormat, CjsObjFormat as default };
@@ -1 +1 @@
1
- {"version":3,"file":"CjsObjFormat.js","sources":["../../../../../src/resource/formats/obj/CjsObjFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\r\n/**\r\n * Exposed CarbonEngineJS-facing OBJ format class.\r\n *\r\n * Keep this file small and reviewable: OBJ parsing, mesh rebuild helpers,\r\n * option normalization, and JSON hydration live under src/core.\r\n */\r\n\r\nimport {\r\n CLASS_KEYS,\r\n DEFAULT_VALUES,\r\n OUTPUT_CMF,\r\n OUTPUT_GR2,\r\n OUTPUT_JSON,\r\n OUTPUT_OBJ_JSON,\r\n OUTPUT_SHARED,\r\n inspectWithValues,\r\n normalizeValues,\r\n readWithValues,\r\n toJsonValue,\r\n toText,\r\n validateClass,\r\n validateClassKey\r\n} from \"./core/helpers.js\";\r\n\r\nconst FORMAT_NAME = \"CjsObjFormat\";\r\n\r\n/**\r\n * CarbonEngineJS-facing Wavefront OBJ format surface.\r\n *\r\n * The Cjs prefix marks this as a JavaScript format/construction boundary.\r\n * OBJ is the current import source; the public read contract is the shared\r\n * CarbonEngineJS JSON mesh schema.\r\n */\r\nexport class CjsObjFormat extends CjsFormat\r\n{\r\n\r\n #emit = DEFAULT_VALUES.emit;\r\n #source = DEFAULT_VALUES.source;\r\n #packTangents = DEFAULT_VALUES.packTangents;\r\n #uvHandedness = DEFAULT_VALUES.uvHandedness;\r\n #rebuildMissingNormals = DEFAULT_VALUES.rebuildMissingNormals;\r\n #rebuildMissingTangents = DEFAULT_VALUES.rebuildMissingTangents;\r\n #rebuildMissingBiNormals = DEFAULT_VALUES.rebuildMissingBiNormals;\r\n #classes = DEFAULT_VALUES.classes;\r\n\r\n /**\r\n * Create a reusable format profile.\r\n *\r\n * @param {object} [options] Default format values.\r\n */\r\n constructor(options = {})\r\n {\r\n super();\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Set format values for this reusable profile.\r\n *\r\n * @param {object} [options] Values to merge into the profile.\r\n * @returns {CjsObjFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\r\n\r\n this.#emit = values.emit;\r\n this.#source = values.source;\r\n this.#packTangents = values.packTangents;\r\n this.#uvHandedness = values.uvHandedness;\r\n this.#rebuildMissingNormals = values.rebuildMissingNormals;\r\n this.#rebuildMissingTangents = values.rebuildMissingTangents;\r\n this.#rebuildMissingBiNormals = values.rebuildMissingBiNormals;\r\n this.#classes = values.classes;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Get this profile's current values, optionally with per-call overrides.\r\n *\r\n * @param {object} [options] Optional values to merge into a copy.\r\n * @returns {object} A copy of the effective values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues({\r\n emit: this.#emit,\r\n source: this.#source,\r\n packTangents: this.#packTangents,\r\n uvHandedness: this.#uvHandedness,\r\n rebuildMissingNormals: this.#rebuildMissingNormals,\r\n rebuildMissingTangents: this.#rebuildMissingTangents,\r\n rebuildMissingBiNormals: this.#rebuildMissingBiNormals,\r\n classes: this.#classes\r\n }, options, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Set multiple node-class constructors for this profile.\r\n *\r\n * @param {object} [classes] Map of node class keys to constructors.\r\n * @returns {CjsObjFormat} This format profile.\r\n */\r\n SetClasses(classes = {})\r\n {\r\n return this.SetValues({ classes });\r\n }\r\n\r\n /**\r\n * Set one node-class constructor for this profile.\r\n *\r\n * @param {string} type Node class key.\r\n * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.\r\n * @returns {CjsObjFormat} This format profile.\r\n */\r\n SetClass(type, Class)\r\n {\r\n if (Class === null || Class === undefined)\r\n {\r\n validateClassKey(type, FORMAT_NAME);\r\n const classes = { ...this.#classes };\r\n delete classes[type];\r\n this.#classes = classes;\r\n return this;\r\n }\r\n\r\n validateClass(type, Class, FORMAT_NAME);\r\n return this.SetValues({ classes: { [type]: Class } });\r\n }\r\n\r\n /**\r\n * Get a configured node-class constructor.\r\n *\r\n * @param {string} type Node class key.\r\n * @returns {Function|undefined} The registered constructor, if any.\r\n */\r\n GetClass(type)\r\n {\r\n validateClassKey(type, FORMAT_NAME);\r\n return this.#classes[type];\r\n }\r\n\r\n /**\r\n * Whether this format profile has a constructor registered for a node class key.\r\n *\r\n * @param {string} type Node class key.\r\n * @returns {boolean} True when a constructor is registered.\r\n */\r\n HasClass(type)\r\n {\r\n return !!this.GetClass(type);\r\n }\r\n\r\n /**\r\n * Read OBJ text with this profile's values.\r\n *\r\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readWithValues(this, input, this.GetValues(options), FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Inspect OBJ text without hydrating classes.\r\n *\r\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Plain summary data.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, this.GetValues(options), FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Convert format output to JSON-compatible data.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Static one-shot read. Static methods use camelCase by convention.\r\n *\r\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readWithValues(CjsObjFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME), FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Static one-shot inspection.\r\n *\r\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Plain summary data.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME), FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Static JSON-compatible conversion.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Cheap text sniff for OBJ-like mesh data.\r\n *\r\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate OBJ text.\r\n * @returns {boolean} True when at least one vertex and face statement exist.\r\n */\r\n static isObj(input)\r\n {\r\n try\r\n {\r\n const text = toText(input);\r\n return /^v\\s+/m.test(text) && /^f\\s+/m.test(text);\r\n }\r\n catch\r\n {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Emit targets for this format (canonical frozen enum).\r\n */\r\n static Output = Object.freeze({\r\n JSON: OUTPUT_JSON,\r\n OBJ_JSON: OUTPUT_OBJ_JSON,\r\n SHARED: OUTPUT_SHARED,\r\n GR2: OUTPUT_GR2,\r\n CMF: OUTPUT_CMF\r\n });\r\n static CLASS_KEYS = CLASS_KEYS;\r\n static id = \"obj\";\r\n static mediaTypes = Object.freeze([ \"geometry\" ]);\r\n static outputs = CjsFormat.defineOutputs({\r\n shared: { decoded: true },\r\n gr2: { decoded: true },\r\n cmf: { decoded: true },\r\n json: { role: \"debug\", decoded: true },\r\n objJson: { role: \"debug\", default: true, decoded: true }\r\n });\r\n static extensions = Object.freeze([ \".obj\" ]);\r\n\r\n}\r\n\r\nexport default CjsObjFormat;\r\n"],"names":["FORMAT_NAME","CjsObjFormat","CjsFormat","DEFAULT_VALUES","emit","source","packTangents","uvHandedness","rebuildMissingNormals","rebuildMissingTangents","rebuildMissingBiNormals","classes","constructor","options","SetValues","values","normalizeValues","GetValues","SetClasses","SetClass","type","Class","undefined","validateClassKey","validateClass","GetClass","HasClass","Read","input","readWithValues","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","inspect","toJSON","isObj","text","toText","test","Output","Object","freeze","JSON","OUTPUT_JSON","OBJ_JSON","OUTPUT_OBJ_JSON","SHARED","OUTPUT_SHARED","GR2","OUTPUT_GR2","CMF","OUTPUT_CMF","CLASS_KEYS","id","mediaTypes","outputs","defineOutputs","shared","decoded","gr2","cmf","json","role","objJson","default","extensions"],"mappings":";;;;AAyBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,SAASC,SA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AE;AAAEC,MAAAA,IAAI,EAAE,OAAO;AAAEJ,MAAAA,OAAO,EAAE;KAAM;AACtCK,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE,OAAO;AAAEE,MAAAA,OAAO,EAAE,IAAI;AAAEN,MAAAA,OAAO,EAAE;AAAK;AAC3D,GAAC,CAAC;EACF,OAAOO,UAAU,GAAGzB,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AAEjD;;;;"}
1
+ {"version":3,"file":"CjsObjFormat.js","sources":["../../../../../src/resource/formats/obj/CjsObjFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\nimport { CjsGeometryFormat } from \"../../format/CjsGeometryFormat.js\";\n/**\n * Exposed CarbonEngineJS-facing OBJ format class.\n *\n * Keep this file small and reviewable: OBJ parsing, mesh rebuild helpers,\n * option normalization, and JSON hydration live under src/core.\n */\n\nimport {\n CLASS_KEYS,\n DEFAULT_VALUES,\n OUTPUT_CMF,\n OUTPUT_GR2,\n OUTPUT_JSON,\n OUTPUT_OBJ_JSON,\n OUTPUT_SHARED,\n inspectWithValues,\n normalizeValues,\n readWithValues,\n toJsonValue,\n toText,\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsObjFormat\";\n\n/**\n * CarbonEngineJS-facing Wavefront OBJ format surface.\n *\n * The Cjs prefix marks this as a JavaScript format/construction boundary.\n * OBJ is the current import source; the public read contract is the shared\n * CarbonEngineJS JSON mesh schema.\n */\nexport class CjsObjFormat extends CjsGeometryFormat\n{\n\n _emit = DEFAULT_VALUES.emit;\n _source = DEFAULT_VALUES.source;\n _packTangents = DEFAULT_VALUES.packTangents;\n _uvHandedness = DEFAULT_VALUES.uvHandedness;\n _rebuildMissingNormals = DEFAULT_VALUES.rebuildMissingNormals;\n _rebuildMissingTangents = DEFAULT_VALUES.rebuildMissingTangents;\n _rebuildMissingBiNormals = DEFAULT_VALUES.rebuildMissingBiNormals;\n _classes = DEFAULT_VALUES.classes;\n\n /**\n * Create a reusable format profile.\n *\n * @param {object} [options] Default format values.\n */\n constructor(options = {})\n {\n super();\n this.SetValues(options);\n }\n\n /**\n * Set format values for this reusable profile.\n *\n * @param {object} [options] Values to merge into the profile.\n * @returns {CjsObjFormat} This format profile.\n */\n SetValues(options = {})\n {\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\n\n this._emit = values.emit;\n this._source = values.source;\n this._packTangents = values.packTangents;\n this._uvHandedness = values.uvHandedness;\n this._rebuildMissingNormals = values.rebuildMissingNormals;\n this._rebuildMissingTangents = values.rebuildMissingTangents;\n this._rebuildMissingBiNormals = values.rebuildMissingBiNormals;\n this._classes = values.classes;\n\n return this;\n }\n\n /**\n * Get this profile's current values, optionally with per-call overrides.\n *\n * @param {object} [options] Optional values to merge into a copy.\n * @returns {object} A copy of the effective values.\n */\n GetValues(options = {})\n {\n return normalizeValues({\n emit: this._emit,\n source: this._source,\n packTangents: this._packTangents,\n uvHandedness: this._uvHandedness,\n rebuildMissingNormals: this._rebuildMissingNormals,\n rebuildMissingTangents: this._rebuildMissingTangents,\n rebuildMissingBiNormals: this._rebuildMissingBiNormals,\n classes: this._classes\n }, options, FORMAT_NAME);\n }\n\n /**\n * Read OBJ text with this profile's values.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n Read(input, options = {})\n {\n return readWithValues(this, input, this.GetValues(options), FORMAT_NAME);\n }\n\n /**\n * Inspect OBJ text without hydrating classes.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain summary data.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), FORMAT_NAME);\n }\n\n /**\n * Convert format output to JSON-compatible data.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Static one-shot read. Static methods use camelCase by convention.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\n * @param {object} [options] Format values.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n static read(input, options = {})\n {\n return readWithValues(CjsObjFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME), FORMAT_NAME);\n }\n\n /**\n * Static one-shot inspection.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input OBJ text or UTF-8 bytes.\n * @param {object} [options] Format values.\n * @returns {object} Plain summary data.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME), FORMAT_NAME);\n }\n\n /**\n * Static JSON-compatible conversion.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Cheap text sniff for OBJ-like mesh data.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate OBJ text.\n * @returns {boolean} True when at least one vertex and face statement exist.\n */\n static isObj(input)\n {\n try\n {\n const text = toText(input);\n return /^v\\s+/m.test(text) && /^f\\s+/m.test(text);\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static classKeys = CLASS_KEYS;\n static id = \"CjsObjFormat\";\n static outputs = CjsFormat.defineOutputs({\n shared: { decoded: true },\n gr2: { decoded: true },\n cmf: { decoded: true },\n json: { role: \"debug\", decoded: true },\n objJson: { role: \"debug\", default: true, decoded: true }\n });\n static extensions = [ \".obj\" ];\n\n}\n\nexport default CjsObjFormat;\n"],"names":["FORMAT_NAME","CjsObjFormat","CjsGeometryFormat","_emit","DEFAULT_VALUES","emit","_source","source","_packTangents","packTangents","_uvHandedness","uvHandedness","_rebuildMissingNormals","rebuildMissingNormals","_rebuildMissingTangents","rebuildMissingTangents","_rebuildMissingBiNormals","rebuildMissingBiNormals","_classes","classes","constructor","options","SetValues","values","normalizeValues","GetValues","Read","input","readWithValues","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","inspect","toJSON","isObj","text","toText","test","classKeys","CLASS_KEYS","id","outputs","CjsFormat","defineOutputs","shared","decoded","gr2","cmf","json","role","objJson","default","extensions"],"mappings":";;;;;AAwBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,SAASC,iBAAiB,CACnD;EAEIC,KAAK,GAAGC,cAAc,CAACC,IAAI;EAC3BC,OAAO,GAAGF,cAAc,CAACG,MAAM;EAC/BC,aAAa,GAAGJ,cAAc,CAACK,YAAY;EAC3CC,aAAa,GAAGN,cAAc,CAACO,YAAY;EAC3CC,sBAAsB,GAAGR,cAAc,CAACS,qBAAqB;EAC7DC,uBAAuB,GAAGV,cAAc,CAACW,sBAAsB;EAC/DC,wBAAwB,GAAGZ,cAAc,CAACa,uBAAuB;EACjEC,QAAQ,GAAGd,cAAc,CAACe,OAAO;;AAEjC;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,MAAME,MAAM,GAAGC,eAAe,CAAC,IAAI,CAACC,SAAS,EAAE,EAAEJ,OAAO,EAAErB,WAAW,CAAC;AAEtE,IAAA,IAAI,CAACG,KAAK,GAAGoB,MAAM,CAAClB,IAAI;AACxB,IAAA,IAAI,CAACC,OAAO,GAAGiB,MAAM,CAAChB,MAAM;AAC5B,IAAA,IAAI,CAACC,aAAa,GAAGe,MAAM,CAACd,YAAY;AACxC,IAAA,IAAI,CAACC,aAAa,GAAGa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AE;KAAM;AACtBE,IAAAA,GAAG,EAAE;AAAEF,MAAAA,OAAO,EAAE;KAAM;AACtBG,IAAAA,IAAI,EAAE;AAAEC,MAAAA,IAAI,EAAE,OAAO;AAAEJ,MAAAA,OAAO,EAAE;KAAM;AACtCK,IAAAA,OAAO,EAAE;AAAED,MAAAA,IAAI,EAAE,OAAO;AAAEE,MAAAA,OAAO,EAAE,IAAI;AAAEN,MAAAA,OAAO,EAAE;AAAK;AAC3D,GAAC,CAAC;AACF,EAAA,OAAOO,UAAU,GAAG,CAAE,MAAM,CAAE;AAElC;;;;"}
@@ -1,11 +1,11 @@
1
+ import { CjsGeometryFormat } from '../../../format/CjsGeometryFormat.js';
1
2
  import { hydrateJson } from './json.js';
2
3
  import { parseObjText } from './parser.js';
3
4
  import { generateNormals, generateTangents, generateBiNormals } from '#math/mesh';
4
5
  import { packTangentFrames } from '#math/tangent';
5
6
  import { GR2_CLASS_KEYS, CMF_CLASS_KEYS } from '../../cmf/core/constants.js';
6
- import { firstTriangle, bytesPerIndex, totalIndexCount } from '../../cmf/core/utils/indices.js';
7
+ import { buildCmfFromFlatShared } from '../../cmf/core/flatShared.js';
7
8
  import { hydrateCmf } from '../../cmf/core/utils/hydration.js';
8
- import { estimateStrideFromDecl, elementTypeSize } from '../../cmf/core/utils/vertex.js';
9
9
 
10
10
  /**
11
11
  * Internal read-pipeline glue for CjsObjFormat.
@@ -29,18 +29,6 @@ const DEFAULT_VALUES = Object.freeze({
29
29
  });
30
30
  const OPTION_KEYS = new Set(["emit", "source", "packTangents", "uvHandedness", "rebuildMissingNormals", "rebuildMissingTangents", "rebuildMissingBiNormals", "classes"]);
31
31
 
32
- /**
33
- * Validate a `classes` node key against {@link CLASS_KEYS}.
34
- *
35
- * @param {string} key Candidate node key.
36
- * @param {string} [readerName] Format name used in thrown errors.
37
- */
38
- function validateClassKey(key, readerName = "CjsObjFormat") {
39
- if (!CLASS_KEYS.includes(key)) {
40
- throw new Error(`${readerName}: unknown class key ${JSON.stringify(key)}; expected one of ${CLASS_KEYS.join(", ")}`);
41
- }
42
- }
43
-
44
32
  /**
45
33
  * Validate a single `classes` entry.
46
34
  *
@@ -49,10 +37,7 @@ function validateClassKey(key, readerName = "CjsObjFormat") {
49
37
  * @param {string} [readerName] Format name used in thrown errors.
50
38
  */
51
39
  function validateClass(key, Class, readerName = "CjsObjFormat") {
52
- validateClassKey(key, readerName);
53
- if (typeof Class !== "function") {
54
- throw new TypeError(`${readerName}: class ${JSON.stringify(key)} must be a constructor`);
55
- }
40
+ CjsGeometryFormat.validateClass(key, Class, CLASS_KEYS, readerName);
56
41
  }
57
42
 
58
43
  /**
@@ -332,7 +317,7 @@ function readWithValues(format, input, values, readerName = "CjsObjFormat") {
332
317
  });
333
318
  rebuildMissingMeshData(format, json, values);
334
319
  if (values.emit === OUTPUT_CMF) {
335
- return hydrateCmf(buildCmfFromShared(json), values.classes, {
320
+ return hydrateCmf(buildCmfFromFlatShared(json), values.classes, {
336
321
  source: values.source
337
322
  }, "CjsObjFormat CMF");
338
323
  }
@@ -341,99 +326,6 @@ function readWithValues(format, input, values, readerName = "CjsObjFormat") {
341
326
  source: values.source
342
327
  });
343
328
  }
344
- function buildCmfFromShared(root) {
345
- return {
346
- version: 1,
347
- metadata: null,
348
- meshes: (root.meshes ?? []).map(mesh => buildCmfMesh(mesh)),
349
- skeletons: [],
350
- animations: []
351
- };
352
- }
353
- function buildCmfMesh(mesh) {
354
- const vertex = mesh.vertex ?? {},
355
- stride = estimateVertexStride(vertex),
356
- vertexCount = stride === 0 ? 0 : Math.floor((vertex.position ?? []).length / 3),
357
- indices = mesh.indices ?? [];
358
- return {
359
- name: mesh.name ?? "",
360
- decl: buildCmfDecl(vertex),
361
- lods: [{
362
- vb: {
363
- index: 1,
364
- offset: 0,
365
- size: vertexCount * stride,
366
- stride
367
- },
368
- ib: {
369
- index: 2,
370
- offset: 0,
371
- size: totalIndexCount(indices) * bytesPerIndex(indices),
372
- stride: bytesPerIndex(indices)
373
- },
374
- areas: indices.map((group, index) => ({
375
- firstElement: firstTriangle(indices, index),
376
- elementCount: Math.floor((group.faces ?? []).length / 3)
377
- })),
378
- morphTargets: [],
379
- threshold: 0xffffffff,
380
- vertex,
381
- indices
382
- }],
383
- areas: indices.map(group => ({
384
- name: group.name ?? "",
385
- bounds: cmfBounds(mesh),
386
- bones: [],
387
- affectedByBones: false,
388
- affectedByMorphTargets: false
389
- })),
390
- boneBindings: [],
391
- morphTargets: {
392
- decl: [],
393
- targets: []
394
- },
395
- uvDensities: [],
396
- bounds: cmfBounds(mesh),
397
- audioOcclusionMesh: {
398
- vertices: [],
399
- indices: [],
400
- bounds: {
401
- min: [0, 0, 0],
402
- max: [0, 0, 0]
403
- }
404
- },
405
- topology: "TriangleList",
406
- skeleton: null,
407
- vertex,
408
- indices
409
- };
410
- }
411
- function buildCmfDecl(vertex) {
412
- const decl = [];
413
- let offset = 0;
414
- for (const channel of [["position", "Position", 3], ["normal", "Normal", 3], ["tangent", "Tangent", 3], ["binormal", "Binormal", 3], ["texcoord0", "TexCoord", 2, 0], ["texcoord1", "TexCoord", 2, 1], ["color0", "Color", 4, 0], ["blendIndice", "BoneIndices", 4, 0, "UInt16"], ["blendWeight", "BoneWeights", 4, 0]]) {
415
- const [name, usage, elementCount, usageIndex = 0, type = "Float32"] = channel;
416
- if (!Array.isArray(vertex[name]) || vertex[name].length === 0) continue;
417
- decl.push({
418
- usage,
419
- usageIndex,
420
- type,
421
- elementCount,
422
- offset
423
- });
424
- offset += elementCount * elementTypeSize(type);
425
- }
426
- return decl;
427
- }
428
- function estimateVertexStride(vertex) {
429
- return estimateStrideFromDecl(buildCmfDecl(vertex));
430
- }
431
- function cmfBounds(mesh) {
432
- return {
433
- min: mesh.minBounds ?? [0, 0, 0],
434
- max: mesh.maxBounds ?? [0, 0, 0]
435
- };
436
- }
437
329
 
438
330
  /**
439
331
  * Inspect OBJ text without hydrating classes or applying rebuild options.
@@ -465,5 +357,5 @@ function inspectWithValues(input, values) {
465
357
  };
466
358
  }
467
359
 
468
- export { CLASS_KEYS, CMF_CLASS_KEYS, DEFAULT_VALUES, GR2_CLASS_KEYS, OUTPUT_CMF, OUTPUT_GR2, OUTPUT_JSON, OUTPUT_OBJ_JSON, OUTPUT_SHARED, inspectWithValues, normalizeValues, readWithValues, toText, validateClass, validateClassKey };
360
+ export { CLASS_KEYS, CMF_CLASS_KEYS, DEFAULT_VALUES, GR2_CLASS_KEYS, OUTPUT_CMF, OUTPUT_GR2, OUTPUT_JSON, OUTPUT_OBJ_JSON, OUTPUT_SHARED, inspectWithValues, normalizeValues, readWithValues, toText, validateClass };
469
361
  //# sourceMappingURL=helpers.js.map