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,44 @@
1
+ import { ObjMaterialDefinition, type ObjLoadResult, type ObjLoadOptions, type ObjModel } from "./ObjTypes.js";
2
+ /**
3
+ * Parses .obj models (and their .mtl materials) from text or a URL into plain data.
4
+ * Engine-independent; uses only `fetch` and `URL`, and creates no GPU resources.
5
+ * `framework.objLoader` (or the static `ObjLoader.parseAsync`) builds on it.
6
+ */
7
+ export declare class ObjParser {
8
+ /**
9
+ * Parses .mtl text.
10
+ * @param text The .mtl contents.
11
+ * @returns The material definitions, in file order.
12
+ */
13
+ parseMtl(text: string): ObjMaterialDefinition[];
14
+ /**
15
+ * Parses .obj text.
16
+ * @param text The .obj contents.
17
+ * @param materials Material definitions to use for `usemtl`, e.g. from {@link parseMtl}. Default none.
18
+ * @returns The geometry, materials and raw data.
19
+ */
20
+ fromText(text: string, materials?: ObjMaterialDefinition[]): ObjLoadResult;
21
+ /**
22
+ * Loads an .obj file and the .mtl files it references with `mtllib`.
23
+ * A missing or failing .mtl is skipped (logged as a warning); the model still loads with white vertex colours.
24
+ * @param filePath The .obj URL.
25
+ * @param options Optional: how to resolve `mtllib` names, or skip materials.
26
+ * @returns The geometry, materials and raw data.
27
+ */
28
+ loadAsync(filePath: string, options?: ObjLoadOptions): Promise<ObjLoadResult>;
29
+ /**
30
+ * Loads an .obj file (and its .mtl files) into an {@link ObjModel}: the geometry plus one sub mesh per `usemtl`
31
+ * range with its resolved material definition.
32
+ * @param filePath The .obj URL.
33
+ * @param options Optional: how to resolve `mtllib` names, or skip materials.
34
+ * @returns The model.
35
+ */
36
+ parseAsync(filePath: string, options?: ObjLoadOptions): Promise<ObjModel>;
37
+ /**
38
+ * Turns a load result into an {@link ObjModel}.
39
+ * @param result The load result.
40
+ * @returns The model.
41
+ */
42
+ static toModel(result: ObjLoadResult): ObjModel;
43
+ }
44
+ //# sourceMappingURL=ObjParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjParser.d.ts","sourceRoot":"","sources":["../../../../src/api/loaders/obj/ObjParser.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAErB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EAEhB,MAAM,eAAe,CAAC;AAiBvB;;;;GAIG;AACH,qBAAa,SAAS;IAElB;;;;OAIG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,EAAE;IAqEtD;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,qBAAqB,EAAO,GAAG,aAAa;IAiHrF;;;;;;OAMG;IACU,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAyC1F;;;;;;OAMG;IACU,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAItF;;;;OAIG;WACW,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,QAAQ;CAYzD"}
@@ -0,0 +1,119 @@
1
+ /** An RGB colour as read from an .mtl file, each channel usually in 0..1. */
2
+ export type ObjColor = [r: number, g: number, b: number];
3
+ /**
4
+ * A material definition read from an .mtl file (`newmtl` block).
5
+ * This is plain data, not a GPU material; map it onto a framework material yourself.
6
+ */
7
+ export declare class ObjMaterialDefinition {
8
+ name: string;
9
+ /**
10
+ * The constructor.
11
+ * @param name The material name from `newmtl`.
12
+ */
13
+ constructor(name: string);
14
+ /** Ambient colour (`Ka`). */
15
+ ambientColor?: ObjColor;
16
+ /** Diffuse colour (`Kd`). */
17
+ diffuseColor?: ObjColor;
18
+ /** Specular colour (`Ks`). */
19
+ specularColor?: ObjColor;
20
+ /** Emissive colour (`Ke`). */
21
+ emissiveColor?: ObjColor;
22
+ /** Specular exponent (`Ns`). */
23
+ specularExponent?: number;
24
+ /** Opacity, from `d`, or `1 - Tr` when only `Tr` is given. */
25
+ opacity?: number;
26
+ /** Optical density / index of refraction (`Ni`). */
27
+ opticalDensity?: number;
28
+ /** Illumination model (`illum`). */
29
+ illuminationModel?: number;
30
+ /**
31
+ * Texture maps by statement name, e.g. `map_Kd`, `map_Ks`, `map_Bump`, `bump`, `disp`, `decal`, `refl`.
32
+ * The value is the file name (last token); map options such as `-bm 1` are kept in {@link mapOptions}.
33
+ */
34
+ maps: Record<string, string>;
35
+ /** Options written before the file name of a map statement, e.g. `{ map_Bump: "-bm 0.5" }`. */
36
+ mapOptions: Record<string, string>;
37
+ }
38
+ /** A run of triangles in the geometry's index buffer drawn with one material (`usemtl`). */
39
+ export interface ObjMaterialRange {
40
+ /** The material name from `usemtl`, or undefined for faces before any `usemtl`. */
41
+ readonly materialName?: string;
42
+ /** First index in `geometry.indices`. */
43
+ readonly indexStart: number;
44
+ /** Number of indices (3 per triangle). */
45
+ readonly indexCount: number;
46
+ }
47
+ /** The OBJ data exactly as listed in the file, before expansion. */
48
+ export interface ObjRawData {
49
+ /** `v` values, 3 per position. */
50
+ readonly positions: number[];
51
+ /** `vt` values, 2 per texture coordinate (a third `w` value is dropped). */
52
+ readonly textureCoords: number[];
53
+ /** `vn` values, 3 per normal. */
54
+ readonly normals: number[];
55
+ /**
56
+ * Triangulated face corners as zero-based `position, texcoord, normal` triplets.
57
+ * A missing texcoord or normal is -1.
58
+ */
59
+ readonly faceIndices: number[];
60
+ }
61
+ /**
62
+ * Renderable geometry as plain data: one vertex per unique position/texcoord/normal/material corner.
63
+ * Has no dependency on any engine; convert it to engine geometry yourself.
64
+ */
65
+ export interface ObjGeometryDefinition {
66
+ /** Positions, 3 per vertex. */
67
+ readonly positions: number[];
68
+ /** Texture coordinates, 2 per vertex (0,0 when the corner has none). */
69
+ readonly textureCoords: number[];
70
+ /** Normals, 3 per vertex (0,0,0 when the corner has none). */
71
+ readonly normals: number[];
72
+ /** RGBA colours, 4 per vertex: the material's `Kd` with alpha from `d`, white without a material. */
73
+ readonly colors: number[];
74
+ /** Triangle indices, 3 per triangle. */
75
+ readonly indices: number[];
76
+ /** Number of vertices (`positions.length / 3`). */
77
+ readonly vertexCount: number;
78
+ /** Index ranges per `usemtl`, in file order. */
79
+ readonly materialRanges: ObjMaterialRange[];
80
+ }
81
+ /** The result of loading an OBJ file. */
82
+ export interface ObjLoadResult {
83
+ /** The renderable geometry as plain data. */
84
+ readonly geometry: ObjGeometryDefinition;
85
+ /** Material definitions from the referenced .mtl files. Empty when there is no `mtllib` or it could not be loaded. */
86
+ readonly materials: ObjMaterialDefinition[];
87
+ /** Library file names from `mtllib`, in order. */
88
+ readonly materialLibraries: string[];
89
+ /** The raw OBJ lists. */
90
+ readonly raw: ObjRawData;
91
+ }
92
+ /** Options for {@link ObjParser.loadAsync} and `ObjLoader.loadAsync`. */
93
+ export interface ObjLoadOptions {
94
+ /**
95
+ * Maps an `mtllib` name to the URL to fetch.
96
+ * By default, the name is resolved relative to the OBJ URL, which fails for `data:` or `blob:` URLs
97
+ * (for example a bundler-inlined asset); use this to point at the real file.
98
+ */
99
+ resolveMaterialUrl?: (libraryName: string) => string;
100
+ /** Skip fetching .mtl files. */
101
+ ignoreMaterials?: boolean;
102
+ }
103
+ /** One `usemtl` range of an {@link ObjModel}: its index range and resolved material definition. */
104
+ export interface ObjSubMesh {
105
+ /** The material name from `usemtl`, or undefined for faces before any `usemtl`. */
106
+ readonly materialName?: string;
107
+ /** The material definition from the .mtl files, or undefined when there is none. */
108
+ readonly material?: ObjMaterialDefinition;
109
+ /** First index in `geometry.indices`. */
110
+ readonly indexStart: number;
111
+ /** Number of indices. */
112
+ readonly indexCount: number;
113
+ }
114
+ /** A parsed OBJ model (C# `ObjModel`): geometry, sub meshes and material definitions. No GPU resources. */
115
+ export interface ObjModel extends ObjLoadResult {
116
+ /** One entry per `usemtl` range, in file order. */
117
+ readonly subMeshes: ObjSubMesh[];
118
+ }
119
+ //# sourceMappingURL=ObjTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjTypes.d.ts","sourceRoot":"","sources":["../../../../src/api/loaders/obj/ObjTypes.ts"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM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yBAAyB;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B;AAED,2GAA2G;AAC3G,MAAM,WAAW,QAAS,SAAQ,aAAa;IAC3C,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC;CACpC"}
@@ -0,0 +1,3 @@
1
+ export * from "./ObjTypes.js";
2
+ export * from "./ObjParser.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/loaders/obj/index.ts"],"names":[],"mappings":"AAGA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,138 @@
1
+ import type { IRenderableMesh } from "../meshes/IRenderableMesh.js";
2
+ import type { ITexture2D } from "../rendering/texture/ITexture2D.js";
3
+ import type { ISampler } from "../rendering/sampler/ISampler.js";
4
+ import { GeometryFormat } from "../geometry/GeometryFormat.js";
5
+ import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
6
+ import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
7
+ import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
8
+ import type { IFramework } from "../IFramework.js";
9
+ import { Color } from "../data/Color.js";
10
+ import type { IPrimitiveState } from "../rendering/primitive/IPrimitiveState.js";
11
+ import type { ICamera } from "../camera/ICamera.js";
12
+ import type { AmbientLight } from "../lights/AmbientLight.js";
13
+ import type { DirectionalLight } from "../lights/DirectionalLight.js";
14
+ import type { PointLight } from "../lights/PointLight.js";
15
+ import type { ICameraMaterial } from "./ICameraMaterial.js";
16
+ import type { ILightsMaterial } from "./ILightsMaterial.js";
17
+ /**
18
+ * The additional material config options.
19
+ * @public
20
+ **/
21
+ export declare class ForwardBlinnPhongMaterialDescriptor {
22
+ /** The primitive state. */
23
+ primitiveState?: IPrimitiveState;
24
+ /** The projection view buffer. */
25
+ projectionViewBuffer: IUniformBuffer;
26
+ /** The camera position buffer. */
27
+ cameraPositionBuffer: IUniformBuffer;
28
+ }
29
+ /**
30
+ * The Blinn-Phong material with forward calculated lighting.
31
+ * @public
32
+ */
33
+ export declare class ForwardBlinnPhongMaterial implements ICameraMaterial, ILightsMaterial {
34
+ /** The directional light slots of the material's lights buffer and shader. */
35
+ static readonly MAX_DIRECTIONAL_LIGHTS = 3;
36
+ /** The point light slots of the material's lights buffer and shader. */
37
+ static readonly MAX_POINT_LIGHTS = 5;
38
+ private readonly _framework;
39
+ private readonly _lightsBuffer;
40
+ private _diffuseColorCache;
41
+ private _ambientColorCache;
42
+ private _specularColorCache;
43
+ private _shininessCache;
44
+ private _materialData;
45
+ /** Created when the model buffer is assigned (the pipeline requires one). */
46
+ private _pipeline?;
47
+ private readonly _primitiveState?;
48
+ /** Texture and sampler set before the pipeline exists; applied when it is created. */
49
+ private _pendingTexture?;
50
+ private _pendingSampler?;
51
+ private _samplerSet;
52
+ private _projectionViewBuffer;
53
+ private _camera?;
54
+ private _cameraPositionBuffer;
55
+ private _materialBuffer;
56
+ private _modelBuffer?;
57
+ /**
58
+ * The constructor.
59
+ * @param framework The framework.
60
+ * @param descriptor The material descriptor. Its projection view and camera position buffers are shared and are not disposed by this material.
61
+ * @throws Error when `descriptor`, `descriptor.projectionViewBuffer` or `descriptor.cameraPositionBuffer` is missing.
62
+ */
63
+ constructor(framework: IFramework, descriptor: ForwardBlinnPhongMaterialDescriptor);
64
+ /** Creates the pipeline with the current bindings. */
65
+ private _createPipeline;
66
+ /**
67
+ * The ambient color of this material.
68
+ * Alpha is ignored. By default, it is (0.1,0.1,0.1).
69
+ */
70
+ ambientColor: Color;
71
+ /**
72
+ * The diffuse color of this material.
73
+ * Alpha is ignored. By default, it is (0.8,0.8,0.8).
74
+ */
75
+ diffuseColor: Color;
76
+ /**
77
+ * The specular color of this material (MTL `Ks`).
78
+ * Alpha is ignored. By default, it is (0.5,0.5,0.5).
79
+ */
80
+ specularColor: Color;
81
+ /**
82
+ * The specular exponent (MTL `Ns`). Higher values give smaller, sharper highlights. By default, it is 32.
83
+ */
84
+ shininess: number;
85
+ /**
86
+ * The camera. Setting it binds the camera's projection view and position buffers to the pipeline
87
+ * (used by the scene when its camera changes). Setting undefined keeps the last bound buffers.
88
+ * Undefined until set: the constructor only takes the buffers.
89
+ */
90
+ get camera(): ICamera | undefined;
91
+ /** @inheritDoc */
92
+ set camera(camera: ICamera | undefined);
93
+ /** @inheritDoc Defaults to a black ambient light; a `Scene` assigns its active ambient light. */
94
+ get ambientLight(): AmbientLight;
95
+ set ambientLight(value: AmbientLight);
96
+ /** @inheritDoc Only the first 3 are used. A `Scene` assigns its own list. */
97
+ get directionalLights(): DirectionalLight[];
98
+ set directionalLights(value: DirectionalLight[]);
99
+ /** @inheritDoc Only the first 5 are used. A `Scene` assigns its own list. */
100
+ get pointLights(): PointLight[];
101
+ set pointLights(value: PointLight[]);
102
+ /**
103
+ * The texture to inspect.
104
+ */
105
+ get diffuseTexture(): ITexture2D;
106
+ /**
107
+ * The texture to inspect.
108
+ */
109
+ set diffuseTexture(value: ITexture2D);
110
+ /**
111
+ * The texture sampler.
112
+ */
113
+ get diffuseTextureSampler(): ISampler | undefined;
114
+ /**
115
+ * The texture sampler.
116
+ */
117
+ set diffuseTextureSampler(value: ISampler | undefined);
118
+ /**
119
+ * The model buffer (std140 `mat4`). Owned by the mesh, which assigns it before drawing; never disposed by this material.
120
+ * Undefined until assigned: rendering without one throws.
121
+ */
122
+ get modelBuffer(): IUniformBuffer | undefined;
123
+ /** Binds the model buffer to the pipeline. */
124
+ set modelBuffer(value: IUniformBuffer | undefined);
125
+ /**
126
+ * The geometry format.
127
+ */
128
+ readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2_NORMAL3;
129
+ /** @inheritDoc */
130
+ beforeRender(): void;
131
+ /** @inheritDoc */
132
+ renderMesh(mesh: IRenderableMesh): void;
133
+ /** @inheritDoc */
134
+ render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
135
+ /** @inheritDoc */
136
+ dispose(): void;
137
+ }
138
+ //# sourceMappingURL=ForwardBlinnPhongMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForwardBlinnPhongMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/ForwardBlinnPhongMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAC,KAAK,EAAC,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAElD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAG1D;;;IAGI;AACJ,qBAAa,mCAAmC;IAE5C,2BAA2B;IACpB,cAAc,CAAC,EAAE,eAAe,CAA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+ * A material that renders with a camera (unlit, Blinn-Phong, inspect mips).
5
+ * A `Scene` assigns its camera to these materials in `scene.update()`.
6
+ * @public
7
+ */
8
+ export interface ICameraMaterial extends IMaterial {
9
+ /** The camera. Setting it binds the camera's buffers. */
10
+ camera?: ICamera;
11
+ }
12
+ /**
13
+ * Whether a material is an {@link ICameraMaterial}.
14
+ * @param material The material.
15
+ * @public
16
+ */
17
+ export declare function isCameraMaterial(material: IMaterial | undefined): material is ICameraMaterial;
18
+ //# sourceMappingURL=ICameraMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICameraMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/ICameraMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAE9C,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,IAAI,eAAe,CAE7F"}
@@ -0,0 +1,26 @@
1
+ import type { IMaterial } from "./IMaterial.js";
2
+ import type { AmbientLight } from "../lights/AmbientLight.js";
3
+ import type { DirectionalLight } from "../lights/DirectionalLight.js";
4
+ import type { PointLight } from "../lights/PointLight.js";
5
+ /**
6
+ * A material lit by an ambient light, directional lights and point lights (Blinn-Phong).
7
+ * The material owns its lights buffer and uploads it only when the lights changed.
8
+ * A `Scene` hands each lights material its active ambient light and its own light lists (the same arrays, not copies)
9
+ * in `scene.update()`, so lights added to the scene reach every lit material.
10
+ * @public
11
+ */
12
+ export interface ILightsMaterial extends IMaterial {
13
+ /** The ambient light. */
14
+ ambientLight: AmbientLight;
15
+ /** The directional lights. The list is used by reference and may be edited; extra lights beyond the slots are ignored. */
16
+ directionalLights: DirectionalLight[];
17
+ /** The point lights. The list is used by reference and may be edited; extra lights beyond the slots are ignored. */
18
+ pointLights: PointLight[];
19
+ }
20
+ /**
21
+ * Whether a material is an {@link ILightsMaterial}.
22
+ * @param material The material.
23
+ * @public
24
+ */
25
+ export declare function isLightsMaterial(material: IMaterial | undefined): material is ILightsMaterial;
26
+ //# sourceMappingURL=ILightsMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILightsMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/ILightsMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAE9C,yBAAyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAE3B,0HAA0H;IAC1H,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAEtC,oHAAoH;IACpH,WAAW,EAAE,UAAU,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,IAAI,eAAe,CAE7F"}
@@ -1,35 +1,38 @@
1
- import { mat4 } from "gl-matrix";
2
1
  import type { IDisposable } from "../core/IDisposable.js";
