ris-framework 0.2.0-dev.12 → 0.2.0-dev.14

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 (59) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/README.md +101 -158
  3. package/dist/api/IFramework.d.ts +3 -3
  4. package/dist/api/IFramework.d.ts.map +1 -1
  5. package/dist/api/content/ContentManager.d.ts +2 -2
  6. package/dist/api/content/ContentManager.d.ts.map +1 -1
  7. package/dist/api/content/IContentManager.d.ts +2 -2
  8. package/dist/api/content/IContentManager.d.ts.map +1 -1
  9. package/dist/api/rendering/IRenderer.d.ts +11 -6
  10. package/dist/api/rendering/IRenderer.d.ts.map +1 -1
  11. package/dist/api/rendering/enums.d.ts +5 -5
  12. package/dist/api/rendering/enums.d.ts.map +1 -1
  13. package/dist/api/rendering/texture/ITextureDescriptor.d.ts +49 -0
  14. package/dist/api/rendering/texture/ITextureDescriptor.d.ts.map +1 -0
  15. package/dist/api/rendering/texture/ITextureFactory.d.ts +2 -2
  16. package/dist/api/rendering/texture/ITextureFactory.d.ts.map +1 -1
  17. package/dist/api/rendering/texture/TextureUtilities.d.ts +22 -21
  18. package/dist/api/rendering/texture/TextureUtilities.d.ts.map +1 -1
  19. package/dist/api/rendering/texture/_export-texture.d.ts +1 -1
  20. package/dist/api/rendering/texture/_export-texture.d.ts.map +1 -1
  21. package/dist/core/rendering/ARenderer.d.ts +3 -0
  22. package/dist/core/rendering/ARenderer.d.ts.map +1 -1
  23. package/dist/core/rendering/texture/TextureDescriptorUtilities.d.ts +14 -0
  24. package/dist/core/rendering/texture/TextureDescriptorUtilities.d.ts.map +1 -0
  25. package/dist/core/rendering/texture/texture.d.ts +3 -2
  26. package/dist/core/rendering/texture/texture.d.ts.map +1 -1
  27. package/dist/index.js +277 -290
  28. package/dist/webgl/texture/WebGlTexture2D.d.ts +3 -2
  29. package/dist/webgl/texture/WebGlTexture2D.d.ts.map +1 -1
  30. package/dist/webgl/texture/WebGlTextureFactory.d.ts +2 -9
  31. package/dist/webgl/texture/WebGlTextureFactory.d.ts.map +1 -1
  32. package/dist/webgl/utilities/WebGlErrorUtilities.d.ts.map +1 -1
  33. package/dist/webgpu/texture/WebGpuTexture2D.d.ts +3 -2
  34. package/dist/webgpu/texture/WebGpuTexture2D.d.ts.map +1 -1
  35. package/dist/webgpu/texture/WebGpuTextureFactory.d.ts +2 -2
  36. package/dist/webgpu/texture/WebGpuTextureFactory.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/Framework.ts +2 -2
  39. package/src/api/IFramework.ts +3 -3
  40. package/src/api/content/ContentManager.ts +9 -7
  41. package/src/api/content/IContentManager.ts +2 -2
  42. package/src/api/rendering/IRenderer.ts +12 -6
  43. package/src/api/rendering/enums.ts +5 -5
  44. package/src/api/rendering/texture/ITextureDescriptor.ts +57 -0
  45. package/src/api/rendering/texture/ITextureFactory.ts +2 -2
  46. package/src/api/rendering/texture/TextureUtilities.ts +43 -61
  47. package/src/api/rendering/texture/_export-texture.ts +1 -1
  48. package/src/core/rendering/ARenderer.ts +6 -2
  49. package/src/core/rendering/texture/TextureDescriptorUtilities.ts +27 -0
  50. package/src/core/rendering/texture/texture.ts +2 -2
  51. package/src/main.ts +5 -4
  52. package/src/webgl/texture/WebGlTexture2D.ts +9 -8
  53. package/src/webgl/texture/WebGlTextureFactory.ts +50 -64
  54. package/src/webgl/utilities/WebGlErrorUtilities.ts +3 -2
  55. package/src/webgpu/texture/WebGpuTexture2D.ts +10 -9
  56. package/src/webgpu/texture/WebGpuTextureFactory.ts +19 -16
  57. package/dist/api/rendering/texture/TextureDescriptor.d.ts +0 -42
  58. package/dist/api/rendering/texture/TextureDescriptor.d.ts.map +0 -1
  59. package/src/api/rendering/texture/TextureDescriptor.ts +0 -52
package/CHANGELOG.md CHANGED
@@ -16,10 +16,10 @@ Compared with `main` (0.1.0).
16
16
  - Materials take a `modelBuffer` owned by the mesh instead of `modelMatrix`, and `renderMesh` takes an `IRenderableMesh`.
17
17
  - Render pipelines throw when no model buffer is passed.
18
18
  - Requires `ris-ktx2` 0.2.
19
+ - `TextureDescriptor` class is replaced by the `ITextureDescriptor` interface; all fields are optional and factories fill in defaults.
19
20
 
20
21
  ### Added
21
22
 
22
- - WebGPU backend (preview): set `renderingBackend` and call `framework.initializeAsync()`. Only unlit materials are supported so far; WebGL stays the default and is used as a fallback.
23
23
  - `Scene` with `add`/`remove` for meshes, lights and the camera, plus `SceneMesh` for owning a mesh and its materials.
24
24
  - Lights: `AmbientLight`, `DirectionalLight` and `PointLight`.
25
25
  - `ForwardBlinnPhongMaterial`, `SpriteMaterial`, and the `ICameraMaterial`/`ILightsMaterial` interfaces.
@@ -27,11 +27,14 @@ Compared with `main` (0.1.0).
27
27
  - OBJ/MTL loading through `framework.objLoader`, `ObjParser`, and `content.loadMeshAsync`, `loadUnlitMeshAsync` and `loadBlinnPhongMeshAsync`.
