@flighthq/texture 0.2.1-next.841.373388f → 0.3.0-next.906.07cea63

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.
@@ -0,0 +1,6 @@
1
+ export * from './cubeTexture';
2
+ export * from './renderTexture';
3
+ export * from './sampler';
4
+ export * from './texture';
5
+ export * from './videoTexture';
6
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './cubeTexture';
2
+ export * from './renderTexture';
3
+ export * from './sampler';
4
+ export * from './texture';
5
+ export * from './videoTexture';
6
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { CubeTexture, CubeTextureLike, ImageResource } from '@flighthq/types';
1
+ import type { CubeTexture, CubeTextureLike, ImageResource } from '@flighthq/types/contract';
2
2
  export declare function cloneCubeTexture(source: Readonly<CubeTextureLike>): CubeTexture;
3
3
  export declare function copyCubeTexture(out: CubeTextureLike, source: Readonly<CubeTextureLike>): void;
4
4
  export declare function createCubeTexture(opts?: Readonly<Partial<CubeTextureLike>>): CubeTexture;
@@ -1 +1 @@
1
- {"version":3,"file":"cubeTexture.d.ts","sourceRoot":"","sources":["../src/cubeTexture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,E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,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,WAAW,CAMxF;AAID,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,SAAS,EAC/C,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,IAAI,GAAG,SAAS,GAC9C,OAAO,CAST;AAID,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,MAAM,CAM9E;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,OAAO,CAE9E;AAMD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAE9G"}
@@ -1,4 +1,4 @@
1
- import { createEntity } from '@flighthq/entity';
1
+ import { createEntity } from '@flighthq/entity/contract';
2
2
  import { cloneSampler, copySampler, createSampler, equalsSampler } from './sampler';
3
3
  // Allocates an independent CubeTexture over the SAME six face pixels: each ImageResource reference
4
4
  // is shared (the faces array itself is a fresh copy, so reassigning a face on the clone does not
@@ -1 +1 @@
1
- {"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../src/cubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEpF,mGAAmG;AACnG,iGAAiG;AACjG,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,MAAiC;IAChE,OAAO,YAAY,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;QAC3B,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;KACtC,CA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,EAAE,SAAiB,EAAE,KAA2B;IACrG,IAAI,CAAC,KAAkC,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;AAC9D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- export * from './cubeTexture';
2
- export * from './sampler';
3
- export * from './texture';
4
- export * from './videoTexture';
1
+ export { advanceVideoTexture, cloneCubeTexture, cloneSampler, cloneTexture, cloneVideoTexture, copyCubeTexture, copySampler, copyTexture, copyVideoTexture, createAnisotropicSampler, createClampLinearSampler, createCubeTexture, createPixelArtSampler, createRenderTexture, createSampler, createTexture, createTilingSampler, createVideoTexture, equalsCubeTexture, equalsSampler, equalsTexture, getCubeTextureFaceSize, getTextureHeight, getTextureInverseUvMatrix, getTextureUvMatrix, getTextureWidth, getVideoTextureHeight, getVideoTextureInverseUvMatrix, getVideoTextureUvMatrix, getVideoTextureWidth, hasTextureUvTransform, isCubeTextureComplete, isTextureReady, isVideoTextureFrameReady, resetTextureUvTransform, resetVideoTextureFrame, setCubeTextureFace, setTextureFlip, setTextureImage, setTextureUvOffset, setTextureUvRotation, setTextureUvScale, setVideoTextureSource, transformTextureUv, } from './contract';
5
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,2 @@
1
- export * from './cubeTexture';
2
- export * from './sampler';
3
- export * from './texture';
4
- export * from './videoTexture';
1
+ export { advanceVideoTexture, cloneCubeTexture, cloneSampler, cloneTexture, cloneVideoTexture, copyCubeTexture, copySampler, copyTexture, copyVideoTexture, createAnisotropicSampler, createClampLinearSampler, createCubeTexture, createPixelArtSampler, createRenderTexture, createSampler, createTexture, createTilingSampler, createVideoTexture, equalsCubeTexture, equalsSampler, equalsTexture, getCubeTextureFaceSize, getTextureHeight, getTextureInverseUvMatrix, getTextureUvMatrix, getTextureWidth, getVideoTextureHeight, getVideoTextureInverseUvMatrix, getVideoTextureUvMatrix, getVideoTextureWidth, hasTextureUvTransform, isCubeTextureComplete, isTextureReady, isVideoTextureFrameReady, resetTextureUvTransform, resetVideoTextureFrame, setCubeTextureFace, setTextureFlip, setTextureImage, setTextureUvOffset, setTextureUvRotation, setTextureUvScale, setVideoTextureSource, transformTextureUv, } from './contract';
5
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CreateRenderTextureOptions, Texture } from '@flighthq/types/contract';
2
+ export declare function createRenderTexture(options: Readonly<CreateRenderTextureOptions>): Texture;
3
+ //# sourceMappingURL=renderTexture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderTexture.d.ts","sourceRoot":"","sources":["../src/renderTexture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAQpF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,OAAO,CAkC1F"}
@@ -0,0 +1,42 @@
1
+ import { copySampler } from './sampler';
2
+ import { createTexture } from './texture';
3
+ // Creates a universal Texture with a GPU-origin produced backing. Backend allocation stays lazy;
4
+ // renderIntoGlRenderTexture realizes the target in one state and resolveGlTexture later returns its
5
+ // color attachment without a CPU upload.
6
+ export function createRenderTexture(options) {
7
+ const colorSpace = options.colorSpace ?? 'linear';
8
+ const texture = createTexture({
9
+ colorSpace: options.colorSpace ?? 'linear',
10
+ flipX: options.flipX ?? false,
11
+ flipY: options.flipY ?? false,
12
+ storage: {
13
+ dimension: '2d',
14
+ image: null,
15
+ target: {
16
+ colorAttachments: options.colorAttachments,
17
+ colorFormats: options.colorFormats,
18
+ colorSpace,
19
+ clearColors: options.clearColors,
20
+ clearDepth: options.clearDepth,
21
+ depth: options.depth,
22
+ format: options.format,
23
+ height: options.height,
24
+ sampleCount: options.sampleCount,
25
+ width: options.width,
26
+ },
27
+ },
28
+ uvRotation: options.uvRotation,
29
+ });
30
+ if (options.sampler !== undefined)
31
+ copySampler(texture.sampler, options.sampler);
32
+ if (options.uvOffset !== undefined) {
33
+ texture.uvOffset.x = options.uvOffset.x;
34
+ texture.uvOffset.y = options.uvOffset.y;
35
+ }
36
+ if (options.uvScale !== undefined) {
37
+ texture.uvScale.x = options.uvScale.x;
38
+ texture.uvScale.y = options.uvScale.y;
39
+ }
40
+ return texture;
41
+ }
42
+ //# sourceMappingURL=renderTexture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderTexture.js","sourceRoot":"","sources":["../src/renderTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,iGAAiG;AACjG,oGAAoG;AACpG,yCAAyC;AACzC,MAAM,UAAU,mBAAmB,CAAC,OAA6C;IAC/E,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC;IAClD,MAAM,OAAO,GAAG,aAAa,CAAC;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ;QAC1C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;QAC7B,KAAK,EAAE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} from '@flighthq/types/contract';
2
2
  export declare function cloneSampler(source: Readonly<SamplerLike>): Sampler;
3
3
  export declare function copySampler(out: SamplerLike, source: Readonly<SamplerLike>): void;
4
4
  export declare function createAnisotropicSampler(level: number): Sampler;
@@ -1 +1 @@
1
- {"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../src/sampler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI5D,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CASnE;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAOjF;AAKD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAID,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAID,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAKD,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,OAAO,CAS5E;AAID,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAID,wBAAgB,aAAa,CAC3B,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,EAC3C,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAWT"}
1
+ {"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../src/sampler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIrE,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CASnE;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAOjF;AAKD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/D;AAID,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAID,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAKD,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,OAAO,CAS5E;AAID,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAID,wBAAgB,aAAa,CAC3B,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,EAC3C,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAWT"}
package/dist/sampler.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createEntity } from '@flighthq/entity';
1
+ import { createEntity } from '@flighthq/entity/contract';
2
2
  // Allocates an independent Sampler with the same sampling state. Sampler holds only plain values,