3
2
  import { GeometryFormat } from "../geometry/GeometryFormat.js";
4
- import type { IMesh } from "../meshes/IMesh.js";
3
+ import type { IRenderableMesh } from "../meshes/IRenderableMesh.js";
5
4
  import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
6
5
  import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
6
+ import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
7
7
  /**
8
8
  * The material interface.
9
+ * @public
9
10
  */
10
11
  export interface IMaterial extends IDisposable {
11
12
  /**
12
- * The model matrix.
13
- */
14
- modelMatrix: mat4;
15
- /**
16
- * The geometry format required by the material.
13
+ * The model buffer (std140 `mat4`) for materials that use one (unlit, Blinn-Phong, inspect mips).
14
+ * A mesh owns it and assigns it before drawing, like the scene assigns its camera; materials never dispose it.
15
+ * Materials without the property (e.g. the sprite material) are left alone.
17
16
  */
17
+ modelBuffer?: IUniformBuffer;
18
+ /** The geometry format required by the material.*/
18
19
  readonly geometryFormat: GeometryFormat;
19
20
  /**
20
21
  * Called before rendering.
21
22
  */
22
23
  beforeRender(): void;
23
24
  /**
24
- * Renders the material.
25
+ * Renders the mesh with this material, honouring the mesh's index range.
25
26
  * @param mesh - The mesh.
26
27
  */
27
- renderMesh(mesh: IMesh): void;
28
+ renderMesh(mesh: IRenderableMesh): void;
28
29
  /**
29
30
  * Renders the material.
30
31
  * @param vertexBuffer - The vertex buffer.
31
32
  * @param indexBuffer - The index buffer.
33
+ * @param indicesCount - The number of indices to draw. -1 or undefined draws all.
34
+ * @param indicesOffset - The first index to draw. Defaults to 0.
32
35
  */
33
- render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer): void;
36
+ render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
34
37
  }
