palette-shader 0.19.0 → 0.20.1
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 +11 -0
- package/dist/palette-shader.d.ts +4 -0
- package/dist/palette-shader.js +31 -25
- package/dist/palette-shader.js.map +1 -1
- package/dist/palette-shader.umd.cjs +1 -1
- package/dist/palette-shader.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/rendererShared.ts +13 -1
package/README.md
CHANGED
|
@@ -174,10 +174,21 @@ viz.removeColor([0.659, 0.855, 0.863]);
|
|
|
174
174
|
|
|
175
175
|
Cancel the animation frame, release all WebGL resources (programs, textures, framebuffer, buffer, VAO), and remove the canvas from the DOM.
|
|
176
176
|
|
|
177
|
+
### `render()`
|
|
178
|
+
|
|
179
|
+
Force a synchronous render immediately, bypassing the `requestAnimationFrame` schedule. Use this when the canvas (or its WebGL drawing buffer) must reflect the latest state right now — for example before reading pixels back from the canvas in the same JS tick.
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
viz.render();
|
|
183
|
+
// canvas drawing buffer is now up to date — safe to readPixels(...)
|
|
184
|
+
```
|
|
185
|
+
|
|
177
186
|
### `getColorAtUV(x, y)`
|
|
178
187
|
|
|
179
188
|
Returns the current shader result at normalized UV coordinates (`0–1` on both axes) as `[r, g, b]` in `0–1` sRGB. This reads directly from the WebGL render target (or outline source buffer), not from DOM canvas sampling.
|
|
180
189
|
|
|
190
|
+
When a paint is already pending (state changed since the last frame) it renders first; when the render target is already current it skips the redundant render and reads back directly. If you need to guarantee a fresh render as a side effect, call `render()` explicitly.
|
|
191
|
+
|
|
181
192
|
```js
|
|
182
193
|
const color = viz.getColorAtUV(0.5, 0.5); // center
|
|
183
194
|
```
|
package/dist/palette-shader.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ declare abstract class BasePaletteRenderer {
|
|
|
40
40
|
get width(): number;
|
|
41
41
|
get height(): number;
|
|
42
42
|
resize(width: number, height?: number | null): void;
|
|
43
|
+
/** Force a synchronous render immediately, bypassing the rAF schedule.
|
|
44
|
+
* Use when the canvas/FBO must reflect the latest state right now — e.g.
|
|
45
|
+
* before reading pixels back from the canvas. */
|
|
46
|
+
render(): void;
|
|
43
47
|
set palette(palette: ColorList);
|
|
44
48
|
get palette(): ColorList;
|
|
45
49
|
set pixelRatio(value: number);
|
package/dist/palette-shader.js
CHANGED
|
@@ -142,7 +142,7 @@ ${_}`);
|
|
|
142
142
|
function H(r, t) {
|
|
143
143
|
r.bindTexture(r.TEXTURE_2D, t), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.NEAREST), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.NEAREST), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function S(r, t, n) {
|
|
146
146
|
if (n.length === 0) throw new Error("Palette must contain at least one color");
|
|
147
147
|
const e = new Float32Array(n.length * 4);
|
|
148
148
|
n.forEach(([a, o, s], i) => {
|
|
@@ -1299,7 +1299,7 @@ vec3 closestColor(vec3 color, sampler2D paletteTexture) {
|
|
|
1299
1299
|
|
|
1300
1300
|
return closest;
|
|
1301
1301
|
}
|
|
1302
|
-
`,
|
|
1302
|
+
`, O = `
|
|
1303
1303
|
precision highp float;
|
|
1304
1304
|
layout(location = 0) in vec2 a_position;
|
|
1305
1305
|
out vec2 vUv;
|
|
@@ -2024,7 +2024,7 @@ class lt {
|
|
|
2024
2024
|
this.paletteState = t, this.cssWidth = n, this.cssHeight = e, this.pixelRatioState = a, this.observeResize = o, this.containerElement = s, this.canvasElement = document.createElement("canvas"), this.canvasElement.classList.add(i);
|
|
2025
2025
|
const l = this.canvasElement.getContext("webgl2");
|
|
2026
2026
|
if (!l) throw new Error("WebGL2 not supported");
|
|
2027
|
-
this.glContext = l, this.paletteTexture = l.createTexture(), H(l, this.paletteTexture),
|
|
2027
|
+
this.glContext = l, this.paletteTexture = l.createTexture(), H(l, this.paletteTexture), S(l, this.paletteTexture, this.paletteState), this.metricTexture = l.createTexture(), H(l, this.metricTexture);
|
|
2028
2028
|
}
|
|
2029
2029
|
normalizeInvertAxes(t) {
|
|
2030
2030
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -2088,9 +2088,15 @@ class lt {
|
|
|
2088
2088
|
const { pw: e, ph: a } = this.syncCanvasSize(t, n ?? t);
|
|
2089
2089
|
this.onSurfaceResized(e, a), this.schedulePaint();
|
|
2090
2090
|
}
|
|
2091
|
+
/** Force a synchronous render immediately, bypassing the rAF schedule.
|
|
2092
|
+
* Use when the canvas/FBO must reflect the latest state right now — e.g.
|
|
2093
|
+
* before reading pixels back from the canvas. */
|
|
2094
|
+
render() {
|
|
2095
|
+
this.destroyed || (this.flushScheduledPaint(), this.renderFrame());
|
|
2096
|
+
}
|
|
2091
2097
|
set palette(t) {
|
|
2092
2098
|
if (t.length === 0) throw new Error("Palette must contain at least one color");
|
|
2093
|
-
this.paletteState = t,
|
|
2099
|
+
this.paletteState = t, S(this.glContext, this.paletteTexture, t), this.metricPaletteDirty = !0, this.schedulePaint();
|
|
2094
2100
|
}
|
|
2095
2101
|
get palette() {
|
|
2096
2102
|
return this.paletteState.slice();
|
|
@@ -2130,14 +2136,14 @@ class Xt extends lt {
|
|
|
2130
2136
|
#g = null;
|
|
2131
2137
|
#C = null;
|
|
2132
2138
|
#y = null;
|
|
2133
|
-
#
|
|
2139
|
+
#S = null;
|
|
2134
2140
|
// 1×1 float FBO for getColorAtUV_float (lazily created)
|
|
2135
2141
|
#m = null;
|
|
2136
2142
|
#p = null;
|
|
2137
2143
|
#h = null;
|
|
2138
2144
|
#I = null;
|
|
2139
2145
|
#D = null;
|
|
2140
|
-
#
|
|
2146
|
+
#O = null;
|
|
2141
2147
|
#P = null;
|
|
2142
2148
|
#w = null;
|
|
2143
2149
|
#A = !0;
|
|
@@ -2191,11 +2197,11 @@ class Xt extends lt {
|
|
|
2191
2197
|
x[this.#c],
|
|
2192
2198
|
this.#_
|
|
2193
2199
|
);
|
|
2194
|
-
this.#t = y(t, this.#k(), n,
|
|
2200
|
+
this.#t = y(t, this.#k(), n, O), this.#u = t.getUniformLocation(this.#t, "progress"), this.#T = t.getUniformLocation(this.#t, "paletteTexture"), this.#b = t.getUniformLocation(this.#t, "paletteMetricTexture"), this.#R = t.getUniformLocation(this.#t, "uPaletteSize"), this.metricPaletteDirty = !0, this.#A = !0;
|
|
2195
2201
|
}
|
|
2196
2202
|
#x() {
|
|
2197
2203
|
const t = this.glContext;
|
|
2198
|
-
this.#g = y(t, {}, it,
|
|
2204
|
+
this.#g = y(t, {}, it, O), this.#C = t.getUniformLocation(this.#g, "colorMap"), this.#y = t.getUniformLocation(this.#g, "outlineWidth"), this.#S = t.getUniformLocation(this.#g, "resolution"), this.#s = t.createTexture(), this.#e = t.createFramebuffer(), this.#L(this.canvas.width, this.canvas.height);
|
|
2199
2205
|
}
|
|
2200
2206
|
#L(t, n) {
|
|
2201
2207
|
const e = this.glContext;
|
|
@@ -2216,7 +2222,7 @@ class Xt extends lt {
|
|
|
2216
2222
|
renderFrame() {
|
|
2217
2223
|
this.#r && (this.#E(), this.#r = !1);
|
|
2218
2224
|
const t = this.glContext;
|
|
2219
|
-
t.bindFramebuffer(t.FRAMEBUFFER, this.#e), t.useProgram(this.#t), this.uploadMetricPalette(this.#R), t.uniform1f(this.#u, this.#d), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.paletteTexture), t.uniform1i(this.#T, 0), t.activeTexture(t.TEXTURE1), t.bindTexture(t.TEXTURE_2D, this.metricTexture), t.uniform1i(this.#b, 1), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.bindVertexArray(this.#a), t.drawArrays(t.TRIANGLE_STRIP, 0, 4), t.bindFramebuffer(t.FRAMEBUFFER, null), t.useProgram(this.#g), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.#s), t.uniform1i(this.#C, 0), t.uniform1f(this.#y, this.#_ ? 0 : this.#v), t.uniform2f(this.#
|
|
2225
|
+
t.bindFramebuffer(t.FRAMEBUFFER, this.#e), t.useProgram(this.#t), this.uploadMetricPalette(this.#R), t.uniform1f(this.#u, this.#d), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.paletteTexture), t.uniform1i(this.#T, 0), t.activeTexture(t.TEXTURE1), t.bindTexture(t.TEXTURE_2D, this.metricTexture), t.uniform1i(this.#b, 1), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.bindVertexArray(this.#a), t.drawArrays(t.TRIANGLE_STRIP, 0, 4), t.bindFramebuffer(t.FRAMEBUFFER, null), t.useProgram(this.#g), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.#s), t.uniform1i(this.#C, 0), t.uniform1f(this.#y, this.#_ ? 0 : this.#v), t.uniform2f(this.#S, this.canvas.width, this.canvas.height), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLE_STRIP, 0, 4), t.bindVertexArray(null);
|
|
2220
2226
|
}
|
|
2221
2227
|
// ── Public API ──────────────────────────────────────────────────────────────
|
|
2222
2228
|
destroy() {
|
|
@@ -2228,10 +2234,10 @@ class Xt extends lt {
|
|
|
2228
2234
|
setColor(t, n) {
|
|
2229
2235
|
if (n < 0 || n >= this.paletteState.length)
|
|
2230
2236
|
throw new Error(`Index ${n} out of range`);
|
|
2231
|
-
this.paletteState[n] = t,
|
|
2237
|
+
this.paletteState[n] = t, S(this.glContext, this.paletteTexture, this.paletteState), this.metricPaletteDirty = !0, this.schedulePaint();
|
|
2232
2238
|
}
|
|
2233
2239
|
addColor(t, n) {
|
|
2234
|
-
this.paletteState.splice(n ?? this.paletteState.length, 0, t),
|
|
2240
|
+
this.paletteState.splice(n ?? this.paletteState.length, 0, t), S(this.glContext, this.paletteTexture, this.paletteState), this.metricPaletteDirty = !0, this.schedulePaint();
|
|
2235
2241
|
}
|
|
2236
2242
|
removeColor(t) {
|
|
2237
2243
|
const n = typeof t == "number" ? t : this.paletteState.findIndex(
|
|
@@ -2241,7 +2247,7 @@ class Xt extends lt {
|
|
|
2241
2247
|
if (n < 0 || n >= this.paletteState.length)
|
|
2242
2248
|
throw new Error(`Index ${n} out of range`);
|
|
2243
2249
|
if (this.paletteState.length === 1) throw new Error("Palette must contain at least one color");
|
|
2244
|
-
this.paletteState.splice(n, 1),
|
|
2250
|
+
this.paletteState.splice(n, 1), S(this.glContext, this.paletteTexture, this.paletteState), this.metricPaletteDirty = !0, this.schedulePaint();
|
|
2245
2251
|
}
|
|
2246
2252
|
getColorAtUV(t, n) {
|
|
2247
2253
|
if (!Number.isFinite(t) || !Number.isFinite(n))
|
|
@@ -2279,13 +2285,13 @@ class Xt extends lt {
|
|
|
2279
2285
|
this.#_,
|
|
2280
2286
|
!0
|
|
2281
2287
|
);
|
|
2282
|
-
this.#h = y(e, s, i,
|
|
2288
|
+
this.#h = y(e, s, i, O), this.#I = e.getUniformLocation(this.#h, "progress"), this.#D = e.getUniformLocation(this.#h, "paletteTexture"), this.#O = e.getUniformLocation(
|
|
2283
2289
|
this.#h,
|
|
2284
2290
|
"paletteMetricTexture"
|
|
2285
2291
|
), this.#P = e.getUniformLocation(this.#h, "uPaletteSize"), this.#w = e.getUniformLocation(this.#h, "uvOverride"), this.#A = !1;
|
|
2286
2292
|
}
|
|
2287
2293
|
const a = e.getParameter(e.VIEWPORT);
|
|
2288
|
-
e.bindFramebuffer(e.FRAMEBUFFER, this.#m), e.viewport(0, 0, 1, 1), e.useProgram(this.#h), e.uniform2f(this.#w, t, n), e.uniform1f(this.#I, this.#d), e.uniform1i(this.#P, this.paletteState.length), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this.paletteTexture), e.uniform1i(this.#D, 0), e.activeTexture(e.TEXTURE1), e.bindTexture(e.TEXTURE_2D, this.metricTexture), e.uniform1i(this.#
|
|
2294
|
+
e.bindFramebuffer(e.FRAMEBUFFER, this.#m), e.viewport(0, 0, 1, 1), e.useProgram(this.#h), e.uniform2f(this.#w, t, n), e.uniform1f(this.#I, this.#d), e.uniform1i(this.#P, this.paletteState.length), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, this.paletteTexture), e.uniform1i(this.#D, 0), e.activeTexture(e.TEXTURE1), e.bindTexture(e.TEXTURE_2D, this.metricTexture), e.uniform1i(this.#O, 1), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.bindVertexArray(this.#a), e.drawArrays(e.TRIANGLE_STRIP, 0, 4), e.flush();
|
|
2289
2295
|
const o = new Float32Array(4);
|
|
2290
2296
|
return e.readPixels(0, 0, 1, 1, e.RGBA, e.FLOAT, o), e.bindFramebuffer(e.FRAMEBUFFER, null), e.bindVertexArray(null), e.viewport(a[0], a[1], a[2], a[3]), [o[0], o[1], o[2]];
|
|
2291
2297
|
}
|
|
@@ -2346,7 +2352,7 @@ class Xt extends lt {
|
|
|
2346
2352
|
/** @deprecated use PaletteViz.paletteToRGBA */
|
|
2347
2353
|
static paletteToTexture = D;
|
|
2348
2354
|
}
|
|
2349
|
-
function
|
|
2355
|
+
function St(r) {
|
|
2350
2356
|
const t = [], n = [], e = r, a = [
|
|
2351
2357
|
// axisIndex, sign, uAxis, vAxis, uSign, vSign
|
|
2352
2358
|
// +X face
|
|
@@ -2377,7 +2383,7 @@ function Ot(r) {
|
|
|
2377
2383
|
}
|
|
2378
2384
|
return { vertices: new Float32Array(t), indices: new Uint32Array(n) };
|
|
2379
2385
|
}
|
|
2380
|
-
function
|
|
2386
|
+
function Ot(r, t, n = 0) {
|
|
2381
2387
|
const e = [], a = [], o = r, s = -n, l = 1 + n - s;
|
|
2382
2388
|
for (let _ = t; _ >= 0; _--) {
|
|
2383
2389
|
const b = s + l * _ / t, C = e.length / 3;
|
|
@@ -2547,13 +2553,13 @@ class Ht extends lt {
|
|
|
2547
2553
|
#g = 0;
|
|
2548
2554
|
#C = null;
|
|
2549
2555
|
#y = null;
|
|
2550
|
-
#
|
|
2556
|
+
#S = null;
|
|
2551
2557
|
#m = null;
|
|
2552
2558
|
#p = null;
|
|
2553
2559
|
#h = null;
|
|
2554
2560
|
#I = null;
|
|
2555
2561
|
#D = null;
|
|
2556
|
-
#
|
|
2562
|
+
#O = null;
|
|
2557
2563
|
#P = null;
|
|
2558
2564
|
#w = null;
|
|
2559
2565
|
#A = null;
|
|
@@ -2602,7 +2608,7 @@ class Ht extends lt {
|
|
|
2602
2608
|
return;
|
|
2603
2609
|
}
|
|
2604
2610
|
this.#s = this.#n ? this.#U() : 0;
|
|
2605
|
-
const { vertices: n, indices: e } = this.#n ?
|
|
2611
|
+
const { vertices: n, indices: e } = this.#n ? Ot(2, this.#s, Y) : St(64);
|
|
2606
2612
|
this.#T = e.length, this.#r = t.createBuffer(), t.bindBuffer(t.ARRAY_BUFFER, this.#r), t.bufferData(t.ARRAY_BUFFER, n, t.STATIC_DRAW), this.#u = t.createBuffer(), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.#u), t.bufferData(t.ELEMENT_ARRAY_BUFFER, e, t.STATIC_DRAW), this.#a = t.createVertexArray(), t.bindVertexArray(this.#a), t.bindBuffer(t.ARRAY_BUFFER, this.#r), t.enableVertexAttribArray(0), t.vertexAttribPointer(0, 3, t.FLOAT, !1, 0, 0), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this.#u), t.bindVertexArray(null);
|
|
2607
2613
|
}
|
|
2608
2614
|
#U() {
|
|
@@ -2667,7 +2673,7 @@ class Ht extends lt {
|
|
|
2667
2673
|
E[this.#o],
|
|
2668
2674
|
this.#n
|
|
2669
2675
|
), a = this.#e ? xt : Et;
|
|
2670
|
-
this.#t = y(t, this.#J(), n, a), this.#l = y(t, this.#J(), e, a), this.#y = t.getUniformLocation(this.#t, "uMVP"), this.#
|
|
2676
|
+
this.#t = y(t, this.#J(), n, a), this.#l = y(t, this.#J(), e, a), this.#y = t.getUniformLocation(this.#t, "uMVP"), this.#S = t.getUniformLocation(this.#l, "uMVP"), this.#m = t.getUniformLocation(this.#t, "uPosition"), this.#p = t.getUniformLocation(this.#l, "uPosition"), this.#h = t.getUniformLocation(this.#t, "paletteTexture"), this.#I = t.getUniformLocation(this.#t, "paletteMetricTexture"), this.#D = t.getUniformLocation(this.#t, "uPaletteSize"), this.#O = t.getUniformLocation(this.#t, "uColorRotation"), this.#P = t.getUniformLocation(this.#l, "uColorRotation"), this.#w = t.getUniformLocation(this.#t, "uSliceOffset"), this.#A = t.getUniformLocation(this.#l, "uSliceOffset"), this.metricPaletteDirty = !0;
|
|
2671
2677
|
}
|
|
2672
2678
|
#G(t, n, e, a) {
|
|
2673
2679
|
const o = this.glContext;
|
|
@@ -2678,7 +2684,7 @@ class Ht extends lt {
|
|
|
2678
2684
|
}
|
|
2679
2685
|
#Q() {
|
|
2680
2686
|
const t = this.glContext;
|
|
2681
|
-
this.#x = t.createTexture(), this.#L = t.createRenderbuffer(), this.#E = t.createFramebuffer(), this.#K(this.canvas.width, this.canvas.height), this.#B = t.createBuffer(), t.bindBuffer(t.ARRAY_BUFFER, this.#B), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), t.STATIC_DRAW), this.#F = t.createVertexArray(), t.bindVertexArray(this.#F), t.enableVertexAttribArray(0), t.vertexAttribPointer(0, 2, t.FLOAT, !1, 0, 0), t.bindVertexArray(null), this.#M = y(t, {}, it,
|
|
2687
|
+
this.#x = t.createTexture(), this.#L = t.createRenderbuffer(), this.#E = t.createFramebuffer(), this.#K(this.canvas.width, this.canvas.height), this.#B = t.createBuffer(), t.bindBuffer(t.ARRAY_BUFFER, this.#B), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), t.STATIC_DRAW), this.#F = t.createVertexArray(), t.bindVertexArray(this.#F), t.enableVertexAttribArray(0), t.vertexAttribPointer(0, 2, t.FLOAT, !1, 0, 0), t.bindVertexArray(null), this.#M = y(t, {}, it, O), this.#X = t.getUniformLocation(this.#M, "colorMap"), this.#H = t.getUniformLocation(this.#M, "outlineWidth"), this.#V = t.getUniformLocation(this.#M, "resolution");
|
|
2682
2688
|
}
|
|
2683
2689
|
#K(t, n) {
|
|
2684
2690
|
const e = this.glContext;
|
|
@@ -2715,20 +2721,20 @@ class Ht extends lt {
|
|
|
2715
2721
|
const t = this.glContext;
|
|
2716
2722
|
t.bindFramebuffer(t.FRAMEBUFFER, this.#E), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT | t.DEPTH_BUFFER_BIT), (this.#n || this.#e) && (t.colorMask(!1, !1, !1, !1), this.#n ? this.#Y(
|
|
2717
2723
|
this.#l,
|
|
2718
|
-
this.#
|
|
2724
|
+
this.#S,
|
|
2719
2725
|
this.#p,
|
|
2720
2726
|
this.#P,
|
|
2721
2727
|
this.#A
|
|
2722
2728
|
) : (this.#G(
|
|
2723
2729
|
this.#l,
|
|
2724
|
-
this.#
|
|
2730
|
+
this.#S,
|
|
2725
2731
|
this.#p,
|
|
2726
2732
|
this.#P
|
|
2727
|
-
), t.bindVertexArray(this.#a), t.drawElements(t.TRIANGLES, this.#T, t.UNSIGNED_INT, 0), t.bindVertexArray(null)), t.colorMask(!0, !0, !0, !0), t.clear(t.COLOR_BUFFER_BIT), t.depthFunc(t.EQUAL), t.depthMask(!1)), this.#n ? t.useProgram(this.#t) : this.#G(this.#t, this.#y, this.#m, this.#
|
|
2733
|
+
), t.bindVertexArray(this.#a), t.drawElements(t.TRIANGLES, this.#T, t.UNSIGNED_INT, 0), t.bindVertexArray(null)), t.colorMask(!0, !0, !0, !0), t.clear(t.COLOR_BUFFER_BIT), t.depthFunc(t.EQUAL), t.depthMask(!1)), this.#n ? t.useProgram(this.#t) : this.#G(this.#t, this.#y, this.#m, this.#O), this.uploadMetricPalette(this.#D), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.paletteTexture), t.uniform1i(this.#h, 0), t.activeTexture(t.TEXTURE1), t.bindTexture(t.TEXTURE_2D, this.metricTexture), t.uniform1i(this.#I, 1), this.#n ? this.#Y(
|
|
2728
2734
|
this.#t,
|
|
2729
2735
|
this.#y,
|
|
2730
2736
|
this.#m,
|
|
2731
|
-
this.#
|
|
2737
|
+
this.#O,
|
|
2732
2738
|
this.#w
|
|
2733
2739
|
) : (t.bindVertexArray(this.#a), t.drawElements(t.TRIANGLES, this.#T, t.UNSIGNED_INT, 0), t.bindVertexArray(null)), (this.#n || this.#e) && (t.depthMask(!0), t.depthFunc(t.LESS)), t.bindFramebuffer(t.FRAMEBUFFER, null), t.disable(t.DEPTH_TEST), t.useProgram(this.#M), t.activeTexture(t.TEXTURE0), t.bindTexture(t.TEXTURE_2D, this.#x), t.uniform1i(this.#X, 0), t.uniform1f(this.#H, this.#_ ? 0 : this.#v), t.uniform2f(this.#V, this.canvas.width, this.canvas.height), t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.bindVertexArray(this.#F), t.drawArrays(t.TRIANGLE_STRIP, 0, 4), t.bindVertexArray(null), t.enable(t.DEPTH_TEST);
|
|
2734
2740
|
}
|