28
28
  - `geometryBuilder.create(descriptor)` and the exported `BaseGeometry`.
29
29
  - sRGB compressed texture formats (BC1, BC3, BC7, ETC2), with KTX2 loading choosing sRGB automatically.
30
- - Examples: `unlit_mesh`, `unlit_mesh_webgpu`, `blinn_phong_mesh` and `sprite_batch`.
30
+ - `ColorSpace` enum, the `textureColorSpace` configuration option (default `SRGB`) and `IRenderer.preferredColorSpace`.
31
+ - `TextureUtilities.convertToSrgbVariant`, `convertToLinearVariant` and `isSrgbFormat`.
32
+ - Examples: `unlit_mesh`, `blinn_phong_mesh` and `sprite_batch`.
31
33
 
32
34
  ### Changed
33
35
 
34
36
  - `content.loadShaderModule` accepts optional replacement values.
37
+ - Textures without a format, and KTX2 textures, follow the configured color space.
35
38
 
36
39
  ### Fixed
37
40
 
package/README.md CHANGED
@@ -1,212 +1,155 @@
1
1
  # ris-framework
2
2
 
3
- `ris-framework` is a browser WebGL2 framework, published as an ES module. Version 0.1.0. An application imports the compiled package. This repository also contains a sample page that runs the framework.
4
-
5
- Open `index.html`. The module script is `src/main.ts`. That file builds the page, constructs a `Framework`, and starts the frame loop. Shared interfaces and value types (`IFramework`, `Color`, `Rect`, `TextureDescriptor`, and the rest) ship from this package. They used to live in `ris-framework-api`. This repository implements them.
6
-
7
- ## Layout
8
-
9
- | Path | What lives there |
10
- | --- | --- |
11
- | `index.html` | The page. It has `#app` and `<canvas id="game-canvas" width="800" height="600">`. |
12
- | `src/main.ts` | Application entry. |
13
- | `src/index.ts` | Package entry. Exports `Framework`, `FrameworkConfiguration`, `TextureSamplerFilteringPreset`, and everything under `src/api`. |
14
- | `src/Framework.ts` | `Framework`, which wires the renderer, factories, managers, and the frame loop together. |
15
- | `src/api` | Interfaces and value types formerly published as `ris-framework-api` (input, textures, cameras, `TextureUtilities`, and the rest). It also holds `FrameworkConfiguration` and the backend-independent implementations: `WindowManager`, `InputManager`, `ContentManager`, `SpriteBatch`, `GeometryBuilder`, and `BaseGeometry`. `src/api/content/ShaderModuleContent.ts` maps the built-in shader module ids to GLSL from `shaders/glsl`. |
16
- | `src/core` | Renderer and graphics-device base classes (`ARenderer`, `AGraphicsDevice`), the texture base class, blend and sampler descriptors, `VertexBufferLayout`, and `TextureSamplerFilteringPreset`. |
17
- | `src/webgl` | The WebGL2 graphics device, renderer, textures, buffers, samplers, and render pipelines. |
18
- | `shaders/glsl` | Vertex and fragment shaders used by the built-in shader modules. |
19
- | `tests` | Vitest tests for the types under `src/api`. |
20
-
21
- Runtime dependencies are `ris-ktx2` and `gl-matrix`. The KTX2 types (`IKtx2Texture`, `VkFormat`, `KtxTranscodeFormat`, and the rest) are imported from `ris-ktx2`. The library build includes the browser portion of `ris-ktx2`, with its Node loader replaced by a stub, so the published entry does not import Node built-ins. TypeScript, Vite, and Vitest are dev dependencies. Notices for the bundled KTX loader are in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). The package license is Apache License 2.0. Copyright 2026 Luka Erkapic. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
22
-
23
- ## Prerequisites
24
-
25
- - Node.js 22. Continuous integration uses Node.js 22. Vite 7 in this repo requires `^20.19.0` or `>=22.12.0`.
26
- - npm.
27
- - A browser that can create a WebGL2 context. If `canvas.getContext("webgl2")` fails, startup throws `WebGL not supported.`
28
-
29
- ## Install
30
-
31
- Install the package in an application:
3
+ A browser WebGL2 framework for TypeScript, published as an ES module (version 0.2.0). Runtime dependencies are `gl-matrix` and `ris-ktx2`.
32
4
 
33
5
  ```sh
34
6
  npm install ris-framework
35
7
  ```
36
8
 
37
- The published entry is compiled JavaScript and TypeScript declarations (`dist/index.js` and `dist/index.d.ts`). Import the public surface by package name:
9
+ Everything public is exported from the package entry: `Framework`, `TextureSamplerFilteringPreset`, and the API types (scenes, meshes, materials, lights, cameras, textures, loaders, input).
38
10
 
39
- ```ts
40
- import { Framework, FrameworkConfiguration, TextureSamplerFilteringPreset } from "ris-framework";
41
- ```
11
+ ## Create and start a framework
42
12
 
43
- The same entry re-exports the former `ris-framework-api` surface, so a consumer can import those names from `ris-framework`:
13
+ Pass an `IFrameworkConfiguration` object. Every field is optional.
44
14
 
45
15
  ```ts
46
- import { Color, Rect, TextureFormat, TextureUtilities, type IInputManager } from "ris-framework";
47
- ```
16
+ import { Color, Framework, type IFrameworkConfiguration, TextureSamplerFilteringPreset } from "ris-framework";
48
17
 
49
- `Framework`, `FrameworkConfiguration`, `TextureSamplerFilteringPreset`, and that API surface are the public entry. Built-in GLSL is compiled into `dist/index.js`, so a consumer does not load this repository's `shaders/` directory at runtime. The same file includes the browser KTX2 loader. A consuming Vite app can import the package and build without adding a Node stub of its own.
18
+ const config: IFrameworkConfiguration = {
19
+ canvas: document.querySelector<HTMLCanvasElement>("#game-canvas")!,
20
+ textureFiltering: TextureSamplerFilteringPreset.BILINEAR,
21
+ useKtx2: true,
22
+ };
50
23
 