35
38
  //# sourceMappingURL=IMaterial.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/IMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC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EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAEvH"}
@@ -1,5 +1,7 @@
1
1
  import { InspectTextureMipsMaterial } from "./InspectTextureMipsMaterial.js";
2
+ import type { SpriteMaterial, SpriteMaterialDescriptor } from "./SpriteMaterial.js";
2
3
  import { UnlitMaterial, UnlitMaterialDescriptor } from "./UnlitMaterial.js";
4
+ import type { ForwardBlinnPhongMaterial, ForwardBlinnPhongMaterialDescriptor } from "./ForwardBlinnPhongMaterial.js";
3
5
  /**
4
6
  * The material factory.
5
7
  */
@@ -11,9 +13,22 @@ export interface IMaterialFactory {
11
13
  createInspectTextureMipsMaterial(): InspectTextureMipsMaterial;
12
14
  /**
13
15
  * Creates an unlit material.
14
- * @param config The optional additional configuration options for material, such as rendering options.
16
+ * @param descriptor The optional additional configuration options for material, such as rendering options.
15
17
  * @returns The Unlit Material.
16
18
  */
17
- createUnlitMaterial(config?: UnlitMaterialDescriptor): UnlitMaterial;
19
+ createUnlitMaterial(descriptor?: UnlitMaterialDescriptor): UnlitMaterial;
20
+ /**
21
+ * Creates a sprite material.
22
+ * @param descriptor The sprite material descriptor with projection view buffer, texture and sampler.
23
+ * @returns The Sprite Material.
24
+ */
25
+ createSpriteMaterial(descriptor: SpriteMaterialDescriptor): SpriteMaterial;
26
+ /**
27
+ * Creates a Blinn-Phong material with forward calculated lighting.
28
+ * @param descriptor The configuration: the required projection view and camera position buffers, plus optional lights buffer and primitive state.
29
+ * @throws Error when a required buffer is missing.
30
+ * @returns The Forward Blinn-Phong Material.
31
+ */
32
+ createForwardBlinnPhongMaterial(descriptor: ForwardBlinnPhongMaterialDescriptor): ForwardBlinnPhongMaterial;
18
33
  }
