@galacean/effects-core 2.8.0-alpha.2 → 2.8.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -135
- package/dist/components/effect-component.d.ts +2 -1
- package/dist/components/mesh-component.d.ts +7 -1
- package/dist/index.js +521 -620
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +521 -620
- package/dist/index.mjs.map +1 -1
- package/dist/render/post-process-pass.d.ts +9 -24
- package/dist/render/renderer.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -7226,13 +7226,388 @@ __decorate([
|
|
|
7226
7226
|
serialize()
|
|
7227
7227
|
], RendererComponent.prototype, "_priority", void 0);
|
|
7228
7228
|
|
|
7229
|
+
var ShaderType;
|
|
7230
|
+
(function(ShaderType) {
|
|
7231
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
7232
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
7233
|
+
})(ShaderType || (ShaderType = {}));
|
|
7234
|
+
var MaskMode;
|
|
7235
|
+
(function(MaskMode) {
|
|
7236
|
+
/**
|
|
7237
|
+
* 无
|
|
7238
|
+
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
7239
|
+
/**
|
|
7240
|
+
* 蒙版
|
|
7241
|
+
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
7242
|
+
/**
|
|
7243
|
+
* 被遮挡
|
|
7244
|
+
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
7245
|
+
/**
|
|
7246
|
+
* 被反向遮挡
|
|
7247
|
+
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
7248
|
+
})(MaskMode || (MaskMode = {}));
|
|
7249
|
+
|
|
7250
|
+
var TextureLoadAction;
|
|
7251
|
+
(function(TextureLoadAction) {
|
|
7252
|
+
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
7253
|
+
//preserve previous attachment
|
|
7254
|
+
//load = 1,
|
|
7255
|
+
//clear attachment
|
|
7256
|
+
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
7257
|
+
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
7258
|
+
var TextureSourceType;
|
|
7259
|
+
(function(TextureSourceType) {
|
|
7260
|
+
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
7261
|
+
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
7262
|
+
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
7263
|
+
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
7264
|
+
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
7265
|
+
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
7266
|
+
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
7267
|
+
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
7268
|
+
})(TextureSourceType || (TextureSourceType = {}));
|
|
7269
|
+
|
|
7270
|
+
var MaskProcessor = /*#__PURE__*/ function() {
|
|
7271
|
+
function MaskProcessor(engine) {
|
|
7272
|
+
this.engine = engine;
|
|
7273
|
+
this.alphaMaskEnabled = false;
|
|
7274
|
+
this.maskMode = MaskMode.NONE;
|
|
7275
|
+
this.maskable = null;
|
|
7276
|
+
this.stencilClearAction = {
|
|
7277
|
+
stencilAction: TextureLoadAction.clear
|
|
7278
|
+
};
|
|
7279
|
+
}
|
|
7280
|
+
var _proto = MaskProcessor.prototype;
|
|
7281
|
+
_proto.getRefValue = function getRefValue() {
|
|
7282
|
+
return 1;
|
|
7283
|
+
};
|
|
7284
|
+
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
7285
|
+
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask, _data_inverted = data.inverted, inverted = _data_inverted === void 0 ? false : _data_inverted, reference = data.reference, _data_alphaMaskEnabled = data.alphaMaskEnabled, alphaMaskEnabled = _data_alphaMaskEnabled === void 0 ? false : _data_alphaMaskEnabled;
|
|
7286
|
+
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
7287
|
+
if (isMask) {
|
|
7288
|
+
this.maskMode = MaskMode.MASK;
|
|
7289
|
+
} else {
|
|
7290
|
+
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
7291
|
+
this.maskable = this.engine.findObject(reference);
|
|
7292
|
+
}
|
|
7293
|
+
};
|
|
7294
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7295
|
+
if (this.maskable) {
|
|
7296
|
+
renderer.clear(this.stencilClearAction);
|
|
7297
|
+
this.maskable.drawStencilMask(renderer);
|
|
7298
|
+
}
|
|
7299
|
+
};
|
|
7300
|
+
return MaskProcessor;
|
|
7301
|
+
}();
|
|
7302
|
+
|
|
7303
|
+
/**
|
|
7304
|
+
* Helper class to create a WebGL Context
|
|
7305
|
+
*
|
|
7306
|
+
* @param canvas
|
|
7307
|
+
* @param glType
|
|
7308
|
+
* @param options
|
|
7309
|
+
* @returns
|
|
7310
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
7311
|
+
if (glType === void 0) glType = "webgl";
|
|
7312
|
+
var context;
|
|
7313
|
+
if (glType === "webgl2") {
|
|
7314
|
+
context = canvas.getContext("webgl2", options);
|
|
7315
|
+
if (!context) {
|
|
7316
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
if (!context || glType === "webgl") {
|
|
7320
|
+
context = canvas.getContext("webgl", options);
|
|
7321
|
+
}
|
|
7322
|
+
if (!context) {
|
|
7323
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
7324
|
+
}
|
|
7325
|
+
return context;
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
function gpuTimer(gl) {
|
|
7329
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
7330
|
+
if (ext) {
|
|
7331
|
+
var query = gl.createQuery();
|
|
7332
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
7333
|
+
return __generator(this, function(_state) {
|
|
7334
|
+
return [
|
|
7335
|
+
2,
|
|
7336
|
+
new Promise(function(resolve, reject) {
|
|
7337
|
+
if (query) {
|
|
7338
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
7339
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
7340
|
+
if (available && !disjoint) {
|
|
7341
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
7342
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
7343
|
+
// taken to use all significant bits of the result, not just the
|
|
7344
|
+
// least significant 32 bits.
|
|
7345
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
7346
|
+
}
|
|
7347
|
+
if (available || disjoint) {
|
|
7348
|
+
// Clean up the query object.
|
|
7349
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
7350
|
+
query = null;
|
|
7351
|
+
}
|
|
7352
|
+
available !== null && query && window.setTimeout(function() {
|
|
7353
|
+
getTime().then(resolve).catch;
|
|
7354
|
+
}, 1);
|
|
7355
|
+
}
|
|
7356
|
+
})
|
|
7357
|
+
];
|
|
7358
|
+
});
|
|
7359
|
+
});
|
|
7360
|
+
if (!query) {
|
|
7361
|
+
return;
|
|
7362
|
+
}
|
|
7363
|
+
return {
|
|
7364
|
+
begin: function() {
|
|
7365
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
7366
|
+
},
|
|
7367
|
+
end: function() {
|
|
7368
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
7369
|
+
},
|
|
7370
|
+
getTime: getTime
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
}
|
|
7374
|
+
|
|
7375
|
+
var initErrors = [];
|
|
7376
|
+
var glContext = {};
|
|
7377
|
+
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
7378
|
+
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
7379
|
+
if (!initErrors.length) {
|
|
7380
|
+
initGLContext();
|
|
7381
|
+
}
|
|
7382
|
+
function initGLContext() {
|
|
7383
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
7384
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
7385
|
+
copy(WebGL2RenderingContext);
|
|
7386
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
7387
|
+
copy(WebGLRenderingContext);
|
|
7388
|
+
copy(WebGLRenderingContext.prototype);
|
|
7389
|
+
} else {
|
|
7390
|
+
if (canUseBOM) {
|
|
7391
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
7392
|
+
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7393
|
+
} else {
|
|
7394
|
+
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
7398
|
+
// @ts-expect-error set default value
|
|
7399
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
7400
|
+
}
|
|
7401
|
+
}
|
|
7402
|
+
function isWebGL2(gl) {
|
|
7403
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
7404
|
+
}
|
|
7405
|
+
function copy(target) {
|
|
7406
|
+
for(var name in target){
|
|
7407
|
+
if (/^[A-Z_]/.test(name)) {
|
|
7408
|
+
// @ts-expect-error safe to assign
|
|
7409
|
+
glContext[name] = target[name];
|
|
7410
|
+
}
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
function vertexFormatType2GLType(formatType) {
|
|
7414
|
+
switch(formatType){
|
|
7415
|
+
case VertexFormatType.Float32:
|
|
7416
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7417
|
+
case VertexFormatType.Int16:
|
|
7418
|
+
return WebGLRenderingContext["SHORT"];
|
|
7419
|
+
case VertexFormatType.Int8:
|
|
7420
|
+
return WebGLRenderingContext["BYTE"];
|
|
7421
|
+
case VertexFormatType.UInt16:
|
|
7422
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
7423
|
+
case VertexFormatType.UInt8:
|
|
7424
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
7425
|
+
default:
|
|
7426
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7429
|
+
function glType2VertexFormatType(webglType) {
|
|
7430
|
+
switch(webglType){
|
|
7431
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
7432
|
+
return VertexFormatType.Float32;
|
|
7433
|
+
case WebGLRenderingContext["SHORT"]:
|
|
7434
|
+
return VertexFormatType.Int16;
|
|
7435
|
+
case WebGLRenderingContext["BYTE"]:
|
|
7436
|
+
return VertexFormatType.Int8;
|
|
7437
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
7438
|
+
return VertexFormatType.UInt16;
|
|
7439
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
7440
|
+
return VertexFormatType.UInt8;
|
|
7441
|
+
default:
|
|
7442
|
+
return VertexFormatType.Float32;
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7445
|
+
|
|
7446
|
+
function valIfUndefined(val, def) {
|
|
7447
|
+
if (val === undefined || val === null) {
|
|
7448
|
+
return def;
|
|
7449
|
+
}
|
|
7450
|
+
return val;
|
|
7451
|
+
}
|
|
7452
|
+
function getPreMultiAlpha(blending) {
|
|
7453
|
+
switch(blending){
|
|
7454
|
+
case BlendingMode.ALPHA:
|
|
7455
|
+
return 1;
|
|
7456
|
+
case BlendingMode.ADD:
|
|
7457
|
+
return 1;
|
|
7458
|
+
case BlendingMode.SUBTRACTION:
|
|
7459
|
+
return 1;
|
|
7460
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7461
|
+
return 1;
|
|
7462
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7463
|
+
return 1;
|
|
7464
|
+
case BlendingMode.SUPERPOSITION:
|
|
7465
|
+
return 2;
|
|
7466
|
+
case BlendingMode.BRIGHTNESS:
|
|
7467
|
+
return 3;
|
|
7468
|
+
case BlendingMode.MULTIPLY:
|
|
7469
|
+
return 0;
|
|
7470
|
+
default:
|
|
7471
|
+
// 处理undefined
|
|
7472
|
+
return 1;
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
function setBlendMode(material, blendMode) {
|
|
7476
|
+
switch(blendMode){
|
|
7477
|
+
case undefined:
|
|
7478
|
+
material.blendFunction = [
|
|
7479
|
+
glContext.ONE,
|
|
7480
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7481
|
+
glContext.ONE,
|
|
7482
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7483
|
+
];
|
|
7484
|
+
break;
|
|
7485
|
+
case BlendingMode.ALPHA:
|
|
7486
|
+
material.blendFunction = [
|
|
7487
|
+
glContext.ONE,
|
|
7488
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7489
|
+
glContext.ONE,
|
|
7490
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7491
|
+
];
|
|
7492
|
+
break;
|
|
7493
|
+
case BlendingMode.ADD:
|
|
7494
|
+
material.blendFunction = [
|
|
7495
|
+
glContext.ONE,
|
|
7496
|
+
glContext.ONE,
|
|
7497
|
+
glContext.ONE,
|
|
7498
|
+
glContext.ONE
|
|
7499
|
+
];
|
|
7500
|
+
break;
|
|
7501
|
+
case BlendingMode.SUBTRACTION:
|
|
7502
|
+
material.blendFunction = [
|
|
7503
|
+
glContext.ONE,
|
|
7504
|
+
glContext.ONE,
|
|
7505
|
+
glContext.ZERO,
|
|
7506
|
+
glContext.ONE
|
|
7507
|
+
];
|
|
7508
|
+
material.blendEquation = [
|
|
7509
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
7510
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
7511
|
+
];
|
|
7512
|
+
break;
|
|
7513
|
+
case BlendingMode.SUPERPOSITION:
|
|
7514
|
+
material.blendFunction = [
|
|
7515
|
+
glContext.ONE,
|
|
7516
|
+
glContext.ONE,
|
|
7517
|
+
glContext.ONE,
|
|
7518
|
+
glContext.ONE
|
|
7519
|
+
];
|
|
7520
|
+
break;
|
|
7521
|
+
case BlendingMode.MULTIPLY:
|
|
7522
|
+
material.blendFunction = [
|
|
7523
|
+
glContext.DST_COLOR,
|
|
7524
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7525
|
+
glContext.DST_COLOR,
|
|
7526
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7527
|
+
];
|
|
7528
|
+
break;
|
|
7529
|
+
case BlendingMode.BRIGHTNESS:
|
|
7530
|
+
material.blendFunction = [
|
|
7531
|
+
glContext.ONE,
|
|
7532
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7533
|
+
glContext.ONE,
|
|
7534
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7535
|
+
];
|
|
7536
|
+
break;
|
|
7537
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7538
|
+
material.blendFunction = [
|
|
7539
|
+
glContext.DST_COLOR,
|
|
7540
|
+
glContext.DST_ALPHA,
|
|
7541
|
+
glContext.ZERO,
|
|
7542
|
+
glContext.ONE
|
|
7543
|
+
];
|
|
7544
|
+
break;
|
|
7545
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7546
|
+
material.blendFunction = [
|
|
7547
|
+
glContext.DST_COLOR,
|
|
7548
|
+
glContext.ZERO,
|
|
7549
|
+
glContext.ZERO,
|
|
7550
|
+
glContext.ONE
|
|
7551
|
+
];
|
|
7552
|
+
break;
|
|
7553
|
+
default:
|
|
7554
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
function setSideMode(material, side) {
|
|
7558
|
+
if (side === SideMode.DOUBLE) {
|
|
7559
|
+
material.culling = false;
|
|
7560
|
+
} else {
|
|
7561
|
+
material.culling = true;
|
|
7562
|
+
material.frontFace = glContext.CW;
|
|
7563
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7564
|
+
}
|
|
7565
|
+
}
|
|
7566
|
+
function setMaskMode(material, maskMode) {
|
|
7567
|
+
switch(maskMode){
|
|
7568
|
+
case undefined:
|
|
7569
|
+
material.stencilTest = false;
|
|
7570
|
+
break;
|
|
7571
|
+
case MaskMode.MASK:
|
|
7572
|
+
material.stencilTest = true;
|
|
7573
|
+
material.stencilFunc = [
|
|
7574
|
+
glContext.ALWAYS,
|
|
7575
|
+
glContext.ALWAYS
|
|
7576
|
+
];
|
|
7577
|
+
material.stencilOpZPass = [
|
|
7578
|
+
glContext.REPLACE,
|
|
7579
|
+
glContext.REPLACE
|
|
7580
|
+
];
|
|
7581
|
+
break;
|
|
7582
|
+
case MaskMode.OBSCURED:
|
|
7583
|
+
material.stencilTest = true;
|
|
7584
|
+
material.stencilFunc = [
|
|
7585
|
+
glContext.EQUAL,
|
|
7586
|
+
glContext.EQUAL
|
|
7587
|
+
];
|
|
7588
|
+
break;
|
|
7589
|
+
case MaskMode.REVERSE_OBSCURED:
|
|
7590
|
+
material.stencilTest = true;
|
|
7591
|
+
material.stencilFunc = [
|
|
7592
|
+
glContext.NOTEQUAL,
|
|
7593
|
+
glContext.NOTEQUAL
|
|
7594
|
+
];
|
|
7595
|
+
break;
|
|
7596
|
+
case MaskMode.NONE:
|
|
7597
|
+
material.stencilTest = false;
|
|
7598
|
+
break;
|
|
7599
|
+
default:
|
|
7600
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
7601
|
+
}
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7229
7604
|
/**
|
|
7230
7605
|
* Mesh 组件
|
|
7231
7606
|
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
7232
7607
|
_inherits(MeshComponent, RendererComponent);
|
|
7233
|
-
function MeshComponent() {
|
|
7608
|
+
function MeshComponent(engine) {
|
|
7234
7609
|
var _this;
|
|
7235
|
-
_this = RendererComponent.
|
|
7610
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
7236
7611
|
/**
|
|
7237
7612
|
* 用于点击测试的碰撞器
|
|
7238
7613
|
*/ _this.meshCollider = new MeshCollider();
|
|
@@ -7248,6 +7623,7 @@ __decorate([
|
|
|
7248
7623
|
};
|
|
7249
7624
|
}
|
|
7250
7625
|
};
|
|
7626
|
+
_this.maskManager = new MaskProcessor(engine);
|
|
7251
7627
|
return _this;
|
|
7252
7628
|
}
|
|
7253
7629
|
var _proto = MeshComponent.prototype;
|
|
@@ -7257,12 +7633,42 @@ __decorate([
|
|
|
7257
7633
|
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7258
7634
|
}
|
|
7259
7635
|
};
|
|
7636
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7637
|
+
if (!this.isActiveAndEnabled) {
|
|
7638
|
+
return;
|
|
7639
|
+
}
|
|
7640
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
7641
|
+
var material = this.materials[i];
|
|
7642
|
+
var previousColorMask = material.colorMask;
|
|
7643
|
+
material.colorMask = false;
|
|
7644
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7645
|
+
material.colorMask = previousColorMask;
|
|
7646
|
+
}
|
|
7647
|
+
};
|
|
7260
7648
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
7261
7649
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
7262
7650
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
7263
7651
|
var boundingBox = this.meshCollider.getBoundingBox();
|
|
7264
7652
|
return boundingBox;
|
|
7265
7653
|
};
|
|
7654
|
+
// TODO: Update data spec
|
|
7655
|
+
_proto.fromData = function fromData(data) {
|
|
7656
|
+
RendererComponent.prototype.fromData.call(this, data);
|
|
7657
|
+
var maskableRendererData = data;
|
|
7658
|
+
var maskOptions = maskableRendererData.mask;
|
|
7659
|
+
if (maskOptions) {
|
|
7660
|
+
this.maskManager.setMaskOptions(maskOptions);
|
|
7661
|
+
}
|
|
7662
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.materials), _step; !(_step = _iterator()).done;){
|
|
7663
|
+
var material = _step.value;
|
|
7664
|
+
var stencilRef = this.maskManager.getRefValue();
|
|
7665
|
+
material.stencilRef = [
|
|
7666
|
+
stencilRef,
|
|
7667
|
+
stencilRef
|
|
7668
|
+
];
|
|
7669
|
+
setMaskMode(material, this.maskManager.maskMode);
|
|
7670
|
+
}
|
|
7671
|
+
};
|
|
7266
7672
|
return MeshComponent;
|
|
7267
7673
|
}(RendererComponent);
|
|
7268
7674
|
__decorate([
|
|
@@ -8452,348 +8858,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
8452
8858
|
Matrix4.tempVec2 = new Vector3();
|
|
8453
8859
|
Matrix4.tempMat0 = new Matrix4();
|
|
8454
8860
|
|
|
8455
|
-
/**
|
|
8456
|
-
* Helper class to create a WebGL Context
|
|
8457
|
-
*
|
|
8458
|
-
* @param canvas
|
|
8459
|
-
* @param glType
|
|
8460
|
-
* @param options
|
|
8461
|
-
* @returns
|
|
8462
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
8463
|
-
if (glType === void 0) glType = "webgl";
|
|
8464
|
-
var context;
|
|
8465
|
-
if (glType === "webgl2") {
|
|
8466
|
-
context = canvas.getContext("webgl2", options);
|
|
8467
|
-
if (!context) {
|
|
8468
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
8469
|
-
}
|
|
8470
|
-
}
|
|
8471
|
-
if (!context || glType === "webgl") {
|
|
8472
|
-
context = canvas.getContext("webgl", options);
|
|
8473
|
-
}
|
|
8474
|
-
if (!context) {
|
|
8475
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
8476
|
-
}
|
|
8477
|
-
return context;
|
|
8478
|
-
}
|
|
8479
|
-
|
|
8480
|
-
function gpuTimer(gl) {
|
|
8481
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
8482
|
-
if (ext) {
|
|
8483
|
-
var query = gl.createQuery();
|
|
8484
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
8485
|
-
return __generator(this, function(_state) {
|
|
8486
|
-
return [
|
|
8487
|
-
2,
|
|
8488
|
-
new Promise(function(resolve, reject) {
|
|
8489
|
-
if (query) {
|
|
8490
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
8491
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
8492
|
-
if (available && !disjoint) {
|
|
8493
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
8494
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
8495
|
-
// taken to use all significant bits of the result, not just the
|
|
8496
|
-
// least significant 32 bits.
|
|
8497
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
8498
|
-
}
|
|
8499
|
-
if (available || disjoint) {
|
|
8500
|
-
// Clean up the query object.
|
|
8501
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
8502
|
-
query = null;
|
|
8503
|
-
}
|
|
8504
|
-
available !== null && query && window.setTimeout(function() {
|
|
8505
|
-
getTime().then(resolve).catch;
|
|
8506
|
-
}, 1);
|
|
8507
|
-
}
|
|
8508
|
-
})
|
|
8509
|
-
];
|
|
8510
|
-
});
|
|
8511
|
-
});
|
|
8512
|
-
if (!query) {
|
|
8513
|
-
return;
|
|
8514
|
-
}
|
|
8515
|
-
return {
|
|
8516
|
-
begin: function() {
|
|
8517
|
-
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
8518
|
-
},
|
|
8519
|
-
end: function() {
|
|
8520
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
8521
|
-
},
|
|
8522
|
-
getTime: getTime
|
|
8523
|
-
};
|
|
8524
|
-
}
|
|
8525
|
-
}
|
|
8526
|
-
|
|
8527
|
-
var initErrors = [];
|
|
8528
|
-
var glContext = {};
|
|
8529
|
-
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
8530
|
-
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
8531
|
-
if (!initErrors.length) {
|
|
8532
|
-
initGLContext();
|
|
8533
|
-
}
|
|
8534
|
-
function initGLContext() {
|
|
8535
|
-
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
8536
|
-
if (typeof WebGL2RenderingContext === "function") {
|
|
8537
|
-
copy(WebGL2RenderingContext);
|
|
8538
|
-
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
8539
|
-
copy(WebGLRenderingContext);
|
|
8540
|
-
copy(WebGLRenderingContext.prototype);
|
|
8541
|
-
} else {
|
|
8542
|
-
if (canUseBOM) {
|
|
8543
|
-
initErrors.push(// iOS 16 lockdown mode
|
|
8544
|
-
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8545
|
-
} else {
|
|
8546
|
-
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
|
-
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
8550
|
-
// @ts-expect-error set default value
|
|
8551
|
-
glContext["HALF_FLOAT"] = 5131;
|
|
8552
|
-
}
|
|
8553
|
-
}
|
|
8554
|
-
function isWebGL2(gl) {
|
|
8555
|
-
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
8556
|
-
}
|
|
8557
|
-
function copy(target) {
|
|
8558
|
-
for(var name in target){
|
|
8559
|
-
if (/^[A-Z_]/.test(name)) {
|
|
8560
|
-
// @ts-expect-error safe to assign
|
|
8561
|
-
glContext[name] = target[name];
|
|
8562
|
-
}
|
|
8563
|
-
}
|
|
8564
|
-
}
|
|
8565
|
-
function vertexFormatType2GLType(formatType) {
|
|
8566
|
-
switch(formatType){
|
|
8567
|
-
case VertexFormatType.Float32:
|
|
8568
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8569
|
-
case VertexFormatType.Int16:
|
|
8570
|
-
return WebGLRenderingContext["SHORT"];
|
|
8571
|
-
case VertexFormatType.Int8:
|
|
8572
|
-
return WebGLRenderingContext["BYTE"];
|
|
8573
|
-
case VertexFormatType.UInt16:
|
|
8574
|
-
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
8575
|
-
case VertexFormatType.UInt8:
|
|
8576
|
-
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
8577
|
-
default:
|
|
8578
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8579
|
-
}
|
|
8580
|
-
}
|
|
8581
|
-
function glType2VertexFormatType(webglType) {
|
|
8582
|
-
switch(webglType){
|
|
8583
|
-
case WebGLRenderingContext["FLOAT"]:
|
|
8584
|
-
return VertexFormatType.Float32;
|
|
8585
|
-
case WebGLRenderingContext["SHORT"]:
|
|
8586
|
-
return VertexFormatType.Int16;
|
|
8587
|
-
case WebGLRenderingContext["BYTE"]:
|
|
8588
|
-
return VertexFormatType.Int8;
|
|
8589
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
8590
|
-
return VertexFormatType.UInt16;
|
|
8591
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
8592
|
-
return VertexFormatType.UInt8;
|
|
8593
|
-
default:
|
|
8594
|
-
return VertexFormatType.Float32;
|
|
8595
|
-
}
|
|
8596
|
-
}
|
|
8597
|
-
|
|
8598
|
-
var ShaderType;
|
|
8599
|
-
(function(ShaderType) {
|
|
8600
|
-
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
8601
|
-
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
8602
|
-
})(ShaderType || (ShaderType = {}));
|
|
8603
|
-
var MaskMode;
|
|
8604
|
-
(function(MaskMode) {
|
|
8605
|
-
/**
|
|
8606
|
-
* 无
|
|
8607
|
-
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
8608
|
-
/**
|
|
8609
|
-
* 蒙版
|
|
8610
|
-
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
8611
|
-
/**
|
|
8612
|
-
* 被遮挡
|
|
8613
|
-
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
8614
|
-
/**
|
|
8615
|
-
* 被反向遮挡
|
|
8616
|
-
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
8617
|
-
})(MaskMode || (MaskMode = {}));
|
|
8618
|
-
|
|
8619
|
-
function valIfUndefined(val, def) {
|
|
8620
|
-
if (val === undefined || val === null) {
|
|
8621
|
-
return def;
|
|
8622
|
-
}
|
|
8623
|
-
return val;
|
|
8624
|
-
}
|
|
8625
|
-
function getPreMultiAlpha(blending) {
|
|
8626
|
-
switch(blending){
|
|
8627
|
-
case BlendingMode.ALPHA:
|
|
8628
|
-
return 1;
|
|
8629
|
-
case BlendingMode.ADD:
|
|
8630
|
-
return 1;
|
|
8631
|
-
case BlendingMode.SUBTRACTION:
|
|
8632
|
-
return 1;
|
|
8633
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8634
|
-
return 1;
|
|
8635
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8636
|
-
return 1;
|
|
8637
|
-
case BlendingMode.SUPERPOSITION:
|
|
8638
|
-
return 2;
|
|
8639
|
-
case BlendingMode.BRIGHTNESS:
|
|
8640
|
-
return 3;
|
|
8641
|
-
case BlendingMode.MULTIPLY:
|
|
8642
|
-
return 0;
|
|
8643
|
-
default:
|
|
8644
|
-
// 处理undefined
|
|
8645
|
-
return 1;
|
|
8646
|
-
}
|
|
8647
|
-
}
|
|
8648
|
-
function setBlendMode(material, blendMode) {
|
|
8649
|
-
switch(blendMode){
|
|
8650
|
-
case undefined:
|
|
8651
|
-
material.blendFunction = [
|
|
8652
|
-
glContext.ONE,
|
|
8653
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8654
|
-
glContext.ONE,
|
|
8655
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8656
|
-
];
|
|
8657
|
-
break;
|
|
8658
|
-
case BlendingMode.ALPHA:
|
|
8659
|
-
material.blendFunction = [
|
|
8660
|
-
glContext.ONE,
|
|
8661
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8662
|
-
glContext.ONE,
|
|
8663
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8664
|
-
];
|
|
8665
|
-
break;
|
|
8666
|
-
case BlendingMode.ADD:
|
|
8667
|
-
material.blendFunction = [
|
|
8668
|
-
glContext.ONE,
|
|
8669
|
-
glContext.ONE,
|
|
8670
|
-
glContext.ONE,
|
|
8671
|
-
glContext.ONE
|
|
8672
|
-
];
|
|
8673
|
-
break;
|
|
8674
|
-
case BlendingMode.SUBTRACTION:
|
|
8675
|
-
material.blendFunction = [
|
|
8676
|
-
glContext.ONE,
|
|
8677
|
-
glContext.ONE,
|
|
8678
|
-
glContext.ZERO,
|
|
8679
|
-
glContext.ONE
|
|
8680
|
-
];
|
|
8681
|
-
material.blendEquation = [
|
|
8682
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
8683
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
8684
|
-
];
|
|
8685
|
-
break;
|
|
8686
|
-
case BlendingMode.SUPERPOSITION:
|
|
8687
|
-
material.blendFunction = [
|
|
8688
|
-
glContext.ONE,
|
|
8689
|
-
glContext.ONE,
|
|
8690
|
-
glContext.ONE,
|
|
8691
|
-
glContext.ONE
|
|
8692
|
-
];
|
|
8693
|
-
break;
|
|
8694
|
-
case BlendingMode.MULTIPLY:
|
|
8695
|
-
material.blendFunction = [
|
|
8696
|
-
glContext.DST_COLOR,
|
|
8697
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8698
|
-
glContext.DST_COLOR,
|
|
8699
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8700
|
-
];
|
|
8701
|
-
break;
|
|
8702
|
-
case BlendingMode.BRIGHTNESS:
|
|
8703
|
-
material.blendFunction = [
|
|
8704
|
-
glContext.ONE,
|
|
8705
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8706
|
-
glContext.ONE,
|
|
8707
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8708
|
-
];
|
|
8709
|
-
break;
|
|
8710
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8711
|
-
material.blendFunction = [
|
|
8712
|
-
glContext.DST_COLOR,
|
|
8713
|
-
glContext.DST_ALPHA,
|
|
8714
|
-
glContext.ZERO,
|
|
8715
|
-
glContext.ONE
|
|
8716
|
-
];
|
|
8717
|
-
break;
|
|
8718
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8719
|
-
material.blendFunction = [
|
|
8720
|
-
glContext.DST_COLOR,
|
|
8721
|
-
glContext.ZERO,
|
|
8722
|
-
glContext.ZERO,
|
|
8723
|
-
glContext.ONE
|
|
8724
|
-
];
|
|
8725
|
-
break;
|
|
8726
|
-
default:
|
|
8727
|
-
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
8728
|
-
}
|
|
8729
|
-
}
|
|
8730
|
-
function setSideMode(material, side) {
|
|
8731
|
-
if (side === SideMode.DOUBLE) {
|
|
8732
|
-
material.culling = false;
|
|
8733
|
-
} else {
|
|
8734
|
-
material.culling = true;
|
|
8735
|
-
material.frontFace = glContext.CW;
|
|
8736
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
8737
|
-
}
|
|
8738
|
-
}
|
|
8739
|
-
function setMaskMode(material, maskMode) {
|
|
8740
|
-
switch(maskMode){
|
|
8741
|
-
case undefined:
|
|
8742
|
-
material.stencilTest = false;
|
|
8743
|
-
break;
|
|
8744
|
-
case MaskMode.MASK:
|
|
8745
|
-
material.stencilTest = true;
|
|
8746
|
-
material.stencilFunc = [
|
|
8747
|
-
glContext.ALWAYS,
|
|
8748
|
-
glContext.ALWAYS
|
|
8749
|
-
];
|
|
8750
|
-
material.stencilOpZPass = [
|
|
8751
|
-
glContext.REPLACE,
|
|
8752
|
-
glContext.REPLACE
|
|
8753
|
-
];
|
|
8754
|
-
break;
|
|
8755
|
-
case MaskMode.OBSCURED:
|
|
8756
|
-
material.stencilTest = true;
|
|
8757
|
-
material.stencilFunc = [
|
|
8758
|
-
glContext.EQUAL,
|
|
8759
|
-
glContext.EQUAL
|
|
8760
|
-
];
|
|
8761
|
-
break;
|
|
8762
|
-
case MaskMode.REVERSE_OBSCURED:
|
|
8763
|
-
material.stencilTest = true;
|
|
8764
|
-
material.stencilFunc = [
|
|
8765
|
-
glContext.NOTEQUAL,
|
|
8766
|
-
glContext.NOTEQUAL
|
|
8767
|
-
];
|
|
8768
|
-
break;
|
|
8769
|
-
case MaskMode.NONE:
|
|
8770
|
-
material.stencilTest = false;
|
|
8771
|
-
break;
|
|
8772
|
-
default:
|
|
8773
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
8774
|
-
}
|
|
8775
|
-
}
|
|
8776
|
-
|
|
8777
|
-
var TextureLoadAction;
|
|
8778
|
-
(function(TextureLoadAction) {
|
|
8779
|
-
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
8780
|
-
//preserve previous attachment
|
|
8781
|
-
//load = 1,
|
|
8782
|
-
//clear attachment
|
|
8783
|
-
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
8784
|
-
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
8785
|
-
var TextureSourceType;
|
|
8786
|
-
(function(TextureSourceType) {
|
|
8787
|
-
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
8788
|
-
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
8789
|
-
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
8790
|
-
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
8791
|
-
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
8792
|
-
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
8793
|
-
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
8794
|
-
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
8795
|
-
})(TextureSourceType || (TextureSourceType = {}));
|
|
8796
|
-
|
|
8797
8861
|
/**
|
|
8798
8862
|
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
8799
8863
|
*/ var Downloader = /*#__PURE__*/ function() {
|
|
@@ -10272,39 +10336,6 @@ var MaterialRenderType;
|
|
|
10272
10336
|
return Material;
|
|
10273
10337
|
}(EffectsObject);
|
|
10274
10338
|
|
|
10275
|
-
var MaskProcessor = /*#__PURE__*/ function() {
|
|
10276
|
-
function MaskProcessor(engine) {
|
|
10277
|
-
this.engine = engine;
|
|
10278
|
-
this.alphaMaskEnabled = false;
|
|
10279
|
-
this.maskMode = MaskMode.NONE;
|
|
10280
|
-
this.maskable = null;
|
|
10281
|
-
this.stencilClearAction = {
|
|
10282
|
-
stencilAction: TextureLoadAction.clear
|
|
10283
|
-
};
|
|
10284
|
-
}
|
|
10285
|
-
var _proto = MaskProcessor.prototype;
|
|
10286
|
-
_proto.getRefValue = function getRefValue() {
|
|
10287
|
-
return 1;
|
|
10288
|
-
};
|
|
10289
|
-
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
10290
|
-
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask, _data_inverted = data.inverted, inverted = _data_inverted === void 0 ? false : _data_inverted, reference = data.reference, _data_alphaMaskEnabled = data.alphaMaskEnabled, alphaMaskEnabled = _data_alphaMaskEnabled === void 0 ? false : _data_alphaMaskEnabled;
|
|
10291
|
-
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
10292
|
-
if (isMask) {
|
|
10293
|
-
this.maskMode = MaskMode.MASK;
|
|
10294
|
-
} else {
|
|
10295
|
-
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
10296
|
-
this.maskable = this.engine.findObject(reference);
|
|
10297
|
-
}
|
|
10298
|
-
};
|
|
10299
|
-
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
10300
|
-
if (this.maskable) {
|
|
10301
|
-
renderer.clear(this.stencilClearAction);
|
|
10302
|
-
this.maskable.drawStencilMask(renderer);
|
|
10303
|
-
}
|
|
10304
|
-
};
|
|
10305
|
-
return MaskProcessor;
|
|
10306
|
-
}();
|
|
10307
|
-
|
|
10308
10339
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10309
10340
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10310
10341
|
var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
@@ -12718,244 +12749,131 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
12718
12749
|
return ShaderFactory;
|
|
12719
12750
|
}();
|
|
12720
12751
|
|
|
12721
|
-
// Bloom
|
|
12722
|
-
var
|
|
12723
|
-
_inherits(
|
|
12724
|
-
function
|
|
12752
|
+
// Bloom Pass - 包含阈值提取、高斯模糊(Down Sample 和 Up Sample)
|
|
12753
|
+
var BloomPass = /*#__PURE__*/ function(RenderPass) {
|
|
12754
|
+
_inherits(BloomPass, RenderPass);
|
|
12755
|
+
function BloomPass(renderer, iterationCount) {
|
|
12756
|
+
if (iterationCount === void 0) iterationCount = 4;
|
|
12725
12757
|
var _this;
|
|
12726
12758
|
_this = RenderPass.call(this, renderer) || this;
|
|
12759
|
+
_this.tempRTs = [];
|
|
12760
|
+
_this.iterationCount = iterationCount;
|
|
12727
12761
|
var engine = _this.renderer.engine;
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
attributes: {
|
|
12731
|
-
aPos: {
|
|
12732
|
-
type: glContext.FLOAT,
|
|
12733
|
-
size: 2,
|
|
12734
|
-
data: new Float32Array([
|
|
12735
|
-
-1,
|
|
12736
|
-
1,
|
|
12737
|
-
-1,
|
|
12738
|
-
-1,
|
|
12739
|
-
1,
|
|
12740
|
-
1,
|
|
12741
|
-
1,
|
|
12742
|
-
-1
|
|
12743
|
-
])
|
|
12744
|
-
}
|
|
12745
|
-
},
|
|
12746
|
-
drawCount: 4
|
|
12747
|
-
});
|
|
12748
|
-
var material = Material.create(engine, {
|
|
12762
|
+
// Threshold material
|
|
12763
|
+
_this.thresholdMaterial = Material.create(engine, {
|
|
12749
12764
|
shader: {
|
|
12750
12765
|
vertex: screenMeshVert,
|
|
12751
12766
|
fragment: thresholdFrag,
|
|
12752
12767
|
glslVersion: GLSLVersion.GLSL1
|
|
12753
12768
|
}
|
|
12754
12769
|
});
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12770
|
+
_this.thresholdMaterial.blending = false;
|
|
12771
|
+
_this.thresholdMaterial.depthTest = false;
|
|
12772
|
+
_this.thresholdMaterial.culling = false;
|
|
12773
|
+
// Down sample H material
|
|
12774
|
+
_this.downSampleHMaterial = Material.create(engine, {
|
|
12775
|
+
shader: {
|
|
12776
|
+
vertex: screenMeshVert,
|
|
12777
|
+
fragment: gaussianDownHFrag,
|
|
12778
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12779
|
+
}
|
|
12762
12780
|
});
|
|
12781
|
+
_this.downSampleHMaterial.blending = false;
|
|
12782
|
+
_this.downSampleHMaterial.depthTest = false;
|
|
12783
|
+
_this.downSampleHMaterial.culling = false;
|
|
12784
|
+
// Down sample V material
|
|
12785
|
+
_this.downSampleVMaterial = Material.create(engine, {
|
|
12786
|
+
shader: {
|
|
12787
|
+
vertex: screenMeshVert,
|
|
12788
|
+
fragment: gaussianDownVFrag,
|
|
12789
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12790
|
+
}
|
|
12791
|
+
});
|
|
12792
|
+
_this.downSampleVMaterial.blending = false;
|
|
12793
|
+
_this.downSampleVMaterial.depthTest = false;
|
|
12794
|
+
_this.downSampleVMaterial.culling = false;
|
|
12795
|
+
// Up sample material
|
|
12796
|
+
_this.upSampleMaterial = Material.create(engine, {
|
|
12797
|
+
shader: {
|
|
12798
|
+
vertex: screenMeshVert,
|
|
12799
|
+
fragment: gaussianUpFrag,
|
|
12800
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12801
|
+
}
|
|
12802
|
+
});
|
|
12803
|
+
_this.upSampleMaterial.blending = false;
|
|
12804
|
+
_this.upSampleMaterial.depthTest = false;
|
|
12805
|
+
_this.upSampleMaterial.culling = false;
|
|
12763
12806
|
_this.priority = 5000;
|
|
12764
|
-
_this.name = "
|
|
12807
|
+
_this.name = "BloomPass";
|
|
12765
12808
|
return _this;
|
|
12766
12809
|
}
|
|
12767
|
-
var _proto =
|
|
12810
|
+
var _proto = BloomPass.prototype;
|
|
12768
12811
|
_proto.configure = function configure(renderer) {
|
|
12769
|
-
|
|
12812
|
+
// 获取场景纹理用于 ToneMappingPass
|
|
12770
12813
|
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12771
12814
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
12772
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12773
12815
|
};
|
|
12774
12816
|
_proto.execute = function execute(renderer) {
|
|
12775
12817
|
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
12776
|
-
renderer.
|
|
12777
|
-
|
|
12778
|
-
depthAction: TextureLoadAction.clear,
|
|
12779
|
-
stencilAction: TextureLoadAction.clear
|
|
12780
|
-
});
|
|
12781
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12818
|
+
var baseWidth = renderer.getWidth();
|
|
12819
|
+
var baseHeight = renderer.getHeight();
|
|
12782
12820
|
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
12821
|
+
// 1. Threshold pass - 提取高亮区域
|
|
12783
12822
|
var threshold = (_renderer_renderingData_currentFrame_globalVolume_bloom_threshold = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) == null ? void 0 : (_renderer_renderingData_currentFrame_globalVolume_bloom = _renderer_renderingData_currentFrame_globalVolume.bloom) == null ? void 0 : _renderer_renderingData_currentFrame_globalVolume_bloom.threshold) != null ? _renderer_renderingData_currentFrame_globalVolume_bloom_threshold : 1.0;
|
|
12784
|
-
this.
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
]
|
|
12823
|
+
this.thresholdRT = renderer.getTemporaryRT("_BloomThreshold", baseWidth, baseHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12824
|
+
this.thresholdMaterial.setFloat("_Threshold", threshold);
|
|
12825
|
+
renderer.blit(this.mainTexture, this.thresholdRT, this.thresholdMaterial);
|
|
12826
|
+
var currentTexture = this.thresholdRT.getColorTextures()[0];
|
|
12827
|
+
// 2. Down sample passes
|
|
12828
|
+
for(var i = 0; i < this.iterationCount; i++){
|
|
12829
|
+
var downWidth = Math.floor(baseWidth / Math.pow(2, i + 1));
|
|
12830
|
+
var downHeight = Math.floor(baseHeight / Math.pow(2, i + 1));
|
|
12831
|
+
// Horizontal pass
|
|
12832
|
+
var tempH = renderer.getTemporaryRT("_BloomDownH" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12833
|
+
this.downSampleHMaterial.setVector2("_TextureSize", getTextureSize(currentTexture));
|
|
12834
|
+
renderer.blit(currentTexture, tempH, this.downSampleHMaterial);
|
|
12835
|
+
// Vertical pass
|
|
12836
|
+
var tempV = renderer.getTemporaryRT("_BloomDownV" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12837
|
+
this.downSampleVMaterial.setVector2("_TextureSize", getTextureSize(tempH.getColorTextures()[0]));
|
|
12838
|
+
renderer.blit(tempH.getColorTextures()[0], tempV, this.downSampleVMaterial);
|
|
12839
|
+
// 释放 H pass RT,保留 V pass RT 用于 up sample
|
|
12840
|
+
renderer.releaseTemporaryRT(tempH);
|
|
12841
|
+
this.tempRTs.push(tempV);
|
|
12842
|
+
currentTexture = tempV.getColorTextures()[0];
|
|
12843
|
+
}
|
|
12844
|
+
// 释放 threshold RT
|
|
12845
|
+
renderer.releaseTemporaryRT(this.thresholdRT);
|
|
12846
|
+
// 3. Up sample passes
|
|
12847
|
+
for(var i1 = this.iterationCount - 1; i1 > 0; i1--){
|
|
12848
|
+
var upWidth = Math.floor(baseWidth / Math.pow(2, i1 - 1));
|
|
12849
|
+
var upHeight = Math.floor(baseHeight / Math.pow(2, i1 - 1));
|
|
12850
|
+
var tempUp = renderer.getTemporaryRT("_BloomUp" + i1, upWidth, upHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12851
|
+
// 获取下一层的 down sample 结果
|
|
12852
|
+
var downSampleTexture = this.tempRTs[i1 - 1].getColorTextures()[0];
|
|
12853
|
+
this.upSampleMaterial.setTexture("_GaussianDownTex", downSampleTexture);
|
|
12854
|
+
this.upSampleMaterial.setVector2("_GaussianDownTextureSize", getTextureSize(downSampleTexture));
|
|
12855
|
+
renderer.blit(currentTexture, tempUp, this.upSampleMaterial);
|
|
12856
|
+
currentTexture = tempUp.getColorTextures()[0];
|
|
12857
|
+
this.tempRTs.push(tempUp);
|
|
12858
|
+
}
|
|
12859
|
+
// 设置最终输出到当前 framebuffer
|
|
12860
|
+
renderer.setFramebuffer(this.tempRTs[this.tempRTs.length - 1]);
|
|
12788
12861
|
};
|
|
12789
12862
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12790
|
-
|
|
12791
|
-
|
|
12863
|
+
// 释放所有临时 RT
|
|
12864
|
+
for(var i = 0; i < this.tempRTs.length; i++){
|
|
12865
|
+
renderer.releaseTemporaryRT(this.tempRTs[i]);
|
|
12792
12866
|
}
|
|
12867
|
+
this.tempRTs = [];
|
|
12793
12868
|
};
|
|
12794
12869
|
_proto.dispose = function dispose(options) {
|
|
12870
|
+
this.thresholdMaterial.dispose();
|
|
12871
|
+
this.downSampleHMaterial.dispose();
|
|
12872
|
+
this.downSampleVMaterial.dispose();
|
|
12873
|
+
this.upSampleMaterial.dispose();
|
|
12795
12874
|
RenderPass.prototype.dispose.call(this, options);
|
|
12796
12875
|
};
|
|
12797
|
-
return
|
|
12798
|
-
}(RenderPass);
|
|
12799
|
-
var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12800
|
-
_inherits(HQGaussianDownSamplePass, RenderPass);
|
|
12801
|
-
function HQGaussianDownSamplePass(renderer, type, level) {
|
|
12802
|
-
var _this;
|
|
12803
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12804
|
-
_this.type = type;
|
|
12805
|
-
_this.level = level;
|
|
12806
|
-
var engine = _this.renderer.engine;
|
|
12807
|
-
var name = "PostProcess";
|
|
12808
|
-
var geometry = Geometry.create(engine, {
|
|
12809
|
-
name: name,
|
|
12810
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12811
|
-
attributes: {
|
|
12812
|
-
aPos: {
|
|
12813
|
-
type: glContext.FLOAT,
|
|
12814
|
-
size: 2,
|
|
12815
|
-
data: new Float32Array([
|
|
12816
|
-
-1,
|
|
12817
|
-
1,
|
|
12818
|
-
-1,
|
|
12819
|
-
-1,
|
|
12820
|
-
1,
|
|
12821
|
-
1,
|
|
12822
|
-
1,
|
|
12823
|
-
-1
|
|
12824
|
-
])
|
|
12825
|
-
}
|
|
12826
|
-
},
|
|
12827
|
-
drawCount: 4
|
|
12828
|
-
});
|
|
12829
|
-
var fragment = type === "H" ? gaussianDownHFrag : gaussianDownVFrag;
|
|
12830
|
-
var shader = {
|
|
12831
|
-
vertex: screenMeshVert,
|
|
12832
|
-
fragment: fragment,
|
|
12833
|
-
glslVersion: GLSLVersion.GLSL1
|
|
12834
|
-
};
|
|
12835
|
-
var material = Material.create(engine, {
|
|
12836
|
-
name: name,
|
|
12837
|
-
shader: shader
|
|
12838
|
-
});
|
|
12839
|
-
material.blending = false;
|
|
12840
|
-
material.depthTest = false;
|
|
12841
|
-
material.culling = false;
|
|
12842
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12843
|
-
name: name,
|
|
12844
|
-
geometry: geometry,
|
|
12845
|
-
material: material,
|
|
12846
|
-
priority: 0
|
|
12847
|
-
});
|
|
12848
|
-
_this.priority = 5000;
|
|
12849
|
-
_this.name = "GaussianDownPass" + type + level;
|
|
12850
|
-
return _this;
|
|
12851
|
-
}
|
|
12852
|
-
var _proto = HQGaussianDownSamplePass.prototype;
|
|
12853
|
-
_proto.configure = function configure(renderer) {
|
|
12854
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
|
|
12855
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
|
|
12856
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12857
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12858
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12859
|
-
};
|
|
12860
|
-
_proto.execute = function execute(renderer) {
|
|
12861
|
-
renderer.clear({
|
|
12862
|
-
colorAction: TextureLoadAction.clear,
|
|
12863
|
-
depthAction: TextureLoadAction.clear,
|
|
12864
|
-
stencilAction: TextureLoadAction.clear
|
|
12865
|
-
});
|
|
12866
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12867
|
-
this.screenMesh.material.setVector2("_TextureSize", getTextureSize(this.mainTexture));
|
|
12868
|
-
renderer.renderMeshes([
|
|
12869
|
-
this.screenMesh
|
|
12870
|
-
]);
|
|
12871
|
-
if (this.type === "V") {
|
|
12872
|
-
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12873
|
-
}
|
|
12874
|
-
};
|
|
12875
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12876
|
-
if (this.framebuffer) {
|
|
12877
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12878
|
-
}
|
|
12879
|
-
};
|
|
12880
|
-
return HQGaussianDownSamplePass;
|
|
12881
|
-
}(RenderPass);
|
|
12882
|
-
var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12883
|
-
_inherits(HQGaussianUpSamplePass, RenderPass);
|
|
12884
|
-
function HQGaussianUpSamplePass(renderer, level) {
|
|
12885
|
-
var _this;
|
|
12886
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12887
|
-
_this.level = level;
|
|
12888
|
-
var name = "PostProcess";
|
|
12889
|
-
var engine = _this.renderer.engine;
|
|
12890
|
-
var geometry = Geometry.create(engine, {
|
|
12891
|
-
name: name,
|
|
12892
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12893
|
-
attributes: {
|
|
12894
|
-
aPos: {
|
|
12895
|
-
type: glContext.FLOAT,
|
|
12896
|
-
size: 2,
|
|
12897
|
-
data: new Float32Array([
|
|
12898
|
-
-1,
|
|
12899
|
-
1,
|
|
12900
|
-
-1,
|
|
12901
|
-
-1,
|
|
12902
|
-
1,
|
|
12903
|
-
1,
|
|
12904
|
-
1,
|
|
12905
|
-
-1
|
|
12906
|
-
])
|
|
12907
|
-
}
|
|
12908
|
-
},
|
|
12909
|
-
drawCount: 4
|
|
12910
|
-
});
|
|
12911
|
-
var shader = {
|
|
12912
|
-
vertex: screenMeshVert,
|
|
12913
|
-
fragment: gaussianUpFrag
|
|
12914
|
-
};
|
|
12915
|
-
var material = Material.create(engine, {
|
|
12916
|
-
name: name,
|
|
12917
|
-
shader: shader
|
|
12918
|
-
});
|
|
12919
|
-
material.blending = false;
|
|
12920
|
-
material.depthTest = false;
|
|
12921
|
-
material.culling = false;
|
|
12922
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12923
|
-
name: name,
|
|
12924
|
-
geometry: geometry,
|
|
12925
|
-
material: material,
|
|
12926
|
-
priority: 0
|
|
12927
|
-
});
|
|
12928
|
-
_this.priority = 5000;
|
|
12929
|
-
_this.name = "GaussianUpPass" + level;
|
|
12930
|
-
return _this;
|
|
12931
|
-
}
|
|
12932
|
-
var _proto = HQGaussianUpSamplePass.prototype;
|
|
12933
|
-
_proto.configure = function configure(renderer) {
|
|
12934
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
|
|
12935
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
|
|
12936
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12937
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12938
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12939
|
-
};
|
|
12940
|
-
_proto.execute = function execute(renderer) {
|
|
12941
|
-
renderer.clear({
|
|
12942
|
-
colorAction: TextureLoadAction.clear,
|
|
12943
|
-
depthAction: TextureLoadAction.clear,
|
|
12944
|
-
stencilAction: TextureLoadAction.clear
|
|
12945
|
-
});
|
|
12946
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12947
|
-
this.screenMesh.material.setTexture("_GaussianDownTex", this.gaussianDownSampleResult.texture);
|
|
12948
|
-
this.screenMesh.material.setVector2("_GaussianDownTextureSize", getTextureSize(this.gaussianDownSampleResult.texture));
|
|
12949
|
-
renderer.renderMeshes([
|
|
12950
|
-
this.screenMesh
|
|
12951
|
-
]);
|
|
12952
|
-
};
|
|
12953
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12954
|
-
if (this.framebuffer) {
|
|
12955
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12956
|
-
}
|
|
12957
|
-
};
|
|
12958
|
-
return HQGaussianUpSamplePass;
|
|
12876
|
+
return BloomPass;
|
|
12959
12877
|
}(RenderPass);
|
|
12960
12878
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
12961
12879
|
var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -13099,36 +13017,11 @@ var seed$5 = 1;
|
|
|
13099
13017
|
if (postProcessingEnabled) {
|
|
13100
13018
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
13101
13019
|
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
];
|
|
13108
|
-
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
13109
|
-
var bloomThresholdPass = new BloomThresholdPass(renderer);
|
|
13110
|
-
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
13111
|
-
this.addRenderPass(bloomThresholdPass);
|
|
13112
|
-
for(var i = 0; i < gaussianStep; i++){
|
|
13113
|
-
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
13114
|
-
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i);
|
|
13115
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i);
|
|
13116
|
-
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
13117
|
-
this.addRenderPass(gaussianDownHPass);
|
|
13118
|
-
this.addRenderPass(gaussianDownVPass);
|
|
13119
|
-
viewport[2] /= 2;
|
|
13120
|
-
viewport[3] /= 2;
|
|
13121
|
-
// TODO 限制最大迭代
|
|
13122
|
-
}
|
|
13123
|
-
viewport[2] *= 4;
|
|
13124
|
-
viewport[3] *= 4;
|
|
13125
|
-
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
13126
|
-
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1);
|
|
13127
|
-
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
13128
|
-
this.addRenderPass(gaussianUpPass);
|
|
13129
|
-
viewport[2] *= 2;
|
|
13130
|
-
viewport[3] *= 2;
|
|
13131
|
-
}
|
|
13020
|
+
// Bloom Pass(包含阈值提取、高斯模糊)
|
|
13021
|
+
var bloomPass = new BloomPass(renderer, gaussianStep);
|
|
13022
|
+
bloomPass.sceneTextureHandle = sceneTextureHandle;
|
|
13023
|
+
this.addRenderPass(bloomPass);
|
|
13024
|
+
// Tone Mapping Pass
|
|
13132
13025
|
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
13133
13026
|
this.addRenderPass(postProcessPass);
|
|
13134
13027
|
}
|
|
@@ -13622,6 +13515,14 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13622
13515
|
_proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
|
|
13623
13516
|
this.renderTargetPool.release(rt);
|
|
13624
13517
|
};
|
|
13518
|
+
/**
|
|
13519
|
+
* 将源纹理复制到目标 Framebuffer,可使用自定义材质进行处理
|
|
13520
|
+
* @param source - 源纹理
|
|
13521
|
+
* @param destination - 目标 Framebuffer,如果为 null 则渲染到屏幕
|
|
13522
|
+
* @param material - 可选的自定义材质,不传则使用默认复制材质
|
|
13523
|
+
*/ _proto.blit = function blit(source, destination, material) {
|
|
13524
|
+
// OVERRIDE
|
|
13525
|
+
};
|
|
13625
13526
|
_proto.dispose = function dispose() {
|
|
13626
13527
|
// OVERRIDE
|
|
13627
13528
|
};
|
|
@@ -31467,7 +31368,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31467
31368
|
return ret;
|
|
31468
31369
|
}
|
|
31469
31370
|
|
|
31470
|
-
var version$1 = "2.8.0-alpha.
|
|
31371
|
+
var version$1 = "2.8.0-alpha.3";
|
|
31471
31372
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31472
31373
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31473
31374
|
var reverseParticle = false;
|
|
@@ -35168,7 +35069,7 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35168
35069
|
registerPlugin("particle", ParticleLoader);
|
|
35169
35070
|
registerPlugin("cal", CalculateLoader);
|
|
35170
35071
|
registerPlugin("interact", InteractLoader);
|
|
35171
|
-
var version = "2.8.0-alpha.
|
|
35072
|
+
var version = "2.8.0-alpha.3";
|
|
35172
35073
|
logger.info("Core version: " + version + ".");
|
|
35173
35074
|
|
|
35174
35075
|
export { AbstractPlugin, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, PropertyClipPlayable, PropertyTrack, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|