@galacean/effects-core 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/README.md +279 -135
- package/dist/asset-manager.d.ts +1 -1
- package/dist/components/effect-component.d.ts +2 -1
- package/dist/components/mesh-component.d.ts +7 -1
- package/dist/index.js +829 -808
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +829 -808
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-system.d.ts +4 -4
- package/dist/plugins/cal/calculate-loader.d.ts +2 -2
- package/dist/plugins/camera/camera-vfx-item-loader.d.ts +2 -2
- package/dist/plugins/interact/interact-loader.d.ts +2 -2
- package/dist/plugins/particle/particle-loader.d.ts +2 -2
- package/dist/plugins/particle/particle-system.d.ts +2 -1
- package/dist/plugins/plugin.d.ts +24 -19
- package/dist/plugins/sprite/sprite-item.d.ts +0 -1
- package/dist/plugins/sprite/sprite-loader.d.ts +2 -2
- package/dist/plugins/text/text-item.d.ts +21 -1
- package/dist/plugins/text/text-loader.d.ts +2 -2
- package/dist/render/post-process-pass.d.ts +9 -24
- package/dist/render/renderer.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -2879,7 +2879,6 @@ var plugins = [];
|
|
|
2879
2879
|
pluginLoaderMap[name] = pluginClass;
|
|
2880
2880
|
var pluginInstance = new pluginClass();
|
|
2881
2881
|
pluginInstance.name = name;
|
|
2882
|
-
pluginInstance.initialize();
|
|
2883
2882
|
plugins.push(pluginInstance);
|
|
2884
2883
|
plugins.sort(function(a, b) {
|
|
2885
2884
|
return a.order - b.order;
|
|
@@ -2903,29 +2902,29 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
2903
2902
|
};
|
|
2904
2903
|
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2905
2904
|
plugins.forEach(function(loader) {
|
|
2906
|
-
return loader.
|
|
2905
|
+
return loader.onCompositionCreated(composition, scene);
|
|
2907
2906
|
});
|
|
2908
2907
|
};
|
|
2909
2908
|
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2910
2909
|
plugins.forEach(function(loader) {
|
|
2911
|
-
return loader.
|
|
2910
|
+
return loader.onCompositionDestroy(comp);
|
|
2912
2911
|
});
|
|
2913
2912
|
};
|
|
2914
|
-
PluginSystem.
|
|
2913
|
+
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2915
2914
|
return _async_to_generator(function() {
|
|
2916
2915
|
return __generator(this, function(_state) {
|
|
2917
2916
|
return [
|
|
2918
2917
|
2,
|
|
2919
2918
|
Promise.all(plugins.map(function(plugin) {
|
|
2920
|
-
return plugin.
|
|
2919
|
+
return plugin.onAssetsLoadStart(scene, options);
|
|
2921
2920
|
}))
|
|
2922
2921
|
];
|
|
2923
2922
|
});
|
|
2924
2923
|
})();
|
|
2925
2924
|
};
|
|
2926
|
-
PluginSystem.
|
|
2925
|
+
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
2927
2926
|
plugins.forEach(function(loader) {
|
|
2928
|
-
return loader.
|
|
2927
|
+
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
2929
2928
|
});
|
|
2930
2929
|
};
|
|
2931
2930
|
return PluginSystem;
|
|
@@ -2955,20 +2954,18 @@ function getPluginUsageInfo(name) {
|
|
|
2955
2954
|
/**
|
|
2956
2955
|
* 抽象插件类
|
|
2957
2956
|
* 注册合成不同生命周期的回调函数
|
|
2958
|
-
*/ var
|
|
2959
|
-
function
|
|
2957
|
+
*/ var Plugin = /*#__PURE__*/ function() {
|
|
2958
|
+
function Plugin() {
|
|
2960
2959
|
this.order = 100;
|
|
2961
|
-
this.name = "";
|
|
2960
|
+
this.name = "Plugin";
|
|
2962
2961
|
}
|
|
2963
|
-
var _proto =
|
|
2964
|
-
_proto.initialize = function initialize() {};
|
|
2962
|
+
var _proto = Plugin.prototype;
|
|
2965
2963
|
/**
|
|
2966
|
-
*
|
|
2967
|
-
*
|
|
2968
|
-
* @param scene
|
|
2969
|
-
* @param options
|
|
2970
|
-
|
|
2971
|
-
*/ _proto.processAssets = function processAssets(scene, options) {
|
|
2964
|
+
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
2965
|
+
* 此阶段适合发起异步资源请求。
|
|
2966
|
+
* @param scene - 场景对象
|
|
2967
|
+
* @param options - 场景加载选项
|
|
2968
|
+
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2972
2969
|
return _async_to_generator(function() {
|
|
2973
2970
|
return __generator(this, function(_state) {
|
|
2974
2971
|
return [
|
|
@@ -2978,17 +2975,22 @@ function getPluginUsageInfo(name) {
|
|
|
2978
2975
|
})();
|
|
2979
2976
|
};
|
|
2980
2977
|
/**
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2983
|
-
*
|
|
2984
|
-
*
|
|
2985
|
-
*
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2978
|
+
* 场景资源加载完成后触发。
|
|
2979
|
+
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
2980
|
+
* @param scene - 场景对象
|
|
2981
|
+
* @param options - 场景加载选项
|
|
2982
|
+
* @param engine - 引擎实例
|
|
2983
|
+
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
2984
|
+
/**
|
|
2985
|
+
* 合成创建完成后触发。
|
|
2986
|
+
* @param composition - 合成对象
|
|
2987
|
+
* @param scene - 场景对象
|
|
2988
|
+
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
2989
|
+
/**
|
|
2990
|
+
* 合成销毁时触发。
|
|
2991
|
+
* @param composition - 合成对象
|
|
2992
|
+
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
2993
|
+
return Plugin;
|
|
2992
2994
|
}();
|
|
2993
2995
|
|
|
2994
2996
|
function _set_prototype_of(o, p) {
|
|
@@ -7226,13 +7228,388 @@ __decorate([
|
|
|
7226
7228
|
serialize()
|
|
7227
7229
|
], RendererComponent.prototype, "_priority", void 0);
|
|
7228
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
|
+
|
|
7229
7606
|
/**
|
|
7230
7607
|
* Mesh 组件
|
|
7231
7608
|
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
7232
7609
|
_inherits(MeshComponent, RendererComponent);
|
|
7233
|
-
function MeshComponent() {
|
|
7610
|
+
function MeshComponent(engine) {
|
|
7234
7611
|
var _this;
|
|
7235
|
-
_this = RendererComponent.
|
|
7612
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
7236
7613
|
/**
|
|
7237
7614
|
* 用于点击测试的碰撞器
|
|
7238
7615
|
*/ _this.meshCollider = new MeshCollider();
|
|
@@ -7248,6 +7625,7 @@ __decorate([
|
|
|
7248
7625
|
};
|
|
7249
7626
|
}
|
|
7250
7627
|
};
|
|
7628
|
+
_this.maskManager = new MaskProcessor(engine);
|
|
7251
7629
|
return _this;
|
|
7252
7630
|
}
|
|
7253
7631
|
var _proto = MeshComponent.prototype;
|
|
@@ -7257,12 +7635,42 @@ __decorate([
|
|
|
7257
7635
|
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7258
7636
|
}
|
|
7259
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
|
+
};
|
|
7260
7650
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
7261
7651
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
7262
7652
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
7263
7653
|
var boundingBox = this.meshCollider.getBoundingBox();
|
|
7264
7654
|
return boundingBox;
|
|
7265
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
|
+
};
|
|
7266
7674
|
return MeshComponent;
|
|
7267
7675
|
}(RendererComponent);
|
|
7268
7676
|
__decorate([
|
|
@@ -8452,348 +8860,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
8452
8860
|
Matrix4.tempVec2 = new Vector3();
|
|
8453
8861
|
Matrix4.tempMat0 = new Matrix4();
|
|
8454
8862
|
|
|
8455
|
-
/**
|
|
8456
|
-
* Helper class to create a WebGL Context
|
|
8457
|
-
*
|
|
8458
|
-
* @param canvas
|
|
8459
|
-
* @param glType
|
|
8460
|
-
* @param options
|
|
8461
|
-
* @returns
|
|
8462
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
8463
|
-
if (glType === void 0) glType = "webgl";
|
|
8464
|
-
var context;
|
|
8465
|
-
if (glType === "webgl2") {
|
|
8466
|
-
context = canvas.getContext("webgl2", options);
|
|
8467
|
-
if (!context) {
|
|
8468
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
8469
|
-
}
|
|
8470
|
-
}
|
|
8471
|
-
if (!context || glType === "webgl") {
|
|
8472
|
-
context = canvas.getContext("webgl", options);
|
|
8473
|
-
}
|
|
8474
|
-
if (!context) {
|
|
8475
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
8476
|
-
}
|
|
8477
|
-
return context;
|
|
8478
|
-
}
|
|
8479
|
-
|
|
8480
|
-
function gpuTimer(gl) {
|
|
8481
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
8482
|
-
if (ext) {
|
|
8483
|
-
var query = gl.createQuery();
|
|
8484
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
8485
|
-
return __generator(this, function(_state) {
|
|
8486
|
-
return [
|
|
8487
|
-
2,
|
|
8488
|
-
new Promise(function(resolve, reject) {
|
|
8489
|
-
if (query) {
|
|
8490
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
8491
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
8492
|
-
if (available && !disjoint) {
|
|
8493
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
8494
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
8495
|
-
// taken to use all significant bits of the result, not just the
|
|
8496
|
-
// least significant 32 bits.
|
|
8497
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
8498
|
-
}
|
|
8499
|
-
if (available || disjoint) {
|
|
8500
|
-
// Clean up the query object.
|
|
8501
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
8502
|
-
query = null;
|
|
8503
|
-
}
|
|
8504
|
-
available !== null && query && window.setTimeout(function() {
|
|
8505
|
-
getTime().then(resolve).catch;
|
|
8506
|
-
}, 1);
|
|
8507
|
-
}
|
|
8508
|
-
})
|
|
8509
|
-
];
|
|
8510
|
-
});
|
|
8511
|
-
});
|
|
8512
|
-
if (!query) {
|
|
8513
|
-
return;
|
|
8514
|
-
}
|
|
8515
|
-
return {
|
|
8516
|
-
begin: function() {
|
|
8517
|
-
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
8518
|
-
},
|
|
8519
|
-
end: function() {
|
|
8520
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
8521
|
-
},
|
|
8522
|
-
getTime: getTime
|
|
8523
|
-
};
|
|
8524
|
-
}
|
|
8525
|
-
}
|
|
8526
|
-
|
|
8527
|
-
var initErrors = [];
|
|
8528
|
-
var glContext = {};
|
|
8529
|
-
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
8530
|
-
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
8531
|
-
if (!initErrors.length) {
|
|
8532
|
-
initGLContext();
|
|
8533
|
-
}
|
|
8534
|
-
function initGLContext() {
|
|
8535
|
-
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
8536
|
-
if (typeof WebGL2RenderingContext === "function") {
|
|
8537
|
-
copy(WebGL2RenderingContext);
|
|
8538
|
-
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
8539
|
-
copy(WebGLRenderingContext);
|
|
8540
|
-
copy(WebGLRenderingContext.prototype);
|
|
8541
|
-
} else {
|
|
8542
|
-
if (canUseBOM) {
|
|
8543
|
-
initErrors.push(// iOS 16 lockdown mode
|
|
8544
|
-
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8545
|
-
} else {
|
|
8546
|
-
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
|
-
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
8550
|
-
// @ts-expect-error set default value
|
|
8551
|
-
glContext["HALF_FLOAT"] = 5131;
|
|
8552
|
-
}
|
|
8553
|
-
}
|
|
8554
|
-
function isWebGL2(gl) {
|
|
8555
|
-
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
8556
|
-
}
|
|
8557
|
-
function copy(target) {
|
|
8558
|
-
for(var name in target){
|
|
8559
|
-
if (/^[A-Z_]/.test(name)) {
|
|
8560
|
-
// @ts-expect-error safe to assign
|
|
8561
|
-
glContext[name] = target[name];
|
|
8562
|
-
}
|
|
8563
|
-
}
|
|
8564
|
-
}
|
|
8565
|
-
function vertexFormatType2GLType(formatType) {
|
|
8566
|
-
switch(formatType){
|
|
8567
|
-
case VertexFormatType.Float32:
|
|
8568
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8569
|
-
case VertexFormatType.Int16:
|
|
8570
|
-
return WebGLRenderingContext["SHORT"];
|
|
8571
|
-
case VertexFormatType.Int8:
|
|
8572
|
-
return WebGLRenderingContext["BYTE"];
|
|
8573
|
-
case VertexFormatType.UInt16:
|
|
8574
|
-
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
8575
|
-
case VertexFormatType.UInt8:
|
|
8576
|
-
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
8577
|
-
default:
|
|
8578
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8579
|
-
}
|
|
8580
|
-
}
|
|
8581
|
-
function glType2VertexFormatType(webglType) {
|
|
8582
|
-
switch(webglType){
|
|
8583
|
-
case WebGLRenderingContext["FLOAT"]:
|
|
8584
|
-
return VertexFormatType.Float32;
|
|
8585
|
-
case WebGLRenderingContext["SHORT"]:
|
|
8586
|
-
return VertexFormatType.Int16;
|
|
8587
|
-
case WebGLRenderingContext["BYTE"]:
|
|
8588
|
-
return VertexFormatType.Int8;
|
|
8589
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
8590
|
-
return VertexFormatType.UInt16;
|
|
8591
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
8592
|
-
return VertexFormatType.UInt8;
|
|
8593
|
-
default:
|
|
8594
|
-
return VertexFormatType.Float32;
|
|
8595
|
-
}
|
|
8596
|
-
}
|
|
8597
|
-
|
|
8598
|
-
var ShaderType;
|
|
8599
|
-
(function(ShaderType) {
|
|
8600
|
-
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
8601
|
-
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
8602
|
-
})(ShaderType || (ShaderType = {}));
|
|
8603
|
-
var MaskMode;
|
|
8604
|
-
(function(MaskMode) {
|
|
8605
|
-
/**
|
|
8606
|
-
* 无
|
|
8607
|
-
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
8608
|
-
/**
|
|
8609
|
-
* 蒙版
|
|
8610
|
-
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
8611
|
-
/**
|
|
8612
|
-
* 被遮挡
|
|
8613
|
-
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
8614
|
-
/**
|
|
8615
|
-
* 被反向遮挡
|
|
8616
|
-
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
8617
|
-
})(MaskMode || (MaskMode = {}));
|
|
8618
|
-
|
|
8619
|
-
function valIfUndefined(val, def) {
|
|
8620
|
-
if (val === undefined || val === null) {
|
|
8621
|
-
return def;
|
|
8622
|
-
}
|
|
8623
|
-
return val;
|
|
8624
|
-
}
|
|
8625
|
-
function getPreMultiAlpha(blending) {
|
|
8626
|
-
switch(blending){
|
|
8627
|
-
case BlendingMode.ALPHA:
|
|
8628
|
-
return 1;
|
|
8629
|
-
case BlendingMode.ADD:
|
|
8630
|
-
return 1;
|
|
8631
|
-
case BlendingMode.SUBTRACTION:
|
|
8632
|
-
return 1;
|
|
8633
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8634
|
-
return 1;
|
|
8635
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8636
|
-
return 1;
|
|
8637
|
-
case BlendingMode.SUPERPOSITION:
|
|
8638
|
-
return 2;
|
|
8639
|
-
case BlendingMode.BRIGHTNESS:
|
|
8640
|
-
return 3;
|
|
8641
|
-
case BlendingMode.MULTIPLY:
|
|
8642
|
-
return 0;
|
|
8643
|
-
default:
|
|
8644
|
-
// 处理undefined
|
|
8645
|
-
return 1;
|
|
8646
|
-
}
|
|
8647
|
-
}
|
|
8648
|
-
function setBlendMode(material, blendMode) {
|
|
8649
|
-
switch(blendMode){
|
|
8650
|
-
case undefined:
|
|
8651
|
-
material.blendFunction = [
|
|
8652
|
-
glContext.ONE,
|
|
8653
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8654
|
-
glContext.ONE,
|
|
8655
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8656
|
-
];
|
|
8657
|
-
break;
|
|
8658
|
-
case BlendingMode.ALPHA:
|
|
8659
|
-
material.blendFunction = [
|
|
8660
|
-
glContext.ONE,
|
|
8661
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8662
|
-
glContext.ONE,
|
|
8663
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8664
|
-
];
|
|
8665
|
-
break;
|
|
8666
|
-
case BlendingMode.ADD:
|
|
8667
|
-
material.blendFunction = [
|
|
8668
|
-
glContext.ONE,
|
|
8669
|
-
glContext.ONE,
|
|
8670
|
-
glContext.ONE,
|
|
8671
|
-
glContext.ONE
|
|
8672
|
-
];
|
|
8673
|
-
break;
|
|
8674
|
-
case BlendingMode.SUBTRACTION:
|
|
8675
|
-
material.blendFunction = [
|
|
8676
|
-
glContext.ONE,
|
|
8677
|
-
glContext.ONE,
|
|
8678
|
-
glContext.ZERO,
|
|
8679
|
-
glContext.ONE
|
|
8680
|
-
];
|
|
8681
|
-
material.blendEquation = [
|
|
8682
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
8683
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
8684
|
-
];
|
|
8685
|
-
break;
|
|
8686
|
-
case BlendingMode.SUPERPOSITION:
|
|
8687
|
-
material.blendFunction = [
|
|
8688
|
-
glContext.ONE,
|
|
8689
|
-
glContext.ONE,
|
|
8690
|
-
glContext.ONE,
|
|
8691
|
-
glContext.ONE
|
|
8692
|
-
];
|
|
8693
|
-
break;
|
|
8694
|
-
case BlendingMode.MULTIPLY:
|
|
8695
|
-
material.blendFunction = [
|
|
8696
|
-
glContext.DST_COLOR,
|
|
8697
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8698
|
-
glContext.DST_COLOR,
|
|
8699
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8700
|
-
];
|
|
8701
|
-
break;
|
|
8702
|
-
case BlendingMode.BRIGHTNESS:
|
|
8703
|
-
material.blendFunction = [
|
|
8704
|
-
glContext.ONE,
|
|
8705
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8706
|
-
glContext.ONE,
|
|
8707
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8708
|
-
];
|
|
8709
|
-
break;
|
|
8710
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8711
|
-
material.blendFunction = [
|
|
8712
|
-
glContext.DST_COLOR,
|
|
8713
|
-
glContext.DST_ALPHA,
|
|
8714
|
-
glContext.ZERO,
|
|
8715
|
-
glContext.ONE
|
|
8716
|
-
];
|
|
8717
|
-
break;
|
|
8718
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8719
|
-
material.blendFunction = [
|
|
8720
|
-
glContext.DST_COLOR,
|
|
8721
|
-
glContext.ZERO,
|
|
8722
|
-
glContext.ZERO,
|
|
8723
|
-
glContext.ONE
|
|
8724
|
-
];
|
|
8725
|
-
break;
|
|
8726
|
-
default:
|
|
8727
|
-
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
8728
|
-
}
|
|
8729
|
-
}
|
|
8730
|
-
function setSideMode(material, side) {
|
|
8731
|
-
if (side === SideMode.DOUBLE) {
|
|
8732
|
-
material.culling = false;
|
|
8733
|
-
} else {
|
|
8734
|
-
material.culling = true;
|
|
8735
|
-
material.frontFace = glContext.CW;
|
|
8736
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
8737
|
-
}
|
|
8738
|
-
}
|
|
8739
|
-
function setMaskMode(material, maskMode) {
|
|
8740
|
-
switch(maskMode){
|
|
8741
|
-
case undefined:
|
|
8742
|
-
material.stencilTest = false;
|
|
8743
|
-
break;
|
|
8744
|
-
case MaskMode.MASK:
|
|
8745
|
-
material.stencilTest = true;
|
|
8746
|
-
material.stencilFunc = [
|
|
8747
|
-
glContext.ALWAYS,
|
|
8748
|
-
glContext.ALWAYS
|
|
8749
|
-
];
|
|
8750
|
-
material.stencilOpZPass = [
|
|
8751
|
-
glContext.REPLACE,
|
|
8752
|
-
glContext.REPLACE
|
|
8753
|
-
];
|
|
8754
|
-
break;
|
|
8755
|
-
case MaskMode.OBSCURED:
|
|
8756
|
-
material.stencilTest = true;
|
|
8757
|
-
material.stencilFunc = [
|
|
8758
|
-
glContext.EQUAL,
|
|
8759
|
-
glContext.EQUAL
|
|
8760
|
-
];
|
|
8761
|
-
break;
|
|
8762
|
-
case MaskMode.REVERSE_OBSCURED:
|
|
8763
|
-
material.stencilTest = true;
|
|
8764
|
-
material.stencilFunc = [
|
|
8765
|
-
glContext.NOTEQUAL,
|
|
8766
|
-
glContext.NOTEQUAL
|
|
8767
|
-
];
|
|
8768
|
-
break;
|
|
8769
|
-
case MaskMode.NONE:
|
|
8770
|
-
material.stencilTest = false;
|
|
8771
|
-
break;
|
|
8772
|
-
default:
|
|
8773
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
8774
|
-
}
|
|
8775
|
-
}
|
|
8776
|
-
|
|
8777
|
-
var TextureLoadAction;
|
|
8778
|
-
(function(TextureLoadAction) {
|
|
8779
|
-
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
8780
|
-
//preserve previous attachment
|
|
8781
|
-
//load = 1,
|
|
8782
|
-
//clear attachment
|
|
8783
|
-
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
8784
|
-
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
8785
|
-
var TextureSourceType;
|
|
8786
|
-
(function(TextureSourceType) {
|
|
8787
|
-
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
8788
|
-
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
8789
|
-
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
8790
|
-
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
8791
|
-
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
8792
|
-
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
8793
|
-
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
8794
|
-
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
8795
|
-
})(TextureSourceType || (TextureSourceType = {}));
|
|
8796
|
-
|
|
8797
8863
|
/**
|
|
8798
8864
|
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
8799
8865
|
*/ var Downloader = /*#__PURE__*/ function() {
|
|
@@ -10272,39 +10338,6 @@ var MaterialRenderType;
|
|
|
10272
10338
|
return Material;
|
|
10273
10339
|
}(EffectsObject);
|
|
10274
10340
|
|
|
10275
|
-
var MaskProcessor = /*#__PURE__*/ function() {
|
|
10276
|
-
function MaskProcessor(engine) {
|
|
10277
|
-
this.engine = engine;
|
|
10278
|
-
this.alphaMaskEnabled = false;
|
|
10279
|
-
this.maskMode = MaskMode.NONE;
|
|
10280
|
-
this.maskable = null;
|
|
10281
|
-
this.stencilClearAction = {
|
|
10282
|
-
stencilAction: TextureLoadAction.clear
|
|
10283
|
-
};
|
|
10284
|
-
}
|
|
10285
|
-
var _proto = MaskProcessor.prototype;
|
|
10286
|
-
_proto.getRefValue = function getRefValue() {
|
|
10287
|
-
return 1;
|
|
10288
|
-
};
|
|
10289
|
-
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
10290
|
-
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask, _data_inverted = data.inverted, inverted = _data_inverted === void 0 ? false : _data_inverted, reference = data.reference, _data_alphaMaskEnabled = data.alphaMaskEnabled, alphaMaskEnabled = _data_alphaMaskEnabled === void 0 ? false : _data_alphaMaskEnabled;
|
|
10291
|
-
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
10292
|
-
if (isMask) {
|
|
10293
|
-
this.maskMode = MaskMode.MASK;
|
|
10294
|
-
} else {
|
|
10295
|
-
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
10296
|
-
this.maskable = this.engine.findObject(reference);
|
|
10297
|
-
}
|
|
10298
|
-
};
|
|
10299
|
-
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
10300
|
-
if (this.maskable) {
|
|
10301
|
-
renderer.clear(this.stencilClearAction);
|
|
10302
|
-
this.maskable.drawStencilMask(renderer);
|
|
10303
|
-
}
|
|
10304
|
-
};
|
|
10305
|
-
return MaskProcessor;
|
|
10306
|
-
}();
|
|
10307
|
-
|
|
10308
10341
|
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10309
10342
|
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10310
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}";
|
|
@@ -10617,6 +10650,9 @@ var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10617
10650
|
stencilAction: TextureLoadAction.clear
|
|
10618
10651
|
});
|
|
10619
10652
|
}
|
|
10653
|
+
this.meshes.sort(function(a, b) {
|
|
10654
|
+
return a.priority - b.priority;
|
|
10655
|
+
});
|
|
10620
10656
|
renderer.renderMeshes(this.meshes);
|
|
10621
10657
|
};
|
|
10622
10658
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
@@ -12718,244 +12754,131 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
12718
12754
|
return ShaderFactory;
|
|
12719
12755
|
}();
|
|
12720
12756
|
|
|
12721
|
-
// Bloom
|
|
12722
|
-
var
|
|
12723
|
-
_inherits(
|
|
12724
|
-
function
|
|
12757
|
+
// Bloom Pass - 包含阈值提取、高斯模糊(Down Sample 和 Up Sample)
|
|
12758
|
+
var BloomPass = /*#__PURE__*/ function(RenderPass) {
|
|
12759
|
+
_inherits(BloomPass, RenderPass);
|
|
12760
|
+
function BloomPass(renderer, iterationCount) {
|
|
12761
|
+
if (iterationCount === void 0) iterationCount = 4;
|
|
12725
12762
|
var _this;
|
|
12726
12763
|
_this = RenderPass.call(this, renderer) || this;
|
|
12764
|
+
_this.tempRTs = [];
|
|
12765
|
+
_this.iterationCount = iterationCount;
|
|
12727
12766
|
var engine = _this.renderer.engine;
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
attributes: {
|
|
12731
|
-
aPos: {
|
|
12732
|
-
type: glContext.FLOAT,
|
|
12733
|
-
size: 2,
|
|
12734
|
-
data: new Float32Array([
|
|
12735
|
-
-1,
|
|
12736
|
-
1,
|
|
12737
|
-
-1,
|
|
12738
|
-
-1,
|
|
12739
|
-
1,
|
|
12740
|
-
1,
|
|
12741
|
-
1,
|
|
12742
|
-
-1
|
|
12743
|
-
])
|
|
12744
|
-
}
|
|
12745
|
-
},
|
|
12746
|
-
drawCount: 4
|
|
12747
|
-
});
|
|
12748
|
-
var material = Material.create(engine, {
|
|
12767
|
+
// Threshold material
|
|
12768
|
+
_this.thresholdMaterial = Material.create(engine, {
|
|
12749
12769
|
shader: {
|
|
12750
12770
|
vertex: screenMeshVert,
|
|
12751
12771
|
fragment: thresholdFrag,
|
|
12752
12772
|
glslVersion: GLSLVersion.GLSL1
|
|
12753
12773
|
}
|
|
12754
12774
|
});
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12775
|
+
_this.thresholdMaterial.blending = false;
|
|
12776
|
+
_this.thresholdMaterial.depthTest = false;
|
|
12777
|
+
_this.thresholdMaterial.culling = false;
|
|
12778
|
+
// Down sample H material
|
|
12779
|
+
_this.downSampleHMaterial = Material.create(engine, {
|
|
12780
|
+
shader: {
|
|
12781
|
+
vertex: screenMeshVert,
|
|
12782
|
+
fragment: gaussianDownHFrag,
|
|
12783
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12784
|
+
}
|
|
12762
12785
|
});
|
|
12786
|
+
_this.downSampleHMaterial.blending = false;
|
|
12787
|
+
_this.downSampleHMaterial.depthTest = false;
|
|
12788
|
+
_this.downSampleHMaterial.culling = false;
|
|
12789
|
+
// Down sample V material
|
|
12790
|
+
_this.downSampleVMaterial = Material.create(engine, {
|
|
12791
|
+
shader: {
|
|
12792
|
+
vertex: screenMeshVert,
|
|
12793
|
+
fragment: gaussianDownVFrag,
|
|
12794
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12795
|
+
}
|
|
12796
|
+
});
|
|
12797
|
+
_this.downSampleVMaterial.blending = false;
|
|
12798
|
+
_this.downSampleVMaterial.depthTest = false;
|
|
12799
|
+
_this.downSampleVMaterial.culling = false;
|
|
12800
|
+
// Up sample material
|
|
12801
|
+
_this.upSampleMaterial = Material.create(engine, {
|
|
12802
|
+
shader: {
|
|
12803
|
+
vertex: screenMeshVert,
|
|
12804
|
+
fragment: gaussianUpFrag,
|
|
12805
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12806
|
+
}
|
|
12807
|
+
});
|
|
12808
|
+
_this.upSampleMaterial.blending = false;
|
|
12809
|
+
_this.upSampleMaterial.depthTest = false;
|
|
12810
|
+
_this.upSampleMaterial.culling = false;
|
|
12763
12811
|
_this.priority = 5000;
|
|
12764
|
-
_this.name = "
|
|
12812
|
+
_this.name = "BloomPass";
|
|
12765
12813
|
return _this;
|
|
12766
12814
|
}
|
|
12767
|
-
var _proto =
|
|
12815
|
+
var _proto = BloomPass.prototype;
|
|
12768
12816
|
_proto.configure = function configure(renderer) {
|
|
12769
|
-
|
|
12817
|
+
// 获取场景纹理用于 ToneMappingPass
|
|
12770
12818
|
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12771
12819
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
12772
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12773
12820
|
};
|
|
12774
12821
|
_proto.execute = function execute(renderer) {
|
|
12775
12822
|
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
12776
|
-
renderer.
|
|
12777
|
-
|
|
12778
|
-
depthAction: TextureLoadAction.clear,
|
|
12779
|
-
stencilAction: TextureLoadAction.clear
|
|
12780
|
-
});
|
|
12781
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12823
|
+
var baseWidth = renderer.getWidth();
|
|
12824
|
+
var baseHeight = renderer.getHeight();
|
|
12782
12825
|
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
12826
|
+
// 1. Threshold pass - 提取高亮区域
|
|
12783
12827
|
var threshold = (_renderer_renderingData_currentFrame_globalVolume_bloom_threshold = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) == null ? void 0 : (_renderer_renderingData_currentFrame_globalVolume_bloom = _renderer_renderingData_currentFrame_globalVolume.bloom) == null ? void 0 : _renderer_renderingData_currentFrame_globalVolume_bloom.threshold) != null ? _renderer_renderingData_currentFrame_globalVolume_bloom_threshold : 1.0;
|
|
12784
|
-
this.
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
]
|
|
12828
|
+
this.thresholdRT = renderer.getTemporaryRT("_BloomThreshold", baseWidth, baseHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12829
|
+
this.thresholdMaterial.setFloat("_Threshold", threshold);
|
|
12830
|
+
renderer.blit(this.mainTexture, this.thresholdRT, this.thresholdMaterial);
|
|
12831
|
+
var currentTexture = this.thresholdRT.getColorTextures()[0];
|
|
12832
|
+
// 2. Down sample passes
|
|
12833
|
+
for(var i = 0; i < this.iterationCount; i++){
|
|
12834
|
+
var downWidth = Math.floor(baseWidth / Math.pow(2, i + 1));
|
|
12835
|
+
var downHeight = Math.floor(baseHeight / Math.pow(2, i + 1));
|
|
12836
|
+
// Horizontal pass
|
|
12837
|
+
var tempH = renderer.getTemporaryRT("_BloomDownH" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12838
|
+
this.downSampleHMaterial.setVector2("_TextureSize", getTextureSize(currentTexture));
|
|
12839
|
+
renderer.blit(currentTexture, tempH, this.downSampleHMaterial);
|
|
12840
|
+
// Vertical pass
|
|
12841
|
+
var tempV = renderer.getTemporaryRT("_BloomDownV" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12842
|
+
this.downSampleVMaterial.setVector2("_TextureSize", getTextureSize(tempH.getColorTextures()[0]));
|
|
12843
|
+
renderer.blit(tempH.getColorTextures()[0], tempV, this.downSampleVMaterial);
|
|
12844
|
+
// 释放 H pass RT,保留 V pass RT 用于 up sample
|
|
12845
|
+
renderer.releaseTemporaryRT(tempH);
|
|
12846
|
+
this.tempRTs.push(tempV);
|
|
12847
|
+
currentTexture = tempV.getColorTextures()[0];
|
|
12848
|
+
}
|
|
12849
|
+
// 释放 threshold RT
|
|
12850
|
+
renderer.releaseTemporaryRT(this.thresholdRT);
|
|
12851
|
+
// 3. Up sample passes
|
|
12852
|
+
for(var i1 = this.iterationCount - 1; i1 > 0; i1--){
|
|
12853
|
+
var upWidth = Math.floor(baseWidth / Math.pow(2, i1 - 1));
|
|
12854
|
+
var upHeight = Math.floor(baseHeight / Math.pow(2, i1 - 1));
|
|
12855
|
+
var tempUp = renderer.getTemporaryRT("_BloomUp" + i1, upWidth, upHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12856
|
+
// 获取下一层的 down sample 结果
|
|
12857
|
+
var downSampleTexture = this.tempRTs[i1 - 1].getColorTextures()[0];
|
|
12858
|
+
this.upSampleMaterial.setTexture("_GaussianDownTex", downSampleTexture);
|
|
12859
|
+
this.upSampleMaterial.setVector2("_GaussianDownTextureSize", getTextureSize(downSampleTexture));
|
|
12860
|
+
renderer.blit(currentTexture, tempUp, this.upSampleMaterial);
|
|
12861
|
+
currentTexture = tempUp.getColorTextures()[0];
|
|
12862
|
+
this.tempRTs.push(tempUp);
|
|
12863
|
+
}
|
|
12864
|
+
// 设置最终输出到当前 framebuffer
|
|
12865
|
+
renderer.setFramebuffer(this.tempRTs[this.tempRTs.length - 1]);
|
|
12788
12866
|
};
|
|
12789
12867
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12790
|
-
|
|
12791
|
-
|
|
12868
|
+
// 释放所有临时 RT
|
|
12869
|
+
for(var i = 0; i < this.tempRTs.length; i++){
|
|
12870
|
+
renderer.releaseTemporaryRT(this.tempRTs[i]);
|
|
12792
12871
|
}
|
|
12872
|
+
this.tempRTs = [];
|
|
12793
12873
|
};
|
|
12794
12874
|
_proto.dispose = function dispose(options) {
|
|
12875
|
+
this.thresholdMaterial.dispose();
|
|
12876
|
+
this.downSampleHMaterial.dispose();
|
|
12877
|
+
this.downSampleVMaterial.dispose();
|
|
12878
|
+
this.upSampleMaterial.dispose();
|
|
12795
12879
|
RenderPass.prototype.dispose.call(this, options);
|
|
12796
12880
|
};
|
|
12797
|
-
return
|
|
12798
|
-
}(RenderPass);
|
|
12799
|
-
var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12800
|
-
_inherits(HQGaussianDownSamplePass, RenderPass);
|
|
12801
|
-
function HQGaussianDownSamplePass(renderer, type, level) {
|
|
12802
|
-
var _this;
|
|
12803
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12804
|
-
_this.type = type;
|
|
12805
|
-
_this.level = level;
|
|
12806
|
-
var engine = _this.renderer.engine;
|
|
12807
|
-
var name = "PostProcess";
|
|
12808
|
-
var geometry = Geometry.create(engine, {
|
|
12809
|
-
name: name,
|
|
12810
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12811
|
-
attributes: {
|
|
12812
|
-
aPos: {
|
|
12813
|
-
type: glContext.FLOAT,
|
|
12814
|
-
size: 2,
|
|
12815
|
-
data: new Float32Array([
|
|
12816
|
-
-1,
|
|
12817
|
-
1,
|
|
12818
|
-
-1,
|
|
12819
|
-
-1,
|
|
12820
|
-
1,
|
|
12821
|
-
1,
|
|
12822
|
-
1,
|
|
12823
|
-
-1
|
|
12824
|
-
])
|
|
12825
|
-
}
|
|
12826
|
-
},
|
|
12827
|
-
drawCount: 4
|
|
12828
|
-
});
|
|
12829
|
-
var fragment = type === "H" ? gaussianDownHFrag : gaussianDownVFrag;
|
|
12830
|
-
var shader = {
|
|
12831
|
-
vertex: screenMeshVert,
|
|
12832
|
-
fragment: fragment,
|
|
12833
|
-
glslVersion: GLSLVersion.GLSL1
|
|
12834
|
-
};
|
|
12835
|
-
var material = Material.create(engine, {
|
|
12836
|
-
name: name,
|
|
12837
|
-
shader: shader
|
|
12838
|
-
});
|
|
12839
|
-
material.blending = false;
|
|
12840
|
-
material.depthTest = false;
|
|
12841
|
-
material.culling = false;
|
|
12842
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12843
|
-
name: name,
|
|
12844
|
-
geometry: geometry,
|
|
12845
|
-
material: material,
|
|
12846
|
-
priority: 0
|
|
12847
|
-
});
|
|
12848
|
-
_this.priority = 5000;
|
|
12849
|
-
_this.name = "GaussianDownPass" + type + level;
|
|
12850
|
-
return _this;
|
|
12851
|
-
}
|
|
12852
|
-
var _proto = HQGaussianDownSamplePass.prototype;
|
|
12853
|
-
_proto.configure = function configure(renderer) {
|
|
12854
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
|
|
12855
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
|
|
12856
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12857
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12858
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12859
|
-
};
|
|
12860
|
-
_proto.execute = function execute(renderer) {
|
|
12861
|
-
renderer.clear({
|
|
12862
|
-
colorAction: TextureLoadAction.clear,
|
|
12863
|
-
depthAction: TextureLoadAction.clear,
|
|
12864
|
-
stencilAction: TextureLoadAction.clear
|
|
12865
|
-
});
|
|
12866
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12867
|
-
this.screenMesh.material.setVector2("_TextureSize", getTextureSize(this.mainTexture));
|
|
12868
|
-
renderer.renderMeshes([
|
|
12869
|
-
this.screenMesh
|
|
12870
|
-
]);
|
|
12871
|
-
if (this.type === "V") {
|
|
12872
|
-
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12873
|
-
}
|
|
12874
|
-
};
|
|
12875
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12876
|
-
if (this.framebuffer) {
|
|
12877
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12878
|
-
}
|
|
12879
|
-
};
|
|
12880
|
-
return HQGaussianDownSamplePass;
|
|
12881
|
-
}(RenderPass);
|
|
12882
|
-
var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
12883
|
-
_inherits(HQGaussianUpSamplePass, RenderPass);
|
|
12884
|
-
function HQGaussianUpSamplePass(renderer, level) {
|
|
12885
|
-
var _this;
|
|
12886
|
-
_this = RenderPass.call(this, renderer) || this;
|
|
12887
|
-
_this.level = level;
|
|
12888
|
-
var name = "PostProcess";
|
|
12889
|
-
var engine = _this.renderer.engine;
|
|
12890
|
-
var geometry = Geometry.create(engine, {
|
|
12891
|
-
name: name,
|
|
12892
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
12893
|
-
attributes: {
|
|
12894
|
-
aPos: {
|
|
12895
|
-
type: glContext.FLOAT,
|
|
12896
|
-
size: 2,
|
|
12897
|
-
data: new Float32Array([
|
|
12898
|
-
-1,
|
|
12899
|
-
1,
|
|
12900
|
-
-1,
|
|
12901
|
-
-1,
|
|
12902
|
-
1,
|
|
12903
|
-
1,
|
|
12904
|
-
1,
|
|
12905
|
-
-1
|
|
12906
|
-
])
|
|
12907
|
-
}
|
|
12908
|
-
},
|
|
12909
|
-
drawCount: 4
|
|
12910
|
-
});
|
|
12911
|
-
var shader = {
|
|
12912
|
-
vertex: screenMeshVert,
|
|
12913
|
-
fragment: gaussianUpFrag
|
|
12914
|
-
};
|
|
12915
|
-
var material = Material.create(engine, {
|
|
12916
|
-
name: name,
|
|
12917
|
-
shader: shader
|
|
12918
|
-
});
|
|
12919
|
-
material.blending = false;
|
|
12920
|
-
material.depthTest = false;
|
|
12921
|
-
material.culling = false;
|
|
12922
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
12923
|
-
name: name,
|
|
12924
|
-
geometry: geometry,
|
|
12925
|
-
material: material,
|
|
12926
|
-
priority: 0
|
|
12927
|
-
});
|
|
12928
|
-
_this.priority = 5000;
|
|
12929
|
-
_this.name = "GaussianUpPass" + level;
|
|
12930
|
-
return _this;
|
|
12931
|
-
}
|
|
12932
|
-
var _proto = HQGaussianUpSamplePass.prototype;
|
|
12933
|
-
_proto.configure = function configure(renderer) {
|
|
12934
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
|
|
12935
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
|
|
12936
|
-
this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12937
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
12938
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
12939
|
-
};
|
|
12940
|
-
_proto.execute = function execute(renderer) {
|
|
12941
|
-
renderer.clear({
|
|
12942
|
-
colorAction: TextureLoadAction.clear,
|
|
12943
|
-
depthAction: TextureLoadAction.clear,
|
|
12944
|
-
stencilAction: TextureLoadAction.clear
|
|
12945
|
-
});
|
|
12946
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12947
|
-
this.screenMesh.material.setTexture("_GaussianDownTex", this.gaussianDownSampleResult.texture);
|
|
12948
|
-
this.screenMesh.material.setVector2("_GaussianDownTextureSize", getTextureSize(this.gaussianDownSampleResult.texture));
|
|
12949
|
-
renderer.renderMeshes([
|
|
12950
|
-
this.screenMesh
|
|
12951
|
-
]);
|
|
12952
|
-
};
|
|
12953
|
-
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12954
|
-
if (this.framebuffer) {
|
|
12955
|
-
renderer.releaseTemporaryRT(this.framebuffer);
|
|
12956
|
-
}
|
|
12957
|
-
};
|
|
12958
|
-
return HQGaussianUpSamplePass;
|
|
12881
|
+
return BloomPass;
|
|
12959
12882
|
}(RenderPass);
|
|
12960
12883
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
12961
12884
|
var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
@@ -13099,36 +13022,11 @@ var seed$5 = 1;
|
|
|
13099
13022
|
if (postProcessingEnabled) {
|
|
13100
13023
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
13101
13024
|
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
];
|
|
13108
|
-
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
13109
|
-
var bloomThresholdPass = new BloomThresholdPass(renderer);
|
|
13110
|
-
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
13111
|
-
this.addRenderPass(bloomThresholdPass);
|
|
13112
|
-
for(var i = 0; i < gaussianStep; i++){
|
|
13113
|
-
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
13114
|
-
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i);
|
|
13115
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i);
|
|
13116
|
-
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
13117
|
-
this.addRenderPass(gaussianDownHPass);
|
|
13118
|
-
this.addRenderPass(gaussianDownVPass);
|
|
13119
|
-
viewport[2] /= 2;
|
|
13120
|
-
viewport[3] /= 2;
|
|
13121
|
-
// TODO 限制最大迭代
|
|
13122
|
-
}
|
|
13123
|
-
viewport[2] *= 4;
|
|
13124
|
-
viewport[3] *= 4;
|
|
13125
|
-
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
13126
|
-
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1);
|
|
13127
|
-
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
13128
|
-
this.addRenderPass(gaussianUpPass);
|
|
13129
|
-
viewport[2] *= 2;
|
|
13130
|
-
viewport[3] *= 2;
|
|
13131
|
-
}
|
|
13025
|
+
// Bloom Pass(包含阈值提取、高斯模糊)
|
|
13026
|
+
var bloomPass = new BloomPass(renderer, gaussianStep);
|
|
13027
|
+
bloomPass.sceneTextureHandle = sceneTextureHandle;
|
|
13028
|
+
this.addRenderPass(bloomPass);
|
|
13029
|
+
// Tone Mapping Pass
|
|
13132
13030
|
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
13133
13031
|
this.addRenderPass(postProcessPass);
|
|
13134
13032
|
}
|
|
@@ -13622,6 +13520,14 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
13622
13520
|
_proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
|
|
13623
13521
|
this.renderTargetPool.release(rt);
|
|
13624
13522
|
};
|
|
13523
|
+
/**
|
|
13524
|
+
* 将源纹理复制到目标 Framebuffer,可使用自定义材质进行处理
|
|
13525
|
+
* @param source - 源纹理
|
|
13526
|
+
* @param destination - 目标 Framebuffer,如果为 null 则渲染到屏幕
|
|
13527
|
+
* @param material - 可选的自定义材质,不传则使用默认复制材质
|
|
13528
|
+
*/ _proto.blit = function blit(source, destination, material) {
|
|
13529
|
+
// OVERRIDE
|
|
13530
|
+
};
|
|
13625
13531
|
_proto.dispose = function dispose() {
|
|
13626
13532
|
// OVERRIDE
|
|
13627
13533
|
};
|
|
@@ -16684,13 +16590,49 @@ CameraController = __decorate([
|
|
|
16684
16590
|
effectsClass(DataType.CameraController)
|
|
16685
16591
|
], CameraController);
|
|
16686
16592
|
|
|
16687
|
-
|
|
16688
|
-
|
|
16593
|
+
function _get_prototype_of(o) {
|
|
16594
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
16595
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
16596
|
+
};
|
|
16597
|
+
return _get_prototype_of(o);
|
|
16598
|
+
}
|
|
16599
|
+
|
|
16600
|
+
function _is_native_function(fn) {
|
|
16601
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
16602
|
+
}
|
|
16603
|
+
|
|
16604
|
+
function _wrap_native_super(Class) {
|
|
16605
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
16606
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
16607
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
16608
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
16609
|
+
if (typeof _cache !== "undefined") {
|
|
16610
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
16611
|
+
_cache.set(Class, Wrapper);
|
|
16612
|
+
}
|
|
16613
|
+
function Wrapper() {
|
|
16614
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
16615
|
+
}
|
|
16616
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
16617
|
+
constructor: {
|
|
16618
|
+
value: Wrapper,
|
|
16619
|
+
enumerable: false,
|
|
16620
|
+
writable: true,
|
|
16621
|
+
configurable: true
|
|
16622
|
+
}
|
|
16623
|
+
});
|
|
16624
|
+
return _set_prototype_of(Wrapper, Class);
|
|
16625
|
+
};
|
|
16626
|
+
return _wrap_native_super(Class);
|
|
16627
|
+
}
|
|
16628
|
+
|
|
16629
|
+
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
16630
|
+
_inherits(CameraVFXItemLoader, Plugin);
|
|
16689
16631
|
function CameraVFXItemLoader() {
|
|
16690
|
-
return
|
|
16632
|
+
return Plugin.apply(this, arguments);
|
|
16691
16633
|
}
|
|
16692
16634
|
return CameraVFXItemLoader;
|
|
16693
|
-
}(
|
|
16635
|
+
}(_wrap_native_super(Plugin));
|
|
16694
16636
|
|
|
16695
16637
|
var HitTestType;
|
|
16696
16638
|
(function(HitTestType) {
|
|
@@ -16974,13 +16916,13 @@ function getCoord(event) {
|
|
|
16974
16916
|
};
|
|
16975
16917
|
}
|
|
16976
16918
|
|
|
16977
|
-
var InteractLoader = /*#__PURE__*/ function(
|
|
16978
|
-
_inherits(InteractLoader,
|
|
16919
|
+
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
16920
|
+
_inherits(InteractLoader, Plugin);
|
|
16979
16921
|
function InteractLoader() {
|
|
16980
|
-
return
|
|
16922
|
+
return Plugin.apply(this, arguments);
|
|
16981
16923
|
}
|
|
16982
16924
|
return InteractLoader;
|
|
16983
|
-
}(
|
|
16925
|
+
}(_wrap_native_super(Plugin));
|
|
16984
16926
|
|
|
16985
16927
|
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";
|
|
16986
16928
|
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";
|
|
@@ -17579,16 +17521,16 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
17579
17521
|
return MeshCollider;
|
|
17580
17522
|
}();
|
|
17581
17523
|
|
|
17582
|
-
var SpriteLoader = /*#__PURE__*/ function(
|
|
17583
|
-
_inherits(SpriteLoader,
|
|
17524
|
+
var SpriteLoader = /*#__PURE__*/ function(Plugin) {
|
|
17525
|
+
_inherits(SpriteLoader, Plugin);
|
|
17584
17526
|
function SpriteLoader() {
|
|
17585
17527
|
var _this;
|
|
17586
|
-
_this =
|
|
17528
|
+
_this = Plugin.apply(this, arguments) || this;
|
|
17587
17529
|
_this.name = "sprite";
|
|
17588
17530
|
return _this;
|
|
17589
17531
|
}
|
|
17590
17532
|
return SpriteLoader;
|
|
17591
|
-
}(
|
|
17533
|
+
}(_wrap_native_super(Plugin));
|
|
17592
17534
|
|
|
17593
17535
|
/**
|
|
17594
17536
|
* 动画图可播放节点对象
|
|
@@ -20079,7 +20021,7 @@ function calculateDirection(prePoint, point, nextPoint) {
|
|
|
20079
20021
|
if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
|
|
20080
20022
|
particleSystem.reset();
|
|
20081
20023
|
}
|
|
20082
|
-
particleSystem.
|
|
20024
|
+
particleSystem.simulate(this.time - particleSystem.time);
|
|
20083
20025
|
}
|
|
20084
20026
|
this.lastTime = this.time;
|
|
20085
20027
|
};
|
|
@@ -21530,126 +21472,133 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21530
21472
|
this.initEmitterTransform();
|
|
21531
21473
|
};
|
|
21532
21474
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21533
|
-
this.
|
|
21475
|
+
if (!this.frozen) {
|
|
21476
|
+
this.update(dt);
|
|
21477
|
+
}
|
|
21478
|
+
};
|
|
21479
|
+
_proto.simulate = function simulate(time) {
|
|
21480
|
+
this.update(time * 1000);
|
|
21481
|
+
this.frozen = true;
|
|
21534
21482
|
};
|
|
21535
21483
|
_proto.update = function update(delta) {
|
|
21536
21484
|
var _this = this;
|
|
21537
|
-
if (this.started
|
|
21538
|
-
|
|
21539
|
-
|
|
21540
|
-
|
|
21541
|
-
|
|
21542
|
-
|
|
21543
|
-
|
|
21544
|
-
|
|
21545
|
-
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
|
|
21558
|
-
|
|
21559
|
-
|
|
21485
|
+
if (!this.started) {
|
|
21486
|
+
return;
|
|
21487
|
+
}
|
|
21488
|
+
var now = this.time + delta / 1000;
|
|
21489
|
+
var options = this.options;
|
|
21490
|
+
var loopStartTime = this.loopStartTime;
|
|
21491
|
+
var emission = this.emission;
|
|
21492
|
+
this.time = now;
|
|
21493
|
+
this.upDirectionWorld = null;
|
|
21494
|
+
this.renderer.updateTime(now, delta);
|
|
21495
|
+
var link = this.particleLink;
|
|
21496
|
+
var emitterLifetime = (now - loopStartTime) / this.item.duration;
|
|
21497
|
+
var timePassed = this.timePassed;
|
|
21498
|
+
var trailUpdated = false;
|
|
21499
|
+
var updateTrail = function() {
|
|
21500
|
+
if (_this.trails && !trailUpdated) {
|
|
21501
|
+
trailUpdated = true;
|
|
21502
|
+
link.forEach(function(param) {
|
|
21503
|
+
var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
|
|
21504
|
+
if (time < timePassed) {
|
|
21505
|
+
_this.clearPointTrail(pointIndex);
|
|
21506
|
+
} else if (timePassed > delay) {
|
|
21507
|
+
_this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
|
|
21508
|
+
}
|
|
21509
|
+
});
|
|
21510
|
+
}
|
|
21511
|
+
};
|
|
21512
|
+
if (!this.ended) {
|
|
21513
|
+
var duration = this.item.duration;
|
|
21514
|
+
var lifetime = this.lifetime;
|
|
21515
|
+
if (timePassed < duration) {
|
|
21516
|
+
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21517
|
+
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21518
|
+
var maxEmissionCount = pointCount;
|
|
21519
|
+
var timeDelta = interval / pointCount;
|
|
21520
|
+
var meshTime = now;
|
|
21521
|
+
var maxCount = options.maxCount;
|
|
21522
|
+
this.updateEmitterTransform(timePassed);
|
|
21523
|
+
var shouldSkipGenerate = function() {
|
|
21524
|
+
var first = link.first;
|
|
21525
|
+
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21526
|
+
};
|
|
21527
|
+
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21528
|
+
if (shouldSkipGenerate()) {
|
|
21529
|
+
break;
|
|
21530
|
+
}
|
|
21531
|
+
var p = this.createPoint(lifetime);
|
|
21532
|
+
p.delay += meshTime + i * timeDelta;
|
|
21533
|
+
this.addParticle(p, maxCount);
|
|
21534
|
+
this.lastEmitTime = timePassed;
|
|
21560
21535
|
}
|
|
21561
|
-
|
|
21562
|
-
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
if (timePassed < duration) {
|
|
21566
|
-
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21567
|
-
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21568
|
-
var maxEmissionCount = pointCount;
|
|
21569
|
-
var timeDelta = interval / pointCount;
|
|
21570
|
-
var meshTime = now;
|
|
21571
|
-
var maxCount = options.maxCount;
|
|
21572
|
-
this.updateEmitterTransform(timePassed);
|
|
21573
|
-
var shouldSkipGenerate = function() {
|
|
21574
|
-
var first = link.first;
|
|
21575
|
-
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21576
|
-
};
|
|
21577
|
-
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21578
|
-
if (shouldSkipGenerate()) {
|
|
21579
|
-
break;
|
|
21580
|
-
}
|
|
21581
|
-
var p = this.createPoint(lifetime);
|
|
21582
|
-
p.delay += meshTime + i * timeDelta;
|
|
21583
|
-
this.addParticle(p, maxCount);
|
|
21584
|
-
this.lastEmitTime = timePassed;
|
|
21536
|
+
var bursts = emission.bursts;
|
|
21537
|
+
for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
|
|
21538
|
+
if (shouldSkipGenerate()) {
|
|
21539
|
+
break;
|
|
21585
21540
|
}
|
|
21586
|
-
var
|
|
21587
|
-
|
|
21588
|
-
|
|
21589
|
-
|
|
21541
|
+
var burst = bursts[j];
|
|
21542
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
21543
|
+
if (opts) {
|
|
21544
|
+
var originVec = [
|
|
21545
|
+
0,
|
|
21546
|
+
0,
|
|
21547
|
+
0
|
|
21548
|
+
];
|
|
21549
|
+
var offsets = emission.burstOffsets[j];
|
|
21550
|
+
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21551
|
+
if (burst.once) {
|
|
21552
|
+
this.removeBurst(j);
|
|
21590
21553
|
}
|
|
21591
|
-
var
|
|
21592
|
-
|
|
21593
|
-
|
|
21594
|
-
|
|
21595
|
-
0,
|
|
21596
|
-
0,
|
|
21597
|
-
0
|
|
21598
|
-
];
|
|
21599
|
-
var offsets = emission.burstOffsets[j];
|
|
21600
|
-
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21601
|
-
if (burst.once) {
|
|
21602
|
-
this.removeBurst(j);
|
|
21603
|
-
}
|
|
21604
|
-
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21605
|
-
var _p_transform;
|
|
21606
|
-
if (shouldSkipGenerate()) {
|
|
21607
|
-
break;
|
|
21608
|
-
}
|
|
21609
|
-
var p1 = this.initPoint(this.shape.generate({
|
|
21610
|
-
total: opts.total,
|
|
21611
|
-
index: opts.index,
|
|
21612
|
-
burstIndex: i1,
|
|
21613
|
-
burstCount: opts.count
|
|
21614
|
-
}));
|
|
21615
|
-
p1.delay += meshTime;
|
|
21616
|
-
cursor++;
|
|
21617
|
-
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21618
|
-
this.addParticle(p1, maxCount);
|
|
21554
|
+
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21555
|
+
var _p_transform;
|
|
21556
|
+
if (shouldSkipGenerate()) {
|
|
21557
|
+
break;
|
|
21619
21558
|
}
|
|
21559
|
+
var p1 = this.initPoint(this.shape.generate({
|
|
21560
|
+
total: opts.total,
|
|
21561
|
+
index: opts.index,
|
|
21562
|
+
burstIndex: i1,
|
|
21563
|
+
burstCount: opts.count
|
|
21564
|
+
}));
|
|
21565
|
+
p1.delay += meshTime;
|
|
21566
|
+
cursor++;
|
|
21567
|
+
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21568
|
+
this.addParticle(p1, maxCount);
|
|
21620
21569
|
}
|
|
21621
21570
|
}
|
|
21622
|
-
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21623
|
-
updateTrail();
|
|
21624
|
-
this.loopStartTime = now - duration;
|
|
21625
|
-
this.lastEmitTime -= duration;
|
|
21626
|
-
this.time -= duration;
|
|
21627
|
-
emission.bursts.forEach(function(b) {
|
|
21628
|
-
return b.reset();
|
|
21629
|
-
});
|
|
21630
|
-
this.particleLink.forEach(function(content) {
|
|
21631
|
-
content[0] -= duration;
|
|
21632
|
-
content[2] -= duration;
|
|
21633
|
-
content[3].delay -= duration;
|
|
21634
|
-
});
|
|
21635
|
-
this.renderer.minusTimeForLoop(duration);
|
|
21636
|
-
} else {
|
|
21637
|
-
this.ended = true;
|
|
21638
|
-
var endBehavior = this.item.endBehavior;
|
|
21639
|
-
if (endBehavior === EndBehavior.freeze) {
|
|
21640
|
-
this.frozen = true;
|
|
21641
|
-
}
|
|
21642
21571
|
}
|
|
21643
|
-
} else if (this.item.endBehavior
|
|
21644
|
-
|
|
21645
|
-
|
|
21646
|
-
|
|
21647
|
-
|
|
21648
|
-
|
|
21572
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21573
|
+
updateTrail();
|
|
21574
|
+
this.loopStartTime = now - duration;
|
|
21575
|
+
this.lastEmitTime -= duration;
|
|
21576
|
+
this.time -= duration;
|
|
21577
|
+
emission.bursts.forEach(function(b) {
|
|
21578
|
+
return b.reset();
|
|
21579
|
+
});
|
|
21580
|
+
this.particleLink.forEach(function(content) {
|
|
21581
|
+
content[0] -= duration;
|
|
21582
|
+
content[2] -= duration;
|
|
21583
|
+
content[3].delay -= duration;
|
|
21584
|
+
});
|
|
21585
|
+
this.renderer.minusTimeForLoop(duration);
|
|
21586
|
+
} else {
|
|
21587
|
+
this.ended = true;
|
|
21588
|
+
var endBehavior = this.item.endBehavior;
|
|
21589
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
21590
|
+
this.frozen = true;
|
|
21591
|
+
}
|
|
21592
|
+
}
|
|
21593
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
21594
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
21595
|
+
var node = link.last;
|
|
21596
|
+
if (node && node.content[0] < this.time) {
|
|
21597
|
+
this.destroyed = true;
|
|
21649
21598
|
}
|
|
21650
21599
|
}
|
|
21651
|
-
updateTrail();
|
|
21652
21600
|
}
|
|
21601
|
+
updateTrail();
|
|
21653
21602
|
};
|
|
21654
21603
|
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
21655
21604
|
if (!this.isActiveAndEnabled) {
|
|
@@ -25689,7 +25638,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25689
25638
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25690
25639
|
_this.time = 0;
|
|
25691
25640
|
_this.duration = 1;
|
|
25692
|
-
_this.loop = true;
|
|
25693
25641
|
/**
|
|
25694
25642
|
* @internal
|
|
25695
25643
|
*/ _this.splits = singleSplits;
|
|
@@ -25704,11 +25652,15 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25704
25652
|
var _this = this;
|
|
25705
25653
|
var time = this.time;
|
|
25706
25654
|
var duration = this.duration;
|
|
25707
|
-
|
|
25655
|
+
var textureAnimation = this.textureSheetAnimation;
|
|
25656
|
+
var _textureAnimation_loop;
|
|
25657
|
+
// TODO: Update textureAnimation spec.
|
|
25658
|
+
// @ts-expect-error
|
|
25659
|
+
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25660
|
+
if (time > duration && loop) {
|
|
25708
25661
|
time = time % duration;
|
|
25709
25662
|
}
|
|
25710
25663
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
25711
|
-
var ta = this.textureSheetAnimation;
|
|
25712
25664
|
var video = this.renderer.texture.source.video;
|
|
25713
25665
|
if (video) {
|
|
25714
25666
|
if (time === 0) {
|
|
@@ -25720,9 +25672,9 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25720
25672
|
}
|
|
25721
25673
|
this.renderer.texture.uploadCurrentVideoFrame();
|
|
25722
25674
|
}
|
|
25723
|
-
if (
|
|
25675
|
+
if (textureAnimation) {
|
|
25724
25676
|
var _this_material_getVector4;
|
|
25725
|
-
var total =
|
|
25677
|
+
var total = textureAnimation.total || textureAnimation.row * textureAnimation.col;
|
|
25726
25678
|
var texRectX = 0;
|
|
25727
25679
|
var texRectY = 0;
|
|
25728
25680
|
var texRectW = 1;
|
|
@@ -25743,20 +25695,20 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25743
25695
|
}
|
|
25744
25696
|
var dx, dy;
|
|
25745
25697
|
if (flip) {
|
|
25746
|
-
dx = 1 /
|
|
25747
|
-
dy = 1 /
|
|
25698
|
+
dx = 1 / textureAnimation.row * texRectW;
|
|
25699
|
+
dy = 1 / textureAnimation.col * texRectH;
|
|
25748
25700
|
} else {
|
|
25749
|
-
dx = 1 /
|
|
25750
|
-
dy = 1 /
|
|
25701
|
+
dx = 1 / textureAnimation.col * texRectW;
|
|
25702
|
+
dy = 1 / textureAnimation.row * texRectH;
|
|
25751
25703
|
}
|
|
25752
25704
|
var texOffset;
|
|
25753
|
-
if (
|
|
25705
|
+
if (textureAnimation.animate) {
|
|
25754
25706
|
var frameIndex = Math.round(life * (total - 1));
|
|
25755
|
-
var yIndex = Math.floor(frameIndex /
|
|
25756
|
-
var xIndex = frameIndex - yIndex *
|
|
25707
|
+
var yIndex = Math.floor(frameIndex / textureAnimation.col);
|
|
25708
|
+
var xIndex = frameIndex - yIndex * textureAnimation.col;
|
|
25757
25709
|
texOffset = flip ? [
|
|
25758
25710
|
dx * yIndex,
|
|
25759
|
-
dy * (
|
|
25711
|
+
dy * (textureAnimation.col - xIndex)
|
|
25760
25712
|
] : [
|
|
25761
25713
|
dx * xIndex,
|
|
25762
25714
|
dy * (1 + yIndex)
|
|
@@ -25944,8 +25896,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25944
25896
|
var _data_duration;
|
|
25945
25897
|
//@ts-expect-error
|
|
25946
25898
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
25947
|
-
var _data_loop;
|
|
25948
|
-
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
25949
25899
|
};
|
|
25950
25900
|
return SpriteComponent;
|
|
25951
25901
|
}(MaskableGraphic);
|
|
@@ -25953,21 +25903,21 @@ SpriteComponent = __decorate([
|
|
|
25953
25903
|
effectsClass(DataType.SpriteComponent)
|
|
25954
25904
|
], SpriteComponent);
|
|
25955
25905
|
|
|
25956
|
-
var ParticleLoader = /*#__PURE__*/ function(
|
|
25957
|
-
_inherits(ParticleLoader,
|
|
25906
|
+
var ParticleLoader = /*#__PURE__*/ function(Plugin) {
|
|
25907
|
+
_inherits(ParticleLoader, Plugin);
|
|
25958
25908
|
function ParticleLoader() {
|
|
25959
|
-
return
|
|
25909
|
+
return Plugin.apply(this, arguments);
|
|
25960
25910
|
}
|
|
25961
25911
|
return ParticleLoader;
|
|
25962
|
-
}(
|
|
25912
|
+
}(_wrap_native_super(Plugin));
|
|
25963
25913
|
|
|
25964
|
-
var CalculateLoader = /*#__PURE__*/ function(
|
|
25965
|
-
_inherits(CalculateLoader,
|
|
25914
|
+
var CalculateLoader = /*#__PURE__*/ function(Plugin) {
|
|
25915
|
+
_inherits(CalculateLoader, Plugin);
|
|
25966
25916
|
function CalculateLoader() {
|
|
25967
|
-
return
|
|
25917
|
+
return Plugin.apply(this, arguments);
|
|
25968
25918
|
}
|
|
25969
25919
|
return CalculateLoader;
|
|
25970
|
-
}(
|
|
25920
|
+
}(_wrap_native_super(Plugin));
|
|
25971
25921
|
|
|
25972
25922
|
// Based on:
|
|
25973
25923
|
/**
|
|
@@ -29069,6 +29019,12 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29069
29019
|
/**
|
|
29070
29020
|
* 每一行文本的最大宽度
|
|
29071
29021
|
*/ _this.maxLineWidth = 0;
|
|
29022
|
+
/**
|
|
29023
|
+
* 初始文本宽度,用于计算缩放比例
|
|
29024
|
+
*/ _this.baseTextWidth = 0;
|
|
29025
|
+
/**
|
|
29026
|
+
* 初始 `transform.size.x`,用于按比例更新显示宽度
|
|
29027
|
+
*/ _this.baseScaleX = 1;
|
|
29072
29028
|
_this.name = "MText" + seed$1++;
|
|
29073
29029
|
// 初始化canvas资源
|
|
29074
29030
|
_this.canvas = canvasPool.getCanvas();
|
|
@@ -29094,10 +29050,11 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29094
29050
|
text: "默认文本",
|
|
29095
29051
|
fontFamily: "AlibabaSans-BoldItalic",
|
|
29096
29052
|
fontSize: 40,
|
|
29053
|
+
// 统一使用 0-1 颜色值
|
|
29097
29054
|
textColor: [
|
|
29098
|
-
|
|
29099
|
-
|
|
29100
|
-
|
|
29055
|
+
1,
|
|
29056
|
+
1,
|
|
29057
|
+
1,
|
|
29101
29058
|
1
|
|
29102
29059
|
],
|
|
29103
29060
|
fontWeight: TextWeight.normal,
|
|
@@ -29134,6 +29091,10 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29134
29091
|
// TextComponentBase
|
|
29135
29092
|
this.updateWithOptions(options);
|
|
29136
29093
|
this.renderText(options);
|
|
29094
|
+
// 记录初始的 textWidth 和 x 缩放,用于后续按比例更新显示宽度
|
|
29095
|
+
// 添加兜底值 1 防止除 0
|
|
29096
|
+
this.baseTextWidth = options.textWidth || this.textLayout.width || 1;
|
|
29097
|
+
this.baseScaleX = this.item.transform.size.x;
|
|
29137
29098
|
// 恢复默认颜色
|
|
29138
29099
|
this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
29139
29100
|
};
|
|
@@ -29332,9 +29293,9 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29332
29293
|
if (style.isOutlined) {
|
|
29333
29294
|
_this.setupOutline();
|
|
29334
29295
|
}
|
|
29335
|
-
//
|
|
29296
|
+
// textColor 统一是 0-1,写入 canvas 时乘 255
|
|
29336
29297
|
var _style_textColor = style.textColor, r = _style_textColor[0], g = _style_textColor[1], b = _style_textColor[2], a = _style_textColor[3];
|
|
29337
|
-
context.fillStyle = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
|
|
29298
|
+
context.fillStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
29338
29299
|
var charsInfo = [];
|
|
29339
29300
|
var x = 0;
|
|
29340
29301
|
var y = layout.getOffsetY(style, _this.lineCount, lineHeight, fontSize);
|
|
@@ -29396,6 +29357,46 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29396
29357
|
layout.autoWidth = normalizedValue;
|
|
29397
29358
|
this.isDirty = true;
|
|
29398
29359
|
};
|
|
29360
|
+
/**
|
|
29361
|
+
* 设置文本框宽度
|
|
29362
|
+
* 手动设置宽度时会自动关闭 `autoWidth`
|
|
29363
|
+
* 同时会按比例更新 `transform.size.x`,让 UI 框宽度也跟着变化
|
|
29364
|
+
* @param value - 文本框宽度
|
|
29365
|
+
*/ _proto.setTextWidth = function setTextWidth(value) {
|
|
29366
|
+
var width = Math.max(0, Number(value) || 0);
|
|
29367
|
+
var layout = this.textLayout;
|
|
29368
|
+
// 宽度没变且已是非 autoWidth 模式,直接返回
|
|
29369
|
+
if (layout.width === width && layout.autoWidth === false) {
|
|
29370
|
+
return;
|
|
29371
|
+
}
|
|
29372
|
+
// 手动设置宽度时关闭 autoWidth
|
|
29373
|
+
layout.autoWidth = false;
|
|
29374
|
+
layout.width = width;
|
|
29375
|
+
// 按当前 overflow 模式重新计算行数和 maxLineWidth
|
|
29376
|
+
this.lineCount = this.getLineCount(this.text || "");
|
|
29377
|
+
this.isDirty = true;
|
|
29378
|
+
// 同步更新外层显示宽度(按比例缩放 transform)
|
|
29379
|
+
// 这样 UI 框的视觉宽度也会跟着文本宽度变化
|
|
29380
|
+
if (this.baseTextWidth > 0) {
|
|
29381
|
+
var scale = width / this.baseTextWidth;
|
|
29382
|
+
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29383
|
+
}
|
|
29384
|
+
};
|
|
29385
|
+
/**
|
|
29386
|
+
* 设置文本框高度
|
|
29387
|
+
* @param value - 文本框高度
|
|
29388
|
+
*/ _proto.setTextHeight = function setTextHeight(value) {
|
|
29389
|
+
var height = Math.max(0, Number(value) || 0);
|
|
29390
|
+
if (height === 0) {
|
|
29391
|
+
return;
|
|
29392
|
+
}
|
|
29393
|
+
var layout = this.textLayout;
|
|
29394
|
+
if (layout.height === height) {
|
|
29395
|
+
return;
|
|
29396
|
+
}
|
|
29397
|
+
layout.height = height;
|
|
29398
|
+
this.isDirty = true;
|
|
29399
|
+
};
|
|
29399
29400
|
_proto.setFontSize = function setFontSize(value) {
|
|
29400
29401
|
if (this.textStyle.fontSize === value) {
|
|
29401
29402
|
return;
|
|
@@ -29463,13 +29464,13 @@ applyMixins(TextComponent, [
|
|
|
29463
29464
|
]);
|
|
29464
29465
|
|
|
29465
29466
|
// TODO: 注册必须用
|
|
29466
|
-
var TextLoader = /*#__PURE__*/ function(
|
|
29467
|
-
_inherits(TextLoader,
|
|
29467
|
+
var TextLoader = /*#__PURE__*/ function(Plugin) {
|
|
29468
|
+
_inherits(TextLoader, Plugin);
|
|
29468
29469
|
function TextLoader() {
|
|
29469
|
-
return
|
|
29470
|
+
return Plugin.apply(this, arguments);
|
|
29470
29471
|
}
|
|
29471
29472
|
return TextLoader;
|
|
29472
|
-
}(
|
|
29473
|
+
}(_wrap_native_super(Plugin));
|
|
29473
29474
|
|
|
29474
29475
|
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
29475
29476
|
_inherits(Asset, EffectsObject);
|
|
@@ -30526,6 +30527,10 @@ function version35Migration(json) {
|
|
|
30526
30527
|
if (component.dataType === DataType.TextComponent || component.dataType === DataType.RichTextComponent && component.options) {
|
|
30527
30528
|
ensureTextVerticalAlign(component.options);
|
|
30528
30529
|
}
|
|
30530
|
+
// 处理文本颜色从 0-255 到 0-1 的转换
|
|
30531
|
+
if (component.dataType === DataType.TextComponent) {
|
|
30532
|
+
convertTextColorTo01(component.options);
|
|
30533
|
+
}
|
|
30529
30534
|
}
|
|
30530
30535
|
}
|
|
30531
30536
|
//@ts-expect-error
|
|
@@ -30545,6 +30550,22 @@ function version35Migration(json) {
|
|
|
30545
30550
|
options.TextVerticalAlign = options.textBaseline;
|
|
30546
30551
|
}
|
|
30547
30552
|
}
|
|
30553
|
+
/**
|
|
30554
|
+
* 将文本颜色从 0-255 转换到 0-1
|
|
30555
|
+
*/ function convertTextColorTo01(options) {
|
|
30556
|
+
if (!options || !options.textColor) {
|
|
30557
|
+
return;
|
|
30558
|
+
}
|
|
30559
|
+
var textColor = options.textColor;
|
|
30560
|
+
var _textColor_;
|
|
30561
|
+
// 将 RGB 从 0-255 转换到 0-1(alpha 通道已经是 0-1,不需要转换)
|
|
30562
|
+
options.textColor = [
|
|
30563
|
+
textColor[0] / 255.0,
|
|
30564
|
+
textColor[1] / 255.0,
|
|
30565
|
+
textColor[2] / 255.0,
|
|
30566
|
+
(_textColor_ = textColor[3]) != null ? _textColor_ : 1
|
|
30567
|
+
];
|
|
30568
|
+
}
|
|
30548
30569
|
/**
|
|
30549
30570
|
* 根据形状获取形状几何体数据
|
|
30550
30571
|
* @param shape - 形状
|
|
@@ -31467,7 +31488,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31467
31488
|
return ret;
|
|
31468
31489
|
}
|
|
31469
31490
|
|
|
31470
|
-
var version$1 = "2.8.0-alpha.
|
|
31491
|
+
var version$1 = "2.8.0-alpha.4";
|
|
31471
31492
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31472
31493
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31473
31494
|
var reverseParticle = false;
|
|
@@ -32107,8 +32128,8 @@ var seed = 1;
|
|
|
32107
32128
|
};
|
|
32108
32129
|
return [
|
|
32109
32130
|
4,
|
|
32110
|
-
hookTimeInfo("plugin:
|
|
32111
|
-
return _this.
|
|
32131
|
+
hookTimeInfo("plugin:onAssetsLoadStart", function() {
|
|
32132
|
+
return _this.onPluginSceneLoadStart(scene);
|
|
32112
32133
|
})
|
|
32113
32134
|
];
|
|
32114
32135
|
case 6:
|
|
@@ -32396,7 +32417,7 @@ var seed = 1;
|
|
|
32396
32417
|
});
|
|
32397
32418
|
})();
|
|
32398
32419
|
};
|
|
32399
|
-
_proto.
|
|
32420
|
+
_proto.onPluginSceneLoadStart = function onPluginSceneLoadStart(scene) {
|
|
32400
32421
|
var _this = this;
|
|
32401
32422
|
return _async_to_generator(function() {
|
|
32402
32423
|
return __generator(this, function(_state) {
|
|
@@ -32404,7 +32425,7 @@ var seed = 1;
|
|
|
32404
32425
|
case 0:
|
|
32405
32426
|
return [
|
|
32406
32427
|
4,
|
|
32407
|
-
PluginSystem.
|
|
32428
|
+
PluginSystem.onAssetsLoadStart(scene, _this.options)
|
|
32408
32429
|
];
|
|
32409
32430
|
case 1:
|
|
32410
32431
|
_state.sent();
|
|
@@ -35105,8 +35126,8 @@ var SceneLoader = /*#__PURE__*/ function() {
|
|
|
35105
35126
|
case 1:
|
|
35106
35127
|
loadedScene = _state.sent();
|
|
35107
35128
|
engine.clearResources();
|
|
35108
|
-
// 触发插件系统 pluginSystem 的回调
|
|
35109
|
-
PluginSystem.
|
|
35129
|
+
// 触发插件系统 pluginSystem 的回调 onAssetsLoadFinish
|
|
35130
|
+
PluginSystem.onAssetsLoadFinish(loadedScene, assetManager.options, engine);
|
|
35110
35131
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
35111
35132
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
35112
35133
|
engine.assetService.initializeTexture(loadedScene);
|
|
@@ -35168,8 +35189,8 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35168
35189
|
registerPlugin("particle", ParticleLoader);
|
|
35169
35190
|
registerPlugin("cal", CalculateLoader);
|
|
35170
35191
|
registerPlugin("interact", InteractLoader);
|
|
35171
|
-
var version = "2.8.0-alpha.
|
|
35192
|
+
var version = "2.8.0-alpha.4";
|
|
35172
35193
|
logger.info("Core version: " + version + ".");
|
|
35173
35194
|
|
|
35174
|
-
export {
|
|
35195
|
+
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, 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, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
35175
35196
|
//# sourceMappingURL=index.mjs.map
|