19
34
  //# sourceMappingURL=IMaterialFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IMaterialFactory.d.ts","sourceRoot":"","sources":["../../../src/api/material/IMaterialFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAE7B;;;OAGG;IACH,gCAAgC,IAAI,0BAA0B,CAAC;IAE/D;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,aAAa,CAAC;CACxE"}
1
+ {"version":3,"file":"IMaterialFactory.d.ts","sourceRoot":"","sources":["../../../src/api/material/IMaterialFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAC,cAAc,EAAE,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAC,yBAAyB,EAAE,mCAAmC,EAAC,MAAM,gCAAgC,CAAC;AAEnH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAE7B;;;OAGG;IACH,gCAAgC,IAAI,0BAA0B,CAAC;IAE/D;;;;OAIG;IACH,mBAAmB,CAAC,UAAU,CAAC,EAAE,uBAAuB,GAAG,aAAa,CAAC;IAEzE;;;;OAIG;IACH,oBAAoB,CAAC,UAAU,EAAE,wBAAwB,GAAG,cAAc,CAAC;IAE3E;;;;;OAKG;IACH,+BAA+B,CAAC,UAAU,EAAE,mCAAmC,GAAG,yBAAyB,CAAC;CAC/G"}
@@ -1,8 +1,8 @@
1
- import type { IMesh } from "../meshes/IMesh.js";
1
+ import type { IRenderableMesh } from "../meshes/IRenderableMesh.js";
2
2
  import type { ITexture2D } from "../rendering/texture/ITexture2D.js";
3
3
  import type { ISampler } from "../rendering/sampler/ISampler.js";
4
- import { mat4 } from "gl-matrix";
5
4
  import { GeometryFormat } from "../geometry/GeometryFormat.js";
5
+ import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
6
6
  import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
7
7
  import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
8
8
  import type { IFramework } from "../IFramework.js";
@@ -12,12 +12,18 @@ import type { IFramework } from "../IFramework.js";
12
12
  export declare class InspectTextureMipsMaterial {
13
13
  private readonly _framework;
14
14
  private _mipLevel;
15
- private _pipeline;
15
+ /** Created when the model buffer is assigned (the pipeline requires one). */
16
+ private _pipeline?;
17
+ /** Texture and sampler set before the pipeline exists; applied when it is created. */
18
+ private _pendingTexture?;
19
+ private _pendingSampler?;
20
+ private _samplerSet;
16
21
  private _projectionViewBuffer;
17
22
  private _fragmentDataBuffer;
18
- private _modelBuffer;
19
- private _previousModelMatrix;
23
+ private _modelBuffer?;
20
24
  constructor(framework: IFramework);
25
+ /** Creates the pipeline with the current bindings. */
26
+ private _createPipeline;
21
27
  /**
22
28
  * The mip level to inspect.
23
29
  */
@@ -39,9 +45,12 @@ export declare class InspectTextureMipsMaterial {
39
45
  */
40
46
  set textureSampler(value: ISampler | undefined);
41
47
  /**
42
- * The model matrix.
48
+ * The model buffer (std140 `mat4`). Owned by the mesh, which assigns it before drawing; never disposed by this material.
49
+ * Undefined until assigned: rendering without one throws.
43
50
  */
44
- modelMatrix: mat4;
51
+ get modelBuffer(): IUniformBuffer | undefined;
52
+ /** Binds the model buffer to the pipeline. */
53
+ set modelBuffer(value: IUniformBuffer | undefined);
45
54
  /**
46
55
  * The geometry format.
47
56
  */
@@ -49,9 +58,9 @@ export declare class InspectTextureMipsMaterial {
49
58
  /** @inheritDoc */
50
59
  beforeRender(): void;
51
60
  /** @inheritDoc */
52
- renderMesh(mesh: IMesh): void;
61
+ renderMesh(mesh: IRenderableMesh): void;
53
62
  /** @inheritDoc */
54
- render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer): void;
63
+ render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
55
64
  /** @inheritDoc */
56
65
  dispose(): void;
57
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InspectTextureMipsMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/InspectTextureMipsMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD;;GAEG;AACH,qBAAa,0BAA0B;IAEnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,SAAS,CAAO;IACxB,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,qBAAqB,CAAiB;IAC9C,OAAO,CAAC,mBAAmB,CAAiB;IAC5C,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,oBAAoB,CAAiB;gBAE1B,SAAS,EAAE,UAAU;IAcxC;;OAEG;IACI,QAAQ,EAAE,MAAM,CAAK;IAE5B;;OAEG;IACH,IAAW,OAAO,IAAI,UAAU,CAE/B;IAED;;OAEG;IACH,IAAW,OAAO,CAAC,KAAK,EAAE,UAAU,EAEnC;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,QAAQ,GAAG,SAAS,CAEhD;IAED;;OAEG;IACH,IAAW,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAEpD;IAED;;OAEG;IACI,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AC,CAAiB;gBAEnB,SAAS,EAAE,UAAU;IAQxC,sDAAsD;IACtD,OAAO,CAAC,eAAe;IAgBvB;;OAEG;IACI,QAAQ,EAAE,MAAM,CAAK;IAE5B;;OAEG;IACH,IAAW,OAAO,IAAI,UAAU,CAE/B;IAED;;OAEG;IACH,IAAW,OAAO,CAAC,KAAK,EAAE,UAAU,EAKnC;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,QAAQ,GAAG,SAAS,CAEhD;IAED;;OAEG;IACH,IAAW,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAMpD;IAED;;;OAGG;IACH,IAAW,WAAW,IAAI,cAAc,GAAG,SAAS,CAEnD;IAED,8CAA8C;IAC9C,IAAW,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,EAavD;IAED;;OAEG;IACH,SAAgB,cAAc,6CAA6C;IAE3E,kBAAkB;IACX,YAAY,IAAI,IAAI;IAO3B,kBAAkB;IACX,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAI9C,kBAAkB;IACX,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IAO1H,kBAAkB;IACX,OAAO,IAAI,IAAI;CAMzB"}
@@ -1,7 +1,9 @@
1
1
  import { InspectTextureMipsMaterial } from "./InspectTextureMipsMaterial.js";
2
2
  import type { IFramework } from "../IFramework.js";
3
3
  import type { IMaterialFactory } from "./IMaterialFactory.js";
4
+ import { SpriteMaterial, type SpriteMaterialDescriptor } from "./SpriteMaterial.js";
4
5
  import { UnlitMaterial, UnlitMaterialDescriptor } from "./UnlitMaterial.js";
6
+ import { ForwardBlinnPhongMaterial, type ForwardBlinnPhongMaterialDescriptor } from "./ForwardBlinnPhongMaterial.js";
5
7
  /**
6
8
  * The material factory.
7
9
  */
@@ -16,5 +18,9 @@ export declare class MaterialFactory implements IMaterialFactory {
16
18
  createInspectTextureMipsMaterial(): InspectTextureMipsMaterial;
17
19
  /** @inheritDoc */
18
20
  createUnlitMaterial(descriptor?: UnlitMaterialDescriptor): UnlitMaterial;
21
+ /** @inheritDoc */
22
+ createSpriteMaterial(descriptor: SpriteMaterialDescriptor): SpriteMaterial;
23
+ /** @inheritDoc */
24
+ createForwardBlinnPhongMaterial(descriptor: ForwardBlinnPhongMaterialDescriptor): ForwardBlinnPhongMaterial;
19
25
  }
20
26
  //# sourceMappingURL=MaterialFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialFactory.d.ts","sourceRoot":"","sources":["../../../src/api/material/MaterialFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAE1E;;GAEG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IAMjC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ9C;;;OAGG;gBACiC,UAAU,EAAE,UAAU;IAG1D,kBAAkB;IACX,gCAAgC,IAAI,0BAA0B;IAIrE,kBAAkB;IACX,mBAAmB,CAAC,UAAU,CAAC,EAAG,uBAAuB,GAAG,aAAa;CAGnF"}
1
+ {"version":3,"file":"MaterialFactory.d.ts","sourceRoot":"","sources":["../../../src/api/material/MaterialFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAC,cAAc,EAAE,KAAK,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAC,yBAAyB,EAAE,KAAK,mCAAmC,EAAC,MAAM,gCAAgC,CAAC;AAEnH;;GAEG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IAMjC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ9C;;;OAGG;gBACiC,UAAU,EAAE,UAAU;IAG1D,kBAAkB;IACX,gCAAgC,IAAI,0BAA0B;IAIrE,kBAAkB;IACX,mBAAmB,CAAC,UAAU,CAAC,EAAG,uBAAuB,GAAG,aAAa;IAIhF,kBAAkB;IACX,oBAAoB,CAAC,UAAU,EAAE,wBAAwB,GAAG,cAAc;IAIjF,kBAAkB;IACX,+BAA+B,CAAC,UAAU,EAAE,mCAAmC,GAAG,yBAAyB;CAGrH"}
@@ -0,0 +1,51 @@
1
+ import type { GeometryFormat } from "../geometry/GeometryFormat.js";
2
+ import type { IRenderableMesh } from "../meshes/IRenderableMesh.js";
3
+ import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
4
+ import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
5
+ import type { ITexture2D } from "../rendering/texture/ITexture2D.js";
6
+ import type { ISampler } from "../rendering/sampler/ISampler.js";
7
+ import type { IFramework } from "../IFramework.js";
8
+ import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
9
+ import type { IMaterial } from "./IMaterial.js";
10
+ /** The sprite material descriptor. */
11
+ export interface SpriteMaterialDescriptor {
12
+ /** The projection view buffer. Shared, it is not disposed by the material. */
13
+ projectionViewBuffer: IUniformBuffer;
14
+ /** The sprite texture. */
15
+ texture: ITexture2D;
16
+ /** The texture sampler. */
17
+ sampler: ISampler;
18
+ }
19
+ /**
20
+ * The sprite material.
21
+ */
22
+ export declare class SpriteMaterial implements IMaterial {
23
+ private readonly _renderPipeline;
24
+ /**
25
+ * The constructor.
26
+ * @param framework - The framework.
27
+ * @param descriptor - The sprite material descriptor.
28
+ */
29
+ constructor(framework: IFramework, descriptor: SpriteMaterialDescriptor);
30
+ /** @inheritDoc */
31
+ get geometryFormat(): GeometryFormat;
32
+ /** The sprite texture. */
33
+ get texture(): ITexture2D;
34
+ /** The sprite texture. */
35
+ set texture(value: ITexture2D);
36
+ /** @inheritDoc */
37
+ beforeRender(): void;
38
+ /** @inheritDoc */
39
+ renderMesh(mesh: IRenderableMesh): void;
40
+ /**
41
+ * Renders the material.
42
+ * @param vertexBuffer - The vertex buffer.
43
+ * @param indexBuffer - The index buffer.
44
+ * @param indicesCount - The number of indices to draw. If -1 draws all indices.
45
+ * @param indicesOffset - Indices offset. Defaults to 0.
46
+ */
47
+ render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
48
+ /** @inheritDoc */
49
+ dispose(): void;
50
+ }
51
+ //# sourceMappingURL=SpriteMaterial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpriteMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/SpriteMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,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