3
3
  // so the clone shares nothing mutable with its source.
4
4
  export function cloneSampler(source) {
@@ -1 +1 @@
1
- {"version":3,"file":"sampler.js","sourceRoot":"","sources":["../src/sampler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,kGAAkG;AAClG,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,MAA6B;IACxD,OAAO,YAAY,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC,CAAC;AACL,CAAC;AAED,+FAA+F;AAC/F,4FAA4F;AAC5F,MAAM,UA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F,MAAM,UAAU,mBAAmB;IACjC,OAAO,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,8FAA8F;AAC9F,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAC3B,CAA2C,EAC3C,CAA2C;IAE3C,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,CACL,CAAC,KAAK,CAAC;QACP,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU;YAC5B,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;YAC3B,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;YAC3B,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;YACvB,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;YACnB,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC,CACvB,CAAC;AACJ,CAAC"}
package/dist/texture.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ImageResource, Matrix3Like, Texture, TextureLike, TextureUvTransform, Vector2Like } from '@flighthq/types';
1
+ import type { ImageResource, Matrix3Like, Texture, TextureLike, TextureUvTransform, Vector2Like } from '@flighthq/types/contract';
2
2
  export declare function cloneTexture(source: Readonly<TextureLike>): Texture;
3
3
  export declare function copyTexture(out: TextureLike, source: Readonly<TextureLike>): void;
4
4
  export declare function createTexture(opts?: Readonly<Partial<TextureLike>>): Texture;
@@ -1 +1 @@
1
- {"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../src/texture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAOzB,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OA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ANGED
@@ -1,43 +1,48 @@
1
- import { createEntity } from '@flighthq/entity';
2
- import { cloneVector2, copyVector2, createVector2, inverseMatrix3 } from '@flighthq/geometry';
1
+ import { createEntity } from '@flighthq/entity/contract';
2
+ import { cloneVector2, copyVector2, createVector2, inverseMatrix3 } from '@flighthq/geometry/contract';
3
3
  import { cloneSampler, copySampler, createSampler, equalsSampler } from './sampler';
4
- // Allocates an independent Texture over the SAME image pixels: the ImageResource reference is
5
- // shared (clone the resource separately to upload into a second render state), while the Sampler
6
- // and the uv-transform vectors are deep-cloned so the two textures can be sampled independently.
4
+ // Allocates an independent Texture over the SAME image pixels: the ImageResource reference is shared
5
+ // through a fresh storage record (clone the resource separately to duplicate its content identity),
6
+ // while the Sampler and uv-transform vectors are deep-cloned for independent sampling.
7
7
  export function cloneTexture(source) {
8
8
  return createEntity({
9
9
  colorSpace: source.colorSpace,
10
10
  flipX: source.flipX,
11
11
  flipY: source.flipY,
12
- image: source.image,
13
12
  resource: source.resource ?? null,
14
13
  sampler: cloneSampler(source.sampler),
14
+ storage: { dimension: '2d', image: source.storage.image, target: source.storage.target },
15
15
  uvOffset: cloneVector2(source.uvOffset),
16
16
  uvRotation: source.uvRotation,
17
17
  uvScale: cloneVector2(source.uvScale),
18
+ version: source.version >>> 0,
18
19
  });
19
20
  }
20
21
  // Copies every Texture field from source into out in place. The image reference is shared; the
21
- // Sampler and uv-transform vectors are copied into out's existing entities (their identities are
22
- // preserved). Safe when out aliases source.
22
+ // storage record, Sampler, and uv-transform vectors are copied into out's existing objects (their
23
+ // identities are preserved). Safe when out aliases source.
23
24
  export function copyTexture(out, source) {
24
25
  const colorSpace = source.colorSpace;
25
26
  const flipX = source.flipX;
26
27
  const flipY = source.flipY;
27
- const image = source.image;
28
+ const image = source.storage.image;
29
+ const target = source.storage.target;
28
30
  const resource = source.resource ?? null;
29
31
  const uvRotation = source.uvRotation;
32
+ const version = source.version >>> 0;
30
33
  copySampler(out.sampler, source.sampler);
31
34
  copyVector2(out.uvOffset, source.uvOffset);
32
35
  copyVector2(out.uvScale, source.uvScale);
33
36
  out.colorSpace = colorSpace;
34
37
  out.flipX = flipX;
35
38
  out.flipY = flipY;
36
- out.image = image;
37
39
  out.resource = resource;
40
+ out.storage.image = image;
41
+ out.storage.target = target;
38
42
  out.uvRotation = uvRotation;
43
+ out.version = version;
39
44
  }
40
- // Builds a Texture: an unbound image slot (null), a default Sampler, 'srgb' color space (the
45
+ // Builds a Texture: 2D storage with an unbound image slot (null), a default Sampler, 'srgb' color space (the
41
46
  // albedo default — data maps override to 'linear'), and an identity KHR_texture_transform
42
47
  // (zero offset, unit scale, no rotation). Pass TextureLike fields to override any of these.
43
48
  export function createTexture(opts) {
@@ -45,12 +50,15 @@ export function createTexture(opts) {
45
50
  colorSpace: opts?.colorSpace ?? 'srgb',
46
51
  flipX: opts?.flipX ?? false,
47
52
  flipY: opts?.flipY ?? false,
48
- image: opts?.image ?? null,
49
53
  resource: opts?.resource ?? null,
50
54
  sampler: opts?.sampler ? cloneSampler(opts.sampler) : createSampler(),
55
+ storage: opts?.storage
56
+ ? { dimension: '2d', image: opts.storage.image, target: opts.storage.target }
57
+ : { dimension: '2d', image: null },
51
58
  uvOffset: opts?.uvOffset ? cloneVector2(opts.uvOffset) : createVector2(0, 0),
52
59
  uvRotation: opts?.uvRotation ?? 0,
53
60
  uvScale: opts?.uvScale ? cloneVector2(opts.uvScale) : createVector2(1, 1),
61
+ version: (opts?.version ?? 0) >>> 0,
54
62
  });
55
63
  }
56
64
  // True when both textures describe identical state: same color space, same sampler state, the same
@@ -63,17 +71,19 @@ export function equalsTexture(a, b) {
63
71
  return (a.colorSpace === b.colorSpace &&
64
72
  a.flipX === b.flipX &&
65
73
  a.flipY === b.flipY &&
66
- a.image === b.image &&
74
+ a.storage.image === b.storage.image &&
75
+ a.storage.target === b.storage.target &&
67
76
  a.uvRotation === b.uvRotation &&
68
77
  a.uvOffset.x === b.uvOffset.x &&
69
78
  a.uvOffset.y === b.uvOffset.y &&
70
79
  a.uvScale.x === b.uvScale.x &&
71
80
  a.uvScale.y === b.uvScale.y &&
81
+ a.version === b.version &&
72
82
  equalsSampler(a.sampler, b.sampler));
73
83
  }
74
- // Returns the pixel height of the texture's bound image, or -1 when no image is bound.
84
+ // Returns the height declared by the CPU image or produced target backing, or -1 when unbound.
75
85
  export function getTextureHeight(texture) {
76
- return texture.image !== null ? texture.image.height : -1;
86
+ return texture.storage.image?.height ?? texture.storage.target?.height ?? -1;
77
87
  }
78
88
  // Composes the KHR_texture_transform fields and inverts the result, producing the matrix that maps
79
89
  // already-transformed uv coordinates back to the unit-square source uv. The forward transform is
@@ -118,9 +128,9 @@ export function getTextureUvMatrix(out, texture) {
118
128
  m[7] = ty; // (1,2)
119
129
  m[8] = 1; // (2,2)
120
130
  }
121
- // Returns the pixel width of the texture's bound image, or -1 when no image is bound.
131
+ // Returns the width declared by the CPU image or produced target backing, or -1 when unbound.
122
132
  export function getTextureWidth(texture) {
123
- return texture.image !== null ? texture.image.width : -1;
133
+ return texture.storage.image?.width ?? texture.storage.target?.width ?? -1;
124
134
  }
125
135
  // True when the texture carries a non-identity KHR_texture_transform — any non-unit scale, non-zero
126
136
  // offset, or non-zero rotation. GPU material renderers gate the HAS_UV_TRANSFORM shader variant on
@@ -135,13 +145,13 @@ export function hasTextureUvTransform(texture) {
135
145
  texture.uvOffset.y !== 0 ||
136
146
  texture.uvRotation !== 0);
137
147
  }
