@galacean/effects-threejs 2.8.0-alpha.2 → 2.8.0-alpha.4
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 +832 -811
- 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 +832 -811
- 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.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -2881,7 +2881,6 @@ var plugins = [];
|
|
|
2881
2881
|
pluginLoaderMap[name] = pluginClass;
|
|
2882
2882
|
var pluginInstance = new pluginClass();
|
|
2883
2883
|
pluginInstance.name = name;
|
|
2884
|
-
pluginInstance.initialize();
|
|
2885
2884
|
plugins.push(pluginInstance);
|
|
2886
2885
|
plugins.sort(function(a, b) {
|
|
2887
2886
|
return a.order - b.order;
|
|
@@ -2905,29 +2904,29 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2905
2904
|
};
|
|
2906
2905
|
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2907
2906
|
plugins.forEach(function(loader) {
|
|
2908
|
-
return loader.
|
|
2907
|
+
return loader.onCompositionCreated(composition, scene);
|
|
2909
2908
|
});
|
|
2910
2909
|
};
|
|
2911
2910
|
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2912
2911
|
plugins.forEach(function(loader) {
|
|
2913
|
-
return loader.
|
|
2912
|
+
return loader.onCompositionDestroy(comp);
|
|
2914
2913
|
});
|
|
2915
2914
|
};
|
|
2916
|
-
PluginSystem.
|
|
2915
|
+
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2917
2916
|
return _async_to_generator(function() {
|
|
2918
2917
|
return __generator(this, function(_state) {
|
|
2919
2918
|
return [
|
|
2920
2919
|
2,
|
|
2921
2920
|
Promise.all(plugins.map(function(plugin) {
|
|
2922
|
-
return plugin.
|
|
2921
|
+
return plugin.onAssetsLoadStart(scene, options);
|
|
2923
2922
|
}))
|
|
2924
2923
|
];
|
|
2925
2924
|
});
|
|
2926
2925
|
})();
|
|
2927
2926
|
};
|
|
2928
|
-
PluginSystem.
|
|
2927
|
+
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
2929
2928
|
plugins.forEach(function(loader) {
|
|
2930
|
-
return loader.
|
|
2929
|
+
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
2931
2930
|
});
|
|
2932
2931
|
};
|
|
2933
2932
|
return PluginSystem;
|
|
@@ -2957,20 +2956,18 @@ function getPluginUsageInfo(name) {
|
|
|
2957
2956
|
/**
|
|
2958
2957
|
* 抽象插件类
|
|
2959
2958
|
* 注册合成不同生命周期的回调函数
|
|
2960
|
-
*/ var
|
|
2961
|
-
function
|
|
2959
|
+
*/ var Plugin = /*#__PURE__*/ function() {
|
|
2960
|
+
function Plugin() {
|
|
2962
2961
|
this.order = 100;
|
|
2963
|
-
this.name = "";
|
|
2962
|
+
this.name = "Plugin";
|
|
2964
2963
|
}
|
|
2965
|
-
var _proto =
|
|
2966
|
-
_proto.initialize = function initialize() {};
|
|
2964
|
+
var _proto = Plugin.prototype;
|
|
2967
2965
|
/**
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
2970
|
-
* @param scene
|
|
2971
|
-
* @param options
|
|
2972
|
-
|
|
2973
|
-
*/ _proto.processAssets = function processAssets(scene, options) {
|
|
2966
|
+
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
2967
|
+
* 此阶段适合发起异步资源请求。
|
|
2968
|
+
* @param scene - 场景对象
|
|
2969
|
+
* @param options - 场景加载选项
|
|
2970
|
+
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2974
2971
|
return _async_to_generator(function() {
|
|
2975
2972
|
return __generator(this, function(_state) {
|
|
2976
2973
|
return [
|
|
@@ -2980,17 +2977,22 @@ function getPluginUsageInfo(name) {
|
|
|
2980
2977
|
})();
|
|
2981
2978
|
};
|
|
2982
2979
|
/**
|
|
2983
|
-
*
|
|
2984
|
-
*
|
|
2985
|
-
*
|
|
2986
|
-
*
|
|
2987
|
-
*
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2980
|
+
* 场景资源加载完成后触发。
|
|
2981
|
+
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
2982
|
+
* @param scene - 场景对象
|
|
2983
|
+
* @param options - 场景加载选项
|
|
2984
|
+
* @param engine - 引擎实例
|
|
2985
|
+
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
2986
|
+
/**
|
|
2987
|
+
* 合成创建完成后触发。
|
|
2988
|
+
* @param composition - 合成对象
|
|
2989
|
+
* @param scene - 场景对象
|
|
2990
|
+
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
2991
|
+
/**
|
|
2992
|
+
* 合成销毁时触发。
|
|
2993
|
+
* @param composition - 合成对象
|
|
2994
|
+
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
2995
|
+
return Plugin;
|
|
2994
2996
|
}();
|
|
2995
2997
|
|
|
2996
2998
|
function _set_prototype_of(o, p) {
|
|
@@ -7228,13 +7230,388 @@ __decorate([
|
|
|
7228
7230
|
serialize()
|
|
7229
7231
|
], RendererComponent.prototype, "_priority", void 0);
|
|
7230
7232
|
|
|
7233
|
+
var ShaderType;
|
|
7234
|
+
(function(ShaderType) {
|
|
7235
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
7236
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
7237
|
+
})(ShaderType || (ShaderType = {}));
|
|
7238
|
+
var MaskMode;
|
|
7239
|
+
(function(MaskMode) {
|
|
7240
|
+
/**
|
|
7241
|
+
* 无
|
|
7242
|
+
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
7243
|
+
/**
|
|
7244
|
+
* 蒙版
|
|
7245
|
+
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
7246
|
+
/**
|
|
7247
|
+
* 被遮挡
|
|
7248
|
+
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
7249
|
+
/**
|
|
7250
|
+
* 被反向遮挡
|
|
7251
|
+
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
7252
|
+
})(MaskMode || (MaskMode = {}));
|
|
7253
|
+
|
|
7254
|
+
var TextureLoadAction;
|
|
7255
|
+
(function(TextureLoadAction) {
|
|
7256
|
+
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
7257
|
+
//preserve previous attachment
|
|
7258
|
+
//load = 1,
|
|
7259
|
+
//clear attachment
|
|
7260
|
+
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
7261
|
+
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
7262
|
+
var TextureSourceType;
|
|
7263
|
+
(function(TextureSourceType) {
|
|
7264
|
+
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
7265
|
+
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
7266
|
+
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
7267
|
+
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
7268
|
+
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
7269
|
+
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
7270
|
+
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
7271
|
+
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
7272
|
+
})(TextureSourceType || (TextureSourceType = {}));
|
|
7273
|
+
|
|
7274
|
+
var MaskProcessor = /*#__PURE__*/ function() {
|
|
7275
|
+
function MaskProcessor(engine) {
|
|
7276
|
+
this.engine = engine;
|
|
7277
|
+
this.alphaMaskEnabled = false;
|
|
7278
|
+
this.maskMode = MaskMode.NONE;
|
|
7279
|
+
this.maskable = null;
|
|
7280
|
+
this.stencilClearAction = {
|
|
7281
|
+
stencilAction: TextureLoadAction.clear
|
|
7282
|
+
};
|
|
7283
|
+
}
|
|
7284
|
+
var _proto = MaskProcessor.prototype;
|
|
7285
|
+
_proto.getRefValue = function getRefValue() {
|
|
7286
|
+
return 1;
|
|
7287
|
+
};
|
|
7288
|
+
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
7289
|
+
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;
|
|
7290
|
+
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
7291
|
+
if (isMask) {
|
|
7292
|
+
this.maskMode = MaskMode.MASK;
|
|
7293
|
+
} else {
|
|
7294
|
+
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
7295
|
+
this.maskable = this.engine.findObject(reference);
|
|
7296
|
+
}
|
|
7297
|
+
};
|
|
7298
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7299
|
+
if (this.maskable) {
|
|
7300
|
+
renderer.clear(this.stencilClearAction);
|
|
7301
|
+
this.maskable.drawStencilMask(renderer);
|
|
7302
|
+
}
|
|
7303
|
+
};
|
|
7304
|
+
return MaskProcessor;
|
|
7305
|
+
}();
|
|
7306
|
+
|
|
7307
|
+
/**
|
|
7308
|
+
* Helper class to create a WebGL Context
|
|
7309
|
+
*
|
|
7310
|
+
* @param canvas
|
|
7311
|
+
* @param glType
|
|
7312
|
+
* @param options
|
|
7313
|
+
* @returns
|
|
7314
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
7315
|
+
if (glType === void 0) glType = "webgl";
|
|
7316
|
+
var context;
|
|
7317
|
+
if (glType === "webgl2") {
|
|
7318
|
+
context = canvas.getContext("webgl2", options);
|
|
7319
|
+
if (!context) {
|
|
7320
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
7321
|
+
}
|
|
7322
|
+
}
|
|
7323
|
+
if (!context || glType === "webgl") {
|
|
7324
|
+
context = canvas.getContext("webgl", options);
|
|
7325
|
+
}
|
|
7326
|
+
if (!context) {
|
|
7327
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
7328
|
+
}
|
|
7329
|
+
return context;
|
|
7330
|
+
}
|
|
7331
|
+
|
|
7332
|
+
function gpuTimer(gl) {
|
|
7333
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
7334
|
+
if (ext) {
|
|
7335
|
+
var query = gl.createQuery();
|
|
7336
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
7337
|
+
return __generator(this, function(_state) {
|
|
7338
|
+
return [
|
|
7339
|
+
2,
|
|
7340
|
+
new Promise(function(resolve, reject) {
|
|
7341
|
+
if (query) {
|
|
7342
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
7343
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
7344
|
+
if (available && !disjoint) {
|
|
7345
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
7346
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
7347
|
+
// taken to use all significant bits of the result, not just the
|
|
7348
|
+
// least significant 32 bits.
|
|
7349
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
7350
|
+
}
|
|
7351
|
+
if (available || disjoint) {
|
|
7352
|
+
// Clean up the query object.
|
|
7353
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
7354
|
+
query = null;
|
|
7355
|
+
}
|
|
7356
|
+
available !== null && query && window.setTimeout(function() {
|
|
7357
|
+
getTime().then(resolve).catch;
|
|
7358
|
+
}, 1);
|
|
7359
|
+
}
|
|
7360
|
+
})
|
|
7361
|
+
];
|
|
7362
|
+
});
|
|
7363
|
+
});
|
|
7364
|
+
if (!query) {
|
|
7365
|
+
return;
|
|
7366
|
+
}
|
|
7367
|
+
return {
|
|
7368
|
+
begin: function() {
|
|
7369
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
7370
|
+
},
|
|
7371
|
+
end: function() {
|
|
7372
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
7373
|
+
},
|
|
7374
|
+
getTime: getTime
|
|
7375
|
+
};
|
|
7376
|
+
}
|
|
7377
|
+
}
|
|
7378
|
+
|
|
7379
|
+
var initErrors = [];
|
|
7380
|
+
var glContext = {};
|
|
7381
|
+
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
7382
|
+
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
7383
|
+
if (!initErrors.length) {
|
|
7384
|
+
initGLContext();
|
|
7385
|
+
}
|
|
7386
|
+
function initGLContext() {
|
|
7387
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
7388
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
7389
|
+
copy(WebGL2RenderingContext);
|
|
7390
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
7391
|
+
copy(WebGLRenderingContext);
|
|
7392
|
+
copy(WebGLRenderingContext.prototype);
|
|
7393
|
+
} else {
|
|
7394
|
+
if (canUseBOM) {
|
|
7395
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
7396
|
+
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7397
|
+
} else {
|
|
7398
|
+
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7399
|
+
}
|
|
7400
|
+
}
|
|
7401
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
7402
|
+
// @ts-expect-error set default value
|
|
7403
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
7404
|
+
}
|
|
7405
|
+
}
|
|
7406
|
+
function isWebGL2(gl) {
|
|
7407
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
7408
|
+
}
|
|
7409
|
+
function copy(target) {
|
|
7410
|
+
for(var name in target){
|
|
7411
|
+
if (/^[A-Z_]/.test(name)) {
|
|
7412
|
+
// @ts-expect-error safe to assign
|
|
7413
|
+
glContext[name] = target[name];
|
|
7414
|
+
}
|
|
7415
|
+
}
|
|
7416
|
+
}
|
|
7417
|
+
function vertexFormatType2GLType(formatType) {
|
|
7418
|
+
switch(formatType){
|
|
7419
|
+
case VertexFormatType.Float32:
|
|
7420
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7421
|
+
case VertexFormatType.Int16:
|
|
7422
|
+
return WebGLRenderingContext["SHORT"];
|
|
7423
|
+
case VertexFormatType.Int8:
|
|
7424
|
+
return WebGLRenderingContext["BYTE"];
|
|
7425
|
+
case VertexFormatType.UInt16:
|
|
7426
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
7427
|
+
case VertexFormatType.UInt8:
|
|
7428
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
7429
|
+
default:
|
|
7430
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7431
|
+
}
|
|
7432
|
+
}
|
|
7433
|
+
function glType2VertexFormatType(webglType) {
|
|
7434
|
+
switch(webglType){
|
|
7435
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
7436
|
+
return VertexFormatType.Float32;
|
|
7437
|
+
case WebGLRenderingContext["SHORT"]:
|
|
7438
|
+
return VertexFormatType.Int16;
|
|
7439
|
+
case WebGLRenderingContext["BYTE"]:
|
|
7440
|
+
return VertexFormatType.Int8;
|
|
7441
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
7442
|
+
return VertexFormatType.UInt16;
|
|
7443
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
7444
|
+
return VertexFormatType.UInt8;
|
|
7445
|
+
default:
|
|
7446
|
+
return VertexFormatType.Float32;
|
|
7447
|
+
}
|
|
7448
|
+
}
|
|
7449
|
+
|
|
7450
|
+
function valIfUndefined(val, def) {
|
|
7451
|
+
if (val === undefined || val === null) {
|
|
7452
|
+
return def;
|
|
7453
|
+
}
|
|
7454
|
+
return val;
|
|
7455
|
+
}
|
|
7456
|
+
function getPreMultiAlpha(blending) {
|
|
7457
|
+
switch(blending){
|
|
7458
|
+
case BlendingMode.ALPHA:
|
|
7459
|
+
return 1;
|
|
7460
|
+
case BlendingMode.ADD:
|
|
7461
|
+
return 1;
|
|
7462
|
+
case BlendingMode.SUBTRACTION:
|
|
7463
|
+
return 1;
|
|
7464
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7465
|
+
return 1;
|
|
7466
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7467
|
+
return 1;
|
|
7468
|
+
case BlendingMode.SUPERPOSITION:
|
|
7469
|
+
return 2;
|
|
7470
|
+
case BlendingMode.BRIGHTNESS:
|
|
7471
|
+
return 3;
|
|
7472
|
+
case BlendingMode.MULTIPLY:
|
|
7473
|
+
return 0;
|
|
7474
|
+
default:
|
|
7475
|
+
// 处理undefined
|
|
7476
|
+
return 1;
|
|
7477
|
+
}
|
|
7478
|
+
}
|
|
7479
|
+
function setBlendMode(material, blendMode) {
|
|
7480
|
+
switch(blendMode){
|
|
7481
|
+
case undefined:
|
|
7482
|
+
material.blendFunction = [
|
|
7483
|
+
glContext.ONE,
|
|
7484
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7485
|
+
glContext.ONE,
|
|
7486
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7487
|
+
];
|
|
7488
|
+
break;
|
|
7489
|
+
case BlendingMode.ALPHA:
|
|
7490
|
+
material.blendFunction = [
|
|
7491
|
+
glContext.ONE,
|
|
7492
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7493
|
+
glContext.ONE,
|
|
7494
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7495
|
+
];
|
|
7496
|
+
break;
|
|
7497
|
+
case BlendingMode.ADD:
|
|
7498
|
+
material.blendFunction = [
|
|
7499
|
+
glContext.ONE,
|
|
7500
|
+
glContext.ONE,
|
|
7501
|
+
glContext.ONE,
|
|
7502
|
+
glContext.ONE
|
|
7503
|
+
];
|
|
7504
|
+
break;
|
|
7505
|
+
case BlendingMode.SUBTRACTION:
|
|
7506
|
+
material.blendFunction = [
|
|
7507
|
+
glContext.ONE,
|
|
7508
|
+
glContext.ONE,
|
|
7509
|
+
glContext.ZERO,
|
|
7510
|
+
glContext.ONE
|
|
7511
|
+
];
|
|
7512
|
+
material.blendEquation = [
|
|
7513
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
7514
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
7515
|
+
];
|
|
7516
|
+
break;
|
|
7517
|
+
case BlendingMode.SUPERPOSITION:
|
|
7518
|
+
material.blendFunction = [
|
|
7519
|
+
glContext.ONE,
|
|
7520
|
+
glContext.ONE,
|
|
7521
|
+
glContext.ONE,
|
|
7522
|
+
glContext.ONE
|
|
7523
|
+
];
|
|
7524
|
+
break;
|
|
7525
|
+
case BlendingMode.MULTIPLY:
|
|
7526
|
+
material.blendFunction = [
|
|
7527
|
+
glContext.DST_COLOR,
|
|
7528
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7529
|
+
glContext.DST_COLOR,
|
|
7530
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7531
|
+
];
|
|
7532
|
+
break;
|
|
7533
|
+
case BlendingMode.BRIGHTNESS:
|
|
7534
|
+
material.blendFunction = [
|
|
7535
|
+
glContext.ONE,
|
|
7536
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7537
|
+
glContext.ONE,
|
|
7538
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7539
|
+
];
|
|
7540
|
+
break;
|
|
7541
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7542
|
+
material.blendFunction = [
|
|
7543
|
+
glContext.DST_COLOR,
|
|
7544
|
+
glContext.DST_ALPHA,
|
|
7545
|
+
glContext.ZERO,
|
|
7546
|
+
glContext.ONE
|
|
7547
|
+
];
|
|
7548
|
+
break;
|
|
7549
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7550
|
+
material.blendFunction = [
|
|
7551
|
+
glContext.DST_COLOR,
|
|
7552
|
+
glContext.ZERO,
|
|
7553
|
+
glContext.ZERO,
|
|
7554
|
+
glContext.ONE
|
|
7555
|
+
];
|
|
7556
|
+
break;
|
|
7557
|
+
default:
|
|
7558
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
7559
|
+
}
|
|
7560
|
+
}
|
|
7561
|
+
function setSideMode(material, side) {
|
|
7562
|
+
if (side === SideMode.DOUBLE) {
|
|
7563
|
+
material.culling = false;
|
|
7564
|
+
} else {
|
|
7565
|
+
material.culling = true;
|
|
7566
|
+
material.frontFace = glContext.CW;
|
|
7567
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7568
|
+
}
|
|
7569
|
+
}
|
|
7570
|
+
function setMaskMode(material, maskMode) {
|
|
7571
|
+
switch(maskMode){
|
|
7572
|
+
case undefined:
|
|
7573
|
+
material.stencilTest = false;
|
|
7574
|
+
break;
|
|
7575
|
+
case MaskMode.MASK:
|
|
7576
|
+
material.stencilTest = true;
|
|
7577
|
+
material.stencilFunc = [
|
|
7578
|
+
glContext.ALWAYS,
|
|
7579
|
+
glContext.ALWAYS
|
|
7580
|
+
];
|
|
7581
|
+
material.stencilOpZPass = [
|
|
7582
|
+
glContext.REPLACE,
|
|
7583
|
+
glContext.REPLACE
|
|
7584
|
+
];
|
|
7585
|
+
break;
|
|
7586
|
+
case MaskMode.OBSCURED:
|
|
7587
|
+
material.stencilTest = true;
|
|
7588
|
+
material.stencilFunc = [
|
|
7589
|
+
glContext.EQUAL,
|
|
7590
|
+
glContext.EQUAL
|
|
7591
|
+
];
|
|
7592
|
+
break;
|
|
7593
|
+
case MaskMode.REVERSE_OBSCURED:
|
|
7594
|
+
material.stencilTest = true;
|
|
7595
|
+
material.stencilFunc = [
|
|
7596
|
+
glContext.NOTEQUAL,
|
|
7597
|
+
glContext.NOTEQUAL
|
|
7598
|
+
];
|
|
7599
|
+
break;
|
|
7600
|
+
case MaskMode.NONE:
|
|
7601
|
+
material.stencilTest = false;
|
|
7602
|
+
break;
|
|
7603
|
+
default:
|
|
7604
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
7605
|
+
}
|
|
7606
|
+
}
|
|
7607
|
+
|
|
7231
7608
|
/**
|
|
7232
7609
|
* Mesh 组件
|
|
7233
7610
|
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
7234
7611
|
_inherits(MeshComponent, RendererComponent);
|
|
7235
|
-
function MeshComponent() {
|
|
7612
|
+
function MeshComponent(engine) {
|
|
7236
7613
|
var _this;
|
|
7237
|
-
_this = RendererComponent.
|
|
7614
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
7238
7615
|
/**
|
|
7239
7616
|
* 用于点击测试的碰撞器
|
|
7240
7617
|
*/ _this.meshCollider = new MeshCollider();
|
|
@@ -7250,6 +7627,7 @@ __decorate([
|
|
|
7250
7627
|
};
|
|
7251
7628
|
}
|
|
7252
7629
|
};
|
|
7630
|
+
_this.maskManager = new MaskProcessor(engine);
|
|
7253
7631
|
return _this;
|
|
7254
7632
|
}
|
|
7255
7633
|
var _proto = MeshComponent.prototype;
|
|
@@ -7259,12 +7637,42 @@ __decorate([
|
|
|
7259
7637
|
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7260
7638
|
}
|
|
7261
7639
|
};
|
|
7640
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7641
|
+
if (!this.isActiveAndEnabled) {
|
|
7642
|
+
return;
|
|
7643
|
+
}
|
|
7644
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
7645
|
+
var material = this.materials[i];
|
|
7646
|
+
var previousColorMask = material.colorMask;
|
|
7647
|
+
material.colorMask = false;
|
|
7648
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7649
|
+
material.colorMask = previousColorMask;
|
|
7650
|
+
}
|
|
7651
|
+
};
|
|
7262
7652
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
7263
7653
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
7264
7654
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
7265
7655
|
var boundingBox = this.meshCollider.getBoundingBox();
|
|
7266
7656
|
return boundingBox;
|
|
7267
7657
|
};
|
|
7658
|
+
// TODO: Update data spec
|
|
7659
|
+
_proto.fromData = function fromData(data) {
|
|
7660
|
+
RendererComponent.prototype.fromData.call(this, data);
|
|
7661
|
+
var maskableRendererData = data;
|
|
7662
|
+
var maskOptions = maskableRendererData.mask;
|
|
7663
|
+
if (maskOptions) {
|
|
7664
|
+
this.maskManager.setMaskOptions(maskOptions);
|
|
7665
|
+
}
|
|
7666
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.materials), _step; !(_step = _iterator()).done;){
|
|
7667
|
+
var material = _step.value;
|
|
7668
|
+
var stencilRef = this.maskManager.getRefValue();
|
|
7669
|
+
material.stencilRef = [
|
|
7670
|
+
stencilRef,
|
|
7671
|
+
stencilRef
|
|
7672
|
+
];
|
|
7673
|
+
setMaskMode(material, this.maskManager.maskMode);
|
|
7674
|
+
}
|
|
7675
|
+
};
|
|
7268
7676
|
return MeshComponent;
|
|
7269
7677
|
}(RendererComponent);
|
|
7270
7678
|
__decorate([
|
|
@@ -8454,348 +8862,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
8454
8862
|
Matrix4.tempVec2 = new Vector3();
|
|
8455
8863
|
Matrix4.tempMat0 = new Matrix4();
|
|
8456
8864
|
|
|
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
8865
|
/**
|
|
8800
8866
|
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
8801
8867
|
*/ var Downloader = /*#__PURE__*/ function() {
|
|
@@ -10274,39 +10340,6 @@ var MaterialRenderType;
|
|
|
10274
10340
|
return Material;
|
|
10275
10341
|
}(EffectsObject);
|
|
10276
10342
|
|
|
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
10343
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10311
10344
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10312
10345
|
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}";
|
|
@@ -10619,6 +10652,9 @@ var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10619
10652
|
stencilAction: TextureLoadAction.clear
|
|
10620
10653
|
});
|
|
10621
10654
|
}
|
|
10655
|
+
this.meshes.sort(function(a, b) {
|
|
10656
|
+
return a.priority - b.priority;
|
|
10657
|
+
});
|
|
10622
10658
|
renderer.renderMeshes(this.meshes);
|
|
10623
10659
|
};
|
|
10624
10660
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
@@ -12720,244 +12756,131 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
12720
12756
|
return ShaderFactory;
|
|
12721
12757
|
}();
|
|
12722
12758
|
|
|
12723
|
-
// Bloom
|
|
12724
|
-
var
|
|
12725
|
-
_inherits(
|
|
12726
|
-
function
|
|
12759
|
+
// Bloom Pass - 包含阈值提取、高斯模糊(Down Sample 和 Up Sample)
|
|
12760
|
+
var BloomPass = /*#__PURE__*/ function(RenderPass) {
|
|
12761
|
+
_inherits(BloomPass, RenderPass);
|
|
12762
|
+
function BloomPass(renderer, iterationCount) {
|
|
12763
|
+
if (iterationCount === void 0) iterationCount = 4;
|
|
12727
12764
|
var _this;
|
|
12728
12765
|
_this = RenderPass.call(this, renderer) || this;
|
|
12766
|
+
_this.tempRTs = [];
|
|
12767
|
+
_this.iterationCount = iterationCount;
|
|
12729
12768
|
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, {
|
|
12769
|
+
// Threshold material
|
|
12770
|
+
_this.thresholdMaterial = Material.create(engine, {
|
|
12751
12771
|
shader: {
|
|
12752
12772
|
vertex: screenMeshVert,
|
|
12753
12773
|
fragment: thresholdFrag,
|
|
12754
12774
|
glslVersion: GLSLVersion.GLSL1
|
|
12755
12775
|
}
|
|
12756
12776
|
});
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12777
|
+
_this.thresholdMaterial.blending = false;
|
|
12778
|
+
_this.thresholdMaterial.depthTest = false;
|
|
12779
|
+
_this.thresholdMaterial.culling = false;
|
|
12780
|
+
// Down sample H material
|
|
12781
|
+
_this.downSampleHMaterial = Material.create(engine, {
|
|
12782
|
+
shader: {
|
|
12783
|
+
vertex: screenMeshVert,
|
|
12784
|
+
fragment: gaussianDownHFrag,
|
|
12785
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12786
|
+
}
|
|
12764
12787
|
});
|
|
12788
|
+
_this.downSampleHMaterial.blending = false;
|
|
12789
|
+
_this.downSampleHMaterial.depthTest = false;
|
|
12790
|
+
_this.downSampleHMaterial.culling = false;
|
|
12791
|
+
// Down sample V material
|
|
12792
|
+
_this.downSampleVMaterial = Material.create(engine, {
|
|
12793
|
+
shader: {
|
|
12794
|
+
vertex: screenMeshVert,
|
|
12795
|
+
fragment: gaussianDownVFrag,
|
|
12796
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12797
|
+
}
|
|
12798
|
+
});
|
|
12799
|
+
_this.downSampleVMaterial.blending = false;
|
|
12800
|
+
_this.downSampleVMaterial.depthTest = false;
|
|
12801
|
+
_this.downSampleVMaterial.culling = false;
|
|
12802
|
+
// Up sample material
|
|
12803
|
+
_this.upSampleMaterial = Material.create(engine, {
|
|
12804
|
+
shader: {
|
|
12805
|
+
vertex: screenMeshVert,
|
|
12806
|
+
fragment: gaussianUpFrag,
|
|
12807
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12808
|
+
}
|
|
12809
|
+
});
|
|
12810
|
+
_this.upSampleMaterial.blending = false;
|
|
12811
|
+
_this.upSampleMaterial.depthTest = false;
|
|
12812
|
+
_this.upSampleMaterial.culling = false;
|
|
12765
12813
|
_this.priority = 5000;
|
|
12766
|
-
_this.name = "
|
|
12814
|
+
_this.name = "BloomPass";
|
|
12767
12815
|
return _this;
|
|
12768
12816
|
}
|
|
12769
|
-
var _proto =
|
|
12817
|
+
var _proto = BloomPass.prototype;
|
|
12770
12818
|
_proto.configure = function configure(renderer) {
|
|
12771
|
-
|
|
12819
|
+
// 获取场景纹理用于 ToneMappingPass
|
|
12772
12820
|
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12773
12821
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
12774
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12775
12822
|
};
|
|
12776
12823
|
_proto.execute = function execute(renderer) {
|
|
12777
12824
|
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);
|
|
12825
|
+
var baseWidth = renderer.getWidth();
|
|
12826
|
+
var baseHeight = renderer.getHeight();
|
|
12784
12827
|
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
12828
|
+
// 1. Threshold pass - 提取高亮区域
|
|
12785
12829
|
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
|
-
]
|
|
12830
|
+
this.thresholdRT = renderer.getTemporaryRT("_BloomThreshold", baseWidth, baseHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12831
|
+
this.thresholdMaterial.setFloat("_Threshold", threshold);
|
|
12832
|
+
renderer.blit(this.mainTexture, this.thresholdRT, this.thresholdMaterial);
|
|
12833
|
+
var currentTexture = this.thresholdRT.getColorTextures()[0];
|
|
12834
|
+
// 2. Down sample passes
|
|
12835
|
+
for(var i = 0; i < this.iterationCount; i++){
|
|
12836
|
+
var downWidth = Math.floor(baseWidth / Math.pow(2, i + 1));
|
|
12837
|
+
var downHeight = Math.floor(baseHeight / Math.pow(2, i + 1));
|
|
12838
|
+
// Horizontal pass
|
|
12839
|
+
var tempH = renderer.getTemporaryRT("_BloomDownH" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12840
|
+
this.downSampleHMaterial.setVector2("_TextureSize", getTextureSize(currentTexture));
|
|
12841
|
+
renderer.blit(currentTexture, tempH, this.downSampleHMaterial);
|
|
12842
|
+
// Vertical pass
|
|
12843
|
+
var tempV = renderer.getTemporaryRT("_BloomDownV" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12844
|
+
this.downSampleVMaterial.setVector2("_TextureSize", getTextureSize(tempH.getColorTextures()[0]));
|
|
12845
|
+
renderer.blit(tempH.getColorTextures()[0], tempV, this.downSampleVMaterial);
|
|
12846
|
+
// 释放 H pass RT,保留 V pass RT 用于 up sample
|
|
12847
|
+
renderer.releaseTemporaryRT(tempH);
|
|
12848
|
+
this.tempRTs.push(tempV);
|
|
12849
|
+
currentTexture = tempV.getColorTextures()[0];
|
|
12850
|
+
}
|
|
12851
|
+
// 释放 threshold RT
|
|
12852
|
+
renderer.releaseTemporaryRT(this.thresholdRT);
|
|
12853
|
+
// 3. Up sample passes
|
|
12854
|
+
for(var i1 = this.iterationCount - 1; i1 > 0; i1--){
|
|
12855
|
+
var upWidth = Math.floor(baseWidth / Math.pow(2, i1 - 1));
|
|
12856
|
+
var upHeight = Math.floor(baseHeight / Math.pow(2, i1 - 1));
|
|
12857
|
+
var tempUp = renderer.getTemporaryRT("_BloomUp" + i1, upWidth, upHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12858
|
+
// 获取下一层的 down sample 结果
|
|
12859
|
+
var downSampleTexture = this.tempRTs[i1 - 1].getColorTextures()[0];
|
|
12860
|
+
this.upSampleMaterial.setTexture("_GaussianDownTex", downSampleTexture);
|
|
12861
|
+
this.upSampleMaterial.setVector2("_GaussianDownTextureSize", getTextureSize(downSampleTexture));
|
|
12862
|
+
renderer.blit(currentTexture, tempUp, this.upSampleMaterial);
|
|
12863
|
+
currentTexture = tempUp.getColorTextures()[0];
|
|
12864
|
+
this.tempRTs.push(tempUp);
|
|
12865
|
+
}
|
|
12866
|
+
// 设置最终输出到当前 framebuffer
|
|
12867
|
+
renderer.setFramebuffer(this.tempRTs[this.tempRTs.length - 1]);
|
|
12790
12868
|
};
|
|
12791
12869
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12792
|
-
|
|
12793
|
-
|
|
12870
|
+
// 释放所有临时 RT
|
|
12871
|
+
for(var i = 0; i < this.tempRTs.length; i++){
|
|
12872
|
+
renderer.releaseTemporaryRT(this.tempRTs[i]);
|
|
12794
12873
|
}
|
|
12874
|
+
this.tempRTs = [];
|
|
12795
12875
|
};
|
|
12796
12876
|
_proto.dispose = function dispose(options) {
|
|
12877
|
+
this.thresholdMaterial.dispose();
|
|
12878
|
+
this.downSampleHMaterial.dispose();
|
|
12879
|
+
this.downSampleVMaterial.dispose();
|
|
12880
|
+
this.upSampleMaterial.dispose();
|
|
12797
12881
|
RenderPass.prototype.dispose.call(this, options);
|
|
12798
12882
|
};
|
|
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;
|
|
12883
|
+
return BloomPass;
|
|
12961
12884
|
}(RenderPass);
|
|
12962
12885
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
12963
12886
|
var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -13101,36 +13024,11 @@ var seed$6 = 1;
|
|
|
13101
13024
|
if (postProcessingEnabled) {
|
|
13102
13025
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
13103
13026
|
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
|
-
}
|
|
13027
|
+
// Bloom Pass(包含阈值提取、高斯模糊)
|
|
13028
|
+
var bloomPass = new BloomPass(renderer, gaussianStep);
|
|
13029
|
+
bloomPass.sceneTextureHandle = sceneTextureHandle;
|
|
13030
|
+
this.addRenderPass(bloomPass);
|
|
13031
|
+
// Tone Mapping Pass
|
|
13134
13032
|
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
13135
13033
|
this.addRenderPass(postProcessPass);
|
|
13136
13034
|
}
|
|
@@ -13624,6 +13522,14 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13624
13522
|
_proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
|
|
13625
13523
|
this.renderTargetPool.release(rt);
|
|
13626
13524
|
};
|
|
13525
|
+
/**
|
|
13526
|
+
* 将源纹理复制到目标 Framebuffer,可使用自定义材质进行处理
|
|
13527
|
+
* @param source - 源纹理
|
|
13528
|
+
* @param destination - 目标 Framebuffer,如果为 null 则渲染到屏幕
|
|
13529
|
+
* @param material - 可选的自定义材质,不传则使用默认复制材质
|
|
13530
|
+
*/ _proto.blit = function blit(source, destination, material) {
|
|
13531
|
+
// OVERRIDE
|
|
13532
|
+
};
|
|
13627
13533
|
_proto.dispose = function dispose() {
|
|
13628
13534
|
// OVERRIDE
|
|
13629
13535
|
};
|
|
@@ -16686,13 +16592,49 @@ CameraController = __decorate([
|
|
|
16686
16592
|
effectsClass(DataType.CameraController)
|
|
16687
16593
|
], CameraController);
|
|
16688
16594
|
|
|
16689
|
-
|
|
16690
|
-
|
|
16595
|
+
function _get_prototype_of(o) {
|
|
16596
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
16597
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
16598
|
+
};
|
|
16599
|
+
return _get_prototype_of(o);
|
|
16600
|
+
}
|
|
16601
|
+
|
|
16602
|
+
function _is_native_function(fn) {
|
|
16603
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
16604
|
+
}
|
|
16605
|
+
|
|
16606
|
+
function _wrap_native_super(Class) {
|
|
16607
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
16608
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
16609
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
16610
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
16611
|
+
if (typeof _cache !== "undefined") {
|
|
16612
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
16613
|
+
_cache.set(Class, Wrapper);
|
|
16614
|
+
}
|
|
16615
|
+
function Wrapper() {
|
|
16616
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
16617
|
+
}
|
|
16618
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
16619
|
+
constructor: {
|
|
16620
|
+
value: Wrapper,
|
|
16621
|
+
enumerable: false,
|
|
16622
|
+
writable: true,
|
|
16623
|
+
configurable: true
|
|
16624
|
+
}
|
|
16625
|
+
});
|
|
16626
|
+
return _set_prototype_of(Wrapper, Class);
|
|
16627
|
+
};
|
|
16628
|
+
return _wrap_native_super(Class);
|
|
16629
|
+
}
|
|
16630
|
+
|
|
16631
|
+
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
16632
|
+
_inherits(CameraVFXItemLoader, Plugin);
|
|
16691
16633
|
function CameraVFXItemLoader() {
|
|
16692
|
-
return
|
|
16634
|
+
return Plugin.apply(this, arguments);
|
|
16693
16635
|
}
|
|
16694
16636
|
return CameraVFXItemLoader;
|
|
16695
|
-
}(
|
|
16637
|
+
}(_wrap_native_super(Plugin));
|
|
16696
16638
|
|
|
16697
16639
|
var HitTestType;
|
|
16698
16640
|
(function(HitTestType) {
|
|
@@ -16976,13 +16918,13 @@ function getCoord(event) {
|
|
|
16976
16918
|
};
|
|
16977
16919
|
}
|
|
16978
16920
|
|
|
16979
|
-
var InteractLoader = /*#__PURE__*/ function(
|
|
16980
|
-
_inherits(InteractLoader,
|
|
16921
|
+
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
16922
|
+
_inherits(InteractLoader, Plugin);
|
|
16981
16923
|
function InteractLoader() {
|
|
16982
|
-
return
|
|
16924
|
+
return Plugin.apply(this, arguments);
|
|
16983
16925
|
}
|
|
16984
16926
|
return InteractLoader;
|
|
16985
|
-
}(
|
|
16927
|
+
}(_wrap_native_super(Plugin));
|
|
16986
16928
|
|
|
16987
16929
|
var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n}\n";
|
|
16988
16930
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n";
|
|
@@ -17581,16 +17523,16 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
17581
17523
|
return MeshCollider;
|
|
17582
17524
|
}();
|
|
17583
17525
|
|
|
17584
|
-
var SpriteLoader = /*#__PURE__*/ function(
|
|
17585
|
-
_inherits(SpriteLoader,
|
|
17526
|
+
var SpriteLoader = /*#__PURE__*/ function(Plugin) {
|
|
17527
|
+
_inherits(SpriteLoader, Plugin);
|
|
17586
17528
|
function SpriteLoader() {
|
|
17587
17529
|
var _this;
|
|
17588
|
-
_this =
|
|
17530
|
+
_this = Plugin.apply(this, arguments) || this;
|
|
17589
17531
|
_this.name = "sprite";
|
|
17590
17532
|
return _this;
|
|
17591
17533
|
}
|
|
17592
17534
|
return SpriteLoader;
|
|
17593
|
-
}(
|
|
17535
|
+
}(_wrap_native_super(Plugin));
|
|
17594
17536
|
|
|
17595
17537
|
/**
|
|
17596
17538
|
* 动画图可播放节点对象
|
|
@@ -20081,7 +20023,7 @@ function calculateDirection(prePoint, point, nextPoint) {
|
|
|
20081
20023
|
if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
|
|
20082
20024
|
particleSystem.reset();
|
|
20083
20025
|
}
|
|
20084
|
-
particleSystem.
|
|
20026
|
+
particleSystem.simulate(this.time - particleSystem.time);
|
|
20085
20027
|
}
|
|
20086
20028
|
this.lastTime = this.time;
|
|
20087
20029
|
};
|
|
@@ -21532,126 +21474,133 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21532
21474
|
this.initEmitterTransform();
|
|
21533
21475
|
};
|
|
21534
21476
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21535
|
-
this.
|
|
21477
|
+
if (!this.frozen) {
|
|
21478
|
+
this.update(dt);
|
|
21479
|
+
}
|
|
21480
|
+
};
|
|
21481
|
+
_proto.simulate = function simulate(time) {
|
|
21482
|
+
this.update(time * 1000);
|
|
21483
|
+
this.frozen = true;
|
|
21536
21484
|
};
|
|
21537
21485
|
_proto.update = function update(delta) {
|
|
21538
21486
|
var _this = this;
|
|
21539
|
-
if (this.started
|
|
21540
|
-
|
|
21541
|
-
|
|
21542
|
-
|
|
21543
|
-
|
|
21544
|
-
|
|
21545
|
-
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21561
|
-
|
|
21487
|
+
if (!this.started) {
|
|
21488
|
+
return;
|
|
21489
|
+
}
|
|
21490
|
+
var now = this.time + delta / 1000;
|
|
21491
|
+
var options = this.options;
|
|
21492
|
+
var loopStartTime = this.loopStartTime;
|
|
21493
|
+
var emission = this.emission;
|
|
21494
|
+
this.time = now;
|
|
21495
|
+
this.upDirectionWorld = null;
|
|
21496
|
+
this.renderer.updateTime(now, delta);
|
|
21497
|
+
var link = this.particleLink;
|
|
21498
|
+
var emitterLifetime = (now - loopStartTime) / this.item.duration;
|
|
21499
|
+
var timePassed = this.timePassed;
|
|
21500
|
+
var trailUpdated = false;
|
|
21501
|
+
var updateTrail = function() {
|
|
21502
|
+
if (_this.trails && !trailUpdated) {
|
|
21503
|
+
trailUpdated = true;
|
|
21504
|
+
link.forEach(function(param) {
|
|
21505
|
+
var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
|
|
21506
|
+
if (time < timePassed) {
|
|
21507
|
+
_this.clearPointTrail(pointIndex);
|
|
21508
|
+
} else if (timePassed > delay) {
|
|
21509
|
+
_this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
|
|
21510
|
+
}
|
|
21511
|
+
});
|
|
21512
|
+
}
|
|
21513
|
+
};
|
|
21514
|
+
if (!this.ended) {
|
|
21515
|
+
var duration = this.item.duration;
|
|
21516
|
+
var lifetime = this.lifetime;
|
|
21517
|
+
if (timePassed < duration) {
|
|
21518
|
+
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21519
|
+
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21520
|
+
var maxEmissionCount = pointCount;
|
|
21521
|
+
var timeDelta = interval / pointCount;
|
|
21522
|
+
var meshTime = now;
|
|
21523
|
+
var maxCount = options.maxCount;
|
|
21524
|
+
this.updateEmitterTransform(timePassed);
|
|
21525
|
+
var shouldSkipGenerate = function() {
|
|
21526
|
+
var first = link.first;
|
|
21527
|
+
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21528
|
+
};
|
|
21529
|
+
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21530
|
+
if (shouldSkipGenerate()) {
|
|
21531
|
+
break;
|
|
21532
|
+
}
|
|
21533
|
+
var p = this.createPoint(lifetime);
|
|
21534
|
+
p.delay += meshTime + i * timeDelta;
|
|
21535
|
+
this.addParticle(p, maxCount);
|
|
21536
|
+
this.lastEmitTime = timePassed;
|
|
21562
21537
|
}
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
if (timePassed < duration) {
|
|
21568
|
-
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21569
|
-
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21570
|
-
var maxEmissionCount = pointCount;
|
|
21571
|
-
var timeDelta = interval / pointCount;
|
|
21572
|
-
var meshTime = now;
|
|
21573
|
-
var maxCount = options.maxCount;
|
|
21574
|
-
this.updateEmitterTransform(timePassed);
|
|
21575
|
-
var shouldSkipGenerate = function() {
|
|
21576
|
-
var first = link.first;
|
|
21577
|
-
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21578
|
-
};
|
|
21579
|
-
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21580
|
-
if (shouldSkipGenerate()) {
|
|
21581
|
-
break;
|
|
21582
|
-
}
|
|
21583
|
-
var p = this.createPoint(lifetime);
|
|
21584
|
-
p.delay += meshTime + i * timeDelta;
|
|
21585
|
-
this.addParticle(p, maxCount);
|
|
21586
|
-
this.lastEmitTime = timePassed;
|
|
21538
|
+
var bursts = emission.bursts;
|
|
21539
|
+
for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
|
|
21540
|
+
if (shouldSkipGenerate()) {
|
|
21541
|
+
break;
|
|
21587
21542
|
}
|
|
21588
|
-
var
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21543
|
+
var burst = bursts[j];
|
|
21544
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
21545
|
+
if (opts) {
|
|
21546
|
+
var originVec = [
|
|
21547
|
+
0,
|
|
21548
|
+
0,
|
|
21549
|
+
0
|
|
21550
|
+
];
|
|
21551
|
+
var offsets = emission.burstOffsets[j];
|
|
21552
|
+
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21553
|
+
if (burst.once) {
|
|
21554
|
+
this.removeBurst(j);
|
|
21592
21555
|
}
|
|
21593
|
-
var
|
|
21594
|
-
|
|
21595
|
-
|
|
21596
|
-
|
|
21597
|
-
0,
|
|
21598
|
-
0,
|
|
21599
|
-
0
|
|
21600
|
-
];
|
|
21601
|
-
var offsets = emission.burstOffsets[j];
|
|
21602
|
-
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21603
|
-
if (burst.once) {
|
|
21604
|
-
this.removeBurst(j);
|
|
21605
|
-
}
|
|
21606
|
-
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21607
|
-
var _p_transform;
|
|
21608
|
-
if (shouldSkipGenerate()) {
|
|
21609
|
-
break;
|
|
21610
|
-
}
|
|
21611
|
-
var p1 = this.initPoint(this.shape.generate({
|
|
21612
|
-
total: opts.total,
|
|
21613
|
-
index: opts.index,
|
|
21614
|
-
burstIndex: i1,
|
|
21615
|
-
burstCount: opts.count
|
|
21616
|
-
}));
|
|
21617
|
-
p1.delay += meshTime;
|
|
21618
|
-
cursor++;
|
|
21619
|
-
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21620
|
-
this.addParticle(p1, maxCount);
|
|
21556
|
+
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21557
|
+
var _p_transform;
|
|
21558
|
+
if (shouldSkipGenerate()) {
|
|
21559
|
+
break;
|
|
21621
21560
|
}
|
|
21561
|
+
var p1 = this.initPoint(this.shape.generate({
|
|
21562
|
+
total: opts.total,
|
|
21563
|
+
index: opts.index,
|
|
21564
|
+
burstIndex: i1,
|
|
21565
|
+
burstCount: opts.count
|
|
21566
|
+
}));
|
|
21567
|
+
p1.delay += meshTime;
|
|
21568
|
+
cursor++;
|
|
21569
|
+
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21570
|
+
this.addParticle(p1, maxCount);
|
|
21622
21571
|
}
|
|
21623
21572
|
}
|
|
21624
|
-
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21625
|
-
updateTrail();
|
|
21626
|
-
this.loopStartTime = now - duration;
|
|
21627
|
-
this.lastEmitTime -= duration;
|
|
21628
|
-
this.time -= duration;
|
|
21629
|
-
emission.bursts.forEach(function(b) {
|
|
21630
|
-
return b.reset();
|
|
21631
|
-
});
|
|
21632
|
-
this.particleLink.forEach(function(content) {
|
|
21633
|
-
content[0] -= duration;
|
|
21634
|
-
content[2] -= duration;
|
|
21635
|
-
content[3].delay -= duration;
|
|
21636
|
-
});
|
|
21637
|
-
this.renderer.minusTimeForLoop(duration);
|
|
21638
|
-
} else {
|
|
21639
|
-
this.ended = true;
|
|
21640
|
-
var endBehavior = this.item.endBehavior;
|
|
21641
|
-
if (endBehavior === EndBehavior.freeze) {
|
|
21642
|
-
this.frozen = true;
|
|
21643
|
-
}
|
|
21644
21573
|
}
|
|
21645
|
-
} else if (this.item.endBehavior
|
|
21646
|
-
|
|
21647
|
-
|
|
21648
|
-
|
|
21649
|
-
|
|
21650
|
-
|
|
21574
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21575
|
+
updateTrail();
|
|
21576
|
+
this.loopStartTime = now - duration;
|
|
21577
|
+
this.lastEmitTime -= duration;
|
|
21578
|
+
this.time -= duration;
|
|
21579
|
+
emission.bursts.forEach(function(b) {
|
|
21580
|
+
return b.reset();
|
|
21581
|
+
});
|
|
21582
|
+
this.particleLink.forEach(function(content) {
|
|
21583
|
+
content[0] -= duration;
|
|
21584
|
+
content[2] -= duration;
|
|
21585
|
+
content[3].delay -= duration;
|
|
21586
|
+
});
|
|
21587
|
+
this.renderer.minusTimeForLoop(duration);
|
|
21588
|
+
} else {
|
|
21589
|
+
this.ended = true;
|
|
21590
|
+
var endBehavior = this.item.endBehavior;
|
|
21591
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
21592
|
+
this.frozen = true;
|
|
21593
|
+
}
|
|
21594
|
+
}
|
|
21595
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
21596
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
21597
|
+
var node = link.last;
|
|
21598
|
+
if (node && node.content[0] < this.time) {
|
|
21599
|
+
this.destroyed = true;
|
|
21651
21600
|
}
|
|
21652
21601
|
}
|
|
21653
|
-
updateTrail();
|
|
21654
21602
|
}
|
|
21603
|
+
updateTrail();
|
|
21655
21604
|
};
|
|
21656
21605
|
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
21657
21606
|
if (!this.isActiveAndEnabled) {
|
|
@@ -25691,7 +25640,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25691
25640
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25692
25641
|
_this.time = 0;
|
|
25693
25642
|
_this.duration = 1;
|
|
25694
|
-
_this.loop = true;
|
|
25695
25643
|
/**
|
|
25696
25644
|
* @internal
|
|
25697
25645
|
*/ _this.splits = singleSplits;
|
|
@@ -25706,11 +25654,15 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25706
25654
|
var _this = this;
|
|
25707
25655
|
var time = this.time;
|
|
25708
25656
|
var duration = this.duration;
|
|
25709
|
-
|
|
25657
|
+
var textureAnimation = this.textureSheetAnimation;
|
|
25658
|
+
var _textureAnimation_loop;
|
|
25659
|
+
// TODO: Update textureAnimation spec.
|
|
25660
|
+
// @ts-expect-error
|
|
25661
|
+
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25662
|
+
if (time > duration && loop) {
|
|
25710
25663
|
time = time % duration;
|
|
25711
25664
|
}
|
|
25712
25665
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
25713
|
-
var ta = this.textureSheetAnimation;
|
|
25714
25666
|
var video = this.renderer.texture.source.video;
|
|
25715
25667
|
if (video) {
|
|
25716
25668
|
if (time === 0) {
|
|
@@ -25722,9 +25674,9 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25722
25674
|
}
|
|
25723
25675
|
this.renderer.texture.uploadCurrentVideoFrame();
|
|
25724
25676
|
}
|
|
25725
|
-
if (
|
|
25677
|
+
if (textureAnimation) {
|
|
25726
25678
|
var _this_material_getVector4;
|
|
25727
|
-
var total =
|
|
25679
|
+
var total = textureAnimation.total || textureAnimation.row * textureAnimation.col;
|
|
25728
25680
|
var texRectX = 0;
|
|
25729
25681
|
var texRectY = 0;
|
|
25730
25682
|
var texRectW = 1;
|
|
@@ -25745,20 +25697,20 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25745
25697
|
}
|
|
25746
25698
|
var dx, dy;
|
|
25747
25699
|
if (flip) {
|
|
25748
|
-
dx = 1 /
|
|
25749
|
-
dy = 1 /
|
|
25700
|
+
dx = 1 / textureAnimation.row * texRectW;
|
|
25701
|
+
dy = 1 / textureAnimation.col * texRectH;
|
|
25750
25702
|
} else {
|
|
25751
|
-
dx = 1 /
|
|
25752
|
-
dy = 1 /
|
|
25703
|
+
dx = 1 / textureAnimation.col * texRectW;
|
|
25704
|
+
dy = 1 / textureAnimation.row * texRectH;
|
|
25753
25705
|
}
|
|
25754
25706
|
var texOffset;
|
|
25755
|
-
if (
|
|
25707
|
+
if (textureAnimation.animate) {
|
|
25756
25708
|
var frameIndex = Math.round(life * (total - 1));
|
|
25757
|
-
var yIndex = Math.floor(frameIndex /
|
|
25758
|
-
var xIndex = frameIndex - yIndex *
|
|
25709
|
+
var yIndex = Math.floor(frameIndex / textureAnimation.col);
|
|
25710
|
+
var xIndex = frameIndex - yIndex * textureAnimation.col;
|
|
25759
25711
|
texOffset = flip ? [
|
|
25760
25712
|
dx * yIndex,
|
|
25761
|
-
dy * (
|
|
25713
|
+
dy * (textureAnimation.col - xIndex)
|
|
25762
25714
|
] : [
|
|
25763
25715
|
dx * xIndex,
|
|
25764
25716
|
dy * (1 + yIndex)
|
|
@@ -25946,8 +25898,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25946
25898
|
var _data_duration;
|
|
25947
25899
|
//@ts-expect-error
|
|
25948
25900
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
25949
|
-
var _data_loop;
|
|
25950
|
-
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
25951
25901
|
};
|
|
25952
25902
|
return SpriteComponent;
|
|
25953
25903
|
}(MaskableGraphic);
|
|
@@ -25955,21 +25905,21 @@ SpriteComponent = __decorate([
|
|
|
25955
25905
|
effectsClass(DataType.SpriteComponent)
|
|
25956
25906
|
], SpriteComponent);
|
|
25957
25907
|
|
|
25958
|
-
var ParticleLoader = /*#__PURE__*/ function(
|
|
25959
|
-
_inherits(ParticleLoader,
|
|
25908
|
+
var ParticleLoader = /*#__PURE__*/ function(Plugin) {
|
|
25909
|
+
_inherits(ParticleLoader, Plugin);
|
|
25960
25910
|
function ParticleLoader() {
|
|
25961
|
-
return
|
|
25911
|
+
return Plugin.apply(this, arguments);
|
|
25962
25912
|
}
|
|
25963
25913
|
return ParticleLoader;
|
|
25964
|
-
}(
|
|
25914
|
+
}(_wrap_native_super(Plugin));
|
|
25965
25915
|
|
|
25966
|
-
var CalculateLoader = /*#__PURE__*/ function(
|
|
25967
|
-
_inherits(CalculateLoader,
|
|
25916
|
+
var CalculateLoader = /*#__PURE__*/ function(Plugin) {
|
|
25917
|
+
_inherits(CalculateLoader, Plugin);
|
|
25968
25918
|
function CalculateLoader() {
|
|
25969
|
-
return
|
|
25919
|
+
return Plugin.apply(this, arguments);
|
|
25970
25920
|
}
|
|
25971
25921
|
return CalculateLoader;
|
|
25972
|
-
}(
|
|
25922
|
+
}(_wrap_native_super(Plugin));
|
|
25973
25923
|
|
|
25974
25924
|
// Based on:
|
|
25975
25925
|
/**
|
|
@@ -29071,6 +29021,12 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29071
29021
|
/**
|
|
29072
29022
|
* 每一行文本的最大宽度
|
|
29073
29023
|
*/ _this.maxLineWidth = 0;
|
|
29024
|
+
/**
|
|
29025
|
+
* 初始文本宽度,用于计算缩放比例
|
|
29026
|
+
*/ _this.baseTextWidth = 0;
|
|
29027
|
+
/**
|
|
29028
|
+
* 初始 `transform.size.x`,用于按比例更新显示宽度
|
|
29029
|
+
*/ _this.baseScaleX = 1;
|
|
29074
29030
|
_this.name = "MText" + seed$2++;
|
|
29075
29031
|
// 初始化canvas资源
|
|
29076
29032
|
_this.canvas = canvasPool.getCanvas();
|
|
@@ -29096,10 +29052,11 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29096
29052
|
text: "默认文本",
|
|
29097
29053
|
fontFamily: "AlibabaSans-BoldItalic",
|
|
29098
29054
|
fontSize: 40,
|
|
29055
|
+
// 统一使用 0-1 颜色值
|
|
29099
29056
|
textColor: [
|
|
29100
|
-
|
|
29101
|
-
|
|
29102
|
-
|
|
29057
|
+
1,
|
|
29058
|
+
1,
|
|
29059
|
+
1,
|
|
29103
29060
|
1
|
|
29104
29061
|
],
|
|
29105
29062
|
fontWeight: TextWeight.normal,
|
|
@@ -29136,6 +29093,10 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29136
29093
|
// TextComponentBase
|
|
29137
29094
|
this.updateWithOptions(options);
|
|
29138
29095
|
this.renderText(options);
|
|
29096
|
+
// 记录初始的 textWidth 和 x 缩放,用于后续按比例更新显示宽度
|
|
29097
|
+
// 添加兜底值 1 防止除 0
|
|
29098
|
+
this.baseTextWidth = options.textWidth || this.textLayout.width || 1;
|
|
29099
|
+
this.baseScaleX = this.item.transform.size.x;
|
|
29139
29100
|
// 恢复默认颜色
|
|
29140
29101
|
this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
29141
29102
|
};
|
|
@@ -29334,9 +29295,9 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29334
29295
|
if (style.isOutlined) {
|
|
29335
29296
|
_this.setupOutline();
|
|
29336
29297
|
}
|
|
29337
|
-
//
|
|
29298
|
+
// textColor 统一是 0-1,写入 canvas 时乘 255
|
|
29338
29299
|
var _style_textColor = style.textColor, r = _style_textColor[0], g = _style_textColor[1], b = _style_textColor[2], a = _style_textColor[3];
|
|
29339
|
-
context.fillStyle = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
|
|
29300
|
+
context.fillStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
29340
29301
|
var charsInfo = [];
|
|
29341
29302
|
var x = 0;
|
|
29342
29303
|
var y = layout.getOffsetY(style, _this.lineCount, lineHeight, fontSize);
|
|
@@ -29398,6 +29359,46 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29398
29359
|
layout.autoWidth = normalizedValue;
|
|
29399
29360
|
this.isDirty = true;
|
|
29400
29361
|
};
|
|
29362
|
+
/**
|
|
29363
|
+
* 设置文本框宽度
|
|
29364
|
+
* 手动设置宽度时会自动关闭 `autoWidth`
|
|
29365
|
+
* 同时会按比例更新 `transform.size.x`,让 UI 框宽度也跟着变化
|
|
29366
|
+
* @param value - 文本框宽度
|
|
29367
|
+
*/ _proto.setTextWidth = function setTextWidth(value) {
|
|
29368
|
+
var width = Math.max(0, Number(value) || 0);
|
|
29369
|
+
var layout = this.textLayout;
|
|
29370
|
+
// 宽度没变且已是非 autoWidth 模式,直接返回
|
|
29371
|
+
if (layout.width === width && layout.autoWidth === false) {
|
|
29372
|
+
return;
|
|
29373
|
+
}
|
|
29374
|
+
// 手动设置宽度时关闭 autoWidth
|
|
29375
|
+
layout.autoWidth = false;
|
|
29376
|
+
layout.width = width;
|
|
29377
|
+
// 按当前 overflow 模式重新计算行数和 maxLineWidth
|
|
29378
|
+
this.lineCount = this.getLineCount(this.text || "");
|
|
29379
|
+
this.isDirty = true;
|
|
29380
|
+
// 同步更新外层显示宽度(按比例缩放 transform)
|
|
29381
|
+
// 这样 UI 框的视觉宽度也会跟着文本宽度变化
|
|
29382
|
+
if (this.baseTextWidth > 0) {
|
|
29383
|
+
var scale = width / this.baseTextWidth;
|
|
29384
|
+
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29385
|
+
}
|
|
29386
|
+
};
|
|
29387
|
+
/**
|
|
29388
|
+
* 设置文本框高度
|
|
29389
|
+
* @param value - 文本框高度
|
|
29390
|
+
*/ _proto.setTextHeight = function setTextHeight(value) {
|
|
29391
|
+
var height = Math.max(0, Number(value) || 0);
|
|
29392
|
+
if (height === 0) {
|
|
29393
|
+
return;
|
|
29394
|
+
}
|
|
29395
|
+
var layout = this.textLayout;
|
|
29396
|
+
if (layout.height === height) {
|
|
29397
|
+
return;
|
|
29398
|
+
}
|
|
29399
|
+
layout.height = height;
|
|
29400
|
+
this.isDirty = true;
|
|
29401
|
+
};
|
|
29401
29402
|
_proto.setFontSize = function setFontSize(value) {
|
|
29402
29403
|
if (this.textStyle.fontSize === value) {
|
|
29403
29404
|
return;
|
|
@@ -29465,13 +29466,13 @@ applyMixins(TextComponent, [
|
|
|
29465
29466
|
]);
|
|
29466
29467
|
|
|
29467
29468
|
// TODO: 注册必须用
|
|
29468
|
-
var TextLoader = /*#__PURE__*/ function(
|
|
29469
|
-
_inherits(TextLoader,
|
|
29469
|
+
var TextLoader = /*#__PURE__*/ function(Plugin) {
|
|
29470
|
+
_inherits(TextLoader, Plugin);
|
|
29470
29471
|
function TextLoader() {
|
|
29471
|
-
return
|
|
29472
|
+
return Plugin.apply(this, arguments);
|
|
29472
29473
|
}
|
|
29473
29474
|
return TextLoader;
|
|
29474
|
-
}(
|
|
29475
|
+
}(_wrap_native_super(Plugin));
|
|
29475
29476
|
|
|
29476
29477
|
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
29477
29478
|
_inherits(Asset, EffectsObject);
|
|
@@ -30528,6 +30529,10 @@ function version35Migration(json) {
|
|
|
30528
30529
|
if (component.dataType === DataType.TextComponent || component.dataType === DataType.RichTextComponent && component.options) {
|
|
30529
30530
|
ensureTextVerticalAlign(component.options);
|
|
30530
30531
|
}
|
|
30532
|
+
// 处理文本颜色从 0-255 到 0-1 的转换
|
|
30533
|
+
if (component.dataType === DataType.TextComponent) {
|
|
30534
|
+
convertTextColorTo01(component.options);
|
|
30535
|
+
}
|
|
30531
30536
|
}
|
|
30532
30537
|
}
|
|
30533
30538
|
//@ts-expect-error
|
|
@@ -30547,6 +30552,22 @@ function version35Migration(json) {
|
|
|
30547
30552
|
options.TextVerticalAlign = options.textBaseline;
|
|
30548
30553
|
}
|
|
30549
30554
|
}
|
|
30555
|
+
/**
|
|
30556
|
+
* 将文本颜色从 0-255 转换到 0-1
|
|
30557
|
+
*/ function convertTextColorTo01(options) {
|
|
30558
|
+
if (!options || !options.textColor) {
|
|
30559
|
+
return;
|
|
30560
|
+
}
|
|
30561
|
+
var textColor = options.textColor;
|
|
30562
|
+
var _textColor_;
|
|
30563
|
+
// 将 RGB 从 0-255 转换到 0-1(alpha 通道已经是 0-1,不需要转换)
|
|
30564
|
+
options.textColor = [
|
|
30565
|
+
textColor[0] / 255.0,
|
|
30566
|
+
textColor[1] / 255.0,
|
|
30567
|
+
textColor[2] / 255.0,
|
|
30568
|
+
(_textColor_ = textColor[3]) != null ? _textColor_ : 1
|
|
30569
|
+
];
|
|
30570
|
+
}
|
|
30550
30571
|
/**
|
|
30551
30572
|
* 根据形状获取形状几何体数据
|
|
30552
30573
|
* @param shape - 形状
|
|
@@ -31469,7 +31490,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31469
31490
|
return ret;
|
|
31470
31491
|
}
|
|
31471
31492
|
|
|
31472
|
-
var version$2 = "2.8.0-alpha.
|
|
31493
|
+
var version$2 = "2.8.0-alpha.4";
|
|
31473
31494
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31474
31495
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31475
31496
|
var reverseParticle = false;
|
|
@@ -32109,8 +32130,8 @@ var seed$1 = 1;
|
|
|
32109
32130
|
};
|
|
32110
32131
|
return [
|
|
32111
32132
|
4,
|
|
32112
|
-
hookTimeInfo("plugin:
|
|
32113
|
-
return _this.
|
|
32133
|
+
hookTimeInfo("plugin:onAssetsLoadStart", function() {
|
|
32134
|
+
return _this.onPluginSceneLoadStart(scene);
|
|
32114
32135
|
})
|
|
32115
32136
|
];
|
|
32116
32137
|
case 6:
|
|
@@ -32398,7 +32419,7 @@ var seed$1 = 1;
|
|
|
32398
32419
|
});
|
|
32399
32420
|
})();
|
|
32400
32421
|
};
|
|
32401
|
-
_proto.
|
|
32422
|
+
_proto.onPluginSceneLoadStart = function onPluginSceneLoadStart(scene) {
|
|
32402
32423
|
var _this = this;
|
|
32403
32424
|
return _async_to_generator(function() {
|
|
32404
32425
|
return __generator(this, function(_state) {
|
|
@@ -32406,7 +32427,7 @@ var seed$1 = 1;
|
|
|
32406
32427
|
case 0:
|
|
32407
32428
|
return [
|
|
32408
32429
|
4,
|
|
32409
|
-
PluginSystem.
|
|
32430
|
+
PluginSystem.onAssetsLoadStart(scene, _this.options)
|
|
32410
32431
|
];
|
|
32411
32432
|
case 1:
|
|
32412
32433
|
_state.sent();
|
|
@@ -35107,8 +35128,8 @@ var SceneLoader = /*#__PURE__*/ function() {
|
|
|
35107
35128
|
case 1:
|
|
35108
35129
|
loadedScene = _state.sent();
|
|
35109
35130
|
engine.clearResources();
|
|
35110
|
-
// 触发插件系统 pluginSystem 的回调
|
|
35111
|
-
PluginSystem.
|
|
35131
|
+
// 触发插件系统 pluginSystem 的回调 onAssetsLoadFinish
|
|
35132
|
+
PluginSystem.onAssetsLoadFinish(loadedScene, assetManager.options, engine);
|
|
35112
35133
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
35113
35134
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
35114
35135
|
engine.assetService.initializeTexture(loadedScene);
|
|
@@ -35170,7 +35191,7 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35170
35191
|
registerPlugin("particle", ParticleLoader);
|
|
35171
35192
|
registerPlugin("cal", CalculateLoader);
|
|
35172
35193
|
registerPlugin("interact", InteractLoader);
|
|
35173
|
-
var version$1 = "2.8.0-alpha.
|
|
35194
|
+
var version$1 = "2.8.0-alpha.4";
|
|
35174
35195
|
logger.info("Core version: " + version$1 + ".");
|
|
35175
35196
|
|
|
35176
35197
|
var _obj;
|
|
@@ -36464,8 +36485,8 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
36464
36485
|
_$scene = _state.sent();
|
|
36465
36486
|
engine = _this.engine;
|
|
36466
36487
|
engine.clearResources();
|
|
36467
|
-
// 触发插件系统 pluginSystem 的回调
|
|
36468
|
-
PluginSystem.
|
|
36488
|
+
// 触发插件系统 pluginSystem 的回调 onAssetsLoadFinish
|
|
36489
|
+
PluginSystem.onAssetsLoadFinish(_$scene, assetManager.options, engine);
|
|
36469
36490
|
_this.assetService.prepareAssets(_$scene, assetManager.getAssets());
|
|
36470
36491
|
_this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
|
|
36471
36492
|
_this.assetService.initializeTexture(_$scene);
|
|
@@ -36760,8 +36781,8 @@ applyMixins(ThreeTextComponent, [
|
|
|
36760
36781
|
*/ Mesh.create = function(engine, props) {
|
|
36761
36782
|
return new ThreeMesh(engine, props);
|
|
36762
36783
|
};
|
|
36763
|
-
var version = "2.8.0-alpha.
|
|
36784
|
+
var version = "2.8.0-alpha.4";
|
|
36764
36785
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36765
36786
|
|
|
36766
|
-
export {
|
|
36787
|
+
export { 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, Plugin, 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 };
|
|
36767
36788
|
//# sourceMappingURL=index.mjs.map
|