@flighthq/scene2d-wgpu 0.3.0-next.1315.1d4eb64 → 0.3.0-next.1392.f0bd0cc
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/wgpuStandardMaterial.d.ts +1 -1
- package/dist/wgpuStandardMaterial.js +1 -1
- package/package.json +18 -18
- package/src/wgpuShape.test.ts +6 -6
- package/src/wgpuSprite.test.ts +2 -2
- package/src/wgpuStandardMaterial.test.ts +3 -3
- package/src/wgpuTextLabel.test.ts +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createWgpuCacheState, createWgpuVelocityTarget, defaultWgpuBitmapTextRenderer, defaultWgpuNode2DVelocityWriter, defaultWgpuParticleEmitter2DRenderer, defaultWgpuParticleEmitter2DVelocityWriter, defaultWgpuQuadBatchRenderer, defaultWgpuRichTextRenderer, defaultWgpuScale9ShapeRenderer, defaultWgpuScene2DRenderer, defaultWgpuShapeCommands, defaultWgpuShapeRenderer, defaultWgpuSpriteRenderer, defaultWgpuTextLabelRenderer, defaultWgpuTextureShapeCommands, defaultWgpuTilemapRenderer, drawWgpuSprite, enableWgpuStrokePathTessellation, enableWgpuClipSupport, enableWgpuRenderCache, enableWgpuTextInput, refreshWgpuRenderCache,
|
|
1
|
+
export { createWgpuCacheState, createWgpuVelocityTarget, defaultWgpuBitmapTextRenderer, defaultWgpuNode2DVelocityWriter, defaultWgpuParticleEmitter2DRenderer, defaultWgpuParticleEmitter2DVelocityWriter, defaultWgpuQuadBatchRenderer, defaultWgpuRichTextRenderer, defaultWgpuScale9ShapeRenderer, defaultWgpuScene2DRenderer, defaultWgpuShapeCommands, defaultWgpuShapeRenderer, defaultWgpuSpriteRenderer, defaultWgpuTextLabelRenderer, defaultWgpuTextureShapeCommands, defaultWgpuTilemapRenderer, drawWgpuSprite, enableWgpuStrokePathTessellation, enableWgpuClipSupport, enableWgpuRenderCache, enableWgpuTextInput, refreshWgpuRenderCache, registerWgpuStandardMaterial, registerWgpuColorAdjustmentMaterialFeature, registerWgpuShapeCommands, registerWgpuVelocityWriter, renderWgpuScene2D, renderWgpuVelocity, } from './contract';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createWgpuCacheState, createWgpuVelocityTarget, defaultWgpuBitmapTextRenderer, defaultWgpuNode2DVelocityWriter, defaultWgpuParticleEmitter2DRenderer, defaultWgpuParticleEmitter2DVelocityWriter, defaultWgpuQuadBatchRenderer, defaultWgpuRichTextRenderer, defaultWgpuScale9ShapeRenderer, defaultWgpuScene2DRenderer, defaultWgpuShapeCommands, defaultWgpuShapeRenderer, defaultWgpuSpriteRenderer, defaultWgpuTextLabelRenderer, defaultWgpuTextureShapeCommands, defaultWgpuTilemapRenderer, drawWgpuSprite, enableWgpuStrokePathTessellation, enableWgpuClipSupport, enableWgpuRenderCache, enableWgpuTextInput, refreshWgpuRenderCache,
|
|
1
|
+
export { createWgpuCacheState, createWgpuVelocityTarget, defaultWgpuBitmapTextRenderer, defaultWgpuNode2DVelocityWriter, defaultWgpuParticleEmitter2DRenderer, defaultWgpuParticleEmitter2DVelocityWriter, defaultWgpuQuadBatchRenderer, defaultWgpuRichTextRenderer, defaultWgpuScale9ShapeRenderer, defaultWgpuScene2DRenderer, defaultWgpuShapeCommands, defaultWgpuShapeRenderer, defaultWgpuSpriteRenderer, defaultWgpuTextLabelRenderer, defaultWgpuTextureShapeCommands, defaultWgpuTilemapRenderer, drawWgpuSprite, enableWgpuStrokePathTessellation, enableWgpuClipSupport, enableWgpuRenderCache, enableWgpuTextInput, refreshWgpuRenderCache, registerWgpuStandardMaterial, registerWgpuColorAdjustmentMaterialFeature, registerWgpuShapeCommands, registerWgpuVelocityWriter, renderWgpuScene2D, renderWgpuVelocity, } from './contract';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function registerWgpuStandardMaterial(state: WgpuRenderState): void;
|
|
3
3
|
export declare const standardWgpuMaterialRenderer: WgpuMaterialRenderer;
|
|
4
4
|
//# sourceMappingURL=wgpuStandardMaterial.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { getWgpuQuadBatchPreludeWGSL } from './wgpuQuadBatchWriter';
|
|
|
4
4
|
// Registers the bundled default material under StandardMaterialKind. It is a bundled material like any
|
|
5
5
|
// other — no privileged status in the render path; a node with no material renders only if a renderer
|
|
6
6
|
// is registered for StandardMaterialKind. A user can copy this file and register their own default.
|
|
7
|
-
export function
|
|
7
|
+
export function registerWgpuStandardMaterial(state) {
|
|
8
8
|
registerWgpuMaterialRenderer(state, StandardMaterialKind, standardWgpuMaterialRenderer);
|
|
9
9
|
}
|
|
10
10
|
// Textured quad with per-instance alpha and no other effect. The batch holds no shader of its own, so
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/scene2d-wgpu",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.1392.f0bd0cc",
|
|
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.
|
|
40
|
-
"@flighthq/scene2d": "0.3.0-next.
|
|
41
|
-
"@flighthq/scene2d-canvas": "0.3.0-next.
|
|
42
|
-
"@flighthq/geometry": "0.3.0-next.
|
|
43
|
-
"@flighthq/image": "0.3.0-next.
|
|
44
|
-
"@flighthq/log": "0.3.0-next.
|
|
45
|
-
"@flighthq/node": "0.3.0-next.
|
|
46
|
-
"@flighthq/path": "0.3.0-next.
|
|
47
|
-
"@flighthq/render": "0.3.0-next.
|
|
48
|
-
"@flighthq/render-wgpu": "0.3.0-next.
|
|
49
|
-
"@flighthq/shape": "0.3.0-next.
|
|
50
|
-
"@flighthq/text": "0.3.0-next.
|
|
51
|
-
"@flighthq/textinput": "0.3.0-next.
|
|
52
|
-
"@flighthq/textlayout": "0.3.0-next.
|
|
53
|
-
"@flighthq/texture": "0.3.0-next.
|
|
54
|
-
"@flighthq/types": "0.3.0-next.
|
|
55
|
-
"@flighthq/velocity": "0.3.0-next.
|
|
39
|
+
"@flighthq/color": "0.3.0-next.1392.f0bd0cc",
|
|
40
|
+
"@flighthq/scene2d": "0.3.0-next.1392.f0bd0cc",
|
|
41
|
+
"@flighthq/scene2d-canvas": "0.3.0-next.1392.f0bd0cc",
|
|
42
|
+
"@flighthq/geometry": "0.3.0-next.1392.f0bd0cc",
|
|
43
|
+
"@flighthq/image": "0.3.0-next.1392.f0bd0cc",
|
|
44
|
+
"@flighthq/log": "0.3.0-next.1392.f0bd0cc",
|
|
45
|
+
"@flighthq/node": "0.3.0-next.1392.f0bd0cc",
|
|
46
|
+
"@flighthq/path": "0.3.0-next.1392.f0bd0cc",
|
|
47
|
+
"@flighthq/render": "0.3.0-next.1392.f0bd0cc",
|
|
48
|
+
"@flighthq/render-wgpu": "0.3.0-next.1392.f0bd0cc",
|
|
49
|
+
"@flighthq/shape": "0.3.0-next.1392.f0bd0cc",
|
|
50
|
+
"@flighthq/text": "0.3.0-next.1392.f0bd0cc",
|
|
51
|
+
"@flighthq/textinput": "0.3.0-next.1392.f0bd0cc",
|
|
52
|
+
"@flighthq/textlayout": "0.3.0-next.1392.f0bd0cc",
|
|
53
|
+
"@flighthq/texture": "0.3.0-next.1392.f0bd0cc",
|
|
54
|
+
"@flighthq/types": "0.3.0-next.1392.f0bd0cc",
|
|
55
|
+
"@flighthq/velocity": "0.3.0-next.1392.f0bd0cc"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@flighthq/bitmaptext": "*",
|
package/src/wgpuShape.test.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { BatchFormat, PathCommand } from '@flighthq/types/contract';
|
|
|
19
19
|
import { enableWgpuStrokePathTessellation } from './enableWgpuStrokePathTessellation';
|
|
20
20
|
import { scopeModuleMocks } from './moduleMockTestHelper';
|
|
21
21
|
import type * as WgpuShapeModule from './wgpuShape';
|
|
22
|
-
import {
|
|
22
|
+
import { registerWgpuStandardMaterial } from './wgpuStandardMaterial';
|
|
23
23
|
|
|
24
24
|
// @flighthq/node's bounds/revision queries expect a real BoundsNode; these tests drive drawWgpuShape
|
|
25
25
|
// with lightweight fake proxies, so the two queries are stubbed. scopeModuleMocks scopes the stub to
|
|
@@ -132,7 +132,7 @@ describe('drawWgpuShape', () => {
|
|
|
132
132
|
it('keeps a closed stroke on the raster lane until stroke-path tessellation is enabled', async () => {
|
|
133
133
|
const state = await createWgpuRenderStateForTest();
|
|
134
134
|
renderWgpuBackground(state);
|
|
135
|
-
|
|
135
|
+
registerWgpuStandardMaterial(state);
|
|
136
136
|
const pass = makeMeshPassSpy();
|
|
137
137
|
getWgpuRenderStateRuntime(state).renderPass = pass;
|
|
138
138
|
const shape = createShape();
|
|
@@ -151,7 +151,7 @@ describe('drawWgpuShape', () => {
|
|
|
151
151
|
const state = await createWgpuRenderStateForTest();
|
|
152
152
|
enableWgpuStrokePathTessellation(state);
|
|
153
153
|
renderWgpuBackground(state);
|
|
154
|
-
|
|
154
|
+
registerWgpuStandardMaterial(state);
|
|
155
155
|
const pass = makeMeshPassSpy();
|
|
156
156
|
getWgpuRenderStateRuntime(state).renderPass = pass;
|
|
157
157
|
const shape = createShape();
|
|
@@ -186,7 +186,7 @@ describe('drawWgpuShape', () => {
|
|
|
186
186
|
it('returns early without writing to batch when commands are empty', async () => {
|
|
187
187
|
const state = await createWgpuRenderStateForTest();
|
|
188
188
|
renderWgpuBackground(state);
|
|
189
|
-
|
|
189
|
+
registerWgpuStandardMaterial(state);
|
|
190
190
|
drawWgpuShape(state, makeShapeProxy({ commands: [] }, makeShapeData()));
|
|
191
191
|
expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(0);
|
|
192
192
|
submitWgpuRenderPass(state);
|
|
@@ -195,7 +195,7 @@ describe('drawWgpuShape', () => {
|
|
|
195
195
|
it('returns early without writing to batch when rendererData is null', async () => {
|
|
196
196
|
const state = await createWgpuRenderStateForTest();
|
|
197
197
|
renderWgpuBackground(state);
|
|
198
|
-
|
|
198
|
+
registerWgpuStandardMaterial(state);
|
|
199
199
|
drawWgpuShape(state, makeShapeProxy({ commands: [{}] }, null));
|
|
200
200
|
expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(0);
|
|
201
201
|
submitWgpuRenderPass(state);
|
|
@@ -209,7 +209,7 @@ describe('drawWgpuShape', () => {
|
|
|
209
209
|
it('writes one instance to the quad-batch writer when shape has valid commands and bounds', async () => {
|
|
210
210
|
const state = await createWgpuRenderStateForTest();
|
|
211
211
|
renderWgpuBackground(state);
|
|
212
|
-
|
|
212
|
+
registerWgpuStandardMaterial(state);
|
|
213
213
|
drawWgpuShape(state, makeShapeProxy({ commands: [{}], version: 1 }, makeShapeData()));
|
|
214
214
|
expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(1);
|
|
215
215
|
submitWgpuRenderPass(state);
|
package/src/wgpuSprite.test.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { createSprite } from '@flighthq/scene2d/contract';
|
|
|
12
12
|
import { createRenderTexture, setTextureUvFromPixelRect } from '@flighthq/texture/contract';
|
|
13
13
|
|
|
14
14
|
import { defaultWgpuSpriteRenderer, drawWgpuSprite } from './wgpuSprite';
|
|
15
|
-
import {
|
|
15
|
+
import { registerWgpuStandardMaterial } from './wgpuStandardMaterial';
|
|
16
16
|
|
|
17
17
|
beforeAll(() => installWgpuMock());
|
|
18
18
|
|
|
@@ -38,7 +38,7 @@ describe('drawWgpuSprite', () => {
|
|
|
38
38
|
const state = await createWgpuRenderStateForTest();
|
|
39
39
|
renderWgpuBackground(state);
|
|
40
40
|
registerWgpuRenderTextureResolver(state);
|
|
41
|
-
|
|
41
|
+
registerWgpuStandardMaterial(state);
|
|
42
42
|
const renderTexture = createRenderTexture({ height: 480, width: 720 });
|
|
43
43
|
setTextureUvFromPixelRect(renderTexture, 140, 160, 100, 80);
|
|
44
44
|
renderIntoWgpuRenderTexture(state, renderTexture, () => {});
|
|
@@ -3,13 +3,13 @@ import { createWgpuRenderStateRuntime } from '@flighthq/render-wgpu/contract';
|
|
|
3
3
|
import type { WgpuRenderState } from '@flighthq/types/contract';
|
|
4
4
|
import { EntityRuntimeKey, StandardMaterialKind } from '@flighthq/types/contract';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { registerWgpuStandardMaterial, standardWgpuMaterialRenderer } from './wgpuStandardMaterial';
|
|
7
7
|
|
|
8
|
-
describe('
|
|
8
|
+
describe('registerWgpuStandardMaterial', () => {
|
|
9
9
|
it('registers the default renderer under StandardMaterialKind', () => {
|
|
10
10
|
const state = {} as WgpuRenderState;
|
|
11
11
|
state[EntityRuntimeKey] = createWgpuRenderStateRuntime();
|
|
12
|
-
|
|
12
|
+
registerWgpuStandardMaterial(state);
|
|
13
13
|
expect(getWgpuMaterialRenderer(state, StandardMaterialKind)).toBe(standardWgpuMaterialRenderer);
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -7,7 +7,7 @@ import type { RenderProxy2D } from '@flighthq/types/contract';
|
|
|
7
7
|
import { BatchFormat } from '@flighthq/types/contract';
|
|
8
8
|
|
|
9
9
|
import { scopeModuleMocks } from './moduleMockTestHelper';
|
|
10
|
-
import {
|
|
10
|
+
import { registerWgpuStandardMaterial } from './wgpuStandardMaterial';
|
|
11
11
|
import type * as WgpuTextLabelModule from './wgpuTextLabel';
|
|
12
12
|
|
|
13
13
|
// @flighthq/textlayout.computeTextLayout is stubbed to emit one deterministic glyph group.
|
|
@@ -92,7 +92,7 @@ describe('drawWgpuTextLabel', () => {
|
|
|
92
92
|
it('returns early when text is empty', async () => {
|
|
93
93
|
const state = await createWgpuRenderStateForTest();
|
|
94
94
|
renderWgpuBackground(state);
|
|
95
|
-
|
|
95
|
+
registerWgpuStandardMaterial(state);
|
|
96
96
|
expect(() => drawWgpuTextLabel(state, makeTextProxy('', makeTextData()))).not.toThrow();
|
|
97
97
|
expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(0);
|
|
98
98
|
submitWgpuRenderPass(state);
|
|
@@ -101,7 +101,7 @@ describe('drawWgpuTextLabel', () => {
|
|
|
101
101
|
it('writes one instance to the quad-batch writer when text has content', async () => {
|
|
102
102
|
const state = await createWgpuRenderStateForTest();
|
|
103
103
|
renderWgpuBackground(state);
|
|
104
|
-
|
|
104
|
+
registerWgpuStandardMaterial(state);
|
|
105
105
|
drawWgpuTextLabel(state, makeTextProxy('hello', makeTextData()));
|
|
106
106
|
expect(getWgpuRenderStateRuntime(state).quadBatchWriterCount).toBe(1);
|
|
107
107
|
submitWgpuRenderPass(state);
|
|
@@ -110,7 +110,7 @@ describe('drawWgpuTextLabel', () => {
|
|
|
110
110
|
it('does not re-rasterize when only alpha changes (content version unchanged)', async () => {
|
|
111
111
|
const state = await createWgpuRenderStateForTest();
|
|
112
112
|
renderWgpuBackground(state);
|
|
113
|
-
|
|
113
|
+
registerWgpuStandardMaterial(state);
|
|
114
114
|
const proxy = makeTextProxy('hello', makeTextData());
|
|
115
115
|
drawWgpuTextLabel(state, proxy);
|
|
116
116
|
const updateSpy = vi.spyOn(getWgpuRenderStateRuntime(state).textureCache, 'get');
|