@ignifx/2d 0.1.0 → 0.2.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignifx/2d",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "ignifx 2D toolkit: Camera2D, sprites, sprite animation, atlases, tilemaps, sorting layers, pixel-perfect, parallax.",
5
5
  "keywords": [
6
6
  "ignifx",
@@ -43,11 +43,11 @@
43
43
  "typedoc-plugin-markdown": "^4.13.0",
44
44
  "typescript-native": "npm:typescript@7.0.2",
45
45
  "vitest": "^5.0.0",
46
- "@ignifx/core": "0.1.0"
46
+ "@ignifx/core": "0.2.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@babylonjs/lite": "1.27.0",
50
- "@ignifx/core": "0.1.0"
50
+ "@ignifx/core": "0.2.0"
51
51
  },
52
52
  "ignifx": {
53
53
  "extension": true,
@@ -3,7 +3,7 @@ name: 2d
3
3
  description: Builds 2D games in ignifx with @ignifx/2d: Camera2D, SpriteRenderer, SpriteAnimator, texture atlases, Tilemap rendering and import, sorting layers and Y-sort, pixel-perfect cameras, parallax layers, and 2D picking. Use when adding or editing sprites, sprite animation, tilemaps, atlases, sorting layers, or a 2D camera in an ignifx project, or when the user mentions @ignifx/2d, Camera2D, SpriteRenderer, or Tilemap.
4
4
  license: Apache-2.0
5
5
  metadata:
6
- ignifx-version: "0.1.0"
6
+ ignifx-version: "0.2.0"
7
7
  ---
8
8
 
9
9
  # @ignifx/2d
@@ -49,7 +49,8 @@ overrides them for that scene:
49
49
  | `pixelsPerUnit` | `100` | How many pixels one world metre spans |
50
50
  | `ySort` | `{}` | Which sorting layers draw back-to-front by world Y |
51
51
 
52
- Sorting layers themselves live in the **core** `sortingLayers` section, back to front.
52
+ Sorting layers themselves live in the **core** `sortingLayers` section, back to front, and the colour
53
+ a `"sprite"`-mode frame is cleared to is the core `rendering.clearColor` setting — see the Gotchas.
53
54
 
54
55
  ## Mental model
55
56
 
@@ -231,6 +232,20 @@ Generated reference: `skills/ignifx/references/formats/`.
231
232
  `Tilemap.worldToCell`, which is exact and free.
232
233
  - **Register `SpriteLayerEffect` before the first sprite on its layer.** A Lite layer's shader is
233
234
  fixed at creation.
235
+ - **The sky of a `"sprite"`-mode frame is `rendering.clearColor`, and nothing else.** The sprite pass
236
+ owns the frame and clears it, so neither `Camera.clearColor` nor `Environment.clearColor` reaches
237
+ the screen in a 2D game — and `Camera2D` has no `clearColor` field. Set it in `ignifx.config.ts`
238
+ under `rendering`, not per camera. In `"mixed"` mode the render scene clears instead and the 3D
239
+ precedence applies as usual.
240
+ - **`clearColor` is sRGB and is presented as its linear value**, so a channel lands on screen at
241
+ `srgbToLinear(value) * 255` rather than `value * 255`: `{ r: 0.6, g: 0.2, b: 0.9 }` reads back as
242
+ bytes `81, 8, 201`, and a literal `#14181F` is almost black. That is the same in both 2D modes and
243
+ on the 3D path — one setting, one colour — so pass the inverse if you are matching a page colour.
244
+ Measured on 2026-09-08 (macOS arm64, SwiftShader, `packages/2d/test/clear-color.browser.test.ts`).
245
+ - **A world whose only camera is a `Camera2D` does not log `IGX-0706`.** Core's "no enabled camera"
246
+ warning is suppressed while the sprite renderer has an active `Camera2D`, so a correct 2D-only
247
+ scene is quiet. Build the camera **before** `app.start()`, as the templates do: a world that is
248
+ still empty when the loop starts has no camera of any kind, and that does warn.
234
249
 
235
250
  ## Deprecated (current window)
236
251