@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.mjs
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
|
import * as THREE from 'three';
|
|
@@ -7228,13 +7228,388 @@ __decorate([
|
|
|
7228
7228
|
serialize()
|
|
7229
7229
|
], RendererComponent.prototype, "_priority", void 0);
|
|
7230
7230
|
|
|
7231
|
+
var ShaderType;
|
|
7232
|
+
(function(ShaderType) {
|
|
7233
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
7234
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
7235
|
+
})(ShaderType || (ShaderType = {}));
|
|
7236
|
+
var MaskMode;
|
|
7237
|
+
(function(MaskMode) {
|
|
7238
|
+
/**
|
|
7239
|
+
* 无
|
|
7240
|
+
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
7241
|
+
/**
|
|
7242
|
+
* 蒙版
|
|
7243
|
+
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
7244
|
+
/**
|
|
7245
|
+
* 被遮挡
|
|
7246
|
+
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
7247
|
+
/**
|
|
7248
|
+
* 被反向遮挡
|
|
7249
|
+
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
7250
|
+
})(MaskMode || (MaskMode = {}));
|
|
7251
|
+
|
|
7252
|
+
var TextureLoadAction;
|
|
7253
|
+
(function(TextureLoadAction) {
|
|
7254
|
+
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
7255
|
+
//preserve previous attachment
|
|
7256
|
+
//load = 1,
|
|
7257
|
+
//clear attachment
|
|
7258
|
+
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
7259
|
+
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
7260
|
+
var TextureSourceType;
|
|
7261
|
+
(function(TextureSourceType) {
|
|
7262
|
+
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
7263
|
+
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
7264
|
+
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
7265
|
+
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
7266
|
+
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
7267
|
+
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
7268
|
+
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
7269
|
+
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
7270
|
+
})(TextureSourceType || (TextureSourceType = {}));
|
|
7271
|
+
|
|
7272
|
+
var MaskProcessor = /*#__PURE__*/ function() {
|
|
7273
|
+
function MaskProcessor(engine) {
|
|
7274
|
+
this.engine = engine;
|
|
7275
|
+
this.alphaMaskEnabled = false;
|
|
7276
|
+
this.maskMode = MaskMode.NONE;
|
|
7277
|
+
this.maskable = null;
|
|
7278
|
+
this.stencilClearAction = {
|
|
7279
|
+
stencilAction: TextureLoadAction.clear
|
|
7280
|
+
};
|
|
7281
|
+
}
|
|
7282
|
+
var _proto = MaskProcessor.prototype;
|
|
7283
|
+
_proto.getRefValue = function getRefValue() {
|
|
7284
|
+
return 1;
|
|
7285
|
+
};
|
|
7286
|
+
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
7287
|
+
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;
|
|
7288
|
+
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
7289
|
+
if (isMask) {
|
|
7290
|
+
this.maskMode = MaskMode.MASK;
|
|
7291
|
+
} else {
|
|
7292
|
+
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
7293
|
+
this.maskable = this.engine.findObject(reference);
|
|
7294
|
+
}
|
|
7295
|
+
};
|
|
7296
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7297
|
+
if (this.maskable) {
|
|
7298
|
+
renderer.clear(this.stencilClearAction);
|
|
7299
|
+
this.maskable.drawStencilMask(renderer);
|
|
7300
|
+
}
|
|
7301
|
+
};
|
|
7302
|
+
return MaskProcessor;
|
|
7303
|
+
}();
|
|
7304
|
+
|
|
7305
|
+
/**
|
|
7306
|
+
* Helper class to create a WebGL Context
|
|
7307
|
+
*
|
|
7308
|
+
* @param canvas
|
|
7309
|
+
* @param glType
|
|
7310
|
+
* @param options
|
|
7311
|
+
* @returns
|
|
7312
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
7313
|
+
if (glType === void 0) glType = "webgl";
|
|
7314
|
+
var context;
|
|
7315
|
+
if (glType === "webgl2") {
|
|
7316
|
+
context = canvas.getContext("webgl2", options);
|
|
7317
|
+
if (!context) {
|
|
7318
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
7319
|
+
}
|
|
7320
|
+
}
|
|
7321
|
+
if (!context || glType === "webgl") {
|
|
7322
|
+
context = canvas.getContext("webgl", options);
|
|
7323
|
+
}
|
|
7324
|
+
if (!context) {
|
|
7325
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
7326
|
+
}
|
|
7327
|
+
return context;
|
|
7328
|
+
}
|
|
7329
|
+
|
|
7330
|
+
function gpuTimer(gl) {
|
|
7331
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
7332
|
+
if (ext) {
|
|
7333
|
+
var query = gl.createQuery();
|
|
7334
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
7335
|
+
return __generator(this, function(_state) {
|
|
7336
|
+
return [
|
|
7337
|
+
2,
|
|
7338
|
+
new Promise(function(resolve, reject) {
|
|
7339
|
+
if (query) {
|
|
7340
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
7341
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
7342
|
+
if (available && !disjoint) {
|
|
7343
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
7344
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
7345
|
+
// taken to use all significant bits of the result, not just the
|
|
7346
|
+
// least significant 32 bits.
|
|
7347
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
7348
|
+
}
|
|
7349
|
+
if (available || disjoint) {
|
|
7350
|
+
// Clean up the query object.
|
|
7351
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
7352
|
+
query = null;
|
|
7353
|
+
}
|
|
7354
|
+
available !== null && query && window.setTimeout(function() {
|
|
7355
|
+
getTime().then(resolve).catch;
|
|
7356
|
+
}, 1);
|
|
7357
|
+
}
|
|
7358
|
+
})
|
|
7359
|
+
];
|
|
7360
|
+
});
|
|
7361
|
+
});
|
|
7362
|
+
if (!query) {
|
|
7363
|
+
return;
|
|
7364
|
+
}
|
|
7365
|
+
return {
|
|
7366
|
+
begin: function() {
|
|
7367
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
7368
|
+
},
|
|
7369
|
+
end: function() {
|
|
7370
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
7371
|
+
},
|
|
7372
|
+
getTime: getTime
|
|
7373
|
+
};
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7377
|
+
var initErrors = [];
|
|
7378
|
+
var glContext = {};
|
|
7379
|
+
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
7380
|
+
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
7381
|
+
if (!initErrors.length) {
|
|
7382
|
+
initGLContext();
|
|
7383
|
+
}
|
|
7384
|
+
function initGLContext() {
|
|
7385
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
7386
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
7387
|
+
copy(WebGL2RenderingContext);
|
|
7388
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
7389
|
+
copy(WebGLRenderingContext);
|
|
7390
|
+
copy(WebGLRenderingContext.prototype);
|
|
7391
|
+
} else {
|
|
7392
|
+
if (canUseBOM) {
|
|
7393
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
7394
|
+
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7395
|
+
} else {
|
|
7396
|
+
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
7400
|
+
// @ts-expect-error set default value
|
|
7401
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
7402
|
+
}
|
|
7403
|
+
}
|
|
7404
|
+
function isWebGL2(gl) {
|
|
7405
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
7406
|
+
}
|
|
7407
|
+
function copy(target) {
|
|
7408
|
+
for(var name in target){
|
|
7409
|
+
if (/^[A-Z_]/.test(name)) {
|
|
7410
|
+
// @ts-expect-error safe to assign
|
|
7411
|
+
glContext[name] = target[name];
|
|
7412
|
+
}
|
|
7413
|
+
}
|
|
7414
|
+
}
|
|
7415
|
+
function vertexFormatType2GLType(formatType) {
|
|
7416
|
+
switch(formatType){
|
|
7417
|
+
case VertexFormatType.Float32:
|
|
7418
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7419
|
+
case VertexFormatType.Int16:
|
|
7420
|
+
return WebGLRenderingContext["SHORT"];
|
|
7421
|
+
case VertexFormatType.Int8:
|
|
7422
|
+
return WebGLRenderingContext["BYTE"];
|
|
7423
|
+
case VertexFormatType.UInt16:
|
|
7424
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
7425
|
+
case VertexFormatType.UInt8:
|
|
7426
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
7427
|
+
default:
|
|
7428
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7429
|
+
}
|
|
7430
|
+
}
|
|
7431
|
+
function glType2VertexFormatType(webglType) {
|
|
7432
|
+
switch(webglType){
|
|
7433
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
7434
|
+
return VertexFormatType.Float32;
|
|
7435
|
+
case WebGLRenderingContext["SHORT"]:
|
|
7436
|
+
return VertexFormatType.Int16;
|
|
7437
|
+
case WebGLRenderingContext["BYTE"]:
|
|
7438
|
+
return VertexFormatType.Int8;
|
|
7439
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
7440
|
+
return VertexFormatType.UInt16;
|
|
7441
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
7442
|
+
return VertexFormatType.UInt8;
|
|
7443
|
+
default:
|
|
7444
|
+
return VertexFormatType.Float32;
|
|
7445
|
+
}
|
|
7446
|
+
}
|
|
7447
|
+
|
|
7448
|
+
function valIfUndefined(val, def) {
|
|
7449
|
+
if (val === undefined || val === null) {
|
|
7450
|
+
return def;
|
|
7451
|
+
}
|
|
7452
|
+
return val;
|
|
7453
|
+
}
|
|
7454
|
+
function getPreMultiAlpha(blending) {
|
|
7455
|
+
switch(blending){
|
|
7456
|
+
case BlendingMode.ALPHA:
|
|
7457
|
+
return 1;
|
|
7458
|
+
case BlendingMode.ADD:
|
|
7459
|
+
return 1;
|
|
7460
|
+
case BlendingMode.SUBTRACTION:
|
|
7461
|
+
return 1;
|
|
7462
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7463
|
+
return 1;
|
|
7464
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7465
|
+
return 1;
|
|
7466
|
+
case BlendingMode.SUPERPOSITION:
|
|
7467
|
+
return 2;
|
|
7468
|
+
case BlendingMode.BRIGHTNESS:
|
|
7469
|
+
return 3;
|
|
7470
|
+
case BlendingMode.MULTIPLY:
|
|
7471
|
+
return 0;
|
|
7472
|
+
default:
|
|
7473
|
+
// 处理undefined
|
|
7474
|
+
return 1;
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7477
|
+
function setBlendMode(material, blendMode) {
|
|
7478
|
+
switch(blendMode){
|
|
7479
|
+
case undefined:
|
|
7480
|
+
material.blendFunction = [
|
|
7481
|
+
glContext.ONE,
|
|
7482
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7483
|
+
glContext.ONE,
|
|
7484
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7485
|
+
];
|
|
7486
|
+
break;
|
|
7487
|
+
case BlendingMode.ALPHA:
|
|
7488
|
+
material.blendFunction = [
|
|
7489
|
+
glContext.ONE,
|
|
7490
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7491
|
+
glContext.ONE,
|
|
7492
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7493
|
+
];
|
|
7494
|
+
break;
|
|
7495
|
+
case BlendingMode.ADD:
|
|
7496
|
+
material.blendFunction = [
|
|
7497
|
+
glContext.ONE,
|
|
7498
|
+
glContext.ONE,
|
|
7499
|
+
glContext.ONE,
|
|
7500
|
+
glContext.ONE
|
|
7501
|
+
];
|
|
7502
|
+
break;
|
|
7503
|
+
case BlendingMode.SUBTRACTION:
|
|
7504
|
+
material.blendFunction = [
|
|
7505
|
+
glContext.ONE,
|
|
7506
|
+
glContext.ONE,
|
|
7507
|
+
glContext.ZERO,
|
|
7508
|
+
glContext.ONE
|
|
7509
|
+
];
|
|
7510
|
+
material.blendEquation = [
|
|
7511
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
7512
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
7513
|
+
];
|
|
7514
|
+
break;
|
|
7515
|
+
case BlendingMode.SUPERPOSITION:
|
|
7516
|
+
material.blendFunction = [
|
|
7517
|
+
glContext.ONE,
|
|
7518
|
+
glContext.ONE,
|
|
7519
|
+
glContext.ONE,
|
|
7520
|
+
glContext.ONE
|
|
7521
|
+
];
|
|
7522
|
+
break;
|
|
7523
|
+
case BlendingMode.MULTIPLY:
|
|
7524
|
+
material.blendFunction = [
|
|
7525
|
+
glContext.DST_COLOR,
|
|
7526
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7527
|
+
glContext.DST_COLOR,
|
|
7528
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7529
|
+
];
|
|
7530
|
+
break;
|
|
7531
|
+
case BlendingMode.BRIGHTNESS:
|
|
7532
|
+
material.blendFunction = [
|
|
7533
|
+
glContext.ONE,
|
|
7534
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7535
|
+
glContext.ONE,
|
|
7536
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7537
|
+
];
|
|
7538
|
+
break;
|
|
7539
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7540
|
+
material.blendFunction = [
|
|
7541
|
+
glContext.DST_COLOR,
|
|
7542
|
+
glContext.DST_ALPHA,
|
|
7543
|
+
glContext.ZERO,
|
|
7544
|
+
glContext.ONE
|
|
7545
|
+
];
|
|
7546
|
+
break;
|
|
7547
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7548
|
+
material.blendFunction = [
|
|
7549
|
+
glContext.DST_COLOR,
|
|
7550
|
+
glContext.ZERO,
|
|
7551
|
+
glContext.ZERO,
|
|
7552
|
+
glContext.ONE
|
|
7553
|
+
];
|
|
7554
|
+
break;
|
|
7555
|
+
default:
|
|
7556
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
7557
|
+
}
|
|
7558
|
+
}
|
|
7559
|
+
function setSideMode(material, side) {
|
|
7560
|
+
if (side === SideMode.DOUBLE) {
|
|
7561
|
+
material.culling = false;
|
|
7562
|
+
} else {
|
|
7563
|
+
material.culling = true;
|
|
7564
|
+
material.frontFace = glContext.CW;
|
|
7565
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7566
|
+
}
|
|
7567
|
+
}
|
|
7568
|
+
function setMaskMode(material, maskMode) {
|
|
7569
|
+
switch(maskMode){
|
|
7570
|
+
case undefined:
|
|
7571
|
+
material.stencilTest = false;
|
|
7572
|
+
break;
|
|
7573
|
+
case MaskMode.MASK:
|
|
7574
|
+
material.stencilTest = true;
|
|
7575
|
+
material.stencilFunc = [
|
|
7576
|
+
glContext.ALWAYS,
|
|
7577
|
+
glContext.ALWAYS
|
|
7578
|
+
];
|
|
7579
|
+
material.stencilOpZPass = [
|
|
7580
|
+
glContext.REPLACE,
|
|
7581
|
+
glContext.REPLACE
|
|
7582
|
+
];
|
|
7583
|
+
break;
|
|
7584
|
+
case MaskMode.OBSCURED:
|
|
7585
|
+
material.stencilTest = true;
|
|
7586
|
+
material.stencilFunc = [
|
|
7587
|
+
glContext.EQUAL,
|
|
7588
|
+
glContext.EQUAL
|
|
7589
|
+
];
|
|
7590
|
+
break;
|
|
7591
|
+
case MaskMode.REVERSE_OBSCURED:
|
|
7592
|
+
material.stencilTest = true;
|
|
7593
|
+
material.stencilFunc = [
|
|
7594
|
+
glContext.NOTEQUAL,
|
|
7595
|
+
glContext.NOTEQUAL
|
|
7596
|
+
];
|
|
7597
|
+
break;
|
|
7598
|
+
case MaskMode.NONE:
|
|
7599
|
+
material.stencilTest = false;
|
|
7600
|
+
break;
|
|
7601
|
+
default:
|
|
7602
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
7603
|
+
}
|
|
7604
|
+
}
|
|
7605
|
+
|
|
7231
7606
|
/**
|
|
7232
7607
|
* Mesh 组件
|
|
7233
7608
|
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
7234
7609
|
_inherits(MeshComponent, RendererComponent);
|
|
7235
|
-
function MeshComponent() {
|
|
7610
|
+
function MeshComponent(engine) {
|
|
7236
7611
|
var _this;
|
|
7237
|
-
_this = RendererComponent.
|
|
7612
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
7238
7613
|
/**
|
|
7239
7614
|
* 用于点击测试的碰撞器
|
|
7240
7615
|
*/ _this.meshCollider = new MeshCollider();
|
|
@@ -7250,6 +7625,7 @@ __decorate([
|
|
|
7250
7625
|
};
|
|
7251
7626
|
}
|
|
7252
7627
|
};
|
|
7628
|
+
_this.maskManager = new MaskProcessor(engine);
|
|
7253
7629
|
return _this;
|
|
7254
7630
|
}
|
|
7255
7631
|
var _proto = MeshComponent.prototype;
|
|
@@ -7259,12 +7635,42 @@ __decorate([
|
|
|
7259
7635
|
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7260
7636
|
}
|
|
7261
7637
|
};
|
|
7638
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7639
|
+
if (!this.isActiveAndEnabled) {
|
|
7640
|
+
return;
|
|
7641
|
+
}
|
|
7642
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
7643
|
+
var material = this.materials[i];
|
|
7644
|
+
var previousColorMask = material.colorMask;
|
|
7645
|
+
material.colorMask = false;
|
|
7646
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7647
|
+
material.colorMask = previousColorMask;
|
|
7648
|
+
}
|
|
7649
|
+
};
|
|
7262
7650
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
7263
7651
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
7264
7652
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
7265
7653
|
var boundingBox = this.meshCollider.getBoundingBox();
|
|
7266
7654
|
return boundingBox;
|
|
7267
7655
|
};
|
|
7656
|
+
// TODO: Update data spec
|
|
7657
|
+
_proto.fromData = function fromData(data) {
|
|
7658
|
+
RendererComponent.prototype.fromData.call(this, data);
|
|
7659
|
+
var maskableRendererData = data;
|
|
7660
|
+
var maskOptions = maskableRendererData.mask;
|
|
7661
|
+
if (maskOptions) {
|
|
7662
|
+
this.maskManager.setMaskOptions(maskOptions);
|
|
7663
|
+
}
|
|
7664
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.materials), _step; !(_step = _iterator()).done;){
|
|
7665
|
+
var material = _step.value;
|
|
7666
|
+
var stencilRef = this.maskManager.getRefValue();
|
|
7667
|
+
material.stencilRef = [
|
|
7668
|
+
stencilRef,
|
|
7669
|
+
stencilRef
|
|
7670
|
+
];
|
|
7671
|
+
setMaskMode(material, this.maskManager.maskMode);
|
|
7672
|
+
}
|
|
7673
|
+
};
|
|
7268
7674
|
return MeshComponent;
|
|
7269
7675
|
}(RendererComponent);
|
|
7270
7676
|
__decorate([
|
|
@@ -8454,348 +8860,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
8454
8860
|
Matrix4.tempVec2 = new Vector3();
|
|
8455
8861
|
Matrix4.tempMat0 = new Matrix4();
|
|
8456
8862
|
|
|
8457
|
-
/**
|
|
8458
|
-
* Helper class to create a WebGL Context
|
|
8459
|
-
*
|
|
8460
|
-
* @param canvas
|
|
8461
|
-
* @param glType
|
|
8462
|
-
* @param options
|
|
8463
|
-
* @returns
|
|
8464
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
8465
|
-
if (glType === void 0) glType = "webgl";
|
|
8466
|
-
var context;
|
|
8467
|
-
if (glType === "webgl2") {
|
|
8468
|
-
context = canvas.getContext("webgl2", options);
|
|
8469
|
-
if (!context) {
|
|
8470
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
8471
|
-
}
|
|
8472
|
-
}
|
|
8473
|
-
if (!context || glType === "webgl") {
|
|
8474
|
-
context = canvas.getContext("webgl", options);
|
|
8475
|
-
}
|
|
8476
|
-
if (!context) {
|
|
8477
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
8478
|
-
}
|
|
8479
|
-
return context;
|
|
8480
|
-
}
|
|
8481
|
-
|
|
8482
|
-
function gpuTimer(gl) {
|
|
8483
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
8484
|
-
if (ext) {
|
|
8485
|
-
var query = gl.createQuery();
|
|
8486
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
8487
|
-
return __generator(this, function(_state) {
|
|
8488
|
-
return [
|
|
8489
|
-
2,
|
|
8490
|
-
new Promise(function(resolve, reject) {
|
|
8491
|
-
if (query) {
|
|
8492
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
8493
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
8494
|
-
if (available && !disjoint) {
|
|
8495
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
8496
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
8497
|
-
// taken to use all significant bits of the result, not just the
|
|
8498
|
-
// least significant 32 bits.
|
|
8499
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
8500
|
-
}
|
|
8501
|
-
if (available || disjoint) {
|
|
8502
|
-
// Clean up the query object.
|
|
8503
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
8504
|
-
query = null;
|
|
8505
|
-
}
|
|
8506
|
-
available !== null && query && window.setTimeout(function() {
|
|
8507
|
-
getTime().then(resolve).catch;
|
|
8508
|
-
}, 1);
|
|
8509
|
-
}
|
|
8510
|
-
})
|
|
8511
|
-
];
|
|
8512
|
-
});
|
|
8513
|
-
});
|
|
8514
|
-
if (!query) {
|
|
8515
|
-
return;
|
|
8516
|
-
}
|
|
8517
|
-
return {
|
|
8518
|
-
begin: function() {
|
|
8519
|
-
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
8520
|
-
},
|
|
8521
|
-
end: function() {
|
|
8522
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
8523
|
-
},
|
|
8524
|
-
getTime: getTime
|
|
8525
|
-
};
|
|
8526
|
-
}
|
|
8527
|
-
}
|
|
8528
|
-
|
|
8529
|
-
var initErrors = [];
|
|
8530
|
-
var glContext = {};
|
|
8531
|
-
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
8532
|
-
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
8533
|
-
if (!initErrors.length) {
|
|
8534
|
-
initGLContext();
|
|
8535
|
-
}
|
|
8536
|
-
function initGLContext() {
|
|
8537
|
-
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
8538
|
-
if (typeof WebGL2RenderingContext === "function") {
|
|
8539
|
-
copy(WebGL2RenderingContext);
|
|
8540
|
-
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
8541
|
-
copy(WebGLRenderingContext);
|
|
8542
|
-
copy(WebGLRenderingContext.prototype);
|
|
8543
|
-
} else {
|
|
8544
|
-
if (canUseBOM) {
|
|
8545
|
-
initErrors.push(// iOS 16 lockdown mode
|
|
8546
|
-
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8547
|
-
} else {
|
|
8548
|
-
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8549
|
-
}
|
|
8550
|
-
}
|
|
8551
|
-
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
8552
|
-
// @ts-expect-error set default value
|
|
8553
|
-
glContext["HALF_FLOAT"] = 5131;
|
|
8554
|
-
}
|
|
8555
|
-
}
|
|
8556
|
-
function isWebGL2(gl) {
|
|
8557
|
-
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
8558
|
-
}
|
|
8559
|
-
function copy(target) {
|
|
8560
|
-
for(var name in target){
|
|
8561
|
-
if (/^[A-Z_]/.test(name)) {
|
|
8562
|
-
// @ts-expect-error safe to assign
|
|
8563
|
-
glContext[name] = target[name];
|
|
8564
|
-
}
|
|
8565
|
-
}
|
|
8566
|
-
}
|
|
8567
|
-
function vertexFormatType2GLType(formatType) {
|
|
8568
|
-
switch(formatType){
|
|
8569
|
-
case VertexFormatType.Float32:
|
|
8570
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8571
|
-
case VertexFormatType.Int16:
|
|
8572
|
-
return WebGLRenderingContext["SHORT"];
|
|
8573
|
-
case VertexFormatType.Int8:
|
|
8574
|
-
return WebGLRenderingContext["BYTE"];
|
|
8575
|
-
case VertexFormatType.UInt16:
|
|
8576
|
-
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
8577
|
-
case VertexFormatType.UInt8:
|
|
8578
|
-
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
8579
|
-
default:
|
|
8580
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8581
|
-
}
|
|
8582
|
-
}
|
|
8583
|
-
function glType2VertexFormatType(webglType) {
|
|
8584
|
-
switch(webglType){
|
|
8585
|
-
case WebGLRenderingContext["FLOAT"]:
|
|
8586
|
-
return VertexFormatType.Float32;
|
|
8587
|
-
case WebGLRenderingContext["SHORT"]:
|
|
8588
|
-
return VertexFormatType.Int16;
|
|
8589
|
-
case WebGLRenderingContext["BYTE"]:
|
|
8590
|
-
return VertexFormatType.Int8;
|
|
8591
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
8592
|
-
return VertexFormatType.UInt16;
|
|
8593
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
8594
|
-
return VertexFormatType.UInt8;
|
|
8595
|
-
default:
|
|
8596
|
-
return VertexFormatType.Float32;
|
|
8597
|
-
}
|
|
8598
|
-
}
|
|
8599
|
-
|
|
8600
|
-
var ShaderType;
|
|
8601
|
-
(function(ShaderType) {
|
|
8602
|
-
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
8603
|
-
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
8604
|
-
})(ShaderType || (ShaderType = {}));
|
|
8605
|
-
var MaskMode;
|
|
8606
|
-
(function(MaskMode) {
|
|
8607
|
-
/**
|
|
8608
|
-
* 无
|
|
8609
|
-
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
8610
|
-
/**
|
|
8611
|
-
* 蒙版
|
|
8612
|
-
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
8613
|
-
/**
|
|
8614
|
-
* 被遮挡
|
|
8615
|
-
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
8616
|
-
/**
|
|
8617
|
-
* 被反向遮挡
|
|
8618
|
-
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
8619
|
-
})(MaskMode || (MaskMode = {}));
|
|
8620
|
-
|
|
8621
|
-
function valIfUndefined(val, def) {
|
|
8622
|
-
if (val === undefined || val === null) {
|
|
8623
|
-
return def;
|
|
8624
|
-
}
|
|
8625
|
-
return val;
|
|
8626
|
-
}
|
|
8627
|
-
function getPreMultiAlpha(blending) {
|
|
8628
|
-
switch(blending){
|
|
8629
|
-
case BlendingMode.ALPHA:
|
|
8630
|
-
return 1;
|
|
8631
|
-
case BlendingMode.ADD:
|
|
8632
|
-
return 1;
|
|
8633
|
-
case BlendingMode.SUBTRACTION:
|
|
8634
|
-
return 1;
|
|
8635
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8636
|
-
return 1;
|
|
8637
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8638
|
-
return 1;
|
|
8639
|
-
case BlendingMode.SUPERPOSITION:
|
|
8640
|
-
return 2;
|
|
8641
|
-
case BlendingMode.BRIGHTNESS:
|
|
8642
|
-
return 3;
|
|
8643
|
-
case BlendingMode.MULTIPLY:
|
|
8644
|
-
return 0;
|
|
8645
|
-
default:
|
|
8646
|
-
// 处理undefined
|
|
8647
|
-
return 1;
|
|
8648
|
-
}
|
|
8649
|
-
}
|
|
8650
|
-
function setBlendMode(material, blendMode) {
|
|
8651
|
-
switch(blendMode){
|
|
8652
|
-
case undefined:
|
|
8653
|
-
material.blendFunction = [
|
|
8654
|
-
glContext.ONE,
|
|
8655
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8656
|
-
glContext.ONE,
|
|
8657
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8658
|
-
];
|
|
8659
|
-
break;
|
|
8660
|
-
case BlendingMode.ALPHA:
|
|
8661
|
-
material.blendFunction = [
|
|
8662
|
-
glContext.ONE,
|
|
8663
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8664
|
-
glContext.ONE,
|
|
8665
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8666
|
-
];
|
|
8667
|
-
break;
|
|
8668
|
-
case BlendingMode.ADD:
|
|
8669
|
-
material.blendFunction = [
|
|
8670
|
-
glContext.ONE,
|
|
8671
|
-
glContext.ONE,
|
|
8672
|
-
glContext.ONE,
|
|
8673
|
-
glContext.ONE
|
|
8674
|
-
];
|
|
8675
|
-
break;
|
|
8676
|
-
case BlendingMode.SUBTRACTION:
|
|
8677
|
-
material.blendFunction = [
|
|
8678
|
-
glContext.ONE,
|
|
8679
|
-
glContext.ONE,
|
|
8680
|
-
glContext.ZERO,
|
|
8681
|
-
glContext.ONE
|
|
8682
|
-
];
|
|
8683
|
-
material.blendEquation = [
|
|
8684
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
8685
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
8686
|
-
];
|
|
8687
|
-
break;
|
|
8688
|
-
case BlendingMode.SUPERPOSITION:
|
|
8689
|
-
material.blendFunction = [
|
|
8690
|
-
glContext.ONE,
|
|
8691
|
-
glContext.ONE,
|
|
8692
|
-
glContext.ONE,
|
|
8693
|
-
glContext.ONE
|
|
8694
|
-
];
|
|
8695
|
-
break;
|
|
8696
|
-
case BlendingMode.MULTIPLY:
|
|
8697
|
-
material.blendFunction = [
|
|
8698
|
-
glContext.DST_COLOR,
|
|
8699
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8700
|
-
glContext.DST_COLOR,
|
|
8701
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8702
|
-
];
|
|
8703
|
-
break;
|
|
8704
|
-
case BlendingMode.BRIGHTNESS:
|
|
8705
|
-
material.blendFunction = [
|
|
8706
|
-
glContext.ONE,
|
|
8707
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8708
|
-
glContext.ONE,
|
|
8709
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8710
|
-
];
|
|
8711
|
-
break;
|
|
8712
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8713
|
-
material.blendFunction = [
|
|
8714
|
-
glContext.DST_COLOR,
|
|
8715
|
-
glContext.DST_ALPHA,
|
|
8716
|
-
glContext.ZERO,
|
|
8717
|
-
glContext.ONE
|
|
8718
|
-
];
|
|
8719
|
-
break;
|
|
8720
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8721
|
-
material.blendFunction = [
|
|
8722
|
-
glContext.DST_COLOR,
|
|
8723
|
-
glContext.ZERO,
|
|
8724
|
-
glContext.ZERO,
|
|
8725
|
-
glContext.ONE
|
|
8726
|
-
];
|
|
8727
|
-
break;
|
|
8728
|
-
default:
|
|
8729
|
-
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
8730
|
-
}
|
|
8731
|
-
}
|
|
8732
|
-
function setSideMode(material, side) {
|
|
8733
|
-
if (side === SideMode.DOUBLE) {
|
|
8734
|
-
material.culling = false;
|
|
8735
|
-
} else {
|
|
8736
|
-
material.culling = true;
|
|
8737
|
-
material.frontFace = glContext.CW;
|
|
8738
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
8739
|
-
}
|
|
8740
|
-
}
|
|
8741
|
-
function setMaskMode(material, maskMode) {
|
|
8742
|
-
switch(maskMode){
|
|
8743
|
-
case undefined:
|
|
8744
|
-
material.stencilTest = false;
|
|
8745
|
-
break;
|
|
8746
|
-
case MaskMode.MASK:
|
|
8747
|
-
material.stencilTest = true;
|
|
8748
|
-
material.stencilFunc = [
|
|
8749
|
-
glContext.ALWAYS,
|
|
8750
|
-
glContext.ALWAYS
|
|
8751
|
-
];
|
|
8752
|
-
material.stencilOpZPass = [
|
|
8753
|
-
glContext.REPLACE,
|
|
8754
|
-
glContext.REPLACE
|
|
8755
|
-
];
|
|
8756
|
-
break;
|
|
8757
|
-
case MaskMode.OBSCURED:
|
|
8758
|
-
material.stencilTest = true;
|
|
8759
|
-
material.stencilFunc = [
|
|
8760
|
-
glContext.EQUAL,
|
|
8761
|
-
glContext.EQUAL
|
|
8762
|
-
];
|
|
8763
|
-
break;
|
|
8764
|
-
case MaskMode.REVERSE_OBSCURED:
|
|
8765
|
-
material.stencilTest = true;
|
|
8766
|
-
material.stencilFunc = [
|
|
8767
|
-
glContext.NOTEQUAL,
|
|
8768
|
-
glContext.NOTEQUAL
|
|
8769
|
-
];
|
|
8770
|
-
break;
|
|
8771
|
-
case MaskMode.NONE:
|
|
8772
|
-
material.stencilTest = false;
|
|
8773
|
-
break;
|
|
8774
|
-
default:
|
|
8775
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
8776
|
-
}
|
|
8777
|
-
}
|
|
8778
|
-
|
|
8779
|
-
var TextureLoadAction;
|
|
8780
|
-
(function(TextureLoadAction) {
|
|
8781
|
-
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
8782
|
-
//preserve previous attachment
|
|
8783
|
-
//load = 1,
|
|
8784
|
-
//clear attachment
|
|
8785
|
-
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
8786
|
-
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
8787
|
-
var TextureSourceType;
|
|
8788
|
-
(function(TextureSourceType) {
|
|
8789
|
-
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
8790
|
-
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
8791
|
-
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
8792
|
-
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
8793
|
-
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
8794
|
-
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
8795
|
-
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
8796
|
-
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
8797
|
-
})(TextureSourceType || (TextureSourceType = {}));
|
|
8798
|
-
|
|
8799
8863
|
/**
|
|
8800
8864
|
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
8801
8865
|
*/ var Downloader = /*#__PURE__*/ function() {
|
|
@@ -10274,39 +10338,6 @@ var MaterialRenderType;
|
|
|
10274
10338
|
return Material;
|
|
10275
10339
|
}(EffectsObject);
|
|
10276
10340
|
|
|
10277
|
-
var MaskProcessor = /*#__PURE__*/ function() {
|
|
10278
|
-
function MaskProcessor(engine) {
|
|
10279
|
-
this.engine = engine;
|
|
10280
|
-
this.alphaMaskEnabled = false;
|
|
10281
|
-
this.maskMode = MaskMode.NONE;
|
|
10282
|
-
this.maskable = null;
|
|
10283
|
-
this.stencilClearAction = {
|
|
10284
|
-
stencilAction: TextureLoadAction.clear
|
|
10285
|
-
};
|
|
10286
|
-
}
|
|
10287
|
-
var _proto = MaskProcessor.prototype;
|
|
10288
|
-
_proto.getRefValue = function getRefValue() {
|
|
10289
|
-
return 1;
|
|
10290
|
-
};
|
|
10291
|
-
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
10292
|
-
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;
|
|
10293
|
-
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
10294
|
-
if (isMask) {
|
|
10295
|
-
this.maskMode = MaskMode.MASK;
|
|
10296
|
-
} else {
|
|
10297
|
-
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
10298
|
-
this.maskable = this.engine.findObject(reference);
|
|
10299
|
-
}
|
|
10300
|
-
};
|
|
10301
|
-
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
10302
|
-
if (this.maskable) {
|
|
10303
|
-
renderer.clear(this.stencilClearAction);
|
|
10304
|
-
this.maskable.drawStencilMask(renderer);
|
|
10305
|
-
}
|
|
10306
|
-
};
|
|
10307
|
-
return MaskProcessor;
|
|
10308
|
-
}();
|
|
10309
|
-
|
|
10310
10341
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10311
10342
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10312
10343
|
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}";
|
|
@@ -12720,244 +12751,131 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
12720
12751
|
return ShaderFactory;
|
|
12721
12752
|
}();
|
|
12722
12753
|
|
|
12723
|
-
// Bloom
|
|
12724
|
-
var
|
|
12725
|
-
_inherits(
|
|
12726
|
-
function
|
|
12754
|
+
// Bloom Pass - 包含阈值提取、高斯模糊(Down Sample 和 Up Sample)
|
|
12755
|
+
var BloomPass = /*#__PURE__*/ function(RenderPass) {
|
|
12756
|
+
_inherits(BloomPass, RenderPass);
|
|
12757
|
+
function BloomPass(renderer, iterationCount) {
|
|
12758
|
+
if (iterationCount === void 0) iterationCount = 4;
|
|
12727
12759
|
var _this;
|
|
12728
12760
|
_this = RenderPass.call(this, renderer) || this;
|
|
12761
|
+
_this.tempRTs = [];
|
|
12762
|
+
_this.iterationCount = iterationCount;
|
|
12729
12763
|
var engine = _this.renderer.engine;
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
attributes: {
|
|
12733
|
-
aPos: {
|
|
12734
|
-
type: glContext.FLOAT,
|
|
12735
|
-
size: 2,
|
|
12736
|
-
data: new Float32Array([
|
|
12737
|
-
-1,
|
|
12738
|
-
1,
|
|
12739
|
-
-1,
|
|
12740
|
-
-1,
|
|
12741
|
-
1,
|
|
12742
|
-
1,
|
|
12743
|
-
1,
|
|
12744
|
-
-1
|
|
12745
|
-
])
|
|
12746
|
-
}
|
|
12747
|
-
},
|
|
12748
|
-
drawCount: 4
|
|
12749
|
-
});
|
|
12750
|
-
var material = Material.create(engine, {
|
|
12764
|
+
// Threshold material
|
|
12765
|
+
_this.thresholdMaterial = Material.create(engine, {
|
|
12751
12766
|
shader: {
|
|
12752
12767
|
vertex: screenMeshVert,
|
|
12753
12768
|
fragment: thresholdFrag,
|
|
12754
12769
|
glslVersion: GLSLVersion.GLSL1
|
|
12755
12770
|
}
|
|
12756
12771
|
});
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12772
|
+
_this.thresholdMaterial.blending = false;
|
|
12773
|
+
_this.thresholdMaterial.depthTest = false;
|
|
12774
|
+
_this.thresholdMaterial.culling = false;
|
|
12775
|
+
// Down sample H material
|
|
12776
|
+
_this.downSampleHMaterial = Material.create(engine, {
|
|
12777
|
+
shader: {
|
|
12778
|
+
vertex: screenMeshVert,
|
|
12779
|
+
fragment: gaussianDownHFrag,
|
|
12780
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12781
|
+
}
|
|
12764
12782
|
});
|
|
12783
|
+
_this.downSampleHMaterial.blending = false;
|
|
12784
|
+
_this.downSampleHMaterial.depthTest = false;
|
|
12785
|
+
_this.downSampleHMaterial.culling = false;
|
|
12786
|
+
// Down sample V material
|
|
12787
|
+
_this.downSampleVMaterial = Material.create(engine, {
|
|
12788
|
+
shader: {
|
|
12789
|
+
vertex: screenMeshVert,
|
|
12790
|
+
fragment: gaussianDownVFrag,
|
|
12791
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12792
|
+
}
|
|
12793
|
+
});
|
|
12794
|
+
_this.downSampleVMaterial.blending = false;
|
|
12795
|
+
_this.downSampleVMaterial.depthTest = false;
|
|
12796
|
+
_this.downSampleVMaterial.culling = false;
|
|
12797
|
+
// Up sample material
|
|
12798
|
+
_this.upSampleMaterial = Material.create(engine, {
|
|
12799
|
+
shader: {
|
|
12800
|
+
vertex: screenMeshVert,
|
|
12801
|
+
fragment: gaussianUpFrag,
|
|
12802
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12803
|
+
}
|
|
12804
|
+
});
|
|
12805
|
+
_this.upSampleMaterial.blending = false;
|
|
12806
|
+
_this.upSampleMaterial.depthTest = false;
|
|
12807
|
+
_this.upSampleMaterial.culling = false;
|
|
12765
12808
|
_this.priority = 5000;
|
|
12766
|
-
_this.name = "
|
|
12809
|
+
_this.name = "BloomPass";
|
|
12767
12810
|
return _this;
|
|
12768
12811
|
}
|
|
12769
|
-
var _proto =
|
|
12812
|
+
var _proto = BloomPass.prototype;
|
|
12770
12813
|
_proto.configure = function configure(renderer) {
|
|
12771
|
-
|
|
12814
|
+
// 获取场景纹理用于 ToneMappingPass
|
|
12772
12815
|
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12773
12816
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
12774
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12775
12817
|
};
|
|
12776
12818
|
_proto.execute = function execute(renderer) {
|
|
12777
12819
|
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
12778
|
-
renderer.
|
|
12779
|
-
|
|
12780
|
-
depthAction: TextureLoadAction.clear,
|
|
12781
|
-
stencilAction: TextureLoadAction.clear
|
|
12782
|
-
});
|
|
12783
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12820
|
+
var baseWidth = renderer.getWidth();
|
|
12821
|
+
var baseHeight = renderer.getHeight();
|
|
12784
12822
|
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
12823
|
+
// 1. Threshold pass - 提取高亮区域
|
|
12785
12824
|
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;
|
|
12786
|
-
this.
|
|
12787
|
-
|
|
12788
|
-
|
|
12789
|
-
]
|
|
12825
|
+
this.thresholdRT = renderer.getTemporaryRT("_BloomThreshold", baseWidth, baseHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12826
|
+
this.thresholdMaterial.setFloat("_Threshold", threshold);
|
|
12827
|
+
renderer.blit(this.mainTexture, this.thresholdRT, this.thresholdMaterial);
|
|
12828
|
+
var currentTexture = this.thresholdRT.getColorTextures()[0];
|
|
12829
|
+
// 2. Down sample passes
|
|
12830
|
+
for(var i = 0; i < this.iterationCount; i++){
|
|
12831
|
+
var downWidth = Math.floor(baseWidth / Math.pow(2, i + 1));
|
|
12832
|
+
var downHeight = Math.floor(baseHeight / Math.pow(2, i + 1));
|
|
12833
|
+
// Horizontal pass
|
|
12834
|
+
var tempH = renderer.getTemporaryRT("_BloomDownH" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12835
|
+
this.downSampleHMaterial.setVector2("_TextureSize", getTextureSize(currentTexture));
|
|
12836
|
+
renderer.blit(currentTexture, tempH, this.downSampleHMaterial);
|
|
12837
|
+
// Vertical pass
|
|
12838
|
+
var tempV = renderer.getTemporaryRT("_BloomDownV" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12839
|
+
this.downSampleVMaterial.setVector2("_TextureSize", getTextureSize(tempH.getColorTextures()[0]));
|
|
12840
|
+
renderer.blit(tempH.getColorTextures()[0], tempV, this.downSampleVMaterial);
|
|
12841
|
+
// 释放 H pass RT,保留 V pass RT 用于 up sample
|
|
12842
|
+
renderer.releaseTemporaryRT(tempH);
|
|
12843
|
+
this.tempRTs.push(tempV);
|
|
12844
|
+
currentTexture = tempV.getColorTextures()[0];
|
|
12845
|
+
}
|
|
12846
|
+
// 释放 threshold RT
|
|
12847
|
+
renderer.releaseTemporaryRT(this.thresholdRT);
|
|
12848
|
+
// 3. Up sample passes
|
|
12849
|
+
for(var i1 = this.iterationCount - 1; i1 > 0; i1--){
|
|
12850
|
+
var upWidth = Math.floor(baseWidth / Math.pow(2, i1 - 1));
|
|
12851
|
+
var upHeight = Math.floor(baseHeight / Math.pow(2, i1 - 1));
|
|
12852
|
+
var tempUp = renderer.getTemporaryRT("_BloomUp" + i1, upWidth, upHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12853
|
+
// 获取下一层的 down sample 结果
|
|
12854
|
+
var downSampleTexture = this.tempRTs[i1 - 1].getColorTextures()[0];
|
|
12855
|
+
this.upSampleMaterial.setTexture("_GaussianDownTex", downSampleTexture);
|
|
12856
|
+
this.upSampleMaterial.setVector2("_GaussianDownTextureSize", getTextureSize(downSampleTexture));
|
|
12857
|
+
renderer.blit(currentTexture, tempUp, this.upSampleMaterial);
|
|
12858
|
+
currentTexture = tempUp.getColorTextures()[0];
|
|
12859
|
+
this.tempRTs.push(tempUp);
|
|
12860
|
+
}
|
|
12861
|
+
// 设置最终输出到当前 framebuffer
|
|
12862
|
+
renderer.setFramebuffer(this.tempRTs[this.tempRTs.length - 1]);
|
|
12790
12863
|
};
|
|
12791
12864
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12792
|
-
|
|
12793
|
-
|
|
12865
|
+
// 释放所有临时 RT
|
|
12866
|
+
for(var i = 0; i < this.tempRTs.length; i++){
|
|
12867
|
+
renderer.releaseTemporaryRT(this.tempRTs[i]);
|
|
12794
12868
|
}
|
|
12869
|
+
this.tempRTs = [];
|
|
12795
12870
|
};
|
|
12796
12871
|
_proto.dispose = function dispose(options) {
|
|
12872
|
+
this.thresholdMaterial.dispose();
|
|
12873
|
+
this.downSampleHMaterial.dispose();
|
|
12874
|
+
this.downSampleVMaterial.dispose();
|
|
12875
|
+
this.upSampleMaterial.dispose();
|
|
12797
12876
|
RenderPass.prototype.dispose.call(this, options);
|
|
12798
12877
|
};
|
|
12799
|
-
return
|
|
12800
|
-
}(RenderPass);
|
|
12801
|
-
var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12802
|
-
_inherits(HQGaussianDownSamplePass, RenderPass);
|
|
12803
|
-
function HQGaussianDownSamplePass(renderer, type, level) {
|
|
12804
|
-
var _this;
|
|
12805
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12806
|
-
_this.type = type;
|
|
12807
|
-
_this.level = level;
|
|
12808
|
-
var engine = _this.renderer.engine;
|
|
12809
|
-
var name = "PostProcess";
|
|
12810
|
-
var geometry = Geometry.create(engine, {
|
|
12811
|
-
name: name,
|
|
12812
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12813
|
-
attributes: {
|
|
12814
|
-
aPos: {
|
|
12815
|
-
type: glContext.FLOAT,
|
|
12816
|
-
size: 2,
|
|
12817
|
-
data: new Float32Array([
|
|
12818
|
-
-1,
|
|
12819
|
-
1,
|
|
12820
|
-
-1,
|
|
12821
|
-
-1,
|
|
12822
|
-
1,
|
|
12823
|
-
1,
|
|
12824
|
-
1,
|
|
12825
|
-
-1
|
|
12826
|
-
])
|
|
12827
|
-
}
|
|
12828
|
-
},
|
|
12829
|
-
drawCount: 4
|
|
12830
|
-
});
|
|
12831
|
-
var fragment = type === "H" ? gaussianDownHFrag : gaussianDownVFrag;
|
|
12832
|
-
var shader = {
|
|
12833
|
-
vertex: screenMeshVert,
|
|
12834
|
-
fragment: fragment,
|
|
12835
|
-
glslVersion: GLSLVersion.GLSL1
|
|
12836
|
-
};
|
|
12837
|
-
var material = Material.create(engine, {
|
|
12838
|
-
name: name,
|
|
12839
|
-
shader: shader
|
|
12840
|
-
});
|
|
12841
|
-
material.blending = false;
|
|
12842
|
-
material.depthTest = false;
|
|
12843
|
-
material.culling = false;
|
|
12844
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12845
|
-
name: name,
|
|
12846
|
-
geometry: geometry,
|
|
12847
|
-
material: material,
|
|
12848
|
-
priority: 0
|
|
12849
|
-
});
|
|
12850
|
-
_this.priority = 5000;
|
|
12851
|
-
_this.name = "GaussianDownPass" + type + level;
|
|
12852
|
-
return _this;
|
|
12853
|
-
}
|
|
12854
|
-
var _proto = HQGaussianDownSamplePass.prototype;
|
|
12855
|
-
_proto.configure = function configure(renderer) {
|
|
12856
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
|
|
12857
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
|
|
12858
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12859
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12860
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12861
|
-
};
|
|
12862
|
-
_proto.execute = function execute(renderer) {
|
|
12863
|
-
renderer.clear({
|
|
12864
|
-
colorAction: TextureLoadAction.clear,
|
|
12865
|
-
depthAction: TextureLoadAction.clear,
|
|
12866
|
-
stencilAction: TextureLoadAction.clear
|
|
12867
|
-
});
|
|
12868
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12869
|
-
this.screenMesh.material.setVector2("_TextureSize", getTextureSize(this.mainTexture));
|
|
12870
|
-
renderer.renderMeshes([
|
|
12871
|
-
this.screenMesh
|
|
12872
|
-
]);
|
|
12873
|
-
if (this.type === "V") {
|
|
12874
|
-
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12875
|
-
}
|
|
12876
|
-
};
|
|
12877
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12878
|
-
if (this.framebuffer) {
|
|
12879
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12880
|
-
}
|
|
12881
|
-
};
|
|
12882
|
-
return HQGaussianDownSamplePass;
|
|
12883
|
-
}(RenderPass);
|
|
12884
|
-
var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12885
|
-
_inherits(HQGaussianUpSamplePass, RenderPass);
|
|
12886
|
-
function HQGaussianUpSamplePass(renderer, level) {
|
|
12887
|
-
var _this;
|
|
12888
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12889
|
-
_this.level = level;
|
|
12890
|
-
var name = "PostProcess";
|
|
12891
|
-
var engine = _this.renderer.engine;
|
|
12892
|
-
var geometry = Geometry.create(engine, {
|
|
12893
|
-
name: name,
|
|
12894
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12895
|
-
attributes: {
|
|
12896
|
-
aPos: {
|
|
12897
|
-
type: glContext.FLOAT,
|
|
12898
|
-
size: 2,
|
|
12899
|
-
data: new Float32Array([
|
|
12900
|
-
-1,
|
|
12901
|
-
1,
|
|
12902
|
-
-1,
|
|
12903
|
-
-1,
|
|
12904
|
-
1,
|
|
12905
|
-
1,
|
|
12906
|
-
1,
|
|
12907
|
-
-1
|
|
12908
|
-
])
|
|
12909
|
-
}
|
|
12910
|
-
},
|
|
12911
|
-
drawCount: 4
|
|
12912
|
-
});
|
|
12913
|
-
var shader = {
|
|
12914
|
-
vertex: screenMeshVert,
|
|
12915
|
-
fragment: gaussianUpFrag
|
|
12916
|
-
};
|
|
12917
|
-
var material = Material.create(engine, {
|
|
12918
|
-
name: name,
|
|
12919
|
-
shader: shader
|
|
12920
|
-
});
|
|
12921
|
-
material.blending = false;
|
|
12922
|
-
material.depthTest = false;
|
|
12923
|
-
material.culling = false;
|
|
12924
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12925
|
-
name: name,
|
|
12926
|
-
geometry: geometry,
|
|
12927
|
-
material: material,
|
|
12928
|
-
priority: 0
|
|
12929
|
-
});
|
|
12930
|
-
_this.priority = 5000;
|
|
12931
|
-
_this.name = "GaussianUpPass" + level;
|
|
12932
|
-
return _this;
|
|
12933
|
-
}
|
|
12934
|
-
var _proto = HQGaussianUpSamplePass.prototype;
|
|
12935
|
-
_proto.configure = function configure(renderer) {
|
|
12936
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
|
|
12937
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
|
|
12938
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12939
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12940
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12941
|
-
};
|
|
12942
|
-
_proto.execute = function execute(renderer) {
|
|
12943
|
-
renderer.clear({
|
|
12944
|
-
colorAction: TextureLoadAction.clear,
|
|
12945
|
-
depthAction: TextureLoadAction.clear,
|
|
12946
|
-
stencilAction: TextureLoadAction.clear
|
|
12947
|
-
});
|
|
12948
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12949
|
-
this.screenMesh.material.setTexture("_GaussianDownTex", this.gaussianDownSampleResult.texture);
|
|
12950
|
-
this.screenMesh.material.setVector2("_GaussianDownTextureSize", getTextureSize(this.gaussianDownSampleResult.texture));
|
|
12951
|
-
renderer.renderMeshes([
|
|
12952
|
-
this.screenMesh
|
|
12953
|
-
]);
|
|
12954
|
-
};
|
|
12955
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12956
|
-
if (this.framebuffer) {
|
|
12957
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12958
|
-
}
|
|
12959
|
-
};
|
|
12960
|
-
return HQGaussianUpSamplePass;
|
|
12878
|
+
return BloomPass;
|
|
12961
12879
|
}(RenderPass);
|
|
12962
12880
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
12963
12881
|
var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -13101,36 +13019,11 @@ var seed$6 = 1;
|
|
|
13101
13019
|
if (postProcessingEnabled) {
|
|
13102
13020
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
13103
13021
|
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
];
|
|
13110
|
-
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
13111
|
-
var bloomThresholdPass = new BloomThresholdPass(renderer);
|
|
13112
|
-
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
13113
|
-
this.addRenderPass(bloomThresholdPass);
|
|
13114
|
-
for(var i = 0; i < gaussianStep; i++){
|
|
13115
|
-
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
13116
|
-
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i);
|
|
13117
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i);
|
|
13118
|
-
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
13119
|
-
this.addRenderPass(gaussianDownHPass);
|
|
13120
|
-
this.addRenderPass(gaussianDownVPass);
|
|
13121
|
-
viewport[2] /= 2;
|
|
13122
|
-
viewport[3] /= 2;
|
|
13123
|
-
// TODO 限制最大迭代
|
|
13124
|
-
}
|
|
13125
|
-
viewport[2] *= 4;
|
|
13126
|
-
viewport[3] *= 4;
|
|
13127
|
-
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
13128
|
-
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1);
|
|
13129
|
-
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
13130
|
-
this.addRenderPass(gaussianUpPass);
|
|
13131
|
-
viewport[2] *= 2;
|
|
13132
|
-
viewport[3] *= 2;
|
|
13133
|
-
}
|
|
13022
|
+
// Bloom Pass(包含阈值提取、高斯模糊)
|
|
13023
|
+
var bloomPass = new BloomPass(renderer, gaussianStep);
|
|
13024
|
+
bloomPass.sceneTextureHandle = sceneTextureHandle;
|
|
13025
|
+
this.addRenderPass(bloomPass);
|
|
13026
|
+
// Tone Mapping Pass
|
|
13134
13027
|
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
13135
13028
|
this.addRenderPass(postProcessPass);
|
|
13136
13029
|
}
|
|
@@ -13624,6 +13517,14 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13624
13517
|
_proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
|
|
13625
13518
|
this.renderTargetPool.release(rt);
|
|
13626
13519
|
};
|
|
13520
|
+
/**
|
|
13521
|
+
* 将源纹理复制到目标 Framebuffer,可使用自定义材质进行处理
|
|
13522
|
+
* @param source - 源纹理
|
|
13523
|
+
* @param destination - 目标 Framebuffer,如果为 null 则渲染到屏幕
|
|
13524
|
+
* @param material - 可选的自定义材质,不传则使用默认复制材质
|
|
13525
|
+
*/ _proto.blit = function blit(source, destination, material) {
|
|
13526
|
+
// OVERRIDE
|
|
13527
|
+
};
|
|
13627
13528
|
_proto.dispose = function dispose() {
|
|
13628
13529
|
// OVERRIDE
|
|
13629
13530
|
};
|
|
@@ -31469,7 +31370,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31469
31370
|
return ret;
|
|
31470
31371
|
}
|
|
31471
31372
|
|
|
31472
|
-
var version$2 = "2.8.0-alpha.
|
|
31373
|
+
var version$2 = "2.8.0-alpha.3";
|
|
31473
31374
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31474
31375
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31475
31376
|
var reverseParticle = false;
|
|
@@ -35170,7 +35071,7 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35170
35071
|
registerPlugin("particle", ParticleLoader);
|
|
35171
35072
|
registerPlugin("cal", CalculateLoader);
|
|
35172
35073
|
registerPlugin("interact", InteractLoader);
|
|
35173
|
-
var version$1 = "2.8.0-alpha.
|
|
35074
|
+
var version$1 = "2.8.0-alpha.3";
|
|
35174
35075
|
logger.info("Core version: " + version$1 + ".");
|
|
35175
35076
|
|
|
35176
35077
|
var _obj;
|
|
@@ -36760,7 +36661,7 @@ applyMixins(ThreeTextComponent, [
|
|
|
36760
36661
|
*/ Mesh.create = function(engine, props) {
|
|
36761
36662
|
return new ThreeMesh(engine, props);
|
|
36762
36663
|
};
|
|
36763
|
-
var version = "2.8.0-alpha.
|
|
36664
|
+
var version = "2.8.0-alpha.3";
|
|
36764
36665
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36765
36666
|
|
|
36766
36667
|
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, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, 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, TEXTURE_UNIFORM_MAP, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|