51
- To work in this repository:
52
-
53
- ```sh
54
- npm ci
55
- ```
24
+ const framework = new Framework(config);
56
25
 
57
- `Framework` creates its services itself and passes dependencies through their constructors; no dependency-injection container or `reflect-metadata` import is needed.
26
+ framework.addOnLoadContentListener(async () => { /* load content */ });
27
+ framework.addOnUpdateListener(time => { /* update, time.deltaTimeSec */ });
28
+ framework.addOnRenderListener(() => { /* draw */ });
58
29
 
59
- ## Create a framework instance
30
+ framework.initialize();
31
+ framework.renderer.clearColor = Color.cornerFlowerBlue();
32
+ ```
60
33
 
61
- Construct `FrameworkConfiguration`, then pass it to `Framework`. The constructor is `constructor(options?: IFrameworkConfiguration)`. Omitting the argument uses `new FrameworkConfiguration()`. The constructor writes the resolved `backBufferSize` back onto the object you pass.
34
+ | Field | Default | Meaning |
35
+ | --- | --- | --- |
36
+ | `canvas` | created and appended | The canvas to render into. |
37
+ | `backBufferSize` | `800 × 600` | Back buffer size. |
38
+ | `textureFiltering` | `BILINEAR` | Default sampler preset. |
39
+ | `textureColorSpace` | `SRGB` | Default texture colour space. |
40
+ | `useKtx2` | `false` | Creates `framework.ktx2Factory`. |
41
+ | `alpha` | `false` | Whether the back buffer has an alpha channel. |
42
+ | `powerPreference` | `DEFAULT` | GPU preference on multi-GPU systems. |
62
43
 
63
- Another project imports that public entry by package name: `import { Framework, FrameworkConfiguration, TextureSamplerFilteringPreset } from "ris-framework"`.
44
+ Register listeners before `initialize()`. Load-content and initialized listeners run inside that call.
64
45
 
65
- No config field is required. Each field has a default.
46
+ ## Scenes, cameras and lights
66
47
 
67
- | Field | Default | What the code does with it |
68
- | --- | --- | --- |
69
- | `canvas` | `undefined` | The canvas the WebGL2 context is created from. When unset, `Framework` logs a warning and `WindowManager` creates a canvas and appends it to `document.body`. `src/main.ts` sets this to `#game-canvas`. |
70
- | `backBufferSize` | `undefined` (the constructor uses `vec2.fromValues(800, 600)`) | Copied onto an internal `IRendererConfiguration`. `WebGlRenderer` leaves that copy unused. The main render target starts at the canvas element's `width` and `height`. The canvas in `index.html` is 800 by 600. |
71
- | `textureFiltering` | `TextureSamplerFilteringPreset.BILINEAR` | Preset for the graphics device's default texture sampler. `POINT` is nearest filtering with no mipmaps. `BILINEAR` is linear filtering with no mipmaps. `TRILINEAR` is linear filtering with linear mipmaps. `undefined` is treated as `BILINEAR`. |
72
- | `useKtx2` | `false` | When `true`, the constructor sets `framework.ktx2Factory` to a `Ktx2Factory`. `initialize()` then calls `initializeAsync()` on it and does not wait. When `false`, `ktx2Factory` stays unset. |
73
- | `alpha` | `false` | Passed as the WebGL2 context's `alpha` attribute, so it decides whether the canvas back buffer has an alpha channel. |
74
- | `powerPreference` | `PowerPreferenceType.DEFAULT` | Passed as the WebGL2 context's `powerPreference` (`"default"`, `"low-power"`, or `"high-performance"`). It only matters on machines with more than one GPU. |
48
+ ```ts
49
+ import { Color, DirectionalLight, PointLight, Scene } from "ris-framework";
75
50
 
76
- Every field is optional on `IFrameworkConfiguration`. A new `FrameworkConfiguration` sets `useKtx2`, `textureFiltering`, `alpha`, and `powerPreference`. `canvas` and `backBufferSize` start unset.
51
+ const scene = new Scene(framework);
77
52
 
78
- ```ts
79
- import { Framework, FrameworkConfiguration, TextureSamplerFilteringPreset } from "ris-framework";
53
+ // Passing the scene makes this the scene's camera.
54
+ const camera = framework.cameraFactory.createPerspectiveCamera({
55
+ aspectRatio: canvas.width / canvas.height,
56
+ eye: [0, 0, 3],
57
+ }, scene);
80
58
 
81
- const config = new FrameworkConfiguration();
82
- config.canvas = document.getElementById("game-canvas") as HTMLCanvasElement;
83
- config.textureFiltering = TextureSamplerFilteringPreset.BILINEAR;
59
+ scene.activeAmbientLight.color = new Color(0.4, 0.4, 0.4);
60
+ // Lights take an optional scene; passing it adds them.
61
+ new DirectionalLight({ color: new Color(1, 1, 1), intensity: 0.8, direction: [-0.4, -0.6, 1] }, scene);
62
+ new PointLight({ color: new Color(1, 0.5, 0.2), intensity: 1.2, linear: 0.35, quadratic: 0.44 }, scene);
84
63
 
