wuepgg3-track 3.0.4 → 4.0.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/dist/{SharedSystems-D2-L-AEG.mjs → SharedSystems-C25A8QWM.mjs} +675 -433
- package/dist/{WebGLRenderer-0nbxwc6U.mjs → WebGLRenderer-5GDaDku_.mjs} +417 -382
- package/dist/{WebGPURenderer-DWuXep8H.mjs → WebGPURenderer-DPF_CZ2D.mjs} +277 -258
- package/dist/{browserAll-C-dLabXl.mjs → browserAll-BNzjEqpL.mjs} +2 -2
- package/dist/{colorToUniform-DQmiMhES.mjs → colorToUniform-C6ntO3i9.mjs} +9 -8
- package/dist/components/GenomeView/TrackComponents/DynseqComponents/DynseqTrackComponents.d.ts +3 -4
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/GenomeAlignComponents.d.ts +3 -1
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/HorizontalFragment.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/MultiAlignmentViewCalculator.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/GroupedTrackManager.d.ts +3 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/DynamicInteractionTrackComponents.d.ts +59 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/InteractionTrackComponent.d.ts +6 -16
- package/dist/components/GenomeView/TrackComponents/MethylcComponents/MethylCTrackComputation.d.ts +6 -14
- package/dist/components/GenomeView/TrackComponents/QBedComponents/QBedTrackComponents.d.ts +10 -27
- package/dist/components/GenomeView/TrackComponents/RulerComponents/RulerComponent.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/VcfComponents/Vcf.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfTrack.d.ts +6 -25
- package/dist/components/GenomeView/TrackComponents/bedComponents/DynamicBedTrackComponents.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/FiberTrackComponent.d.ts +5 -40
- package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/HoverToolTip.d.ts +5 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/OutsideClickDetector.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicNumericalTrack.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicplotTrackComponent.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/MatplotTrackComponent.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalAggregator.d.ts +2 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalTrack.d.ts +3 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/stats/BoxplotTrackComponents.d.ts +4 -38
- package/dist/components/GenomeView/TrackComponents/displayModeComponentMap.d.ts +1 -1
- package/dist/genome-hub/GenomeSerializer.d.ts +1 -1
- package/dist/genome-hub/genome-schema.d.ts +1 -2
- package/dist/getLocalData/LocalBigSource.d.ts +47 -0
- package/dist/getRemoteData/BigSourceWorker.d.ts +47 -0
- package/dist/getRemoteData/BigSourceWorkerGmod.d.ts +10 -0
- package/dist/getRemoteData/VcfSource.d.ts +9 -0
- package/dist/getRemoteData/tabixSource.d.ts +18 -0
- package/dist/getRemoteData/vendor/bbi-js/main/bigwig.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/bin.d.ts +20 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/das.d.ts +6 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/jszlib.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/sha1.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/spans.d.ts +13 -0
- package/dist/{index-DryYmDPe.mjs → index-BjfzAHgP.mjs} +63585 -64977
- package/dist/index.es.js +11 -11
- package/dist/index.umd.js +243 -231
- package/dist/{init-D8gtYsaQ.mjs → init-B9EV4EW9.mjs} +370 -355
- package/dist/models/FeatureAggregator.d.ts +3 -4
- package/dist/models/FeatureArranger.d.ts +7 -1
- package/dist/models/NavigationContext.d.ts +1 -0
- package/dist/models/TrackModel.d.ts +2 -0
- package/dist/models/genomes/allGenomes.d.ts +20 -0
- package/dist/models/genomes/mCalJa1.2.pat.X/mCalJa1.2.pat.X.d.ts +17 -0
- package/dist/models/getXSpan/FeaturePlacer.d.ts +2 -9
- package/dist/models/trackModels/trackProps.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/track-container/index.d.ts +1 -1
- package/dist/trackConfigs/config-menu-components.tsx/ColorConfig.d.ts +1 -0
- package/dist/trackConfigs/config-menu-components.tsx/DownsamplingConfig.d.ts +8 -0
- package/dist/types/track-container.d.ts +5 -0
- package/dist/webworkerAll-DBeEkdnk.mjs +2 -0
- package/package.json +2 -4
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/createNewTrackState.d.ts +0 -18
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getDataAfterConfigChange.d.ts +0 -11
- package/dist/components/testCustomGenome.d.ts +0 -505
- package/dist/webworkerAll-BYF_bwOo.mjs +0 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as d, B, w as m, D as S,
|
|
2
|
-
import { S as
|
|
3
|
-
import { e as
|
|
4
|
-
class
|
|
1
|
+
import { E as d, c as U, B, w as m, D as S, L as $, a as Ae, S as F, v as b, a6 as Ne, m as z, a7 as ye, d as p, Q as H, l as A, k as N, n as O, M as Y, a8 as q, a9 as Ce, aa as De, ab as Z, ac as Ie, A as Ge, R as Ue, e as v } from "./index-BjfzAHgP.mjs";
|
|
2
|
+
import { S as P, b as Q } from "./colorToUniform-C6ntO3i9.mjs";
|
|
3
|
+
import { e as Fe, G as Oe, c as Pe, b as Me, U as Le, R as we, B as J, d as y, f as He, S as ke, a as Ve } from "./SharedSystems-C25A8QWM.mjs";
|
|
4
|
+
class ee {
|
|
5
5
|
constructor() {
|
|
6
|
-
this._tempState =
|
|
6
|
+
this._tempState = P.for2d(), this._didUploadHash = {};
|
|
7
7
|
}
|
|
8
8
|
init(e) {
|
|
9
9
|
e.renderer.runners.contextChange.add(this);
|
|
@@ -24,35 +24,43 @@ class Q {
|
|
|
24
24
|
s.geometry.draw(r.topology, r.size, r.start);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
ee.extension = {
|
|
28
28
|
type: [
|
|
29
29
|
d.WebGLPipesAdaptor
|
|
30
30
|
],
|
|
31
31
|
name: "batch"
|
|
32
32
|
};
|
|
33
33
|
var x = /* @__PURE__ */ ((t) => (t[t.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER", t[t.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", t[t.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER", t))(x || {});
|
|
34
|
-
class
|
|
34
|
+
class Xe {
|
|
35
35
|
constructor(e, r) {
|
|
36
36
|
this._lastBindBaseLocation = -1, this._lastBindCallId = -1, this.buffer = e || null, this.updateID = -1, this.byteLength = -1, this.type = r;
|
|
37
37
|
}
|
|
38
|
+
destroy() {
|
|
39
|
+
this.buffer = null, this.updateID = -1, this.byteLength = -1, this.type = -1, this._lastBindBaseLocation = -1, this._lastBindCallId = -1;
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
|
-
class
|
|
42
|
+
class te {
|
|
40
43
|
/**
|
|
41
44
|
* @param {Renderer} renderer - The renderer this System works for.
|
|
42
45
|
*/
|
|
43
46
|
constructor(e) {
|
|
44
|
-
this.
|
|
47
|
+
this._boundBufferBases = /* @__PURE__ */ Object.create(null), this._minBaseLocation = 0, this._nextBindBaseIndex = this._minBaseLocation, this._bindCallId = 0, this._renderer = e, this._managedBuffers = new U({
|
|
48
|
+
renderer: e,
|
|
49
|
+
type: "resource",
|
|
50
|
+
onUnload: this.onBufferUnload.bind(this),
|
|
51
|
+
name: "glBuffer"
|
|
52
|
+
});
|
|
45
53
|
}
|
|
46
54
|
/** @ignore */
|
|
47
55
|
destroy() {
|
|
48
|
-
this.
|
|
56
|
+
this._managedBuffers.destroy(), this._renderer = null, this._gl = null, this._boundBufferBases = {};
|
|
49
57
|
}
|
|
50
58
|
/** Sets up the renderer context and necessary buffers. */
|
|
51
59
|
contextChange() {
|
|
52
|
-
this._gl = this._renderer.gl, this.
|
|
60
|
+
this._gl = this._renderer.gl, this.destroyAll(!0), this._maxBindings = this._renderer.limits.maxUniformBindings;
|
|
53
61
|
}
|
|
54
62
|
getGlBuffer(e) {
|
|
55
|
-
return this.
|
|
63
|
+
return e._gcLastUsed = this._renderer.gc.now, e._gpuData[this._renderer.uid] || this.createGLBuffer(e);
|
|
56
64
|
}
|
|
57
65
|
/**
|
|
58
66
|
* This binds specified buffer. On first run, it will create the webGL buffers for the context too
|
|
@@ -120,23 +128,16 @@ class ee {
|
|
|
120
128
|
const n = e.data, i = e.descriptor.usage & B.STATIC ? r.STATIC_DRAW : r.DYNAMIC_DRAW;
|
|
121
129
|
return n ? s.byteLength >= n.byteLength ? r.bufferSubData(s.type, 0, n, 0, e._updateSize / n.BYTES_PER_ELEMENT) : (s.byteLength = n.byteLength, r.bufferData(s.type, n, i)) : (s.byteLength = e.descriptor.size, r.bufferData(s.type, s.byteLength, i)), s;
|
|
122
130
|
}
|
|
123
|
-
/** dispose all WebGL resources of all managed buffers */
|
|
124
|
-
destroyAll() {
|
|
125
|
-
const e = this._gl;
|
|
126
|
-
for (const r in this._gpuBuffers)
|
|
127
|
-
this._gpuBuffers[r] && e.deleteBuffer(this._gpuBuffers[r].buffer);
|
|
128
|
-
this._gpuBuffers = /* @__PURE__ */ Object.create(null);
|
|
129
|
-
}
|
|
130
131
|
/**
|
|
131
|
-
*
|
|
132
|
-
* @param
|
|
133
|
-
* @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray
|
|
132
|
+
* dispose all WebGL resources of all managed buffers
|
|
133
|
+
* @param contextLost
|
|
134
134
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
destroyAll(e = !1) {
|
|
136
|
+
this._managedBuffers.removeAll(e);
|
|
137
|
+
}
|
|
138
|
+
onBufferUnload(e, r = !1) {
|
|
139
|
+
const s = e._gpuData[this._renderer.uid];
|
|
140
|
+
s && (r || this._gl.deleteBuffer(s.buffer));
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
142
143
|
* creates and attaches a GLBuffer object tied to the current context.
|
|
@@ -147,20 +148,20 @@ class ee {
|
|
|
147
148
|
const { _gl: r } = this;
|
|
148
149
|
let s = x.ARRAY_BUFFER;
|
|
149
150
|
e.descriptor.usage & B.INDEX ? s = x.ELEMENT_ARRAY_BUFFER : e.descriptor.usage & B.UNIFORM && (s = x.UNIFORM_BUFFER);
|
|
150
|
-
const n = new
|
|
151
|
-
return
|
|
151
|
+
const n = new Xe(r.createBuffer(), s);
|
|
152
|
+
return e._gpuData[this._renderer.uid] = n, this._managedBuffers.add(e), n;
|
|
152
153
|
}
|
|
153
154
|
resetState() {
|
|
154
155
|
this._boundBufferBases = /* @__PURE__ */ Object.create(null);
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
|
|
158
|
+
te.extension = {
|
|
158
159
|
type: [
|
|
159
160
|
d.WebGLSystem
|
|
160
161
|
],
|
|
161
162
|
name: "buffer"
|
|
162
163
|
};
|
|
163
|
-
const
|
|
164
|
+
const M = class re {
|
|
164
165
|
/** @param renderer - The renderer this System works for. */
|
|
165
166
|
constructor(e) {
|
|
166
167
|
this.supports = {
|
|
@@ -195,7 +196,7 @@ const P = class te {
|
|
|
195
196
|
this.gl = e, this._renderer.gl = e;
|
|
196
197
|
}
|
|
197
198
|
init(e) {
|
|
198
|
-
e = { ...
|
|
199
|
+
e = { ...re.defaultOptions, ...e };
|
|
199
200
|
let r = this.multiView = e.multiView;
|
|
200
201
|
if (e.context && r && (m("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."), r = !1), r ? this.canvas = S.get().createCanvas(this._renderer.canvas.width, this._renderer.canvas.height) : this.canvas = this._renderer.view.canvas, e.context)
|
|
201
202
|
this.initFromContext(e.context);
|
|
@@ -325,13 +326,13 @@ const P = class te {
|
|
|
325
326
|
s.uint32Indices = n || !!i.uint32ElementIndex, s.uniformBufferObject = n, s.vertexArrayObject = n || !!i.vertexArrayObject, s.srgbTextures = n || !!i.srgb, s.nonPowOf2wrapping = n, s.nonPowOf2mipmaps = n, s.msaa = n, s.uint32Indices || m("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly");
|
|
326
327
|
}
|
|
327
328
|
};
|
|
328
|
-
|
|
329
|
+
M.extension = {
|
|
329
330
|
type: [
|
|
330
331
|
d.WebGLSystem
|
|
331
332
|
],
|
|
332
333
|
name: "context"
|
|
333
334
|
};
|
|
334
|
-
|
|
335
|
+
M.defaultOptions = {
|
|
335
336
|
/**
|
|
336
337
|
* {@link WebGLOptions.context}
|
|
337
338
|
* @default null
|
|
@@ -363,68 +364,82 @@ P.defaultOptions = {
|
|
|
363
364
|
*/
|
|
364
365
|
multiView: !1
|
|
365
366
|
};
|
|
366
|
-
let
|
|
367
|
-
var I = /* @__PURE__ */ ((t) => (t[t.RGBA = 6408] = "RGBA", t[t.RGB = 6407] = "RGB", t[t.RG = 33319] = "RG", t[t.RED = 6403] = "RED", t[t.RGBA_INTEGER = 36249] = "RGBA_INTEGER", t[t.RGB_INTEGER = 36248] = "RGB_INTEGER", t[t.RG_INTEGER = 33320] = "RG_INTEGER", t[t.RED_INTEGER = 36244] = "RED_INTEGER", t[t.ALPHA = 6406] = "ALPHA", t[t.LUMINANCE = 6409] = "LUMINANCE", t[t.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", t[t.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", t[t.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", t))(I || {}),
|
|
368
|
-
const
|
|
369
|
-
uint8x2:
|
|
370
|
-
uint8x4:
|
|
371
|
-
sint8x2:
|
|
372
|
-
sint8x4:
|
|
373
|
-
unorm8x2:
|
|
374
|
-
unorm8x4:
|
|
375
|
-
snorm8x2:
|
|
376
|
-
snorm8x4:
|
|
377
|
-
uint16x2:
|
|
378
|
-
uint16x4:
|
|
379
|
-
sint16x2:
|
|
380
|
-
sint16x4:
|
|
381
|
-
unorm16x2:
|
|
382
|
-
unorm16x4:
|
|
383
|
-
snorm16x2:
|
|
384
|
-
snorm16x4:
|
|
385
|
-
float16x2:
|
|
386
|
-
float16x4:
|
|
387
|
-
float32:
|
|
388
|
-
float32x2:
|
|
389
|
-
float32x3:
|
|
390
|
-
float32x4:
|
|
391
|
-
uint32:
|
|
392
|
-
uint32x2:
|
|
393
|
-
uint32x3:
|
|
394
|
-
uint32x4:
|
|
395
|
-
sint32:
|
|
396
|
-
sint32x2:
|
|
397
|
-
sint32x3:
|
|
398
|
-
sint32x4:
|
|
367
|
+
let We = M;
|
|
368
|
+
var I = /* @__PURE__ */ ((t) => (t[t.RGBA = 6408] = "RGBA", t[t.RGB = 6407] = "RGB", t[t.RG = 33319] = "RG", t[t.RED = 6403] = "RED", t[t.RGBA_INTEGER = 36249] = "RGBA_INTEGER", t[t.RGB_INTEGER = 36248] = "RGB_INTEGER", t[t.RG_INTEGER = 33320] = "RG_INTEGER", t[t.RED_INTEGER = 36244] = "RED_INTEGER", t[t.ALPHA = 6406] = "ALPHA", t[t.LUMINANCE = 6409] = "LUMINANCE", t[t.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", t[t.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", t[t.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", t))(I || {}), se = /* @__PURE__ */ ((t) => (t[t.TEXTURE_2D = 3553] = "TEXTURE_2D", t[t.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP", t[t.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY", t[t.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X", t[t.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X", t[t.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y", t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y", t[t.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z", t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z", t))(se || {}), f = /* @__PURE__ */ ((t) => (t[t.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", t[t.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", t[t.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5", t[t.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4", t[t.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1", t[t.UNSIGNED_INT = 5125] = "UNSIGNED_INT", t[t.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV", t[t.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV", t[t.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8", t[t.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV", t[t.BYTE = 5120] = "BYTE", t[t.SHORT = 5122] = "SHORT", t[t.INT = 5124] = "INT", t[t.FLOAT = 5126] = "FLOAT", t[t.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV", t[t.HALF_FLOAT = 36193] = "HALF_FLOAT", t))(f || {});
|
|
369
|
+
const k = {
|
|
370
|
+
uint8x2: f.UNSIGNED_BYTE,
|
|
371
|
+
uint8x4: f.UNSIGNED_BYTE,
|
|
372
|
+
sint8x2: f.BYTE,
|
|
373
|
+
sint8x4: f.BYTE,
|
|
374
|
+
unorm8x2: f.UNSIGNED_BYTE,
|
|
375
|
+
unorm8x4: f.UNSIGNED_BYTE,
|
|
376
|
+
snorm8x2: f.BYTE,
|
|
377
|
+
snorm8x4: f.BYTE,
|
|
378
|
+
uint16x2: f.UNSIGNED_SHORT,
|
|
379
|
+
uint16x4: f.UNSIGNED_SHORT,
|
|
380
|
+
sint16x2: f.SHORT,
|
|
381
|
+
sint16x4: f.SHORT,
|
|
382
|
+
unorm16x2: f.UNSIGNED_SHORT,
|
|
383
|
+
unorm16x4: f.UNSIGNED_SHORT,
|
|
384
|
+
snorm16x2: f.SHORT,
|
|
385
|
+
snorm16x4: f.SHORT,
|
|
386
|
+
float16x2: f.HALF_FLOAT,
|
|
387
|
+
float16x4: f.HALF_FLOAT,
|
|
388
|
+
float32: f.FLOAT,
|
|
389
|
+
float32x2: f.FLOAT,
|
|
390
|
+
float32x3: f.FLOAT,
|
|
391
|
+
float32x4: f.FLOAT,
|
|
392
|
+
uint32: f.UNSIGNED_INT,
|
|
393
|
+
uint32x2: f.UNSIGNED_INT,
|
|
394
|
+
uint32x3: f.UNSIGNED_INT,
|
|
395
|
+
uint32x4: f.UNSIGNED_INT,
|
|
396
|
+
sint32: f.INT,
|
|
397
|
+
sint32x2: f.INT,
|
|
398
|
+
sint32x3: f.INT,
|
|
399
|
+
sint32x4: f.INT
|
|
399
400
|
};
|
|
400
|
-
function
|
|
401
|
-
return
|
|
401
|
+
function je(t) {
|
|
402
|
+
return k[t] ?? k.float32;
|
|
402
403
|
}
|
|
403
|
-
const
|
|
404
|
+
const Ke = {
|
|
404
405
|
"point-list": 0,
|
|
405
406
|
"line-list": 1,
|
|
406
407
|
"line-strip": 3,
|
|
407
408
|
"triangle-list": 4,
|
|
408
409
|
"triangle-strip": 5
|
|
409
410
|
};
|
|
410
|
-
class
|
|
411
|
+
class $e {
|
|
412
|
+
constructor() {
|
|
413
|
+
this.vaoCache = /* @__PURE__ */ Object.create(null);
|
|
414
|
+
}
|
|
415
|
+
destroy() {
|
|
416
|
+
this.vaoCache = /* @__PURE__ */ Object.create(null);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
class ne {
|
|
411
420
|
/** @param renderer - The renderer this System works for. */
|
|
412
421
|
constructor(e) {
|
|
413
|
-
this.
|
|
422
|
+
this._renderer = e, this._activeGeometry = null, this._activeVao = null, this.hasVao = !0, this.hasInstance = !0, this._managedGeometries = new U({
|
|
423
|
+
renderer: e,
|
|
424
|
+
type: "resource",
|
|
425
|
+
onUnload: this.onGeometryUnload.bind(this),
|
|
426
|
+
name: "glGeometry"
|
|
427
|
+
});
|
|
414
428
|
}
|
|
415
429
|
/** Sets up the renderer context and necessary buffers. */
|
|
416
430
|
contextChange() {
|
|
417
431
|
const e = this.gl = this._renderer.gl;
|
|
418
432
|
if (!this._renderer.context.supports.vertexArrayObject)
|
|
419
433
|
throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");
|
|
434
|
+
this.destroyAll(!0);
|
|
420
435
|
const r = this._renderer.context.extensions.vertexArrayObject;
|
|
421
436
|
r && (e.createVertexArray = () => r.createVertexArrayOES(), e.bindVertexArray = (n) => r.bindVertexArrayOES(n), e.deleteVertexArray = (n) => r.deleteVertexArrayOES(n));
|
|
422
437
|
const s = this._renderer.context.extensions.vertexAttribDivisorANGLE;
|
|
423
438
|
s && (e.drawArraysInstanced = (n, i, a, o) => {
|
|
424
439
|
s.drawArraysInstancedANGLE(n, i, a, o);
|
|
425
|
-
}, e.drawElementsInstanced = (n, i, a, o,
|
|
426
|
-
s.drawElementsInstancedANGLE(n, i, a, o,
|
|
427
|
-
}, e.vertexAttribDivisor = (n, i) => s.vertexAttribDivisorANGLE(n, i)), this._activeGeometry = null, this._activeVao = null
|
|
440
|
+
}, e.drawElementsInstanced = (n, i, a, o, u) => {
|
|
441
|
+
s.drawElementsInstancedANGLE(n, i, a, o, u);
|
|
442
|
+
}, e.vertexAttribDivisor = (n, i) => s.vertexAttribDivisorANGLE(n, i)), this._activeGeometry = null, this._activeVao = null;
|
|
428
443
|
}
|
|
429
444
|
/**
|
|
430
445
|
* Binds geometry so that is can be drawn. Creating a Vao if required
|
|
@@ -448,6 +463,7 @@ class se {
|
|
|
448
463
|
const n = e.buffers[s];
|
|
449
464
|
r.updateBuffer(n);
|
|
450
465
|
}
|
|
466
|
+
e._gcLastUsed = this._renderer.gc.now;
|
|
451
467
|
}
|
|
452
468
|
/**
|
|
453
469
|
* Check compatibility between a geometry and a program
|
|
@@ -474,7 +490,7 @@ class se {
|
|
|
474
490
|
}
|
|
475
491
|
getVao(e, r) {
|
|
476
492
|
var s;
|
|
477
|
-
return ((s =
|
|
493
|
+
return ((s = e._gpuData[this._renderer.uid]) == null ? void 0 : s.vaoCache[r._key]) || this.initGeometryVao(e, r);
|
|
478
494
|
}
|
|
479
495
|
/**
|
|
480
496
|
* Creates or gets Vao with the same structure as the geometry and stores it on the geometry.
|
|
@@ -487,49 +503,36 @@ class se {
|
|
|
487
503
|
initGeometryVao(e, r, s = !0) {
|
|
488
504
|
const n = this._renderer.gl, i = this._renderer.buffer;
|
|
489
505
|
this._renderer.shader._getProgramData(r), this.checkCompatibility(e, r);
|
|
490
|
-
const a = this.getSignature(e, r);
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
let c =
|
|
506
|
+
const a = this.getSignature(e, r), o = new $e();
|
|
507
|
+
e._gpuData[this._renderer.uid] = o, this._managedGeometries.add(e);
|
|
508
|
+
const u = o.vaoCache;
|
|
509
|
+
let c = u[a];
|
|
494
510
|
if (c)
|
|
495
|
-
return
|
|
496
|
-
|
|
497
|
-
const
|
|
511
|
+
return u[r._key] = c, c;
|
|
512
|
+
Fe(e, r._attributeData);
|
|
513
|
+
const _ = e.buffers;
|
|
498
514
|
c = n.createVertexArray(), n.bindVertexArray(c);
|
|
499
|
-
for (let
|
|
500
|
-
const
|
|
501
|
-
i.bind(
|
|
515
|
+
for (let h = 0; h < _.length; h++) {
|
|
516
|
+
const l = _[h];
|
|
517
|
+
i.bind(l);
|
|
502
518
|
}
|
|
503
|
-
return this.activateVao(e, r),
|
|
519
|
+
return this.activateVao(e, r), u[r._key] = c, u[a] = c, n.bindVertexArray(null), c;
|
|
504
520
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (r)
|
|
514
|
-
for (const i in s)
|
|
515
|
-
this._activeVao !== s[i] && this.unbind(), n.deleteVertexArray(s[i]);
|
|
516
|
-
this._geometryVaoHash[e.uid] = null;
|
|
517
|
-
}
|
|
521
|
+
onGeometryUnload(e, r = !1) {
|
|
522
|
+
const s = e._gpuData[this._renderer.uid];
|
|
523
|
+
if (!s)
|
|
524
|
+
return;
|
|
525
|
+
const n = s.vaoCache;
|
|
526
|
+
if (!r)
|
|
527
|
+
for (const i in n)
|
|
528
|
+
this._activeVao !== n[i] && this.resetState(), this.gl.deleteVertexArray(n[i]);
|
|
518
529
|
}
|
|
519
530
|
/**
|
|
520
531
|
* Dispose all WebGL resources of all managed geometries.
|
|
521
532
|
* @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls
|
|
522
533
|
*/
|
|
523
534
|
destroyAll(e = !1) {
|
|
524
|
-
|
|
525
|
-
for (const s in this._geometryVaoHash) {
|
|
526
|
-
if (e)
|
|
527
|
-
for (const n in this._geometryVaoHash[s]) {
|
|
528
|
-
const i = this._geometryVaoHash[s];
|
|
529
|
-
this._activeVao !== i && this.unbind(), r.deleteVertexArray(i[n]);
|
|
530
|
-
}
|
|
531
|
-
this._geometryVaoHash[s] = null;
|
|
532
|
-
}
|
|
535
|
+
this._managedGeometries.removeAll(e);
|
|
533
536
|
}
|
|
534
537
|
/**
|
|
535
538
|
* Activate vertex array object.
|
|
@@ -541,30 +544,30 @@ class se {
|
|
|
541
544
|
const s = this._renderer.gl, n = this._renderer.buffer, i = e.attributes;
|
|
542
545
|
e.indexBuffer && n.bind(e.indexBuffer);
|
|
543
546
|
let a = null;
|
|
544
|
-
for (const
|
|
545
|
-
const
|
|
547
|
+
for (const u in i) {
|
|
548
|
+
const c = i[u], _ = c.buffer, h = n.getGlBuffer(_), l = r._attributeData[u];
|
|
546
549
|
if (l) {
|
|
547
|
-
a !==
|
|
550
|
+
a !== h && (n.bind(_), a = h);
|
|
548
551
|
const E = l.location;
|
|
549
552
|
s.enableVertexAttribArray(E);
|
|
550
|
-
const
|
|
553
|
+
const T = $(c.format), w = je(c.format);
|
|
551
554
|
if (((o = l.format) == null ? void 0 : o.substring(1, 4)) === "int" ? s.vertexAttribIPointer(
|
|
552
555
|
E,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
556
|
+
T.size,
|
|
557
|
+
w,
|
|
558
|
+
c.stride,
|
|
559
|
+
c.offset
|
|
557
560
|
) : s.vertexAttribPointer(
|
|
558
561
|
E,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
),
|
|
562
|
+
T.size,
|
|
563
|
+
w,
|
|
564
|
+
T.normalised,
|
|
565
|
+
c.stride,
|
|
566
|
+
c.offset
|
|
567
|
+
), c.instance)
|
|
565
568
|
if (this.hasInstance) {
|
|
566
|
-
const
|
|
567
|
-
s.vertexAttribDivisor(E,
|
|
569
|
+
const Be = c.divisor ?? 1;
|
|
570
|
+
s.vertexAttribDivisor(E, Be);
|
|
568
571
|
} else
|
|
569
572
|
throw new Error("geometry error, GPU Instancing is not supported on this device");
|
|
570
573
|
}
|
|
@@ -582,10 +585,10 @@ class se {
|
|
|
582
585
|
* @returns This instance of the geometry system.
|
|
583
586
|
*/
|
|
584
587
|
draw(e, r, s, n) {
|
|
585
|
-
const { gl: i } = this._renderer, a = this._activeGeometry, o =
|
|
588
|
+
const { gl: i } = this._renderer, a = this._activeGeometry, o = Ke[e || a.topology];
|
|
586
589
|
if (n ?? (n = a.instanceCount), a.indexBuffer) {
|
|
587
|
-
const
|
|
588
|
-
n !== 1 ? i.drawElementsInstanced(o, r || a.indexBuffer.data.length,
|
|
590
|
+
const u = a.indexBuffer.data.BYTES_PER_ELEMENT, c = u === 2 ? i.UNSIGNED_SHORT : i.UNSIGNED_INT;
|
|
591
|
+
n !== 1 ? i.drawElementsInstanced(o, r || a.indexBuffer.data.length, c, (s || 0) * u, n) : i.drawElements(o, r || a.indexBuffer.data.length, c, (s || 0) * u);
|
|
589
592
|
} else n !== 1 ? i.drawArraysInstanced(o, s || 0, r || a.getSize(), n) : i.drawArrays(o, s || 0, r || a.getSize());
|
|
590
593
|
return this;
|
|
591
594
|
}
|
|
@@ -594,16 +597,16 @@ class se {
|
|
|
594
597
|
this.gl.bindVertexArray(null), this._activeVao = null, this._activeGeometry = null;
|
|
595
598
|
}
|
|
596
599
|
destroy() {
|
|
597
|
-
this._renderer = null, this.gl = null, this._activeVao = null, this._activeGeometry = null
|
|
600
|
+
this._managedGeometries.destroy(), this._renderer = null, this.gl = null, this._activeVao = null, this._activeGeometry = null;
|
|
598
601
|
}
|
|
599
602
|
}
|
|
600
|
-
|
|
603
|
+
ne.extension = {
|
|
601
604
|
type: [
|
|
602
605
|
d.WebGLSystem
|
|
603
606
|
],
|
|
604
607
|
name: "geometry"
|
|
605
608
|
};
|
|
606
|
-
const
|
|
609
|
+
const ze = new Ne({
|
|
607
610
|
attributes: {
|
|
608
611
|
aPosition: [
|
|
609
612
|
-1,
|
|
@@ -617,14 +620,14 @@ const Ke = new Ae({
|
|
|
617
620
|
// Top left corner, extending beyond top edge
|
|
618
621
|
]
|
|
619
622
|
}
|
|
620
|
-
}),
|
|
623
|
+
}), L = class ie {
|
|
621
624
|
constructor(e) {
|
|
622
625
|
this.useBackBuffer = !1, this._useBackBufferThisRender = !1, this._renderer = e;
|
|
623
626
|
}
|
|
624
627
|
init(e = {}) {
|
|
625
|
-
const { useBackBuffer: r, antialias: s } = { ...
|
|
626
|
-
this.useBackBuffer = r, this._antialias = s, this._renderer.context.supports.msaa || (m("antialiasing, is not supported on when using the back buffer"), this._antialias = !1), this._state =
|
|
627
|
-
const n = new
|
|
628
|
+
const { useBackBuffer: r, antialias: s } = { ...ie.defaultOptions, ...e };
|
|
629
|
+
this.useBackBuffer = r, this._antialias = s, this._renderer.context.supports.msaa || (m("antialiasing, is not supported on when using the back buffer"), this._antialias = !1), this._state = P.for2d();
|
|
630
|
+
const n = new Ae({
|
|
628
631
|
vertex: `
|
|
629
632
|
attribute vec2 aPosition;
|
|
630
633
|
out vec2 vUv;
|
|
@@ -648,7 +651,7 @@ const Ke = new Ae({
|
|
|
648
651
|
}`,
|
|
649
652
|
name: "big-triangle"
|
|
650
653
|
});
|
|
651
|
-
this._bigTriangleShader = new
|
|
654
|
+
this._bigTriangleShader = new F({
|
|
652
655
|
glProgram: n,
|
|
653
656
|
resources: {
|
|
654
657
|
uTexture: b.WHITE.source
|
|
@@ -673,14 +676,14 @@ const Ke = new Ae({
|
|
|
673
676
|
_presentBackBuffer() {
|
|
674
677
|
const e = this._renderer;
|
|
675
678
|
e.renderTarget.finishRenderPass(), this._useBackBufferThisRender && (e.renderTarget.bind(this._targetTexture, !1), this._bigTriangleShader.resources.uTexture = this._backBufferTexture.source, e.encoder.draw({
|
|
676
|
-
geometry:
|
|
679
|
+
geometry: ze,
|
|
677
680
|
shader: this._bigTriangleShader,
|
|
678
681
|
state: this._state
|
|
679
682
|
}));
|
|
680
683
|
}
|
|
681
684
|
_getBackBufferTexture(e) {
|
|
682
685
|
return this._backBufferTexture = this._backBufferTexture || new b({
|
|
683
|
-
source: new
|
|
686
|
+
source: new z({
|
|
684
687
|
width: e.width,
|
|
685
688
|
height: e.height,
|
|
686
689
|
resolution: e._resolution,
|
|
@@ -697,19 +700,19 @@ const Ke = new Ae({
|
|
|
697
700
|
this._backBufferTexture && (this._backBufferTexture.destroy(), this._backBufferTexture = null);
|
|
698
701
|
}
|
|
699
702
|
};
|
|
700
|
-
|
|
703
|
+
L.extension = {
|
|
701
704
|
type: [
|
|
702
705
|
d.WebGLSystem
|
|
703
706
|
],
|
|
704
707
|
name: "backBuffer",
|
|
705
708
|
priority: 1
|
|
706
709
|
};
|
|
707
|
-
|
|
710
|
+
L.defaultOptions = {
|
|
708
711
|
/** if true will use the back buffer where required */
|
|
709
712
|
useBackBuffer: !1
|
|
710
713
|
};
|
|
711
|
-
let
|
|
712
|
-
class
|
|
714
|
+
let Ye = L;
|
|
715
|
+
class ae {
|
|
713
716
|
constructor(e) {
|
|
714
717
|
this._colorMaskCache = 15, this._renderer = e;
|
|
715
718
|
}
|
|
@@ -722,13 +725,13 @@ class ie {
|
|
|
722
725
|
));
|
|
723
726
|
}
|
|
724
727
|
}
|
|
725
|
-
|
|
728
|
+
ae.extension = {
|
|
726
729
|
type: [
|
|
727
730
|
d.WebGLSystem
|
|
728
731
|
],
|
|
729
732
|
name: "colorMask"
|
|
730
733
|
};
|
|
731
|
-
class
|
|
734
|
+
class oe {
|
|
732
735
|
constructor(e) {
|
|
733
736
|
this.commandFinished = Promise.resolve(), this._renderer = e;
|
|
734
737
|
}
|
|
@@ -738,44 +741,44 @@ class ae {
|
|
|
738
741
|
finishRenderPass() {
|
|
739
742
|
}
|
|
740
743
|
draw(e) {
|
|
741
|
-
const r = this._renderer, { geometry: s, shader: n, state: i, skipSync: a, topology: o, size:
|
|
742
|
-
r.shader.bind(n, a), r.geometry.bind(s, r.shader._activeProgram), i && r.state.set(i), r.geometry.draw(o,
|
|
744
|
+
const r = this._renderer, { geometry: s, shader: n, state: i, skipSync: a, topology: o, size: u, start: c, instanceCount: _ } = e;
|
|
745
|
+
r.shader.bind(n, a), r.geometry.bind(s, r.shader._activeProgram), i && r.state.set(i), r.geometry.draw(o, u, c, _ ?? s.instanceCount);
|
|
743
746
|
}
|
|
744
747
|
destroy() {
|
|
745
748
|
this._renderer = null;
|
|
746
749
|
}
|
|
747
750
|
}
|
|
748
|
-
|
|
751
|
+
oe.extension = {
|
|
749
752
|
type: [
|
|
750
753
|
d.WebGLSystem
|
|
751
754
|
],
|
|
752
755
|
name: "encoder"
|
|
753
756
|
};
|
|
754
|
-
class
|
|
757
|
+
class ce {
|
|
755
758
|
constructor(e) {
|
|
756
759
|
this._renderer = e;
|
|
757
760
|
}
|
|
758
761
|
contextChange() {
|
|
759
762
|
const e = this._renderer.gl;
|
|
760
|
-
this.maxTextures = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS), this.maxBatchableTextures =
|
|
763
|
+
this.maxTextures = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS), this.maxBatchableTextures = ye(this.maxTextures, e);
|
|
761
764
|
const r = this._renderer.context.webGLVersion === 2;
|
|
762
765
|
this.maxUniformBindings = r ? e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS) : 0;
|
|
763
766
|
}
|
|
764
767
|
destroy() {
|
|
765
768
|
}
|
|
766
769
|
}
|
|
767
|
-
|
|
770
|
+
ce.extension = {
|
|
768
771
|
type: [
|
|
769
772
|
d.WebGLSystem
|
|
770
773
|
],
|
|
771
774
|
name: "limits"
|
|
772
775
|
};
|
|
773
|
-
class
|
|
776
|
+
class qe {
|
|
774
777
|
constructor() {
|
|
775
778
|
this.width = -1, this.height = -1, this.msaa = !1, this.msaaRenderBuffer = [];
|
|
776
779
|
}
|
|
777
780
|
}
|
|
778
|
-
class
|
|
781
|
+
class ue {
|
|
779
782
|
constructor(e) {
|
|
780
783
|
this._stencilCache = {
|
|
781
784
|
enabled: !1,
|
|
@@ -818,7 +821,7 @@ class ce {
|
|
|
818
821
|
this._stencilCache.enabled = !1, this._stencilCache.stencilMode = p.NONE, this._stencilCache.stencilReference = 0;
|
|
819
822
|
}
|
|
820
823
|
setStencilMode(e, r) {
|
|
821
|
-
const s = this._renderTargetStencilState[this._activeRenderTarget.uid], n = this._gl, i =
|
|
824
|
+
const s = this._renderTargetStencilState[this._activeRenderTarget.uid], n = this._gl, i = Oe[e], a = this._stencilCache;
|
|
822
825
|
if (s.stencilMode = e, s.stencilReference = r, e === p.DISABLED) {
|
|
823
826
|
this._stencilCache.enabled && (this._stencilCache.enabled = !1, n.disable(n.STENCIL_TEST));
|
|
824
827
|
return;
|
|
@@ -826,13 +829,13 @@ class ce {
|
|
|
826
829
|
this._stencilCache.enabled || (this._stencilCache.enabled = !0, n.enable(n.STENCIL_TEST)), (e !== a.stencilMode || a.stencilReference !== r) && (a.stencilMode = e, a.stencilReference = r, n.stencilFunc(this._comparisonFuncMapping[i.stencilBack.compare], r, 255), n.stencilOp(n.KEEP, n.KEEP, this._stencilOpsMapping[i.stencilBack.passOp]));
|
|
827
830
|
}
|
|
828
831
|
}
|
|
829
|
-
|
|
832
|
+
ue.extension = {
|
|
830
833
|
type: [
|
|
831
834
|
d.WebGLSystem
|
|
832
835
|
],
|
|
833
836
|
name: "stencil"
|
|
834
837
|
};
|
|
835
|
-
const
|
|
838
|
+
const _e = {
|
|
836
839
|
f32: 4,
|
|
837
840
|
i32: 4,
|
|
838
841
|
"vec2<f32>": 8,
|
|
@@ -861,7 +864,7 @@ const ue = {
|
|
|
861
864
|
// mat3: 16 * 3,
|
|
862
865
|
// mat4: 16 * 4,
|
|
863
866
|
};
|
|
864
|
-
function
|
|
867
|
+
function Ze(t) {
|
|
865
868
|
const e = t.map((i) => ({
|
|
866
869
|
data: i,
|
|
867
870
|
offset: 0,
|
|
@@ -870,18 +873,18 @@ function Ye(t) {
|
|
|
870
873
|
let s = 0, n = 0;
|
|
871
874
|
for (let i = 0; i < e.length; i++) {
|
|
872
875
|
const a = e[i];
|
|
873
|
-
if (s =
|
|
876
|
+
if (s = _e[a.data.type], !s)
|
|
874
877
|
throw new Error(`Unknown type ${a.data.type}`);
|
|
875
878
|
a.data.size > 1 && (s = Math.max(s, r) * a.data.size);
|
|
876
879
|
const o = s === 12 ? 16 : s;
|
|
877
880
|
a.size = s;
|
|
878
|
-
const
|
|
879
|
-
|
|
881
|
+
const u = n % r;
|
|
882
|
+
u > 0 && r - u < o ? n += (r - u) % 16 : n += (s - u % s) % s, a.offset = n, n += s;
|
|
880
883
|
}
|
|
881
884
|
return n = Math.ceil(n / 16) * 16, { uboElements: e, size: n };
|
|
882
885
|
}
|
|
883
|
-
function
|
|
884
|
-
const r = Math.max(
|
|
886
|
+
function Qe(t, e) {
|
|
887
|
+
const r = Math.max(_e[t.data.type] / 16, 1), s = t.data.value.length / t.data.size, n = (4 - s % 4) % 4, i = t.data.type.indexOf("i32") >= 0 ? "dataInt32" : "data";
|
|
885
888
|
return `
|
|
886
889
|
v = uv.${t.data.name};
|
|
887
890
|
offset += ${e};
|
|
@@ -900,27 +903,27 @@ function qe(t, e) {
|
|
|
900
903
|
}
|
|
901
904
|
`;
|
|
902
905
|
}
|
|
903
|
-
function
|
|
904
|
-
return
|
|
906
|
+
function Je(t) {
|
|
907
|
+
return Pe(
|
|
905
908
|
t,
|
|
906
909
|
"uboStd40",
|
|
907
|
-
|
|
908
|
-
|
|
910
|
+
Qe,
|
|
911
|
+
Me
|
|
909
912
|
);
|
|
910
913
|
}
|
|
911
|
-
class
|
|
914
|
+
class fe extends Le {
|
|
912
915
|
constructor() {
|
|
913
916
|
super({
|
|
914
|
-
createUboElements:
|
|
915
|
-
generateUboSync:
|
|
917
|
+
createUboElements: Ze,
|
|
918
|
+
generateUboSync: Je
|
|
916
919
|
});
|
|
917
920
|
}
|
|
918
921
|
}
|
|
919
|
-
|
|
922
|
+
fe.extension = {
|
|
920
923
|
type: [d.WebGLSystem],
|
|
921
924
|
name: "ubo"
|
|
922
925
|
};
|
|
923
|
-
class
|
|
926
|
+
class et {
|
|
924
927
|
constructor() {
|
|
925
928
|
this._clearColorCache = [0, 0, 0, 0], this._viewPortCache = new H();
|
|
926
929
|
}
|
|
@@ -929,11 +932,15 @@ class Je {
|
|
|
929
932
|
}
|
|
930
933
|
contextChange() {
|
|
931
934
|
this._clearColorCache = [0, 0, 0, 0], this._viewPortCache = new H();
|
|
935
|
+
const e = this._renderer.gl;
|
|
936
|
+
this._drawBuffersCache = [];
|
|
937
|
+
for (let r = 1; r <= 16; r++)
|
|
938
|
+
this._drawBuffersCache[r] = Array.from({ length: r }, (s, n) => e.COLOR_ATTACHMENT0 + n);
|
|
932
939
|
}
|
|
933
940
|
copyToTexture(e, r, s, n, i) {
|
|
934
|
-
const a = this._renderTargetSystem, o = this._renderer,
|
|
935
|
-
return this.finishRenderPass(e),
|
|
936
|
-
|
|
941
|
+
const a = this._renderTargetSystem, o = this._renderer, u = a.getGpuRenderTarget(e), c = o.gl;
|
|
942
|
+
return this.finishRenderPass(e), c.bindFramebuffer(c.FRAMEBUFFER, u.resolveTargetFramebuffer), o.texture.bind(r, 0), c.copyTexSubImage2D(
|
|
943
|
+
c.TEXTURE_2D,
|
|
937
944
|
0,
|
|
938
945
|
i.x,
|
|
939
946
|
i.y,
|
|
@@ -945,16 +952,16 @@ class Je {
|
|
|
945
952
|
}
|
|
946
953
|
startRenderPass(e, r = !0, s, n) {
|
|
947
954
|
const i = this._renderTargetSystem, a = e.colorTexture, o = i.getGpuRenderTarget(e);
|
|
948
|
-
let
|
|
949
|
-
e.isRoot && (
|
|
950
|
-
this._renderer.texture.unbind(
|
|
955
|
+
let u = n.y;
|
|
956
|
+
e.isRoot && (u = a.pixelHeight - n.height - n.y), e.colorTextures.forEach((h) => {
|
|
957
|
+
this._renderer.texture.unbind(h);
|
|
951
958
|
});
|
|
952
|
-
const
|
|
953
|
-
|
|
959
|
+
const c = this._renderer.gl;
|
|
960
|
+
c.bindFramebuffer(c.FRAMEBUFFER, o.framebuffer), e.colorTextures.length > 1 && this._setDrawBuffers(e, c);
|
|
954
961
|
const _ = this._viewPortCache;
|
|
955
|
-
(_.x !== n.x || _.y !==
|
|
962
|
+
(_.x !== n.x || _.y !== u || _.width !== n.width || _.height !== n.height) && (_.x = n.x, _.y = u, _.width = n.width, _.height = n.height, c.viewport(
|
|
956
963
|
n.x,
|
|
957
|
-
|
|
964
|
+
u,
|
|
958
965
|
n.width,
|
|
959
966
|
n.height
|
|
960
967
|
)), !o.depthStencilRenderBuffer && (e.stencil || e.depth) && this._initStencil(o), this.clear(e, r, s);
|
|
@@ -978,7 +985,7 @@ class Je {
|
|
|
978
985
|
), n.bindFramebuffer(n.FRAMEBUFFER, s.framebuffer);
|
|
979
986
|
}
|
|
980
987
|
initGpuRenderTarget(e) {
|
|
981
|
-
const s = this._renderer.gl, n = new
|
|
988
|
+
const s = this._renderer.gl, n = new qe();
|
|
982
989
|
return e.colorTexture instanceof A ? (this._renderer.context.ensureCanvasSize(e.colorTexture.resource), n.framebuffer = null, n) : (this._initColor(e, n), s.bindFramebuffer(s.FRAMEBUFFER, null), n);
|
|
983
990
|
}
|
|
984
991
|
destroyGpuRenderTarget(e) {
|
|
@@ -1008,23 +1015,23 @@ class Je {
|
|
|
1008
1015
|
}
|
|
1009
1016
|
_initColor(e, r) {
|
|
1010
1017
|
const s = this._renderer, n = s.gl, i = n.createFramebuffer();
|
|
1011
|
-
if (r.resolveTargetFramebuffer = i, n.bindFramebuffer(n.FRAMEBUFFER, i), r.width = e.colorTexture.source.pixelWidth, r.height = e.colorTexture.source.pixelHeight, e.colorTextures.forEach((
|
|
1012
|
-
const c =
|
|
1018
|
+
if (r.resolveTargetFramebuffer = i, n.bindFramebuffer(n.FRAMEBUFFER, i), r.width = e.colorTexture.source.pixelWidth, r.height = e.colorTexture.source.pixelHeight, e.colorTextures.forEach((o, u) => {
|
|
1019
|
+
const c = o.source;
|
|
1013
1020
|
c.antialias && (s.context.supports.msaa ? r.msaa = !0 : m("[RenderTexture] Antialiasing on textures is not supported in WebGL1")), s.texture.bindSource(c, 0);
|
|
1014
|
-
const
|
|
1021
|
+
const h = s.texture.getGlSource(c).texture;
|
|
1015
1022
|
n.framebufferTexture2D(
|
|
1016
1023
|
n.FRAMEBUFFER,
|
|
1017
|
-
n.COLOR_ATTACHMENT0 +
|
|
1024
|
+
n.COLOR_ATTACHMENT0 + u,
|
|
1018
1025
|
3553,
|
|
1019
1026
|
// texture.target,
|
|
1020
|
-
|
|
1027
|
+
h,
|
|
1021
1028
|
0
|
|
1022
1029
|
);
|
|
1023
1030
|
}), r.msaa) {
|
|
1024
|
-
const
|
|
1025
|
-
r.framebuffer =
|
|
1026
|
-
const
|
|
1027
|
-
r.msaaRenderBuffer[c] =
|
|
1031
|
+
const o = n.createFramebuffer();
|
|
1032
|
+
r.framebuffer = o, n.bindFramebuffer(n.FRAMEBUFFER, o), e.colorTextures.forEach((u, c) => {
|
|
1033
|
+
const _ = n.createRenderbuffer();
|
|
1034
|
+
r.msaaRenderBuffer[c] = _;
|
|
1028
1035
|
});
|
|
1029
1036
|
} else
|
|
1030
1037
|
r.framebuffer = i;
|
|
@@ -1036,22 +1043,22 @@ class Je {
|
|
|
1036
1043
|
i !== 0 && n.source.resize(s.width, s.height, s._resolution);
|
|
1037
1044
|
}), r.msaa) {
|
|
1038
1045
|
const n = this._renderer, i = n.gl, a = r.framebuffer;
|
|
1039
|
-
i.bindFramebuffer(i.FRAMEBUFFER, a), e.colorTextures.forEach((o,
|
|
1040
|
-
const
|
|
1041
|
-
n.texture.bindSource(
|
|
1042
|
-
const
|
|
1046
|
+
i.bindFramebuffer(i.FRAMEBUFFER, a), e.colorTextures.forEach((o, u) => {
|
|
1047
|
+
const c = o.source;
|
|
1048
|
+
n.texture.bindSource(c, 0);
|
|
1049
|
+
const h = n.texture.getGlSource(c).internalFormat, l = r.msaaRenderBuffer[u];
|
|
1043
1050
|
i.bindRenderbuffer(
|
|
1044
1051
|
i.RENDERBUFFER,
|
|
1045
1052
|
l
|
|
1046
1053
|
), i.renderbufferStorageMultisample(
|
|
1047
1054
|
i.RENDERBUFFER,
|
|
1048
1055
|
4,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1056
|
+
h,
|
|
1057
|
+
c.pixelWidth,
|
|
1058
|
+
c.pixelHeight
|
|
1052
1059
|
), i.framebufferRenderbuffer(
|
|
1053
1060
|
i.FRAMEBUFFER,
|
|
1054
|
-
i.COLOR_ATTACHMENT0 +
|
|
1061
|
+
i.COLOR_ATTACHMENT0 + u,
|
|
1055
1062
|
i.RENDERBUFFER,
|
|
1056
1063
|
l
|
|
1057
1064
|
);
|
|
@@ -1104,17 +1111,25 @@ class Je {
|
|
|
1104
1111
|
);
|
|
1105
1112
|
}
|
|
1106
1113
|
}
|
|
1114
|
+
_setDrawBuffers(e, r) {
|
|
1115
|
+
const s = e.colorTextures.length, n = this._drawBuffersCache[s];
|
|
1116
|
+
if (this._renderer.context.webGLVersion === 1) {
|
|
1117
|
+
const i = this._renderer.context.extensions.drawBuffers;
|
|
1118
|
+
i ? i.drawBuffersWEBGL(n) : m("[RenderTexture] This WebGL1 context does not support rendering to multiple targets");
|
|
1119
|
+
} else
|
|
1120
|
+
r.drawBuffers(n);
|
|
1121
|
+
}
|
|
1107
1122
|
}
|
|
1108
|
-
class he extends
|
|
1123
|
+
class he extends we {
|
|
1109
1124
|
constructor(e) {
|
|
1110
|
-
super(e), this.adaptor = new
|
|
1125
|
+
super(e), this.adaptor = new et(), this.adaptor.init(e, this);
|
|
1111
1126
|
}
|
|
1112
1127
|
}
|
|
1113
1128
|
he.extension = {
|
|
1114
1129
|
type: [d.WebGLSystem],
|
|
1115
1130
|
name: "renderTarget"
|
|
1116
1131
|
};
|
|
1117
|
-
function
|
|
1132
|
+
function tt(t, e) {
|
|
1118
1133
|
const r = [], s = [`
|
|
1119
1134
|
var g = s.groups;
|
|
1120
1135
|
var sS = r.shader;
|
|
@@ -1124,16 +1139,16 @@ function Qe(t, e) {
|
|
|
1124
1139
|
`];
|
|
1125
1140
|
let n = !1, i = 0;
|
|
1126
1141
|
const a = e._getProgramData(t.glProgram);
|
|
1127
|
-
for (const
|
|
1128
|
-
const
|
|
1142
|
+
for (const u in t.groups) {
|
|
1143
|
+
const c = t.groups[u];
|
|
1129
1144
|
r.push(`
|
|
1130
|
-
resources = g[${
|
|
1145
|
+
resources = g[${u}].resources;
|
|
1131
1146
|
`);
|
|
1132
|
-
for (const _ in
|
|
1133
|
-
const
|
|
1134
|
-
if (
|
|
1135
|
-
if (
|
|
1136
|
-
const l = t._uniformBindMap[
|
|
1147
|
+
for (const _ in c.resources) {
|
|
1148
|
+
const h = c.resources[_];
|
|
1149
|
+
if (h instanceof O)
|
|
1150
|
+
if (h.ubo) {
|
|
1151
|
+
const l = t._uniformBindMap[u][Number(_)];
|
|
1137
1152
|
r.push(`
|
|
1138
1153
|
sS.bindUniformBlock(
|
|
1139
1154
|
resources[${_}],
|
|
@@ -1145,8 +1160,8 @@ function Qe(t, e) {
|
|
|
1145
1160
|
r.push(`
|
|
1146
1161
|
ugS.updateUniformGroup(resources[${_}], p, sD);
|
|
1147
1162
|
`);
|
|
1148
|
-
else if (
|
|
1149
|
-
const l = t._uniformBindMap[
|
|
1163
|
+
else if (h instanceof J) {
|
|
1164
|
+
const l = t._uniformBindMap[u][Number(_)];
|
|
1150
1165
|
r.push(`
|
|
1151
1166
|
sS.bindUniformBlock(
|
|
1152
1167
|
resources[${_}],
|
|
@@ -1154,8 +1169,8 @@ function Qe(t, e) {
|
|
|
1154
1169
|
${t.glProgram._uniformBlockData[l].index}
|
|
1155
1170
|
);
|
|
1156
1171
|
`);
|
|
1157
|
-
} else if (
|
|
1158
|
-
const l = t._uniformBindMap[
|
|
1172
|
+
} else if (h instanceof z) {
|
|
1173
|
+
const l = t._uniformBindMap[u][_], E = a.uniformData[l];
|
|
1159
1174
|
E && (n || (n = !0, s.push(`
|
|
1160
1175
|
var tS = r.texture;
|
|
1161
1176
|
`)), e._gl.uniform1i(E.location, i), r.push(`
|
|
@@ -1168,7 +1183,7 @@ function Qe(t, e) {
|
|
|
1168
1183
|
`);
|
|
1169
1184
|
return new Function("r", "s", "sD", o);
|
|
1170
1185
|
}
|
|
1171
|
-
class
|
|
1186
|
+
class rt {
|
|
1172
1187
|
/**
|
|
1173
1188
|
* Makes a new Pixi program.
|
|
1174
1189
|
* @param program - webgl program
|
|
@@ -1192,7 +1207,7 @@ function C(t) {
|
|
|
1192
1207
|
e[r] = !1;
|
|
1193
1208
|
return e;
|
|
1194
1209
|
}
|
|
1195
|
-
function
|
|
1210
|
+
function le(t, e) {
|
|
1196
1211
|
switch (t) {
|
|
1197
1212
|
case "float":
|
|
1198
1213
|
return 0;
|
|
@@ -1269,7 +1284,7 @@ function fe(t, e) {
|
|
|
1269
1284
|
return null;
|
|
1270
1285
|
}
|
|
1271
1286
|
let g = null;
|
|
1272
|
-
const
|
|
1287
|
+
const X = {
|
|
1273
1288
|
FLOAT: "float",
|
|
1274
1289
|
FLOAT_VEC2: "vec2",
|
|
1275
1290
|
FLOAT_VEC3: "vec3",
|
|
@@ -1298,7 +1313,7 @@ const k = {
|
|
|
1298
1313
|
SAMPLER_2D_ARRAY: "sampler2DArray",
|
|
1299
1314
|
INT_SAMPLER_2D_ARRAY: "sampler2DArray",
|
|
1300
1315
|
UNSIGNED_INT_SAMPLER_2D_ARRAY: "sampler2DArray"
|
|
1301
|
-
},
|
|
1316
|
+
}, st = {
|
|
1302
1317
|
float: "float32",
|
|
1303
1318
|
vec2: "float32x2",
|
|
1304
1319
|
vec3: "float32x3",
|
|
@@ -1316,33 +1331,33 @@ const k = {
|
|
|
1316
1331
|
bvec3: "uint32x3",
|
|
1317
1332
|
bvec4: "uint32x4"
|
|
1318
1333
|
};
|
|
1319
|
-
function
|
|
1334
|
+
function de(t, e) {
|
|
1320
1335
|
if (!g) {
|
|
1321
|
-
const r = Object.keys(
|
|
1336
|
+
const r = Object.keys(X);
|
|
1322
1337
|
g = {};
|
|
1323
1338
|
for (let s = 0; s < r.length; ++s) {
|
|
1324
1339
|
const n = r[s];
|
|
1325
|
-
g[t[n]] =
|
|
1340
|
+
g[t[n]] = X[n];
|
|
1326
1341
|
}
|
|
1327
1342
|
}
|
|
1328
1343
|
return g[e];
|
|
1329
1344
|
}
|
|
1330
|
-
function
|
|
1331
|
-
const r =
|
|
1332
|
-
return
|
|
1345
|
+
function nt(t, e) {
|
|
1346
|
+
const r = de(t, e);
|
|
1347
|
+
return st[r] || "float32";
|
|
1333
1348
|
}
|
|
1334
|
-
function
|
|
1349
|
+
function it(t, e, r = !1) {
|
|
1335
1350
|
const s = {}, n = e.getProgramParameter(t, e.ACTIVE_ATTRIBUTES);
|
|
1336
1351
|
for (let a = 0; a < n; a++) {
|
|
1337
1352
|
const o = e.getActiveAttrib(t, a);
|
|
1338
1353
|
if (o.name.startsWith("gl_"))
|
|
1339
1354
|
continue;
|
|
1340
|
-
const
|
|
1355
|
+
const u = nt(e, o.type);
|
|
1341
1356
|
s[o.name] = {
|
|
1342
1357
|
location: 0,
|
|
1343
1358
|
// set further down..
|
|
1344
|
-
format:
|
|
1345
|
-
stride:
|
|
1359
|
+
format: u,
|
|
1360
|
+
stride: $(u).stride,
|
|
1346
1361
|
offset: 0,
|
|
1347
1362
|
instance: !1,
|
|
1348
1363
|
start: 0
|
|
@@ -1359,7 +1374,7 @@ function st(t, e, r = !1) {
|
|
|
1359
1374
|
s[i[a]].location = e.getAttribLocation(t, i[a]);
|
|
1360
1375
|
return s;
|
|
1361
1376
|
}
|
|
1362
|
-
function
|
|
1377
|
+
function at(t, e) {
|
|
1363
1378
|
if (!e.ACTIVE_UNIFORM_BLOCKS)
|
|
1364
1379
|
return {};
|
|
1365
1380
|
const r = {}, s = e.getProgramParameter(t, e.ACTIVE_UNIFORM_BLOCKS);
|
|
@@ -1373,36 +1388,36 @@ function nt(t, e) {
|
|
|
1373
1388
|
}
|
|
1374
1389
|
return r;
|
|
1375
1390
|
}
|
|
1376
|
-
function
|
|
1391
|
+
function ot(t, e) {
|
|
1377
1392
|
const r = {}, s = e.getProgramParameter(t, e.ACTIVE_UNIFORMS);
|
|
1378
1393
|
for (let n = 0; n < s; n++) {
|
|
1379
|
-
const i = e.getActiveUniform(t, n), a = i.name.replace(/\[.*?\]$/, ""), o = !!i.name.match(/\[.*?\]$/),
|
|
1394
|
+
const i = e.getActiveUniform(t, n), a = i.name.replace(/\[.*?\]$/, ""), o = !!i.name.match(/\[.*?\]$/), u = de(e, i.type);
|
|
1380
1395
|
r[a] = {
|
|
1381
1396
|
name: a,
|
|
1382
1397
|
index: n,
|
|
1383
|
-
type:
|
|
1398
|
+
type: u,
|
|
1384
1399
|
size: i.size,
|
|
1385
1400
|
isArray: o,
|
|
1386
|
-
value:
|
|
1401
|
+
value: le(u, i.size)
|
|
1387
1402
|
};
|
|
1388
1403
|
}
|
|
1389
1404
|
return r;
|
|
1390
1405
|
}
|
|
1391
|
-
function
|
|
1406
|
+
function W(t, e) {
|
|
1392
1407
|
const r = t.getShaderSource(e).split(`
|
|
1393
|
-
`).map((
|
|
1394
|
-
`), i = {}, a = n.map((
|
|
1395
|
-
a.forEach((
|
|
1396
|
-
r[
|
|
1408
|
+
`).map((c, _) => `${_}: ${c}`), s = t.getShaderInfoLog(e), n = s.split(`
|
|
1409
|
+
`), i = {}, a = n.map((c) => parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/, "$1"))).filter((c) => c && !i[c] ? (i[c] = !0, !0) : !1), o = [""];
|
|
1410
|
+
a.forEach((c) => {
|
|
1411
|
+
r[c - 1] = `%c${r[c - 1]}%c`, o.push("background: #FF0000; color:#FFFFFF; font-size: 10px", "font-size: 10px");
|
|
1397
1412
|
});
|
|
1398
|
-
const
|
|
1413
|
+
const u = r.join(`
|
|
1399
1414
|
`);
|
|
1400
|
-
o[0] =
|
|
1415
|
+
o[0] = u, console.error(s), console.groupCollapsed("click to view full shader code"), console.warn(...o), console.groupEnd();
|
|
1401
1416
|
}
|
|
1402
|
-
function
|
|
1403
|
-
t.getProgramParameter(e, t.LINK_STATUS) || (t.getShaderParameter(r, t.COMPILE_STATUS) ||
|
|
1417
|
+
function ct(t, e, r, s) {
|
|
1418
|
+
t.getProgramParameter(e, t.LINK_STATUS) || (t.getShaderParameter(r, t.COMPILE_STATUS) || W(t, r), t.getShaderParameter(s, t.COMPILE_STATUS) || W(t, s), console.error("PixiJS Error: Could not initialize shader."), t.getProgramInfoLog(e) !== "" && console.warn("PixiJS Warning: gl.getProgramInfoLog()", t.getProgramInfoLog(e)));
|
|
1404
1419
|
}
|
|
1405
|
-
function
|
|
1420
|
+
function ut(t, e) {
|
|
1406
1421
|
const r = V(t, t.VERTEX_SHADER, e.vertex), s = V(t, t.FRAGMENT_SHADER, e.fragment), n = t.createProgram();
|
|
1407
1422
|
t.attachShader(n, r), t.attachShader(n, s);
|
|
1408
1423
|
const i = e.transformFeedbackVaryings;
|
|
@@ -1410,28 +1425,28 @@ function ot(t, e) {
|
|
|
1410
1425
|
n,
|
|
1411
1426
|
i.names,
|
|
1412
1427
|
i.bufferMode === "separate" ? t.SEPARATE_ATTRIBS : t.INTERLEAVED_ATTRIBS
|
|
1413
|
-
)), t.linkProgram(n), t.getProgramParameter(n, t.LINK_STATUS) ||
|
|
1428
|
+
)), t.linkProgram(n), t.getProgramParameter(n, t.LINK_STATUS) || ct(t, n, r, s), e._attributeData = it(
|
|
1414
1429
|
n,
|
|
1415
1430
|
t,
|
|
1416
1431
|
!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)
|
|
1417
|
-
), e._uniformData =
|
|
1432
|
+
), e._uniformData = ot(n, t), e._uniformBlockData = at(n, t), t.deleteShader(r), t.deleteShader(s);
|
|
1418
1433
|
const a = {};
|
|
1419
|
-
for (const
|
|
1420
|
-
const
|
|
1421
|
-
a[
|
|
1422
|
-
location: t.getUniformLocation(n,
|
|
1423
|
-
value:
|
|
1434
|
+
for (const u in e._uniformData) {
|
|
1435
|
+
const c = e._uniformData[u];
|
|
1436
|
+
a[u] = {
|
|
1437
|
+
location: t.getUniformLocation(n, u),
|
|
1438
|
+
value: le(c.type, c.size)
|
|
1424
1439
|
};
|
|
1425
1440
|
}
|
|
1426
|
-
return new
|
|
1441
|
+
return new rt(n, a);
|
|
1427
1442
|
}
|
|
1428
1443
|
const R = {
|
|
1429
1444
|
textureCount: 0,
|
|
1430
1445
|
blockIndex: 0
|
|
1431
1446
|
};
|
|
1432
|
-
class
|
|
1447
|
+
class me {
|
|
1433
1448
|
constructor(e) {
|
|
1434
|
-
this._activeProgram = null, this._programDataHash = /* @__PURE__ */ Object.create(null), this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null), this._renderer = e
|
|
1449
|
+
this._activeProgram = null, this._programDataHash = /* @__PURE__ */ Object.create(null), this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null), this._renderer = e;
|
|
1435
1450
|
}
|
|
1436
1451
|
contextChange(e) {
|
|
1437
1452
|
this._gl = e, this._programDataHash = /* @__PURE__ */ Object.create(null), this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null), this._activeProgram = null;
|
|
@@ -1465,13 +1480,13 @@ class de {
|
|
|
1465
1480
|
bindUniformBlock(e, r, s = 0) {
|
|
1466
1481
|
const n = this._renderer.buffer, i = this._getProgramData(this._activeProgram), a = e._bufferResource;
|
|
1467
1482
|
a || this._renderer.ubo.updateUniformGroup(e);
|
|
1468
|
-
const o = e.buffer,
|
|
1483
|
+
const o = e.buffer, u = n.updateBuffer(o), c = n.freeLocationForBufferBase(u);
|
|
1469
1484
|
if (a) {
|
|
1470
|
-
const { offset:
|
|
1471
|
-
|
|
1472
|
-
} else n.getLastBindBaseLocation(
|
|
1485
|
+
const { offset: h, size: l } = e;
|
|
1486
|
+
h === 0 && l === o.data.byteLength ? n.bindBufferBase(u, c) : n.bindBufferRange(u, c, h);
|
|
1487
|
+
} else n.getLastBindBaseLocation(u) !== c && n.bindBufferBase(u, c);
|
|
1473
1488
|
const _ = this._activeProgram._uniformBlockData[r].index;
|
|
1474
|
-
i.uniformBlockBindings[s] !==
|
|
1489
|
+
i.uniformBlockBindings[s] !== c && (i.uniformBlockBindings[s] = c, this._renderer.gl.uniformBlockBinding(i.program, _, c));
|
|
1475
1490
|
}
|
|
1476
1491
|
_setProgram(e) {
|
|
1477
1492
|
if (this._activeProgram === e)
|
|
@@ -1489,11 +1504,11 @@ class de {
|
|
|
1489
1504
|
}
|
|
1490
1505
|
_createProgramData(e) {
|
|
1491
1506
|
const r = e._key;
|
|
1492
|
-
return this._programDataHash[r] =
|
|
1507
|
+
return this._programDataHash[r] = ut(this._gl, e), this._programDataHash[r];
|
|
1493
1508
|
}
|
|
1494
1509
|
destroy() {
|
|
1495
1510
|
for (const e of Object.keys(this._programDataHash))
|
|
1496
|
-
this._programDataHash[e].destroy()
|
|
1511
|
+
this._programDataHash[e].destroy();
|
|
1497
1512
|
this._programDataHash = null, this._shaderSyncFunctions = null, this._activeProgram = null, this._renderer = null, this._gl = null;
|
|
1498
1513
|
}
|
|
1499
1514
|
/**
|
|
@@ -1505,19 +1520,19 @@ class de {
|
|
|
1505
1520
|
* @ignore
|
|
1506
1521
|
*/
|
|
1507
1522
|
_generateShaderSync(e, r) {
|
|
1508
|
-
return
|
|
1523
|
+
return tt(e, r);
|
|
1509
1524
|
}
|
|
1510
1525
|
resetState() {
|
|
1511
1526
|
this._activeProgram = null;
|
|
1512
1527
|
}
|
|
1513
1528
|
}
|
|
1514
|
-
|
|
1529
|
+
me.extension = {
|
|
1515
1530
|
type: [
|
|
1516
1531
|
d.WebGLSystem
|
|
1517
1532
|
],
|
|
1518
1533
|
name: "shader"
|
|
1519
1534
|
};
|
|
1520
|
-
const
|
|
1535
|
+
const _t = {
|
|
1521
1536
|
f32: `if (cv !== v) {
|
|
1522
1537
|
cu.value = v;
|
|
1523
1538
|
gl.uniform1f(location, v);
|
|
@@ -1609,7 +1624,7 @@ const ct = {
|
|
|
1609
1624
|
"mat2x2<f32>": "gl.uniformMatrix2fv(location, false, v);",
|
|
1610
1625
|
"mat3x3<f32>": "gl.uniformMatrix3fv(location, false, v);",
|
|
1611
1626
|
"mat4x4<f32>": "gl.uniformMatrix4fv(location, false, v);"
|
|
1612
|
-
},
|
|
1627
|
+
}, ft = {
|
|
1613
1628
|
f32: "gl.uniform1fv(location, v);",
|
|
1614
1629
|
"vec2<f32>": "gl.uniform2fv(location, v);",
|
|
1615
1630
|
"vec3<f32>": "gl.uniform3fv(location, v);",
|
|
@@ -1630,7 +1645,7 @@ const ct = {
|
|
|
1630
1645
|
"vec3<bool>": "gl.uniform3iv(location, v);",
|
|
1631
1646
|
"vec4<bool>": "gl.uniform4iv(location, v);"
|
|
1632
1647
|
};
|
|
1633
|
-
function
|
|
1648
|
+
function ht(t, e) {
|
|
1634
1649
|
const r = [`
|
|
1635
1650
|
var v = null;
|
|
1636
1651
|
var cv = null;
|
|
@@ -1641,7 +1656,7 @@ function _t(t, e) {
|
|
|
1641
1656
|
`];
|
|
1642
1657
|
for (const s in t.uniforms) {
|
|
1643
1658
|
if (!e[s]) {
|
|
1644
|
-
t.uniforms[s] instanceof
|
|
1659
|
+
t.uniforms[s] instanceof O ? t.uniforms[s].ubo ? r.push(`
|
|
1645
1660
|
renderer.shader.bindUniformBlock(uv.${s}, "${s}");
|
|
1646
1661
|
`) : r.push(`
|
|
1647
1662
|
renderer.shader.updateUniformGroup(uv.${s});
|
|
@@ -1660,7 +1675,7 @@ function _t(t, e) {
|
|
|
1660
1675
|
}
|
|
1661
1676
|
}
|
|
1662
1677
|
if (!i) {
|
|
1663
|
-
const o = (n.size === 1 ?
|
|
1678
|
+
const o = (n.size === 1 ? _t : ft)[n.type].replace("location", `ud["${s}"].location`);
|
|
1664
1679
|
r.push(`
|
|
1665
1680
|
cu = ud["${s}"];
|
|
1666
1681
|
cv = cu.value;
|
|
@@ -1671,7 +1686,7 @@ function _t(t, e) {
|
|
|
1671
1686
|
return new Function("ud", "uv", "renderer", "syncData", r.join(`
|
|
1672
1687
|
`));
|
|
1673
1688
|
}
|
|
1674
|
-
class
|
|
1689
|
+
class Ee {
|
|
1675
1690
|
/** @param renderer - The renderer this System works for. */
|
|
1676
1691
|
constructor(e) {
|
|
1677
1692
|
this._cache = {}, this._uniformGroupSyncHash = {}, this._renderer = e, this.gl = null, this._cache = {};
|
|
@@ -1704,7 +1719,7 @@ class me {
|
|
|
1704
1719
|
return this._cache[n] || (this._cache[n] = this._generateUniformsSync(e, r._uniformData)), s[r._key] = this._cache[n], s[r._key];
|
|
1705
1720
|
}
|
|
1706
1721
|
_generateUniformsSync(e, r) {
|
|
1707
|
-
return
|
|
1722
|
+
return ht(e, r);
|
|
1708
1723
|
}
|
|
1709
1724
|
/**
|
|
1710
1725
|
* Takes a uniform group and data and generates a unique signature for them.
|
|
@@ -1725,13 +1740,13 @@ class me {
|
|
|
1725
1740
|
this._renderer = null, this._cache = null;
|
|
1726
1741
|
}
|
|
1727
1742
|
}
|
|
1728
|
-
|
|
1743
|
+
Ee.extension = {
|
|
1729
1744
|
type: [
|
|
1730
1745
|
d.WebGLSystem
|
|
1731
1746
|
],
|
|
1732
1747
|
name: "uniformGroup"
|
|
1733
1748
|
};
|
|
1734
|
-
function
|
|
1749
|
+
function lt(t) {
|
|
1735
1750
|
const e = {};
|
|
1736
1751
|
if (e.normal = [t.ONE, t.ONE_MINUS_SRC_ALPHA], e.add = [t.ONE, t.ONE], e.multiply = [t.DST_COLOR, t.ONE_MINUS_SRC_ALPHA, t.ONE, t.ONE_MINUS_SRC_ALPHA], e.screen = [t.ONE, t.ONE_MINUS_SRC_COLOR, t.ONE, t.ONE_MINUS_SRC_ALPHA], e.none = [0, 0], e["normal-npm"] = [t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA, t.ONE, t.ONE_MINUS_SRC_ALPHA], e["add-npm"] = [t.SRC_ALPHA, t.ONE, t.ONE, t.ONE], e["screen-npm"] = [t.SRC_ALPHA, t.ONE_MINUS_SRC_COLOR, t.ONE, t.ONE_MINUS_SRC_ALPHA], e.erase = [t.ZERO, t.ONE_MINUS_SRC_ALPHA], !(t instanceof S.get().getWebGLRenderingContext()))
|
|
1737
1752
|
e.min = [t.ONE, t.ONE, t.ONE, t.ONE, t.MIN, t.MIN], e.max = [t.ONE, t.ONE, t.ONE, t.ONE, t.MAX, t.MAX];
|
|
@@ -1741,15 +1756,15 @@ function ht(t) {
|
|
|
1741
1756
|
}
|
|
1742
1757
|
return e;
|
|
1743
1758
|
}
|
|
1744
|
-
const
|
|
1759
|
+
const dt = 0, mt = 1, Et = 2, bt = 3, St = 4, pt = 5, be = class G {
|
|
1745
1760
|
constructor(e) {
|
|
1746
|
-
this._invertFrontFace = !1, this.gl = null, this.stateId = 0, this.polygonOffset = 0, this.blendMode = "none", this._blendEq = !1, this.map = [], this.map[
|
|
1761
|
+
this._invertFrontFace = !1, this.gl = null, this.stateId = 0, this.polygonOffset = 0, this.blendMode = "none", this._blendEq = !1, this.map = [], this.map[dt] = this.setBlend, this.map[mt] = this.setOffset, this.map[Et] = this.setCullFace, this.map[bt] = this.setDepthTest, this.map[St] = this.setFrontFace, this.map[pt] = this.setDepthMask, this.checks = [], this.defaultState = P.for2d(), e.renderTarget.onRenderTargetChange.add(this);
|
|
1747
1762
|
}
|
|
1748
1763
|
onRenderTargetChange(e) {
|
|
1749
1764
|
this._invertFrontFace = !e.isRoot, this._cullFace ? this.setFrontFace(this._frontFace) : this._frontFaceDirty = !0;
|
|
1750
1765
|
}
|
|
1751
1766
|
contextChange(e) {
|
|
1752
|
-
this.gl = e, this.blendModesMap =
|
|
1767
|
+
this.gl = e, this.blendModesMap = lt(e), this.resetState();
|
|
1753
1768
|
}
|
|
1754
1769
|
/**
|
|
1755
1770
|
* Sets the current state
|
|
@@ -1878,19 +1893,21 @@ const ft = 0, lt = 1, dt = 2, mt = 3, Et = 4, bt = 5, Ee = class G {
|
|
|
1878
1893
|
this.gl = null, this.checks.length = 0;
|
|
1879
1894
|
}
|
|
1880
1895
|
};
|
|
1881
|
-
|
|
1896
|
+
be.extension = {
|
|
1882
1897
|
type: [
|
|
1883
1898
|
d.WebGLSystem
|
|
1884
1899
|
],
|
|
1885
1900
|
name: "state"
|
|
1886
1901
|
};
|
|
1887
|
-
let
|
|
1888
|
-
class
|
|
1902
|
+
let gt = be;
|
|
1903
|
+
class Rt {
|
|
1889
1904
|
constructor(e) {
|
|
1890
|
-
this.target =
|
|
1905
|
+
this.target = se.TEXTURE_2D, this.texture = e, this.width = -1, this.height = -1, this.type = f.UNSIGNED_BYTE, this.internalFormat = I.RGBA, this.format = I.RGBA, this.samplerType = 0;
|
|
1906
|
+
}
|
|
1907
|
+
destroy() {
|
|
1891
1908
|
}
|
|
1892
1909
|
}
|
|
1893
|
-
const
|
|
1910
|
+
const xt = {
|
|
1894
1911
|
id: "buffer",
|
|
1895
1912
|
upload(t, e, r) {
|
|
1896
1913
|
e.width === t.width || e.height === t.height ? r.texSubImage2D(
|
|
@@ -1915,7 +1932,7 @@ const gt = {
|
|
|
1915
1932
|
t.resource
|
|
1916
1933
|
), e.width = t.width, e.height = t.height;
|
|
1917
1934
|
}
|
|
1918
|
-
},
|
|
1935
|
+
}, vt = {
|
|
1919
1936
|
"bc1-rgba-unorm": !0,
|
|
1920
1937
|
"bc1-rgba-unorm-srgb": !0,
|
|
1921
1938
|
"bc2-rgba-unorm": !0,
|
|
@@ -1972,12 +1989,12 @@ const gt = {
|
|
|
1972
1989
|
"astc-12x10-unorm-srgb": !0,
|
|
1973
1990
|
"astc-12x12-unorm": !0,
|
|
1974
1991
|
"astc-12x12-unorm-srgb": !0
|
|
1975
|
-
},
|
|
1992
|
+
}, Tt = {
|
|
1976
1993
|
id: "compressed",
|
|
1977
1994
|
upload(t, e, r) {
|
|
1978
1995
|
r.pixelStorei(r.UNPACK_ALIGNMENT, 4);
|
|
1979
1996
|
let s = t.pixelWidth, n = t.pixelHeight;
|
|
1980
|
-
const i = !!
|
|
1997
|
+
const i = !!vt[t.format];
|
|
1981
1998
|
for (let a = 0; a < t.resource.length; a++) {
|
|
1982
1999
|
const o = t.resource[a];
|
|
1983
2000
|
i ? r.compressedTexImage2D(
|
|
@@ -2001,11 +2018,11 @@ const gt = {
|
|
|
2001
2018
|
), s = Math.max(s >> 1, 1), n = Math.max(n >> 1, 1);
|
|
2002
2019
|
}
|
|
2003
2020
|
}
|
|
2004
|
-
},
|
|
2021
|
+
}, Se = {
|
|
2005
2022
|
id: "image",
|
|
2006
2023
|
upload(t, e, r, s) {
|
|
2007
|
-
const n = e.width, i = e.height, a = t.pixelWidth, o = t.pixelHeight,
|
|
2008
|
-
|
|
2024
|
+
const n = e.width, i = e.height, a = t.pixelWidth, o = t.pixelHeight, u = t.resourceWidth, c = t.resourceHeight;
|
|
2025
|
+
u < a || c < o ? ((n !== a || i !== o) && r.texImage2D(
|
|
2009
2026
|
e.target,
|
|
2010
2027
|
0,
|
|
2011
2028
|
e.internalFormat,
|
|
@@ -2020,8 +2037,8 @@ const gt = {
|
|
|
2020
2037
|
0,
|
|
2021
2038
|
0,
|
|
2022
2039
|
0,
|
|
2023
|
-
c,
|
|
2024
2040
|
u,
|
|
2041
|
+
c,
|
|
2025
2042
|
e.format,
|
|
2026
2043
|
e.type,
|
|
2027
2044
|
t.resource
|
|
@@ -2060,7 +2077,7 @@ const gt = {
|
|
|
2060
2077
|
t.resource
|
|
2061
2078
|
), e.width = a, e.height = o;
|
|
2062
2079
|
}
|
|
2063
|
-
},
|
|
2080
|
+
}, Bt = {
|
|
2064
2081
|
id: "video",
|
|
2065
2082
|
upload(t, e, r, s) {
|
|
2066
2083
|
if (!t.isValid) {
|
|
@@ -2077,12 +2094,12 @@ const gt = {
|
|
|
2077
2094
|
);
|
|
2078
2095
|
return;
|
|
2079
2096
|
}
|
|
2080
|
-
|
|
2097
|
+
Se.upload(t, e, r, s);
|
|
2081
2098
|
}
|
|
2082
|
-
},
|
|
2099
|
+
}, j = {
|
|
2083
2100
|
linear: 9729,
|
|
2084
2101
|
nearest: 9728
|
|
2085
|
-
},
|
|
2102
|
+
}, At = {
|
|
2086
2103
|
linear: {
|
|
2087
2104
|
linear: 9987,
|
|
2088
2105
|
nearest: 9985
|
|
@@ -2095,7 +2112,7 @@ const gt = {
|
|
|
2095
2112
|
"clamp-to-edge": 33071,
|
|
2096
2113
|
repeat: 10497,
|
|
2097
2114
|
"mirror-repeat": 33648
|
|
2098
|
-
},
|
|
2115
|
+
}, Nt = {
|
|
2099
2116
|
never: 512,
|
|
2100
2117
|
less: 513,
|
|
2101
2118
|
equal: 514,
|
|
@@ -2105,26 +2122,26 @@ const gt = {
|
|
|
2105
2122
|
"greater-equal": 518,
|
|
2106
2123
|
always: 519
|
|
2107
2124
|
};
|
|
2108
|
-
function
|
|
2109
|
-
const
|
|
2125
|
+
function K(t, e, r, s, n, i, a, o) {
|
|
2126
|
+
const u = i;
|
|
2110
2127
|
if (!o || t.addressModeU !== "repeat" || t.addressModeV !== "repeat" || t.addressModeW !== "repeat") {
|
|
2111
|
-
const
|
|
2112
|
-
e[n](
|
|
2128
|
+
const c = D[a ? "clamp-to-edge" : t.addressModeU], _ = D[a ? "clamp-to-edge" : t.addressModeV], h = D[a ? "clamp-to-edge" : t.addressModeW];
|
|
2129
|
+
e[n](u, e.TEXTURE_WRAP_S, c), e[n](u, e.TEXTURE_WRAP_T, _), e.TEXTURE_WRAP_R && e[n](u, e.TEXTURE_WRAP_R, h);
|
|
2113
2130
|
}
|
|
2114
|
-
if ((!o || t.magFilter !== "linear") && e[n](
|
|
2131
|
+
if ((!o || t.magFilter !== "linear") && e[n](u, e.TEXTURE_MAG_FILTER, j[t.magFilter]), r) {
|
|
2115
2132
|
if (!o || t.mipmapFilter !== "linear") {
|
|
2116
|
-
const
|
|
2117
|
-
e[n](
|
|
2133
|
+
const c = At[t.minFilter][t.mipmapFilter];
|
|
2134
|
+
e[n](u, e.TEXTURE_MIN_FILTER, c);
|
|
2118
2135
|
}
|
|
2119
2136
|
} else
|
|
2120
|
-
e[n](
|
|
2137
|
+
e[n](u, e.TEXTURE_MIN_FILTER, j[t.minFilter]);
|
|
2121
2138
|
if (s && t.maxAnisotropy > 1) {
|
|
2122
|
-
const
|
|
2123
|
-
e[n](
|
|
2139
|
+
const c = Math.min(t.maxAnisotropy, e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
|
|
2140
|
+
e[n](u, s.TEXTURE_MAX_ANISOTROPY_EXT, c);
|
|
2124
2141
|
}
|
|
2125
|
-
t.compare && e[n](
|
|
2142
|
+
t.compare && e[n](u, e.TEXTURE_COMPARE_FUNC, Nt[t.compare]);
|
|
2126
2143
|
}
|
|
2127
|
-
function
|
|
2144
|
+
function yt(t) {
|
|
2128
2145
|
return {
|
|
2129
2146
|
// 8-bit formats
|
|
2130
2147
|
r8unorm: t.RED,
|
|
@@ -2177,7 +2194,7 @@ function At(t) {
|
|
|
2177
2194
|
"depth32float-stencil8": t.DEPTH_STENCIL
|
|
2178
2195
|
};
|
|
2179
2196
|
}
|
|
2180
|
-
function
|
|
2197
|
+
function Ct(t, e) {
|
|
2181
2198
|
let r = {}, s = t.RGBA;
|
|
2182
2199
|
return t instanceof S.get().getWebGLRenderingContext() ? e.srgb && (r = {
|
|
2183
2200
|
"rgba8unorm-srgb": e.srgb.SRGB8_ALPHA8_EXT,
|
|
@@ -2301,7 +2318,7 @@ function Nt(t, e) {
|
|
|
2301
2318
|
} : {}
|
|
2302
2319
|
};
|
|
2303
2320
|
}
|
|
2304
|
-
function
|
|
2321
|
+
function Dt(t) {
|
|
2305
2322
|
return {
|
|
2306
2323
|
// 8-bit formats
|
|
2307
2324
|
r8unorm: t.UNSIGNED_BYTE,
|
|
@@ -2354,18 +2371,29 @@ function yt(t) {
|
|
|
2354
2371
|
"depth32float-stencil8": t.FLOAT_32_UNSIGNED_INT_24_8_REV
|
|
2355
2372
|
};
|
|
2356
2373
|
}
|
|
2357
|
-
const
|
|
2358
|
-
class
|
|
2374
|
+
const It = 4;
|
|
2375
|
+
class pe {
|
|
2359
2376
|
constructor(e) {
|
|
2360
|
-
this.
|
|
2361
|
-
image:
|
|
2362
|
-
buffer:
|
|
2363
|
-
video:
|
|
2364
|
-
compressed:
|
|
2365
|
-
}, this._premultiplyAlpha = !1, this._useSeparateSamplers = !1, this._renderer = e, this.
|
|
2377
|
+
this._glSamplers = /* @__PURE__ */ Object.create(null), this._boundTextures = [], this._activeTextureLocation = -1, this._boundSamplers = /* @__PURE__ */ Object.create(null), this._uploads = {
|
|
2378
|
+
image: Se,
|
|
2379
|
+
buffer: xt,
|
|
2380
|
+
video: Bt,
|
|
2381
|
+
compressed: Tt
|
|
2382
|
+
}, this._premultiplyAlpha = !1, this._useSeparateSamplers = !1, this._renderer = e, this._managedTextures = new U({
|
|
2383
|
+
renderer: e,
|
|
2384
|
+
type: "resource",
|
|
2385
|
+
onUnload: this.onSourceUnload.bind(this),
|
|
2386
|
+
name: "glTexture"
|
|
2387
|
+
});
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* @deprecated since 8.15.0
|
|
2391
|
+
*/
|
|
2392
|
+
get managedTextures() {
|
|
2393
|
+
return Object.values(this._managedTextures.items);
|
|
2366
2394
|
}
|
|
2367
2395
|
contextChange(e) {
|
|
2368
|
-
this._gl = e, this._mapFormatToInternalFormat || (this._mapFormatToInternalFormat =
|
|
2396
|
+
this._gl = e, this._mapFormatToInternalFormat || (this._mapFormatToInternalFormat = Ct(e, this._renderer.context.extensions), this._mapFormatToType = Dt(e), this._mapFormatToFormat = yt(e)), this._managedTextures.removeAll(!0), this._glSamplers = /* @__PURE__ */ Object.create(null), this._boundSamplers = /* @__PURE__ */ Object.create(null), this._premultiplyAlpha = !1;
|
|
2369
2397
|
for (let r = 0; r < 16; r++)
|
|
2370
2398
|
this.bind(b.EMPTY, r);
|
|
2371
2399
|
}
|
|
@@ -2383,7 +2411,7 @@ class Se {
|
|
|
2383
2411
|
}
|
|
2384
2412
|
bindSource(e, r = 0) {
|
|
2385
2413
|
const s = this._gl;
|
|
2386
|
-
if (e.
|
|
2414
|
+
if (e._gcLastUsed = this._renderer.gc.now, this._boundTextures[r] !== e) {
|
|
2387
2415
|
this._boundTextures[r] = e, this._activateLocation(r), e || (e = b.EMPTY.source);
|
|
2388
2416
|
const n = this.getGlSource(e);
|
|
2389
2417
|
s.bindTexture(n.target, n.texture);
|
|
@@ -2411,19 +2439,19 @@ class Se {
|
|
|
2411
2439
|
this._activeTextureLocation !== e && (this._activeTextureLocation = e, this._gl.activeTexture(this._gl.TEXTURE0 + e));
|
|
2412
2440
|
}
|
|
2413
2441
|
_initSource(e) {
|
|
2414
|
-
const r = this._gl, s = new
|
|
2442
|
+
const r = this._gl, s = new Rt(r.createTexture());
|
|
2415
2443
|
if (s.type = this._mapFormatToType[e.format], s.internalFormat = this._mapFormatToInternalFormat[e.format], s.format = this._mapFormatToFormat[e.format], e.autoGenerateMipmaps && (this._renderer.context.supports.nonPowOf2mipmaps || e.isPowerOfTwo)) {
|
|
2416
|
-
const
|
|
2417
|
-
e.mipLevelCount = Math.floor(Math.log2(
|
|
2444
|
+
const i = Math.max(e.width, e.height);
|
|
2445
|
+
e.mipLevelCount = Math.floor(Math.log2(i)) + 1;
|
|
2418
2446
|
}
|
|
2419
|
-
return
|
|
2447
|
+
return e._gpuData[this._renderer.uid] = s, this._managedTextures.add(e) && (e.on("update", this.onSourceUpdate, this), e.on("resize", this.onSourceUpdate, this), e.on("styleChange", this.onStyleChange, this), e.on("updateMipmaps", this.onUpdateMipmaps, this)), this.onSourceUpdate(e), this.updateStyle(e, !1), s;
|
|
2420
2448
|
}
|
|
2421
2449
|
onStyleChange(e) {
|
|
2422
2450
|
this.updateStyle(e, !1);
|
|
2423
2451
|
}
|
|
2424
2452
|
updateStyle(e, r) {
|
|
2425
2453
|
const s = this._gl, n = this.getGlSource(e);
|
|
2426
|
-
s.bindTexture(s.TEXTURE_2D, n.texture), this._boundTextures[this._activeTextureLocation] = e,
|
|
2454
|
+
s.bindTexture(s.TEXTURE_2D, n.texture), this._boundTextures[this._activeTextureLocation] = e, K(
|
|
2427
2455
|
e.style,
|
|
2428
2456
|
s,
|
|
2429
2457
|
e.mipLevelCount > 1,
|
|
@@ -2435,27 +2463,34 @@ class Se {
|
|
|
2435
2463
|
r
|
|
2436
2464
|
);
|
|
2437
2465
|
}
|
|
2438
|
-
onSourceUnload(e) {
|
|
2439
|
-
const
|
|
2440
|
-
|
|
2466
|
+
onSourceUnload(e, r = !1) {
|
|
2467
|
+
const s = e._gpuData[this._renderer.uid];
|
|
2468
|
+
s && (r || (this.unbind(e), this._gl.deleteTexture(s.texture)), e.off("update", this.onSourceUpdate, this), e.off("resize", this.onSourceUpdate, this), e.off("styleChange", this.onStyleChange, this), e.off("updateMipmaps", this.onUpdateMipmaps, this));
|
|
2441
2469
|
}
|
|
2442
2470
|
onSourceUpdate(e) {
|
|
2443
2471
|
const r = this._gl, s = this.getGlSource(e);
|
|
2444
2472
|
r.bindTexture(r.TEXTURE_2D, s.texture), this._boundTextures[this._activeTextureLocation] = e;
|
|
2445
2473
|
const n = e.alphaMode === "premultiply-alpha-on-upload";
|
|
2446
|
-
this._premultiplyAlpha !== n && (this._premultiplyAlpha = n, r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n)), this._uploads[e.uploadMethodId] ? this._uploads[e.uploadMethodId].upload(e, s, r, this._renderer.context.webGLVersion) : r.texImage2D(
|
|
2474
|
+
this._premultiplyAlpha !== n && (this._premultiplyAlpha = n, r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n)), this._uploads[e.uploadMethodId] ? this._uploads[e.uploadMethodId].upload(e, s, r, this._renderer.context.webGLVersion) : r.texImage2D(
|
|
2475
|
+
r.TEXTURE_2D,
|
|
2476
|
+
0,
|
|
2477
|
+
s.internalFormat,
|
|
2478
|
+
e.pixelWidth,
|
|
2479
|
+
e.pixelHeight,
|
|
2480
|
+
0,
|
|
2481
|
+
s.format,
|
|
2482
|
+
s.type,
|
|
2483
|
+
null
|
|
2484
|
+
), e.autoGenerateMipmaps && e.mipLevelCount > 1 && this.onUpdateMipmaps(e, !1);
|
|
2447
2485
|
}
|
|
2448
2486
|
onUpdateMipmaps(e, r = !0) {
|
|
2449
2487
|
r && this.bindSource(e, 0);
|
|
2450
2488
|
const s = this.getGlSource(e);
|
|
2451
2489
|
this._gl.generateMipmap(s.target);
|
|
2452
2490
|
}
|
|
2453
|
-
onSourceDestroy(e) {
|
|
2454
|
-
e.off("destroy", this.onSourceDestroy, this), e.off("update", this.onSourceUpdate, this), e.off("resize", this.onSourceUpdate, this), e.off("unload", this.onSourceUnload, this), e.off("styleChange", this.onStyleChange, this), e.off("updateMipmaps", this.onUpdateMipmaps, this), this.managedTextures.splice(this.managedTextures.indexOf(e), 1), this.onSourceUnload(e);
|
|
2455
|
-
}
|
|
2456
2491
|
_initSampler(e) {
|
|
2457
2492
|
const r = this._gl, s = this._gl.createSampler();
|
|
2458
|
-
return this._glSamplers[e._resourceId] = s,
|
|
2493
|
+
return this._glSamplers[e._resourceId] = s, K(
|
|
2459
2494
|
e,
|
|
2460
2495
|
r,
|
|
2461
2496
|
this._boundTextures[this._activeTextureLocation].mipLevelCount > 1,
|
|
@@ -2470,7 +2505,7 @@ class Se {
|
|
|
2470
2505
|
return this._glSamplers[e._resourceId] || this._initSampler(e);
|
|
2471
2506
|
}
|
|
2472
2507
|
getGlSource(e) {
|
|
2473
|
-
return this.
|
|
2508
|
+
return e._gcLastUsed = this._renderer.gc.now, e._gpuData[this._renderer.uid] || this._initSource(e);
|
|
2474
2509
|
}
|
|
2475
2510
|
generateCanvas(e) {
|
|
2476
2511
|
const { pixels: r, width: s, height: n } = this.getPixels(e), i = S.get().createCanvas();
|
|
@@ -2483,8 +2518,8 @@ class Se {
|
|
|
2483
2518
|
return i;
|
|
2484
2519
|
}
|
|
2485
2520
|
getPixels(e) {
|
|
2486
|
-
const r = e.source.resolution, s = e.frame, n = Math.max(Math.round(s.width * r), 1), i = Math.max(Math.round(s.height * r), 1), a = new Uint8Array(
|
|
2487
|
-
return _.bindFramebuffer(_.FRAMEBUFFER,
|
|
2521
|
+
const r = e.source.resolution, s = e.frame, n = Math.max(Math.round(s.width * r), 1), i = Math.max(Math.round(s.height * r), 1), a = new Uint8Array(It * n * i), o = this._renderer, u = o.renderTarget.getRenderTarget(e), c = o.renderTarget.getGpuRenderTarget(u), _ = o.gl;
|
|
2522
|
+
return _.bindFramebuffer(_.FRAMEBUFFER, c.resolveTargetFramebuffer), _.readPixels(
|
|
2488
2523
|
Math.round(s.x * r),
|
|
2489
2524
|
Math.round(s.y * r),
|
|
2490
2525
|
n,
|
|
@@ -2495,7 +2530,7 @@ class Se {
|
|
|
2495
2530
|
), { pixels: new Uint8ClampedArray(a.buffer), width: n, height: i };
|
|
2496
2531
|
}
|
|
2497
2532
|
destroy() {
|
|
2498
|
-
this.
|
|
2533
|
+
this._managedTextures.destroy(), this._glSamplers = null, this._boundTextures = null, this._boundSamplers = null, this._mapFormatToInternalFormat = null, this._mapFormatToType = null, this._mapFormatToFormat = null, this._uploads = null, this._renderer = null;
|
|
2499
2534
|
}
|
|
2500
2535
|
resetState() {
|
|
2501
2536
|
this._activeTextureLocation = -1, this._boundTextures.fill(b.EMPTY.source), this._boundSamplers = /* @__PURE__ */ Object.create(null);
|
|
@@ -2503,48 +2538,48 @@ class Se {
|
|
|
2503
2538
|
this._premultiplyAlpha = !1, e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this._premultiplyAlpha);
|
|
2504
2539
|
}
|
|
2505
2540
|
}
|
|
2506
|
-
|
|
2541
|
+
pe.extension = {
|
|
2507
2542
|
type: [
|
|
2508
2543
|
d.WebGLSystem
|
|
2509
2544
|
],
|
|
2510
2545
|
name: "texture"
|
|
2511
2546
|
};
|
|
2512
|
-
class
|
|
2547
|
+
class ge {
|
|
2513
2548
|
contextChange(e) {
|
|
2514
|
-
const r = new
|
|
2549
|
+
const r = new O({
|
|
2515
2550
|
uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
|
|
2516
|
-
uTransformMatrix: { value: new
|
|
2551
|
+
uTransformMatrix: { value: new Y(), type: "mat3x3<f32>" },
|
|
2517
2552
|
uRound: { value: 0, type: "f32" }
|
|
2518
|
-
}), s = e.limits.maxBatchableTextures, n =
|
|
2553
|
+
}), s = e.limits.maxBatchableTextures, n = q({
|
|
2519
2554
|
name: "graphics",
|
|
2520
2555
|
bits: [
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2556
|
+
Ce,
|
|
2557
|
+
De(s),
|
|
2558
|
+
Q,
|
|
2559
|
+
Z
|
|
2525
2560
|
]
|
|
2526
2561
|
});
|
|
2527
|
-
this.shader = new
|
|
2562
|
+
this.shader = new F({
|
|
2528
2563
|
glProgram: n,
|
|
2529
2564
|
resources: {
|
|
2530
2565
|
localUniforms: r,
|
|
2531
|
-
batchSamplers:
|
|
2566
|
+
batchSamplers: Ie(s)
|
|
2532
2567
|
}
|
|
2533
2568
|
});
|
|
2534
2569
|
}
|
|
2535
2570
|
execute(e, r) {
|
|
2536
2571
|
const s = r.context, n = s.customShader || this.shader, i = e.renderer, a = i.graphicsContext, {
|
|
2537
2572
|
batcher: o,
|
|
2538
|
-
instructions:
|
|
2573
|
+
instructions: u
|
|
2539
2574
|
} = a.getContextRenderData(s);
|
|
2540
2575
|
n.groups[0] = i.globalUniforms.bindGroup, i.state.set(e.state), i.shader.bind(n), i.geometry.bind(o.geometry, n.glProgram);
|
|
2541
|
-
const
|
|
2542
|
-
for (let _ = 0; _ <
|
|
2543
|
-
const
|
|
2544
|
-
if (
|
|
2545
|
-
for (let l = 0; l <
|
|
2546
|
-
i.texture.bind(
|
|
2547
|
-
i.geometry.draw(
|
|
2576
|
+
const c = u.instructions;
|
|
2577
|
+
for (let _ = 0; _ < u.instructionSize; _++) {
|
|
2578
|
+
const h = c[_];
|
|
2579
|
+
if (h.size) {
|
|
2580
|
+
for (let l = 0; l < h.textures.count; l++)
|
|
2581
|
+
i.texture.bind(h.textures.textures[l], l);
|
|
2582
|
+
i.geometry.draw(h.topology, h.size, h.start);
|
|
2548
2583
|
}
|
|
2549
2584
|
}
|
|
2550
2585
|
}
|
|
@@ -2552,28 +2587,28 @@ class pe {
|
|
|
2552
2587
|
this.shader.destroy(!0), this.shader = null;
|
|
2553
2588
|
}
|
|
2554
2589
|
}
|
|
2555
|
-
|
|
2590
|
+
ge.extension = {
|
|
2556
2591
|
type: [
|
|
2557
2592
|
d.WebGLPipesAdaptor
|
|
2558
2593
|
],
|
|
2559
2594
|
name: "graphics"
|
|
2560
2595
|
};
|
|
2561
|
-
class
|
|
2596
|
+
class Re {
|
|
2562
2597
|
init() {
|
|
2563
|
-
const e =
|
|
2598
|
+
const e = q({
|
|
2564
2599
|
name: "mesh",
|
|
2565
2600
|
bits: [
|
|
2566
|
-
|
|
2601
|
+
Q,
|
|
2567
2602
|
He,
|
|
2568
|
-
|
|
2603
|
+
Z
|
|
2569
2604
|
]
|
|
2570
2605
|
});
|
|
2571
|
-
this._shader = new
|
|
2606
|
+
this._shader = new F({
|
|
2572
2607
|
glProgram: e,
|
|
2573
2608
|
resources: {
|
|
2574
2609
|
uTexture: b.EMPTY.source,
|
|
2575
2610
|
textureUniforms: {
|
|
2576
|
-
uTextureMatrix: { type: "mat3x3<f32>", value: new
|
|
2611
|
+
uTextureMatrix: { type: "mat3x3<f32>", value: new Y() }
|
|
2577
2612
|
}
|
|
2578
2613
|
}
|
|
2579
2614
|
});
|
|
@@ -2601,45 +2636,45 @@ class ge {
|
|
|
2601
2636
|
this._shader.destroy(!0), this._shader = null;
|
|
2602
2637
|
}
|
|
2603
2638
|
}
|
|
2604
|
-
|
|
2639
|
+
Re.extension = {
|
|
2605
2640
|
type: [
|
|
2606
2641
|
d.WebGLPipesAdaptor
|
|
2607
2642
|
],
|
|
2608
2643
|
name: "mesh"
|
|
2609
2644
|
};
|
|
2610
|
-
const
|
|
2611
|
-
...
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2645
|
+
const Gt = [
|
|
2646
|
+
...ke,
|
|
2647
|
+
fe,
|
|
2648
|
+
Ye,
|
|
2649
|
+
We,
|
|
2650
|
+
ce,
|
|
2651
|
+
te,
|
|
2652
|
+
pe,
|
|
2618
2653
|
he,
|
|
2619
|
-
|
|
2654
|
+
ne,
|
|
2655
|
+
Ee,
|
|
2620
2656
|
me,
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
class Pt extends Ie {
|
|
2657
|
+
oe,
|
|
2658
|
+
gt,
|
|
2659
|
+
ue,
|
|
2660
|
+
ae
|
|
2661
|
+
], Ut = [...Ve], Ft = [ee, Re, ge], xe = [], ve = [], Te = [];
|
|
2662
|
+
v.handleByNamedList(d.WebGLSystem, xe);
|
|
2663
|
+
v.handleByNamedList(d.WebGLPipes, ve);
|
|
2664
|
+
v.handleByNamedList(d.WebGLPipesAdaptor, Te);
|
|
2665
|
+
v.add(...Gt, ...Ut, ...Ft);
|
|
2666
|
+
class Lt extends Ge {
|
|
2632
2667
|
constructor() {
|
|
2633
2668
|
const e = {
|
|
2634
2669
|
name: "webgl",
|
|
2635
|
-
type:
|
|
2636
|
-
systems:
|
|
2637
|
-
renderPipes:
|
|
2670
|
+
type: Ue.WEBGL,
|
|
2671
|
+
systems: xe,
|
|
2672
|
+
renderPipes: ve,
|
|
2638
2673
|
renderPipeAdaptors: Te
|
|
2639
2674
|
};
|
|
2640
2675
|
super(e);
|
|
2641
2676
|
}
|
|
2642
2677
|
}
|
|
2643
2678
|
export {
|
|
2644
|
-
|
|
2679
|
+
Lt as WebGLRenderer
|
|
2645
2680
|
};
|