@flighthq/render-gl 0.3.0-next.1445.14ca01c → 0.3.0-next.1454.b17f8a5
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { GlRenderState, GlTextureResolver, TextureSourceKind, TextureLike } from '@flighthq/types/contract';
|
|
1
|
+
import type { GlRenderState, GlTextureResolver, TextureColorSpace, TextureSourceKind, TextureLike } from '@flighthq/types/contract';
|
|
2
2
|
export declare function registerGlBitmapTextureResolver(state: GlRenderState): void;
|
|
3
3
|
export declare function registerGlCompressedImageTextureResolver(state: GlRenderState): void;
|
|
4
4
|
export declare function registerGlImageTextureResolver(state: GlRenderState): void;
|
|
5
5
|
export declare function registerGlRenderTextureResolver(state: GlRenderState): void;
|
|
6
6
|
export declare function registerGlTextureResolver(state: GlRenderState, sourceKind: TextureSourceKind, resolver: GlTextureResolver | null): void;
|
|
7
7
|
export declare function registerStandardGlTextureResolvers(state: GlRenderState): void;
|
|
8
|
-
export declare function resolveGlTexture(state: GlRenderState, texture: Readonly<TextureLike>, premultiply?: boolean): WebGLTexture | null;
|
|
8
|
+
export declare function resolveGlTexture(state: GlRenderState, texture: Readonly<TextureLike>, premultiply?: boolean, colorSpace?: TextureColorSpace): WebGLTexture | null;
|
|
9
9
|
//# sourceMappingURL=glTextureResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTextureResolver.d.ts","sourceRoot":"","sources":["../src/glTextureResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,aAAa,EACb,iBAAiB,EAGjB,iBAAiB,EACjB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAYlC,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAE1E;AAED,wBAAgB,wCAAwC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAEnF;AAED,wBAAgB,8BAA8B,CAAC,K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AUrB"}
|
|
@@ -36,7 +36,7 @@ export function registerStandardGlTextureResolvers(state) {
|
|
|
36
36
|
// GL upload and sampler application require that binding. Callers must not reorder this call across
|
|
37
37
|
// activeTexture/bind operations as though it only returned a handle. The CPU source owns its kind; a
|
|
38
38
|
// GPU-origin target owns its own. An unbound or undeclared source is the null sentinel.
|
|
39
|
-
export function resolveGlTexture(state, texture, premultiply = false) {
|
|
39
|
+
export function resolveGlTexture(state, texture, premultiply = false, colorSpace = texture.colorSpace) {
|
|
40
40
|
const sourceKind = getTextureSourceKind(texture);
|
|
41
41
|
if (sourceKind === null)
|
|
42
42
|
return null;
|
|
@@ -46,23 +46,21 @@ export function resolveGlTexture(state, texture, premultiply = false) {
|
|
|
46
46
|
runtime.registryMiss?.(3, sourceKind);
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
return resolver(state, texture, premultiply);
|
|
49
|
+
return resolver(state, texture, premultiply, colorSpace);
|
|
50
50
|
}
|
|
51
|
-
function resolveGlBitmapTexture(state, texture, premultiply) {
|
|
51
|
+
function resolveGlBitmapTexture(state, texture, premultiply, colorSpace) {
|
|
52
52
|
const bitmap = getTextureSource(texture);
|
|
53
|
-
return bitmap === null
|
|
54
|
-
? null
|
|
55
|
-
: bindGlBitmapTexture(state, bitmap, texture.sampler, null, premultiply, texture.colorSpace);
|
|
53
|
+
return bitmap === null ? null : bindGlBitmapTexture(state, bitmap, texture.sampler, null, premultiply, colorSpace);
|
|
56
54
|
}
|
|
57
|
-
function resolveGlCompressedImageTexture(state, texture) {
|
|
55
|
+
function resolveGlCompressedImageTexture(state, texture, _premultiply, colorSpace) {
|
|
58
56
|
const image = getTextureSource(texture);
|
|
59
|
-
return image === null ? null : bindGlCompressedImageTexture(state, image, texture.sampler, null,
|
|
57
|
+
return image === null ? null : bindGlCompressedImageTexture(state, image, texture.sampler, null, colorSpace);
|
|
60
58
|
}
|
|
61
|
-
function resolveGlImageTexture(state, texture, premultiply) {
|
|
59
|
+
function resolveGlImageTexture(state, texture, premultiply, colorSpace) {
|
|
62
60
|
const image = getTextureSource(texture);
|
|
63
61
|
return image === null
|
|
64
62
|
? null
|
|
65
|
-
: bindGlImageResourceTexture(state, image, texture.sampler, null, premultiply,
|
|
63
|
+
: bindGlImageResourceTexture(state, image, texture.sampler, null, premultiply, colorSpace);
|
|
66
64
|
}
|
|
67
65
|
function resolveGlRenderTexture(state, texture) {
|
|
68
66
|
return bindGlRenderTexture(state, texture);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glTextureResolver.js","sourceRoot":"","sources":["../src/glTextureResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"glTextureResolver.js","sourceRoot":"","sources":["../src/glTextureResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAYpF,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,UAAU,+BAA+B,CAAC,KAAoB;IAClE,yBAAyB,CAAC,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,wCAAwC,CAAC,KAAoB;IAC3E,yBAAyB,CAAC,KAAK,EAAE,gCAAgC,EAAE,+BAA+B,CAAC,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,KAAoB;IACjE,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,C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package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/render-gl",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.1454.b17f8a5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/flighthq/flight.git",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@flighthq/color": "0.3.0-next.
|
|
40
|
-
"@flighthq/entity": "0.3.0-next.
|
|
41
|
-
"@flighthq/log": "0.3.0-next.
|
|
42
|
-
"@flighthq/scene2d": "0.3.0-next.
|
|
43
|
-
"@flighthq/geometry": "0.3.0-next.
|
|
44
|
-
"@flighthq/render": "0.3.0-next.
|
|
45
|
-
"@flighthq/signals": "0.3.0-next.
|
|
46
|
-
"@flighthq/texture": "0.3.0-next.
|
|
47
|
-
"@flighthq/types": "0.3.0-next.
|
|
39
|
+
"@flighthq/color": "0.3.0-next.1454.b17f8a5",
|
|
40
|
+
"@flighthq/entity": "0.3.0-next.1454.b17f8a5",
|
|
41
|
+
"@flighthq/log": "0.3.0-next.1454.b17f8a5",
|
|
42
|
+
"@flighthq/scene2d": "0.3.0-next.1454.b17f8a5",
|
|
43
|
+
"@flighthq/geometry": "0.3.0-next.1454.b17f8a5",
|
|
44
|
+
"@flighthq/render": "0.3.0-next.1454.b17f8a5",
|
|
45
|
+
"@flighthq/signals": "0.3.0-next.1454.b17f8a5",
|
|
46
|
+
"@flighthq/texture": "0.3.0-next.1454.b17f8a5",
|
|
47
|
+
"@flighthq/types": "0.3.0-next.1454.b17f8a5"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^5.3.0"
|
|
@@ -108,7 +108,7 @@ describe('registerGlImageTextureResolver', () => {
|
|
|
108
108
|
expect(gl.texImage2D).toHaveBeenCalledOnce();
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
it('realizes
|
|
111
|
+
it('realizes an override independently and defaults to the texture color space', () => {
|
|
112
112
|
const { state, gl } = createGlState();
|
|
113
113
|
const texture = textureWithImage(imageResource());
|
|
114
114
|
registerGlImageTextureResolver(state);
|
|
@@ -122,8 +122,7 @@ describe('registerGlImageTextureResolver', () => {
|
|
|
122
122
|
gl.UNSIGNED_BYTE,
|
|
123
123
|
expect.anything(),
|
|
124
124
|
);
|
|
125
|
-
|
|
126
|
-
const linear = resolveGlTexture(state, texture);
|
|
125
|
+
const linear = resolveGlTexture(state, texture, false, 'linear');
|
|
127
126
|
expect(linear).not.toBe(srgb);
|
|
128
127
|
expect(gl.texImage2D).toHaveBeenLastCalledWith(
|
|
129
128
|
gl.TEXTURE_2D,
|
|
@@ -133,6 +132,7 @@ describe('registerGlImageTextureResolver', () => {
|
|
|
133
132
|
gl.UNSIGNED_BYTE,
|
|
134
133
|
expect.anything(),
|
|
135
134
|
);
|
|
135
|
+
expect(resolveGlTexture(state, texture)).toBe(srgb);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
it('returns null for an unbound image source', () => {
|