@galacean/effects-threejs 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/dist/index.js +522 -621
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +522 -621
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin 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
|
'use strict';
|
|
@@ -7252,13 +7252,388 @@ __decorate([
|
|
|
7252
7252
|
serialize()
|
|
7253
7253
|
], RendererComponent.prototype, "_priority", void 0);
|
|
7254
7254
|
|
|
7255
|
+
exports.ShaderType = void 0;
|
|
7256
|
+
(function(ShaderType) {
|
|
7257
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
7258
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
7259
|
+
})(exports.ShaderType || (exports.ShaderType = {}));
|
|
7260
|
+
exports.MaskMode = void 0;
|
|
7261
|
+
(function(MaskMode) {
|
|
7262
|
+
/**
|
|
7263
|
+
* 无
|
|
7264
|
+
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
7265
|
+
/**
|
|
7266
|
+
* 蒙版
|
|
7267
|
+
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
7268
|
+
/**
|
|
7269
|
+
* 被遮挡
|
|
7270
|
+
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
7271
|
+
/**
|
|
7272
|
+
* 被反向遮挡
|
|
7273
|
+
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
7274
|
+
})(exports.MaskMode || (exports.MaskMode = {}));
|
|
7275
|
+
|
|
7276
|
+
exports.TextureLoadAction = void 0;
|
|
7277
|
+
(function(TextureLoadAction) {
|
|
7278
|
+
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
7279
|
+
//preserve previous attachment
|
|
7280
|
+
//load = 1,
|
|
7281
|
+
//clear attachment
|
|
7282
|
+
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
7283
|
+
})(exports.TextureLoadAction || (exports.TextureLoadAction = {}));
|
|
7284
|
+
exports.TextureSourceType = void 0;
|
|
7285
|
+
(function(TextureSourceType) {
|
|
7286
|
+
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
7287
|
+
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
7288
|
+
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
7289
|
+
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
7290
|
+
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
7291
|
+
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
7292
|
+
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
7293
|
+
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
7294
|
+
})(exports.TextureSourceType || (exports.TextureSourceType = {}));
|
|
7295
|
+
|
|
7296
|
+
var MaskProcessor = /*#__PURE__*/ function() {
|
|
7297
|
+
function MaskProcessor(engine) {
|
|
7298
|
+
this.engine = engine;
|
|
7299
|
+
this.alphaMaskEnabled = false;
|
|
7300
|
+
this.maskMode = exports.MaskMode.NONE;
|
|
7301
|
+
this.maskable = null;
|
|
7302
|
+
this.stencilClearAction = {
|
|
7303
|
+
stencilAction: exports.TextureLoadAction.clear
|
|
7304
|
+
};
|
|
7305
|
+
}
|
|
7306
|
+
var _proto = MaskProcessor.prototype;
|
|
7307
|
+
_proto.getRefValue = function getRefValue() {
|
|
7308
|
+
return 1;
|
|
7309
|
+
};
|
|
7310
|
+
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
7311
|
+
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;
|
|
7312
|
+
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
7313
|
+
if (isMask) {
|
|
7314
|
+
this.maskMode = exports.MaskMode.MASK;
|
|
7315
|
+
} else {
|
|
7316
|
+
this.maskMode = inverted ? exports.MaskMode.REVERSE_OBSCURED : exports.MaskMode.OBSCURED;
|
|
7317
|
+
this.maskable = this.engine.findObject(reference);
|
|
7318
|
+
}
|
|
7319
|
+
};
|
|
7320
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7321
|
+
if (this.maskable) {
|
|
7322
|
+
renderer.clear(this.stencilClearAction);
|
|
7323
|
+
this.maskable.drawStencilMask(renderer);
|
|
7324
|
+
}
|
|
7325
|
+
};
|
|
7326
|
+
return MaskProcessor;
|
|
7327
|
+
}();
|
|
7328
|
+
|
|
7329
|
+
/**
|
|
7330
|
+
* Helper class to create a WebGL Context
|
|
7331
|
+
*
|
|
7332
|
+
* @param canvas
|
|
7333
|
+
* @param glType
|
|
7334
|
+
* @param options
|
|
7335
|
+
* @returns
|
|
7336
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
7337
|
+
if (glType === void 0) glType = "webgl";
|
|
7338
|
+
var context;
|
|
7339
|
+
if (glType === "webgl2") {
|
|
7340
|
+
context = canvas.getContext("webgl2", options);
|
|
7341
|
+
if (!context) {
|
|
7342
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
7343
|
+
}
|
|
7344
|
+
}
|
|
7345
|
+
if (!context || glType === "webgl") {
|
|
7346
|
+
context = canvas.getContext("webgl", options);
|
|
7347
|
+
}
|
|
7348
|
+
if (!context) {
|
|
7349
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
7350
|
+
}
|
|
7351
|
+
return context;
|
|
7352
|
+
}
|
|
7353
|
+
|
|
7354
|
+
function gpuTimer(gl) {
|
|
7355
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
7356
|
+
if (ext) {
|
|
7357
|
+
var query = gl.createQuery();
|
|
7358
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
7359
|
+
return __generator(this, function(_state) {
|
|
7360
|
+
return [
|
|
7361
|
+
2,
|
|
7362
|
+
new Promise(function(resolve, reject) {
|
|
7363
|
+
if (query) {
|
|
7364
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
7365
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
7366
|
+
if (available && !disjoint) {
|
|
7367
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
7368
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
7369
|
+
// taken to use all significant bits of the result, not just the
|
|
7370
|
+
// least significant 32 bits.
|
|
7371
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
7372
|
+
}
|
|
7373
|
+
if (available || disjoint) {
|
|
7374
|
+
// Clean up the query object.
|
|
7375
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
7376
|
+
query = null;
|
|
7377
|
+
}
|
|
7378
|
+
available !== null && query && window.setTimeout(function() {
|
|
7379
|
+
getTime().then(resolve).catch;
|
|
7380
|
+
}, 1);
|
|
7381
|
+
}
|
|
7382
|
+
})
|
|
7383
|
+
];
|
|
7384
|
+
});
|
|
7385
|
+
});
|
|
7386
|
+
if (!query) {
|
|
7387
|
+
return;
|
|
7388
|
+
}
|
|
7389
|
+
return {
|
|
7390
|
+
begin: function() {
|
|
7391
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
7392
|
+
},
|
|
7393
|
+
end: function() {
|
|
7394
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
7395
|
+
},
|
|
7396
|
+
getTime: getTime
|
|
7397
|
+
};
|
|
7398
|
+
}
|
|
7399
|
+
}
|
|
7400
|
+
|
|
7401
|
+
var initErrors = [];
|
|
7402
|
+
var glContext = {};
|
|
7403
|
+
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
7404
|
+
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
7405
|
+
if (!initErrors.length) {
|
|
7406
|
+
initGLContext();
|
|
7407
|
+
}
|
|
7408
|
+
function initGLContext() {
|
|
7409
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
7410
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
7411
|
+
copy(WebGL2RenderingContext);
|
|
7412
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
7413
|
+
copy(WebGLRenderingContext);
|
|
7414
|
+
copy(WebGLRenderingContext.prototype);
|
|
7415
|
+
} else {
|
|
7416
|
+
if (canUseBOM) {
|
|
7417
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
7418
|
+
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7419
|
+
} else {
|
|
7420
|
+
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
7424
|
+
// @ts-expect-error set default value
|
|
7425
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
7426
|
+
}
|
|
7427
|
+
}
|
|
7428
|
+
function isWebGL2(gl) {
|
|
7429
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
7430
|
+
}
|
|
7431
|
+
function copy(target) {
|
|
7432
|
+
for(var name in target){
|
|
7433
|
+
if (/^[A-Z_]/.test(name)) {
|
|
7434
|
+
// @ts-expect-error safe to assign
|
|
7435
|
+
glContext[name] = target[name];
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
}
|
|
7439
|
+
function vertexFormatType2GLType(formatType) {
|
|
7440
|
+
switch(formatType){
|
|
7441
|
+
case VertexFormatType.Float32:
|
|
7442
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7443
|
+
case VertexFormatType.Int16:
|
|
7444
|
+
return WebGLRenderingContext["SHORT"];
|
|
7445
|
+
case VertexFormatType.Int8:
|
|
7446
|
+
return WebGLRenderingContext["BYTE"];
|
|
7447
|
+
case VertexFormatType.UInt16:
|
|
7448
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
7449
|
+
case VertexFormatType.UInt8:
|
|
7450
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
7451
|
+
default:
|
|
7452
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7453
|
+
}
|
|
7454
|
+
}
|
|
7455
|
+
function glType2VertexFormatType(webglType) {
|
|
7456
|
+
switch(webglType){
|
|
7457
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
7458
|
+
return VertexFormatType.Float32;
|
|
7459
|
+
case WebGLRenderingContext["SHORT"]:
|
|
7460
|
+
return VertexFormatType.Int16;
|
|
7461
|
+
case WebGLRenderingContext["BYTE"]:
|
|
7462
|
+
return VertexFormatType.Int8;
|
|
7463
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
7464
|
+
return VertexFormatType.UInt16;
|
|
7465
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
7466
|
+
return VertexFormatType.UInt8;
|
|
7467
|
+
default:
|
|
7468
|
+
return VertexFormatType.Float32;
|
|
7469
|
+
}
|
|
7470
|
+
}
|
|
7471
|
+
|
|
7472
|
+
function valIfUndefined(val, def) {
|
|
7473
|
+
if (val === undefined || val === null) {
|
|
7474
|
+
return def;
|
|
7475
|
+
}
|
|
7476
|
+
return val;
|
|
7477
|
+
}
|
|
7478
|
+
function getPreMultiAlpha(blending) {
|
|
7479
|
+
switch(blending){
|
|
7480
|
+
case BlendingMode.ALPHA:
|
|
7481
|
+
return 1;
|
|
7482
|
+
case BlendingMode.ADD:
|
|
7483
|
+
return 1;
|
|
7484
|
+
case BlendingMode.SUBTRACTION:
|
|
7485
|
+
return 1;
|
|
7486
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7487
|
+
return 1;
|
|
7488
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7489
|
+
return 1;
|
|
7490
|
+
case BlendingMode.SUPERPOSITION:
|
|
7491
|
+
return 2;
|
|
7492
|
+
case BlendingMode.BRIGHTNESS:
|
|
7493
|
+
return 3;
|
|
7494
|
+
case BlendingMode.MULTIPLY:
|
|
7495
|
+
return 0;
|
|
7496
|
+
default:
|
|
7497
|
+
// 处理undefined
|
|
7498
|
+
return 1;
|
|
7499
|
+
}
|
|
7500
|
+
}
|
|
7501
|
+
function setBlendMode(material, blendMode) {
|
|
7502
|
+
switch(blendMode){
|
|
7503
|
+
case undefined:
|
|
7504
|
+
material.blendFunction = [
|
|
7505
|
+
glContext.ONE,
|
|
7506
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7507
|
+
glContext.ONE,
|
|
7508
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7509
|
+
];
|
|
7510
|
+
break;
|
|
7511
|
+
case BlendingMode.ALPHA:
|
|
7512
|
+
material.blendFunction = [
|
|
7513
|
+
glContext.ONE,
|
|
7514
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7515
|
+
glContext.ONE,
|
|
7516
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7517
|
+
];
|
|
7518
|
+
break;
|
|
7519
|
+
case BlendingMode.ADD:
|
|
7520
|
+
material.blendFunction = [
|
|
7521
|
+
glContext.ONE,
|
|
7522
|
+
glContext.ONE,
|
|
7523
|
+
glContext.ONE,
|
|
7524
|
+
glContext.ONE
|
|
7525
|
+
];
|
|
7526
|
+
break;
|
|
7527
|
+
case BlendingMode.SUBTRACTION:
|
|
7528
|
+
material.blendFunction = [
|
|
7529
|
+
glContext.ONE,
|
|
7530
|
+
glContext.ONE,
|
|
7531
|
+
glContext.ZERO,
|
|
7532
|
+
glContext.ONE
|
|
7533
|
+
];
|
|
7534
|
+
material.blendEquation = [
|
|
7535
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
7536
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
7537
|
+
];
|
|
7538
|
+
break;
|
|
7539
|
+
case BlendingMode.SUPERPOSITION:
|
|
7540
|
+
material.blendFunction = [
|
|
7541
|
+
glContext.ONE,
|
|
7542
|
+
glContext.ONE,
|
|
7543
|
+
glContext.ONE,
|
|
7544
|
+
glContext.ONE
|
|
7545
|
+
];
|
|
7546
|
+
break;
|
|
7547
|
+
case BlendingMode.MULTIPLY:
|
|
7548
|
+
material.blendFunction = [
|
|
7549
|
+
glContext.DST_COLOR,
|
|
7550
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7551
|
+
glContext.DST_COLOR,
|
|
7552
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7553
|
+
];
|
|
7554
|
+
break;
|
|
7555
|
+
case BlendingMode.BRIGHTNESS:
|
|
7556
|
+
material.blendFunction = [
|
|
7557
|
+
glContext.ONE,
|
|
7558
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7559
|
+
glContext.ONE,
|
|
7560
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7561
|
+
];
|
|
7562
|
+
break;
|
|
7563
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7564
|
+
material.blendFunction = [
|
|
7565
|
+
glContext.DST_COLOR,
|
|
7566
|
+
glContext.DST_ALPHA,
|
|
7567
|
+
glContext.ZERO,
|
|
7568
|
+
glContext.ONE
|
|
7569
|
+
];
|
|
7570
|
+
break;
|
|
7571
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7572
|
+
material.blendFunction = [
|
|
7573
|
+
glContext.DST_COLOR,
|
|
7574
|
+
glContext.ZERO,
|
|
7575
|
+
glContext.ZERO,
|
|
7576
|
+
glContext.ONE
|
|
7577
|
+
];
|
|
7578
|
+
break;
|
|
7579
|
+
default:
|
|
7580
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
7581
|
+
}
|
|
7582
|
+
}
|
|
7583
|
+
function setSideMode(material, side) {
|
|
7584
|
+
if (side === SideMode.DOUBLE) {
|
|
7585
|
+
material.culling = false;
|
|
7586
|
+
} else {
|
|
7587
|
+
material.culling = true;
|
|
7588
|
+
material.frontFace = glContext.CW;
|
|
7589
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7590
|
+
}
|
|
7591
|
+
}
|
|
7592
|
+
function setMaskMode(material, maskMode) {
|
|
7593
|
+
switch(maskMode){
|
|
7594
|
+
case undefined:
|
|
7595
|
+
material.stencilTest = false;
|
|
7596
|
+
break;
|
|
7597
|
+
case exports.MaskMode.MASK:
|
|
7598
|
+
material.stencilTest = true;
|
|
7599
|
+
material.stencilFunc = [
|
|
7600
|
+
glContext.ALWAYS,
|
|
7601
|
+
glContext.ALWAYS
|
|
7602
|
+
];
|
|
7603
|
+
material.stencilOpZPass = [
|
|
7604
|
+
glContext.REPLACE,
|
|
7605
|
+
glContext.REPLACE
|
|
7606
|
+
];
|
|
7607
|
+
break;
|
|
7608
|
+
case exports.MaskMode.OBSCURED:
|
|
7609
|
+
material.stencilTest = true;
|
|
7610
|
+
material.stencilFunc = [
|
|
7611
|
+
glContext.EQUAL,
|
|
7612
|
+
glContext.EQUAL
|
|
7613
|
+
];
|
|
7614
|
+
break;
|
|
7615
|
+
case exports.MaskMode.REVERSE_OBSCURED:
|
|
7616
|
+
material.stencilTest = true;
|
|
7617
|
+
material.stencilFunc = [
|
|
7618
|
+
glContext.NOTEQUAL,
|
|
7619
|
+
glContext.NOTEQUAL
|
|
7620
|
+
];
|
|
7621
|
+
break;
|
|
7622
|
+
case exports.MaskMode.NONE:
|
|
7623
|
+
material.stencilTest = false;
|
|
7624
|
+
break;
|
|
7625
|
+
default:
|
|
7626
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
7627
|
+
}
|
|
7628
|
+
}
|
|
7629
|
+
|
|
7255
7630
|
/**
|
|
7256
7631
|
* Mesh 组件
|
|
7257
7632
|
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
7258
7633
|
_inherits(MeshComponent, RendererComponent);
|
|
7259
|
-
function MeshComponent() {
|
|
7634
|
+
function MeshComponent(engine) {
|
|
7260
7635
|
var _this;
|
|
7261
|
-
_this = RendererComponent.
|
|
7636
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
7262
7637
|
/**
|
|
7263
7638
|
* 用于点击测试的碰撞器
|
|
7264
7639
|
*/ _this.meshCollider = new MeshCollider();
|
|
@@ -7274,6 +7649,7 @@ __decorate([
|
|
|
7274
7649
|
};
|
|
7275
7650
|
}
|
|
7276
7651
|
};
|
|
7652
|
+
_this.maskManager = new MaskProcessor(engine);
|
|
7277
7653
|
return _this;
|
|
7278
7654
|
}
|
|
7279
7655
|
var _proto = MeshComponent.prototype;
|
|
@@ -7283,12 +7659,42 @@ __decorate([
|
|
|
7283
7659
|
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7284
7660
|
}
|
|
7285
7661
|
};
|
|
7662
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7663
|
+
if (!this.isActiveAndEnabled) {
|
|
7664
|
+
return;
|
|
7665
|
+
}
|
|
7666
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
7667
|
+
var material = this.materials[i];
|
|
7668
|
+
var previousColorMask = material.colorMask;
|
|
7669
|
+
material.colorMask = false;
|
|
7670
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7671
|
+
material.colorMask = previousColorMask;
|
|
7672
|
+
}
|
|
7673
|
+
};
|
|
7286
7674
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
7287
7675
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
7288
7676
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
7289
7677
|
var boundingBox = this.meshCollider.getBoundingBox();
|
|
7290
7678
|
return boundingBox;
|
|
7291
7679
|
};
|
|
7680
|
+
// TODO: Update data spec
|
|
7681
|
+
_proto.fromData = function fromData(data) {
|
|
7682
|
+
RendererComponent.prototype.fromData.call(this, data);
|
|
7683
|
+
var maskableRendererData = data;
|
|
7684
|
+
var maskOptions = maskableRendererData.mask;
|
|
7685
|
+
if (maskOptions) {
|
|
7686
|
+
this.maskManager.setMaskOptions(maskOptions);
|
|
7687
|
+
}
|
|
7688
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.materials), _step; !(_step = _iterator()).done;){
|
|
7689
|
+
var material = _step.value;
|
|
7690
|
+
var stencilRef = this.maskManager.getRefValue();
|
|
7691
|
+
material.stencilRef = [
|
|
7692
|
+
stencilRef,
|
|
7693
|
+
stencilRef
|
|
7694
|
+
];
|
|
7695
|
+
setMaskMode(material, this.maskManager.maskMode);
|
|
7696
|
+
}
|
|
7697
|
+
};
|
|
7292
7698
|
return MeshComponent;
|
|
7293
7699
|
}(RendererComponent);
|
|
7294
7700
|
__decorate([
|
|
@@ -8478,348 +8884,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
8478
8884
|
Matrix4.tempVec2 = new Vector3();
|
|
8479
8885
|
Matrix4.tempMat0 = new Matrix4();
|
|
8480
8886
|
|
|
8481
|
-
/**
|
|
8482
|
-
* Helper class to create a WebGL Context
|
|
8483
|
-
*
|
|
8484
|
-
* @param canvas
|
|
8485
|
-
* @param glType
|
|
8486
|
-
* @param options
|
|
8487
|
-
* @returns
|
|
8488
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
8489
|
-
if (glType === void 0) glType = "webgl";
|
|
8490
|
-
var context;
|
|
8491
|
-
if (glType === "webgl2") {
|
|
8492
|
-
context = canvas.getContext("webgl2", options);
|
|
8493
|
-
if (!context) {
|
|
8494
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
8495
|
-
}
|
|
8496
|
-
}
|
|
8497
|
-
if (!context || glType === "webgl") {
|
|
8498
|
-
context = canvas.getContext("webgl", options);
|
|
8499
|
-
}
|
|
8500
|
-
if (!context) {
|
|
8501
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
8502
|
-
}
|
|
8503
|
-
return context;
|
|
8504
|
-
}
|
|
8505
|
-
|
|
8506
|
-
function gpuTimer(gl) {
|
|
8507
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
8508
|
-
if (ext) {
|
|
8509
|
-
var query = gl.createQuery();
|
|
8510
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
8511
|
-
return __generator(this, function(_state) {
|
|
8512
|
-
return [
|
|
8513
|
-
2,
|
|
8514
|
-
new Promise(function(resolve, reject) {
|
|
8515
|
-
if (query) {
|
|
8516
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
8517
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
8518
|
-
if (available && !disjoint) {
|
|
8519
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
8520
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
8521
|
-
// taken to use all significant bits of the result, not just the
|
|
8522
|
-
// least significant 32 bits.
|
|
8523
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
8524
|
-
}
|
|
8525
|
-
if (available || disjoint) {
|
|
8526
|
-
// Clean up the query object.
|
|
8527
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
8528
|
-
query = null;
|
|
8529
|
-
}
|
|
8530
|
-
available !== null && query && window.setTimeout(function() {
|
|
8531
|
-
getTime().then(resolve).catch;
|
|
8532
|
-
}, 1);
|
|
8533
|
-
}
|
|
8534
|
-
})
|
|
8535
|
-
];
|
|
8536
|
-
});
|
|
8537
|
-
});
|
|
8538
|
-
if (!query) {
|
|
8539
|
-
return;
|
|
8540
|
-
}
|
|
8541
|
-
return {
|
|
8542
|
-
begin: function() {
|
|
8543
|
-
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
8544
|
-
},
|
|
8545
|
-
end: function() {
|
|
8546
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
8547
|
-
},
|
|
8548
|
-
getTime: getTime
|
|
8549
|
-
};
|
|
8550
|
-
}
|
|
8551
|
-
}
|
|
8552
|
-
|
|
8553
|
-
var initErrors = [];
|
|
8554
|
-
var glContext = {};
|
|
8555
|
-
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
8556
|
-
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
8557
|
-
if (!initErrors.length) {
|
|
8558
|
-
initGLContext();
|
|
8559
|
-
}
|
|
8560
|
-
function initGLContext() {
|
|
8561
|
-
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
8562
|
-
if (typeof WebGL2RenderingContext === "function") {
|
|
8563
|
-
copy(WebGL2RenderingContext);
|
|
8564
|
-
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
8565
|
-
copy(WebGLRenderingContext);
|
|
8566
|
-
copy(WebGLRenderingContext.prototype);
|
|
8567
|
-
} else {
|
|
8568
|
-
if (canUseBOM) {
|
|
8569
|
-
initErrors.push(// iOS 16 lockdown mode
|
|
8570
|
-
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8571
|
-
} else {
|
|
8572
|
-
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8573
|
-
}
|
|
8574
|
-
}
|
|
8575
|
-
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
8576
|
-
// @ts-expect-error set default value
|
|
8577
|
-
glContext["HALF_FLOAT"] = 5131;
|
|
8578
|
-
}
|
|
8579
|
-
}
|
|
8580
|
-
function isWebGL2(gl) {
|
|
8581
|
-
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
8582
|
-
}
|
|
8583
|
-
function copy(target) {
|
|
8584
|
-
for(var name in target){
|
|
8585
|
-
if (/^[A-Z_]/.test(name)) {
|
|
8586
|
-
// @ts-expect-error safe to assign
|
|
8587
|
-
glContext[name] = target[name];
|
|
8588
|
-
}
|
|
8589
|
-
}
|
|
8590
|
-
}
|
|
8591
|
-
function vertexFormatType2GLType(formatType) {
|
|
8592
|
-
switch(formatType){
|
|
8593
|
-
case VertexFormatType.Float32:
|
|
8594
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8595
|
-
case VertexFormatType.Int16:
|
|
8596
|
-
return WebGLRenderingContext["SHORT"];
|
|
8597
|
-
case VertexFormatType.Int8:
|
|
8598
|
-
return WebGLRenderingContext["BYTE"];
|
|
8599
|
-
case VertexFormatType.UInt16:
|
|
8600
|
-
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
8601
|
-
case VertexFormatType.UInt8:
|
|
8602
|
-
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
8603
|
-
default:
|
|
8604
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8605
|
-
}
|
|
8606
|
-
}
|
|
8607
|
-
function glType2VertexFormatType(webglType) {
|
|
8608
|
-
switch(webglType){
|
|
8609
|
-
case WebGLRenderingContext["FLOAT"]:
|
|
8610
|
-
return VertexFormatType.Float32;
|
|
8611
|
-
case WebGLRenderingContext["SHORT"]:
|
|
8612
|
-
return VertexFormatType.Int16;
|
|
8613
|
-
case WebGLRenderingContext["BYTE"]:
|
|
8614
|
-
return VertexFormatType.Int8;
|
|
8615
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
8616
|
-
return VertexFormatType.UInt16;
|
|
8617
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
8618
|
-
return VertexFormatType.UInt8;
|
|
8619
|
-
default:
|
|
8620
|
-
return VertexFormatType.Float32;
|
|
8621
|
-
}
|
|
8622
|
-
}
|
|
8623
|
-
|
|
8624
|
-
exports.ShaderType = void 0;
|
|
8625
|
-
(function(ShaderType) {
|
|
8626
|
-
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
8627
|
-
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
8628
|
-
})(exports.ShaderType || (exports.ShaderType = {}));
|
|
8629
|
-
exports.MaskMode = void 0;
|
|
8630
|
-
(function(MaskMode) {
|
|
8631
|
-
/**
|
|
8632
|
-
* 无
|
|
8633
|
-
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
8634
|
-
/**
|
|
8635
|
-
* 蒙版
|
|
8636
|
-
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
8637
|
-
/**
|
|
8638
|
-
* 被遮挡
|
|
8639
|
-
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
8640
|
-
/**
|
|
8641
|
-
* 被反向遮挡
|
|
8642
|
-
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
8643
|
-
})(exports.MaskMode || (exports.MaskMode = {}));
|
|
8644
|
-
|
|
8645
|
-
function valIfUndefined(val, def) {
|
|
8646
|
-
if (val === undefined || val === null) {
|
|
8647
|
-
return def;
|
|
8648
|
-
}
|
|
8649
|
-
return val;
|
|
8650
|
-
}
|
|
8651
|
-
function getPreMultiAlpha(blending) {
|
|
8652
|
-
switch(blending){
|
|
8653
|
-
case BlendingMode.ALPHA:
|
|
8654
|
-
return 1;
|
|
8655
|
-
case BlendingMode.ADD:
|
|
8656
|
-
return 1;
|
|
8657
|
-
case BlendingMode.SUBTRACTION:
|
|
8658
|
-
return 1;
|
|
8659
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8660
|
-
return 1;
|
|
8661
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8662
|
-
return 1;
|
|
8663
|
-
case BlendingMode.SUPERPOSITION:
|
|
8664
|
-
return 2;
|
|
8665
|
-
case BlendingMode.BRIGHTNESS:
|
|
8666
|
-
return 3;
|
|
8667
|
-
case BlendingMode.MULTIPLY:
|
|
8668
|
-
return 0;
|
|
8669
|
-
default:
|
|
8670
|
-
// 处理undefined
|
|
8671
|
-
return 1;
|
|
8672
|
-
}
|
|
8673
|
-
}
|
|
8674
|
-
function setBlendMode(material, blendMode) {
|
|
8675
|
-
switch(blendMode){
|
|
8676
|
-
case undefined:
|
|
8677
|
-
material.blendFunction = [
|
|
8678
|
-
glContext.ONE,
|
|
8679
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8680
|
-
glContext.ONE,
|
|
8681
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8682
|
-
];
|
|
8683
|
-
break;
|
|
8684
|
-
case BlendingMode.ALPHA:
|
|
8685
|
-
material.blendFunction = [
|
|
8686
|
-
glContext.ONE,
|
|
8687
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8688
|
-
glContext.ONE,
|
|
8689
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8690
|
-
];
|
|
8691
|
-
break;
|
|
8692
|
-
case BlendingMode.ADD:
|
|
8693
|
-
material.blendFunction = [
|
|
8694
|
-
glContext.ONE,
|
|
8695
|
-
glContext.ONE,
|
|
8696
|
-
glContext.ONE,
|
|
8697
|
-
glContext.ONE
|
|
8698
|
-
];
|
|
8699
|
-
break;
|
|
8700
|
-
case BlendingMode.SUBTRACTION:
|
|
8701
|
-
material.blendFunction = [
|
|
8702
|
-
glContext.ONE,
|
|
8703
|
-
glContext.ONE,
|
|
8704
|
-
glContext.ZERO,
|
|
8705
|
-
glContext.ONE
|
|
8706
|
-
];
|
|
8707
|
-
material.blendEquation = [
|
|
8708
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
8709
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
8710
|
-
];
|
|
8711
|
-
break;
|
|
8712
|
-
case BlendingMode.SUPERPOSITION:
|
|
8713
|
-
material.blendFunction = [
|
|
8714
|
-
glContext.ONE,
|
|
8715
|
-
glContext.ONE,
|
|
8716
|
-
glContext.ONE,
|
|
8717
|
-
glContext.ONE
|
|
8718
|
-
];
|
|
8719
|
-
break;
|
|
8720
|
-
case BlendingMode.MULTIPLY:
|
|
8721
|
-
material.blendFunction = [
|
|
8722
|
-
glContext.DST_COLOR,
|
|
8723
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8724
|
-
glContext.DST_COLOR,
|
|
8725
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8726
|
-
];
|
|
8727
|
-
break;
|
|
8728
|
-
case BlendingMode.BRIGHTNESS:
|
|
8729
|
-
material.blendFunction = [
|
|
8730
|
-
glContext.ONE,
|
|
8731
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8732
|
-
glContext.ONE,
|
|
8733
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8734
|
-
];
|
|
8735
|
-
break;
|
|
8736
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8737
|
-
material.blendFunction = [
|
|
8738
|
-
glContext.DST_COLOR,
|
|
8739
|
-
glContext.DST_ALPHA,
|
|
8740
|
-
glContext.ZERO,
|
|
8741
|
-
glContext.ONE
|
|
8742
|
-
];
|
|
8743
|
-
break;
|
|
8744
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8745
|
-
material.blendFunction = [
|
|
8746
|
-
glContext.DST_COLOR,
|
|
8747
|
-
glContext.ZERO,
|
|
8748
|
-
glContext.ZERO,
|
|
8749
|
-
glContext.ONE
|
|
8750
|
-
];
|
|
8751
|
-
break;
|
|
8752
|
-
default:
|
|
8753
|
-
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
8754
|
-
}
|
|
8755
|
-
}
|
|
8756
|
-
function setSideMode(material, side) {
|
|
8757
|
-
if (side === SideMode.DOUBLE) {
|
|
8758
|
-
material.culling = false;
|
|
8759
|
-
} else {
|
|
8760
|
-
material.culling = true;
|
|
8761
|
-
material.frontFace = glContext.CW;
|
|
8762
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
8763
|
-
}
|
|
8764
|
-
}
|
|
8765
|
-
function setMaskMode(material, maskMode) {
|
|
8766
|
-
switch(maskMode){
|
|
8767
|
-
case undefined:
|
|
8768
|
-
material.stencilTest = false;
|
|
8769
|
-
break;
|
|
8770
|
-
case exports.MaskMode.MASK:
|
|
8771
|
-
material.stencilTest = true;
|
|
8772
|
-
material.stencilFunc = [
|
|
8773
|
-
glContext.ALWAYS,
|
|
8774
|
-
glContext.ALWAYS
|
|
8775
|
-
];
|
|
8776
|
-
material.stencilOpZPass = [
|
|
8777
|
-
glContext.REPLACE,
|
|
8778
|
-
glContext.REPLACE
|
|
8779
|
-
];
|
|
8780
|
-
break;
|
|
8781
|
-
case exports.MaskMode.OBSCURED:
|
|
8782
|
-
material.stencilTest = true;
|
|
8783
|
-
material.stencilFunc = [
|
|
8784
|
-
glContext.EQUAL,
|
|
8785
|
-
glContext.EQUAL
|
|
8786
|
-
];
|
|
8787
|
-
break;
|
|
8788
|
-
case exports.MaskMode.REVERSE_OBSCURED:
|
|
8789
|
-
material.stencilTest = true;
|
|
8790
|
-
material.stencilFunc = [
|
|
8791
|
-
glContext.NOTEQUAL,
|
|
8792
|
-
glContext.NOTEQUAL
|
|
8793
|
-
];
|
|
8794
|
-
break;
|
|
8795
|
-
case exports.MaskMode.NONE:
|
|
8796
|
-
material.stencilTest = false;
|
|
8797
|
-
break;
|
|
8798
|
-
default:
|
|
8799
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
8800
|
-
}
|
|
8801
|
-
}
|
|
8802
|
-
|
|
8803
|
-
exports.TextureLoadAction = void 0;
|
|
8804
|
-
(function(TextureLoadAction) {
|
|
8805
|
-
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
8806
|
-
//preserve previous attachment
|
|
8807
|
-
//load = 1,
|
|
8808
|
-
//clear attachment
|
|
8809
|
-
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
8810
|
-
})(exports.TextureLoadAction || (exports.TextureLoadAction = {}));
|
|
8811
|
-
exports.TextureSourceType = void 0;
|
|
8812
|
-
(function(TextureSourceType) {
|
|
8813
|
-
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
8814
|
-
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
8815
|
-
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
8816
|
-
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
8817
|
-
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
8818
|
-
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
8819
|
-
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
8820
|
-
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
8821
|
-
})(exports.TextureSourceType || (exports.TextureSourceType = {}));
|
|
8822
|
-
|
|
8823
8887
|
/**
|
|
8824
8888
|
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
8825
8889
|
*/ var Downloader = /*#__PURE__*/ function() {
|
|
@@ -10298,39 +10362,6 @@ exports.MaterialRenderType = void 0;
|
|
|
10298
10362
|
return Material;
|
|
10299
10363
|
}(EffectsObject);
|
|
10300
10364
|
|
|
10301
|
-
var MaskProcessor = /*#__PURE__*/ function() {
|
|
10302
|
-
function MaskProcessor(engine) {
|
|
10303
|
-
this.engine = engine;
|
|
10304
|
-
this.alphaMaskEnabled = false;
|
|
10305
|
-
this.maskMode = exports.MaskMode.NONE;
|
|
10306
|
-
this.maskable = null;
|
|
10307
|
-
this.stencilClearAction = {
|
|
10308
|
-
stencilAction: exports.TextureLoadAction.clear
|
|
10309
|
-
};
|
|
10310
|
-
}
|
|
10311
|
-
var _proto = MaskProcessor.prototype;
|
|
10312
|
-
_proto.getRefValue = function getRefValue() {
|
|
10313
|
-
return 1;
|
|
10314
|
-
};
|
|
10315
|
-
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
10316
|
-
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;
|
|
10317
|
-
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
10318
|
-
if (isMask) {
|
|
10319
|
-
this.maskMode = exports.MaskMode.MASK;
|
|
10320
|
-
} else {
|
|
10321
|
-
this.maskMode = inverted ? exports.MaskMode.REVERSE_OBSCURED : exports.MaskMode.OBSCURED;
|
|
10322
|
-
this.maskable = this.engine.findObject(reference);
|
|
10323
|
-
}
|
|
10324
|
-
};
|
|
10325
|
-
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
10326
|
-
if (this.maskable) {
|
|
10327
|
-
renderer.clear(this.stencilClearAction);
|
|
10328
|
-
this.maskable.drawStencilMask(renderer);
|
|
10329
|
-
}
|
|
10330
|
-
};
|
|
10331
|
-
return MaskProcessor;
|
|
10332
|
-
}();
|
|
10333
|
-
|
|
10334
10365
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10335
10366
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10336
10367
|
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}";
|
|
@@ -12744,244 +12775,131 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
12744
12775
|
return ShaderFactory;
|
|
12745
12776
|
}();
|
|
12746
12777
|
|
|
12747
|
-
// Bloom
|
|
12748
|
-
var
|
|
12749
|
-
_inherits(
|
|
12750
|
-
function
|
|
12778
|
+
// Bloom Pass - 包含阈值提取、高斯模糊(Down Sample 和 Up Sample)
|
|
12779
|
+
var BloomPass = /*#__PURE__*/ function(RenderPass) {
|
|
12780
|
+
_inherits(BloomPass, RenderPass);
|
|
12781
|
+
function BloomPass(renderer, iterationCount) {
|
|
12782
|
+
if (iterationCount === void 0) iterationCount = 4;
|
|
12751
12783
|
var _this;
|
|
12752
12784
|
_this = RenderPass.call(this, renderer) || this;
|
|
12785
|
+
_this.tempRTs = [];
|
|
12786
|
+
_this.iterationCount = iterationCount;
|
|
12753
12787
|
var engine = _this.renderer.engine;
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
attributes: {
|
|
12757
|
-
aPos: {
|
|
12758
|
-
type: glContext.FLOAT,
|
|
12759
|
-
size: 2,
|
|
12760
|
-
data: new Float32Array([
|
|
12761
|
-
-1,
|
|
12762
|
-
1,
|
|
12763
|
-
-1,
|
|
12764
|
-
-1,
|
|
12765
|
-
1,
|
|
12766
|
-
1,
|
|
12767
|
-
1,
|
|
12768
|
-
-1
|
|
12769
|
-
])
|
|
12770
|
-
}
|
|
12771
|
-
},
|
|
12772
|
-
drawCount: 4
|
|
12773
|
-
});
|
|
12774
|
-
var material = Material.create(engine, {
|
|
12788
|
+
// Threshold material
|
|
12789
|
+
_this.thresholdMaterial = Material.create(engine, {
|
|
12775
12790
|
shader: {
|
|
12776
12791
|
vertex: screenMeshVert,
|
|
12777
12792
|
fragment: thresholdFrag,
|
|
12778
12793
|
glslVersion: exports.GLSLVersion.GLSL1
|
|
12779
12794
|
}
|
|
12780
12795
|
});
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12796
|
+
_this.thresholdMaterial.blending = false;
|
|
12797
|
+
_this.thresholdMaterial.depthTest = false;
|
|
12798
|
+
_this.thresholdMaterial.culling = false;
|
|
12799
|
+
// Down sample H material
|
|
12800
|
+
_this.downSampleHMaterial = Material.create(engine, {
|
|
12801
|
+
shader: {
|
|
12802
|
+
vertex: screenMeshVert,
|
|
12803
|
+
fragment: gaussianDownHFrag,
|
|
12804
|
+
glslVersion: exports.GLSLVersion.GLSL1
|
|
12805
|
+
}
|
|
12788
12806
|
});
|
|
12807
|
+
_this.downSampleHMaterial.blending = false;
|
|
12808
|
+
_this.downSampleHMaterial.depthTest = false;
|
|
12809
|
+
_this.downSampleHMaterial.culling = false;
|
|
12810
|
+
// Down sample V material
|
|
12811
|
+
_this.downSampleVMaterial = Material.create(engine, {
|
|
12812
|
+
shader: {
|
|
12813
|
+
vertex: screenMeshVert,
|
|
12814
|
+
fragment: gaussianDownVFrag,
|
|
12815
|
+
glslVersion: exports.GLSLVersion.GLSL1
|
|
12816
|
+
}
|
|
12817
|
+
});
|
|
12818
|
+
_this.downSampleVMaterial.blending = false;
|
|
12819
|
+
_this.downSampleVMaterial.depthTest = false;
|
|
12820
|
+
_this.downSampleVMaterial.culling = false;
|
|
12821
|
+
// Up sample material
|
|
12822
|
+
_this.upSampleMaterial = Material.create(engine, {
|
|
12823
|
+
shader: {
|
|
12824
|
+
vertex: screenMeshVert,
|
|
12825
|
+
fragment: gaussianUpFrag,
|
|
12826
|
+
glslVersion: exports.GLSLVersion.GLSL1
|
|
12827
|
+
}
|
|
12828
|
+
});
|
|
12829
|
+
_this.upSampleMaterial.blending = false;
|
|
12830
|
+
_this.upSampleMaterial.depthTest = false;
|
|
12831
|
+
_this.upSampleMaterial.culling = false;
|
|
12789
12832
|
_this.priority = 5000;
|
|
12790
|
-
_this.name = "
|
|
12833
|
+
_this.name = "BloomPass";
|
|
12791
12834
|
return _this;
|
|
12792
12835
|
}
|
|
12793
|
-
var _proto =
|
|
12836
|
+
var _proto = BloomPass.prototype;
|
|
12794
12837
|
_proto.configure = function configure(renderer) {
|
|
12795
|
-
|
|
12838
|
+
// 获取场景纹理用于 ToneMappingPass
|
|
12796
12839
|
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12797
12840
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
12798
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12799
12841
|
};
|
|
12800
12842
|
_proto.execute = function execute(renderer) {
|
|
12801
12843
|
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
12802
|
-
renderer.
|
|
12803
|
-
|
|
12804
|
-
depthAction: exports.TextureLoadAction.clear,
|
|
12805
|
-
stencilAction: exports.TextureLoadAction.clear
|
|
12806
|
-
});
|
|
12807
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12844
|
+
var baseWidth = renderer.getWidth();
|
|
12845
|
+
var baseHeight = renderer.getHeight();
|
|
12808
12846
|
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
12847
|
+
// 1. Threshold pass - 提取高亮区域
|
|
12809
12848
|
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;
|
|
12810
|
-
this.
|
|
12811
|
-
|
|
12812
|
-
|
|
12813
|
-
]
|
|
12849
|
+
this.thresholdRT = renderer.getTemporaryRT("_BloomThreshold", baseWidth, baseHeight, 0, exports.FilterMode.Linear, exports.RenderTextureFormat.RGBAHalf);
|
|
12850
|
+
this.thresholdMaterial.setFloat("_Threshold", threshold);
|
|
12851
|
+
renderer.blit(this.mainTexture, this.thresholdRT, this.thresholdMaterial);
|
|
12852
|
+
var currentTexture = this.thresholdRT.getColorTextures()[0];
|
|
12853
|
+
// 2. Down sample passes
|
|
12854
|
+
for(var i = 0; i < this.iterationCount; i++){
|
|
12855
|
+
var downWidth = Math.floor(baseWidth / Math.pow(2, i + 1));
|
|
12856
|
+
var downHeight = Math.floor(baseHeight / Math.pow(2, i + 1));
|
|
12857
|
+
// Horizontal pass
|
|
12858
|
+
var tempH = renderer.getTemporaryRT("_BloomDownH" + i, downWidth, downHeight, 0, exports.FilterMode.Linear, exports.RenderTextureFormat.RGBAHalf);
|
|
12859
|
+
this.downSampleHMaterial.setVector2("_TextureSize", getTextureSize(currentTexture));
|
|
12860
|
+
renderer.blit(currentTexture, tempH, this.downSampleHMaterial);
|
|
12861
|
+
// Vertical pass
|
|
12862
|
+
var tempV = renderer.getTemporaryRT("_BloomDownV" + i, downWidth, downHeight, 0, exports.FilterMode.Linear, exports.RenderTextureFormat.RGBAHalf);
|
|
12863
|
+
this.downSampleVMaterial.setVector2("_TextureSize", getTextureSize(tempH.getColorTextures()[0]));
|
|
12864
|
+
renderer.blit(tempH.getColorTextures()[0], tempV, this.downSampleVMaterial);
|
|
12865
|
+
// 释放 H pass RT,保留 V pass RT 用于 up sample
|
|
12866
|
+
renderer.releaseTemporaryRT(tempH);
|
|
12867
|
+
this.tempRTs.push(tempV);
|
|
12868
|
+
currentTexture = tempV.getColorTextures()[0];
|
|
12869
|
+
}
|
|
12870
|
+
// 释放 threshold RT
|
|
12871
|
+
renderer.releaseTemporaryRT(this.thresholdRT);
|
|
12872
|
+
// 3. Up sample passes
|
|
12873
|
+
for(var i1 = this.iterationCount - 1; i1 > 0; i1--){
|
|
12874
|
+
var upWidth = Math.floor(baseWidth / Math.pow(2, i1 - 1));
|
|
12875
|
+
var upHeight = Math.floor(baseHeight / Math.pow(2, i1 - 1));
|
|
12876
|
+
var tempUp = renderer.getTemporaryRT("_BloomUp" + i1, upWidth, upHeight, 0, exports.FilterMode.Linear, exports.RenderTextureFormat.RGBAHalf);
|
|
12877
|
+
// 获取下一层的 down sample 结果
|
|
12878
|
+
var downSampleTexture = this.tempRTs[i1 - 1].getColorTextures()[0];
|
|
12879
|
+
this.upSampleMaterial.setTexture("_GaussianDownTex", downSampleTexture);
|
|
12880
|
+
this.upSampleMaterial.setVector2("_GaussianDownTextureSize", getTextureSize(downSampleTexture));
|
|
12881
|
+
renderer.blit(currentTexture, tempUp, this.upSampleMaterial);
|
|
12882
|
+
currentTexture = tempUp.getColorTextures()[0];
|
|
12883
|
+
this.tempRTs.push(tempUp);
|
|
12884
|
+
}
|
|
12885
|
+
// 设置最终输出到当前 framebuffer
|
|
12886
|
+
renderer.setFramebuffer(this.tempRTs[this.tempRTs.length - 1]);
|
|
12814
12887
|
};
|
|
12815
12888
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12816
|
-
|
|
12817
|
-
|
|
12889
|
+
// 释放所有临时 RT
|
|
12890
|
+
for(var i = 0; i < this.tempRTs.length; i++){
|
|
12891
|
+
renderer.releaseTemporaryRT(this.tempRTs[i]);
|
|
12818
12892
|
}
|
|
12893
|
+
this.tempRTs = [];
|
|
12819
12894
|
};
|
|
12820
12895
|
_proto.dispose = function dispose(options) {
|
|
12896
|
+
this.thresholdMaterial.dispose();
|
|
12897
|
+
this.downSampleHMaterial.dispose();
|
|
12898
|
+
this.downSampleVMaterial.dispose();
|
|
12899
|
+
this.upSampleMaterial.dispose();
|
|
12821
12900
|
RenderPass.prototype.dispose.call(this, options);
|
|
12822
12901
|
};
|
|
12823
|
-
return
|
|
12824
|
-
}(RenderPass);
|
|
12825
|
-
var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12826
|
-
_inherits(HQGaussianDownSamplePass, RenderPass);
|
|
12827
|
-
function HQGaussianDownSamplePass(renderer, type, level) {
|
|
12828
|
-
var _this;
|
|
12829
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12830
|
-
_this.type = type;
|
|
12831
|
-
_this.level = level;
|
|
12832
|
-
var engine = _this.renderer.engine;
|
|
12833
|
-
var name = "PostProcess";
|
|
12834
|
-
var geometry = Geometry.create(engine, {
|
|
12835
|
-
name: name,
|
|
12836
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12837
|
-
attributes: {
|
|
12838
|
-
aPos: {
|
|
12839
|
-
type: glContext.FLOAT,
|
|
12840
|
-
size: 2,
|
|
12841
|
-
data: new Float32Array([
|
|
12842
|
-
-1,
|
|
12843
|
-
1,
|
|
12844
|
-
-1,
|
|
12845
|
-
-1,
|
|
12846
|
-
1,
|
|
12847
|
-
1,
|
|
12848
|
-
1,
|
|
12849
|
-
-1
|
|
12850
|
-
])
|
|
12851
|
-
}
|
|
12852
|
-
},
|
|
12853
|
-
drawCount: 4
|
|
12854
|
-
});
|
|
12855
|
-
var fragment = type === "H" ? gaussianDownHFrag : gaussianDownVFrag;
|
|
12856
|
-
var shader = {
|
|
12857
|
-
vertex: screenMeshVert,
|
|
12858
|
-
fragment: fragment,
|
|
12859
|
-
glslVersion: exports.GLSLVersion.GLSL1
|
|
12860
|
-
};
|
|
12861
|
-
var material = Material.create(engine, {
|
|
12862
|
-
name: name,
|
|
12863
|
-
shader: shader
|
|
12864
|
-
});
|
|
12865
|
-
material.blending = false;
|
|
12866
|
-
material.depthTest = false;
|
|
12867
|
-
material.culling = false;
|
|
12868
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12869
|
-
name: name,
|
|
12870
|
-
geometry: geometry,
|
|
12871
|
-
material: material,
|
|
12872
|
-
priority: 0
|
|
12873
|
-
});
|
|
12874
|
-
_this.priority = 5000;
|
|
12875
|
-
_this.name = "GaussianDownPass" + type + level;
|
|
12876
|
-
return _this;
|
|
12877
|
-
}
|
|
12878
|
-
var _proto = HQGaussianDownSamplePass.prototype;
|
|
12879
|
-
_proto.configure = function configure(renderer) {
|
|
12880
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
|
|
12881
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
|
|
12882
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, exports.FilterMode.Linear, exports.RenderTextureFormat.RGBAHalf);
|
|
12883
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12884
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12885
|
-
};
|
|
12886
|
-
_proto.execute = function execute(renderer) {
|
|
12887
|
-
renderer.clear({
|
|
12888
|
-
colorAction: exports.TextureLoadAction.clear,
|
|
12889
|
-
depthAction: exports.TextureLoadAction.clear,
|
|
12890
|
-
stencilAction: exports.TextureLoadAction.clear
|
|
12891
|
-
});
|
|
12892
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12893
|
-
this.screenMesh.material.setVector2("_TextureSize", getTextureSize(this.mainTexture));
|
|
12894
|
-
renderer.renderMeshes([
|
|
12895
|
-
this.screenMesh
|
|
12896
|
-
]);
|
|
12897
|
-
if (this.type === "V") {
|
|
12898
|
-
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12899
|
-
}
|
|
12900
|
-
};
|
|
12901
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12902
|
-
if (this.framebuffer) {
|
|
12903
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12904
|
-
}
|
|
12905
|
-
};
|
|
12906
|
-
return HQGaussianDownSamplePass;
|
|
12907
|
-
}(RenderPass);
|
|
12908
|
-
var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12909
|
-
_inherits(HQGaussianUpSamplePass, RenderPass);
|
|
12910
|
-
function HQGaussianUpSamplePass(renderer, level) {
|
|
12911
|
-
var _this;
|
|
12912
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12913
|
-
_this.level = level;
|
|
12914
|
-
var name = "PostProcess";
|
|
12915
|
-
var engine = _this.renderer.engine;
|
|
12916
|
-
var geometry = Geometry.create(engine, {
|
|
12917
|
-
name: name,
|
|
12918
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12919
|
-
attributes: {
|
|
12920
|
-
aPos: {
|
|
12921
|
-
type: glContext.FLOAT,
|
|
12922
|
-
size: 2,
|
|
12923
|
-
data: new Float32Array([
|
|
12924
|
-
-1,
|
|
12925
|
-
1,
|
|
12926
|
-
-1,
|
|
12927
|
-
-1,
|
|
12928
|
-
1,
|
|
12929
|
-
1,
|
|
12930
|
-
1,
|
|
12931
|
-
-1
|
|
12932
|
-
])
|
|
12933
|
-
}
|
|
12934
|
-
},
|
|
12935
|
-
drawCount: 4
|
|
12936
|
-
});
|
|
12937
|
-
var shader = {
|
|
12938
|
-
vertex: screenMeshVert,
|
|
12939
|
-
fragment: gaussianUpFrag
|
|
12940
|
-
};
|
|
12941
|
-
var material = Material.create(engine, {
|
|
12942
|
-
name: name,
|
|
12943
|
-
shader: shader
|
|
12944
|
-
});
|
|
12945
|
-
material.blending = false;
|
|
12946
|
-
material.depthTest = false;
|
|
12947
|
-
material.culling = false;
|
|
12948
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12949
|
-
name: name,
|
|
12950
|
-
geometry: geometry,
|
|
12951
|
-
material: material,
|
|
12952
|
-
priority: 0
|
|
12953
|
-
});
|
|
12954
|
-
_this.priority = 5000;
|
|
12955
|
-
_this.name = "GaussianUpPass" + level;
|
|
12956
|
-
return _this;
|
|
12957
|
-
}
|
|
12958
|
-
var _proto = HQGaussianUpSamplePass.prototype;
|
|
12959
|
-
_proto.configure = function configure(renderer) {
|
|
12960
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
|
|
12961
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
|
|
12962
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, exports.FilterMode.Linear, exports.RenderTextureFormat.RGBAHalf);
|
|
12963
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12964
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12965
|
-
};
|
|
12966
|
-
_proto.execute = function execute(renderer) {
|
|
12967
|
-
renderer.clear({
|
|
12968
|
-
colorAction: exports.TextureLoadAction.clear,
|
|
12969
|
-
depthAction: exports.TextureLoadAction.clear,
|
|
12970
|
-
stencilAction: exports.TextureLoadAction.clear
|
|
12971
|
-
});
|
|
12972
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12973
|
-
this.screenMesh.material.setTexture("_GaussianDownTex", this.gaussianDownSampleResult.texture);
|
|
12974
|
-
this.screenMesh.material.setVector2("_GaussianDownTextureSize", getTextureSize(this.gaussianDownSampleResult.texture));
|
|
12975
|
-
renderer.renderMeshes([
|
|
12976
|
-
this.screenMesh
|
|
12977
|
-
]);
|
|
12978
|
-
};
|
|
12979
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12980
|
-
if (this.framebuffer) {
|
|
12981
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12982
|
-
}
|
|
12983
|
-
};
|
|
12984
|
-
return HQGaussianUpSamplePass;
|
|
12902
|
+
return BloomPass;
|
|
12985
12903
|
}(RenderPass);
|
|
12986
12904
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
12987
12905
|
var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -13125,36 +13043,11 @@ var seed$6 = 1;
|
|
|
13125
13043
|
if (postProcessingEnabled) {
|
|
13126
13044
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
13127
13045
|
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
|
|
13132
|
-
|
|
13133
|
-
];
|
|
13134
|
-
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
13135
|
-
var bloomThresholdPass = new BloomThresholdPass(renderer);
|
|
13136
|
-
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
13137
|
-
this.addRenderPass(bloomThresholdPass);
|
|
13138
|
-
for(var i = 0; i < gaussianStep; i++){
|
|
13139
|
-
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
13140
|
-
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i);
|
|
13141
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i);
|
|
13142
|
-
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
13143
|
-
this.addRenderPass(gaussianDownHPass);
|
|
13144
|
-
this.addRenderPass(gaussianDownVPass);
|
|
13145
|
-
viewport[2] /= 2;
|
|
13146
|
-
viewport[3] /= 2;
|
|
13147
|
-
// TODO 限制最大迭代
|
|
13148
|
-
}
|
|
13149
|
-
viewport[2] *= 4;
|
|
13150
|
-
viewport[3] *= 4;
|
|
13151
|
-
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
13152
|
-
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1);
|
|
13153
|
-
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
13154
|
-
this.addRenderPass(gaussianUpPass);
|
|
13155
|
-
viewport[2] *= 2;
|
|
13156
|
-
viewport[3] *= 2;
|
|
13157
|
-
}
|
|
13046
|
+
// Bloom Pass(包含阈值提取、高斯模糊)
|
|
13047
|
+
var bloomPass = new BloomPass(renderer, gaussianStep);
|
|
13048
|
+
bloomPass.sceneTextureHandle = sceneTextureHandle;
|
|
13049
|
+
this.addRenderPass(bloomPass);
|
|
13050
|
+
// Tone Mapping Pass
|
|
13158
13051
|
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
13159
13052
|
this.addRenderPass(postProcessPass);
|
|
13160
13053
|
}
|
|
@@ -13648,6 +13541,14 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13648
13541
|
_proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
|
|
13649
13542
|
this.renderTargetPool.release(rt);
|
|
13650
13543
|
};
|
|
13544
|
+
/**
|
|
13545
|
+
* 将源纹理复制到目标 Framebuffer,可使用自定义材质进行处理
|
|
13546
|
+
* @param source - 源纹理
|
|
13547
|
+
* @param destination - 目标 Framebuffer,如果为 null 则渲染到屏幕
|
|
13548
|
+
* @param material - 可选的自定义材质,不传则使用默认复制材质
|
|
13549
|
+
*/ _proto.blit = function blit(source, destination, material) {
|
|
13550
|
+
// OVERRIDE
|
|
13551
|
+
};
|
|
13651
13552
|
_proto.dispose = function dispose() {
|
|
13652
13553
|
// OVERRIDE
|
|
13653
13554
|
};
|
|
@@ -31493,7 +31394,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31493
31394
|
return ret;
|
|
31494
31395
|
}
|
|
31495
31396
|
|
|
31496
|
-
var version$2 = "2.8.0-alpha.
|
|
31397
|
+
var version$2 = "2.8.0-alpha.3";
|
|
31497
31398
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31498
31399
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31499
31400
|
var reverseParticle = false;
|
|
@@ -35194,7 +35095,7 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35194
35095
|
registerPlugin("particle", ParticleLoader);
|
|
35195
35096
|
registerPlugin("cal", CalculateLoader);
|
|
35196
35097
|
registerPlugin("interact", InteractLoader);
|
|
35197
|
-
var version$1 = "2.8.0-alpha.
|
|
35098
|
+
var version$1 = "2.8.0-alpha.3";
|
|
35198
35099
|
logger.info("Core version: " + version$1 + ".");
|
|
35199
35100
|
|
|
35200
35101
|
var _obj;
|
|
@@ -36784,7 +36685,7 @@ applyMixins(exports.ThreeTextComponent, [
|
|
|
36784
36685
|
*/ Mesh.create = function(engine, props) {
|
|
36785
36686
|
return new ThreeMesh(engine, props);
|
|
36786
36687
|
};
|
|
36787
|
-
var version = "2.8.0-alpha.
|
|
36688
|
+
var version = "2.8.0-alpha.3";
|
|
36788
36689
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36789
36690
|
|
|
36790
36691
|
exports.AbstractPlugin = AbstractPlugin;
|