85
- const framework = new Framework(config);
64
+ framework.addOnUpdateListener(time => {
65
+ camera.update(time);
66
+ scene.update(time);
67
+ });
68
+ framework.addOnRenderListener(() => scene.render());
86
69
  ```
87
70
 
88
- `src/main.ts` constructs the sample the same way, but it imports those three symbols from the source files under `src/` instead of from the package name.
71
+ `scene.add(item)` and `scene.remove(item)` accept a renderable mesh, a `SceneMesh`, a light or a camera. Blinn-Phong materials support up to 3 directional and 5 point lights.
89
72
 
90
- `framework.renderingBackend` is `RenderingBackend.WEB_GL`. After `initialize()`, `framework.graphicsDevice` is the renderer's WebGL2 device.
73
+ ## Meshes and materials
91
74
 
75
+ - `IMesh` / `Mesh` hold geometry and the vertex and index buffers.
76
+ - `IRenderableMesh` / `RenderableMesh` add a material, an index range and sub meshes (`mesh.addSubMesh(material, start, count)` or `meshFactory.createWithSubMeshes`). The root mesh owns the transform and one model buffer, which all its sub meshes share.
77
+ - Transforms: `mesh.position`, `mesh.rotation` (Euler radians, applied Y, then X, then Z) and `mesh.scale`. `mesh.modelMatrix` is recomputed only when one of them changes.
78
+ - `SceneMesh`: `scene.add(mesh)` wraps a renderable mesh in a `SceneMesh`, which owns its materials. `sceneMesh.dispose()` and `scene.dispose()` dispose the mesh and each material once.
79
+ - Materials come from `framework.materialFactory`. They include unlit, `ForwardBlinnPhongMaterial` and `SpriteMaterial`.
92
80
 
93
- ## From startup to the first frame
81
+ ## Loading OBJ/MTL
94
82
 
95
- `src/main.ts` is the current startup path. It still fills `#app` with the Vite starter page (logos and a heading) and then starts the framework on `#game-canvas`.
83
+ ```ts
84
+ // Unlit or Blinn-Phong materials (one per usemtl), coloured from the .mtl.
85
+ const cube = await framework.content.loadBlinnPhongMeshAsync("/assets/cube.obj", camera);
86
+ const flat = await framework.content.loadUnlitMeshAsync("/assets/cube.obj", camera);
87
+ scene.add(cube);
96
88
 
97
- Register listeners before `initialize()`. Load-content and initialized listeners run only inside that call. Update and render listeners stay on the loop, so a listener added later still runs on a following frame. `initialize()` does this:
89
+ // Lower level: pass a Blinn-Phong descriptor or a material factory per sub mesh.
90
+ const mesh = await framework.objLoader.loadAsync("/assets/cube.obj", {
91
+ projectionViewBuffer: camera.projectionViewBuffer,
92
+ cameraPositionBuffer: camera.positionBuffer,
93
+ });
98
94
 
99
- 1. Starts KTX2 initialization when `useKtx2` is set, without awaiting it.
100
- 2. Creates the WebGL2 context, swap chain, and default sampler, blend state, and primitive state.
101
- 3. Initializes the sprite batch (a default orthographic camera and a 1×1 white texture).
102
- 4. Initializes input. Mouse move, mouse buttons, and wheel events on the canvas update `framework.input.getMouseState()`. Touch start, move, end, and cancel events on the canvas update `framework.input.getTouchCollection()`, using the same viewport `clientX` / `clientY` coordinates as the mouse. A cancel is `TouchLocationState.CANCELLED`, which is not a finger lift. The canvas `touch-action` is set to `none`, and touch start and move call `preventDefault`, so the browser does not scroll or pinch-zoom that canvas.
103
- 5. Prepares the time manager.
104
- 6. Calls every `addOnLoadContentListener` callback. Async callbacks are not awaited.
105
- 7. Calls every `addOnInitializedListener` callback.
106
- 8. Creates the main render target at the canvas size and a swap-chain pass. The clear color at this moment is `Color.lightPink()`, the renderer default.
107
- 9. Subscribes an update callback and a render callback, then runs both once before returning. Later frames are scheduled with `requestAnimationFrame`.
95
+ // Geometry only, with no materials (GeometryFormat is exported from "ris-framework").
96
+ const geometry = await framework.content.loadMeshAsync("/assets/cube.obj", GeometryFormat.POS3_COLOR4_TEXTURECOORDS2);
97
+ ```
108
98
 
109
- Each update calls `timeManager.frameStart()`, updates input, then calls `addOnUpdateListener` callbacks with that frame's `GameTime`. `src/main.ts` registers no update listener. Each render begins the main pass, calls `addOnRenderListener` callbacks, calls `spriteBatch.frameEnd()`, and presents.
99
+ `ObjLoader.parseAsync(path)` and `ObjParser` return plain data without creating GPU resources.
110
100
 
111
- Before that call, `src/main.ts` registers the listeners below. The sample loads images, creates a nearest sampler, and draws with the sprite batch:
101
+ ## Textures and KTX2
112
102
 
113
103
  ```ts
114
- import {
115
- Color,
116
- Rect,
117
- SamplerDescriptor,
118
- SamplerFilter,
119
- TextureDescriptor,
120
- TextureFormat,
121
- type ISampler,
122
- type ITexture2D,
123
- } from "ris-framework";
124
-
125
- const rect = new Rect(200, 200, 200, 200);
126
- const texRect = new Rect(500, 200, 200, 200);
127
- const color = Color.blue();
128
- const white = Color.white();
129
- let tex: ITexture2D;
130
- let sampler: ISampler;
131
-
132
- framework.addOnLoadContentListener(async () => {
133
- const texDesc = new TextureDescriptor();
134
- texDesc.generateMipmaps = true;
135
- texDesc.textureFormat = TextureFormat.RGBA_8_UNORM;
136
-
137
- tex = await framework.content.loadTexture2DAsync("/assets/test.png", texDesc);
138
- });
139
-
140
- framework.addOnInitializedListener(() => {
141
- const desc = new SamplerDescriptor();
142
- desc.minFilter = SamplerFilter.NEAREST;
143
- desc.magFilter = SamplerFilter.NEAREST;
144
- sampler = framework.graphicsDevice.createSampler(desc);
145
- });
146
-
147
- framework.addOnRenderListener(() => {
148
- const spriteBatch = framework.spriteBatch;
149
- spriteBatch.begin(undefined, sampler);
150
- spriteBatch.drawRect(rect, color);
151
- if (tex != null) {
152
- spriteBatch.draw(tex, texRect, white);
153
- }
154
- spriteBatch.end();
155
- });
104
+ const png = await framework.content.loadTexture2DAsync("/assets/test.png");
105
+ const ktx = await framework.content.loadTexture2DAsync("/assets/kodim23.ktx2");
156
106
 
157
- framework.initialize();
158
- framework.renderer.clearColor = Color.lightPink();
107
+ // Optional descriptor: every field is optional, missing ones get defaults.
108
+ const desc: ITextureDescriptor = { generateMipmaps: true, textureFormat: TextureFormat.RGBA_8_UNORM };
109
+ const cat = await framework.content.loadTexture2DAsync("/assets/cat.jpg", desc);
159
110
  ```
