@flighthq/scene2d-wgpu 0.3.0-next.1280.6369398 → 0.3.0-next.1297.43a5ef8

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": "@flighthq/scene2d-wgpu",
3
- "version": "0.3.0-next.1280.6369398",
3
+ "version": "0.3.0-next.1297.43a5ef8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/flighthq/flight.git",
@@ -36,23 +36,23 @@
36
36
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@flighthq/color": "0.3.0-next.1280.6369398",
40
- "@flighthq/scene2d": "0.3.0-next.1280.6369398",
41
- "@flighthq/scene2d-canvas": "0.3.0-next.1280.6369398",
42
- "@flighthq/geometry": "0.3.0-next.1280.6369398",
43
- "@flighthq/image": "0.3.0-next.1280.6369398",
44
- "@flighthq/log": "0.3.0-next.1280.6369398",
45
- "@flighthq/node": "0.3.0-next.1280.6369398",
46
- "@flighthq/path": "0.3.0-next.1280.6369398",
47
- "@flighthq/render": "0.3.0-next.1280.6369398",
48
- "@flighthq/render-wgpu": "0.3.0-next.1280.6369398",
49
- "@flighthq/shape": "0.3.0-next.1280.6369398",
50
- "@flighthq/text": "0.3.0-next.1280.6369398",
51
- "@flighthq/textinput": "0.3.0-next.1280.6369398",
52
- "@flighthq/textlayout": "0.3.0-next.1280.6369398",
53
- "@flighthq/texture": "0.3.0-next.1280.6369398",
54
- "@flighthq/types": "0.3.0-next.1280.6369398",
55
- "@flighthq/velocity": "0.3.0-next.1280.6369398"
39
+ "@flighthq/color": "0.3.0-next.1297.43a5ef8",
40
+ "@flighthq/scene2d": "0.3.0-next.1297.43a5ef8",
41
+ "@flighthq/scene2d-canvas": "0.3.0-next.1297.43a5ef8",
42
+ "@flighthq/geometry": "0.3.0-next.1297.43a5ef8",
43
+ "@flighthq/image": "0.3.0-next.1297.43a5ef8",
44
+ "@flighthq/log": "0.3.0-next.1297.43a5ef8",
45
+ "@flighthq/node": "0.3.0-next.1297.43a5ef8",
46
+ "@flighthq/path": "0.3.0-next.1297.43a5ef8",
47
+ "@flighthq/render": "0.3.0-next.1297.43a5ef8",
48
+ "@flighthq/render-wgpu": "0.3.0-next.1297.43a5ef8",
49
+ "@flighthq/shape": "0.3.0-next.1297.43a5ef8",
50
+ "@flighthq/text": "0.3.0-next.1297.43a5ef8",
51
+ "@flighthq/textinput": "0.3.0-next.1297.43a5ef8",
52
+ "@flighthq/textlayout": "0.3.0-next.1297.43a5ef8",
53
+ "@flighthq/texture": "0.3.0-next.1297.43a5ef8",
54
+ "@flighthq/types": "0.3.0-next.1297.43a5ef8",
55
+ "@flighthq/velocity": "0.3.0-next.1297.43a5ef8"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@flighthq/bitmaptext": "*",
@@ -1,13 +1,18 @@
1
1
  import {
2
2
  createWgpuRenderStateForTest,
3
+ getWgpuRenderStateRuntime,
3
4
  installWgpuMock,
5
+ registerWgpuRenderTextureResolver,
6
+ renderIntoWgpuRenderTexture,
4
7
  renderWgpuBackground,
5
8
  submitWgpuRenderPass,
6
9
  } from '@flighthq/render-wgpu/contract';
7
10
  import { getOrCreateRenderProxy2D, prepareScene2DRender } from '@flighthq/render/contract';
8
11
  import { createSprite } from '@flighthq/scene2d/contract';
12
+ import { createRenderTexture, setTextureUvFromPixelRect } from '@flighthq/texture/contract';
9
13
 
10
14
  import { defaultWgpuSpriteRenderer, drawWgpuSprite } from './wgpuSprite';
15
+ import { registerStandardWgpuMaterial } from './wgpuStandardMaterial';
11
16
 
12
17
  beforeAll(() => installWgpuMock());
13
18
 
@@ -28,4 +33,22 @@ describe('drawWgpuSprite', () => {
28
33
  expect(() => drawWgpuSprite(state, getOrCreateRenderProxy2D(state, sprite))).not.toThrow();
29
34
  submitWgpuRenderPass(state);
30
35
  });
36
+
37
+ it('uses the physical slab once and preserves a top-origin render-target sub-view', async () => {
38
+ const state = await createWgpuRenderStateForTest();
39
+ renderWgpuBackground(state);
40
+ registerWgpuRenderTextureResolver(state);
41
+ registerStandardWgpuMaterial(state);
42
+ const renderTexture = createRenderTexture({ height: 480, width: 720 });
43
+ setTextureUvFromPixelRect(renderTexture, 140, 160, 100, 80);
44
+ renderIntoWgpuRenderTexture(state, renderTexture, () => {});
45
+ const sprite = createSprite({ data: { texture: renderTexture } });
46
+ prepareScene2DRender(state, sprite);
47
+
48
+ drawWgpuSprite(state, getOrCreateRenderProxy2D(state, sprite));
49
+
50
+ const data = getWgpuRenderStateRuntime(state).quadBatchWriterInstanceData;
51
+ expect(data.slice(6, 12)).toEqual(new Float32Array([100, 80, 140 / 720, 160 / 480, 240 / 720, 240 / 480]));
52
+ submitWgpuRenderPass(state);
53
+ });
31
54
  });