ris-framework 0.1.0-dev.6 → 0.1.0-dev.7

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 (177) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSES/Apache-2.0.txt +202 -0
  3. package/README.md +28 -11
  4. package/THIRD_PARTY_NOTICES.md +27 -0
  5. package/dist/TextureFormat.d.ts +2 -0
  6. package/dist/TextureFormat.d.ts.map +1 -0
  7. package/dist/VertexFormat.d.ts +14 -0
  8. package/dist/VertexFormat.d.ts.map +1 -0
  9. package/dist/_ris-ktx2-node-module-stub-nzBRmiO_.js +10 -0
  10. package/dist/common/sampler-enums.d.ts +16 -0
  11. package/dist/common/sampler-enums.d.ts.map +1 -0
  12. package/dist/common/vertex-step-mode.d.ts +11 -0
  13. package/dist/common/vertex-step-mode.d.ts.map +1 -0
  14. package/dist/content/ShaderModuleContent.d.ts +14 -0
  15. package/dist/content/ShaderModuleContent.d.ts.map +1 -0
  16. package/dist/core/Framework.d.ts +79 -0
  17. package/dist/core/Framework.d.ts.map +1 -0
  18. package/dist/core/FrameworkConfig.d.ts +26 -0
  19. package/dist/core/FrameworkConfig.d.ts.map +1 -0
  20. package/dist/core/buffers/buffers-factory-interface.d.ts +2 -0
  21. package/dist/core/buffers/buffers-factory-interface.d.ts.map +1 -0
  22. package/dist/core/buffers/vertex-buffer-interface.d.ts +2 -0
  23. package/dist/core/buffers/vertex-buffer-interface.d.ts.map +1 -0
  24. package/dist/core/content/ContentManager.d.ts +26 -0
  25. package/dist/core/content/ContentManager.d.ts.map +1 -0
  26. package/dist/core/dependency-injection/register-services-interface.d.ts +13 -0
  27. package/dist/core/dependency-injection/register-services-interface.d.ts.map +1 -0
  28. package/dist/core/framework-interface.d.ts +2 -0
  29. package/dist/core/framework-interface.d.ts.map +1 -0
  30. package/dist/core/input/InputManager.d.ts +27 -0
  31. package/dist/core/input/InputManager.d.ts.map +1 -0
  32. package/dist/core/renderer/enums.d.ts +18 -0
  33. package/dist/core/renderer/enums.d.ts.map +1 -0
  34. package/dist/core/renderer/renderer-interface.d.ts +77 -0
  35. package/dist/core/renderer/renderer-interface.d.ts.map +1 -0
  36. package/dist/core/renderer/rendering-limits.d.ts +16 -0
  37. package/dist/core/renderer/rendering-limits.d.ts.map +1 -0
  38. package/dist/core/rendering/AGraphicsDevice.d.ts +69 -0
  39. package/dist/core/rendering/AGraphicsDevice.d.ts.map +1 -0
  40. package/dist/core/rendering/ARenderer.d.ts +75 -0
  41. package/dist/core/rendering/ARenderer.d.ts.map +1 -0
  42. package/dist/core/rendering/blending/blend-component-descriptor.d.ts +25 -0
  43. package/dist/core/rendering/blending/blend-component-descriptor.d.ts.map +1 -0
  44. package/dist/core/rendering/blending/blend-state-descriptor.d.ts +29 -0
  45. package/dist/core/rendering/blending/blend-state-descriptor.d.ts.map +1 -0
  46. package/dist/core/rendering/blending/enums.d.ts +40 -0
  47. package/dist/core/rendering/blending/enums.d.ts.map +1 -0
  48. package/dist/core/rendering/enums.d.ts +20 -0
  49. package/dist/core/rendering/enums.d.ts.map +1 -0
  50. package/dist/core/rendering/primitive/PrimitiveStateDescriptor.d.ts +26 -0
  51. package/dist/core/rendering/primitive/PrimitiveStateDescriptor.d.ts.map +1 -0
  52. package/dist/core/rendering/primitive/enums.d.ts +56 -0
  53. package/dist/core/rendering/primitive/enums.d.ts.map +1 -0
  54. package/dist/core/rendering/render-pass/render-pass-descriptor.d.ts +2 -0
  55. package/dist/core/rendering/render-pass/render-pass-descriptor.d.ts.map +1 -0
  56. package/dist/core/rendering/render-pass/render-pass-interface.d.ts +15 -0
  57. package/dist/core/rendering/render-pass/render-pass-interface.d.ts.map +1 -0
  58. package/dist/core/rendering/sampler/sampler-descriptor.d.ts +28 -0
  59. package/dist/core/rendering/sampler/sampler-descriptor.d.ts.map +1 -0
  60. package/dist/core/rendering/texture/texture.d.ts +69 -0
  61. package/dist/core/rendering/texture/texture.d.ts.map +1 -0
  62. package/dist/core/rendering/vertex-attribute.d.ts +17 -0
  63. package/dist/core/rendering/vertex-attribute.d.ts.map +1 -0
  64. package/dist/core/rendering/vertex-buffer-layout.d.ts +23 -0
  65. package/dist/core/rendering/vertex-buffer-layout.d.ts.map +1 -0
  66. package/dist/core/shader/shader-loader.d.ts +12 -0
  67. package/dist/core/shader/shader-loader.d.ts.map +1 -0
  68. package/dist/core/shader/shader-module-interface.d.ts +2 -0
  69. package/dist/core/shader/shader-module-interface.d.ts.map +1 -0
  70. package/dist/core/sprite-batch/SpriteBatch.d.ts +50 -0
  71. package/dist/core/sprite-batch/SpriteBatch.d.ts.map +1 -0
  72. package/dist/core/sprite-batch/SpriteBatchDrawable.d.ts +57 -0
  73. package/dist/core/sprite-batch/SpriteBatchDrawable.d.ts.map +1 -0
  74. package/dist/core/sprite-batch/SpriteBatchMesh.d.ts +32 -0
  75. package/dist/core/sprite-batch/SpriteBatchMesh.d.ts.map +1 -0
  76. package/dist/core/window/window-manager.d.ts +32 -0
  77. package/dist/core/window/window-manager.d.ts.map +1 -0
  78. package/dist/geometry/BaseGeometry.d.ts +41 -0
  79. package/dist/geometry/BaseGeometry.d.ts.map +1 -0
  80. package/dist/geometry/GeometryBuilder.d.ts +11 -0
  81. package/dist/geometry/GeometryBuilder.d.ts.map +1 -0
  82. package/dist/geometry/GeometryFormat.d.ts +34 -0
  83. package/dist/geometry/GeometryFormat.d.ts.map +1 -0
  84. package/dist/index.d.ts +4 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +4598 -0
  87. package/dist/libktx-Cjh8w7XG-DhnH9lxr.js +4 -0
  88. package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts +31 -0
  89. package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts.map +1 -0
  90. package/dist/webgl/WebGlGpuInfo.d.ts +25 -0
  91. package/dist/webgl/WebGlGpuInfo.d.ts.map +1 -0
  92. package/dist/webgl/WebGlGraphicsDevice.d.ts +45 -0
  93. package/dist/webgl/WebGlGraphicsDevice.d.ts.map +1 -0
  94. package/dist/webgl/WebGlRenderer.d.ts +18 -0
  95. package/dist/webgl/WebGlRenderer.d.ts.map +1 -0
  96. package/dist/webgl/blending/webgl-blend-state.d.ts +33 -0
  97. package/dist/webgl/blending/webgl-blend-state.d.ts.map +1 -0
  98. package/dist/webgl/buffers/WebGlBuffersFactory.d.ts +16 -0
  99. package/dist/webgl/buffers/WebGlBuffersFactory.d.ts.map +1 -0
  100. package/dist/webgl/buffers/WebGlUniformBuffer.d.ts +34 -0
  101. package/dist/webgl/buffers/WebGlUniformBuffer.d.ts.map +1 -0
  102. package/dist/webgl/buffers/WebGlVertexBuffer.d.ts +48 -0
  103. package/dist/webgl/buffers/WebGlVertexBuffer.d.ts.map +1 -0
  104. package/dist/webgl/buffers/webgl-index-buffer.d.ts +43 -0
  105. package/dist/webgl/buffers/webgl-index-buffer.d.ts.map +1 -0
  106. package/dist/webgl/cast/cast.d.ts +52 -0
  107. package/dist/webgl/cast/cast.d.ts.map +1 -0
  108. package/dist/webgl/primitive/WebGlPrimitiveState.d.ts +31 -0
  109. package/dist/webgl/primitive/WebGlPrimitiveState.d.ts.map +1 -0
  110. package/dist/webgl/render-pass/WebGlRenderPass.d.ts +34 -0
  111. package/dist/webgl/render-pass/WebGlRenderPass.d.ts.map +1 -0
  112. package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts +53 -0
  113. package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts.map +1 -0
  114. package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts +28 -0
  115. package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts.map +1 -0
  116. package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts +24 -0
  117. package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts.map +1 -0
  118. package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts +57 -0
  119. package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts.map +1 -0
  120. package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts +57 -0
  121. package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts.map +1 -0
  122. package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts +40 -0
  123. package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts.map +1 -0
  124. package/dist/webgl/rendering/webgl-vertex-attribute.d.ts +10 -0
  125. package/dist/webgl/rendering/webgl-vertex-attribute.d.ts.map +1 -0
  126. package/dist/webgl/rendering/webgl-vertex-buffer-layout.d.ts +27 -0
  127. package/dist/webgl/rendering/webgl-vertex-buffer-layout.d.ts.map +1 -0
  128. package/dist/webgl/sampler/webgl-sampler.d.ts +48 -0
  129. package/dist/webgl/sampler/webgl-sampler.d.ts.map +1 -0
  130. package/dist/webgl/shader/WebGlShaderModule.d.ts +34 -0
  131. package/dist/webgl/shader/WebGlShaderModule.d.ts.map +1 -0
  132. package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts +19 -0
  133. package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts.map +1 -0
  134. package/dist/webgl/swap-chain/WebGlSwapChain.d.ts +27 -0
  135. package/dist/webgl/swap-chain/WebGlSwapChain.d.ts.map +1 -0
  136. package/dist/webgl/texture/WebGlTexture2D.d.ts +37 -0
  137. package/dist/webgl/texture/WebGlTexture2D.d.ts.map +1 -0
  138. package/dist/webgl/texture/WebGlTextureFactory.d.ts +17 -0
  139. package/dist/webgl/texture/WebGlTextureFactory.d.ts.map +1 -0
  140. package/dist/webgl/utilities/WebGlBufferUtilities.d.ts +45 -0
  141. package/dist/webgl/utilities/WebGlBufferUtilities.d.ts.map +1 -0
  142. package/dist/webgl/utilities/WebGlConverter.d.ts +124 -0
  143. package/dist/webgl/utilities/WebGlConverter.d.ts.map +1 -0
  144. package/dist/webgl/utilities/WebGlFrameBufferUtilities.d.ts +54 -0
  145. package/dist/webgl/utilities/WebGlFrameBufferUtilities.d.ts.map +1 -0
  146. package/dist/webgl/utilities/WebGlSamplerUtilities.d.ts +23 -0
  147. package/dist/webgl/utilities/WebGlSamplerUtilities.d.ts.map +1 -0
  148. package/dist/webgl/utilities/WebGlShaderUtilities.d.ts +28 -0
  149. package/dist/webgl/utilities/WebGlShaderUtilities.d.ts.map +1 -0
  150. package/dist/webgl/utilities/WebGlTextureUtilities.d.ts +33 -0
  151. package/dist/webgl/utilities/WebGlTextureUtilities.d.ts.map +1 -0
  152. package/dist/webgl/utilities/WebGlUtilities.d.ts +60 -0
  153. package/dist/webgl/utilities/WebGlUtilities.d.ts.map +1 -0
  154. package/dist/webgl/utilities/spector-js-utilities.d.ts +9 -0
  155. package/dist/webgl/utilities/spector-js-utilities.d.ts.map +1 -0
  156. package/dist/webgl/utilities/webgl-blending-utilities.d.ts +17 -0
  157. package/dist/webgl/utilities/webgl-blending-utilities.d.ts.map +1 -0
  158. package/dist/webgl/utilities/webgl-culling-utilities.d.ts +13 -0
  159. package/dist/webgl/utilities/webgl-culling-utilities.d.ts.map +1 -0
  160. package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts +24 -0
  161. package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts.map +1 -0
  162. package/dist/webgl/utilities/webgl-program-utilities.d.ts +14 -0
  163. package/dist/webgl/utilities/webgl-program-utilities.d.ts.map +1 -0
  164. package/dist/webgl/utilities/webgl-render-buffer-utilities.d.ts +5 -0
  165. package/dist/webgl/utilities/webgl-render-buffer-utilities.d.ts.map +1 -0
  166. package/dist/webgl/utilities/webgl-renderbuffer-utilities.d.ts +17 -0
  167. package/dist/webgl/utilities/webgl-renderbuffer-utilities.d.ts.map +1 -0
  168. package/package.json +15 -9
  169. package/src/glsl-raw.d.ts +4 -0
  170. package/dist/assets/_ris-ktx2-node-module-stub-DwDS30PT.js +0 -1
  171. package/dist/assets/cat.jpg +0 -0
  172. package/dist/assets/index-BmeGit54.css +0 -1
  173. package/dist/assets/index-qyn4pzGw.js +0 -151
  174. package/dist/assets/libktx-Cjh8w7XG-Ci1Fm_MH.js +0 -1
  175. package/dist/assets/test.png +0 -0
  176. package/dist/index.html +0 -16
  177. package/dist/vite.svg +0 -1