160
111
 
161
- `loadTexture2DAsync(path, textureDescriptor?, contentConfig?)` is the image path used above. For a path that does not end in `.ktx2`, the descriptor's `textureFormat` is used when it is not `TextureFormat.UNDEFINED`; otherwise the renderer's preferred format is used. `generateMipmaps` is passed through. Width, height, pixel data, usage, label, and block size on that descriptor are not applied to this load. An optional `ContentConfig` only forwards `keepDataCached` to the image loader.
112
+ Textures without a format use `RGBA_8_UNORM_SRGB` when `textureColorSpace` is `SRGB` (the default) and `RGBA_8_UNORM` when it is `LINEAR`.
162
113
 
163
- The first `begin` / `drawRect` / `end` runs inside `initialize()`, before the texture promise resolves, so the blue rectangle is the first draw. Later frames draw the texture once `tex` is set. `spriteBatch.begin` with no matrix keeps the default orthographic camera. The sampler argument overrides the device's default sampler for that batch. `drawRect` draws the 1×1 white texture tinted by `color`.
114
+ Paths ending in `.ktx2` are loaded through `ris-ktx2`.
164
115
 
165
- `src/main.ts` also loads `/assets/cat.jpg` the same way and draws it at `new Rect(200, 500, 200, 200)`. Those two files are absent from this repository. Put them under `public/assets/` before those loads can succeed. The blue rectangle still draws when the image loads fail.
116
+ - **Basis Universal files** are transcoded to the best format the GPU supports, in this order: BC7, ASTC 4×4, BC3, ETC2, PVRTC, and RGBA8 as a last resort.
117
+ - **Other KTX2 files** are uploaded in their stored format.
118
+ - **sRGB:** sRGB files load as sRGB formats (`BC7_RGBA_SRGB`, `BC3_RGBA_SRGB`, `BC1_RGB_SRGB`, `ETC2_RGBA8_SRGB`, `ETC2_RGB8_SRGB`, `ASTC_*_RGBA_SRGB`, `RGBA_8_UNORM_SRGB`), so the GPU decodes them to linear.
119
+ - **sRGB fallback:** if `WEBGL_compressed_texture_s3tc_srgb` is missing, sRGB BC1 and BC3 textures fall back to linear with a warning.
166
120
 
167
- Setting `framework.renderer.clearColor` after `initialize()` updates later frames. The first frame has already cleared with the default light pink.
121
+ `framework.graphicsDevice.features` reports compression support: `supportsTextureCompressionBC` (BPTC/BC7), `supportsTextureCompressionS3TC`, `supportsTextureCompressionS3TCSrgb`, `supportsTextureCompressionETC2`, `supportsTextureCompressionASTC` and `supportsTextureCompressionPVRTC`.
168
122
 
169
- ## Scene
170
-
171
- `new Scene(framework)` holds meshes, lights and the camera. `scene.add(item)` and `scene.remove(item)` accept a renderable mesh (wrapped in a `SceneMesh`, which owns and disposes its materials), an `AmbientLight`, `DirectionalLight`, `PointLight` or a camera; adding twice does nothing. Lights and the perspective camera given a scene in their constructor add themselves. Adding a camera makes it `scene.camera`; removing the active camera clears it. `scene.update(time)` hands the camera, the active ambient light and the scene's light lists (by reference) to the materials. `addLight`/`removeLight` remain as deprecated aliases.
172
-
173
- Meshes follow the C# framework: `IMesh`/`Mesh` hold geometry and buffers only; `IRenderableMesh`/`RenderableMesh` add an optional material, an index range (`indexStart`, `indexCount`, -1 for all), sub meshes that share the root's buffers, and the transform with one model buffer per root. OBJ files load through `framework.objLoader`:
123
+ ## Sprites
174
124
 
175
125
  ```ts
176
- const mesh = await framework.objLoader.loadAsync(url, {
177
- projectionViewBuffer: camera.projectionViewBuffer,
178
- cameraPositionBuffer: camera.positionBuffer,
179
- }); // one ForwardBlinnPhongMaterial per usemtl material
180
- // or: framework.objLoader.loadAsync(url, subMesh => myMaterial(subMesh.material))
181
- // or: await ObjLoader.parseAsync(url) for plain data without GPU resources
182
- scene.add(mesh);
126
+ framework.addOnRenderListener(() => {
127
+ framework.spriteBatch.begin();
128
+ framework.spriteBatch.draw(texture, new Rect(200, 200, 200, 200), Color.white());
129
+ framework.spriteBatch.drawRect(new Rect(500, 200, 100, 100), Color.blue());
130
+ framework.spriteBatch.end();
131
+ });
183
132
  ```
184
133
 
185
- ## Examples
134
+ ## Examples and scripts
186
135
 
187
- Browser examples live in [`examples/`](examples/), one folder per example. See [`examples/README.md`](examples/README.md).
136
+ Examples live in [`examples/`](examples/): `unlit_mesh`, `blinn_phong_mesh` and `sprite_batch` (see [`examples/README.md`](examples/README.md)).
188
137
 
