ris-framework 0.1.0 → 0.2.0-dev.12

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 (383) hide show
  1. package/CHANGELOG.md +42 -1
  2. package/README.md +27 -4
  3. package/dist/Framework.d.ts +34 -10
  4. package/dist/Framework.d.ts.map +1 -1
  5. package/dist/api/IFramework.d.ts +50 -6
  6. package/dist/api/IFramework.d.ts.map +1 -1
  7. package/dist/api/_export.d.ts +3 -1
  8. package/dist/api/_export.d.ts.map +1 -1
  9. package/dist/api/camera/CameraFactory.d.ts +3 -2
  10. package/dist/api/camera/CameraFactory.d.ts.map +1 -1
  11. package/dist/api/camera/ICamera.d.ts +5 -0
  12. package/dist/api/camera/ICamera.d.ts.map +1 -1
  13. package/dist/api/camera/ICameraFactory.d.ts +5 -6
  14. package/dist/api/camera/ICameraFactory.d.ts.map +1 -1
  15. package/dist/api/camera/OrthographicCamera.d.ts +7 -0
  16. package/dist/api/camera/OrthographicCamera.d.ts.map +1 -1
  17. package/dist/api/camera/PerspectiveCamera.d.ts +30 -6
  18. package/dist/api/camera/PerspectiveCamera.d.ts.map +1 -1
  19. package/dist/api/content/ContentManager.d.ts +15 -2
  20. package/dist/api/content/ContentManager.d.ts.map +1 -1
  21. package/dist/api/content/IContentManager.d.ts +35 -1
  22. package/dist/api/content/IContentManager.d.ts.map +1 -1
  23. package/dist/api/content/ShaderModuleContent.d.ts.map +1 -1
  24. package/dist/api/data/Color.d.ts +5 -0
  25. package/dist/api/data/Color.d.ts.map +1 -1
  26. package/dist/api/geometry/BaseGeometry.d.ts +9 -0
  27. package/dist/api/geometry/BaseGeometry.d.ts.map +1 -1
  28. package/dist/api/geometry/GeometryBuilder.d.ts +3 -1
  29. package/dist/api/geometry/GeometryBuilder.d.ts.map +1 -1
  30. package/dist/api/geometry/IGeometryBuilder.d.ts +24 -0
  31. package/dist/api/geometry/IGeometryBuilder.d.ts.map +1 -1
  32. package/dist/api/geometry/_export-geometry.d.ts +1 -0
  33. package/dist/api/geometry/_export-geometry.d.ts.map +1 -1
  34. package/dist/api/input/InputManager.d.ts +4 -0
  35. package/dist/api/input/InputManager.d.ts.map +1 -1
  36. package/dist/api/lights/AmbientLight.d.ts +35 -0
  37. package/dist/api/lights/AmbientLight.d.ts.map +1 -0
  38. package/dist/api/lights/DirectionalLight.d.ts +40 -0
  39. package/dist/api/lights/DirectionalLight.d.ts.map +1 -0
  40. package/dist/api/lights/LightFactory.d.ts +18 -0
  41. package/dist/api/lights/LightFactory.d.ts.map +1 -0
  42. package/dist/api/lights/LightId.d.ts +6 -0
  43. package/dist/api/lights/LightId.d.ts.map +1 -0
  44. package/dist/api/lights/LightsBuffer.d.ts +77 -0
  45. package/dist/api/lights/LightsBuffer.d.ts.map +1 -0
  46. package/dist/api/lights/PointLight.d.ts +59 -0
  47. package/dist/api/lights/PointLight.d.ts.map +1 -0
  48. package/dist/api/lights/_export.d.ts +6 -0
  49. package/dist/api/lights/_export.d.ts.map +1 -0
  50. package/dist/api/loaders/ObjGeometryMapper.d.ts +19 -0
  51. package/dist/api/loaders/ObjGeometryMapper.d.ts.map +1 -0
  52. package/dist/api/loaders/ObjLoader.d.ts +61 -0
  53. package/dist/api/loaders/ObjLoader.d.ts.map +1 -0
  54. package/dist/api/loaders/_export.d.ts +2 -0
  55. package/dist/api/loaders/_export.d.ts.map +1 -1
  56. package/dist/api/loaders/obj/ObjParser.d.ts +44 -0
  57. package/dist/api/loaders/obj/ObjParser.d.ts.map +1 -0
  58. package/dist/api/loaders/obj/ObjTypes.d.ts +119 -0
  59. package/dist/api/loaders/obj/ObjTypes.d.ts.map +1 -0
  60. package/dist/api/loaders/obj/index.d.ts +3 -0
  61. package/dist/api/loaders/obj/index.d.ts.map +1 -0
  62. package/dist/api/material/ForwardBlinnPhongMaterial.d.ts +138 -0
  63. package/dist/api/material/ForwardBlinnPhongMaterial.d.ts.map +1 -0
  64. package/dist/api/material/ICameraMaterial.d.ts +18 -0
  65. package/dist/api/material/ICameraMaterial.d.ts.map +1 -0
  66. package/dist/api/material/ILightsMaterial.d.ts +26 -0
  67. package/dist/api/material/ILightsMaterial.d.ts.map +1 -0
  68. package/dist/api/material/IMaterial.d.ts +13 -10
  69. package/dist/api/material/IMaterial.d.ts.map +1 -1
  70. package/dist/api/material/IMaterialFactory.d.ts +17 -2
  71. package/dist/api/material/IMaterialFactory.d.ts.map +1 -1
  72. package/dist/api/material/InspectTextureMipsMaterial.d.ts +18 -9
  73. package/dist/api/material/InspectTextureMipsMaterial.d.ts.map +1 -1
  74. package/dist/api/material/MaterialFactory.d.ts +6 -0
  75. package/dist/api/material/MaterialFactory.d.ts.map +1 -1
  76. package/dist/api/material/SpriteMaterial.d.ts +51 -0
  77. package/dist/api/material/SpriteMaterial.d.ts.map +1 -0
  78. package/dist/api/material/UnlitMaterial.d.ts +32 -13
  79. package/dist/api/material/UnlitMaterial.d.ts.map +1 -1
  80. package/dist/api/material/_export.d.ts +4 -0
  81. package/dist/api/material/_export.d.ts.map +1 -1
  82. package/dist/api/meshes/IMesh.d.ts +31 -6
  83. package/dist/api/meshes/IMesh.d.ts.map +1 -1
  84. package/dist/api/meshes/IMeshFactory.d.ts +30 -4
  85. package/dist/api/meshes/IMeshFactory.d.ts.map +1 -1
  86. package/dist/api/meshes/IRenderableMesh.d.ts +47 -0
  87. package/dist/api/meshes/IRenderableMesh.d.ts.map +1 -0
  88. package/dist/api/meshes/Mesh.d.ts +14 -8
  89. package/dist/api/meshes/Mesh.d.ts.map +1 -1
  90. package/dist/api/meshes/MeshFactory.d.ts +10 -3
  91. package/dist/api/meshes/MeshFactory.d.ts.map +1 -1
  92. package/dist/api/meshes/QuadMesh.d.ts +5 -3
  93. package/dist/api/meshes/QuadMesh.d.ts.map +1 -1
  94. package/dist/api/meshes/RenderableMesh.d.ts +95 -0
  95. package/dist/api/meshes/RenderableMesh.d.ts.map +1 -0
  96. package/dist/api/meshes/_export.d.ts +2 -0
  97. package/dist/api/meshes/_export.d.ts.map +1 -1
  98. package/dist/api/rendering/IGraphicsDeviceFeatures.d.ts +8 -2
  99. package/dist/api/rendering/IGraphicsDeviceFeatures.d.ts.map +1 -1
  100. package/dist/api/rendering/IRenderer.d.ts +28 -1
  101. package/dist/api/rendering/IRenderer.d.ts.map +1 -1
  102. package/dist/api/rendering/enums.d.ts +7 -0
  103. package/dist/api/rendering/enums.d.ts.map +1 -1
  104. package/dist/api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.d.ts +56 -0
  105. package/dist/api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.d.ts.map +1 -0
  106. package/dist/api/rendering/render-pipelines/IRenderPipeline.d.ts +3 -0
  107. package/dist/api/rendering/render-pipelines/IRenderPipeline.d.ts.map +1 -1
  108. package/dist/api/rendering/render-pipelines/IRenderPipelineFactory.d.ts +29 -0
  109. package/dist/api/rendering/render-pipelines/IRenderPipelineFactory.d.ts.map +1 -1
  110. package/dist/api/rendering/render-pipelines/_export-render-pipelines.d.ts +1 -0
  111. package/dist/api/rendering/render-pipelines/_export-render-pipelines.d.ts.map +1 -1
  112. package/dist/api/rendering/renderer-interface.d.ts +1 -31
  113. package/dist/api/rendering/renderer-interface.d.ts.map +1 -1
  114. package/dist/api/rendering/renderpass/RenderPassDescriptor.d.ts +2 -6
  115. package/dist/api/rendering/renderpass/RenderPassDescriptor.d.ts.map +1 -1
  116. package/dist/api/rendering/swapchain/ISwapChain.d.ts +1 -3
  117. package/dist/api/rendering/swapchain/ISwapChain.d.ts.map +1 -1
  118. package/dist/api/rendering/texture/TextureFormat.d.ts +88 -14
  119. package/dist/api/rendering/texture/TextureFormat.d.ts.map +1 -1
  120. package/dist/api/rendering/texture/TextureUtilities.d.ts +23 -0
  121. package/dist/api/rendering/texture/TextureUtilities.d.ts.map +1 -1
  122. package/dist/api/scene/Scene.d.ts +113 -0
  123. package/dist/api/scene/Scene.d.ts.map +1 -0
  124. package/dist/api/scene/SceneMesh.d.ts +27 -0
  125. package/dist/api/scene/SceneMesh.d.ts.map +1 -0
  126. package/dist/api/shader/IShaderModuleLoader.d.ts +4 -1
  127. package/dist/api/shader/IShaderModuleLoader.d.ts.map +1 -1
  128. package/dist/api/shader/{shader-loader.d.ts → ShaderLoader.d.ts} +1 -1
  129. package/dist/api/shader/ShaderLoader.d.ts.map +1 -0
  130. package/dist/api/sprites/SpriteBatchDrawable.d.ts +1 -1
  131. package/dist/api/sprites/SpriteBatchDrawable.d.ts.map +1 -1
  132. package/dist/api/sprites/SpriteBatchMesh.d.ts +14 -1
  133. package/dist/api/sprites/SpriteBatchMesh.d.ts.map +1 -1
  134. package/dist/api/utilities/AlignUtilities.d.ts.map +1 -1
  135. package/dist/api/utilities/GeometryUtilities.d.ts.map +1 -1
  136. package/dist/api/window/WindowManager.d.ts +4 -0
  137. package/dist/api/window/WindowManager.d.ts.map +1 -1
  138. package/dist/core/rendering/ARenderer.d.ts +5 -5
  139. package/dist/core/rendering/ARenderer.d.ts.map +1 -1
  140. package/dist/core/rendering/vertex-buffer-layout.d.ts +1 -0
  141. package/dist/core/rendering/vertex-buffer-layout.d.ts.map +1 -1
  142. package/dist/index.d.ts +0 -1
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +9238 -4595
  145. package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts +4 -0
  146. package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts.map +1 -1
  147. package/dist/webgl/WebGlGraphicsDevice.d.ts.map +1 -1
  148. package/dist/webgl/WebGlRenderer.d.ts +1 -3
  149. package/dist/webgl/WebGlRenderer.d.ts.map +1 -1
  150. package/dist/webgl/lights/WebGlAmbientLightFactory.d.ts +17 -0
  151. package/dist/webgl/lights/WebGlAmbientLightFactory.d.ts.map +1 -0
  152. package/dist/webgl/lights/WebGlLightsBuffer.d.ts +59 -0
  153. package/dist/webgl/lights/WebGlLightsBuffer.d.ts.map +1 -0
  154. package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts +3 -1
  155. package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts.map +1 -1
  156. package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts +5 -0
  157. package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts.map +1 -1
  158. package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts +3 -1
  159. package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts.map +1 -1
  160. package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts +3 -1
  161. package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts.map +1 -1
  162. package/dist/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.d.ts +88 -0
  163. package/dist/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.d.ts.map +1 -0
  164. package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts +3 -1
  165. package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts.map +1 -1
  166. package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts +3 -1
  167. package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts.map +1 -1
  168. package/dist/webgl/shader/WebGlShaderModule.d.ts +4 -1
  169. package/dist/webgl/shader/WebGlShaderModule.d.ts.map +1 -1
  170. package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts +16 -5
  171. package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts.map +1 -1
  172. package/dist/webgl/swap-chain/WebGlSwapChain.d.ts +3 -2
  173. package/dist/webgl/swap-chain/WebGlSwapChain.d.ts.map +1 -1
  174. package/dist/webgl/texture/WebGlTexture2D.d.ts +8 -1
  175. package/dist/webgl/texture/WebGlTexture2D.d.ts.map +1 -1
  176. package/dist/webgl/texture/WebGlTextureFactory.d.ts +7 -0
  177. package/dist/webgl/texture/WebGlTextureFactory.d.ts.map +1 -1
  178. package/dist/webgl/utilities/WebGlConstants.d.ts +91 -0
  179. package/dist/webgl/utilities/WebGlConstants.d.ts.map +1 -0
  180. package/dist/webgl/utilities/WebGlConverter.d.ts +0 -7
  181. package/dist/webgl/utilities/WebGlConverter.d.ts.map +1 -1
  182. package/dist/webgl/utilities/WebGlErrorUtilities.d.ts +10 -0
  183. package/dist/webgl/utilities/WebGlErrorUtilities.d.ts.map +1 -0
  184. package/dist/webgl/utilities/WebGlTextureUtilities.d.ts.map +1 -1
  185. package/dist/webgl/utilities/WebGlUtilities.d.ts +3 -0
  186. package/dist/webgl/utilities/WebGlUtilities.d.ts.map +1 -1
  187. package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts +0 -1
  188. package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts.map +1 -1
  189. package/dist/webgpu/WebGpuGpuInfo.d.ts +28 -0
  190. package/dist/webgpu/WebGpuGpuInfo.d.ts.map +1 -0
  191. package/dist/webgpu/WebGpuGraphicsDevice.d.ts +80 -0
  192. package/dist/webgpu/WebGpuGraphicsDevice.d.ts.map +1 -0
  193. package/dist/webgpu/WebGpuGraphicsDeviceFeatures.d.ts +26 -0
  194. package/dist/webgpu/WebGpuGraphicsDeviceFeatures.d.ts.map +1 -0
  195. package/dist/webgpu/WebGpuRenderer.d.ts +26 -0
  196. package/dist/webgpu/WebGpuRenderer.d.ts.map +1 -0
  197. package/dist/webgpu/WebGpuTypes.d.ts +355 -0
  198. package/dist/webgpu/WebGpuTypes.d.ts.map +1 -0
  199. package/dist/webgpu/blending/WebGpuBlendState.d.ts +30 -0
  200. package/dist/webgpu/blending/WebGpuBlendState.d.ts.map +1 -0
  201. package/dist/webgpu/buffers/WebGpuBuffersFactory.d.ts +20 -0
  202. package/dist/webgpu/buffers/WebGpuBuffersFactory.d.ts.map +1 -0
  203. package/dist/webgpu/buffers/WebGpuIndexBuffer.d.ts +46 -0
  204. package/dist/webgpu/buffers/WebGpuIndexBuffer.d.ts.map +1 -0
  205. package/dist/webgpu/buffers/WebGpuUniformBuffer.d.ts +43 -0
  206. package/dist/webgpu/buffers/WebGpuUniformBuffer.d.ts.map +1 -0
  207. package/dist/webgpu/buffers/WebGpuVertexBuffer.d.ts +49 -0
  208. package/dist/webgpu/buffers/WebGpuVertexBuffer.d.ts.map +1 -0
  209. package/dist/webgpu/primitive/WebGpuPrimitiveState.d.ts +32 -0
  210. package/dist/webgpu/primitive/WebGpuPrimitiveState.d.ts.map +1 -0
  211. package/dist/webgpu/render-pass/WebGpuRenderPass.d.ts +28 -0
  212. package/dist/webgpu/render-pass/WebGpuRenderPass.d.ts.map +1 -0
  213. package/dist/webgpu/render-pipelines/AWebGpuRenderPipeline.d.ts +50 -0
  214. package/dist/webgpu/render-pipelines/AWebGpuRenderPipeline.d.ts.map +1 -0
  215. package/dist/webgpu/render-pipelines/WebGpuMainRenderTargetRenderPipeline.d.ts +34 -0
  216. package/dist/webgpu/render-pipelines/WebGpuMainRenderTargetRenderPipeline.d.ts.map +1 -0
  217. package/dist/webgpu/render-pipelines/WebGpuRenderPipelineFactory.d.ts +26 -0
  218. package/dist/webgpu/render-pipelines/WebGpuRenderPipelineFactory.d.ts.map +1 -0
  219. package/dist/webgpu/render-pipelines/material/AWebGpuMeshRenderPipeline.d.ts +72 -0
  220. package/dist/webgpu/render-pipelines/material/AWebGpuMeshRenderPipeline.d.ts.map +1 -0
  221. package/dist/webgpu/render-pipelines/material/WebGpuUnlitRenderPipeline.d.ts +40 -0
  222. package/dist/webgpu/render-pipelines/material/WebGpuUnlitRenderPipeline.d.ts.map +1 -0
  223. package/dist/webgpu/sampler/WebGpuSampler.d.ts +39 -0
  224. package/dist/webgpu/sampler/WebGpuSampler.d.ts.map +1 -0
  225. package/dist/webgpu/shader/WebGpuShaderModule.d.ts +29 -0
  226. package/dist/webgpu/shader/WebGpuShaderModule.d.ts.map +1 -0
  227. package/dist/webgpu/shader/WebGpuShaderModuleLoader.d.ts +21 -0
  228. package/dist/webgpu/shader/WebGpuShaderModuleLoader.d.ts.map +1 -0
  229. package/dist/webgpu/shader/WgslShaderContent.d.ts +9 -0
  230. package/dist/webgpu/shader/WgslShaderContent.d.ts.map +1 -0
  231. package/dist/webgpu/swap-chain/WebGpuSwapChain.d.ts +41 -0
  232. package/dist/webgpu/swap-chain/WebGpuSwapChain.d.ts.map +1 -0
  233. package/dist/webgpu/texture/WebGpuTexture2D.d.ts +47 -0
  234. package/dist/webgpu/texture/WebGpuTexture2D.d.ts.map +1 -0
  235. package/dist/webgpu/texture/WebGpuTextureFactory.d.ts +21 -0
  236. package/dist/webgpu/texture/WebGpuTextureFactory.d.ts.map +1 -0
  237. package/dist/webgpu/texture/WebGpuTextureView.d.ts +25 -0
  238. package/dist/webgpu/texture/WebGpuTextureView.d.ts.map +1 -0
  239. package/dist/webgpu/utilities/WebGpuConverter.d.ts +45 -0
  240. package/dist/webgpu/utilities/WebGpuConverter.d.ts.map +1 -0
  241. package/package.json +4 -4
  242. package/shaders/glsl/forward_blinn_phong_material_fs.glsl +110 -0
  243. package/shaders/glsl/forward_blinn_phong_material_vs.glsl +32 -0
  244. package/shaders/glsl/main_render_target_flip_y_fs.glsl +35 -1
  245. package/shaders/glsl/sprite_fs.glsl +1 -1
  246. package/shaders/glsl/unlit_material_fs.glsl +1 -1
  247. package/shaders/wgsl/forward_blinn_phong_material.wgsl +150 -0
  248. package/shaders/wgsl/inspect_texture_mips.wgsl +51 -0
  249. package/shaders/wgsl/main_frame_buffer.wgsl +35 -0
  250. package/shaders/wgsl/main_render_target_flip_y.wgsl +35 -0
  251. package/shaders/wgsl/sprite.wgsl +40 -0
  252. package/shaders/wgsl/unlit_material.wgsl +49 -0
  253. package/src/Framework.ts +156 -48
  254. package/src/api/IFramework.ts +63 -6
  255. package/src/api/_export.ts +3 -1
  256. package/src/api/camera/CameraFactory.ts +6 -6
  257. package/src/api/camera/ICamera.ts +6 -0
  258. package/src/api/camera/ICameraFactory.ts +5 -10
  259. package/src/api/camera/OrthographicCamera.ts +23 -1
  260. package/src/api/camera/PerspectiveCamera.ts +60 -15
  261. package/src/api/content/ContentManager.ts +78 -16
  262. package/src/api/content/IContentManager.ts +37 -1
  263. package/src/api/content/ShaderModuleContent.ts +9 -0
  264. package/src/api/data/Color.ts +7 -1
  265. package/src/api/geometry/BaseGeometry.ts +23 -0
  266. package/src/api/geometry/GeometryBuilder.ts +14 -2
  267. package/src/api/geometry/IGeometryBuilder.ts +31 -1
  268. package/src/api/geometry/_export-geometry.ts +2 -1
  269. package/src/api/input/InputManager.ts +14 -5
  270. package/src/api/lights/AmbientLight.ts +53 -0
  271. package/src/api/lights/DirectionalLight.ts +60 -0
  272. package/src/api/lights/LightFactory.ts +21 -0
  273. package/src/api/lights/LightId.ts +9 -0
  274. package/src/api/lights/LightsBuffer.ts +94 -0
  275. package/src/api/lights/PointLight.ts +91 -0
  276. package/src/api/lights/_export.ts +5 -0
  277. package/src/api/loaders/ObjGeometryMapper.ts +28 -0
  278. package/src/api/loaders/ObjLoader.ts +126 -0
  279. package/src/api/loaders/_export.ts +3 -1
  280. package/src/api/loaders/obj/ObjParser.ts +301 -0
  281. package/src/api/loaders/obj/ObjTypes.ts +142 -0
  282. package/src/api/loaders/obj/index.ts +5 -0
  283. package/src/api/material/ForwardBlinnPhongMaterial.ts +328 -0
  284. package/src/api/material/ICameraMaterial.ts +22 -0
  285. package/src/api/material/ILightsMaterial.ts +32 -0
  286. package/src/api/material/IMaterial.ts +13 -10
  287. package/src/api/material/IMaterialFactory.ts +19 -2
  288. package/src/api/material/InspectTextureMipsMaterial.ts +65 -26
  289. package/src/api/material/MaterialFactory.ts +12 -0
  290. package/src/api/material/SpriteMaterial.ts +83 -0
  291. package/src/api/material/UnlitMaterial.ts +105 -32
  292. package/src/api/material/_export.ts +5 -1
  293. package/src/api/meshes/IMesh.ts +40 -6
  294. package/src/api/meshes/IMeshFactory.ts +33 -4
  295. package/src/api/meshes/IRenderableMesh.ts +58 -0
  296. package/src/api/meshes/Mesh.ts +50 -43
  297. package/src/api/meshes/MeshFactory.ts +37 -4
  298. package/src/api/meshes/QuadMesh.ts +6 -4
  299. package/src/api/meshes/RenderableMesh.ts +207 -0
  300. package/src/api/meshes/_export.ts +6 -4
  301. package/src/api/rendering/IGraphicsDeviceFeatures.ts +28 -21
  302. package/src/api/rendering/IRenderer.ts +34 -1
  303. package/src/api/rendering/enums.ts +10 -0
  304. package/src/api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.ts +66 -0
  305. package/src/api/rendering/render-pipelines/IRenderPipeline.ts +4 -0
  306. package/src/api/rendering/render-pipelines/IRenderPipelineFactory.ts +39 -0
  307. package/src/api/rendering/render-pipelines/_export-render-pipelines.ts +2 -1
  308. package/src/api/rendering/renderer-interface.ts +1 -36
  309. package/src/api/rendering/renderpass/RenderPassDescriptor.ts +10 -14
  310. package/src/api/rendering/swapchain/ISwapChain.ts +1 -3
  311. package/src/api/rendering/texture/TextureFormat.ts +128 -14
  312. package/src/api/rendering/texture/TextureUtilities.ts +225 -10
  313. package/src/api/scene/Scene.ts +297 -0
  314. package/src/api/scene/SceneMesh.ts +61 -0
  315. package/src/api/shader/IShaderModuleLoader.ts +2 -1
  316. package/src/api/sprites/SpriteBatchDrawable.ts +12 -16
  317. package/src/api/sprites/SpriteBatchMesh.ts +22 -3
  318. package/src/api/utilities/AlignUtilities.ts +2 -1
  319. package/src/api/utilities/GeometryUtilities.ts +2 -0
  320. package/src/api/window/WindowManager.ts +23 -3
  321. package/src/core/rendering/ARenderer.ts +24 -15
  322. package/src/core/rendering/vertex-buffer-layout.ts +32 -1
  323. package/src/index.ts +0 -1
  324. package/src/main.ts +2 -4
  325. package/src/webgl/WebGLGraphicsDeviceFeatures.ts +12 -2
  326. package/src/webgl/WebGlGpuInfo.ts +1 -1
  327. package/src/webgl/WebGlGraphicsDevice.ts +0 -1
  328. package/src/webgl/WebGlRenderer.ts +2 -5
  329. package/src/webgl/lights/WebGlAmbientLightFactory.ts +35 -0
  330. package/src/webgl/lights/WebGlLightsBuffer.ts +225 -0
  331. package/src/webgl/render-pipelines/AWebGlRenderPipeline.ts +7 -1
  332. package/src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts +21 -1
  333. package/src/webgl/render-pipelines/WebGlRenderPipelineFactory.ts +24 -2
  334. package/src/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.ts +16 -6
  335. package/src/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.ts +300 -0
  336. package/src/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.ts +16 -6
  337. package/src/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.ts +11 -7
  338. package/src/webgl/shader/WebGlShaderModule.ts +11 -4
  339. package/src/webgl/shader/WebGlShaderModuleLoader.ts +29 -10
  340. package/src/webgl/swap-chain/WebGlSwapChain.ts +7 -6
  341. package/src/webgl/texture/WebGlTexture2D.ts +19 -5
  342. package/src/webgl/texture/WebGlTextureFactory.ts +49 -7
  343. package/src/webgl/utilities/WebGlConstants.ts +136 -0
  344. package/src/webgl/utilities/WebGlConverter.ts +91 -22
  345. package/src/webgl/utilities/WebGlErrorUtilities.ts +15 -0
  346. package/src/webgl/utilities/WebGlTextureUtilities.ts +5 -2
  347. package/src/webgl/utilities/WebGlUtilities.ts +4 -0
  348. package/src/webgl/utilities/webgl-filter-anisotropic-utilities.ts +9 -6
  349. package/src/webgpu/WebGpuGpuInfo.ts +61 -0
  350. package/src/webgpu/WebGpuGraphicsDevice.ts +199 -0
  351. package/src/webgpu/WebGpuGraphicsDeviceFeatures.ts +41 -0
  352. package/src/webgpu/WebGpuRenderer.ts +49 -0
  353. package/src/webgpu/WebGpuTypes.ts +288 -0
  354. package/src/webgpu/blending/WebGpuBlendState.ts +53 -0
  355. package/src/webgpu/buffers/WebGpuBuffersFactory.ts +46 -0
  356. package/src/webgpu/buffers/WebGpuIndexBuffer.ts +118 -0
  357. package/src/webgpu/buffers/WebGpuUniformBuffer.ts +102 -0
  358. package/src/webgpu/buffers/WebGpuVertexBuffer.ts +119 -0
  359. package/src/webgpu/primitive/WebGpuPrimitiveState.ts +52 -0
  360. package/src/webgpu/render-pass/WebGpuRenderPass.ts +131 -0
  361. package/src/webgpu/render-pipelines/AWebGpuRenderPipeline.ts +123 -0
  362. package/src/webgpu/render-pipelines/WebGpuMainRenderTargetRenderPipeline.ts +119 -0
  363. package/src/webgpu/render-pipelines/WebGpuRenderPipelineFactory.ts +66 -0
  364. package/src/webgpu/render-pipelines/material/AWebGpuMeshRenderPipeline.ts +249 -0
  365. package/src/webgpu/render-pipelines/material/WebGpuUnlitRenderPipeline.ts +101 -0
  366. package/src/webgpu/sampler/WebGpuSampler.ts +84 -0
  367. package/src/webgpu/shader/WebGpuShaderModule.ts +65 -0
  368. package/src/webgpu/shader/WebGpuShaderModuleLoader.ts +38 -0
  369. package/src/webgpu/shader/WgslShaderContent.ts +20 -0
  370. package/src/webgpu/swap-chain/WebGpuSwapChain.ts +93 -0
  371. package/src/webgpu/texture/WebGpuTexture2D.ts +197 -0
  372. package/src/webgpu/texture/WebGpuTextureFactory.ts +118 -0
  373. package/src/webgpu/texture/WebGpuTextureView.ts +43 -0
  374. package/src/webgpu/utilities/WebGpuConverter.ts +299 -0
  375. package/src/wgsl-raw.d.ts +4 -0
  376. package/dist/api/FrameworkConfiguration.d.ts +0 -23
  377. package/dist/api/FrameworkConfiguration.d.ts.map +0 -1
  378. package/dist/api/IFrameworkConfiguration.d.ts +0 -25
  379. package/dist/api/IFrameworkConfiguration.d.ts.map +0 -1
  380. package/dist/api/shader/shader-loader.d.ts.map +0 -1
  381. package/src/api/FrameworkConfiguration.ts +0 -29
  382. package/src/api/IFrameworkConfiguration.ts +0 -30
  383. /package/src/api/shader/{shader-loader.ts → ShaderLoader.ts} +0 -0