@@ -0,0 +1,40 @@
1
+ import type { IFramework, ISampler, ISpriteRenderPipeline, ITexture2D, IUniformBuffer, IVertexBuffer } from "ris-framework-api";
2
+ import { AWebGlRenderPipeline } from "../AWebGlRenderPipeline.js";
3
+ import { type IIndexBuffer } from "ris-framework-api";
4
+ /**
5
+ * The WebGL implementation of the sprite render pipeline.
6
+ */
7
+ export declare class WebGlSpriteRenderPipeline extends AWebGlRenderPipeline implements ISpriteRenderPipeline {
8
+ private static readonly CAMERA_BINDING_POINT;
9
+ private _texture;
10
+ private _sampler?;
11
+ private _projectionViewBuffer;
12
+ private _cameraBlockIndex;
13
+ private _buffersArray;
14
+ private _lastVertexBuffer;
15
+ /**
16
+ * The constructor.
17
+ * @param framework The framework.
18
+ * @param projectionViewBuffer The projection view buffer.
19
+ */
20
+ constructor(framework: IFramework, projectionViewBuffer: IUniformBuffer);
21
+ /** @inheritdoc */
22
+ get projectionViewBuffer(): IUniformBuffer;
23
+ /** @inheritdoc */
24
+ set projectionViewBuffer(value: IUniformBuffer);
25
+ /** @inheritdoc */
26
+ get spriteTexture(): ITexture2D;
27
+ /** @inheritdoc */
28
+ set spriteTexture(value: ITexture2D);
29
+ /** @inheritdoc */
30
+ get textureSampler(): ISampler | undefined;
31
+ set textureSampler(value: ISampler | undefined);
32
+ /** @inheritdoc */
33
+ initialize(): void;
34
+ private _createResources;
35
+ /** @inheritdoc */
36
+ protected _provideBuffers(): WebGLBuffer[] | undefined | null;
37
+ /** @inheritdoc */
38
+ render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
39
+ }
40
+ //# sourceMappingURL=WebGlSpriteRenderPipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlSpriteRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,UAAU,EACV,QAAQ,EACR,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,aAAa,EAChB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAC,KAAK,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAGrE;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,oBAAqB,YAAW,qBAAqB;IAEhG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAa;IAEzD,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,qBAAqB,CAAqB;IAClD,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,iBAAiB,CAAkC;IAE3D;;;;OAIG;gBACS,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,cAAc;IAKvE,kBAAkB;IAClB,IAAW,oBAAoB,IAAI,cAAc,CAEhD;IAED,kBAAkB;IAClB,IAAW,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAEpD;IAED,kBAAkB;IAClB,IAAW,aAAa,IAAI,UAAU,CAErC;IAED,kBAAkB;IAClB,IAAW,aAAa,CAAC,KAAK,EAAE,UAAU,EAEzC;IAED,kBAAkB;IAClB,IAAW,cAAc,IAAI,QAAQ,GAAG,SAAS,CAEhD;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAEpD;IAED,kBAAkB;IACF,UAAU,IAAI,IAAI;IASlC,OAAO,CAAC,gBAAgB;IAUxB,kBAAkB;IAClB,SAAS,CAAC,eAAe,IAAI,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI;IAS7D,kBAAkB;IACX,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAE,MAAW,EAAE,aAAa,GAAE,MAAU,GAAG,IAAI;CA4CpI"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The WebGL implementation of a vertex attribute.
3
+ */
4
+ export declare class WebGLVertexAttribute {
5
+ gl: WebGL2RenderingContext;
6
+ constructor(gl: WebGL2RenderingContext);
7
+ /** @inheritdoc */
8
+ initialize(): void;
9
+ }
10
+ //# sourceMappingURL=webgl-vertex-attribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-vertex-attribute.d.ts","sourceRoot":"","sources":["../../../src/webgl/rendering/webgl-vertex-attribute.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,qBAAa,oBAAoB;IAElB,EAAE,EAAE,sBAAsB;gBAA1B,EAAE,EAAE,sBAAsB;IAKrC,kBAAkB;IAClB,UAAU,IAAI,IAAI;CAGrB"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The WebGL implementation of a vertex buffer layout.
3
+ */
4
+ export declare class WebGLVertexBufferLayout {
5
+ private readonly _gl;
6
+ private _bufferTarget;
7
+ /**
8
+ * The constructor for the WebGLVertexBufferLayout class.
9
+ * @param gl The WebGL2 rendering context.
10
+ * @param buffer The WebGL buffer that is used to store the vertex data. This is used to determine the buffer target for the vertex buffer layout.
11
+ * @param bufferTarget The buffer target for the vertex buffer layout. This is used to determine how the vertex buffer is bound to the WebGL context. This is typically either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER.
12
+ */
13
+ constructor(gl: WebGL2RenderingContext, buffer: WebGLBuffer, bufferTarget: number);
14
+ /**
15
+ * The WebGL buffer that is used to store the vertex data.
16
+ */
17
+ buffer: WebGLBuffer | null;
18
+ /**
19
+ * Binds the vertex buffer to the WebGL context using the buffer target specified in the constructor.
20
+ */
21
+ bindBuffer(): void;
22
+ /**
23
+ * Initializes the vertex buffer layout. This method should be called after the buffer has been created and bound.
24
+ */
25
+ initialize(): void;
26
+ }
27
+ //# sourceMappingURL=webgl-vertex-buffer-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-vertex-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/webgl/rendering/webgl-vertex-buffer-layout.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,aAAa,CAAa;IAElC;;;;;OAKG;gBAEC,EAAE,EAAE,sBAAsB,EAC1B,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,MAAM;IAOxB;;OAEG;IACI,MAAM,EAAE,WAAW,GAAG,IAAI,CAAQ;IAEzC;;OAEG;IACI,UAAU,IAAI,IAAI;IAIzB;;OAEG;IACI,UAAU,IAAI,IAAI;CAwB5B"}
@@ -0,0 +1,48 @@
1
+ import { SamplerDescriptor } from "../../core/rendering/sampler/sampler-descriptor";
2
+ import type { WebGlGraphicsDevice } from "../WebGlGraphicsDevice.js";
3
+ import { type ISampler, MipMapSamplerFilter, SamplerAddressMode, SamplerFilter } from "ris-framework-api";
4
+ /**
5
+ * The WebGL implementation of the ISampler interface.
6
+ */
7
+ export declare class WebGlSampler implements ISampler {
8
+ private static _id;
9
+ private readonly _gl;
10
+ private _minFilter;
11
+ private _magFilter;
12
+ private _mipMapFilter;
13
+ private _addressModueU;
14
+ private _addressModueV;
15
+ private _addressModueW;
16
+ /**
17
+ * Creates an instance of WebGlSampler.
18
+ * @param graphicsDevice The WebGL graphics device that will be used to create the sampler. The graphics device provides access to the WebGL rendering context and other resources needed for creating and managing the sampler.
19
+ * @param descriptor The descriptor containing configuration details for the sampler. This parameter is optional, and if not provided, default values will be used for the sampler configuration. The descriptor allows you to specify various properties of the sampler, such as filtering methods and address modes, which determine how textures are sampled in the shader.
20
+ */
21
+ constructor(graphicsDevice: WebGlGraphicsDevice, descriptor?: SamplerDescriptor);
22
+ /** @inheritDoc */
23
+ readonly id: number;
24
+ /** @inheritdoc */
25
+ get minFilter(): SamplerFilter;
26
+ /** @inheritdoc */
27
+ get magFilter(): SamplerFilter;
28
+ /** @inheritdoc */
29
+ get mipmapFilter(): MipMapSamplerFilter;
30
+ /** @inheritdoc */
31
+ get addressModeU(): SamplerAddressMode;
32
+ /** @inheritdoc */
33
+ get addressModeV(): SamplerAddressMode;
34
+ /** @inheritdoc */
35
+ get addressModeW(): SamplerAddressMode;
36
+ /** @inheritdoc */
37
+ get handle(): any;
38
+ /**
39
+ * The handle of the sampler.
40
+ * This is used to bind the sampler to the graphics pipeline.
41
+ */
42
+ glSampler: globalThis.WebGLSampler;
43
+ /** @inheritdoc */
44
+ _createSampler(): void;
45
+ /** @inheritdoc */
46
+ dispose(): void;
47
+ }
48
+ //# sourceMappingURL=webgl-sampler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-sampler.d.ts","sourceRoot":"","sources":["../../../src/webgl/sampler/webgl-sampler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAEpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAC,KAAK,QAAQ,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAExG;;GAEG;AACH,qBAAa,YAAa,YAAW,QAAQ;IAEzC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,cAAc,CAAoC;IAE1D;;;;OAIG;gBACS,cAAc,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,iBAAiB;IAiB/E,kBAAkB;IAClB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,kBAAkB;IAClB,IAAW,SAAS,kBAEnB;IAED,kBAAkB;IAClB,IAAW,SAAS,kBAEnB;IAED,kBAAkB;IAClB,IAAW,YAAY,wBAEtB;IAED,kBAAkB;IAClB,IAAW,YAAY,uBAEtB;IAED,kBAAkB;IAClB,IAAW,YAAY,uBAEtB;IAED,kBAAkB;IAClB,IAAW,YAAY,uBAEtB;IAED,kBAAkB;IAClB,IAAW,MAAM,IAAI,GAAG,CAEvB;IAED;;;OAGG;IACI,SAAS,EAAE,UAAU,CAAC,YAAY,CAAS;IAElD,kBAAkB;IACX,cAAc,IAAI,IAAI;IAc7B,kBAAkB;IACX,OAAO,IAAI,IAAI;CAOzB"}
@@ -0,0 +1,34 @@
1
+ import { type IFramework, type IShaderModule, ShaderStage } from "ris-framework-api";
2
+ /**
3
+ * The WebGL shader module.
4
+ */
5
+ export declare class WebGlShaderModule implements IShaderModule {
6
+ private readonly _graphicsDevice;
7
+ private readonly _gl;
8
+ private _program?;
9
+ /**
10
+ * The constructor of the WebGL shader module.
11
+ * @param framework The framework.
12
+ * @param shaderFilePath
13
+ */
14
+ constructor(framework: IFramework, shaderFilePath: string);
15
+ /** @inheritDoc */
16
+ stages: ShaderStage[];
17
+ /** @inheritDoc */
18
+ nativeHandle?: any;
19
+ /**
20
+ * Tries to framework shader.
21
+ * These shaders are part of framework.
22
+ * @param id The id of internal shader.
23
+ */
24
+ private _tryResolveFrameworkShader;
25
+ /**
26
+ * The program of this shader module
27
+ */
28
+ get program(): WebGLProgram | null | undefined;
29
+ private _loadShaders;
30
+ /** @inheritdoc */
31
+ dispose(): void;
32
+ }
33
+ export default WebGlShaderModule;
34
+ //# sourceMappingURL=WebGlShaderModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlShaderModule.d.ts","sourceRoot":"","sources":["../../../src/webgl/shader/WebGlShaderModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AASnF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAAe;IAEhC;;;;OAIG;gBACgB,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM;IAOhE,kBAAkB;IACX,MAAM,EAAE,WAAW,EAAE,CAAM;IAElC,kBAAkB;IACX,YAAY,CAAC,EAAE,GAAG,CAAC;IAE1B;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAelC;;OAEG;IACH,IAAW,OAAO,IAAI,YAAY,GAAG,IAAI,GAAG,SAAS,CAEpD;IAED,OAAO,CAAC,YAAY;IAkCpB,kBAAkB;IACX,OAAO,IAAI,IAAI;CAOzB;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,19 @@
1
+ import type { IFramework, IShaderModule } from "ris-framework-api";
2
+ /**
3
+ * The content WebGL implementation of ShaderContentModule.
4
+ */
5
+ export declare class WebGlShaderModuleLoader {
6
+ private readonly _shaderModules;
7
+ private readonly _framework;
8
+ /**
9
+ * The WebGL shader content module.
10
+ * @param framework The framework.
11
+ */
12
+ constructor(framework: IFramework);
13
+ /**
14
+ * The content types provided by this content module.
15
+ * @param assetFilePathOrIdentifier The asset file path or identifier of the content to load.
16
+ */
17
+ load(assetFilePathOrIdentifier: string): IShaderModule;
18
+ }
19
+ //# sourceMappingURL=WebGlShaderModuleLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlShaderModuleLoader.d.ts","sourceRoot":"","sources":["../../../src/webgl/shader/WebGlShaderModuleLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGjE;;GAEG;AACH,qBAAa,uBAAuB;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwE;IACvG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;OAGG;gBACgB,SAAS,EAAE,UAAU;IAIxC;;;OAGG;IACI,IAAI,CAAC,yBAAyB,EAAE,MAAM,GAAG,aAAa;CAgBhE"}
@@ -0,0 +1,27 @@
1
+ import { vec2 } from "gl-matrix";
2
+ import { type IGraphicsDevice, type ISwapChain, TextureFormat } from "ris-framework-api";
3
+ /**
4
+ * The WebGL implementation of the ISwapChain interface, which manages the swap chain for rendering operations in a WebGL context.
5
+ */
6
+ export declare class WebGlSwapChain implements ISwapChain {
7
+ private readonly _canvas;
8
+ private readonly _graphicsDevice;
9
+ private _backBufferSize;
10
+ /**
11
+ * The WebGLSwapChain constructor.
12
+ * @param canvas The HTML canvas element that the swap chain will use for rendering.
13
+ * @param graphicsDevice The graphics device.
14
+ */
15
+ constructor(canvas: HTMLCanvasElement, graphicsDevice: IGraphicsDevice);
16
+ /** @inheritdoc */
17
+ get textureFormat(): TextureFormat;
18
+ /** @inheritdoc */
19
+ get backBufferSize(): vec2;
20
+ /** @inheritdoc */
21
+ resize(_width: number, _height: number): void;
22
+ /** @inheritdoc */
23
+ present(): void;
24
+ /** @inheritdoc */
25
+ dispose(): void;
26
+ }
27
+ //# sourceMappingURL=WebGlSwapChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlSwapChain.d.ts","sourceRoot":"","sources":["../../../src/webgl/swap-chain/WebGlSwapChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGvF;;GAEG;AACH,qBAAa,cAAe,YAAW,UAAU;IAE7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IAEtD,OAAO,CAAC,eAAe,CAAO;IAE9B;;;;OAIG;gBACgB,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe;IAW7E,kBAAkB;IAClB,IAAW,aAAa,IAAI,aAAa,CAExC;IAED,kBAAkB;IAClB,IAAW,cAAc,IAAI,IAAI,CAEhC;IAED,kBAAkB;IACX,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIpD,kBAAkB;IACX,OAAO,IAAI,IAAI;IAKtB,kBAAkB;IACX,OAAO,IAAI,IAAI;CAGzB"}
@@ -0,0 +1,37 @@
1
+ import { TextureDescriptor, type IFramework, type ITextureView, type TextureViewDescriptor } from "ris-framework-api";
2
+ import { ATexture2D } from "../../core/rendering/texture/texture.js";
3
+ /**
4
+ * The WebGL implementation of ITexture2D.
5
+ */
6
+ export declare class WebGlTexture2D extends ATexture2D {
7
+ private readonly _framework;
8
+ private readonly _graphicsDevice;
9
+ private readonly _gl;
10
+ private _glTexture;
11
+ /**
12
+ * The constructor.
13
+ * @param _framework The framework instance.
14
+ * @param textureDescriptor The texture descriptor.
15
+ */
16
+ constructor(_framework: IFramework, textureDescriptor: TextureDescriptor);
17
+ /**
18
+ * Gets the underlying WebGL texture.
19
+ * @returns The WebGL texture.
20
+ */
21
+ get glTexture(): WebGLTexture;
22
+ /** @inheritdoc */
23
+ initialize(): void;
24
+ /** @inheritdoc */
25
+ createView(_descriptor?: TextureViewDescriptor): ITextureView;
26
+ /** @inheritdoc */
27
+ dispose(): void;
28
+ private static _defaultFilled;
29
+ /**
30
+ * Creates a default 1x1 white texture if it doesn't already exist and returns it.
31
+ * This can be used as a placeholder texture when a texture is expected but not available.
32
+ * @param framework The framework instance.
33
+ * @returns The default 1x1 white texture.
34
+ */
35
+ static getOrCreateDefault(framework: IFramework): WebGlTexture2D;
36
+ }
37
+ //# sourceMappingURL=WebGlTexture2D.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlTexture2D.d.ts","sourceRoot":"","sources":["../../../src/webgl/texture/WebGlTexture2D.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAGnE;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAYtC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAV/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,UAAU,CAA6B;IAE/C;;;;OAIG;gBAEkB,UAAU,EAAE,UAAU,EACvC,iBAAiB,EAAE,iBAAiB;IAOxC;;;OAGG;IACH,IAAW,SAAS,IAAI,YAAY,CAEnC;IAED,kBAAkB;IACX,UAAU,IAAI,IAAI;IA0CzB,kBAAkB;IACX,UAAU,CAAC,WAAW,CAAC,EAAE,qBAAqB,GAAG,YAAY;IAKpE,kBAAkB;IACX,OAAO,IAAI,IAAI;IAetB,OAAO,CAAC,MAAM,CAAC,cAAc,CAA+B;IAE5D;;;;;OAKG;WACW,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG,cAAc;CAiB1E"}
@@ -0,0 +1,17 @@
1
+ import { Color, type IFramework, type ITexture2D, type ITextureFactory, TextureDescriptor, TextureFormat } from "ris-framework-api";
2
+ import { type IKtx2Texture } from "ris-ktx2-api";
3
+ export declare class WebGlTextureFactory implements ITextureFactory {
4
+ private readonly _framework;
5
+ /**
6
+ * The constructor for the WebGLTextureFactory class.
7
+ * @param _framework The framework instance.
8
+ */
9
+ constructor(_framework: IFramework);
10
+ /** @inheritDoc */
11
+ createFromKtx2(ktxTexture: IKtx2Texture, descriptor?: TextureDescriptor): ITexture2D;
12
+ /** @inheritdoc */
13
+ create(width: number, height: number, data?: Uint8Array | HTMLImageElement, channels?: number, label?: string | null | undefined, textureUsage?: number, textureFormat?: TextureFormat, useMipMaps?: boolean): ITexture2D;
14
+ /** @inheritdoc */
15
+ createEmpty(width: number, height: number, color?: Color | null, textureUsage?: number, textureFormat?: TextureFormat, label?: string | null, useMipmap?: boolean): ITexture2D;
16
+ }
17
+ //# sourceMappingURL=WebGlTextureFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlTextureFactory.d.ts","sourceRoot":"","sources":["../../../src/webgl/texture/WebGlTextureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,iBAAiB,EACjB,aAAa,EAGhB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAC,KAAK,YAAY,EAAqE,MAAM,cAAc,CAAC;AAGnH,qBAAa,mBAAoB,YAAW,eAAe;IAM3C,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJvC;;;OAGG;gBAC0B,UAAU,EAAE,UAAU;IAGnD,kBAAkB;IACX,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,iBAAiB,GAAG,UAAU;IAsE3F,kBAAkB;IACX,MAAM,CACT,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC7B,IAAI,CAAC,EAAE,UAAU,GAAG,gBAAgB,EACpC,QAAQ,GAAE,MAAU,EACpB,KAAK,GAAE,MAAM,GAAG,IAAI,GAAG,SAAgB,EACvC,YAAY,SAAuD,EACnE,aAAa,gBAA4B,EACzC,UAAU,UAAQ,GAAG,UAAU;IAgCnC,kBAAkB;IACX,WAAW,CACd,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC7B,KAAK,GAAE,KAAK,GAAG,IAAW,EAC1B,YAAY,SAAuD,EACnE,aAAa,gBAA0B,EACvC,KAAK,GAAE,MAAM,GAAG,IAAW,EAC3B,SAAS,UAAQ,GAAG,UAAU;CA0CrC"}
@@ -0,0 +1,45 @@
1
+ import type { BufferUsage } from "ris-framework-api";
2
+ /**
3
+ * This file contains utility functions for working with WebGL buffers,
4
+ * such as creating and managing vertex buffers, index buffers, and uniform buffers.
5
+ * It provides a higher-level abstraction over the raw WebGL API to simplify buffer management in a WebGL application.
6
+ */
7
+ export declare class WebGlBufferUtilities {
8
+ /**
9
+ * Creates a vertex buffer in WebGL with the given data and usage.
10
+ * @param gl The WebGL2RenderingContext to use for creating the buffer.
11
+ * @param dataOrByteSize The data to upload to the vertex buffer, typically a Float32Array containing vertex attributes, or a number representing the byte size of the buffer to create.
12
+ * @param usage The intended usage of the buffer, which can affect how the buffer is created and optimized by the graphics API. For example, a vertex buffer may be optimized for use as a vertex buffer in rendering operations.
13
+ * @returns The created WebGLBuffer object that represents the vertex buffer in WebGL.
14
+ */
15
+ createVertexBuffer(gl: WebGL2RenderingContext, dataOrByteSize: Float32Array | number, usage: BufferUsage): WebGLBuffer;
16
+ /**
17
+ * Creates an index buffer in WebGL with the given data and usage.
18
+ * @param gl The WebGL2RenderingContext to use for creating the buffer.
19
+ * @param dataOrByteSize The data to upload to the index buffer, typically a Uint16Array or Uint32Array containing index data, or a number representing the byte size of the buffer to create.
20
+ * @param usage The intended usage of the buffer, which can affect how the buffer is created and optimized by the graphics API. For example, an index buffer may be optimized for use as an index buffer in rendering operations.
21
+ * @param label The label.
22
+ * @returns The created WebGLBuffer object that represents the index buffer in WebGL.
23
+ */
24
+ createIndexBuffer(gl: WebGL2RenderingContext, dataOrByteSize: Uint16Array | Uint32Array | number, usage: BufferUsage, label?: string): WebGLBuffer;
25
+ /**
26
+ * Creates a uniform buffer in WebGL with the given data and usage.
27
+ * @param gl The WebGL2RenderingContext to use for creating the buffer.
28
+ * @param dataOrByteSize The data to upload to the uniform buffer, typically an ArrayBuffer or a TypedArray containing uniform data, or a number representing the byte size of the buffer to create.
29
+ * @param usage The intended usage of the buffer, which can affect how the buffer is created and optimized by the graphics API. For example, a uniform buffer may be optimized for use as a uniform buffer in rendering operations.
30
+ * @param label An optional label for the buffer, which can be used for debugging purposes to identify the buffer in graphics debugging tools.
31
+ * @returns The created WebGLBuffer object that represents the uniform buffer in WebGL.
32
+ */
33
+ createUniformBuffer(gl: WebGL2RenderingContext, dataOrByteSize: ArrayBuffer | ArrayBufferView | number, usage: BufferUsage, label?: string): WebGLBuffer;
34
+ /**
35
+ * Updates the vertex buffer.
36
+ * @param gl
37
+ * @param buffer
38
+ * @param data The data.
39
+ * @param destOffset Offset into destination.
40
+ * @param srcOffset
41
+ * @param srcLength
42
+ */
43
+ updateVertexBuffer(gl: WebGL2RenderingContext, buffer: WebGLBuffer, data: Float32Array, destOffset?: number, srcOffset?: number, srcLength?: number): void;
44
+ }
45
+ //# sourceMappingURL=WebGlBufferUtilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlBufferUtilities.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/WebGlBufferUtilities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,oBAAoB;IAE7B;;;;;;OAMG;IACI,kBAAkB,CAAC,EAAE,EAAE,sBAAsB,EAAE,cAAc,EAAE,YAAY,GAAG,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW;IAiB7H;;;;;;;OAOG;IACI,iBAAiB,CAAC,EAAE,EAAE,sBAAsB,EAC1B,cAAc,EAAE,WAAW,GAAG,WAAW,GAAG,MAAM,EAClD,KAAK,EAAE,WAAW,EAClB,KAAK,CAAC,EAAE,MAAM,GACpC,WAAW;IAyBd;;;;;;;OAOG;IACI,mBAAmB,CAAC,EAAE,EAAE,sBAAsB,EAAE,cAAc,EAAE,WAAW,GAAG,eAAe,GAAG,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW;IAqB/J;;;;;;;;OAQG;IACI,kBAAkB,CACrB,EAAE,EAAE,sBAAsB,EAC1B,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,YAAY,EAClB,UAAU,GAAE,MAAU,EACtB,SAAS,GAAE,MAAU,EACrB,SAAS,GAAE,MAAU;CAQ5B"}
@@ -0,0 +1,124 @@
1
+ import { Culling } from "../../core/renderer/enums";
2
+ import { BlendFactor, BlendOperation } from "../../core/rendering/blending/enums";
3
+ import { CullMode, FrontFace, PrimitiveTopology } from "../../core/rendering/primitive/enums";
4
+ import { VertexFormat } from "../../VertexFormat.js";
5
+ import { BufferUsage, MipMapSamplerFilter, SamplerAddressMode, SamplerFilter, TextureFormat } from "ris-framework-api";
6
+ export declare class WebGlConverter {
7
+ /** BC3 */
8
+ private static GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
9
+ /** BC7 */
10
+ private static GL_COMPRESSED_RGBA_BPTC_UNORM;
11
+ /** ETC2 */
12
+ private static GL_COMPRESSED_RGBA8_ETC2_EAC;
13
+ private static GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
14
+ /**
15
+ * Converts PrimitiveTopology to WebGL enum.
16
+ * @param topology The PrimitiveTopology.
17
+ * @returns The WebGL enum.
18
+ */
19
+ static convertPrimitiveType(topology: PrimitiveTopology): number;
20
+ /**
21
+ * Converts CullMode to WebGL enum.
22
+ * @param cullFace The CullMode.
23
+ * @return The WebGL enum.
24
+ */
25
+ static convertCullFace(cullFace: CullMode): number;
26
+ /**
27
+ * Converts FrontFace to WebGL enum.
28
+ * @param frontFace The FrontFace.
29
+ * @return The WebGL enum.
30
+ */
31
+ static convertFrontFace(frontFace: FrontFace): number;
32
+ /**
33
+ * Converts BufferUsage to WebGL enum.
34
+ * @param usage The BufferUsage.
35
+ * @return The WebGL enum.
36
+ */
37
+ static convertBufferUsage(usage: BufferUsage): GLenum;
38
+ /**
39
+ * Conversts BlendOperation to WebGL enum.
40
+ * @parma gl The WebGL2RenderingContext.
41
+ * @param blendOperation The BlendOperation.
42
+ * @return The WebGL enum.
43
+ */
44
+ static convertBlendOperation(gl: WebGL2RenderingContext, blendOperation: BlendOperation): GLenum;
45
+ /**
46
+ * Converts BlendFactor to WebGL enum.
47
+ * @param gl The WebGL2RenderingContext.
48
+ * @param blendingFactor The BlendFactor.
49
+ * @returns The WebGL enum.
50
+ */
51
+ static convertBlendFactor(gl: WebGL2RenderingContext, blendingFactor: BlendFactor): number;
52
+ /**
53
+ * Converts Culling to WebGL enum.
54
+ * @param gl The WebGL2RenderingContext.
55
+ * @param culling The Culling.
56
+ * @returns The WebGL enum.
57
+ */
58
+ static convertCulling(gl: WebGL2RenderingContext, culling: Culling): number;
59
+ /**
60
+ * Converts TextureFormat to WebGL internal format, format, and type.
61
+ * @param gl The WebGL2RenderingContext.
62
+ * @param textureFormat The TextureFormat.
63
+ * @returns The WebGL internal format.
64
+ */
65
+ static convertInternalFormat(gl: WebGL2RenderingContext, textureFormat: TextureFormat): number;
66
+ /**
67
+ * Converts TextureFormat to WebGL format.
68
+ * @param gl The WebGL2RenderingContext.
69
+ * @param textureFormat The TextureFormat.
70
+ * @returns The WebGL format.
71
+ */
72
+ static convertToPixelFormat(gl: WebGL2RenderingContext, textureFormat: TextureFormat): number;
73
+ /**
74
+ * Converts TextureFormat to WebGL texture type.
75
+ * @param gl The WebGL2RenderingContext.
76
+ * @param textureFormat The TextureFormat.
77
+ * @returns The WebGL texture type.
78
+ */
79
+ static convertToTextureType(gl: WebGL2RenderingContext, textureFormat: TextureFormat): number;
80
+ /**
81
+ * Converts SamplerMinFilter to WebGL enum.
82
+ * @param gl The WebGL2RenderingContext.
83
+ * @param minFilter The SamplerMinFilter.
84
+ * @param mipMapFilter The MipmapSamplerFilter.
85
+ * @returns The WebGL enum.
86
+ */
87
+ static convertToMinFilter(gl: WebGL2RenderingContext, minFilter: SamplerFilter, mipMapFilter: MipMapSamplerFilter): number;
88
+ /**
89
+ * Converts SamplerMagFilter to WebGL enum.
90
+ * @param gl The WebGL2RenderingContext.
91
+ * @param magFilter The SamplerMagFilter.
92
+ * @returns The WebGL enum.
93
+ */
94
+ static convertToMagFilter(gl: WebGL2RenderingContext, magFilter: SamplerFilter): number;
95
+ /**
96
+ * Converts VertexFormat to the number of components for WebGL vertex attribute pointer.
97
+ * @param vertexFormat The VertexFormat.
98
+ * @returns The number of components for WebGL vertex attribute pointer.
99
+ */
100
+ static convertVertexFormat(vertexFormat: VertexFormat): number;
101
+ /**
102
+ * Converts SamplerFilter to WebGL enum.
103
+ * @param gl The WebGL2RenderingContext.
104
+ * @param filter The SamplerFilter.
105
+ * @returns The WebGL enum.
106
+ */
107
+ static convertMagFilter(gl: WebGL2RenderingContext, filter: SamplerFilter): number;
108
+ /**
109
+ * Converts SamplerFilter and MipmapSamplerFilter to WebGL enum for minification filter.
110
+ * @param gl The WebGL2RenderingContext.
111
+ * @param filter The SamplerFilter.
112
+ * @param mipMapFilter The MipmapSamplerFilter.
113
+ * @returns The WebGL enum.
114
+ */
115
+ static convertMinFIlter(gl: WebGL2RenderingContext, filter: SamplerFilter, mipMapFilter: MipMapSamplerFilter): number;
116
+ /**
117
+ * Converts SamplerAddressMode to WebGL enum.
118
+ * @param gl The WebGL2RenderingContext.
119
+ * @param addressMode The SamplerAddressMode.
120
+ * @returns The WebGL enum.
121
+ */
122
+ static convertAddressMode(gl: WebGL2RenderingContext, addressMode: SamplerAddressMode): number;
123
+ }
124
+ //# sourceMappingURL=WebGlConverter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlConverter.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/WebGlConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAC,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAErH,qBAAa,cAAc;IAIvB,UAAU;IACV,OAAO,CAAC,MAAM,CAAC,gCAAgC,CAAU;IAEzD,UAAU;IACV,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAU;IAGtD,WAAW;IACX,OAAO,CAAC,MAAM,CAAC,4BAA4B,CAAU;IAErD,OAAO,CAAC,MAAM,CAAC,+BAA+B,CAAU;IAExD;;;;OAIG;WACW,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM;IAgBvE;;;;OAIG;WACW,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;IAczD;;;;OAIG;WACW,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IAW5D;;;;OAIG;WACW,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAW5D;;;;;OAKG;WACW,qBAAqB,CAC/B,EAAE,EAAE,sBAAsB,EAC1B,cAAc,EAAE,cAAc,GAC/B,MAAM;IAiBT;;;;;OAKG;WACW,kBAAkB,CAC5B,EAAE,EAAE,sBAAsB,EAC1B,cAAc,EAAE,WAAW,GAC5B,MAAM;IAqBT;;;;;OAKG;WACW,cAAc,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;IAalF;;;;;OAKG;WACW,qBAAqB,CAAC,EAAE,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM;IAyBrG;;;;;OAKG;WACW,oBAAoB,CAAC,EAAE,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM;IAcpG;;;;;OAKG;WACW,oBAAoB,CAAC,EAAE,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM;IAapG;;;;;;OAMG;WACW,kBAAkB,CAAC,EAAE,EAAE,sBAAsB,EAC1B,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,mBAAmB,GAAG,MAAM;IA6B3E;;;;;OAKG;WACW,kBAAkB,CAAC,EAAE,EAAE,sBAAsB,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAW9F;;;;OAIG;WACW,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM;IAiBrE;;;;;OAKG;WACW,gBAAgB,CAAC,EAAE,EAAE,sBAAsB,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM;IAWzF;;;;;;OAMG;WACW,gBAAgB,CAAC,EAAE,EAAE,sBAAsB,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,GAAG,MAAM;IA6B5H;;;;;OAKG;WACW,kBAAkB,CAAC,EAAE,EAAE,sBAAsB,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM;CAexG"}
@@ -0,0 +1,54 @@
1
+ import { TextureFormat } from "ris-framework-api";
2
+ /**
3
+ * This file defines the WebGLFrameBufferUtilities class, which provides utility functions for working with WebGL framebuffers.
4
+ * The WebGLFrameBufferUtilities class includes methods for creating framebuffers with specific configurations, such as attaching textures as color and depth attachments.
5
+ * These utilities simplify the process of setting up framebuffers for rendering to textures, which is a common technique in graphics programming for effects like render-to-texture, post-processing, and off-screen rendering.
6
+ */
7
+ export declare class WebGlFrameBufferUtilities {
8
+ /**
9
+ * Creates a framebuffer and attaches the provided texture(s) as color attachments.
10
+ * This method is useful for setting up a framebuffer for rendering to one or more textures.
11
+ * @param gl The WebGL2 rendering context.
12
+ * @param textureIds The texture(s) to be attached as color attachments.
13
+ * @param framebufferLabel An optional label for the framebuffer, which can be used for debugging purposes.
14
+ * @returns The created framebuffer.
15
+ */
16
+ create(gl: WebGL2RenderingContext, textureIds: WebGLTexture[] | WebGLTexture, framebufferLabel?: string | null): WebGLFramebuffer;
17
+ /**
18
+ * Creates a framebuffer with texture being attached as color attachment 0 and depth render buffer.
19
+ * @param gl The WebGL2 rendering context.
20
+ * @param textureAttachment0 The texture to be attached as color attachment 0.
21
+ * @param depthAttachmentType The type of the depth attachment, which can be DepthAttachment, DepthStencilAttachment or StencilAttachment.
22
+ * @param depthStencilRenderBuffer The render buffer to be attached as the depth/stencil attachment.
23
+ * @param label An optional label for the framebuffer, which can be used for debugging purposes.
24
+ * @return The created framebuffer.
25
+ */
26
+ createWithRenderBufferAsDepthBuffer(gl: WebGL2RenderingContext, textureAttachment0: WebGLTexture, depthAttachmentType: GLenum, depthStencilRenderBuffer: WebGLRenderbuffer, label: string | null | undefined): WebGLFramebuffer;
27
+ /**
28
+ * Creates a framebuffer with texture being attached as color attachment 0 and depth render buffer.
29
+ * @param gl The WebGL2 rendering context.
30
+ * @param textureAttachment0 The texture to be attached as color attachment 0.
31
+ * @param depthAttachmentType The type of the depth attachment, which can be DepthAttachment, DepthStencilAttachment or StencilAttachment.
32
+ * @param depthStencilTexture The texture to be attached as the depth/stencil attachment.
33
+ * @param label An optional label for the framebuffer, which can be used for debugging purposes.
34
+ * @returns The created framebuffer.
35
+ */
36
+ createWithRenderTextureAsDepthBuffer(gl: WebGL2RenderingContext, textureAttachment0: WebGLTexture, depthAttachmentType: GLenum, depthStencilTexture: WebGLTexture, label?: string): WebGLFramebuffer;
37
+ /**
38
+ * Attaches a depth/stencil render buffer to the framebuffer.
39
+ * @param gl The WebGL2 rendering context.
40
+ * @param frameBuffer The framebuffer to which the depth/stencil render buffer will be attached.
41
+ * @param depthStencilRenderBuffer The depth/stencil render buffer to be attached.
42
+ * @param format The format of the depth/stencil render buffer, which determines the type of attachment (depth, stencil, or depth-stencil).
43
+ */
44
+ attachDepthStencilRenderBuffer(gl: WebGL2RenderingContext, frameBuffer: WebGLFramebuffer, depthStencilRenderBuffer: WebGLRenderbuffer, format: TextureFormat): void;
45
+ /**
46
+ * Attaches a depth/stencil texture to the framebuffer.
47
+ * @param gl The WebGL2 rendering context.
48
+ * @param frameBuffer The framebuffer to which the depth/stencil texture will be attached.
49
+ * @param depthStencilTexture The depth/stencil texture to be attached.
50
+ * @param textureFormat The format of the depth/stencil texture, which determines the type of attachment (depth, stencil, or depth-stencil).
51
+ */
52
+ attachDepthStencilTexture(gl: WebGL2RenderingContext, frameBuffer: WebGLFramebuffer, depthStencilTexture: WebGLTexture, textureFormat: TextureFormat): void;
53
+ }
54
+ //# sourceMappingURL=WebGlFrameBufferUtilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlFrameBufferUtilities.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/WebGlFrameBufferUtilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGhD;;;;GAIG;AACH,qBAAa,yBAAyB;IAGlC;;;;;;;OAOG;IACI,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,gBAAgB,GAAE,MAAM,GAAG,IAAW,GAAG,gBAAgB;IA8C9I;;;;;;;;OAQG;IACI,mCAAmC,CAAC,EAAE,EAAE,sBAAsB,EACjE,kBAAkB,EAAE,YAAY,EAChC,mBAAmB,EAAE,MAAM,EAC3B,wBAAwB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,gBAAgB;IA2CpG;;;;;;;;OAQG;IACI,oCAAoC,CAAC,EAAE,EAAE,sBAAsB,EAClE,kBAAkB,EAAE,YAAY,EAChC,mBAAmB,EAAE,MAAM,EAC3B,mBAAmB,EAAE,YAAY,EACjC,KAAK,CAAC,EAAE,MAAM,GAAG,gBAAgB;IA2CrC;;;;;;OAMG;IACI,8BAA8B,CACjC,EAAE,EAAE,sBAAsB,EAC1B,WAAW,EAAE,gBAAgB,EAC7B,wBAAwB,EAAE,iBAAiB,EAC3C,MAAM,EAAE,aAAa,GAAG,IAAI;IAwBhC;;;;;;OAMG;IACI,yBAAyB,CAC5B,EAAE,EAAE,sBAAsB,EAC1B,WAAW,EAAE,gBAAgB,EAC7B,mBAAmB,EAAE,YAAY,EACjC,aAAa,EAAE,aAAa,GAAG,IAAI;CAiB1C"}
@@ -0,0 +1,23 @@
1
+ import { SamplerCompareFunction } from '../../common/sampler-enums';
2
+ import { MipMapSamplerFilter, SamplerAddressMode, SamplerFilter } from "ris-framework-api";
3
+ /**
4
+ * The utility class for working with WebGLSampler object.
5
+ */
6
+ export declare class WebGlSamplerUtilities {
7
+ /**
8
+ * Creates a WebGLSampler with the specified parameters.
9
+ * @param gl The WebGL2RenderingContext.
10
+ * @param minFilter The minification filter of the sampler.
11
+ * @param magFilter The magnification filter of the sampler.
12
+ * @param mipMapFilter The mipmap filter of the sampler.
13
+ * @param addressModeU The address mode of the sampler for the U coordinate.
14
+ * @param addressModeV The address mode of the sampler for the V coordinate.
15
+ * @param addressModeW The address mode of the sampler for the W coordinate.
16
+ * @param compareFunction The compare function of the sampler. This is used for shadow samplers.
17
+ * @param _anisotropy The anisotropy level of the sampler. This is used for anisotropic filtering. The default value is 1, which means no anisotropic filtering.
18
+ * @param label The label of the sampler. This is used for debugging purposes and can be viewed in graphics debuggers like SpectorJS.
19
+ * @returns
20
+ */
21
+ create(gl: WebGL2RenderingContext, minFilter?: SamplerFilter, magFilter?: SamplerFilter, mipMapFilter?: MipMapSamplerFilter, addressModeU?: SamplerAddressMode, addressModeV?: SamplerAddressMode, addressModeW?: SamplerAddressMode, compareFunction?: SamplerCompareFunction, _anisotropy?: number, label?: string): WebGLSampler;
22
+ }
23
+ //# sourceMappingURL=WebGlSamplerUtilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlSamplerUtilities.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/WebGlSamplerUtilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEzF;;GAEG;AACH,qBAAa,qBAAqB;IAE9B;;;;;;;;;;;;;OAaG;IACI,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAC1B,SAAS,GAAE,aAAoC,EAC/C,SAAS,GAAE,aAAoC,EAC/C,YAAY,GAAE,mBAA8C,EAC5D,YAAY,GAAE,kBAAqD,EACnE,YAAY,GAAE,kBAAqD,EACnE,YAAY,GAAE,kBAAqD,EACnE,eAAe,GAAE,sBAAqD,EACtE,WAAW,GAAE,MAAU,EACjC,KAAK,GAAE,MAAW,GAAI,YAAY;CA+CzC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This module provides utility functions for working with WebGL shaders, including shader creation and compilation.
3
+ */
4
+ export declare class WebGlShaderUtilities {
5
+ /**
6
+ * Creates a WebGL shader of the specified type using the provided shader source code.
7
+ * @param gl The WebGL2 rendering context.
8
+ * @param shaderSource The source code of the shader.
9
+ * @param shaderType The type of the shader (e.g., gl.VERTEX_SHADER or gl.FRAGMENT_SHADER).
10
+ * @returns The compiled WebGLShader object.
11
+ */
12
+ create(gl: WebGL2RenderingContext, shaderSource: string, shaderType: GLenum): WebGLShader;
13
+ /**
14
+ * Creates a vertex shader using the provided shader source code.
15
+ * @param gl The WebGL2 rendering context.
16
+ * @param shaderSource The source code of the vertex shader.
17
+ * @returns The compiled WebGLShader object representing the vertex shader.
18
+ */
19
+ createVertexShader(gl: WebGL2RenderingContext, shaderSource: string): WebGLShader;
20
+ /**
21
+ * Creates a fragment shader using the provided shader source code.
22
+ * @param gl The WebGL2 rendering context.
23
+ * @param shaderSource The source code of the fragment shader.
24
+ * @returns The compiled WebGLShader object representing the fragment shader.
25
+ */
26
+ createFragmentShader(gl: WebGL2RenderingContext, shaderSource: string): WebGLShader;
27
+ }
28
+ //# sourceMappingURL=WebGlShaderUtilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlShaderUtilities.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/WebGlShaderUtilities.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,qBAAa,oBAAoB;IAE7B;;;;;;OAMG;IACI,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAG,MAAM,GAAG,WAAW;IAejG;;;;;OAKG;IACI,kBAAkB,CAAC,EAAE,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW;IAIxF;;;;;OAKG;IACI,oBAAoB,CAAC,EAAE,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW;CAG7F"}