189
138
  ```sh
190
- npm run dev:examples # serve the examples index, e.g. /sprite_batch/
191
- npm run build:examples # build every example into examples/dist/
139
+ npm ci
140
+ npm run dev:examples # serve the examples
141
+ npm run build:examples # build them into examples/dist/
142
+ npm run dev # src/main.ts playground
143
+ npm test # type-check and Vitest
144
+ npm run build # library (dist/) and app build
192
145
  ```
193
146
 
194
- ## What is still unfinished
195
-
196
- These throw, or they accept a call and do not do the work the name suggests:
147
+ Requires Node.js 22 (or `^20.19.0`) and a WebGL2-capable browser.
197
148
 
198
- - `WindowManager.addOnResizeListener`, `removeOnResizeListener`, `initializeForWebGPU`, `initializeForWebGl`, and `dispose` throw `Method not implemented.` `title` and `windowBounds` are stored and never applied. There is no WebGPU backend.
199
- - `Framework.dispose()` is empty. It does not release the window, device, or GPU resources.
200
- - `renderer.beginComputePass()` and `renderer.endComputePass()` throw `Method not implemented.` `ARenderer.limits` throws the same error.
201
- - `graphicsDevice.setupDebugCallback()`, `frameEnd()`, `pushDebugGroup()`, and `popDebugGroup()` throw `Method not implemented.`
202
- - `ITexture2D.createView()` throws `Method not implemented.`
203
- - `content.loadShaderModule` only resolves the built-in ids `sprite`, `unlit_material`, `inspect_texture_mips`, and `main_render_target_flip_y`. Any other id throws `Not implemented`.
204
- - `SpriteBatch.draw` and `drawRect` accept rotation arguments and do not use them. `layerDepth` is written as the sprite's z position.
205
- - Keyboard and gamepad queries return empty state. `getKeyboardState()` is an empty `KeyboardState`. `getGamePadState()` is a disconnected `GamePadState`. `thumbstickDeadZone` is stored and not applied.
206
- - A render pass that enables stencil without depth throws `Not implemented`.
207
- - Paths ending in `.ktx2` go through `content.loadKtx2Async`, which uses its own `Ktx2Factory` and does not call `initializeAsync`. The libktx module is shared by every `Ktx2Factory`, so `loadAsync` works only after some factory has finished `initializeAsync()`. `useKtx2` starts that call in `initialize()` but does not wait for it. To load a `.ktx2` file, set `useKtx2`, await `framework.ktx2Factory.initializeAsync()` before `initialize()`, and then call `loadTexture2DAsync` from a load-content listener. `src/main.ts` does not load a `.ktx2` file.
208
- - The geometry and unlit-pipeline steps at the bottom of `src/main.ts` are comments. `geometryBuilder.quadGeometry()` can build quad data; the entry file does not upload it or draw it.
149
+ ## Known limitations
209
150
 
210
- ## Version
151
+ - Window resize listeners and compute passes throw `Method not implemented.`
152
+ - Keyboard and gamepad state are stubs.
153
+ - `SpriteBatch` ignores rotation.
211
154
 
212
- `package.json` `version` stays a release version with no prerelease suffix. It is `0.1.0`. Branch and publish rules are in [CONTRIBUTING.md](CONTRIBUTING.md).
155
+ Branch and publish rules are in [CONTRIBUTING.md](CONTRIBUTING.md). Changes are listed in [CHANGELOG.md](CHANGELOG.md).
@@ -23,7 +23,7 @@ import type { IDisposable } from "./core/IDisposable.js";
23
23
  import type { vec2 } from "gl-matrix";
24
24
  import type { TextureSamplerFilteringPreset } from "../core/rendering/enums.js";
25
25
  import type { PowerPreferenceType } from "./rendering/PowerPreference.js";
26
- import type { TextureColorSpace } from "./rendering/enums.js";
26
+ import type { ColorSpace } from "./rendering/enums.js";
27
27
  /**
28
28
  * The configuration for the framework.
29
29
  * @public
@@ -35,8 +35,8 @@ export declare class IFrameworkConfiguration {
35
35
  backBufferSize?: vec2;
36
36
  /** The texture filtering to configure */
37
37
  textureFiltering?: TextureSamplerFilteringPreset;
38
- /** The texture color space to use by default. By default, it is {@link TextureColorSpace.SRGB}. */
39
- textureColorSpace?: TextureColorSpace;
38
+ /** The texture color space to use by default. By default, it is {@link ColorSpace.SRGB}. */
39
+ textureColorSpace?: ColorSpace;
40
40
  /**
41
41
  * The HTMLCanvasElement to use for rendering.
42
42
  * If null, a new canvas will be created and added to the document body.
@@ -1 +1 @@
1
- {"version":3,"file":"IFramework.d.ts","sourceRoot":"","sources":["../../src/api/IFramework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAC9E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ACjC,UAAU,IAAI,IAAI,CAAC;IAEnB;;;OAGG;IACH,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAEpC"}
@@ -1,4 +1,4 @@
1
- import { type IShaderModule, type IContentManager, type IShaderModuleLoader, type ITexture2D, type IFramework, TextureDescriptor, ContentConfig, type IMesh, type IRenderableMesh, type GeometryFormat, type ICamera } from "../index.js";
1
+ import { type IShaderModule, type IContentManager, type IShaderModuleLoader, type ITexture2D, type IFramework, type ITextureDescriptor, ContentConfig, type IMesh, type IRenderableMesh, type GeometryFormat, type ICamera } from "../index.js";
2
2
  import type { IKtx2Texture } from "ris-ktx2";
3
3
  /**
4
4
  * The content manager.
@@ -27,7 +27,7 @@ export declare class ContentManager implements IContentManager {
27
27
  [id: string]: number;
28
28
  }): IShaderModule;
29
29
  /** @inheritDoc */