138
- // True once the texture references a pixel source. A texture with a null image is treated as an
148
+ // True once the texture references a pixel source. A texture whose storage has a null image is treated as an
139
149
  // absent slot by materials, so this is the gate a material samples behind.
140
150
  export function isTextureReady(texture) {
141
- return texture.image !== null;
151
+ return texture.storage.image !== null;
142
152
  }
143
153
  // Resets the KHR_texture_transform to identity in place: zero offset, no rotation, unit scale, and
144
- // no flip. Leaves the image, color space, and sampler untouched.
154
+ // no flip. Leaves storage, color space, sampler, and version untouched.
145
155
  export function resetTextureUvTransform(texture) {
146
156
  texture.flipX = false;
147
157
  texture.flipY = false;
@@ -158,10 +168,13 @@ export function setTextureFlip(texture, flipX, flipY) {
158
168
  texture.flipX = flipX;
159
169
  texture.flipY = flipY;
160
170
  }
161
- // Binds (or clears, with null) the texture's image source in place. Does not touch sampling state
162
- // or the uv-transform.
171
+ // Binds (or clears, with null) the texture's image source in place and advances the u32 dirty-bit.
172
+ // Does not touch sampling state or the uv-transform.
163
173
  export function setTextureImage(texture, image) {
164
- texture.image = image;
174
+ if (texture.storage.image === image)
175
+ return;
176
+ texture.storage.image = image;
177
+ texture.version = (texture.version + 1) >>> 0;
165
178
  }
166
179
  // Sets the uv offset (scroll/translation) in place. Equivalent to assigning texture.uvOffset
167
180
  // directly but provides a named mutator for the KHR_texture_transform model.
@@ -1 +1 @@
1
- {"version":3,"file":"texture.js","sourceRoot":"","sources":["../src/texture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAU9F,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEpF,8FAA8F;AAC9F,iGAAiG;AACjG,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,MAA6B;IACxD,OAAO,YAAY,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI;QACjC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;QACrC,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,OAAO,EAAE,YAAY,CAAC,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AAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;IAC7C,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AAC/C,CAAC"}
@@ -1,13 +1,13 @@
1
- import type { Matrix3Like, VideoResource, VideoTexture, VideoTextureLike } from '@flighthq/types';
2
- export declare function advanceVideoTexture(videoTexture: VideoTextureLike): number;
3
- export declare function cloneVideoTexture(source: Readonly<VideoTextureLike>): VideoTexture;
4
- export declare function copyVideoTexture(out: VideoTextureLike, source: Readonly<VideoTextureLike>): void;
5
- export declare function createVideoTexture(source: VideoResource, opts?: Readonly<Partial<VideoTextureLike>>): VideoTexture;
6
- export declare function getVideoTextureHeight(videoTexture: Readonly<VideoTextureLike>): number;
7
- export declare function getVideoTextureInverseUvMatrix(out: Matrix3Like, videoTexture: Readonly<VideoTextureLike>): void;
8
- export declare function getVideoTextureUvMatrix(out: Matrix3Like, videoTexture: Readonly<VideoTextureLike>): void;
9
- export declare function getVideoTextureWidth(videoTexture: Readonly<VideoTextureLike>): number;
10
- export declare function isVideoTextureFrameReady(videoTexture: Readonly<VideoTextureLike>): boolean;
11
- export declare function resetVideoTextureFrame(videoTexture: VideoTextureLike): void;
12
- export declare function setVideoTextureSource(videoTexture: VideoTextureLike, source: VideoResource): void;
1
+ import type { Matrix3Like, Texture, TextureLike, VideoResource } from '@flighthq/types/contract';
2
+ export declare function advanceVideoTexture(texture: TextureLike): number;
3
+ export declare function cloneVideoTexture(source: Readonly<TextureLike>): Texture;
4
+ export declare function copyVideoTexture(out: TextureLike, source: Readonly<TextureLike>): void;
5
+ export declare function createVideoTexture(source: VideoResource, opts?: Readonly<Partial<TextureLike>>): Texture;
6
+ export declare function getVideoTextureHeight(texture: Readonly<TextureLike>): number;
7
+ export declare function getVideoTextureInverseUvMatrix(out: Matrix3Like, texture: Readonly<TextureLike>): void;
8
+ export declare function getVideoTextureUvMatrix(out: Matrix3Like, texture: Readonly<TextureLike>): void;
9
+ export declare function getVideoTextureWidth(texture: Readonly<TextureLike>): number;
10
+ export declare function isVideoTextureFrameReady(texture: Readonly<TextureLike>): boolean;
11
+ export declare function resetVideoTextureFrame(texture: TextureLike): void;
12
+ export declare function setVideoTextureSource(texture: TextureLike, source: VideoResource): void;
13
13
  //# sourceMappingURL=videoTexture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"videoTexture.d.ts","sourceRoot":"","sources":["../src/videoTexture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASlG,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,gBAAgB,GAAG,MAAM,CAG1E;AAMD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,YAAY,CAYlF;AAKD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAgBhG;AAKD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,YAAY,CAYlH;AAKD,wBA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O,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,CAG5E;AAGD,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAGrG;AAGD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAE9F;AAGD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,CAG3E;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CAKhF;AAGD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAIjE;AAID,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAYvF"}
@@ -1,113 +1,108 @@
1
- import { createEntity } from '@flighthq/entity';
2
- import { cloneVector2, copyVector2, createVector2, inverseMatrix3 } from '@flighthq/geometry';
3
- import { cloneSampler, copySampler, createSampler } from './sampler';
4
- import { getTextureUvMatrix } from './texture';
5
- // Marks a fresh decoded frame as available for upload by bumping `frameId`. A driver calls this once
6
- // per rendered frame when the backing element reports new pixels (readyState advanced, or a
7
- // requestVideoFrameCallback fired); the GPU uploader compares the id against the one it last uploaded
8
- // and re-uploads only on a change, so a paused stream costs no upload. Returns the new id.
9
- export function advanceVideoTexture(videoTexture) {
10
- videoTexture.frameId += 1;
11
- return videoTexture.frameId;
1
+ import { createEntity } from '@flighthq/entity/contract';
2
+ import { inverseMatrix3 } from '@flighthq/geometry/contract';
3
+ import { cloneTexture, copyTexture, createTexture, getTextureUvMatrix } from './texture';
4
+ // Marks a fresh decoded frame on a video-backed Texture. The ImageResource is the shared CPU-origin
5
+ // backing and owns the upload revision; Texture.version mirrors it as the sampled object's dirty-bit.
6
+ export function advanceVideoTexture(texture) {
7
+ const image = texture.storage.image;
8
+ if (image === null)
9
+ return texture.version;
10
+ updateVideoImageSize(image);
11
+ image.version = (image.version + 1) >>> 0;
12
+ texture.version = image.version;
13
+ return texture.version;
12
14
  }
13
- // Allocates an independent VideoTexture over the SAME video stream: the VideoResource reference is
14
- // shared (an HTMLVideoElement cannot be duplicated), while the Sampler and uv-transform vectors are
15
- // deep-cloned so two textures over one stream sample independently. `frameId` resets to -1 so the
16
- // clone forces its own first upload.
15
+ // Clones sampling/UV state while sharing the borrowed video ImageResource and its upload cache key.
17
16
  export function cloneVideoTexture(source) {
18
- return createEntity({
19
- colorSpace: source.colorSpace,
20
- flipX: source.flipX,
21
- flipY: source.flipY,
22
- frameId: -1,
23
- sampler: cloneSampler(source.sampler),
24
- source: source.source,
25
- uvOffset: cloneVector2(source.uvOffset),
26
- uvRotation: source.uvRotation,
27
- uvScale: cloneVector2(source.uvScale),
28
- });
17
+ return cloneTexture(source);
29
18
  }
30
- // Copies every VideoTexture field from source into out in place. The VideoResource reference is
31
- // shared; the Sampler and uv-transform vectors are copied into out's existing entities. Safe when out
32
- // aliases source.
19
+ // Copies a video-backed Texture through the universal Texture field copier.
33
20
  export function copyVideoTexture(out, source) {
34
- const colorSpace = source.colorSpace;
35
- const flipX = source.flipX;
36
- const flipY = source.flipY;
37
- const frameId = source.frameId;
38
- const src = source.source;
39
- const uvRotation = source.uvRotation;
40
- copySampler(out.sampler, source.sampler);
41
- copyVector2(out.uvOffset, source.uvOffset);
42
- copyVector2(out.uvScale, source.uvScale);
43
- out.colorSpace = colorSpace;
44
- out.flipX = flipX;
45
- out.flipY = flipY;
46
- out.frameId = frameId;
47
- out.source = src;
48
- out.uvRotation = uvRotation;
21
+ copyTexture(out, source);
49
22
  }
50
- // Builds a VideoTexture over a VideoResource: a default Sampler, 'srgb' color space (video is
51
- // display-referred), an identity KHR_texture_transform, and `frameId` -1 (no frame uploaded yet).
52
- // Pass VideoTextureLike fields to override any of these.
23
+ // Wraps a VideoResource's borrowed host element in an ImageResource backing and returns the same
24
+ // universal Texture type used by still images and produced targets. The all-ones initial revision
25
+ // preserves the former first advanceVideoTexture result of 0 after u32 wrap.
53
26
  export function createVideoTexture(source, opts) {
54
- return createEntity({
55
- colorSpace: opts?.colorSpace ?? 'srgb',
56
- flipX: opts?.flipX ?? false,
57
- flipY: opts?.flipY ?? false,
58
- frameId: opts?.frameId ?? -1,
59
- sampler: opts?.sampler ? cloneSampler(opts.sampler) : createSampler(),
60
- source: opts?.source ?? source,
61
- uvOffset: opts?.uvOffset ? cloneVector2(opts.uvOffset) : createVector2(0, 0),
62
- uvRotation: opts?.uvRotation ?? 0,
63
- uvScale: opts?.uvScale ? cloneVector2(opts.uvScale) : createVector2(1, 1),
27
+ const image = createVideoImageResource(source);
28
+ return createTexture({
29
+ ...opts,
30
+ storage: { dimension: '2d', image },
31
+ version: image.version,
64
32
  });
65
33
  }
66
- // Returns the pixel height of the current video frame, or -1 when no element is attached or no frame
67
- // has decoded yet (videoHeight is 0). Reads the element directly, so the value tracks a resolution
68
- // change mid-stream.
69
- export function getVideoTextureHeight(videoTexture) {
70
- const element = videoTexture.source.element;
34
+ // Returns the decoded frame height, or -1 while the borrowed host element is absent/unready.
35
+ export function getVideoTextureHeight(texture) {
36
+ const element = getVideoElement(texture);
71
37
  return element !== null && element.videoHeight > 0 ? element.videoHeight : -1;
72
38
  }
73
- // Composes the KHR_texture_transform fields and inverts the result, producing the matrix that maps
74
- // already-transformed uv back to the unit-square source uv. A zero scale is singular, so inverseMatrix3
75
- // fills the matrix with NaN. Out-param form — write into a pre-allocated Matrix3.
76
- export function getVideoTextureInverseUvMatrix(out, videoTexture) {
77
- getVideoTextureUvMatrix(out, videoTexture);
39
+ // Video-named compatibility entry over the universal Texture UV transform.
40
+ export function getVideoTextureInverseUvMatrix(out, texture) {
41
+ getVideoTextureUvMatrix(out, texture);
78
42
  inverseMatrix3(out, out);
79
43
  }
80
- // Composes the KHR_texture_transform fields (flip, uvOffset, uvRotation, uvScale) into the column-major
81
- // 3×3 matrix a shader consumes at sample time. A VideoTexture is a TextureUvTransform, so this delegates
82
- // to getTextureUvMatrix — one uv-transform path (flip → scale → rotate → translate) for both texture
83
- // kinds. Out-param form.
84
- export function getVideoTextureUvMatrix(out, videoTexture) {
85
- getTextureUvMatrix(out, videoTexture);
44
+ // Video-named compatibility entry over the universal Texture UV transform.
45
+ export function getVideoTextureUvMatrix(out, texture) {
46
+ getTextureUvMatrix(out, texture);
86
47
  }
87
- // Returns the pixel width of the current video frame, or -1 when no element is attached or no frame
88
- // has decoded yet.
89
- export function getVideoTextureWidth(videoTexture) {
90
- const element = videoTexture.source.element;
48
+ // Returns the decoded frame width, or -1 while the borrowed host element is absent/unready.
49
+ export function getVideoTextureWidth(texture) {
50
+ const element = getVideoElement(texture);
91
51
  return element !== null && element.videoWidth > 0 ? element.videoWidth : -1;
92
52
  }
93
- // True when the backing element has decoded at least the current frame (readyState >=
94
- // HAVE_CURRENT_DATA) and its dimensions are known — the gate a material samples behind and a driver
95
- // checks before calling advanceVideoTexture. False while metadata/first-frame is still buffering.
96
- export function isVideoTextureFrameReady(videoTexture) {
97
- const element = videoTexture.source.element;
53
+ // True once the borrowed host element exposes a decoded current frame and non-zero dimensions.
54
+ export function isVideoTextureFrameReady(texture) {
55
+ const element = getVideoElement(texture);
98
56
  return (element !== null && element.readyState >= HAVE_CURRENT_DATA && element.videoWidth > 0 && element.videoHeight > 0);
99
57
  }
100
- // Resets `frameId` to -1 so the next upload re-sends the current frame regardless of history. Used
101
- // after a context loss (the GPU texture is gone) or a source swap to force a re-upload.
102
- export function resetVideoTextureFrame(videoTexture) {
103
- videoTexture.frameId = -1;
58
+ // Resets the shared backing revision so its next advance wraps to 0 and every state re-uploads.
59
+ export function resetVideoTextureFrame(texture) {
60
+ const image = texture.storage.image;
61
+ if (image !== null)
62
+ image.version = INITIAL_VIDEO_VERSION;
63
+ texture.version = INITIAL_VIDEO_VERSION;
64
+ }
65
+ // Replaces the borrowed host element in the existing ImageResource backing and resets its upload
66
+ // revision. The VideoResource remains the loader/lifecycle object; Texture stores only its host handle.
67
+ export function setVideoTextureSource(texture, source) {
68
+ const image = texture.storage.image;
69
+ if (image === null) {
70
+ texture.storage.image = createVideoImageResource(source);
71
+ }
72
+ else {
73
+ image.source = source.element;
74
+ image.width = 0;
75
+ image.height = 0;
76
+ updateVideoImageSize(image);
77
+ image.version = INITIAL_VIDEO_VERSION;
78
+ }
79
+ texture.version = INITIAL_VIDEO_VERSION;
80
+ }
81
+ function createVideoImageResource(source) {
82
+ const image = createEntity({
83
+ alphaType: 'straight',
84
+ compressed: null,
85
+ data: null,
86
+ format: 'rgba8unorm',
87
+ height: 0,
88
+ source: source.element,
89
+ version: INITIAL_VIDEO_VERSION,
90
+ width: 0,
91
+ });
92
+ updateVideoImageSize(image);
93
+ return image;
94
+ }
95
+ function getVideoElement(texture) {
96
+ return texture.storage.image?.source ?? null;
104
97
  }
105
- // Binds a different video stream and resets `frameId` to -1 so the new stream's first frame uploads.
106
- // Does not touch sampling state or the uv-transform.
107
- export function setVideoTextureSource(videoTexture, source) {
108
- videoTexture.source = source;
109
- videoTexture.frameId = -1;
98
+ function updateVideoImageSize(image) {
99
+ const element = image.source;
100
+ if (element === null)
101
+ return;
102
+ image.width = element.videoWidth || 0;
103
+ image.height = element.videoHeight || 0;
110
104
  }
111
- // HTMLMediaElement.HAVE_CURRENT_DATA — data for the current playback position is available.
105
+ // HTMLMediaElement.HAVE_CURRENT_DATA and the u32 predecessor of the first public frame revision.
112
106
  const HAVE_CURRENT_DATA = 2;
107
+ const INITIAL_VIDEO_VERSION = 0xffffffff;
113
108
  //# sourceMappingURL=videoTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"videoTexture.js","sourceRoot":"","sources":["../src/videoTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,a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D,OAAO,CAAC,OAAO,GAAG,qBAAqB,CAAC;AAC1C,CAAC;AAED,SAAS,wBAAwB,CAAC,MAA+B;IAC/D,MAAM,KAAK,GAAG,YAAY,CAAC;QACzB,SAAS,EAAE,UAAU;QACrB,UAAU,EAAE,IAAI;QAChB,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,MAAM,CAAC,OAAO;QACtB,OAAO,EAAE,qBAAqB;QAC9B,KAAK,EAAE,CAAC;KACT,CAAkB,CAAC;IACpB,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,OAA8B;IACrD,OAAQ,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,MAA8C,IAAI,IAAI,CAAC;AACxF,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAoB;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAiC,CAAC;IACxD,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO;IAC7B,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,iGAAiG;AACjG,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,qBAAqB,GAAG,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/texture",
3
- "version": "0.2.1-next.841.373388f",
3
+ "version": "0.3.0-next.906.07cea63",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/flighthq/flight.git",
@@ -13,6 +13,10 @@
13
13
  ".": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
+ },
17
+ "./contract": {
18
+ "types": "./dist/contract.d.ts",
19
+ "default": "./dist/contract.js"
16
20
  }
17
21
  },
18
22
  "files": [
@@ -32,9 +36,9 @@
32
36
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
33
37
  },
34
38
  "dependencies": {
35
- "@flighthq/entity": "0.2.1-next.841.373388f",
36
- "@flighthq/geometry": "0.2.1-next.841.373388f",
37
- "@flighthq/types": "0.2.1-next.841.373388f"
39
+ "@flighthq/entity": "0.3.0-next.906.07cea63",
40
+ "@flighthq/geometry": "0.3.0-next.906.07cea63",
41
+ "@flighthq/types": "0.3.0-next.906.07cea63"
38
42
  },
39
43
  "devDependencies": {
40
44
  "typescript": "^5.3.0"
@@ -1,5 +1,5 @@
1
- import type { ImageResource } from '@flighthq/types';
2
- import { CubeFaceNegativeX, CubeFacePositiveX, CubeFacePositiveY } from '@flighthq/types';
1
+ import type { ImageResource } from '@flighthq/types/contract';
2
+ import { CubeFaceNegativeX, CubeFacePositiveX, CubeFacePositiveY } from '@flighthq/types/contract';
3
3
 
4
4
  import {
5
5
  cloneCubeTexture,
@@ -0,0 +1,45 @@
1
+ import { createRenderTexture } from './renderTexture';
2
+ import { createSampler } from './sampler';
3
+
4
+ describe('createRenderTexture', () => {
5
+ it('creates a linear render target with identity UVs and no depth by default', () => {
6
+ const texture = createRenderTexture({ height: 32, width: 64 });
7
+
8
+ expect(texture).toMatchObject({
9
+ colorSpace: 'linear',
10
+ flipX: false,
11
+ flipY: false,
12
+ storage: {
13
+ dimension: '2d',
14
+ image: null,
15
+ target: { colorSpace: 'linear', height: 32, width: 64 },
16
+ },
17
+ uvOffset: { x: 0, y: 0 },
18
+ uvRotation: 0,
19
+ uvScale: { x: 1, y: 1 },
20
+ version: 0,
21
+ });
22
+ });
23
+
24
+ it('applies sampling, depth, color-space, and uv overrides without aliasing mutable values', () => {
25
+ const sampler = createSampler({ magFilter: 'nearest' });
26
+ const uvOffset = { x: 0.25, y: 0.5 };
27
+ const texture = createRenderTexture({
28
+ colorSpace: 'srgb',
29
+ depth: 'depth-stencil',
30
+ flipY: false,
31
+ height: 16,
32
+ sampler,
33
+ uvOffset,
34
+ width: 8,
35
+ });
36
+
37
+ expect(texture.colorSpace).toBe('srgb');
38
+ expect(texture.storage.target?.depth).toBe('depth-stencil');
39
+ expect(texture.flipY).toBe(false);
40
+ expect(texture.sampler.magFilter).toBe('nearest');
41
+ expect(texture.sampler).not.toBe(sampler);
42
+ expect(texture.uvOffset).toMatchObject(uvOffset);
43
+ expect(texture.uvOffset).not.toBe(uvOffset);
44
+ });
45
+ });
@@ -1,5 +1,5 @@
1
- import { createMatrix3, createVector2, inverseMatrix3 } from '@flighthq/geometry';
2
- import type { ImageResource } from '@flighthq/types';
1
+ import { createMatrix3, createVector2, inverseMatrix3 } from '@flighthq/geometry/contract';
2
+ import type { ImageResource } from '@flighthq/types/contract';
3
3
 
4
4
  import { createSampler, equalsSampler } from './sampler';
5
5
  import {
@@ -35,7 +35,7 @@ describe('cloneTexture', () => {
35
35
  it('shares the image but deep-clones the sampler and uv vectors', () => {
36
36
  const source = createTexture({
37
37
  colorSpace: 'linear',
38
- image: fakeImage,
38
+ storage: { dimension: '2d', image: fakeImage },
39
39
  uvRotation: 0.5,
40
40
  });
41
41
  source.uvOffset.x = 0.25;
@@ -44,7 +44,8 @@ describe('cloneTexture', () => {
44
44
  const copy = cloneTexture(source);
45
45
 
46
46
  expect(copy).not.toBe(source);
47
- expect(copy.image).toBe(fakeImage);
47
+ expect(copy.storage).not.toBe(source.storage);
48
+ expect(copy.storage.image).toBe(fakeImage);
48
49
  expect(copy.colorSpace).toStrictEqual('linear');
49
50
  expect(copy.uvRotation).toStrictEqual(0.5);
50
51
  expect(copy.sampler).not.toBe(source.sampler);
@@ -56,34 +57,55 @@ describe('cloneTexture', () => {
56
57
  copy.uvOffset.x = 0.9;
57
58
  expect(source.uvOffset.x).toStrictEqual(0.25);
58
59
  });
60
+
61
+ it('preserves a produced descriptor while cloning sampling state', () => {
62
+ const target = { colorSpace: 'linear' as const, height: 32, width: 64 };
63
+ const source = createTexture({ storage: { dimension: '2d', image: null, target } });
64
+
65
+ const copy = cloneTexture(source);
66
+
67
+ expect(copy.storage.target).toBe(target);
68
+ expect(copy.storage).not.toBe(source.storage);
69
+ expect(copy.sampler).not.toBe(source.sampler);
70
+ });
59
71
  });
60
72
 
61
73
  describe('copyTexture', () => {
62
74
  it('writes every field from source into a distinct out, preserving out entity identities', () => {
63
- const source = createTexture({ colorSpace: 'linear', image: fakeImage, uvRotation: 1 });
75
+ const source = createTexture({
76
+ colorSpace: 'linear',
77
+ storage: { dimension: '2d', image: fakeImage },
78
+ uvRotation: 1,
79
+ });
64
80
  source.uvScale.x = 4;
65
81
  const out = createTexture();
66
82
  const outSampler = out.sampler;
67
83
  const outOffset = out.uvOffset;
84
+ const outStorage = out.storage;
68
85
 
69
86
  copyTexture(out, source);
70
87
 
71
- expect(out.image).toBe(fakeImage);
88
+ expect(out.storage.image).toBe(fakeImage);
72
89
  expect(out.colorSpace).toStrictEqual('linear');
73
90
  expect(out.uvRotation).toStrictEqual(1);
74
91
  expect(out.uvScale.x).toStrictEqual(4);
75
92
  expect(out.sampler).toBe(outSampler);
93
+ expect(out.storage).toBe(outStorage);
76
94
  expect(out.uvOffset).toBe(outOffset);
77
95
  });
78
96
 
79
97
  it('is safe when out aliases source', () => {
80
- const source = createTexture({ colorSpace: 'linear', image: fakeImage, uvRotation: 2 });
98
+ const source = createTexture({
99
+ colorSpace: 'linear',
100
+ storage: { dimension: '2d', image: fakeImage },
101
+ uvRotation: 2,
102
+ });
81
103
  source.uvScale.x = 7;
82
104
 
83
105
  copyTexture(source, source);
84
106
 
85
107
  expect(source.colorSpace).toStrictEqual('linear');
86
- expect(source.image).toBe(fakeImage);
108
+ expect(source.storage.image).toBe(fakeImage);
87
109
  expect(source.uvRotation).toStrictEqual(2);
88
110
  expect(source.uvScale.x).toStrictEqual(7);
89
111
  });
@@ -93,8 +115,10 @@ describe('createTexture', () => {
93
115
  it('applies the default unbound, srgb, identity-transform state', () => {
94
116
  const texture = createTexture();
95
117
 
96
- expect(texture.image).toBeNull();
118
+ expect(texture.storage.image).toBeNull();
119
+ expect(texture.storage.dimension).toStrictEqual('2d');
97
120
  expect(texture.colorSpace).toStrictEqual('srgb');
121
+ expect(texture.version).toStrictEqual(0);
98
122
  expect(texture.uvRotation).toStrictEqual(0);
99
123
  expect(texture.uvOffset.x).toStrictEqual(0);
100
124
  expect(texture.uvOffset.y).toStrictEqual(0);
@@ -114,8 +138,8 @@ describe('createTexture', () => {
114
138
 
115
139
  describe('equalsTexture', () => {
116
140
  it('is true for textures with identical state and same image reference', () => {
117
- const a = createTexture({ image: fakeImage, colorSpace: 'linear' });
118
- const b = createTexture({ image: fakeImage, colorSpace: 'linear' });
141
+ const a = createTexture({ colorSpace: 'linear', storage: { dimension: '2d', image: fakeImage } });
142
+ const b = createTexture({ colorSpace: 'linear', storage: { dimension: '2d', image: fakeImage } });
119
143
 
120
144
  expect(equalsTexture(a, b)).toBe(true);
121
145
  expect(equalsTexture(a, a)).toBe(true);
@@ -123,8 +147,8 @@ describe('equalsTexture', () => {
123
147
 
124
148
  it('is false when the image reference differs', () => {
125
149
  const other = { width: 4, height: 4 } as ImageResource;
126
- const a = createTexture({ image: fakeImage });
127
- const b = createTexture({ image: other });
150
+ const a = createTexture({ storage: { dimension: '2d', image: fakeImage } });
151
+ const b = createTexture({ storage: { dimension: '2d', image: other } });
128
152
 
129
153
  expect(equalsTexture(a, b)).toBe(false);
130
154
  });
@@ -177,7 +201,7 @@ describe('equalsTexture', () => {
177
201
 
178
202
  describe('getTextureHeight', () => {
179
203
  it('returns the image height when an image is bound', () => {
180
- const texture = createTexture({ image: fakeImage });
204
+ const texture = createTexture({ storage: { dimension: '2d', image: fakeImage } });
181
205
 
182
206
  expect(getTextureHeight(texture)).toStrictEqual(64);
183
207
  });
@@ -187,6 +211,14 @@ describe('getTextureHeight', () => {
187
211
 
188
212
  expect(getTextureHeight(texture)).toStrictEqual(-1);
189
213
  });
214
+
215
+ it('returns the produced target height when there is no CPU image', () => {
216
+ const texture = createTexture({
217
+ storage: { dimension: '2d', image: null, target: { height: 48, width: 96 } },
218
+ });
219
+
220
+ expect(getTextureHeight(texture)).toStrictEqual(48);
221
+ });
190
222
  });
191
223
 
192
224
  describe('getTextureInverseUvMatrix', () => {
@@ -320,7 +352,7 @@ describe('getTextureUvMatrix', () => {
320
352
 
321
353
  describe('getTextureWidth', () => {
322
354
  it('returns the image width when an image is bound', () => {
323
- const texture = createTexture({ image: fakeImage });
355
+ const texture = createTexture({ storage: { dimension: '2d', image: fakeImage } });
324
356
 
325
357
  expect(getTextureWidth(texture)).toStrictEqual(32);
326
358
  });
@@ -330,6 +362,14 @@ describe('getTextureWidth', () => {
330
362
 
331
363
  expect(getTextureWidth(texture)).toStrictEqual(-1);
332
364
  });
365
+
366
+ it('returns the produced target width when there is no CPU image', () => {
367
+ const texture = createTexture({
368
+ storage: { dimension: '2d', image: null, target: { height: 48, width: 96 } },
369
+ });
370
+
371
+ expect(getTextureWidth(texture)).toStrictEqual(96);
372
+ });
333
373
  });
334
374
 
335
375
  describe('hasTextureUvTransform', () => {
@@ -378,14 +418,14 @@ describe('isTextureReady', () => {
378
418
 
379
419
  expect(isTextureReady(texture)).toBe(false);
380
420
 
381
- texture.image = fakeImage;
421
+ texture.storage.image = fakeImage;
382
422
  expect(isTextureReady(texture)).toBe(true);
383
423
  });
384
424
  });
385
425
 
386
426
  describe('resetTextureUvTransform', () => {
387
427
  it('restores the identity transform while leaving image, color space, and sampler untouched', () => {
388
- const texture = createTexture({ colorSpace: 'linear', image: fakeImage });
428
+ const texture = createTexture({ colorSpace: 'linear', storage: { dimension: '2d', image: fakeImage } });
389
429
  const sampler = texture.sampler;
390
430
  setTextureUvOffset(texture, 0.4, 0.6);
391
431
  setTextureUvRotation(texture, Math.PI);
@@ -399,7 +439,7 @@ describe('resetTextureUvTransform', () => {
399
439
  expect(texture.uvScale.x).toStrictEqual(1);
400
440
  expect(texture.uvScale.y).toStrictEqual(1);
401
441
  expect(texture.colorSpace).toStrictEqual('linear');
402
- expect(texture.image).toBe(fakeImage);
442
+ expect(texture.storage.image).toBe(fakeImage);
403
443
  expect(texture.sampler).toBe(sampler);
404
444
  });
405
445
  });
@@ -418,14 +458,19 @@ describe('setTextureFlip', () => {
418
458
  });
419
459
 
420
460
  describe('setTextureImage', () => {
421
- it('binds and clears the image in place', () => {
461
+ it('binds and clears the image in place and advances the u32 version', () => {
422
462
  const texture = createTexture();
423
463
 
424
464
  setTextureImage(texture, fakeImage);
425
- expect(texture.image).toBe(fakeImage);
465
+ expect(texture.storage.image).toBe(fakeImage);
466
+ expect(texture.version).toStrictEqual(1);
467
+
468
+ setTextureImage(texture, fakeImage);
469
+ expect(texture.version).toStrictEqual(1);
426
470
 
427
471
  setTextureImage(texture, null);
428
- expect(texture.image).toBeNull();
472
+ expect(texture.storage.image).toBeNull();
473
+ expect(texture.version).toStrictEqual(2);
429
474
  });
430
475
  });
431
476
 
@@ -1,5 +1,5 @@
1
- import { createMatrix3, createVector2 } from '@flighthq/geometry';
2
- import type { VideoResource } from '@flighthq/types';
1
+ import { createMatrix3, createVector2 } from '@flighthq/geometry/contract';
2
+ import type { VideoResource } from '@flighthq/types/contract';
3
3
 
4
4
  import {
5
5
  advanceVideoTexture,
@@ -15,7 +15,7 @@ import {
15
15
  setVideoTextureSource,
16
16
  } from './videoTexture';
17
17
 
18
- // A minimal element carrier: only the fields the VideoTexture accessors read.
18
+ // A minimal borrowed host element: only the fields the video-backed Texture accessors read.
19
19
  function makeVideoResource(readyState = 4, videoWidth = 320, videoHeight = 240): VideoResource {
20
20
  return {
21
21
  element: { readyState, videoWidth, videoHeight } as unknown as HTMLVideoElement,
@@ -23,26 +23,27 @@ function makeVideoResource(readyState = 4, videoWidth = 320, videoHeight = 240):
23
23
  }
24
24
 
25
25
  describe('advanceVideoTexture', () => {
26
- it('bumps frameId and returns the new value', () => {
26
+ it('bumps the backing and Texture versions and returns the new value', () => {
27
27
  const vt = createVideoTexture(makeVideoResource());
28
- expect(vt.frameId).toBe(-1);
28
+ expect(vt.version).toBe(0xffffffff);
29
29
  expect(advanceVideoTexture(vt)).toBe(0);
30
30
  expect(advanceVideoTexture(vt)).toBe(1);
31
- expect(vt.frameId).toBe(1);
31
+ expect(vt.version).toBe(1);
32
+ expect(vt.storage.image?.version).toBe(1);
32
33
  });
33
34
  });
34
35
 
35
36
  describe('cloneVideoTexture', () => {
36
- it('shares the source but deep-clones sampler and uv vectors and resets frameId', () => {
37
+ it('shares the backing but deep-clones sampler and uv vectors', () => {
37
38
  const source = makeVideoResource();
38
39
  const vt = createVideoTexture(source, { uvOffset: createVector2(2, 3) });
39
40
  advanceVideoTexture(vt);
40
41
  const clone = cloneVideoTexture(vt);
41
- expect(clone.source).toBe(source);
42
+ expect(clone.storage.image).toBe(vt.storage.image);
42
43
  expect(clone.sampler).not.toBe(vt.sampler);
43
44
  expect(clone.uvOffset).not.toBe(vt.uvOffset);
44
45
  expect(clone.uvOffset.x).toBe(2);
45
- expect(clone.frameId).toBe(-1);
46
+ expect(clone.version).toBe(0);
46
47
  });
47
48
  });
48
49
 
@@ -53,8 +54,8 @@ describe('copyVideoTexture', () => {
53
54
  const b = createVideoTexture(makeVideoResource());
54
55
  copyVideoTexture(b, a);
55
56
  expect(b.colorSpace).toBe('linear');
56
- expect(b.frameId).toBe(0);
57
- expect(b.source).toBe(a.source);
57
+ expect(b.version).toBe(0);
58
+ expect(b.storage.image).toBe(a.storage.image);
58
59
  expect(b.uvScale.x).toBe(4);
59
60
  copyVideoTexture(a, a);
60
61
  expect(a.uvScale.x).toBe(4);
@@ -62,12 +63,12 @@ describe('copyVideoTexture', () => {
62
63
  });
63
64
 
64
65
  describe('createVideoTexture', () => {
65
- it('defaults to srgb, identity uv-transform, and frameId -1', () => {
66
+ it('returns a universal srgb Texture with a borrowed host-image backing', () => {
66
67
  const source = makeVideoResource();
67
68
  const vt = createVideoTexture(source);
68
69
  expect(vt.colorSpace).toBe('srgb');
69
- expect(vt.source).toBe(source);
70
- expect(vt.frameId).toBe(-1);
70
+ expect(vt.storage.image?.source).toBe(source.element);
71
+ expect(vt.version).toBe(0xffffffff);
71
72
  expect(vt.uvOffset.x).toBe(0);
72
73
  expect(vt.uvScale.x).toBe(1);
73
74
  expect(vt.uvRotation).toBe(0);
@@ -135,23 +136,24 @@ describe('isVideoTextureFrameReady', () => {
135
136
  });
136
137
 
137
138
  describe('resetVideoTextureFrame', () => {
138
- it('sets frameId back to -1', () => {
139
+ it('sets the shared revision to the u32 pre-first-frame sentinel', () => {
139
140
  const vt = createVideoTexture(makeVideoResource());
140
141
  advanceVideoTexture(vt);
141
142
  advanceVideoTexture(vt);
142
143
  resetVideoTextureFrame(vt);
143
- expect(vt.frameId).toBe(-1);
144
+ expect(vt.version).toBe(0xffffffff);
145
+ expect(vt.storage.image?.version).toBe(0xffffffff);
144
146
  });
145
147
  });
146
148
 
147
149
  describe('setVideoTextureSource', () => {
148
- it('swaps the source and resets frameId', () => {
150
+ it('swaps the borrowed host handle and resets the version', () => {
149
151
  const vt = createVideoTexture(makeVideoResource());
150
152
  advanceVideoTexture(vt);
151
153
  const next = makeVideoResource(4, 640, 480);
152
154
  setVideoTextureSource(vt, next);
153
- expect(vt.source).toBe(next);
154
- expect(vt.frameId).toBe(-1);
155
+ expect(vt.storage.image?.source).toBe(next.element);
156
+ expect(vt.version).toBe(0xffffffff);
155
157
  expect(getVideoTextureWidth(vt)).toBe(640);
156
158
  });
157
159
  });