@@ -0,0 +1,301 @@
1
+ import {
2
+ ObjMaterialDefinition,
3
+ type ObjColor,
4
+ type ObjLoadResult,
5
+ type ObjLoadOptions,
6
+ type ObjModel,
7
+ type ObjMaterialRange,
8
+ } from "./ObjTypes.ts";
9
+
10
+ function tokens(line: string): string[] {
11
+ return line.trim().split(/\s+/);
12
+ }
13
+
14
+ function readColor(parts: string[]): ObjColor | undefined {
15
+ // "Kd spectral ..." and "Kd xyz ..." are not supported.
16
+ if (parts.length < 2 || isNaN(parseFloat(parts[1]))) {
17
+ return undefined;
18
+ }
19
+ const r = parseFloat(parts[1]);
20
+ const g = parts.length > 2 ? parseFloat(parts[2]) : r;
21
+ const b = parts.length > 3 ? parseFloat(parts[3]) : r;
22
+ return [r, g, b];
23
+ }
24
+
25
+ /**
26
+ * Parses .obj models (and their .mtl materials) from text or a URL into plain data.
27
+ * Engine-independent; uses only `fetch` and `URL`, and creates no GPU resources.
28
+ * `framework.objLoader` (or the static `ObjLoader.parseAsync`) builds on it.
29
+ */
30
+ export class ObjParser {
31
+
32
+ /**
33
+ * Parses .mtl text.
34
+ * @param text The .mtl contents.
35
+ * @returns The material definitions, in file order.
36
+ */
37
+ public parseMtl(text: string): ObjMaterialDefinition[] {
38
+ const materials: ObjMaterialDefinition[] = [];
39
+ let current: ObjMaterialDefinition | undefined;
40
+
41
+ for (const rawLine of text.split(/\r?\n/)) {
42
+ const line = rawLine.trim();
43
+ if (line.length == 0 || line.startsWith("#")) {
44
+ continue;
45
+ }
46
+ const parts = tokens(line);
47
+ const keyword = parts[0];
48
+
49
+ if (keyword == "newmtl") {
50
+ current = new ObjMaterialDefinition(line.substring(keyword.length).trim());
51
+ materials.push(current);
52
+ continue;
53
+ }
54
+ if (!current) {
55
+ continue;
56
+ }
57
+
58
+ switch (keyword) {
59
+ case "Ka":
60
+ current.ambientColor = readColor(parts);
61
+ break;
62
+ case "Kd":
63
+ current.diffuseColor = readColor(parts);
64
+ break;
65
+ case "Ks":
66
+ current.specularColor = readColor(parts);
67
+ break;
68
+ case "Ke":
69
+ current.emissiveColor = readColor(parts);
70
+ break;
71
+ case "Ns":
72
+ current.specularExponent = parseFloat(parts[1]);
73
+ break;
74
+ case "Ni":
75
+ current.opticalDensity = parseFloat(parts[1]);
76
+ break;
77
+ case "illum":
78
+ current.illuminationModel = parseInt(parts[1]);
79
+ break;
80
+ case "d":
81
+ current.opacity = parseFloat(parts[parts.length - 1]);
82
+ break;
83
+ case "Tr":
84
+ // "d" wins when both are present.
85
+ if (current.opacity === undefined) {
86
+ current.opacity = 1 - parseFloat(parts[1]);
87
+ }
88
+ break;
89
+ default:
90
+ if (keyword.startsWith("map_") || keyword == "bump" || keyword == "disp"
91
+ || keyword == "decal" || keyword == "refl" || keyword == "norm") {
92
+ if (parts.length >= 2) {
93
+ current.maps[keyword] = parts[parts.length - 1];
94
+ if (parts.length > 2) {
95
+ current.mapOptions[keyword] = parts.slice(1, -1).join(" ");
96
+ }
97
+ }
98
+ }
99
+ break;
100
+ }
101
+ }
102
+
103
+ return materials;
104
+ }
105
+
106
+ /**
107
+ * Parses .obj text.
108
+ * @param text The .obj contents.
109
+ * @param materials Material definitions to use for `usemtl`, e.g. from {@link parseMtl}. Default none.
110
+ * @returns The geometry, materials and raw data.
111
+ */
112
+ public fromText(text: string, materials: ObjMaterialDefinition[] = []): ObjLoadResult {
113
+ const rawPositions: number[] = [];
114
+ const rawTextureCoords: number[] = [];
115
+ const rawNormals: number[] = [];
116
+ const faceIndices: number[] = [];
117
+ const materialLibraries: string[] = [];
118
+ const materialRanges: ObjMaterialRange[] = [];
119
+
120
+ const positions: number[] = [];
121
+ const textureCoords: number[] = [];
122
+ const normals: number[] = [];
123
+ const colors: number[] = [];
124
+ const indices: number[] = [];
125
+ const vertexLookup = new Map<string, number>();
126
+
127
+ const materialsByName = new Map(materials.map(m => [m.name, m]));
128
+ let materialName: string | undefined;
129
+ let rangeStart = 0;
130
+
131
+ const closeRange = () => {
132
+ if (indices.length > rangeStart) {
133
+ materialRanges.push({materialName, indexStart: rangeStart, indexCount: indices.length - rangeStart});
134
+ }
135
+ rangeStart = indices.length;
136
+ };
137
+
138
+ const resolve = (value: string | undefined, count: number): number => {
139
+ if (value === undefined || value.length == 0) {
140
+ return -1;
141
+ }
142
+ const index = parseInt(value);
143
+ // OBJ indices are one-based; negative values count back from the end.
144
+ return index < 0 ? count + index : index - 1;
145
+ };
146
+
147
+ const addCorner = (p: number, t: number, n: number): void => {
148
+ faceIndices.push(p, t, n);
149
+ const key = `${p}/${t}/${n}/${materialName ?? ""}`;
150
+ let vertex = vertexLookup.get(key);
151
+ if (vertex === undefined) {
152
+ vertex = positions.length / 3;
153
+ vertexLookup.set(key, vertex);
154
+ positions.push(rawPositions[p * 3], rawPositions[p * 3 + 1], rawPositions[p * 3 + 2]);
155
+ textureCoords.push(t >= 0 ? rawTextureCoords[t * 2] : 0, t >= 0 ? rawTextureCoords[t * 2 + 1] : 0);
156
+ normals.push(n >= 0 ? rawNormals[n * 3] : 0, n >= 0 ? rawNormals[n * 3 + 1] : 0, n >= 0 ? rawNormals[n * 3 + 2] : 0);
157
+ const material = materialName !== undefined ? materialsByName.get(materialName) : undefined;
158
+ const kd = material?.diffuseColor ?? [1, 1, 1];
159
+ colors.push(kd[0], kd[1], kd[2], material?.opacity ?? 1);
160
+ }
161
+ indices.push(vertex);
162
+ };
163
+
164
+ for (const rawLine of text.split(/\r?\n/)) {
165
+ const line = rawLine.trim();
166
+ if (line.length == 0 || line.startsWith("#")) {
167
+ continue;
168
+ }
169
+ const parts = tokens(line);
170
+
171
+ switch (parts[0]) {
172
+ case "v":
173
+ rawPositions.push(parseFloat(parts[1]), parseFloat(parts[2]), parseFloat(parts[3]));
174
+ break;
175
+ case "vt":
176
+ rawTextureCoords.push(parseFloat(parts[1]), parts.length > 2 ? parseFloat(parts[2]) : 0);
177
+ break;
178
+ case "vn":
179
+ rawNormals.push(parseFloat(parts[1]), parseFloat(parts[2]), parseFloat(parts[3]));
180
+ break;
181
+ case "f": {
182
+ const corners = parts.slice(1).map(corner => {
183
+ const [p, t, n] = corner.split("/");
184
+ return [
185
+ resolve(p, rawPositions.length / 3),
186
+ resolve(t, rawTextureCoords.length / 2),
187
+ resolve(n, rawNormals.length / 3),
188
+ ];
189
+ });
190
+ // Triangulate polygons as a fan.
191
+ for (let i = 1; i + 1 < corners.length; i++) {
192
+ addCorner(corners[0][0], corners[0][1], corners[0][2]);
193
+ addCorner(corners[i][0], corners[i][1], corners[i][2]);
194
+ addCorner(corners[i + 1][0], corners[i + 1][1], corners[i + 1][2]);
195
+ }
196
+ break;
197
+ }
198
+ case "mtllib":
199
+ materialLibraries.push(...parts.slice(1));
200
+ break;
201
+ case "usemtl":
202
+ closeRange();
203
+ materialName = line.substring(parts[0].length).trim();
204
+ break;
205
+ }
206
+ }
207
+ closeRange();
208
+
209
+ if(positions.length == 0){
210
+ throw new Error("Invalid obj file.");
211
+ }
212
+
213
+ return {
214
+ geometry: {
215
+ positions, textureCoords, normals, colors, indices,
216
+ vertexCount: positions.length / 3,
217
+ materialRanges,
218
+ },
219
+ materials,
220
+ materialLibraries,
221
+ raw: {positions: rawPositions, textureCoords: rawTextureCoords, normals: rawNormals, faceIndices},
222
+ };
223
+ }
224
+
225
+ /**
226
+ * Loads an .obj file and the .mtl files it references with `mtllib`.
227
+ * A missing or failing .mtl is skipped (logged as a warning); the model still loads with white vertex colours.
228
+ * @param filePath The .obj URL.
229
+ * @param options Optional: how to resolve `mtllib` names, or skip materials.
230
+ * @returns The geometry, materials and raw data.
231
+ */
232
+ public async loadAsync(filePath: string, options?: ObjLoadOptions): Promise<ObjLoadResult> {
233
+ const response = await fetch(filePath);
234
+ if (!response.ok) {
235
+ throw new Error(`Failed to load OBJ '${filePath}': ${response.status} ${response.statusText}`);
236
+ }
237
+ const text = await response.text();
238
+
239
+ const materials: ObjMaterialDefinition[] = [];
240
+
241
+ const libraries = options?.ignoreMaterials ? [] : text.split(/\r?\n/)
242
+ .map(line => tokens(line))
243
+ .filter(parts => parts[0] == "mtllib")
244
+ .flatMap(parts => parts.slice(1));
245
+
246
+ // data: and blob: URLs have no directory, so relative names cannot be resolved against them.
247
+ const opaqueUrl = /^(data|blob):/i.test(filePath);
248
+ for (const library of libraries) {
249
+ try {
250
+ let mtlUrl: string;
251
+ if (options?.resolveMaterialUrl) {
252
+ mtlUrl = options.resolveMaterialUrl(library);
253
+ } else if (opaqueUrl) {
254
+ throw new Error("the OBJ was loaded from a data: or blob: URL (e.g. a bundler-inlined asset), so the name cannot be resolved; pass options.resolveMaterialUrl");
255
+ } else {
256
+ mtlUrl = filePath.substring(0, filePath.lastIndexOf("/") + 1) + library;
257
+ }
258
+ const mtlResponse = await fetch(mtlUrl);
259
+
260
+ if (!mtlResponse.ok) {
261
+ throw new Error(`${mtlResponse.status} ${mtlResponse.statusText}`);
262
+ }
263
+ materials.push(...this.parseMtl(await mtlResponse.text()));
264
+ } catch (error) {
265
+ console.warn(`ObjParser: could not load material library '${library}'.`, error);
266
+ }
267
+ }
268
+
269
+
270
+ return this.fromText(text, materials);
271
+ }
272
+
273
+ /**
274
+ * Loads an .obj file (and its .mtl files) into an {@link ObjModel}: the geometry plus one sub mesh per `usemtl`
275
+ * range with its resolved material definition.
276
+ * @param filePath The .obj URL.
277
+ * @param options Optional: how to resolve `mtllib` names, or skip materials.
278
+ * @returns The model.
279
+ */
280
+ public async parseAsync(filePath: string, options?: ObjLoadOptions): Promise<ObjModel> {
281
+ return ObjParser.toModel(await this.loadAsync(filePath, options));
282
+ }
283
+
284
+ /**
285
+ * Turns a load result into an {@link ObjModel}.
286
+ * @param result The load result.
287
+ * @returns The model.
288
+ */
289
+ public static toModel(result: ObjLoadResult): ObjModel {
290
+ const byName = new Map(result.materials.map(m => [m.name, m]));
291
+ return {
292
+ ...result,
293
+ subMeshes: result.geometry.materialRanges.map(range => ({
294
+ materialName: range.materialName,
295
+ material: range.materialName === undefined ? undefined : byName.get(range.materialName),
296
+ indexStart: range.indexStart,
297
+ indexCount: range.indexCount,
298
+ })),
299
+ };
300
+ }
301
+ }
@@ -0,0 +1,142 @@
1
+ /*
2
+ * Plain-data types produced by the OBJ loader.
3
+ * This folder is self-contained: files here import only each other, so it can move to its own package.
4
+ */
5
+
6
+ /** An RGB colour as read from an .mtl file, each channel usually in 0..1. */
7
+ export type ObjColor = [r: number, g: number, b: number];
8
+
9
+ /**
10
+ * A material definition read from an .mtl file (`newmtl` block).
11
+ * This is plain data, not a GPU material; map it onto a framework material yourself.
12
+ */
13
+ export class ObjMaterialDefinition {
14
+
15
+ /**
16
+ * The constructor.
17
+ * @param name The material name from `newmtl`.
18
+ */
19
+ public constructor(public name: string) {
20
+ }
21
+
22
+ /** Ambient colour (`Ka`). */
23
+ public ambientColor?: ObjColor;
24
+
25
+ /** Diffuse colour (`Kd`). */
26
+ public diffuseColor?: ObjColor;
27
+
28
+ /** Specular colour (`Ks`). */
29
+ public specularColor?: ObjColor;
30
+
31
+ /** Emissive colour (`Ke`). */
32
+ public emissiveColor?: ObjColor;
33
+
34
+ /** Specular exponent (`Ns`). */
35
+ public specularExponent?: number;
36
+
37
+ /** Opacity, from `d`, or `1 - Tr` when only `Tr` is given. */
38
+ public opacity?: number;
39
+
40
+ /** Optical density / index of refraction (`Ni`). */
41
+ public opticalDensity?: number;
42
+
43
+ /** Illumination model (`illum`). */
44
+ public illuminationModel?: number;
45
+
46
+ /**
47
+ * Texture maps by statement name, e.g. `map_Kd`, `map_Ks`, `map_Bump`, `bump`, `disp`, `decal`, `refl`.
48
+ * The value is the file name (last token); map options such as `-bm 1` are kept in {@link mapOptions}.
49
+ */
50
+ public maps: Record<string, string> = {};
51
+
52
+ /** Options written before the file name of a map statement, e.g. `{ map_Bump: "-bm 0.5" }`. */
53
+ public mapOptions: Record<string, string> = {};
54
+ }
55
+
56
+ /** A run of triangles in the geometry's index buffer drawn with one material (`usemtl`). */
57
+ export interface ObjMaterialRange {
58
+ /** The material name from `usemtl`, or undefined for faces before any `usemtl`. */
59
+ readonly materialName?: string;
60
+ /** First index in `geometry.indices`. */
61
+ readonly indexStart: number;
62
+ /** Number of indices (3 per triangle). */
63
+ readonly indexCount: number;
64
+ }
65
+
66
+ /** The OBJ data exactly as listed in the file, before expansion. */
67
+ export interface ObjRawData {
68
+ /** `v` values, 3 per position. */
69
+ readonly positions: number[];
70
+ /** `vt` values, 2 per texture coordinate (a third `w` value is dropped). */
71
+ readonly textureCoords: number[];
72
+ /** `vn` values, 3 per normal. */
73
+ readonly normals: number[];
74
+ /**
75
+ * Triangulated face corners as zero-based `position, texcoord, normal` triplets.
76
+ * A missing texcoord or normal is -1.
77
+ */
78
+ readonly faceIndices: number[];
79
+ }
80
+
81
+ /**
82
+ * Renderable geometry as plain data: one vertex per unique position/texcoord/normal/material corner.
83
+ * Has no dependency on any engine; convert it to engine geometry yourself.
84
+ */
85
+ export interface ObjGeometryDefinition {
86
+ /** Positions, 3 per vertex. */
87
+ readonly positions: number[];
88
+ /** Texture coordinates, 2 per vertex (0,0 when the corner has none). */
89
+ readonly textureCoords: number[];
90
+ /** Normals, 3 per vertex (0,0,0 when the corner has none). */
91
+ readonly normals: number[];
92
+ /** RGBA colours, 4 per vertex: the material's `Kd` with alpha from `d`, white without a material. */
93
+ readonly colors: number[];
94
+ /** Triangle indices, 3 per triangle. */
95
+ readonly indices: number[];
96
+ /** Number of vertices (`positions.length / 3`). */
97
+ readonly vertexCount: number;
98
+ /** Index ranges per `usemtl`, in file order. */
99
+ readonly materialRanges: ObjMaterialRange[];
100
+ }
101
+
102
+ /** The result of loading an OBJ file. */
103
+ export interface ObjLoadResult {
104
+ /** The renderable geometry as plain data. */
105
+ readonly geometry: ObjGeometryDefinition;
106
+ /** Material definitions from the referenced .mtl files. Empty when there is no `mtllib` or it could not be loaded. */
107
+ readonly materials: ObjMaterialDefinition[];
108
+ /** Library file names from `mtllib`, in order. */
109
+ readonly materialLibraries: string[];
110
+ /** The raw OBJ lists. */
111
+ readonly raw: ObjRawData;
112
+ }
113
+
114
+ /** Options for {@link ObjParser.loadAsync} and `ObjLoader.loadAsync`. */
115
+ export interface ObjLoadOptions {
116
+ /**
117
+ * Maps an `mtllib` name to the URL to fetch.
118
+ * By default, the name is resolved relative to the OBJ URL, which fails for `data:` or `blob:` URLs
119
+ * (for example a bundler-inlined asset); use this to point at the real file.
120
+ */
121
+ resolveMaterialUrl?: (libraryName: string) => string;
122
+ /** Skip fetching .mtl files. */
123
+ ignoreMaterials?: boolean;
124
+ }
125
+
126
+ /** One `usemtl` range of an {@link ObjModel}: its index range and resolved material definition. */
127
+ export interface ObjSubMesh {
128
+ /** The material name from `usemtl`, or undefined for faces before any `usemtl`. */
129
+ readonly materialName?: string;
130
+ /** The material definition from the .mtl files, or undefined when there is none. */
131
+ readonly material?: ObjMaterialDefinition;
132
+ /** First index in `geometry.indices`. */
133
+ readonly indexStart: number;
134
+ /** Number of indices. */
135
+ readonly indexCount: number;
136
+ }
137
+
138
+ /** A parsed OBJ model (C# `ObjModel`): geometry, sub meshes and material definitions. No GPU resources. */
139
+ export interface ObjModel extends ObjLoadResult {
140
+ /** One entry per `usemtl` range, in file order. */
141
+ readonly subMeshes: ObjSubMesh[];
142
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * OBJ/MTL loader. Self-contained: no imports outside this folder.
3
+ */
4
+ export * from "./ObjTypes.ts";
5
+ export * from "./ObjParser.ts";