30
- loadTexture2DAsync(path: string, textureDescriptor?: TextureDescriptor, contentConfig?: ContentConfig): Promise<ITexture2D>;
30
+ loadTexture2DAsync(path: string, textureDescriptor?: ITextureDescriptor, contentConfig?: ContentConfig): Promise<ITexture2D>;
31
31
  /** @inheritDoc */
32
32
  loadTexture2DFromPixels(width: number, height: number, pixels: ArrayBuffer): ITexture2D;
33
33
  /** @inheritDoc */
@@ -1 +1 @@
1
- {"version":3,"file":"ContentManager.d.ts","sourceRoot":"","sources":["../../../src/api/content/ContentManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,iBAAiB,EAEjB,aAAa,EAEb,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,OAAO,EAEf,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAI3C;;;GAGG;AACH,qBAAa,cAAe,YAAW,eAAe;IAU/B,OAAO,CAAC,QAAQ,CAAC,UAAU;aAA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EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IASnF,kBAAkB;IACX,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC;CAS1F"}
@@ -4,7 +4,7 @@ import type { IRenderableMesh } from "../meshes/IRenderableMesh.js";
4
4
  import type { IShaderModuleLoader } from "../shader/IShaderModuleLoader.js";
5
5
  import type { IShaderModule } from "../shader/IShaderModule.js";
6
6
  import type { ITexture2D } from "../rendering/texture/ITexture2D.js";
7
- import { TextureDescriptor } from "../rendering/texture/TextureDescriptor.js";
7
+ import type { ITextureDescriptor } from "../rendering/texture/ITextureDescriptor.js";
8
8
  import { ContentConfig } from "./ContentConfig.js";
9
9
  import type { IKtx2Texture } from "ris-ktx2";
10
10
  import type { IMesh } from "../meshes/IMesh.js";
@@ -39,7 +39,7 @@ export interface IContentManager {
39
39
  * @param contentConfig - The content config.
40
40
  * @returns The Texture2D.
41
41
  */
42
- loadTexture2DAsync(path: string, desc?: TextureDescriptor, contentConfig?: ContentConfig): Promise<ITexture2D>;
42
+ loadTexture2DAsync(path: string, desc?: ITextureDescriptor, contentConfig?: ContentConfig): Promise<ITexture2D>;
43
43
  /**
44
44
  * Loads a plain mesh (geometry and buffers only, no material or transform) from an OBJ (Wavefront) file,
45
45
  * like C# `ContentManager.LoadMesh`. Materials (.mtl) are not loaded.
@@ -1 +1 @@
1
- {"version":3,"file":"IContentManager.d.ts","sourceRoot":"","sources":["../../../src/api/content/IContentManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,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AAC,CAAC;IAE5E;;;;;;;OAOG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7E;;;;;;;;OAQG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAEpF"}
@@ -5,7 +5,7 @@ import { RenderingBackend } from "./RenderingBackend.js";
5
5
  import { vec2 } from "gl-matrix";
6
6
  import type { PowerPreferenceType } from "./PowerPreference.js";
7
7
  import type { TextureSamplerFilteringPreset } from "../../core/rendering/enums.js";
8
- import type { TextureColorSpace } from "./enums.js";
8
+ import type { ColorSpace } from "./enums.js";
9
9
  /**
10
10
  * The configuration for the renderer. This is used to initialize the renderer.
11
11
  * @internal
@@ -24,7 +24,7 @@ export interface IRendererConfiguration {
24
24
  */
25
25
  textureFiltering: TextureSamplerFilteringPreset;
26
26
  /** The desired texture color space. */
27
- textureColorSpace: TextureColorSpace;
27
+ textureColorSpace: ColorSpace;
28
28
  }
29
29
  /**
30
30
  * The interface for a renderer.
@@ -36,12 +36,17 @@ export interface IRenderer {
36
36
  */
37
37
  readonly graphicsDevice: IGraphicsDevice;
38
38
  /**
39
- * The preferred texture format.
40
- * This will encode texture which do not specify texture format to:
41
- * - {@link TextureFormat.} // TODO: describe SRGB depending on TextureSurfaceFormat requested
42
- * - {@link TextureFormat.} // TODO: describe RGBA depending on TextureSurfaceFormat requested
39
+ * The preferred texture format, chosen from {@link IRendererConfiguration.textureColorSpace}.
40
+ * Textures that do not specify a texture format are created with it:
41
+ * - {@link TextureFormat.RGBA_8_UNORM_SRGB} when the color space is {@link ColorSpace.SRGB} (the default).
42
+ * - {@link TextureFormat.RGBA_8_UNORM} when the color space is {@link ColorSpace.LINEAR}.
43
43
  */
44
44
  readonly preferredTextureFormat: TextureFormat;
45
+ /**
46
+ * The preferred texture color space, taken from {@link IRendererConfiguration.textureColorSpace}.
47
+ * Textures that do not specify a format are treated as being in this color space.
48
+ */
49
+ readonly preferredColorSpace: ColorSpace;
45
50
  /**
46
51
  * The preferred depth stencil format.
47
52
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IRenderer.d.ts","sourceRoot":"","sources":["../../../src/api/rendering/IRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,KAAK,EAAC,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAGlD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IAEnC,wCAAwC;IACxC,cAAc,EAAE,IAAI,CAAC;IAErB,oCAAoC;IACpC,KAAK,EAAE,OAAO,CAAC;IAEf,0GAA0G;IAC1G,eAAe,EAAE,mBAAmB,CAAC;IAErC;;;;OAIG;IACH,gBAAgB,EAAE,6BAA6B,CAAC;IAEhD,uCAAuC;IACvC,iBAAiB,EAAE,iBAAiB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IAEtB;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;IAEzC;;;;;OAKG;IACH,QAAQ,CAAC,sBAAsB,EAAE,aAAa,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,2BAA2B,EAAE,aAAa,CAAC;IAEpD;;;OAGG;IACH,UAAU,EAAE,KAAK,CAAC;IAElB;;OAEG;IACH,QAAQ,C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AE,mBAAmB,CAAC;IAErC;;;;OAIG;IACH,gBAAgB,EAAE,6BAA6B,CAAC;IAEhD,uCAAuC;IACvC,iBAAiB,EAAE,UAAU,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IAEtB;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;IAEzC;;;;;OAKG;IACH,QAAQ,CAAC,sBAAsB,EAAE,aAAa,CAAC;IAE/C;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,UAAU,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,2BAA2B,EAAE,aAAa,CAAC;IAEpD;;;OAGG;IACH,UAAU,EAAE,KAAK,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IAEnC;;;;;;;OAOG;IACH,cAAc,EAAE,IAAI,CAAC;IAErB;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC;IAElE;;OAEG;IACH,uBAAuB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC;IACrE;;OAEG;IACH,eAAe,IAAI,IAAI,CAAC;IAExB;;OAEG;IACH,gBAAgB,IAAI,IAAI,CAAC;IAEzB;;OAEG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB;;;OAGG;IACH,eAAe,IAAI,IAAI,CAAC;IAExB;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;CACzB"}
@@ -15,11 +15,11 @@ export declare enum Culling {
15
15
  */
16
16
  Front = 2
17
17
  }
