@eva/plugin-renderer 1.2.7-editor.6 → 1.2.7-editor.9
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/package.json +3 -3
- package/dist/miniprogram.js +0 -1046
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer",
|
|
3
|
-
"version": "1.2.7-editor.
|
|
3
|
+
"version": "1.2.7-editor.9",
|
|
4
4
|
"description": "@eva/plugin-renderer",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer.esm.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/eva.js": "1.2.7-editor.
|
|
22
|
-
"@eva/renderer-adapter": "1.2.7-editor.
|
|
21
|
+
"@eva/eva.js": "1.2.7-editor.9",
|
|
22
|
+
"@eva/renderer-adapter": "1.2.7-editor.9",
|
|
23
23
|
"@types/pixi.js": "^4.8.9",
|
|
24
24
|
"eventemitter3": "^3.1.2",
|
|
25
25
|
"lodash-es": "^4.17.21",
|
package/dist/miniprogram.js
DELETED
|
@@ -1,1046 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
import { __values, __extends, __decorate, __metadata, __spread, __assign } from 'tslib';
|
|
4
|
-
import { OBSERVER_TYPE, decorators, resourceLoader, resource, RESOURCE_TYPE_STRATEGY, LOAD_SCENE_MODE, System } from '@eva/eva.js/dist/miniprogram';
|
|
5
|
-
import { Container, Application } from '@eva/renderer-adapter/dist/miniprogram';
|
|
6
|
-
import isEqual from 'lodash-es/isEqual';
|
|
7
|
-
import EventEmitter from 'eventemitter3';
|
|
8
|
-
import { glCore, Texture, BaseTexture, utils, ticker } from '@eva/miniprogram-pixi';
|
|
9
|
-
|
|
10
|
-
var RendererManager = function () {
|
|
11
|
-
function RendererManager(_a) {
|
|
12
|
-
var game = _a.game,
|
|
13
|
-
rendererSystem = _a.rendererSystem;
|
|
14
|
-
this.renderers = [];
|
|
15
|
-
this.game = game;
|
|
16
|
-
this.rendererSystem = rendererSystem;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
RendererManager.prototype.register = function () {
|
|
20
|
-
var e_1, _a;
|
|
21
|
-
|
|
22
|
-
var renderers = [];
|
|
23
|
-
|
|
24
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
25
|
-
renderers[_i] = arguments[_i];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
for (var renderers_1 = __values(renderers), renderers_1_1 = renderers_1.next(); !renderers_1_1.done; renderers_1_1 = renderers_1.next()) {
|
|
30
|
-
var renderer = renderers_1_1.value;
|
|
31
|
-
renderer.game = this.game;
|
|
32
|
-
renderer.rendererManager = this.rendererSystem.rendererManager;
|
|
33
|
-
renderer.containerManager = this.rendererSystem.containerManager;
|
|
34
|
-
this.renderers.push(renderer);
|
|
35
|
-
}
|
|
36
|
-
} catch (e_1_1) {
|
|
37
|
-
e_1 = {
|
|
38
|
-
error: e_1_1
|
|
39
|
-
};
|
|
40
|
-
} finally {
|
|
41
|
-
try {
|
|
42
|
-
if (renderers_1_1 && !renderers_1_1.done && (_a = renderers_1.return)) _a.call(renderers_1);
|
|
43
|
-
} finally {
|
|
44
|
-
if (e_1) throw e_1.error;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
RendererManager.prototype.componentChanged = function (changes) {
|
|
50
|
-
var e_2, _a;
|
|
51
|
-
|
|
52
|
-
var _loop_1 = function _loop_1(changed) {
|
|
53
|
-
var e_3, _a;
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
for (var _b = (e_3 = void 0, __values(this_1.renderers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
57
|
-
var renderer = _c.value;
|
|
58
|
-
var props = renderer.observerInfo[changed.componentName];
|
|
59
|
-
|
|
60
|
-
if (props) {
|
|
61
|
-
if ([OBSERVER_TYPE.ADD, OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {
|
|
62
|
-
try {
|
|
63
|
-
renderer.componentChanged && renderer.componentChanged(changed);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
console.error("gameObject: " + changed.gameObject.name + ", " + changed.componentName + " is error.", changed, e);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var index = props.findIndex(function (prop) {
|
|
72
|
-
return isEqual(prop, changed.prop);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
if (index > -1) {
|
|
76
|
-
try {
|
|
77
|
-
renderer.componentChanged && renderer.componentChanged(changed);
|
|
78
|
-
} catch (e) {
|
|
79
|
-
console.error("gameObject: " + (changed.gameObject && changed.gameObject.name) + ", " + changed.componentName + " is componentChanged error.", changed, e);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
} catch (e_3_1) {
|
|
85
|
-
e_3 = {
|
|
86
|
-
error: e_3_1
|
|
87
|
-
};
|
|
88
|
-
} finally {
|
|
89
|
-
try {
|
|
90
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
91
|
-
} finally {
|
|
92
|
-
if (e_3) throw e_3.error;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
var this_1 = this;
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
|
|
101
|
-
var changed = changes_1_1.value;
|
|
102
|
-
|
|
103
|
-
_loop_1(changed);
|
|
104
|
-
}
|
|
105
|
-
} catch (e_2_1) {
|
|
106
|
-
e_2 = {
|
|
107
|
-
error: e_2_1
|
|
108
|
-
};
|
|
109
|
-
} finally {
|
|
110
|
-
try {
|
|
111
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
112
|
-
} finally {
|
|
113
|
-
if (e_2) throw e_2.error;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
RendererManager.prototype.update = function (gameObject) {
|
|
119
|
-
var e_4, _a, e_5, _b;
|
|
120
|
-
|
|
121
|
-
try {
|
|
122
|
-
for (var _c = __values(gameObject.components), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
123
|
-
var component = _d.value;
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
for (var _e = (e_5 = void 0, __values(this.renderers)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
127
|
-
var renderer = _f.value;
|
|
128
|
-
var cache = [];
|
|
129
|
-
var props = renderer.observerInfo[component.name];
|
|
130
|
-
|
|
131
|
-
if (props && cache.indexOf(gameObject) === -1) {
|
|
132
|
-
cache.push(gameObject);
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
renderer.rendererUpdate && renderer.rendererUpdate(gameObject);
|
|
136
|
-
} catch (e) {
|
|
137
|
-
console.info("gameObject: " + gameObject.name + ", " + component.name + " is update error", e);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
} catch (e_5_1) {
|
|
142
|
-
e_5 = {
|
|
143
|
-
error: e_5_1
|
|
144
|
-
};
|
|
145
|
-
} finally {
|
|
146
|
-
try {
|
|
147
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
148
|
-
} finally {
|
|
149
|
-
if (e_5) throw e_5.error;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
} catch (e_4_1) {
|
|
154
|
-
e_4 = {
|
|
155
|
-
error: e_4_1
|
|
156
|
-
};
|
|
157
|
-
} finally {
|
|
158
|
-
try {
|
|
159
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
160
|
-
} finally {
|
|
161
|
-
if (e_4) throw e_4.error;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
return RendererManager;
|
|
167
|
-
}();
|
|
168
|
-
|
|
169
|
-
var RendererManager$1 = RendererManager;
|
|
170
|
-
|
|
171
|
-
var ContainerManager = function () {
|
|
172
|
-
function ContainerManager() {
|
|
173
|
-
this.containerMap = {};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
ContainerManager.prototype.addContainer = function (_a) {
|
|
177
|
-
var name = _a.name,
|
|
178
|
-
container = _a.container;
|
|
179
|
-
this.containerMap[name] = container;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
ContainerManager.prototype.getContainer = function (name) {
|
|
183
|
-
return this.containerMap[name];
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
ContainerManager.prototype.removeContainer = function (name) {
|
|
187
|
-
var _a;
|
|
188
|
-
|
|
189
|
-
(_a = this.containerMap[name]) === null || _a === void 0 ? void 0 : _a.destroy({
|
|
190
|
-
children: true
|
|
191
|
-
});
|
|
192
|
-
delete this.containerMap[name];
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
ContainerManager.prototype.updateTransform = function (_a) {
|
|
196
|
-
var name = _a.name,
|
|
197
|
-
transform = _a.transform;
|
|
198
|
-
var container = this.containerMap[name];
|
|
199
|
-
if (!container || !transform) return;
|
|
200
|
-
var anchor = transform.anchor,
|
|
201
|
-
origin = transform.origin,
|
|
202
|
-
position = transform.position,
|
|
203
|
-
rotation = transform.rotation,
|
|
204
|
-
scale = transform.scale,
|
|
205
|
-
size = transform.size,
|
|
206
|
-
skew = transform.skew;
|
|
207
|
-
container.rotation = rotation;
|
|
208
|
-
container.scale = scale;
|
|
209
|
-
container.pivot.x = size.width * origin.x;
|
|
210
|
-
container.pivot.y = size.height * origin.y;
|
|
211
|
-
container.skew = skew;
|
|
212
|
-
var x = position.x;
|
|
213
|
-
var y = position.y;
|
|
214
|
-
|
|
215
|
-
if (transform.parent) {
|
|
216
|
-
var parent_1 = transform.parent;
|
|
217
|
-
x = x + parent_1.size.width * anchor.x;
|
|
218
|
-
y = y + parent_1.size.height * anchor.y;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
container.position = {
|
|
222
|
-
x: x,
|
|
223
|
-
y: y
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
return ContainerManager;
|
|
228
|
-
}();
|
|
229
|
-
|
|
230
|
-
var ContainerManager$1 = ContainerManager;
|
|
231
|
-
|
|
232
|
-
var Transform = function (_super) {
|
|
233
|
-
__extends(Transform, _super);
|
|
234
|
-
|
|
235
|
-
function Transform(_a) {
|
|
236
|
-
var system = _a.system,
|
|
237
|
-
containerManager = _a.containerManager;
|
|
238
|
-
|
|
239
|
-
var _this = _super.call(this) || this;
|
|
240
|
-
|
|
241
|
-
_this.name = 'Transform';
|
|
242
|
-
_this.waitRemoveIds = [];
|
|
243
|
-
_this.waitChangeScenes = [];
|
|
244
|
-
_this.containerManager = containerManager;
|
|
245
|
-
|
|
246
|
-
_this.init(system);
|
|
247
|
-
|
|
248
|
-
return _this;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
Transform.prototype.init = function (system) {
|
|
252
|
-
var _this = this;
|
|
253
|
-
|
|
254
|
-
this.system = system;
|
|
255
|
-
this.on('changeScene', function (_a) {
|
|
256
|
-
var scene = _a.scene,
|
|
257
|
-
mode = _a.mode,
|
|
258
|
-
application = _a.application;
|
|
259
|
-
|
|
260
|
-
_this.waitChangeScenes.push({
|
|
261
|
-
scene: scene,
|
|
262
|
-
mode: mode,
|
|
263
|
-
application: application
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
Transform.prototype.update = function () {
|
|
269
|
-
var e_1, _a, e_2, _b;
|
|
270
|
-
|
|
271
|
-
try {
|
|
272
|
-
for (var _c = __values(this.waitRemoveIds), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
273
|
-
var id = _d.value;
|
|
274
|
-
this.containerManager.removeContainer(id);
|
|
275
|
-
}
|
|
276
|
-
} catch (e_1_1) {
|
|
277
|
-
e_1 = {
|
|
278
|
-
error: e_1_1
|
|
279
|
-
};
|
|
280
|
-
} finally {
|
|
281
|
-
try {
|
|
282
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
283
|
-
} finally {
|
|
284
|
-
if (e_1) throw e_1.error;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
this.waitRemoveIds = [];
|
|
289
|
-
|
|
290
|
-
try {
|
|
291
|
-
for (var _e = __values(this.waitChangeScenes), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
292
|
-
var sceneInfo = _f.value;
|
|
293
|
-
var container = this.containerManager.getContainer(sceneInfo.scene.id);
|
|
294
|
-
|
|
295
|
-
if (container) {
|
|
296
|
-
sceneInfo.application.stage.removeChildren();
|
|
297
|
-
sceneInfo.application.stage.addChild(container);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
} catch (e_2_1) {
|
|
301
|
-
e_2 = {
|
|
302
|
-
error: e_2_1
|
|
303
|
-
};
|
|
304
|
-
} finally {
|
|
305
|
-
try {
|
|
306
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
307
|
-
} finally {
|
|
308
|
-
if (e_2) throw e_2.error;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
this.waitChangeScenes = [];
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
Transform.prototype.componentChanged = function (changed) {
|
|
316
|
-
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
317
|
-
this.addContainer(changed);
|
|
318
|
-
} else if (changed.type === OBSERVER_TYPE.CHANGE) {
|
|
319
|
-
this.change(changed);
|
|
320
|
-
} else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
321
|
-
this.waitRemoveIds.push(changed.gameObject.id);
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
Transform.prototype.addContainer = function (changed) {
|
|
326
|
-
var container = new Container();
|
|
327
|
-
container.name = changed.gameObject.name;
|
|
328
|
-
this.containerManager.addContainer({
|
|
329
|
-
name: changed.gameObject.id,
|
|
330
|
-
container: container
|
|
331
|
-
});
|
|
332
|
-
var transform = changed.component;
|
|
333
|
-
transform.worldTransform = container.transform.worldTransform;
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
Transform.prototype.change = function (changed) {
|
|
337
|
-
var transform = changed.component;
|
|
338
|
-
|
|
339
|
-
if (transform.parent) {
|
|
340
|
-
var parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id);
|
|
341
|
-
|
|
342
|
-
if (transform.childIndex > -1) {
|
|
343
|
-
parentContainer.addChildAt(this.containerManager.getContainer(changed.gameObject.id), transform.childIndex);
|
|
344
|
-
transform.childIndex = -1;
|
|
345
|
-
} else {
|
|
346
|
-
parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id));
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
var render = changed.gameObject.transform.parent && changed.gameObject.transform.parent.gameObject.getComponent('Render');
|
|
350
|
-
|
|
351
|
-
if (render) {
|
|
352
|
-
render.sortDirty = true;
|
|
353
|
-
}
|
|
354
|
-
} else {
|
|
355
|
-
var container = this.containerManager.getContainer(changed.gameObject.id);
|
|
356
|
-
delete transform.worldTransform;
|
|
357
|
-
container.parent && container.parent.removeChild(container);
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
Transform.prototype.destroy = function () {
|
|
362
|
-
this.removeAllListeners();
|
|
363
|
-
this.waitRemoveIds = null;
|
|
364
|
-
this.waitChangeScenes = null;
|
|
365
|
-
this.system = null;
|
|
366
|
-
this.containerManager = null;
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
Transform = __decorate([decorators.componentObserver({
|
|
370
|
-
Transform: ['_parent']
|
|
371
|
-
}), __metadata("design:paramtypes", [Object])], Transform);
|
|
372
|
-
return Transform;
|
|
373
|
-
}(EventEmitter);
|
|
374
|
-
|
|
375
|
-
var Transform$1 = Transform;
|
|
376
|
-
var result = undefined;
|
|
377
|
-
|
|
378
|
-
function getSuportCompressedTextureFormats(gl) {
|
|
379
|
-
if (result) return result;
|
|
380
|
-
|
|
381
|
-
if (!gl) {
|
|
382
|
-
console.warn('WebGL not available for compressed textures. Silently failing.');
|
|
383
|
-
return {
|
|
384
|
-
s3tc: false,
|
|
385
|
-
etc: false,
|
|
386
|
-
etc1: false,
|
|
387
|
-
pvrtc: false,
|
|
388
|
-
atc: false,
|
|
389
|
-
astc: false
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
result = {
|
|
394
|
-
s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'),
|
|
395
|
-
etc: !!gl.getExtension('WEBGL_compressed_texture_etc'),
|
|
396
|
-
etc1: !!gl.getExtension('WEBGL_compressed_texture_etc1'),
|
|
397
|
-
pvrtc: !!gl.getExtension('WEBGL_compressed_texture_pvrtc') || !!gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),
|
|
398
|
-
atc: !!gl.getExtension('WEBGL_compressed_texture_atc'),
|
|
399
|
-
astc: !!gl.getExtension('WEBGL_compressed_texture_astc')
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
try {
|
|
403
|
-
console.log('Eva.js Supported Compressed Texture Format List: ' + Object.keys(result).filter(function (type) {
|
|
404
|
-
return result[type];
|
|
405
|
-
}).join(', '));
|
|
406
|
-
} catch (e) {}
|
|
407
|
-
|
|
408
|
-
return result;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
var XLS = resourceLoader.XhrLoadStrategy;
|
|
412
|
-
var XhrLoadStrategy = XLS;
|
|
413
|
-
|
|
414
|
-
var _a, _b;
|
|
415
|
-
|
|
416
|
-
var INTERNAL_FORMATS;
|
|
417
|
-
|
|
418
|
-
(function (INTERNAL_FORMATS) {
|
|
419
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_S3TC_DXT1_EXT"] = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT";
|
|
420
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_S3TC_DXT1_EXT"] = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT";
|
|
421
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_S3TC_DXT3_EXT"] = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT";
|
|
422
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_S3TC_DXT5_EXT"] = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT";
|
|
423
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"] = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
|
|
424
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"] = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
|
|
425
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"] = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
|
|
426
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_S3TC_DXT1_EXT"] = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT";
|
|
427
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_R11_EAC"] = 37488] = "COMPRESSED_R11_EAC";
|
|
428
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SIGNED_R11_EAC"] = 37489] = "COMPRESSED_SIGNED_R11_EAC";
|
|
429
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RG11_EAC"] = 37490] = "COMPRESSED_RG11_EAC";
|
|
430
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SIGNED_RG11_EAC"] = 37491] = "COMPRESSED_SIGNED_RG11_EAC";
|
|
431
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB8_ETC2"] = 37492] = "COMPRESSED_RGB8_ETC2";
|
|
432
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA8_ETC2_EAC"] = 37496] = "COMPRESSED_RGBA8_ETC2_EAC";
|
|
433
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ETC2"] = 37493] = "COMPRESSED_SRGB8_ETC2";
|
|
434
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"] = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
|
|
435
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
|
|
436
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
|
|
437
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_PVRTC_4BPPV1_IMG"] = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
|
|
438
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"] = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
|
|
439
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_PVRTC_2BPPV1_IMG"] = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
|
|
440
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"] = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
|
|
441
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_ETC1_WEBGL"] = 36196] = "COMPRESSED_RGB_ETC1_WEBGL";
|
|
442
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_ATC_WEBGL"] = 35986] = "COMPRESSED_RGB_ATC_WEBGL";
|
|
443
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"] = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL";
|
|
444
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"] = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL";
|
|
445
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x10_KHR"] = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR";
|
|
446
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x5_KHR"] = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR";
|
|
447
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x6_KHR"] = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR";
|
|
448
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x8_KHR"] = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR";
|
|
449
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_12x10_KHR"] = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR";
|
|
450
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_12x12_KHR"] = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR";
|
|
451
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_4x4_KHR"] = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR";
|
|
452
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_5x4_KHR"] = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR";
|
|
453
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_5x5_KHR"] = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR";
|
|
454
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_6x5_KHR"] = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR";
|
|
455
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_6x6_KHR"] = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR";
|
|
456
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_8x5_KHR"] = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR";
|
|
457
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_8x6_KHR"] = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR";
|
|
458
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_8x8_KHR"] = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR";
|
|
459
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR"] = 3781] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
|
|
460
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR"] = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR";
|
|
461
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR"] = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR";
|
|
462
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR"] = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR";
|
|
463
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR"] = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
|
|
464
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"] = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
|
|
465
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR"] = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR";
|
|
466
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR"] = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR";
|
|
467
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR"] = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR";
|
|
468
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR"] = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR";
|
|
469
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR"] = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR";
|
|
470
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR"] = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR";
|
|
471
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR"] = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR";
|
|
472
|
-
INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"] = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR";
|
|
473
|
-
})(INTERNAL_FORMATS || (INTERNAL_FORMATS = {}));
|
|
474
|
-
|
|
475
|
-
var INTERNAL_FORMAT_TO_BLOCK_SIZE = (_a = {}, _a[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_R11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RG11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = [8, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = [8, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x5_KHR] = [5, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x6_KHR] = [6, 6], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x8_KHR] = [8, 8], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x10_KHR] = [10, 10], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x12_KHR] = [12, 12], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x5_KHR] = [10, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x6_KHR] = [10, 6], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x8_KHR] = [10, 8], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x10_KHR] = [12, 10], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x4_KHR] = [5, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x5_KHR] = [6, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x5_KHR] = [8, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x6_KHR] = [8, 6], _a);
|
|
476
|
-
var INTERNAL_FORMATS_TO_EXTENSION_NAME = (_b = {}, _b[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_R11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RG11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL] = 'WEBGL_compressed_texture_etc1', _b[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL] = 'WEBGL_compressed_texture_atc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = 'WEBGL_compressed_texture_atc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = 'WEBGL_compressed_texture_atc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x5_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x6_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x8_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x10_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x12_KHR] = 'WEBGL_compressed_texture_astc', _b);
|
|
477
|
-
|
|
478
|
-
var CompressedTextureResource = function () {
|
|
479
|
-
function CompressedTextureResource() {
|
|
480
|
-
this.levelBuffers = [];
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
CompressedTextureResource.prototype.upload = function (gl) {
|
|
484
|
-
var levels = this.levels;
|
|
485
|
-
var name = INTERNAL_FORMATS_TO_EXTENSION_NAME[this.internalFormat];
|
|
486
|
-
|
|
487
|
-
if (!gl[name]) {
|
|
488
|
-
gl[name] = true;
|
|
489
|
-
|
|
490
|
-
if (name === 'WEBGL_compressed_texture_pvrtc') {
|
|
491
|
-
gl.getExtension(name) || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');
|
|
492
|
-
} else {
|
|
493
|
-
gl.getExtension(name);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
for (var i = 0; i < this.levels; ++i) {
|
|
498
|
-
var _a = this.levelBuffers[i],
|
|
499
|
-
levelWidth = _a.levelWidth,
|
|
500
|
-
levelHeight = _a.levelHeight,
|
|
501
|
-
levelBuffer = _a.levelBuffer;
|
|
502
|
-
gl.compressedTexImage2D(gl.TEXTURE_2D, i, this.internalFormat, levelWidth, levelHeight, 0, levelBuffer);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
if (levels > 1) {
|
|
506
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
507
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
|
|
508
|
-
} else {
|
|
509
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
510
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
return CompressedTextureResource;
|
|
515
|
-
}();
|
|
516
|
-
|
|
517
|
-
var FILE_HEADER_SIZE = 64;
|
|
518
|
-
var KTX_FIELDS = {
|
|
519
|
-
FILE_IDENTIFIER: 0,
|
|
520
|
-
ENDIANNESS: 12,
|
|
521
|
-
GL_TYPE: 16,
|
|
522
|
-
GL_TYPE_SIZE: 20,
|
|
523
|
-
GL_FORMAT: 24,
|
|
524
|
-
GL_INTERNAL_FORMAT: 28,
|
|
525
|
-
GL_BASE_INTERNAL_FORMAT: 32,
|
|
526
|
-
PIXEL_WIDTH: 36,
|
|
527
|
-
PIXEL_HEIGHT: 40,
|
|
528
|
-
PIXEL_DEPTH: 44,
|
|
529
|
-
NUMBER_OF_ARRAY_ELEMENTS: 48,
|
|
530
|
-
NUMBER_OF_FACES: 52,
|
|
531
|
-
NUMBER_OF_MIPMAP_LEVELS: 56,
|
|
532
|
-
BYTES_OF_KEY_VALUE_DATA: 60
|
|
533
|
-
};
|
|
534
|
-
var FILE_IDENTIFIER = [0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A];
|
|
535
|
-
var ENDIANNESS = 0x04030201;
|
|
536
|
-
|
|
537
|
-
var KTXTextureResource = function (_super) {
|
|
538
|
-
__extends(KTXTextureResource, _super);
|
|
539
|
-
|
|
540
|
-
function KTXTextureResource(source, config) {
|
|
541
|
-
var _a;
|
|
542
|
-
|
|
543
|
-
var _this = _super.call(this) || this;
|
|
544
|
-
|
|
545
|
-
_this.complete = true;
|
|
546
|
-
_this.src = config.url;
|
|
547
|
-
var dataView = new DataView(source);
|
|
548
|
-
|
|
549
|
-
if (!validateKTX(dataView)) {
|
|
550
|
-
throw new Error('Not a valid KTX Texture');
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
var littleEndian = dataView.getUint32(KTX_FIELDS.ENDIANNESS, true) === ENDIANNESS;
|
|
554
|
-
_this.internalFormat = dataView.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT, littleEndian);
|
|
555
|
-
var pixelWidth = _this.formerWidth = dataView.getUint32(KTX_FIELDS.PIXEL_WIDTH, littleEndian);
|
|
556
|
-
var pixelHeight = _this.formerHeight = dataView.getUint32(KTX_FIELDS.PIXEL_HEIGHT, littleEndian) || 1;
|
|
557
|
-
var size = INTERNAL_FORMAT_TO_BLOCK_SIZE[_this.internalFormat];
|
|
558
|
-
_this.width = pixelWidth % size[0] === 0 ? pixelWidth : pixelWidth + size[0] - pixelWidth % size[0];
|
|
559
|
-
_this.height = pixelHeight % size[1] === 0 ? pixelHeight : pixelHeight + size[1] - pixelHeight % size[1];
|
|
560
|
-
var src = resource.resourcesMap[config.metadata.name].src[config.metadata.key];
|
|
561
|
-
|
|
562
|
-
var _b = (_a = src === null || src === void 0 ? void 0 : src.size) !== null && _a !== void 0 ? _a : {},
|
|
563
|
-
width = _b.width,
|
|
564
|
-
height = _b.height;
|
|
565
|
-
|
|
566
|
-
if (width && height) {
|
|
567
|
-
_this.naturalWidth = width;
|
|
568
|
-
_this.naturalHeight = height;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
var pixelDepth = dataView.getUint32(KTX_FIELDS.PIXEL_DEPTH, littleEndian) || 1;
|
|
572
|
-
var numberOfArrayElements = dataView.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS, littleEndian) || 1;
|
|
573
|
-
var numberOfFaces = dataView.getUint32(KTX_FIELDS.NUMBER_OF_FACES, littleEndian);
|
|
574
|
-
var numberOfMipmapLevels = _this.levels = dataView.getUint32(KTX_FIELDS.NUMBER_OF_MIPMAP_LEVELS, littleEndian);
|
|
575
|
-
var bytesOfKeyValueData = dataView.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA, littleEndian);
|
|
576
|
-
|
|
577
|
-
if (pixelHeight === 0 || pixelDepth !== 1) {
|
|
578
|
-
throw new Error('Only 2D textures are supported!');
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
if (numberOfFaces !== 1) {
|
|
582
|
-
throw new Error('CubeTextures are not supported!');
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (numberOfArrayElements !== 1) {
|
|
586
|
-
throw new Error('It does not support array textures!');
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
var mipWidth = pixelWidth;
|
|
590
|
-
var mipHeight = pixelHeight;
|
|
591
|
-
var imageOffset = FILE_HEADER_SIZE + bytesOfKeyValueData;
|
|
592
|
-
|
|
593
|
-
for (var mipmapLevel = 0; mipmapLevel < numberOfMipmapLevels; mipmapLevel++) {
|
|
594
|
-
var imageSize = dataView.getUint32(imageOffset, littleEndian);
|
|
595
|
-
imageOffset += 4;
|
|
596
|
-
var size_1 = INTERNAL_FORMAT_TO_BLOCK_SIZE[_this.internalFormat];
|
|
597
|
-
var levelWidth = mipWidth % size_1[0] === 0 ? mipWidth : mipWidth + size_1[0] - mipWidth % size_1[0];
|
|
598
|
-
var levelHeight = mipHeight % size_1[1] === 0 ? mipHeight : mipHeight + size_1[1] - mipHeight % size_1[1];
|
|
599
|
-
var mip = {
|
|
600
|
-
levelID: mipmapLevel,
|
|
601
|
-
levelWidth: levelWidth,
|
|
602
|
-
levelHeight: levelHeight,
|
|
603
|
-
levelBuffer: new Uint8Array(source, imageOffset, imageSize)
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
_this.levelBuffers.push(mip);
|
|
607
|
-
|
|
608
|
-
imageOffset += imageSize;
|
|
609
|
-
imageOffset += 3 - (imageOffset + 3) % 4;
|
|
610
|
-
mipWidth = mipWidth >> 1 || 1;
|
|
611
|
-
mipHeight = mipHeight >> 1 || 1;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
return _this;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
return KTXTextureResource;
|
|
618
|
-
}(CompressedTextureResource);
|
|
619
|
-
|
|
620
|
-
function validateKTX(dataView) {
|
|
621
|
-
for (var i = 0; i < FILE_IDENTIFIER.length; i++) {
|
|
622
|
-
if (dataView.getUint8(i) !== FILE_IDENTIFIER[i]) {
|
|
623
|
-
return false;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
return true;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
var KTXLoadStrategy = function (_super) {
|
|
631
|
-
__extends(KTXLoadStrategy, _super);
|
|
632
|
-
|
|
633
|
-
function KTXLoadStrategy() {
|
|
634
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
KTXLoadStrategy.prototype._complete = function (type, data) {
|
|
638
|
-
_super.prototype._complete.call(this, type, new KTXTextureResource(data, this.config));
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
return KTXLoadStrategy;
|
|
642
|
-
}(XhrLoadStrategy);
|
|
643
|
-
|
|
644
|
-
var KTXLoadStrategy$1 = KTXLoadStrategy;
|
|
645
|
-
var XhrResponseType = resourceLoader.XhrResponseType;
|
|
646
|
-
|
|
647
|
-
function addPreProcessResourceHandler(resource, gl) {
|
|
648
|
-
resource.addPreProcessResourceHandler(function normalizeResource(resource) {
|
|
649
|
-
var _a, _b, _c;
|
|
650
|
-
|
|
651
|
-
var textures = (_b = (_a = resource.src) === null || _a === void 0 ? void 0 : _a.image) === null || _b === void 0 ? void 0 : _b.texture;
|
|
652
|
-
if (!textures) return;
|
|
653
|
-
|
|
654
|
-
if (!Array.isArray(textures)) {
|
|
655
|
-
textures = [textures];
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
var formats = (_c = getSuportCompressedTextureFormats(gl)) !== null && _c !== void 0 ? _c : {};
|
|
659
|
-
var target = textures.find(function (texture) {
|
|
660
|
-
return formats[texture.type];
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
if (target) {
|
|
664
|
-
_extends(resource.src.image, target);
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
function addKTXStragetyAndRegister() {
|
|
670
|
-
_extends(RESOURCE_TYPE_STRATEGY, {
|
|
671
|
-
astc: KTXLoadStrategy$1,
|
|
672
|
-
etc: KTXLoadStrategy$1,
|
|
673
|
-
pvrtc: KTXLoadStrategy$1,
|
|
674
|
-
s3tc: KTXLoadStrategy$1,
|
|
675
|
-
atc: KTXLoadStrategy$1
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
KTXLoadStrategy$1.setExtensionXhrType('ktx', XhrResponseType.Buffer);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
var GLTexture = glCore.GLTexture;
|
|
682
|
-
var GLTextureMixin = {
|
|
683
|
-
isCompressed: false,
|
|
684
|
-
uploadNotCompressed: GLTexture.prototype.upload,
|
|
685
|
-
upload: function upload(source) {
|
|
686
|
-
if (!(source instanceof CompressedTextureResource)) {
|
|
687
|
-
return this.uploadNotCompressed(source);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
this.bind();
|
|
691
|
-
var gl = this.gl;
|
|
692
|
-
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);
|
|
693
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST);
|
|
694
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
695
|
-
this.isCompressed = true;
|
|
696
|
-
source.upload(gl);
|
|
697
|
-
},
|
|
698
|
-
enableMipmap: function enableMipmap() {
|
|
699
|
-
if (this.isCompressed) {
|
|
700
|
-
return;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
var gl = this.gl;
|
|
704
|
-
this.bind();
|
|
705
|
-
this.mipmap = true;
|
|
706
|
-
gl.generateMipmap(gl.TEXTURE_2D);
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
var TextureMixin = {
|
|
710
|
-
oldFrom: Texture.from,
|
|
711
|
-
from: function from(source) {
|
|
712
|
-
if (!(source instanceof CompressedTextureResource)) {
|
|
713
|
-
return this.oldFrom(source);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
return new Texture(BaseTexture.from(source));
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
var BaseTextureMixin = {
|
|
720
|
-
oldFrom: BaseTexture.from,
|
|
721
|
-
from: function from(source, scaleMode, sourceScale) {
|
|
722
|
-
if (!(source instanceof CompressedTextureResource)) {
|
|
723
|
-
return this.oldFrom(source, scaleMode, sourceScale);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
var imageUrl = source.src;
|
|
727
|
-
var baseTexture = utils.BaseTextureCache[imageUrl];
|
|
728
|
-
|
|
729
|
-
if (!baseTexture) {
|
|
730
|
-
baseTexture = new BaseTexture(source, scaleMode);
|
|
731
|
-
baseTexture.imageUrl = imageUrl;
|
|
732
|
-
|
|
733
|
-
if (sourceScale) {
|
|
734
|
-
baseTexture.sourceScale = sourceScale;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
BaseTexture.addToCache(baseTexture, imageUrl);
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
return baseTexture;
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
function registerCompressedTexture(gl) {
|
|
745
|
-
addPreProcessResourceHandler(resource, gl);
|
|
746
|
-
addKTXStragetyAndRegister();
|
|
747
|
-
|
|
748
|
-
_extends(glCore.GLTexture.prototype, GLTextureMixin);
|
|
749
|
-
|
|
750
|
-
_extends(Texture, TextureMixin);
|
|
751
|
-
|
|
752
|
-
_extends(BaseTexture, BaseTextureMixin);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
var RENDERER_TYPE;
|
|
756
|
-
|
|
757
|
-
(function (RENDERER_TYPE) {
|
|
758
|
-
RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
|
|
759
|
-
RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL";
|
|
760
|
-
RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS";
|
|
761
|
-
})(RENDERER_TYPE || (RENDERER_TYPE = {}));
|
|
762
|
-
|
|
763
|
-
var disableScroll = function disableScroll(renderer) {
|
|
764
|
-
renderer.plugins.interaction.autoPreventDefault = true;
|
|
765
|
-
renderer.view.style.touchAction = 'none';
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
var enableScroll = function enableScroll(renderer) {
|
|
769
|
-
renderer.plugins.interaction.autoPreventDefault = false;
|
|
770
|
-
renderer.view.style.touchAction = 'auto';
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
var Renderer$2 = function (_super) {
|
|
774
|
-
__extends(Renderer, _super);
|
|
775
|
-
|
|
776
|
-
function Renderer() {
|
|
777
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
778
|
-
|
|
779
|
-
_this.multiApps = [];
|
|
780
|
-
return _this;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
Renderer.prototype.init = function (params) {
|
|
784
|
-
var _this = this;
|
|
785
|
-
|
|
786
|
-
this.params = params;
|
|
787
|
-
this.application = this.createApplication(params);
|
|
788
|
-
this.containerManager = new ContainerManager$1();
|
|
789
|
-
this.rendererManager = new RendererManager$1({
|
|
790
|
-
game: this.game,
|
|
791
|
-
rendererSystem: this
|
|
792
|
-
});
|
|
793
|
-
this.game.canvas = this.application.view;
|
|
794
|
-
this.transform = new Transform$1({
|
|
795
|
-
system: this,
|
|
796
|
-
containerManager: this.containerManager
|
|
797
|
-
});
|
|
798
|
-
this.game.on('sceneChanged', function (_a) {
|
|
799
|
-
var scene = _a.scene,
|
|
800
|
-
mode = _a.mode,
|
|
801
|
-
params = _a.params;
|
|
802
|
-
var application;
|
|
803
|
-
|
|
804
|
-
switch (mode) {
|
|
805
|
-
case LOAD_SCENE_MODE.SINGLE:
|
|
806
|
-
application = _this.application;
|
|
807
|
-
break;
|
|
808
|
-
|
|
809
|
-
case LOAD_SCENE_MODE.MULTI_CANVAS:
|
|
810
|
-
application = _this.createMultiApplication({
|
|
811
|
-
params: params
|
|
812
|
-
});
|
|
813
|
-
break;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
scene.canvas = application.view;
|
|
817
|
-
|
|
818
|
-
_this.transform.emit('changeScene', {
|
|
819
|
-
scene: scene,
|
|
820
|
-
mode: mode,
|
|
821
|
-
application: application
|
|
822
|
-
});
|
|
823
|
-
});
|
|
824
|
-
var gl = this.application.renderer.gl;
|
|
825
|
-
|
|
826
|
-
if (gl) {
|
|
827
|
-
this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl);
|
|
828
|
-
registerCompressedTexture(gl);
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
Renderer.prototype.registerObserver = function (observerInfo) {
|
|
833
|
-
var _a;
|
|
834
|
-
|
|
835
|
-
var thisObserverInfo = this.constructor.observerInfo;
|
|
836
|
-
|
|
837
|
-
for (var key in observerInfo) {
|
|
838
|
-
if (!thisObserverInfo[key]) {
|
|
839
|
-
thisObserverInfo[key] = [];
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
(_a = thisObserverInfo[key]).push.apply(_a, __spread(observerInfo[key]));
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
Renderer.prototype.createMultiApplication = function (_a) {
|
|
847
|
-
var params = _a.params;
|
|
848
|
-
var app = this.createApplication(params);
|
|
849
|
-
this.multiApps.push(app);
|
|
850
|
-
return app;
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
Renderer.prototype.createApplication = function (params) {
|
|
854
|
-
params.view = params.canvas;
|
|
855
|
-
|
|
856
|
-
if (params.renderType === RENDERER_TYPE.CANVAS) {
|
|
857
|
-
params.forceCanvas = true;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
var app = new Application(__assign({
|
|
861
|
-
sharedTicker: true
|
|
862
|
-
}, params));
|
|
863
|
-
ticker.shared.stop();
|
|
864
|
-
ticker.shared.autoStart = false;
|
|
865
|
-
|
|
866
|
-
if (params.preventScroll !== undefined) {
|
|
867
|
-
console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game');
|
|
868
|
-
params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer);
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
if (params.enableScroll !== undefined) {
|
|
872
|
-
params.enableScroll ? enableScroll(app.renderer) : disableScroll(app.renderer);
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
if (params.preventScroll === undefined && params.enableScroll === undefined) {
|
|
876
|
-
enableScroll(app.renderer);
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
return app;
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
Renderer.prototype.update = function () {
|
|
883
|
-
var e_1, _a, e_2, _b;
|
|
884
|
-
|
|
885
|
-
var changes = this.componentObserver.clear();
|
|
886
|
-
|
|
887
|
-
try {
|
|
888
|
-
for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
|
|
889
|
-
var changed = changes_1_1.value;
|
|
890
|
-
this.transform.componentChanged(changed);
|
|
891
|
-
}
|
|
892
|
-
} catch (e_1_1) {
|
|
893
|
-
e_1 = {
|
|
894
|
-
error: e_1_1
|
|
895
|
-
};
|
|
896
|
-
} finally {
|
|
897
|
-
try {
|
|
898
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
899
|
-
} finally {
|
|
900
|
-
if (e_1) throw e_1.error;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
try {
|
|
905
|
-
for (var _c = __values(this.game.gameObjects), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
906
|
-
var gameObject = _d.value;
|
|
907
|
-
this.containerManager.updateTransform({
|
|
908
|
-
name: gameObject.id,
|
|
909
|
-
transform: gameObject.transform
|
|
910
|
-
});
|
|
911
|
-
this.rendererManager.update(gameObject);
|
|
912
|
-
}
|
|
913
|
-
} catch (e_2_1) {
|
|
914
|
-
e_2 = {
|
|
915
|
-
error: e_2_1
|
|
916
|
-
};
|
|
917
|
-
} finally {
|
|
918
|
-
try {
|
|
919
|
-
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
920
|
-
} finally {
|
|
921
|
-
if (e_2) throw e_2.error;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
|
|
926
|
-
Renderer.prototype.lateUpdate = function (e) {
|
|
927
|
-
this.transform.update();
|
|
928
|
-
this.application.ticker.update(e.time);
|
|
929
|
-
};
|
|
930
|
-
|
|
931
|
-
Renderer.prototype.onDestroy = function () {
|
|
932
|
-
var e_3, _a;
|
|
933
|
-
|
|
934
|
-
this.application.destroy();
|
|
935
|
-
|
|
936
|
-
try {
|
|
937
|
-
for (var _b = __values(this.multiApps), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
938
|
-
var app = _c.value;
|
|
939
|
-
app && app.destroy();
|
|
940
|
-
}
|
|
941
|
-
} catch (e_3_1) {
|
|
942
|
-
e_3 = {
|
|
943
|
-
error: e_3_1
|
|
944
|
-
};
|
|
945
|
-
} finally {
|
|
946
|
-
try {
|
|
947
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
948
|
-
} finally {
|
|
949
|
-
if (e_3) throw e_3.error;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
this.transform.destroy();
|
|
954
|
-
this.transform = null;
|
|
955
|
-
this.params = null;
|
|
956
|
-
this.rendererManager = null;
|
|
957
|
-
this.containerManager = null;
|
|
958
|
-
this.application = null;
|
|
959
|
-
this.game = null;
|
|
960
|
-
this.multiApps = null;
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
Renderer.prototype.resize = function (width, height) {
|
|
964
|
-
this.params.width = width;
|
|
965
|
-
this.params.height = height;
|
|
966
|
-
this.application.renderer.resize(width, height);
|
|
967
|
-
};
|
|
968
|
-
|
|
969
|
-
Renderer.systemName = 'Renderer';
|
|
970
|
-
Renderer = __decorate([decorators.componentObserver({
|
|
971
|
-
Transform: ['_parent']
|
|
972
|
-
})], Renderer);
|
|
973
|
-
return Renderer;
|
|
974
|
-
}(System);
|
|
975
|
-
|
|
976
|
-
var Renderer$3 = Renderer$2;
|
|
977
|
-
|
|
978
|
-
var Renderer = function (_super) {
|
|
979
|
-
__extends(Renderer, _super);
|
|
980
|
-
|
|
981
|
-
function Renderer(params) {
|
|
982
|
-
var _this = _super.call(this, params) || this;
|
|
983
|
-
|
|
984
|
-
_this.asyncIdMap = {};
|
|
985
|
-
_this.observerInfo = _this.constructor.observerInfo;
|
|
986
|
-
return _this;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
Renderer.prototype.componentChanged = function (_changed) {};
|
|
990
|
-
|
|
991
|
-
Renderer.prototype.rendererUpdate = function (_gameObject) {};
|
|
992
|
-
|
|
993
|
-
Renderer.prototype.update = function (e) {
|
|
994
|
-
var e_1, _a;
|
|
995
|
-
|
|
996
|
-
var changes = this.componentObserver.clear();
|
|
997
|
-
|
|
998
|
-
try {
|
|
999
|
-
for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
|
|
1000
|
-
var changed = changes_1_1.value;
|
|
1001
|
-
this.componentChanged(changed);
|
|
1002
|
-
}
|
|
1003
|
-
} catch (e_1_1) {
|
|
1004
|
-
e_1 = {
|
|
1005
|
-
error: e_1_1
|
|
1006
|
-
};
|
|
1007
|
-
} finally {
|
|
1008
|
-
try {
|
|
1009
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
1010
|
-
} finally {
|
|
1011
|
-
if (e_1) throw e_1.error;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
|
|
1016
|
-
Renderer.prototype.increaseAsyncId = function (id) {
|
|
1017
|
-
this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;
|
|
1018
|
-
return this.asyncIdMap[id];
|
|
1019
|
-
};
|
|
1020
|
-
|
|
1021
|
-
Renderer.prototype.validateAsyncId = function (id, asyncId) {
|
|
1022
|
-
return this.asyncIdMap[id] === asyncId;
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
return Renderer;
|
|
1026
|
-
}(System);
|
|
1027
|
-
|
|
1028
|
-
var Renderer$1 = Renderer;
|
|
1029
|
-
|
|
1030
|
-
var mixinPIXI = function mixinPIXI() {
|
|
1031
|
-
BaseTexture.prototype.destroy = function () {
|
|
1032
|
-
if (this.imageUrl) {
|
|
1033
|
-
delete utils.TextureCache[this.imageUrl];
|
|
1034
|
-
this.imageUrl = null;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
this.source = null;
|
|
1038
|
-
this.dispose();
|
|
1039
|
-
BaseTexture.removeFromCache(this);
|
|
1040
|
-
this.textureCacheIds = null;
|
|
1041
|
-
this._destroyed = true;
|
|
1042
|
-
};
|
|
1043
|
-
};
|
|
1044
|
-
|
|
1045
|
-
mixinPIXI();
|
|
1046
|
-
export { ContainerManager$1 as ContainerManager, RENDERER_TYPE, Renderer$1 as Renderer, RendererManager$1 as RendererManager, Renderer$3 as RendererSystem };
|