@flighthq/scene3d-wgpu 0.5.1-next.704.19c91ec → 0.5.1-next.730.f29a5aa
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/README.md +2 -2
- package/dist/wgpuEnvironmentCube.d.ts.map +1 -1
- package/dist/wgpuEnvironmentCube.js +1 -1
- package/dist/wgpuEnvironmentCube.js.map +1 -1
- package/package.json +17 -16
- package/src/customShaderWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/unlitWgpuMeshMaterialRenderer.test.ts +2 -5
- package/src/wgpuClassicPrelude.test.ts +2 -2
- package/src/wgpuEnvironmentCube.test.ts +2 -2
- package/src/wgpuEnvironmentIblBake.test.ts +2 -2
- package/src/wgpuEnvironmentSkybox.test.ts +2 -2
- package/src/wgpuMeshPipeline.test.ts +14 -14
- package/src/wgpuShadedPrelude.test.ts +3 -3
- package/src/wgpuUnlitPrelude.test.ts +2 -5
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/scene3d-wgpu`. The `
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/scene3d-wgpu@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/scene3d-wgpu@0.5.1-next.730.f29a5aa](https://github.com/flighthq/flight/tree/f29a5aab5db192284ce5cadf08ffae2649a598ea/packages/scene3d-wgpu)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/f29a5aab5db192284ce5cadf08ffae2649a598ea/LICENSE.md)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuEnvironmentCube.d.ts","sourceRoot":"","sources":["../src/wgpuEnvironmentCube.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"wgpuEnvironmentCube.d.ts","sourceRoot":"","sources":["../src/wgpuEnvironmentCube.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,WAAW,EACX,aAAa,EAGb,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAgBlC,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,GACjC,cAAc,GAAG,IAAI,CA2BvB;AAQD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,GAC7B,OAAO,CAKT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { uploadWgpuTextureData, uploadWgpuTextureImageResource } from '@flighthq/render-wgpu/contract';
|
|
2
2
|
import { BitmapTextureSourceKind, ImageTextureSourceKind } from '@flighthq/types/contract';
|
|
3
3
|
import { getWgpuScene3DRuntime } from './wgpuScene3DRuntime';
|
|
4
|
-
// Uploads an Environment's source radiance cubemap (six
|
|
4
|
+
// Uploads an Environment's source radiance cubemap (six ImageResource faces) to a wgpu cube texture,
|
|
5
5
|
// caching it on the scene runtime. Returns null when the environment has no complete cube — all six faces
|
|
6
6
|
// bound with pixels, either a decoded `source` element or raw `data` — which callers treat as "no
|
|
7
7
|
// environment this frame". Each face uploads through whichever representation it carries:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuEnvironmentCube.js","sourceRoot":"","sources":["../src/wgpuEnvironmentCube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"wgpuEnvironmentCube.js","sourceRoot":"","sources":["../src/wgpuEnvironmentCube.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,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QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,0BAA0B,CACjC,MAAiB,EACjB,OAAmB,EACnB,IAAY,EACZ,KAA8B;IAE9B,IAAI,KAAK,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,KAAyB,CAAC;QACzC,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACjG,CAAC;SAAM,CAAC;QACN,8BAA8B,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,KAAgC,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/scene3d-wgpu",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.730.f29a5aa",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/camera": "0.5.1-next.
|
|
42
|
-
"@flighthq/color": "0.5.1-next.
|
|
43
|
-
"@flighthq/geometry": "0.5.1-next.
|
|
44
|
-
"@flighthq/image": "0.5.1-next.
|
|
45
|
-
"@flighthq/lighting": "0.5.1-next.
|
|
46
|
-
"@flighthq/log": "0.5.1-next.
|
|
47
|
-
"@flighthq/materials": "0.5.1-next.
|
|
48
|
-
"@flighthq/node": "0.5.1-next.
|
|
49
|
-
"@flighthq/registry": "0.5.1-next.
|
|
50
|
-
"@flighthq/render": "0.5.1-next.
|
|
51
|
-
"@flighthq/render-wgpu": "0.5.1-next.
|
|
52
|
-
"@flighthq/scene3d": "0.5.1-next.
|
|
53
|
-
"@flighthq/shading": "0.5.1-next.
|
|
54
|
-
"@flighthq/texture": "0.5.1-next.
|
|
55
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/camera": "0.5.1-next.730.f29a5aa",
|
|
42
|
+
"@flighthq/color": "0.5.1-next.730.f29a5aa",
|
|
43
|
+
"@flighthq/geometry": "0.5.1-next.730.f29a5aa",
|
|
44
|
+
"@flighthq/image": "0.5.1-next.730.f29a5aa",
|
|
45
|
+
"@flighthq/lighting": "0.5.1-next.730.f29a5aa",
|
|
46
|
+
"@flighthq/log": "0.5.1-next.730.f29a5aa",
|
|
47
|
+
"@flighthq/materials": "0.5.1-next.730.f29a5aa",
|
|
48
|
+
"@flighthq/node": "0.5.1-next.730.f29a5aa",
|
|
49
|
+
"@flighthq/registry": "0.5.1-next.730.f29a5aa",
|
|
50
|
+
"@flighthq/render": "0.5.1-next.730.f29a5aa",
|
|
51
|
+
"@flighthq/render-wgpu": "0.5.1-next.730.f29a5aa",
|
|
52
|
+
"@flighthq/scene3d": "0.5.1-next.730.f29a5aa",
|
|
53
|
+
"@flighthq/shading": "0.5.1-next.730.f29a5aa",
|
|
54
|
+
"@flighthq/texture": "0.5.1-next.730.f29a5aa",
|
|
55
|
+
"@flighthq/types": "0.5.1-next.730.f29a5aa"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@webgpu/types": "^0.1.70"
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@flighthq/mesh": "*",
|
|
62
62
|
"@flighthq/particleemitter": "*",
|
|
63
|
+
"@flighthq/video": "*",
|
|
63
64
|
"@webgpu/types": "*",
|
|
64
65
|
"typescript": "^5.3.0"
|
|
65
66
|
},
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
registerWgpuImageTextureResolver,
|
|
10
10
|
} from '@flighthq/render-wgpu/contract';
|
|
11
11
|
import { createTexture } from '@flighthq/texture/contract';
|
|
12
|
-
import type { Camera3D,
|
|
12
|
+
import type { Camera3D, ImageResource, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
13
13
|
import { CustomShaderMaterialKind, ImageTextureSourceKind } from '@flighthq/types/contract';
|
|
14
14
|
|
|
15
15
|
import {
|
|
@@ -177,7 +177,7 @@ describe('customShaderWgpuMeshMaterialRenderer', () => {
|
|
|
177
177
|
});
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
function makeImageResource(version: number):
|
|
180
|
+
function makeImageResource(version: number): ImageResource {
|
|
181
181
|
const source = document.createElement('canvas');
|
|
182
182
|
source.width = 1;
|
|
183
183
|
source.height = 1;
|
|
@@ -187,7 +187,7 @@ function makeImageResource(version: number): Image {
|
|
|
187
187
|
source,
|
|
188
188
|
version,
|
|
189
189
|
width: 1,
|
|
190
|
-
} as unknown as
|
|
190
|
+
} as unknown as ImageResource;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
describe('getWgpuCustomMaterialShaderSource', () => {
|
|
@@ -6,6 +6,7 @@ import { registerWgpuImageTextureResolver } from '@flighthq/render-wgpu/contract
|
|
|
6
6
|
import { advanceVideoTexture, createVideoTexture } from '@flighthq/texture/contract';
|
|
7
7
|
import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
8
8
|
import { UnlitMaterialKind } from '@flighthq/types/contract';
|
|
9
|
+
import { createVideoResource } from '@flighthq/video/contract';
|
|
9
10
|
|
|
10
11
|
import { registerWgpuUnlitMaterial, unlitWgpuMeshMaterialRenderer } from './unlitWgpuMeshMaterialRenderer';
|
|
11
12
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
@@ -61,11 +62,7 @@ describe('unlitWgpuMeshMaterialRenderer', () => {
|
|
|
61
62
|
videoHeight: { value: 120 },
|
|
62
63
|
videoWidth: { value: 160 },
|
|
63
64
|
});
|
|
64
|
-
material.baseColorMap = createVideoTexture(
|
|
65
|
-
element,
|
|
66
|
-
objectUrl: null,
|
|
67
|
-
ownsElement: false,
|
|
68
|
-
});
|
|
65
|
+
material.baseColorMap = createVideoTexture(createVideoResource(element));
|
|
69
66
|
advanceVideoTexture(material.baseColorMap);
|
|
70
67
|
registerWgpuImageTextureResolver(state);
|
|
71
68
|
unlitWgpuMeshMaterialRenderer.bind(state, material, NO_LIGHTS, makeCamera());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTexture } from '@flighthq/texture/contract';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
3
|
+
ImageResource,
|
|
4
4
|
WgpuClassicDefineKey,
|
|
5
5
|
WgpuClassicLightingModel,
|
|
6
6
|
WgpuColorAdjustmentMaterialFeature,
|
|
@@ -61,7 +61,7 @@ describe('bindWgpuClassicSurface', () => {
|
|
|
61
61
|
// path an already-resolved-sampler helper test bypasses). Same shared binder that PBR uses.
|
|
62
62
|
const diffuseMap = createTexture({
|
|
63
63
|
dimension: '2d',
|
|
64
|
-
source: { source: {} } as unknown as
|
|
64
|
+
source: { source: {} } as unknown as ImageResource,
|
|
65
65
|
});
|
|
66
66
|
bindWgpuClassicSurface(state, pipeline, key, [1, 0, 0, 1], [1, 1, 1, 1], 32, 0.5, diffuseMap, null, null, null);
|
|
67
67
|
const count = (name: string) => fake.calls.filter((c) => c.name === name).length;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Bitmap, Environment,
|
|
1
|
+
import type { Bitmap, Environment, ImageResource, Texture } from '@flighthq/types/contract';
|
|
2
2
|
import { BitmapTextureSourceKind, ImageTextureSourceKind } from '@flighthq/types/contract';
|
|
3
3
|
|
|
4
4
|
import { ensureWgpuEnvironmentSourceCube, updateWgpuEnvironmentCubeFace } from './wgpuEnvironmentCube';
|
|
@@ -18,7 +18,7 @@ function completeEnvironment(): Environment {
|
|
|
18
18
|
kind: ImageTextureSourceKind,
|
|
19
19
|
source,
|
|
20
20
|
width: 4,
|
|
21
|
-
} as unknown as
|
|
21
|
+
} as unknown as ImageResource;
|
|
22
22
|
const cube = {
|
|
23
23
|
colorSpace: 'srgb',
|
|
24
24
|
sampler: {},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Environment,
|
|
1
|
+
import type { Environment, ImageResource, Texture } from '@flighthq/types/contract';
|
|
2
2
|
import { ImageTextureSourceKind } from '@flighthq/types/contract';
|
|
3
3
|
|
|
4
4
|
import { bakeWgpuEnvironmentIbl, destroyWgpuScene3DIbl } from './wgpuEnvironmentIblBake';
|
|
@@ -19,7 +19,7 @@ function completeEnvironment(): Environment {
|
|
|
19
19
|
kind: ImageTextureSourceKind,
|
|
20
20
|
source,
|
|
21
21
|
width: 4,
|
|
22
|
-
} as unknown as
|
|
22
|
+
} as unknown as ImageResource;
|
|
23
23
|
const cube = {
|
|
24
24
|
colorSpace: 'srgb',
|
|
25
25
|
sampler: {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCamera3D } from '@flighthq/camera/contract';
|
|
2
|
-
import type { Camera3D, Environment,
|
|
2
|
+
import type { Camera3D, Environment, ImageResource, Texture } from '@flighthq/types/contract';
|
|
3
3
|
import { ImageTextureSourceKind } from '@flighthq/types/contract';
|
|
4
4
|
|
|
5
5
|
import { drawWgpuEnvironmentSkybox } from './wgpuEnvironmentSkybox';
|
|
@@ -22,7 +22,7 @@ function completeEnvironment(): Environment {
|
|
|
22
22
|
kind: ImageTextureSourceKind,
|
|
23
23
|
source,
|
|
24
24
|
width: 4,
|
|
25
|
-
} as unknown as
|
|
25
|
+
} as unknown as ImageResource;
|
|
26
26
|
const cube = {
|
|
27
27
|
colorSpace: 'srgb',
|
|
28
28
|
sampler: {},
|
|
@@ -7,7 +7,7 @@ import { createTexture, setTextureUvOffset, setTextureUvScale } from '@flighthq/
|
|
|
7
7
|
import type {
|
|
8
8
|
Camera3D,
|
|
9
9
|
Bitmap,
|
|
10
|
-
|
|
10
|
+
ImageResource,
|
|
11
11
|
Scene3DLightBlock,
|
|
12
12
|
Scene3DRenderProxy,
|
|
13
13
|
Texture,
|
|
@@ -735,7 +735,7 @@ describe('getWgpuMaterialSampler', () => {
|
|
|
735
735
|
const { state } = makeWgpuScene3DState();
|
|
736
736
|
const texture = createTexture({
|
|
737
737
|
dimension: '2d',
|
|
738
|
-
source: { kind: ImageTextureSourceKind } as
|
|
738
|
+
source: { kind: ImageTextureSourceKind } as ImageResource,
|
|
739
739
|
});
|
|
740
740
|
texture.sampler.wrapU = 'repeat';
|
|
741
741
|
texture.sampler.wrapV = 'repeat';
|
|
@@ -750,7 +750,7 @@ describe('getWgpuMaterialSampler', () => {
|
|
|
750
750
|
|
|
751
751
|
it('preserves independent minification and magnification filters', () => {
|
|
752
752
|
const { fake, state } = makeWgpuScene3DState();
|
|
753
|
-
const texture = createTexture({ dimension: '2d', source: {} as
|
|
753
|
+
const texture = createTexture({ dimension: '2d', source: {} as ImageResource });
|
|
754
754
|
texture.sampler.minFilter = 'nearest';
|
|
755
755
|
texture.sampler.magFilter = 'linear';
|
|
756
756
|
|
|
@@ -763,9 +763,9 @@ describe('getWgpuMaterialSampler', () => {
|
|
|
763
763
|
|
|
764
764
|
it('drops the mip filter when the map disables mipmaps (distinct packed key from the mipmapped default)', () => {
|
|
765
765
|
const { state } = makeWgpuScene3DState();
|
|
766
|
-
const noMip = createTexture({ dimension: '2d', source: {} as
|
|
766
|
+
const noMip = createTexture({ dimension: '2d', source: {} as ImageResource });
|
|
767
767
|
noMip.sampler.mipmaps = false;
|
|
768
|
-
const withMip = createTexture({ dimension: '2d', source: {} as
|
|
768
|
+
const withMip = createTexture({ dimension: '2d', source: {} as ImageResource }); // default: trilinear (mipmaps on)
|
|
769
769
|
|
|
770
770
|
getWgpuMaterialSampler(state, noMip);
|
|
771
771
|
getWgpuMaterialSampler(state, withMip);
|
|
@@ -775,9 +775,9 @@ describe('getWgpuMaterialSampler', () => {
|
|
|
775
775
|
|
|
776
776
|
it('carries the map anisotropy into the derived sampler (distinct packed key from the non-anisotropic one)', () => {
|
|
777
777
|
const { state } = makeWgpuScene3DState();
|
|
778
|
-
const aniso = createTexture({ dimension: '2d', source: {} as
|
|
778
|
+
const aniso = createTexture({ dimension: '2d', source: {} as ImageResource });
|
|
779
779
|
aniso.sampler.anisotropy = 8;
|
|
780
|
-
const noAniso = createTexture({ dimension: '2d', source: {} as
|
|
780
|
+
const noAniso = createTexture({ dimension: '2d', source: {} as ImageResource });
|
|
781
781
|
|
|
782
782
|
getWgpuMaterialSampler(state, aniso);
|
|
783
783
|
getWgpuMaterialSampler(state, noAniso);
|
|
@@ -823,7 +823,7 @@ describe('isWgpuMaterialBindGroupRebuildNeeded', () => {
|
|
|
823
823
|
|
|
824
824
|
it('rebuilds when any resolved view identity changes (swap / unready->ready / ready->ready / version++)', () => {
|
|
825
825
|
// resolveWgpuMaterialTextureView is the invalidation seam: a texture swap, an unready->ready
|
|
826
|
-
// transition, a ready->ready image replacement, or an
|
|
826
|
+
// transition, a ready->ready image replacement, or an ImageResource version bump each yield a new
|
|
827
827
|
// view identity, so this single identity check covers all four.
|
|
828
828
|
expect(isWgpuMaterialBindGroupRebuildNeeded(cached, sampler, [{} as GPUTextureView, view1])).toBe(true);
|
|
829
829
|
});
|
|
@@ -842,7 +842,7 @@ describe('isWgpuTextureReady', () => {
|
|
|
842
842
|
expect(
|
|
843
843
|
isWgpuTextureReady({
|
|
844
844
|
dimension: '2d',
|
|
845
|
-
source: { height: 1, kind: ImageTextureSourceKind, source: {}, version: 0, width: 1 } as
|
|
845
|
+
source: { height: 1, kind: ImageTextureSourceKind, source: {}, version: 0, width: 1 } as ImageResource,
|
|
846
846
|
} as unknown as Texture),
|
|
847
847
|
).toBe(true);
|
|
848
848
|
expect(
|
|
@@ -905,7 +905,7 @@ describe('stashWgpuUvTransform', () => {
|
|
|
905
905
|
const { state } = makeWgpuScene3DState();
|
|
906
906
|
const texture = createTexture({
|
|
907
907
|
dimension: '2d',
|
|
908
|
-
source: { kind: ImageTextureSourceKind } as
|
|
908
|
+
source: { kind: ImageTextureSourceKind } as ImageResource,
|
|
909
909
|
});
|
|
910
910
|
setTextureUvScale(texture, 2, 3);
|
|
911
911
|
setTextureUvOffset(texture, 0.5, 0.25);
|
|
@@ -921,7 +921,7 @@ describe('stashWgpuUvTransform', () => {
|
|
|
921
921
|
const { state } = makeWgpuScene3DState();
|
|
922
922
|
const texture = createTexture({
|
|
923
923
|
dimension: '2d',
|
|
924
|
-
source: { kind: ImageTextureSourceKind } as
|
|
924
|
+
source: { kind: ImageTextureSourceKind } as ImageResource,
|
|
925
925
|
});
|
|
926
926
|
setTextureUvScale(texture, 4, 4);
|
|
927
927
|
stashWgpuUvTransform(state, texture);
|
|
@@ -938,7 +938,7 @@ describe('stashWgpuUvTransform', () => {
|
|
|
938
938
|
state,
|
|
939
939
|
createTexture({
|
|
940
940
|
dimension: '2d',
|
|
941
|
-
source: { kind: ImageTextureSourceKind } as
|
|
941
|
+
source: { kind: ImageTextureSourceKind } as ImageResource,
|
|
942
942
|
}),
|
|
943
943
|
);
|
|
944
944
|
|
|
@@ -1000,7 +1000,7 @@ describe('writeWgpuDrawUniform', () => {
|
|
|
1000
1000
|
const { state } = makeWgpuScene3DState();
|
|
1001
1001
|
const texture = createTexture({
|
|
1002
1002
|
dimension: '2d',
|
|
1003
|
-
source: { kind: ImageTextureSourceKind } as
|
|
1003
|
+
source: { kind: ImageTextureSourceKind } as ImageResource,
|
|
1004
1004
|
});
|
|
1005
1005
|
setTextureUvScale(texture, 2, 3);
|
|
1006
1006
|
stashWgpuUvTransform(state, texture);
|
|
@@ -1019,7 +1019,7 @@ describe('writeWgpuDrawUniform', () => {
|
|
|
1019
1019
|
const { state } = makeWgpuScene3DState();
|
|
1020
1020
|
const texture = createTexture({
|
|
1021
1021
|
dimension: '2d',
|
|
1022
|
-
source: { kind: ImageTextureSourceKind } as
|
|
1022
|
+
source: { kind: ImageTextureSourceKind } as ImageResource,
|
|
1023
1023
|
});
|
|
1024
1024
|
setTextureUvScale(texture, 2, 3);
|
|
1025
1025
|
stashWgpuUvTransform(state, texture);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@flighthq/shading/contract';
|
|
13
13
|
import { createTexture, getTextureSource } from '@flighthq/texture/contract';
|
|
14
14
|
import type {
|
|
15
|
-
|
|
15
|
+
ImageResource,
|
|
16
16
|
Modifier,
|
|
17
17
|
Texture,
|
|
18
18
|
WgpuColorAdjustmentMaterialFeature,
|
|
@@ -427,7 +427,7 @@ describe('shaded binding cache', () => {
|
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
429
|
|
|
430
|
-
function makeImageResource():
|
|
430
|
+
function makeImageResource(): ImageResource {
|
|
431
431
|
const source = document.createElement('canvas');
|
|
432
432
|
source.width = 1;
|
|
433
433
|
source.height = 1;
|
|
@@ -437,5 +437,5 @@ function makeImageResource(): Image {
|
|
|
437
437
|
source,
|
|
438
438
|
version: 0,
|
|
439
439
|
width: 1,
|
|
440
|
-
} as unknown as
|
|
440
|
+
} as unknown as ImageResource;
|
|
441
441
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { registerWgpuImageTextureResolver } from '@flighthq/render-wgpu/contract';
|
|
2
2
|
import { advanceVideoTexture, createVideoTexture } from '@flighthq/texture/contract';
|
|
3
3
|
import type { LinearColor, WgpuUnlitDefineKey } from '@flighthq/types/contract';
|
|
4
|
+
import { createVideoResource } from '@flighthq/video/contract';
|
|
4
5
|
|
|
5
6
|
import { getWgpuScene3DRuntime } from './wgpuScene3DRuntime';
|
|
6
7
|
import { makeWgpuScene3DState, makeWgpuSkinningAdapter } from './wgpuScene3DTestHelper';
|
|
@@ -39,11 +40,7 @@ describe('bindWgpuUnlitVideoSurface', () => {
|
|
|
39
40
|
videoHeight: { value: 120 },
|
|
40
41
|
videoWidth: { value: 160 },
|
|
41
42
|
});
|
|
42
|
-
const video = createVideoTexture(
|
|
43
|
-
element,
|
|
44
|
-
objectUrl: null,
|
|
45
|
-
ownsElement: false,
|
|
46
|
-
});
|
|
43
|
+
const video = createVideoTexture(createVideoResource(element));
|
|
47
44
|
advanceVideoTexture(video);
|
|
48
45
|
registerWgpuImageTextureResolver(state);
|
|
49
46
|
bindWgpuUnlitVideoSurface(state, pipeline, {}, COLOR, 1, 0.5, video);
|