18
- /** TODO: */
19
- export declare enum TextureColorSpace {
20
- /** TODO */
18
+ /** The color space. */
19
+ export declare enum ColorSpace {
20
+ /** The linear color space. */
21
21
  LINEAR = "LINEAR",
22
- /** TODO */
23
- SRGB = "S_RGBA"
22
+ /** The sRGB color space. */
23
+ SRGB = "SRGB"
24
24
  }
25
25
  //# sourceMappingURL=enums.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/api/rendering/enums.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,OAAO;IACf;;OAEG;IACH,IAAI,IAAA;IAEJ;;OAEG;IACH,IAAI,IAAA;IAEJ;;OAEG;IACH,KAAK,IAAA;CACR;AAED,YAAY;AACZ,oBAAY,iBAAiB;IAEzB,WAAW;IACX,MAAM,WAAW;IAEjB,WAAW;IACX,IAAI,WAAW;CAClB"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/api/rendering/enums.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,OAAO;IACf;;OAEG;IACH,IAAI,IAAA;IAEJ;;OAEG;IACH,IAAI,IAAA;IAEJ;;OAEG;IACH,KAAK,IAAA;CACR;AAED,uBAAuB;AACvB,oBAAY,UAAU;IAElB,8BAA8B;IAC9B,MAAM,WAAW;IAEjB,4BAA4B;IAC5B,IAAI,SAAS;CAChB"}
@@ -0,0 +1,49 @@
1
+ import type { TextureFormat } from "./TextureFormat.js";
2
+ import type { TextureUsage } from "./TextureUsage.js";
3
+ import type { vec2 } from "gl-matrix";
4
+ /**
5
+ * The texture descriptor. Every field is optional; factories fill in the defaults for missing fields.
6
+ */
7
+ export interface ITextureDescriptor {
8
+ /**
9
+ * The texture width.
10
+ * By default, it is 0.
11
+ */
12
+ width?: number;
13
+ /**
14
+ * The texture height.
15
+ * By default, it is 0.
16
+ */
17
+ height?: number;
18
+ /**
19
+ * The texture format.
20
+ * By default, it is UNDEFINED.
21
+ */
22
+ textureFormat?: TextureFormat;
23
+ /**
24
+ * The texture usage.
25
+ * By default, it is TEXTURE_BINDING | COPY_DST.
26
+ */
27
+ textureUsage?: TextureUsage;
28
+ /**
29
+ * The texture label.
30
+ * By default, it is null.
31
+ */
32
+ label?: string | null;
33
+ /**
34
+ * The data per mip level.
35
+ * By default, it is undefined.
36
+ */
37
+ data?: Uint8Array[];
38
+ /**
39
+ * Should mipmaps be generated.
40
+ * By default, it is false.
41
+ */
42
+ generateMipmaps?: boolean;
43
+ /**
44
+ * The block size of a texture, which must be set for compressed textures.
45
+ * By default, it is undefined.
46
+ */
47
+ blockSize?: vec2;
48
+ }
49
+ //# sourceMappingURL=ITextureDescriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITextureDescriptor.d.ts","sourceRoot":"","sources":["../../../../src/api/rendering/texture/ITextureDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;IAEpB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC;CACpB"}
@@ -2,7 +2,7 @@ import { Color } from "../../data/Color.js";
2
2
  import { TextureUsage } from "./TextureUsage.js";
3
3
  import { TextureFormat } from "./TextureFormat.js";
4
4
  import type { ITexture2D } from "./ITexture2D.js";
5
- import { TextureDescriptor } from "./TextureDescriptor.js";
5
+ import type { ITextureDescriptor } from "./ITextureDescriptor.js";
6
6
  import type { IKtx2Texture } from "ris-ktx2";
7
7
  /**
8
8
  * The texture factory.
@@ -37,6 +37,6 @@ export interface ITextureFactory {
37
37
  * @param descriptor - The optional texture descriptor.
38
38
  * @returns The 2D texture.
39
39
  */
40
- createFromKtx2(ktxTexture: IKtx2Texture, descriptor?: TextureDescriptor): ITexture2D;
40
+ createFromKtx2(ktxTexture: IKtx2Texture, descriptor?: ITextureDescriptor): ITexture2D;
41
41
  }
42
42
  //# sourceMappingURL=ITextureFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ITextureFactory.d.ts","sourceRoot":"","sources":["../../../../src/api/rendering/texture/ITextureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,eAAe;IAE5B;;;;;;;;OAQG;IACH,WAAW,CACP,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC7B,YAAY,CAAC,EAAE,KAAK,EACpB,YAAY,CAAC,EAAE,YAAY,EAC3B,aAAa,CAAC,EAAE,aAAa,EAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAEhC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,GAAG,eAAe,EACpD,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,EACd,KAAK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