@galacean/engine-core 1.1.0-alpha.4 → 1.1.0-beta.1

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.
@@ -189,6 +189,31 @@ function _inherits(subClass, superClass) {
189
189
  return this;
190
190
  };
191
191
  /**
192
+ * Copy from array like object.
193
+ * @param source - Array like object
194
+ * @param offset - The start offset
195
+ * @returns This color
196
+ */ _proto.copyFromArray = function copyFromArray(source, offset) {
197
+ if (offset === void 0) offset = 0;
198
+ this._r = source[offset];
199
+ this._g = source[offset + 1];
200
+ this._b = source[offset + 2];
201
+ this._a = source[offset + 3];
202
+ this._onValueChanged && this._onValueChanged();
203
+ return this;
204
+ };
205
+ /**
206
+ * Copy the value of this color to an array.
207
+ * @param out - The color
208
+ * @param outOffset - The start offset
209
+ */ _proto.copyToArray = function copyToArray(out, outOffset) {
210
+ if (outOffset === void 0) outOffset = 0;
211
+ out[outOffset] = this._r;
212
+ out[outOffset + 1] = this._g;
213
+ out[outOffset + 2] = this._b;
214
+ out[outOffset + 3] = this._a;
215
+ };
216
+ /**
192
217
  * Modify components (r, g, b) of this color from gamma space to linear space.
193
218
  * @param out - The color in linear space
194
219
  * @returns The color in linear space
@@ -376,28 +401,33 @@ function _inherits(subClass, superClass) {
376
401
  return Color;
377
402
  }();
378
403
 
379
- /******************************************************************************
380
- Copyright (c) Microsoft Corporation.
381
-
382
- Permission to use, copy, modify, and/or distribute this software for any
383
- purpose with or without fee is hereby granted.
384
-
385
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
386
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
387
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
388
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
389
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
390
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
391
- PERFORMANCE OF THIS SOFTWARE.
392
- ***************************************************************************** */
393
-
394
- function __decorate(decorators, target, key, desc) {
395
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
396
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
397
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
398
- return c > 3 && r && Object.defineProperty(target, key, r), r;
404
+ /******************************************************************************
405
+ Copyright (c) Microsoft Corporation.
406
+
407
+ Permission to use, copy, modify, and/or distribute this software for any
408
+ purpose with or without fee is hereby granted.
409
+
410
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
411
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
412
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
413
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
414
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
415
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
416
+ PERFORMANCE OF THIS SOFTWARE.
417
+ ***************************************************************************** */
418
+
419
+ function __decorate(decorators, target, key, desc) {
420
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
421
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
422
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
423
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
399
424
  }
400
425
 
426
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
427
+ var e = new Error(message);
428
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
429
+ };
430
+
401
431
  function _instanceof(left, right) {
402
432
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
403
433
  return !!right[Symbol.hasInstance](left);
@@ -612,11 +642,11 @@ __decorate([
612
642
 
613
643
  /**
614
644
  * The base class of assets, with reference counting capability.
615
- */ var ReferResource = /*#__PURE__*/ function(EngineObject) {
616
- _inherits(ReferResource, EngineObject);
645
+ */ var ReferResource = /*#__PURE__*/ function(EngineObject1) {
646
+ _inherits(ReferResource, EngineObject1);
617
647
  function ReferResource(engine) {
618
648
  var _this;
619
- _this = EngineObject.call(this, engine) || this;
649
+ _this = EngineObject1.call(this, engine) || this;
620
650
  /** Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc(). */ _this.isGCIgnored = false;
621
651
  _this._refCount = 0;
622
652
  engine.resourceManager._addReferResource(_assert_this_initialized(_this));
@@ -632,7 +662,7 @@ __decorate([
632
662
  if (!force && this._refCount !== 0) {
633
663
  return false;
634
664
  }
635
- EngineObject.prototype.destroy.call(this);
665
+ EngineObject1.prototype.destroy.call(this);
636
666
  return true;
637
667
  };
638
668
  /**
@@ -653,7 +683,7 @@ __decorate([
653
683
  /**
654
684
  * @internal
655
685
  */ _proto._onDestroy = function _onDestroy() {
656
- EngineObject.prototype._onDestroy.call(this);
686
+ EngineObject1.prototype._onDestroy.call(this);
657
687
  this._engine.resourceManager._deleteReferResource(this);
658
688
  var refCount = this._getReferCount();
659
689
  if (refCount > 0) {
@@ -786,11 +816,11 @@ __decorate([
786
816
  TextureWrapMode[TextureWrapMode[/** Mirror repeat mode. tiling will be mirrored and repeated if it exceeds the texture boundary. */ "Mirror"] = 2] = "Mirror";
787
817
  })(exports.TextureWrapMode || (exports.TextureWrapMode = {}));
788
818
 
789
- var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
790
- _inherits(GraphicsResource, ReferResource);
819
+ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
820
+ _inherits(GraphicsResource, ReferResource1);
791
821
  function GraphicsResource(engine) {
792
822
  var _this;
793
- _this = ReferResource.call(this, engine) || this;
823
+ _this = ReferResource1.call(this, engine) || this;
794
824
  /** @internal */ _this._isContentLost = false;
795
825
  engine.resourceManager._addGraphicResource(_assert_this_initialized(_this));
796
826
  return _this;
@@ -799,7 +829,7 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
799
829
  /**
800
830
  * @internal
801
831
  */ _proto._onDestroy = function _onDestroy() {
802
- ReferResource.prototype._onDestroy.call(this);
832
+ ReferResource1.prototype._onDestroy.call(this);
803
833
  this.engine.resourceManager._deleteGraphicResource(this);
804
834
  };
805
835
  _create_class(GraphicsResource, [
@@ -851,11 +881,11 @@ var Logger = {
851
881
 
852
882
  /**
853
883
  * The base class of texture, contains some common functions of texture-related classes.
854
- */ var Texture = /*#__PURE__*/ function(GraphicsResource) {
855
- _inherits(Texture, GraphicsResource);
884
+ */ var Texture = /*#__PURE__*/ function(GraphicsResource1) {
885
+ _inherits(Texture, GraphicsResource1);
856
886
  function Texture() {
857
887
  var _this;
858
- _this = GraphicsResource.apply(this, arguments) || this;
888
+ _this = GraphicsResource1.apply(this, arguments) || this;
859
889
  /** @internal */ _this._isDepthTexture = false;
860
890
  _this._anisoLevel = 1;
861
891
  _this._useDepthCompareMode = false;
@@ -892,7 +922,7 @@ var Logger = {
892
922
  /**
893
923
  * @internal
894
924
  */ _proto._onDestroy = function _onDestroy() {
895
- GraphicsResource.prototype._onDestroy.call(this);
925
+ GraphicsResource1.prototype._onDestroy.call(this);
896
926
  this._platformTexture.destroy();
897
927
  this._platformTexture = null;
898
928
  };
@@ -1032,13 +1062,13 @@ var Logger = {
1032
1062
 
1033
1063
  /**
1034
1064
  * The render target used for off-screen rendering.
1035
- */ var RenderTarget = /*#__PURE__*/ function(GraphicsResource) {
1036
- _inherits(RenderTarget, GraphicsResource);
1065
+ */ var RenderTarget = /*#__PURE__*/ function(GraphicsResource1) {
1066
+ _inherits(RenderTarget, GraphicsResource1);
1037
1067
  function RenderTarget(engine, width, height, renderTexture, depth, antiAliasing) {
1038
1068
  if (depth === void 0) depth = exports.RenderBufferDepthFormat.Depth;
1039
1069
  if (antiAliasing === void 0) antiAliasing = 1;
1040
1070
  var _this;
1041
- _this = GraphicsResource.call(this, engine) || this;
1071
+ _this = GraphicsResource1.call(this, engine) || this;
1042
1072
  _this._autoGenerateMipmaps = true;
1043
1073
  _this._width = width;
1044
1074
  _this._height = height;
@@ -1094,7 +1124,7 @@ var Logger = {
1094
1124
  * @internal
1095
1125
  */ _proto._onDestroy = function _onDestroy() {
1096
1126
  var _this__depthTexture;
1097
- GraphicsResource.prototype._onDestroy.call(this);
1127
+ GraphicsResource1.prototype._onDestroy.call(this);
1098
1128
  this._platformRenderTarget.destroy();
1099
1129
  var _this = this, colorTextures = _this._colorTextures;
1100
1130
  for(var i = 0, n = colorTextures.length; i < n; i++){
@@ -1180,14 +1210,14 @@ var Logger = {
1180
1210
 
1181
1211
  /**
1182
1212
  * Two-dimensional texture.
1183
- */ var Texture2D = /*#__PURE__*/ function(Texture) {
1184
- _inherits(Texture2D, Texture);
1213
+ */ var Texture2D = /*#__PURE__*/ function(Texture1) {
1214
+ _inherits(Texture2D, Texture1);
1185
1215
  function Texture2D(engine, width, height, format, mipmap, usage) {
1186
1216
  if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
1187
1217
  if (mipmap === void 0) mipmap = true;
1188
1218
  if (usage === void 0) usage = exports.TextureUsage.Static;
1189
1219
  var _this;
1190
- _this = Texture.call(this, engine) || this;
1220
+ _this = Texture1.call(this, engine) || this;
1191
1221
  _this._mipmap = mipmap;
1192
1222
  _this._width = width;
1193
1223
  _this._height = height;
@@ -1250,20 +1280,20 @@ var Logger = {
1250
1280
  * @internal
1251
1281
  */ _proto._rebuild = function _rebuild() {
1252
1282
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2D(this);
1253
- Texture.prototype._rebuild.call(this);
1283
+ Texture1.prototype._rebuild.call(this);
1254
1284
  };
1255
1285
  return Texture2D;
1256
1286
  }(Texture);
1257
1287
 
1258
1288
  /**
1259
1289
  * Two-dimensional texture array.
1260
- */ var Texture2DArray = /*#__PURE__*/ function(Texture) {
1261
- _inherits(Texture2DArray, Texture);
1290
+ */ var Texture2DArray = /*#__PURE__*/ function(Texture1) {
1291
+ _inherits(Texture2DArray, Texture1);
1262
1292
  function Texture2DArray(engine, width, height, length, format, mipmap) {
1263
1293
  if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
1264
1294
  if (mipmap === void 0) mipmap = true;
1265
1295
  var _this;
1266
- _this = Texture.call(this, engine) || this;
1296
+ _this = Texture1.call(this, engine) || this;
1267
1297
  _this._mipmap = mipmap;
1268
1298
  _this._width = width;
1269
1299
  _this._height = height;
@@ -1328,7 +1358,7 @@ var Logger = {
1328
1358
  * @internal
1329
1359
  */ _proto._rebuild = function _rebuild() {
1330
1360
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
1331
- Texture.prototype._rebuild.call(this);
1361
+ Texture1.prototype._rebuild.call(this);
1332
1362
  };
1333
1363
  _create_class(Texture2DArray, [
1334
1364
  {
@@ -1345,13 +1375,13 @@ var Logger = {
1345
1375
 
1346
1376
  /**
1347
1377
  * Cube texture.
1348
- */ var TextureCube = /*#__PURE__*/ function(Texture) {
1349
- _inherits(TextureCube, Texture);
1378
+ */ var TextureCube = /*#__PURE__*/ function(Texture1) {
1379
+ _inherits(TextureCube, Texture1);
1350
1380
  function TextureCube(engine, size, format, mipmap) {
1351
1381
  if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
1352
1382
  if (mipmap === void 0) mipmap = true;
1353
1383
  var _this;
1354
- _this = Texture.call(this, engine) || this;
1384
+ _this = Texture1.call(this, engine) || this;
1355
1385
  _this._mipmap = mipmap;
1356
1386
  _this._width = size;
1357
1387
  _this._height = size;
@@ -1414,18 +1444,18 @@ var Logger = {
1414
1444
  * @internal
1415
1445
  */ _proto._rebuild = function _rebuild() {
1416
1446
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTextureCube(this);
1417
- Texture.prototype._rebuild.call(this);
1447
+ Texture1.prototype._rebuild.call(this);
1418
1448
  };
1419
1449
  return TextureCube;
1420
1450
  }(Texture);
1421
1451
 
1422
1452
  /**
1423
1453
  * @internal
1424
- */ var FontAtlas = /*#__PURE__*/ function(ReferResource) {
1425
- _inherits(FontAtlas, ReferResource);
1454
+ */ var FontAtlas = /*#__PURE__*/ function(ReferResource1) {
1455
+ _inherits(FontAtlas, ReferResource1);
1426
1456
  function FontAtlas(engine) {
1427
1457
  var _this;
1428
- _this = ReferResource.call(this, engine) || this;
1458
+ _this = ReferResource1.call(this, engine) || this;
1429
1459
  _this._charInfoMap = {};
1430
1460
  _this._space = 1;
1431
1461
  _this._curX = 1;
@@ -1488,7 +1518,7 @@ var Logger = {
1488
1518
  /**
1489
1519
  * @internal
1490
1520
  */ _proto._onDestroy = function _onDestroy() {
1491
- ReferResource.prototype._onDestroy.call(this);
1521
+ ReferResource1.prototype._onDestroy.call(this);
1492
1522
  this.texture.destroy();
1493
1523
  this.texture = null;
1494
1524
  this._charInfoMap = {};
@@ -2037,12 +2067,12 @@ var Logger = {
2037
2067
 
2038
2068
  /**
2039
2069
  * Font.
2040
- */ var Font = /*#__PURE__*/ function(ReferResource) {
2041
- _inherits(Font, ReferResource);
2070
+ */ var Font = /*#__PURE__*/ function(ReferResource1) {
2071
+ _inherits(Font, ReferResource1);
2042
2072
  function Font(engine, name) {
2043
2073
  if (name === void 0) name = "";
2044
2074
  var _this;
2045
- _this = ReferResource.call(this, engine) || this;
2075
+ _this = ReferResource1.call(this, engine) || this;
2046
2076
  _this._name = "";
2047
2077
  _this._subFontMap = {};
2048
2078
  _this._name = name;
@@ -2065,7 +2095,7 @@ var Logger = {
2065
2095
  /**
2066
2096
  * @internal
2067
2097
  */ _proto._onDestroy = function _onDestroy() {
2068
- ReferResource.prototype._onDestroy.call(this);
2098
+ ReferResource1.prototype._onDestroy.call(this);
2069
2099
  var subFontMap = this._subFontMap;
2070
2100
  for(var k in subFontMap){
2071
2101
  subFontMap[k].destroy();
@@ -2294,8 +2324,9 @@ var Logger = {
2294
2324
  /**
2295
2325
  * @internal
2296
2326
  */ ShaderProperty._getShaderPropertyGroup = function _getShaderPropertyGroup(propertyName) {
2327
+ var _shaderProperty;
2297
2328
  var shaderProperty = ShaderProperty._propertyNameMap[propertyName];
2298
- return shaderProperty == null ? void 0 : shaderProperty._group;
2329
+ return (_shaderProperty = shaderProperty) == null ? void 0 : _shaderProperty._group;
2299
2330
  };
2300
2331
  _create_class(ShaderProperty, [
2301
2332
  {
@@ -2505,11 +2536,11 @@ var ActiveChangeFlag;
2505
2536
 
2506
2537
  /**
2507
2538
  * The base class of the components.
2508
- */ var Component = /*#__PURE__*/ function(EngineObject) {
2509
- _inherits(Component, EngineObject);
2539
+ */ var Component = /*#__PURE__*/ function(EngineObject1) {
2540
+ _inherits(Component, EngineObject1);
2510
2541
  function Component(entity) {
2511
2542
  var _this;
2512
- _this = EngineObject.call(this, entity.engine) || this;
2543
+ _this = EngineObject1.call(this, entity.engine) || this;
2513
2544
  /** @internal */ _this._awoken = false;
2514
2545
  _this._phasedActive = false;
2515
2546
  _this._phasedActiveInScene = false;
@@ -2577,7 +2608,7 @@ var ActiveChangeFlag;
2577
2608
  /**
2578
2609
  * @internal
2579
2610
  */ _proto._onDestroy = function _onDestroy() {
2580
- EngineObject.prototype._onDestroy.call(this);
2611
+ EngineObject1.prototype._onDestroy.call(this);
2581
2612
  var entity = this._entity;
2582
2613
  entity._removeComponent(this);
2583
2614
  if (this._enabled) {
@@ -3053,11 +3084,11 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3053
3084
 
3054
3085
  /**
3055
3086
  * Bool update flag.
3056
- */ var BoolUpdateFlag = /*#__PURE__*/ function(UpdateFlag) {
3057
- _inherits(BoolUpdateFlag, UpdateFlag);
3087
+ */ var BoolUpdateFlag = /*#__PURE__*/ function(UpdateFlag1) {
3088
+ _inherits(BoolUpdateFlag, UpdateFlag1);
3058
3089
  function BoolUpdateFlag() {
3059
3090
  var _this;
3060
- _this = UpdateFlag.apply(this, arguments) || this;
3091
+ _this = UpdateFlag1.apply(this, arguments) || this;
3061
3092
  /** Bool flag. */ _this.flag = true;
3062
3093
  return _this;
3063
3094
  }
@@ -3133,11 +3164,11 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3133
3164
 
3134
3165
  /**
3135
3166
  * Used to implement transformation related functions.
3136
- */ var Transform = /*#__PURE__*/ function(Component) {
3137
- _inherits(Transform, Component);
3167
+ */ var Transform = /*#__PURE__*/ function(Component1) {
3168
+ _inherits(Transform, Component1);
3138
3169
  function Transform(entity) {
3139
3170
  var _this;
3140
- _this = Component.call(this, entity) || this;
3171
+ _this = Component1.call(this, entity) || this;
3141
3172
  _this._position = new miniprogram.Vector3();
3142
3173
  _this._rotation = new miniprogram.Vector3();
3143
3174
  _this._rotationQuaternion = new miniprogram.Quaternion();
@@ -3323,7 +3354,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3323
3354
  return isInvert;
3324
3355
  };
3325
3356
  _proto._onDestroy = function _onDestroy() {
3326
- Component.prototype._onDestroy.call(this);
3357
+ Component1.prototype._onDestroy.call(this);
3327
3358
  //@ts-ignore
3328
3359
  this._worldPosition._onValueChanged = null;
3329
3360
  //@ts-ignore
@@ -3956,11 +3987,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
3956
3987
 
3957
3988
  /**
3958
3989
  * Entity, be used as components container.
3959
- */ var Entity = /*#__PURE__*/ function(EngineObject) {
3960
- _inherits(Entity, EngineObject);
3990
+ */ var Entity = /*#__PURE__*/ function(EngineObject1) {
3991
+ _inherits(Entity, EngineObject1);
3961
3992
  function Entity(engine, name) {
3962
3993
  var _this;
3963
- _this = EngineObject.call(this, engine) || this;
3994
+ _this = EngineObject1.call(this, engine) || this;
3964
3995
  /** The layer the entity belongs to. */ _this.layer = exports.Layer.Layer0;
3965
3996
  /** @internal */ _this._isActiveInHierarchy = false;
3966
3997
  /** @internal */ _this._isActiveInScene = false;
@@ -4196,7 +4227,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
4196
4227
  if (this._destroyed) {
4197
4228
  return;
4198
4229
  }
4199
- EngineObject.prototype.destroy.call(this);
4230
+ EngineObject1.prototype.destroy.call(this);
4200
4231
  if (this._hookResource) {
4201
4232
  this._hookResource._addReferCount(-1);
4202
4233
  this._hookResource = null;
@@ -4211,11 +4242,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
4211
4242
  children[0].destroy();
4212
4243
  }
4213
4244
  if (this._isRoot) {
4214
- this._scene._removeFromEntityList(this);
4215
- this._isRoot = false;
4245
+ this._scene.removeRootEntity(this);
4216
4246
  } else {
4217
- this._removeFromParent();
4247
+ this._setParent(null);
4218
4248
  }
4249
+ this.isActive = false;
4219
4250
  };
4220
4251
  /**
4221
4252
  * @internal
@@ -4459,8 +4490,9 @@ var ComponentCloner = /*#__PURE__*/ function() {
4459
4490
  if (this._isRoot && this._scene._isActiveInEngine) {
4460
4491
  activeChangeFlag |= ActiveChangeFlag.All;
4461
4492
  } else {
4462
- (parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
4463
- (parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
4493
+ var _parent, _parent1;
4494
+ ((_parent = parent) == null ? void 0 : _parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
4495
+ ((_parent1 = parent) == null ? void 0 : _parent1._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
4464
4496
  }
4465
4497
  activeChangeFlag && this._processActive(activeChangeFlag);
4466
4498
  } else {
@@ -4670,6 +4702,7 @@ exports.RenderStateDataKey = void 0;
4670
4702
  RenderStateElementKey[RenderStateElementKey[/** Raster state fill mode key. */ "RasterStateCullMode"] = 25] = "RasterStateCullMode";
4671
4703
  RenderStateElementKey[RenderStateElementKey[/** Raster state cull mode key. */ "RasterStateDepthBias"] = 26] = "RasterStateDepthBias";
4672
4704
  RenderStateElementKey[RenderStateElementKey[/** Raster state depth bias key. */ "RasterStateSlopeScaledDepthBias"] = 27] = "RasterStateSlopeScaledDepthBias";
4705
+ RenderStateElementKey[RenderStateElementKey[/** Render queue type key. */ "RenderQueueType"] = 28] = "RenderQueueType";
4673
4706
  })(exports.RenderStateDataKey || (exports.RenderStateDataKey = {}));
4674
4707
 
4675
4708
  /**
@@ -5191,14 +5224,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
5191
5224
  return src.replace(regex, replace);
5192
5225
  };
5193
5226
  /**
5194
- * GLSL extension.
5195
- * @param extensions - such as ["GL_EXT_shader_texture_lod"]
5196
- * */ ShaderFactory.parseExtension = function parseExtension(extensions) {
5197
- return extensions.map(function(e) {
5198
- return "#extension " + e + " : enable\n";
5199
- }).join("");
5200
- };
5201
- /**
5202
5227
  * Convert lower GLSL version to GLSL 300 es.
5203
5228
  * @param shader - code
5204
5229
  * @param isFrag - Whether it is a fragment shader.
@@ -5237,6 +5262,15 @@ var ShaderFactory = /*#__PURE__*/ function() {
5237
5262
  };
5238
5263
  return ShaderFactory;
5239
5264
  }();
5265
+ (function() {
5266
+ /** @internal */ ShaderFactory._shaderExtension = [
5267
+ "GL_EXT_shader_texture_lod",
5268
+ "GL_OES_standard_derivatives",
5269
+ "GL_EXT_draw_buffers"
5270
+ ].map(function(e) {
5271
+ return "#extension " + e + " : enable\n";
5272
+ }).join("");
5273
+ })();
5240
5274
 
5241
5275
  /**
5242
5276
  * Shader tag key.
@@ -5284,6 +5318,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
5284
5318
  _proto.getTagValue = function getTagValue(keyOrKeyName) {
5285
5319
  return this._tagsMap[typeof keyOrKeyName == "string" ? ShaderTagKey.getByName(keyOrKeyName)._uniqueId : keyOrKeyName._uniqueId];
5286
5320
  };
5321
+ _create_class(ShaderPart, [
5322
+ {
5323
+ key: "name",
5324
+ get: /**
5325
+ * Name.
5326
+ */ function get() {
5327
+ return this._name;
5328
+ }
5329
+ }
5330
+ ]);
5287
5331
  return ShaderPart;
5288
5332
  }();
5289
5333
 
@@ -5901,19 +5945,29 @@ var ShaderFactory = /*#__PURE__*/ function() {
5901
5945
 
5902
5946
  /**
5903
5947
  * Shader pass containing vertex and fragment source.
5904
- */ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
5905
- _inherits(ShaderPass, ShaderPart);
5906
- function ShaderPass(vertexSource, fragmentSource, tags) {
5907
- if (tags === void 0) tags = {
5908
- pipelineStage: exports.PipelineStage.Forward
5909
- };
5948
+ */ var ShaderPass = /*#__PURE__*/ function(ShaderPart1) {
5949
+ _inherits(ShaderPass, ShaderPart1);
5950
+ function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSource, fragmentSourceOrTags, tags) {
5910
5951
  var _this;
5911
- _this = ShaderPart.call(this) || this;
5952
+ _this = ShaderPart1.call(this) || this;
5912
5953
  /** @internal */ _this._shaderPassId = 0;
5913
5954
  /** @internal */ _this._renderStateDataMap = {};
5914
5955
  _this._shaderPassId = ShaderPass._shaderPassCounter++;
5915
- _this._vertexSource = vertexSource;
5916
- _this._fragmentSource = fragmentSource;
5956
+ if (typeof fragmentSourceOrTags === "string") {
5957
+ _this._name = nameOrVertexSource;
5958
+ _this._vertexSource = vertexSourceOrFragmentSource;
5959
+ _this._fragmentSource = fragmentSourceOrTags;
5960
+ tags = tags != null ? tags : {
5961
+ pipelineStage: exports.PipelineStage.Forward
5962
+ };
5963
+ } else {
5964
+ _this._name = "Default";
5965
+ _this._vertexSource = nameOrVertexSource;
5966
+ _this._fragmentSource = vertexSourceOrFragmentSource;
5967
+ tags = fragmentSourceOrTags != null ? fragmentSourceOrTags : {
5968
+ pipelineStage: exports.PipelineStage.Forward
5969
+ };
5970
+ }
5917
5971
  for(var key in tags){
5918
5972
  _this.setTag(key, tags[key]);
5919
5973
  }
@@ -5942,7 +5996,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
5942
5996
  precisionStr += "#define HAS_DERIVATIVES\n";
5943
5997
  }
5944
5998
  var vertexSource = " " + versionStr + "\n " + graphicAPI + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._vertexSource);
5945
- var fragmentSource = " " + versionStr + "\n " + graphicAPI + "\n " + (isWebGL2 ? "" : ShaderFactory.parseExtension(Shader._shaderExtension)) + "\n " + precisionStr + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._fragmentSource);
5999
+ var fragmentSource = " " + versionStr + "\n " + graphicAPI + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._fragmentSource);
5946
6000
  if (isWebGL2) {
5947
6001
  vertexSource = ShaderFactory.convertTo300(vertexSource);
5948
6002
  fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
@@ -5959,12 +6013,12 @@ var ShaderFactory = /*#__PURE__*/ function() {
5959
6013
 
5960
6014
  /**
5961
6015
  * Sub shader.
5962
- */ var SubShader = /*#__PURE__*/ function(ShaderPart) {
5963
- _inherits(SubShader, ShaderPart);
6016
+ */ var SubShader = /*#__PURE__*/ function(ShaderPart1) {
6017
+ _inherits(SubShader, ShaderPart1);
5964
6018
  function SubShader(name, passes, tags) {
5965
6019
  var _this;
5966
- _this = ShaderPart.call(this) || this;
5967
- _this.name = name;
6020
+ _this = ShaderPart1.call(this) || this;
6021
+ _this._name = name;
5968
6022
  var passCount = passes.length;
5969
6023
  if (passCount < 1) {
5970
6024
  throw " count must large than 0.";
@@ -6538,6 +6592,11 @@ var ShaderFactory = /*#__PURE__*/ function() {
6538
6592
  this.depthState._applyShaderDataValue(renderStateDataMap, shaderData);
6539
6593
  this.stencilState._applyShaderDataValue(renderStateDataMap, shaderData);
6540
6594
  this.rasterState._applyShaderDataValue(renderStateDataMap, shaderData);
6595
+ var renderQueueType = renderStateDataMap[exports.RenderStateDataKey.RenderQueueType];
6596
+ if (renderQueueType !== undefined) {
6597
+ var _shaderData_getFloat;
6598
+ this.renderQueueType = (_shaderData_getFloat = shaderData.getFloat(renderQueueType)) != null ? _shaderData_getFloat : exports.RenderQueueType.Opaque;
6599
+ }
6541
6600
  };
6542
6601
  /**
6543
6602
  * @internal
@@ -6602,14 +6661,24 @@ var ShaderFactory = /*#__PURE__*/ function() {
6602
6661
  var shaderInfo = Shader._shaderLab.parseShader(nameOrShaderSource);
6603
6662
  var subShaderList = shaderInfo.subShaders.map(function(subShaderInfo) {
6604
6663
  var passList = subShaderInfo.passes.map(function(passInfo) {
6605
- var shaderPass = new ShaderPass(passInfo.vertexSource, passInfo.fragmentSource, passInfo.tags);
6664
+ if (typeof passInfo === "string") {
6665
+ var _Shader_find_subShaders_find, _Shader_find;
6666
+ // Use pass reference
6667
+ var paths = passInfo.split("/");
6668
+ return (_Shader_find = Shader.find(paths[0])) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
6669
+ return subShader.name === paths[1];
6670
+ })) == null ? void 0 : _Shader_find_subShaders_find.passes.find(function(pass) {
6671
+ return pass.name === paths[2];
6672
+ });
6673
+ }
6674
+ var shaderPass = new ShaderPass(passInfo.name, passInfo.vertexSource, passInfo.fragmentSource, passInfo.tags);
6606
6675
  var renderStates = passInfo.renderStates;
6607
6676
  var renderState = new RenderState();
6608
6677
  shaderPass._renderState = renderState;
6609
6678
  // Parse const render state
6610
6679
  var constRenderStateInfo = renderStates[0];
6611
6680
  for(var k in constRenderStateInfo){
6612
- Shader._applyConstRenderStates(renderState, k, constRenderStateInfo[k]);
6681
+ Shader._applyConstRenderStates(renderState, parseInt(k), constRenderStateInfo[k]);
6613
6682
  }
6614
6683
  // Parse variable render state
6615
6684
  var variableRenderStateInfo = renderStates[1];
@@ -6739,6 +6808,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
6739
6808
  case exports.RenderStateDataKey.RasterStateSlopeScaledDepthBias:
6740
6809
  renderState.rasterState.slopeScaledDepthBias = value;
6741
6810
  break;
6811
+ case exports.RenderStateDataKey.RenderQueueType:
6812
+ renderState.renderQueueType = value;
6813
+ break;
6742
6814
  }
6743
6815
  };
6744
6816
  Shader.getMacroByName = function getMacroByName(name, value) {
@@ -6768,13 +6840,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
6768
6840
  (function() {
6769
6841
  /** @internal */ Shader._compileMacros = new ShaderMacroCollection();
6770
6842
  })();
6771
- (function() {
6772
- /** @internal */ Shader._shaderExtension = [
6773
- "GL_EXT_shader_texture_lod",
6774
- "GL_OES_standard_derivatives",
6775
- "GL_EXT_draw_buffers"
6776
- ];
6777
- })();
6778
6843
  (function() {
6779
6844
  Shader._shaderMap = Object.create(null);
6780
6845
  })();
@@ -7105,11 +7170,11 @@ var RenderElement = /*#__PURE__*/ function() {
7105
7170
 
7106
7171
  // @ts-ignore
7107
7172
  var _Renderer;
7108
- exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
7109
- _inherits(Renderer1, Component);
7173
+ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component1) {
7174
+ _inherits(Renderer1, Component1);
7110
7175
  function Renderer1(entity) {
7111
7176
  var _this;
7112
- _this = Component.call(this, entity) || this;
7177
+ _this = Component1.call(this, entity) || this;
7113
7178
  /** @internal */ _this._onUpdateIndex = -1;
7114
7179
  /** @internal */ _this._rendererIndex = -1;
7115
7180
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
@@ -7255,7 +7320,7 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
7255
7320
  /**
7256
7321
  * @internal
7257
7322
  */ _proto._onDestroy = function _onDestroy() {
7258
- Component.prototype._onDestroy.call(this);
7323
+ Component1.prototype._onDestroy.call(this);
7259
7324
  this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
7260
7325
  this.shaderData._addReferCount(-1);
7261
7326
  var materials = this._materials;
@@ -7653,11 +7718,11 @@ SimpleSpriteAssembler = __decorate([
7653
7718
 
7654
7719
  /**
7655
7720
  * A component for masking Sprites.
7656
- */ var SpriteMask = /*#__PURE__*/ function(Renderer) {
7657
- _inherits(SpriteMask, Renderer);
7721
+ */ var SpriteMask = /*#__PURE__*/ function(Renderer1) {
7722
+ _inherits(SpriteMask, Renderer1);
7658
7723
  function SpriteMask(entity) {
7659
7724
  var _this;
7660
- _this = Renderer.call(this, entity) || this;
7725
+ _this = Renderer1.call(this, entity) || this;
7661
7726
  /** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
7662
7727
  _this._sprite = null;
7663
7728
  _this._automaticWidth = 0;
@@ -7678,7 +7743,7 @@ SimpleSpriteAssembler = __decorate([
7678
7743
  /**
7679
7744
  * @internal
7680
7745
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
7681
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
7746
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
7682
7747
  target.sprite = this._sprite;
7683
7748
  };
7684
7749
  /**
@@ -7721,7 +7786,7 @@ SimpleSpriteAssembler = __decorate([
7721
7786
  * @internal
7722
7787
  * @inheritdoc
7723
7788
  */ _proto._onDestroy = function _onDestroy() {
7724
- Renderer.prototype._onDestroy.call(this);
7789
+ Renderer1.prototype._onDestroy.call(this);
7725
7790
  var sprite = this._sprite;
7726
7791
  if (sprite) {
7727
7792
  sprite._addReferCount(-1);
@@ -8166,13 +8231,13 @@ var BufferUtil = /*#__PURE__*/ function() {
8166
8231
 
8167
8232
  /**
8168
8233
  * Buffer.
8169
- */ var Buffer = /*#__PURE__*/ function(GraphicsResource) {
8170
- _inherits(Buffer, GraphicsResource);
8234
+ */ var Buffer = /*#__PURE__*/ function(GraphicsResource1) {
8235
+ _inherits(Buffer, GraphicsResource1);
8171
8236
  function Buffer(engine, type, byteLengthOrData, bufferUsage, readable) {
8172
8237
  if (bufferUsage === void 0) bufferUsage = exports.BufferUsage.Static;
8173
8238
  if (readable === void 0) readable = false;
8174
8239
  var _this;
8175
- _this = GraphicsResource.call(this, engine) || this;
8240
+ _this = GraphicsResource1.call(this, engine) || this;
8176
8241
  /** @internal */ _this._dataUpdateManager = new UpdateFlagManager();
8177
8242
  _this._engine = engine;
8178
8243
  _this._type = type;
@@ -8239,7 +8304,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8239
8304
  /**
8240
8305
  * @internal
8241
8306
  */ _proto._onDestroy = function _onDestroy() {
8242
- GraphicsResource.prototype._onDestroy.call(this);
8307
+ GraphicsResource1.prototype._onDestroy.call(this);
8243
8308
  this._platformBuffer.destroy();
8244
8309
  };
8245
8310
  _create_class(Buffer, [
@@ -8363,11 +8428,11 @@ var BufferUtil = /*#__PURE__*/ function() {
8363
8428
  /**
8364
8429
  * @internal
8365
8430
  * Primitive.
8366
- */ var Primitive = /*#__PURE__*/ function(GraphicsResource) {
8367
- _inherits(Primitive, GraphicsResource);
8431
+ */ var Primitive = /*#__PURE__*/ function(GraphicsResource1) {
8432
+ _inherits(Primitive, GraphicsResource1);
8368
8433
  function Primitive(engine) {
8369
8434
  var _this;
8370
- _this = GraphicsResource.call(this, engine) || this;
8435
+ _this = GraphicsResource1.call(this, engine) || this;
8371
8436
  _this.enableVAO = true;
8372
8437
  _this.instanceCount = 0;
8373
8438
  _this.vertexBufferBindings = [];
@@ -8432,9 +8497,9 @@ var BufferUtil = /*#__PURE__*/ function() {
8432
8497
  var referCount = this._getReferCount();
8433
8498
  var vertexBufferBindings = this.vertexBufferBindings;
8434
8499
  if (referCount > 0) {
8435
- var _vertexBufferBindings_index;
8500
+ var _vertexBufferBindings_index, _binding;
8436
8501
  (_vertexBufferBindings_index = vertexBufferBindings[index]) == null ? void 0 : _vertexBufferBindings_index.buffer._addReferCount(-referCount);
8437
- binding == null ? void 0 : binding.buffer._addReferCount(referCount);
8502
+ (_binding = binding) == null ? void 0 : _binding.buffer._addReferCount(referCount);
8438
8503
  }
8439
8504
  vertexBufferBindings[index] = binding;
8440
8505
  this._bufferStructChanged = true;
@@ -8457,8 +8522,9 @@ var BufferUtil = /*#__PURE__*/ function() {
8457
8522
  var lastBinding = this.indexBufferBinding;
8458
8523
  var referCount = this._getReferCount();
8459
8524
  if (lastBinding !== binding) {
8525
+ var _lastBinding, _lastBinding1, _binding;
8460
8526
  this._indexBufferBinding = binding;
8461
- referCount > 0 && (lastBinding == null ? void 0 : lastBinding.buffer._addReferCount(-referCount));
8527
+ referCount > 0 && ((_lastBinding = lastBinding) == null ? void 0 : _lastBinding.buffer._addReferCount(-referCount));
8462
8528
  if (binding) {
8463
8529
  referCount > 0 && binding.buffer._addReferCount(referCount);
8464
8530
  this._glIndexType = BufferUtil._getGLIndexType(binding.format);
@@ -8466,7 +8532,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8466
8532
  } else {
8467
8533
  this._glIndexType = undefined;
8468
8534
  }
8469
- this._bufferStructChanged = (lastBinding == null ? void 0 : lastBinding.buffer) !== (binding == null ? void 0 : binding.buffer);
8535
+ this._bufferStructChanged = ((_lastBinding1 = lastBinding) == null ? void 0 : _lastBinding1.buffer) !== ((_binding = binding) == null ? void 0 : _binding.buffer);
8470
8536
  }
8471
8537
  };
8472
8538
  _proto.draw = function draw(shaderProgram, subMesh) {
@@ -8475,7 +8541,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8475
8541
  };
8476
8542
  _proto._addReferCount = function _addReferCount(value) {
8477
8543
  var _this_indexBufferBinding;
8478
- GraphicsResource.prototype._addReferCount.call(this, value);
8544
+ GraphicsResource1.prototype._addReferCount.call(this, value);
8479
8545
  var vertexBufferBindings = this.vertexBufferBindings;
8480
8546
  for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
8481
8547
  var _vertexBufferBindings_i;
@@ -8510,11 +8576,11 @@ var BufferUtil = /*#__PURE__*/ function() {
8510
8576
 
8511
8577
  /**
8512
8578
  * Mesh.
8513
- */ var Mesh = /*#__PURE__*/ function(ReferResource) {
8514
- _inherits(Mesh, ReferResource);
8579
+ */ var Mesh = /*#__PURE__*/ function(ReferResource1) {
8580
+ _inherits(Mesh, ReferResource1);
8515
8581
  function Mesh(engine, name) {
8516
8582
  var _this;
8517
- _this = ReferResource.call(this, engine) || this;
8583
+ _this = ReferResource1.call(this, engine) || this;
8518
8584
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
8519
8585
  _this._bounds = new miniprogram.BoundingBox();
8520
8586
  _this._subMeshes = [];
@@ -8589,13 +8655,13 @@ var BufferUtil = /*#__PURE__*/ function() {
8589
8655
  this._primitive.setVertexBufferBinding(index, binding);
8590
8656
  };
8591
8657
  _proto._addReferCount = function _addReferCount(value) {
8592
- ReferResource.prototype._addReferCount.call(this, value);
8658
+ ReferResource1.prototype._addReferCount.call(this, value);
8593
8659
  this._primitive._addReferCount(value);
8594
8660
  };
8595
8661
  /**
8596
8662
  * @internal
8597
8663
  */ _proto._onDestroy = function _onDestroy() {
8598
- ReferResource.prototype._onDestroy.call(this);
8664
+ ReferResource1.prototype._onDestroy.call(this);
8599
8665
  this._primitive.destroy();
8600
8666
  };
8601
8667
  /**
@@ -8841,10 +8907,10 @@ var BlendShapeFrameDirty;
8841
8907
 
8842
8908
  /**
8843
8909
  * BufferMesh.
8844
- */ var BufferMesh = /*#__PURE__*/ function(Mesh) {
8845
- _inherits(BufferMesh, Mesh);
8910
+ */ var BufferMesh = /*#__PURE__*/ function(Mesh1) {
8911
+ _inherits(BufferMesh, Mesh1);
8846
8912
  function BufferMesh() {
8847
- return Mesh.apply(this, arguments);
8913
+ return Mesh1.apply(this, arguments);
8848
8914
  }
8849
8915
  var _proto = BufferMesh.prototype;
8850
8916
  /**
@@ -8927,11 +8993,11 @@ var BlendShapeFrameDirty;
8927
8993
 
8928
8994
  /**
8929
8995
  * MeshRenderer Component.
8930
- */ var MeshRenderer = /*#__PURE__*/ function(Renderer) {
8931
- _inherits(MeshRenderer, Renderer);
8996
+ */ var MeshRenderer = /*#__PURE__*/ function(Renderer1) {
8997
+ _inherits(MeshRenderer, Renderer1);
8932
8998
  function MeshRenderer(entity) {
8933
8999
  var _this;
8934
- _this = Renderer.call(this, entity) || this;
9000
+ _this = Renderer1.call(this, entity) || this;
8935
9001
  _this._enableVertexColor = false;
8936
9002
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
8937
9003
  return _this;
@@ -8940,7 +9006,7 @@ var BlendShapeFrameDirty;
8940
9006
  /**
8941
9007
  * @internal
8942
9008
  */ _proto._onDestroy = function _onDestroy() {
8943
- Renderer.prototype._onDestroy.call(this);
9009
+ Renderer1.prototype._onDestroy.call(this);
8944
9010
  var mesh = this._mesh;
8945
9011
  if (mesh) {
8946
9012
  mesh.destroyed || mesh._addReferCount(-1);
@@ -8951,7 +9017,7 @@ var BlendShapeFrameDirty;
8951
9017
  /**
8952
9018
  * @internal
8953
9019
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
8954
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
9020
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
8955
9021
  target.mesh = this._mesh;
8956
9022
  };
8957
9023
  /**
@@ -8961,7 +9027,7 @@ var BlendShapeFrameDirty;
8961
9027
  Logger.error("mesh is null.");
8962
9028
  return;
8963
9029
  }
8964
- Renderer.prototype._prepareRender.call(this, context);
9030
+ Renderer1.prototype._prepareRender.call(this, context);
8965
9031
  };
8966
9032
  /**
8967
9033
  * @internal
@@ -9574,11 +9640,11 @@ var /**
9574
9640
 
9575
9641
  /**
9576
9642
  * Mesh containing common vertex elements of the model.
9577
- */ var ModelMesh = /*#__PURE__*/ function(Mesh) {
9578
- _inherits(ModelMesh, Mesh);
9643
+ */ var ModelMesh = /*#__PURE__*/ function(Mesh1) {
9644
+ _inherits(ModelMesh, Mesh1);
9579
9645
  function ModelMesh(engine, name) {
9580
9646
  var _this;
9581
- _this = Mesh.call(this, engine) || this;
9647
+ _this = Mesh1.call(this, engine) || this;
9582
9648
  /** @internal */ _this._internalVertexBufferIndex = -1;
9583
9649
  _this._vertexCount = 0;
9584
9650
  _this._vertexCountDirty = false;
@@ -9621,13 +9687,14 @@ var /**
9621
9687
  * Set positions for the mesh.
9622
9688
  * @param positions - The positions for the mesh
9623
9689
  */ _proto.setPositions = function setPositions(positions) {
9690
+ var _positions;
9624
9691
  if (!this._positions && !positions) {
9625
9692
  return;
9626
9693
  }
9627
9694
  this._updateAdvancedVertexDataMarks(0x1, 0);
9628
9695
  this._positions = positions;
9629
9696
  var _positions_length;
9630
- this._vertexCount = (_positions_length = positions == null ? void 0 : positions.length) != null ? _positions_length : 0;
9697
+ this._vertexCount = (_positions_length = (_positions = positions) == null ? void 0 : _positions.length) != null ? _positions_length : 0;
9631
9698
  this._vertexCountDirty = false;
9632
9699
  };
9633
9700
  /**
@@ -9954,9 +10021,10 @@ var /**
9954
10021
  var vertexBufferInfos = this._vertexBufferInfos;
9955
10022
  var vertexBufferBindings = this._primitive.vertexBufferBindings;
9956
10023
  for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
10024
+ var _vertexBufferInfo;
9957
10025
  var vertexBufferInfo = vertexBufferInfos[i];
9958
10026
  // VertexBufferInfo maybe undefined
9959
- if (vertexBufferInfo == null ? void 0 : vertexBufferInfo.uploadAdvancedData) {
10027
+ if ((_vertexBufferInfo = vertexBufferInfo) == null ? void 0 : _vertexBufferInfo.uploadAdvancedData) {
9960
10028
  var _vertexBufferBindings_i;
9961
10029
  var buffer = (_vertexBufferBindings_i = vertexBufferBindings[i]) == null ? void 0 : _vertexBufferBindings_i.buffer;
9962
10030
  buffer.setData(buffer.data);
@@ -9971,7 +10039,8 @@ var /**
9971
10039
  var indexBuffer = (_this__primitive_indexBufferBinding = this._primitive.indexBufferBinding) == null ? void 0 : _this__primitive_indexBufferBinding._buffer;
9972
10040
  if (indices) {
9973
10041
  if (!indexBuffer || indices.byteLength != indexBuffer.byteLength) {
9974
- indexBuffer == null ? void 0 : indexBuffer.destroy();
10042
+ var _indexBuffer;
10043
+ (_indexBuffer = indexBuffer) == null ? void 0 : _indexBuffer.destroy();
9975
10044
  var newIndexBuffer = new Buffer(this._engine, exports.BufferBindFlag.IndexBuffer, indices);
9976
10045
  this._setIndexBufferBinding(new IndexBufferBinding(newIndexBuffer, this._indicesFormat));
9977
10046
  } else {
@@ -10081,7 +10150,7 @@ var /**
10081
10150
  // Remove listener from previous binding
10082
10151
  var previousBinding = vertexBufferBindings[index];
10083
10152
  previousBinding && previousBinding.buffer._dataUpdateManager.removeListener(onVertexBufferChanged);
10084
- Mesh.prototype._setVertexBufferBinding.call(this, index, binding);
10153
+ Mesh1.prototype._setVertexBufferBinding.call(this, index, binding);
10085
10154
  // Add listener to new binding and trigger update
10086
10155
  if (binding) {
10087
10156
  var _updateInfos, _index;
@@ -10113,7 +10182,7 @@ var /**
10113
10182
  /**
10114
10183
  * @internal
10115
10184
  */ _proto._onDestroy = function _onDestroy() {
10116
- Mesh.prototype._onDestroy.call(this);
10185
+ Mesh1.prototype._onDestroy.call(this);
10117
10186
  this._releaseCache(true);
10118
10187
  };
10119
10188
  _proto._getVertexElementData = function _getVertexElementData(vertices, vertexAttribute, vertexElementIndex, readVertexData) {
@@ -10189,13 +10258,14 @@ var /**
10189
10258
  });
10190
10259
  };
10191
10260
  _proto._readVertexData = function _readVertexData(attributeType, onVertexParse) {
10261
+ var _bufferBinding;
10192
10262
  var primitive = this._primitive;
10193
10263
  var vertexElement = primitive._vertexElementMap[attributeType];
10194
10264
  if (!vertexElement) {
10195
10265
  return null;
10196
10266
  }
10197
10267
  var bufferBinding = primitive.vertexBufferBindings[vertexElement.bindingIndex];
10198
- var buffer = bufferBinding == null ? void 0 : bufferBinding.buffer;
10268
+ var buffer = (_bufferBinding = bufferBinding) == null ? void 0 : _bufferBinding.buffer;
10199
10269
  if (!buffer) {
10200
10270
  return null;
10201
10271
  }
@@ -10349,11 +10419,12 @@ var /**
10349
10419
  });
10350
10420
  };
10351
10421
  _proto._writeAdvancedVertexData = function _writeAdvancedVertexData(attribute, elementIndex, onVertexWrite) {
10422
+ var _bufferBinding;
10352
10423
  var primitive = this._primitive;
10353
10424
  var vertexElement = primitive._vertexElementMap[attribute];
10354
10425
  var bindingIndex = vertexElement.bindingIndex;
10355
10426
  var bufferBinding = primitive.vertexBufferBindings[bindingIndex];
10356
- var buffer = bufferBinding == null ? void 0 : bufferBinding.buffer;
10427
+ var buffer = (_bufferBinding = bufferBinding) == null ? void 0 : _bufferBinding.buffer;
10357
10428
  if (!buffer) {
10358
10429
  return;
10359
10430
  }
@@ -10649,11 +10720,11 @@ var VertexElementIndex;
10649
10720
 
10650
10721
  /**
10651
10722
  * @internal
10652
- */ var PrimitiveMeshRestorer = /*#__PURE__*/ function(ContentRestorer) {
10653
- _inherits(PrimitiveMeshRestorer, ContentRestorer);
10723
+ */ var PrimitiveMeshRestorer = /*#__PURE__*/ function(ContentRestorer1) {
10724
+ _inherits(PrimitiveMeshRestorer, ContentRestorer1);
10654
10725
  function PrimitiveMeshRestorer(resource, primitiveInfo) {
10655
10726
  var _this;
10656
- _this = ContentRestorer.call(this, resource) || this;
10727
+ _this = ContentRestorer1.call(this, resource) || this;
10657
10728
  _this.primitiveInfo = primitiveInfo;
10658
10729
  return _this;
10659
10730
  }
@@ -11658,11 +11729,11 @@ var PrimitiveType;
11658
11729
 
11659
11730
  /**
11660
11731
  * Mesh skin data, equal glTF skins define
11661
- */ var Skin = /*#__PURE__*/ function(EngineObject) {
11662
- _inherits(Skin, EngineObject);
11732
+ */ var Skin = /*#__PURE__*/ function(EngineObject1) {
11733
+ _inherits(Skin, EngineObject1);
11663
11734
  function Skin(name) {
11664
11735
  var _this;
11665
- _this = EngineObject.call(this, null) || this;
11736
+ _this = EngineObject1.call(this, null) || this;
11666
11737
  _this.name = name;
11667
11738
  _this._bones = [];
11668
11739
  _this.inverseBindMatrices = []; // inverse bind matrix array
@@ -11675,11 +11746,11 @@ var PrimitiveType;
11675
11746
 
11676
11747
  /**
11677
11748
  * SkinnedMeshRenderer.
11678
- */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
11679
- _inherits(SkinnedMeshRenderer, MeshRenderer);
11749
+ */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer1) {
11750
+ _inherits(SkinnedMeshRenderer, MeshRenderer1);
11680
11751
  function SkinnedMeshRenderer(entity) {
11681
11752
  var _this;
11682
- _this = MeshRenderer.call(this, entity) || this;
11753
+ _this = MeshRenderer1.call(this, entity) || this;
11683
11754
  _this._jointDataCreateCache = new miniprogram.Vector2(-1, -1);
11684
11755
  _this._localBounds = new miniprogram.BoundingBox();
11685
11756
  _this._skin = null;
@@ -11777,7 +11848,7 @@ var PrimitiveType;
11777
11848
  * @internal
11778
11849
  */ _proto._onDestroy = function _onDestroy() {
11779
11850
  var _this__rootBone, _this__jointTexture;
11780
- MeshRenderer.prototype._onDestroy.call(this);
11851
+ MeshRenderer1.prototype._onDestroy.call(this);
11781
11852
  (_this__rootBone = this._rootBone) == null ? void 0 : _this__rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
11782
11853
  this._rootBone = null;
11783
11854
  this._jointDataCreateCache = null;
@@ -11792,7 +11863,7 @@ var PrimitiveType;
11792
11863
  /**
11793
11864
  * @internal
11794
11865
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
11795
- MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
11866
+ MeshRenderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
11796
11867
  var paths = new Array();
11797
11868
  // Clone rootBone
11798
11869
  if (this.rootBone) {
@@ -11826,7 +11897,7 @@ var PrimitiveType;
11826
11897
  var worldMatrix = this._rootBone.transform.worldMatrix;
11827
11898
  miniprogram.BoundingBox.transform(localBounds, worldMatrix, worldBounds);
11828
11899
  } else {
11829
- MeshRenderer.prototype._updateBounds.call(this, worldBounds);
11900
+ MeshRenderer1.prototype._updateBounds.call(this, worldBounds);
11830
11901
  }
11831
11902
  };
11832
11903
  _proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
@@ -11935,11 +12006,11 @@ var PrimitiveType;
11935
12006
  },
11936
12007
  set: function set(value) {
11937
12008
  if (this._bones !== value) {
11938
- var _this__bones;
12009
+ var _this__bones, _value;
11939
12010
  var _this__bones_length;
11940
12011
  var lastBoneCount = (_this__bones_length = (_this__bones = this._bones) == null ? void 0 : _this__bones.length) != null ? _this__bones_length : 0;
11941
12012
  var _value_length;
11942
- var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
12013
+ var boneCount = (_value_length = (_value = value) == null ? void 0 : _value.length) != null ? _value_length : 0;
11943
12014
  if (lastBoneCount !== boneCount) {
11944
12015
  var shaderData = this.shaderData;
11945
12016
  if (boneCount > 0) {
@@ -12185,10 +12256,10 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12185
12256
  Basic2DBatcher._canUploadSameBuffer = true;
12186
12257
  })();
12187
12258
 
12188
- var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
12189
- _inherits(SpriteMaskBatcher, Basic2DBatcher);
12259
+ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
12260
+ _inherits(SpriteMaskBatcher, Basic2DBatcher1);
12190
12261
  function SpriteMaskBatcher() {
12191
- return Basic2DBatcher.apply(this, arguments);
12262
+ return Basic2DBatcher1.apply(this, arguments);
12192
12263
  }
12193
12264
  var _proto = SpriteMaskBatcher.prototype;
12194
12265
  _proto.createVertexElements = function createVertexElements(vertexElements) {
@@ -12257,7 +12328,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
12257
12328
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
12258
12329
  program.uploadAll(program.materialUniformBlock, material.shaderData);
12259
12330
  material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
12260
- engine._hardwareRenderer.drawPrimitive(mesh, subMesh, program);
12331
+ engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
12261
12332
  }
12262
12333
  };
12263
12334
  return SpriteMaskBatcher;
@@ -12325,11 +12396,11 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
12325
12396
  return SpriteMaskManager;
12326
12397
  }();
12327
12398
 
12328
- var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData) {
12329
- _inherits(SpriteMaskRenderData, RenderData);
12399
+ var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData1) {
12400
+ _inherits(SpriteMaskRenderData, RenderData1);
12330
12401
  function SpriteMaskRenderData() {
12331
12402
  var _this;
12332
- _this = RenderData.call(this) || this;
12403
+ _this = RenderData1.call(this) || this;
12333
12404
  _this.isAdd = true;
12334
12405
  _this.multiRenderData = false;
12335
12406
  return _this;
@@ -12346,11 +12417,11 @@ var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData) {
12346
12417
  return SpriteMaskRenderData;
12347
12418
  }(RenderData);
12348
12419
 
12349
- var SpriteRenderData = /*#__PURE__*/ function(RenderData) {
12350
- _inherits(SpriteRenderData, RenderData);
12420
+ var SpriteRenderData = /*#__PURE__*/ function(RenderData1) {
12421
+ _inherits(SpriteRenderData, RenderData1);
12351
12422
  function SpriteRenderData() {
12352
12423
  var _this;
12353
- _this = RenderData.call(this) || this;
12424
+ _this = RenderData1.call(this) || this;
12354
12425
  _this.multiRenderData = false;
12355
12426
  return _this;
12356
12427
  }
@@ -12369,11 +12440,11 @@ var SpriteRenderData = /*#__PURE__*/ function(RenderData) {
12369
12440
  return SpriteRenderData;
12370
12441
  }(RenderData);
12371
12442
 
12372
- var TextRenderData = /*#__PURE__*/ function(RenderData) {
12373
- _inherits(TextRenderData, RenderData);
12443
+ var TextRenderData = /*#__PURE__*/ function(RenderData1) {
12444
+ _inherits(TextRenderData, RenderData1);
12374
12445
  function TextRenderData() {
12375
12446
  var _this;
12376
- _this = RenderData.call(this) || this;
12447
+ _this = RenderData1.call(this) || this;
12377
12448
  _this.charsData = [];
12378
12449
  _this.multiRenderData = true;
12379
12450
  return _this;
@@ -12419,6 +12490,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
12419
12490
  AssetType[/** HDR to cube. */ "HDR"] = "HDR";
12420
12491
  AssetType[/** Font. */ "Font"] = "Font";
12421
12492
  AssetType[/** Source Font, include ttf、 otf and woff. */ "SourceFont"] = "SourceFont";
12493
+ AssetType[/** Project asset. */ "Project"] = "project";
12422
12494
  })(exports.AssetType || (exports.AssetType = {}));
12423
12495
 
12424
12496
  var SafeLoopArray = /*#__PURE__*/ function() {
@@ -13705,11 +13777,11 @@ SystemInfo._initialize();
13705
13777
  CameraClearFlags[CameraClearFlags[/* Clear color with scene background, depth, and stencil. */ "All"] = 0x7] = "All";
13706
13778
  })(exports.CameraClearFlags || (exports.CameraClearFlags = {}));
13707
13779
 
13708
- exports.Collider = /*#__PURE__*/ function(Component) {
13709
- _inherits(Collider, Component);
13780
+ exports.Collider = /*#__PURE__*/ function(Component1) {
13781
+ _inherits(Collider, Component1);
13710
13782
  function Collider(entity) {
13711
13783
  var _this;
13712
- _this = Component.call(this, entity) || this;
13784
+ _this = Component1.call(this, entity) || this;
13713
13785
  /** @internal */ _this._index = -1;
13714
13786
  _this._shapes = [];
13715
13787
  _this._updateFlag = _this.entity.transform.registerWorldChangeFlag();
@@ -13784,7 +13856,7 @@ exports.Collider = /*#__PURE__*/ function(Component) {
13784
13856
  /**
13785
13857
  * @internal
13786
13858
  */ _proto._onDestroy = function _onDestroy() {
13787
- Component.prototype._onDestroy.call(this);
13859
+ Component1.prototype._onDestroy.call(this);
13788
13860
  this.clearShapes();
13789
13861
  this._nativeCollider.destroy();
13790
13862
  };
@@ -14090,11 +14162,11 @@ var Collision = function Collision() {
14090
14162
 
14091
14163
  /**
14092
14164
  * The character controllers.
14093
- */ var CharacterController = /*#__PURE__*/ function(Collider) {
14094
- _inherits(CharacterController, Collider);
14165
+ */ var CharacterController = /*#__PURE__*/ function(Collider1) {
14166
+ _inherits(CharacterController, Collider1);
14095
14167
  function CharacterController(entity) {
14096
14168
  var _this;
14097
- _this = Collider.call(this, entity) || this;
14169
+ _this = Collider1.call(this, entity) || this;
14098
14170
  _this._stepOffset = 0.5;
14099
14171
  _this._nonWalkableMode = exports.ControllerNonWalkableMode.PreventClimbing;
14100
14172
  _this._upDirection = new miniprogram.Vector3(0, 1, 0);
@@ -14122,14 +14194,14 @@ var Collision = function Collision() {
14122
14194
  if (this._shapes.length > 0) {
14123
14195
  throw "only allow single shape on controller!";
14124
14196
  }
14125
- Collider.prototype.addShape.call(this, shape);
14197
+ Collider1.prototype.addShape.call(this, shape);
14126
14198
  this._updateFlag.flag = true;
14127
14199
  };
14128
14200
  /**
14129
14201
  * Remove all shape attached.
14130
14202
  */ _proto.clearShapes = function clearShapes() {
14131
14203
  if (this._shapes.length > 0) {
14132
- Collider.prototype.removeShape.call(this, this._shapes[0]);
14204
+ Collider1.prototype.removeShape.call(this, this._shapes[0]);
14133
14205
  }
14134
14206
  };
14135
14207
  /**
@@ -14229,11 +14301,11 @@ var Collision = function Collision() {
14229
14301
 
14230
14302
  /**
14231
14303
  * A dynamic collider can act with self-defined movement or physical force.
14232
- */ var DynamicCollider = /*#__PURE__*/ function(Collider) {
14233
- _inherits(DynamicCollider, Collider);
14304
+ */ var DynamicCollider = /*#__PURE__*/ function(Collider1) {
14305
+ _inherits(DynamicCollider, Collider1);
14234
14306
  function DynamicCollider(entity) {
14235
14307
  var _this;
14236
- _this = Collider.call(this, entity) || this;
14308
+ _this = Collider1.call(this, entity) || this;
14237
14309
  _this._linearDamping = 0;
14238
14310
  _this._angularDamping = 0.05;
14239
14311
  _this._linearVelocity = new miniprogram.Vector3();
@@ -14638,11 +14710,11 @@ exports.DynamicColliderConstraints = void 0;
14638
14710
  /**
14639
14711
  * A static collider component that will not move.
14640
14712
  * @remarks Mostly used for object which always stays at the same place and never moves around.
14641
- */ var StaticCollider = /*#__PURE__*/ function(Collider) {
14642
- _inherits(StaticCollider, Collider);
14713
+ */ var StaticCollider = /*#__PURE__*/ function(Collider1) {
14714
+ _inherits(StaticCollider, Collider1);
14643
14715
  function StaticCollider(entity) {
14644
14716
  var _this;
14645
- _this = Collider.call(this, entity) || this;
14717
+ _this = Collider1.call(this, entity) || this;
14646
14718
  var transform = _this.entity.transform;
14647
14719
  _this._nativeCollider = PhysicsScene._nativePhysics.createStaticCollider(transform.worldPosition, transform.worldRotationQuaternion);
14648
14720
  return _this;
@@ -14668,11 +14740,11 @@ exports.DynamicColliderConstraints = void 0;
14668
14740
  ControllerCollisionFlag[ControllerCollisionFlag[/** Character has collision below. */ "Down"] = 4] = "Down";
14669
14741
  })(exports.ControllerCollisionFlag || (exports.ControllerCollisionFlag = {}));
14670
14742
 
14671
- exports.Joint = /*#__PURE__*/ function(Component) {
14672
- _inherits(Joint, Component);
14743
+ exports.Joint = /*#__PURE__*/ function(Component1) {
14744
+ _inherits(Joint, Component1);
14673
14745
  function Joint(entity) {
14674
14746
  var _this;
14675
- _this = Component.call(this, entity) || this;
14747
+ _this = Component1.call(this, entity) || this;
14676
14748
  _this._connectedCollider = new JointCollider();
14677
14749
  _this._collider = new JointCollider();
14678
14750
  _this._force = 0;
@@ -14811,10 +14883,10 @@ exports.Joint = __decorate([
14811
14883
 
14812
14884
  /*
14813
14885
  * A fixed joint permits no relative movement between two colliders. ie the colliders are glued together.
14814
- */ var FixedJoint = /*#__PURE__*/ function(Joint) {
14815
- _inherits(FixedJoint, Joint);
14886
+ */ var FixedJoint = /*#__PURE__*/ function(Joint1) {
14887
+ _inherits(FixedJoint, Joint1);
14816
14888
  function FixedJoint() {
14817
- return Joint.apply(this, arguments);
14889
+ return Joint1.apply(this, arguments);
14818
14890
  }
14819
14891
  var _proto = FixedJoint.prototype;
14820
14892
  /**
@@ -14832,20 +14904,21 @@ exports.Joint = __decorate([
14832
14904
  * @internal
14833
14905
  */ var HingeJointFlag;
14834
14906
  (function(HingeJointFlag) {
14835
- HingeJointFlag[HingeJointFlag[/** enable the limit */ "LimitEnabled"] = 1] = "LimitEnabled";
14836
- HingeJointFlag[HingeJointFlag[/** enable the drive */ "DriveEnabled"] = 2] = "DriveEnabled";
14837
- HingeJointFlag[HingeJointFlag[/** if the existing velocity is beyond the drive velocity, do not add force */ "DriveFreeSpin"] = 4] = "DriveFreeSpin";
14907
+ HingeJointFlag[HingeJointFlag[/** None. */ "None"] = 0] = "None";
14908
+ HingeJointFlag[HingeJointFlag[/** Enable the limit. */ "LimitEnabled"] = 1] = "LimitEnabled";
14909
+ HingeJointFlag[HingeJointFlag[/** Enable the drive. */ "DriveEnabled"] = 2] = "DriveEnabled";
14910
+ HingeJointFlag[HingeJointFlag[/** If the existing velocity is beyond the drive velocity, do not add force. */ "DriveFreeSpin"] = 4] = "DriveFreeSpin";
14838
14911
  })(HingeJointFlag || (HingeJointFlag = {}));
14839
14912
 
14840
14913
  /**
14841
14914
  * A joint which behaves in a similar way to a hinge or axle.
14842
- */ var HingeJoint = /*#__PURE__*/ function(Joint) {
14843
- _inherits(HingeJoint, Joint);
14915
+ */ var HingeJoint = /*#__PURE__*/ function(Joint1) {
14916
+ _inherits(HingeJoint, Joint1);
14844
14917
  function HingeJoint() {
14845
14918
  var _this;
14846
- _this = Joint.apply(this, arguments) || this;
14919
+ _this = Joint1.apply(this, arguments) || this;
14847
14920
  _this._axis = new miniprogram.Vector3(1, 0, 0);
14848
- _this._hingeFlags = 0;
14921
+ _this._hingeFlags = HingeJointFlag.None;
14849
14922
  _this._useSpring = false;
14850
14923
  return _this;
14851
14924
  }
@@ -14914,9 +14987,9 @@ exports.Joint = __decorate([
14914
14987
  },
14915
14988
  set: function set(value) {
14916
14989
  if (value !== this.useLimits) {
14917
- this._hingeFlags |= HingeJointFlag.LimitEnabled;
14990
+ value ? this._hingeFlags |= HingeJointFlag.LimitEnabled : this._hingeFlags &= ~HingeJointFlag.LimitEnabled;
14991
+ this._nativeJoint.setHingeJointFlag(HingeJointFlag.LimitEnabled, value);
14918
14992
  }
14919
- this._nativeJoint.setHingeJointFlag(HingeJointFlag.LimitEnabled, value);
14920
14993
  }
14921
14994
  },
14922
14995
  {
@@ -14928,9 +15001,9 @@ exports.Joint = __decorate([
14928
15001
  },
14929
15002
  set: function set(value) {
14930
15003
  if (value !== this.useMotor) {
14931
- this._hingeFlags |= HingeJointFlag.DriveEnabled;
15004
+ value ? this._hingeFlags |= HingeJointFlag.DriveEnabled : this._hingeFlags &= ~HingeJointFlag.DriveEnabled;
15005
+ this._nativeJoint.setHingeJointFlag(HingeJointFlag.DriveEnabled, value);
14932
15006
  }
14933
- this._nativeJoint.setHingeJointFlag(HingeJointFlag.DriveEnabled, value);
14934
15007
  }
14935
15008
  },
14936
15009
  {
@@ -14988,11 +15061,11 @@ exports.Joint = __decorate([
14988
15061
 
14989
15062
  /**
14990
15063
  * A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
14991
- */ var SpringJoint = /*#__PURE__*/ function(Joint) {
14992
- _inherits(SpringJoint, Joint);
15064
+ */ var SpringJoint = /*#__PURE__*/ function(Joint1) {
15065
+ _inherits(SpringJoint, Joint1);
14993
15066
  function SpringJoint() {
14994
15067
  var _this;
14995
- _this = Joint.apply(this, arguments) || this;
15068
+ _this = Joint1.apply(this, arguments) || this;
14996
15069
  _this._minDistance = 0;
14997
15070
  _this._maxDistance = 0;
14998
15071
  _this._tolerance = 0.25;
@@ -15247,11 +15320,11 @@ exports.Joint = __decorate([
15247
15320
 
15248
15321
  /**
15249
15322
  * Physical collider shape for box.
15250
- */ var BoxColliderShape = /*#__PURE__*/ function(ColliderShape) {
15251
- _inherits(BoxColliderShape, ColliderShape);
15323
+ */ var BoxColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15324
+ _inherits(BoxColliderShape, ColliderShape1);
15252
15325
  function BoxColliderShape() {
15253
15326
  var _this;
15254
- _this = ColliderShape.call(this) || this;
15327
+ _this = ColliderShape1.call(this) || this;
15255
15328
  _this._size = new miniprogram.Vector3(1, 1, 1);
15256
15329
  _this._nativeShape = PhysicsScene._nativePhysics.createBoxColliderShape(_this._id, _this._size, _this._material._nativeMaterial);
15257
15330
  _this._setSize = _this._setSize.bind(_assert_this_initialized(_this));
@@ -15283,11 +15356,11 @@ exports.Joint = __decorate([
15283
15356
 
15284
15357
  /**
15285
15358
  * Physical collider shape for sphere.
15286
- */ var SphereColliderShape = /*#__PURE__*/ function(ColliderShape) {
15287
- _inherits(SphereColliderShape, ColliderShape);
15359
+ */ var SphereColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15360
+ _inherits(SphereColliderShape, ColliderShape1);
15288
15361
  function SphereColliderShape() {
15289
15362
  var _this;
15290
- _this = ColliderShape.call(this) || this;
15363
+ _this = ColliderShape1.call(this) || this;
15291
15364
  _this._radius = 1;
15292
15365
  _this._nativeShape = PhysicsScene._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
15293
15366
  return _this;
@@ -15313,11 +15386,11 @@ exports.Joint = __decorate([
15313
15386
 
15314
15387
  /**
15315
15388
  * Physical collider shape plane.
15316
- */ var PlaneColliderShape = /*#__PURE__*/ function(ColliderShape) {
15317
- _inherits(PlaneColliderShape, ColliderShape);
15389
+ */ var PlaneColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15390
+ _inherits(PlaneColliderShape, ColliderShape1);
15318
15391
  function PlaneColliderShape() {
15319
15392
  var _this;
15320
- _this = ColliderShape.call(this) || this;
15393
+ _this = ColliderShape1.call(this) || this;
15321
15394
  _this._nativeShape = PhysicsScene._nativePhysics.createPlaneColliderShape(_this._id, _this._material._nativeMaterial);
15322
15395
  return _this;
15323
15396
  }
@@ -15326,11 +15399,11 @@ exports.Joint = __decorate([
15326
15399
 
15327
15400
  /**
15328
15401
  * Physical collider shape for capsule.
15329
- */ var CapsuleColliderShape = /*#__PURE__*/ function(ColliderShape) {
15330
- _inherits(CapsuleColliderShape, ColliderShape);
15402
+ */ var CapsuleColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15403
+ _inherits(CapsuleColliderShape, ColliderShape1);
15331
15404
  function CapsuleColliderShape() {
15332
15405
  var _this;
15333
- _this = ColliderShape.call(this) || this;
15406
+ _this = ColliderShape1.call(this) || this;
15334
15407
  _this._radius = 1;
15335
15408
  _this._height = 2;
15336
15409
  _this._upAxis = exports.ColliderShapeUpAxis.Y;
@@ -15412,44 +15485,55 @@ exports.Joint = __decorate([
15412
15485
  /**
15413
15486
  * @internal
15414
15487
  */ _proto._update = function _update() {
15415
- var _this = this, pointers = _this._pointers, nativeEvents = _this._nativeEvents;
15488
+ var _this = this, pointers = _this._pointers, nativeEvents = _this._nativeEvents, htmlCanvas = _this._htmlCanvas;
15489
+ var _this__canvas = this._canvas, width = _this__canvas.width, height = _this__canvas.height;
15490
+ var clientWidth = htmlCanvas.clientWidth, clientHeight = htmlCanvas.clientHeight;
15491
+ var _htmlCanvas_getBoundingClientRect = htmlCanvas.getBoundingClientRect(), left = _htmlCanvas_getBoundingClientRect.left, top = _htmlCanvas_getBoundingClientRect.top;
15492
+ var widthDPR = width / clientWidth;
15493
+ var heightDPR = height / clientHeight;
15416
15494
  // Clean up the pointer released in the previous frame
15417
- var lastIndex = pointers.length - 1;
15418
- if (lastIndex >= 0) {
15419
- for(var i = lastIndex; i >= 0; i--){
15420
- if (pointers[i].phase === exports.PointerPhase.Leave) {
15421
- pointers.splice(i, 1);
15422
- }
15495
+ for(var i = pointers.length - 1; i >= 0; i--){
15496
+ if (pointers[i].phase === exports.PointerPhase.Leave) {
15497
+ pointers.splice(i, 1);
15423
15498
  }
15424
15499
  }
15425
15500
  // Generate the pointer received for this frame
15426
- lastIndex = nativeEvents.length - 1;
15427
- if (lastIndex >= 0) {
15428
- for(var i1 = 0; i1 <= lastIndex; i1++){
15429
- var _this__getPointer;
15430
- var evt = nativeEvents[i1];
15431
- (_this__getPointer = this._getPointer(evt.pointerId)) == null ? void 0 : _this__getPointer._events.push(evt);
15501
+ for(var i1 = 0, n = nativeEvents.length; i1 < n; i1++){
15502
+ var evt = nativeEvents[i1];
15503
+ var pointerId = evt.pointerId;
15504
+ var pointer = this._getPointerByID(pointerId);
15505
+ if (pointer) {
15506
+ pointer._events.push(evt);
15507
+ } else {
15508
+ var lastCount = pointers.length;
15509
+ if (lastCount === 0 || this._multiPointerEnabled) {
15510
+ var _pointerPool, _i;
15511
+ var _this1 = this, pointerPool = _this1._pointerPool;
15512
+ // Get Pointer smallest index
15513
+ var i2 = 0;
15514
+ for(; i2 < lastCount; i2++){
15515
+ if (pointers[i2].id > i2) {
15516
+ break;
15517
+ }
15518
+ }
15519
+ pointer = (_pointerPool = pointerPool)[_i = i2] || (_pointerPool[_i] = new Pointer(i2));
15520
+ pointer._uniqueID = pointerId;
15521
+ pointer._events.push(evt);
15522
+ pointer.position.set((evt.clientX - left) * widthDPR, (evt.clientY - top) * heightDPR);
15523
+ pointers.splice(i2, 0, pointer);
15524
+ }
15432
15525
  }
15433
- nativeEvents.length = 0;
15434
15526
  }
15527
+ nativeEvents.length = 0;
15435
15528
  // Pointer handles its own events
15436
15529
  this._upList.length = this._downList.length = 0;
15437
15530
  this._buttons = exports.PointerButton.None;
15438
- lastIndex = pointers.length - 1;
15439
- if (lastIndex >= 0) {
15440
- var frameCount = this._engine.time.frameCount;
15441
- var _this__htmlCanvas_getBoundingClientRect = this._htmlCanvas.getBoundingClientRect(), left = _this__htmlCanvas_getBoundingClientRect.left, top = _this__htmlCanvas_getBoundingClientRect.top;
15442
- var _this__htmlCanvas = this._htmlCanvas, clientWidth = _this__htmlCanvas.clientWidth, clientHeight = _this__htmlCanvas.clientHeight;
15443
- var _this__canvas = this._canvas, width = _this__canvas.width, height = _this__canvas.height;
15444
- // Device Pixel Ratio
15445
- var widthDPR = width / clientWidth;
15446
- var heightDPR = height / clientHeight;
15447
- for(var i2 = lastIndex; i2 >= 0; i2--){
15448
- var pointer = pointers[i2];
15449
- pointer._upList.length = pointer._downList.length = 0;
15450
- this._updatePointerInfo(frameCount, pointer, left, top, widthDPR, heightDPR);
15451
- this._buttons |= pointer.pressedButtons;
15452
- }
15531
+ var frameCount = this._engine.time.frameCount;
15532
+ for(var i3 = 0, n1 = pointers.length; i3 < n1; i3++){
15533
+ var pointer1 = pointers[i3];
15534
+ pointer1._upList.length = pointer1._downList.length = 0;
15535
+ this._updatePointerInfo(frameCount, pointer1, left, top, widthDPR, heightDPR);
15536
+ this._buttons |= pointer1.pressedButtons;
15453
15537
  }
15454
15538
  };
15455
15539
  /**
@@ -15548,42 +15632,14 @@ exports.Joint = __decorate([
15548
15632
  evt.type === "pointerdown" && this._htmlCanvas.focus();
15549
15633
  this._nativeEvents.push(evt);
15550
15634
  };
15551
- _proto._getIndexByPointerID = function _getIndexByPointerID(pointerId) {
15635
+ _proto._getPointerByID = function _getPointerByID(pointerId) {
15552
15636
  var _this = this, pointers = _this._pointers;
15553
15637
  for(var i = pointers.length - 1; i >= 0; i--){
15554
15638
  if (pointers[i]._uniqueID === pointerId) {
15555
- return i;
15556
- }
15557
- }
15558
- return -1;
15559
- };
15560
- _proto._getPointer = function _getPointer(pointerId) {
15561
- var _this = this, pointers = _this._pointers;
15562
- var index = this._getIndexByPointerID(pointerId);
15563
- if (index >= 0) {
15564
- return pointers[index];
15565
- } else {
15566
- var lastCount = pointers.length;
15567
- if (lastCount === 0 || this._multiPointerEnabled) {
15568
- var _this1 = this, pointerPool = _this1._pointerPool;
15569
- // Get Pointer smallest index
15570
- var i = 0;
15571
- for(; i < lastCount; i++){
15572
- if (pointers[i].id > i) {
15573
- break;
15574
- }
15575
- }
15576
- var pointer = pointerPool[i];
15577
- if (!pointer) {
15578
- pointer = pointerPool[i] = new Pointer(i);
15579
- }
15580
- pointer._uniqueID = pointerId;
15581
- pointers.splice(i, 0, pointer);
15582
- return pointer;
15583
- } else {
15584
- return null;
15639
+ return pointers[i];
15585
15640
  }
15586
15641
  }
15642
+ return null;
15587
15643
  };
15588
15644
  _proto._updatePointerInfo = function _updatePointerInfo(frameCount, pointer, left, top, widthPixelRatio, heightPixelRatio) {
15589
15645
  var events = pointer._events, position = pointer.position;
@@ -15917,11 +15973,11 @@ exports.Joint = __decorate([
15917
15973
 
15918
15974
  /**
15919
15975
  * Material.
15920
- */ var Material = /*#__PURE__*/ function(ReferResource) {
15921
- _inherits(Material, ReferResource);
15976
+ */ var Material = /*#__PURE__*/ function(ReferResource1) {
15977
+ _inherits(Material, ReferResource1);
15922
15978
  function Material(engine, shader) {
15923
15979
  var _this;
15924
- _this = ReferResource.call(this, engine) || this;
15980
+ _this = ReferResource1.call(this, engine) || this;
15925
15981
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
15926
15982
  ;
15927
15983
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
@@ -15946,13 +16002,13 @@ exports.Joint = __decorate([
15946
16002
  };
15947
16003
  _proto._addReferCount = function _addReferCount(value) {
15948
16004
  if (this._destroyed) return;
15949
- ReferResource.prototype._addReferCount.call(this, value);
16005
+ ReferResource1.prototype._addReferCount.call(this, value);
15950
16006
  this.shaderData._addReferCount(value);
15951
16007
  };
15952
16008
  /**
15953
16009
  * @override
15954
16010
  */ _proto._onDestroy = function _onDestroy() {
15955
- ReferResource.prototype._onDestroy.call(this);
16011
+ ReferResource1.prototype._onDestroy.call(this);
15956
16012
  this._shader = null;
15957
16013
  this._shaderData = null;
15958
16014
  this._renderStates.length = 0;
@@ -16099,43 +16155,6 @@ exports.Joint = __decorate([
16099
16155
  return ParticleBufferUtils;
16100
16156
  }();
16101
16157
 
16102
- function _array_like_to_array(arr, len) {
16103
- if (len == null || len > arr.length) len = arr.length;
16104
-
16105
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
16106
-
16107
- return arr2;
16108
- }
16109
-
16110
- function _array_without_holes(arr) {
16111
- if (Array.isArray(arr)) return _array_like_to_array(arr);
16112
- }
16113
-
16114
- function _iterable_to_array(iter) {
16115
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
16116
- return Array.from(iter);
16117
- }
16118
- }
16119
-
16120
- function _non_iterable_spread() {
16121
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16122
- }
16123
-
16124
- function _unsupported_iterable_to_array(o, minLen) {
16125
- if (!o) return;
16126
- if (typeof o === "string") return _array_like_to_array(o, minLen);
16127
-
16128
- var n = Object.prototype.toString.call(o).slice(8, -1);
16129
-
16130
- if (n === "Object" && o.constructor) n = o.constructor.name;
16131
- if (n === "Map" || n === "Set") return Array.from(n);
16132
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
16133
- }
16134
-
16135
- function _to_consumable_array(arr) {
16136
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
16137
- }
16138
-
16139
16158
  var skyProceduralFs = "#define GLSLIFY 1\n#include <common>\nconst float MIE_G=-0.990;const float MIE_G2=0.9801;const float SKY_GROUND_THRESHOLD=0.02;uniform float material_SunSize;uniform float material_SunSizeConvergence;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define LINEAR_2_OUTPUT(color) sqrt(color)\n#endif\nfloat getMiePhase(float eyeCos,float eyeCos2){float temp=1.0+MIE_G2-2.0*MIE_G*eyeCos;temp=pow(temp,pow(material_SunSize,0.65)*10.0);temp=max(temp,1.0e-4);temp=1.5*((1.0-MIE_G2)/(2.0+MIE_G2))*(1.0+eyeCos2)/temp;return temp;}float calcSunAttenuation(vec3 lightPos,vec3 ray){\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nfloat focusedEyeCos=pow(clamp(dot(lightPos,ray),0.0,1.0),material_SunSizeConvergence);return getMiePhase(-focusedEyeCos,focusedEyeCos*focusedEyeCos);\n#else\nvec3 delta=lightPos-ray;float dist=length(delta);float spot=1.0-smoothstep(0.0,material_SunSize,dist);return spot*spot;\n#endif\n}void main(){vec3 col=vec3(0.0,0.0,0.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvec3 ray=normalize(v_Vertex);float y=ray.y/SKY_GROUND_THRESHOLD;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvec3 ray=v_RayDir;float y=ray.y/SKY_GROUND_THRESHOLD;\n#else\nfloat y=v_SkyGroundFactor;\n#endif\ncol=mix(v_SkyColor,v_GroundColor,clamp(y,0.0,1.0));\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nif(y<0.0)col+=v_SunColor*calcSunAttenuation(-scene_SunlightDirection,-ray);\n#endif\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\ncol=LINEAR_2_OUTPUT(col);\n#endif\ngl_FragColor=vec4(col,1.0);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
16140
16159
 
16141
16160
  var skyProceduralVs = "#define GLSLIFY 1\n#define OUTER_RADIUS 1.025\n#define RAYLEIGH (mix(0.0, 0.0025, pow(material_AtmosphereThickness,2.5)))\n#define MIE 0.0010\n#define SUN_BRIGHTNESS 20.0\n#define MAX_SCATTER 50.0\nconst float SKY_GROUND_THRESHOLD=0.02;const float outerRadius=OUTER_RADIUS;const float outerRadius2=OUTER_RADIUS*OUTER_RADIUS;const float innerRadius=1.0;const float innerRadius2=1.0;const float cameraHeight=0.0001;const float HDSundiskIntensityFactor=15.0;const float simpleSundiskIntensityFactor=27.0;const float sunScale=400.0*SUN_BRIGHTNESS;const float kmESun=MIE*SUN_BRIGHTNESS;const float km4PI=MIE*4.0*3.14159265;const float scale=1.0/(OUTER_RADIUS-1.0);const float scaleDepth=0.25;const float scaleOverScaleDepth=(1.0/(OUTER_RADIUS-1.0))/0.25;const float samples=2.0;const vec3 c_DefaultScatteringWavelength=vec3(0.65,0.57,0.475);const vec3 c_VariableRangeForScatteringWavelength=vec3(0.15,0.15,0.15);attribute vec4 POSITION;uniform mat4 camera_VPMat;uniform vec3 material_SkyTint;uniform vec3 material_GroundTint;uniform float material_Exposure;uniform float material_AtmosphereThickness;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define COLOR_2_GAMMA(color) color\n#define COLOR_2_LINEAR(color) color*color\n#else\n#define GAMMA 2.2\n#define COLOR_2_GAMMA(color) pow(color,vec3(1.0/GAMMA))\n#define COLOR_2_LINEAR(color) color\n#endif\nfloat getRayleighPhase(vec3 light,vec3 ray){float eyeCos=dot(light,ray);return 0.75+0.75*eyeCos*eyeCos;}float scaleAngle(float inCos){float x=1.0-inCos;return 0.25*exp(-0.00287+x*(0.459+x*(3.83+x*(-6.80+x*5.25))));}void main(){gl_Position=camera_VPMat*vec4(POSITION.xyz,1.0);vec3 skyTintInGammaSpace=COLOR_2_GAMMA(material_SkyTint);vec3 scatteringWavelength=mix(c_DefaultScatteringWavelength-c_VariableRangeForScatteringWavelength,c_DefaultScatteringWavelength+c_VariableRangeForScatteringWavelength,vec3(1.0)-skyTintInGammaSpace);vec3 invWavelength=1.0/pow(scatteringWavelength,vec3(4.0));float krESun=RAYLEIGH*SUN_BRIGHTNESS;float kr4PI=RAYLEIGH*4.0*3.14159265;vec3 cameraPos=vec3(0.0,innerRadius+cameraHeight,0.0);vec3 eyeRay=normalize(POSITION.xyz);float far=0.0;vec3 cIn,cOut;if(eyeRay.y>=0.0){far=sqrt(outerRadius2+innerRadius2*eyeRay.y*eyeRay.y-innerRadius2)-innerRadius*eyeRay.y;float height=innerRadius+cameraHeight;float depth=exp(scaleOverScaleDepth*-cameraHeight);float startAngle=dot(eyeRay,cameraPos)/height;float startOffset=depth*scaleAngle(startAngle);float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0);{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun);cOut=frontColor*kmESun;}else{far=(-cameraHeight)/(min(-0.001,eyeRay.y));vec3 pos=cameraPos+far*eyeRay;float depth=exp((-cameraHeight)*(1.0/scaleDepth));float cameraAngle=dot(-eyeRay,pos);float lightAngle=dot(-scene_SunlightDirection,pos);float cameraScale=scaleAngle(cameraAngle);float lightScale=scaleAngle(lightAngle);float cameraOffset=depth*cameraScale;float temp=lightScale+cameraScale;float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0,0.0,0.0);vec3 attenuate;{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float scatter=depth*temp-cameraOffset;attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun+kmESun);cOut=clamp(attenuate,0.0,1.0);}\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_Vertex=-POSITION.xyz;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_RayDir=-eyeRay;\n#else\nv_SkyGroundFactor=-eyeRay.y/SKY_GROUND_THRESHOLD;\n#endif\nv_GroundColor=material_Exposure*(cIn+COLOR_2_LINEAR(material_GroundTint)*cOut);v_SkyColor=material_Exposure*(cIn*getRayleighPhase(-scene_SunlightDirection,-eyeRay));float lightColorIntensity=clamp(length(scene_SunlightColor.xyz),0.25,1.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_SunColor=HDSundiskIntensityFactor*clamp(cOut,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_SunColor=simpleSundiskIntensityFactor*clamp(cOut*sunScale,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#endif\n}"; // eslint-disable-line
@@ -16188,10 +16207,10 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16188
16207
  */ var ShaderPool = /*#__PURE__*/ function() {
16189
16208
  function ShaderPool() {}
16190
16209
  ShaderPool.init = function init() {
16191
- var shadowCasterPass = new ShaderPass(shadowMapVs, shadowMapFs, {
16210
+ var shadowCasterPass = new ShaderPass("ShadowCaster", shadowMapVs, shadowMapFs, {
16192
16211
  pipelineStage: exports.PipelineStage.ShadowCaster
16193
16212
  });
16194
- var depthOnlyPass = new ShaderPass(depthOnlyVs, depthOnlyFs, {
16213
+ var depthOnlyPass = new ShaderPass("DepthOnly", depthOnlyVs, depthOnlyFs, {
16195
16214
  pipelineStage: exports.PipelineStage.DepthOnly
16196
16215
  });
16197
16216
  var basePasses = [
@@ -16201,35 +16220,27 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16201
16220
  var forwardPassTags = {
16202
16221
  pipelineStage: exports.PipelineStage.Forward
16203
16222
  };
16204
- Shader.create("blinn-phong", [
16205
- new ShaderPass(blinnPhongVs, blinnPhongFs, forwardPassTags)
16206
- ].concat(_to_consumable_array(basePasses)));
16207
- Shader.create("pbr", [
16208
- new ShaderPass(pbrVs, pbrFs, forwardPassTags)
16209
- ].concat(_to_consumable_array(basePasses)));
16210
- Shader.create("pbr-specular", [
16211
- new ShaderPass(pbrVs, pbrSpecularFs, forwardPassTags)
16212
- ].concat(_to_consumable_array(basePasses)));
16213
- Shader.create("unlit", [
16214
- new ShaderPass(unlitVs, unlitFs, forwardPassTags)
16215
- ].concat(_to_consumable_array(basePasses)));
16223
+ Shader.create("blinn-phong", [].concat(new ShaderPass("Forward", blinnPhongVs, blinnPhongFs, forwardPassTags), basePasses));
16224
+ Shader.create("pbr", [].concat(new ShaderPass("Forward", pbrVs, pbrFs, forwardPassTags), basePasses));
16225
+ Shader.create("pbr-specular", [].concat(new ShaderPass("Forward", pbrVs, pbrSpecularFs, forwardPassTags), basePasses));
16226
+ Shader.create("unlit", [].concat(new ShaderPass("Forward", unlitVs, unlitFs, forwardPassTags), basePasses));
16216
16227
  Shader.create("skybox", [
16217
- new ShaderPass(skyboxVs, skyboxFs, forwardPassTags)
16228
+ new ShaderPass("Forward", skyboxVs, skyboxFs, forwardPassTags)
16218
16229
  ]);
16219
16230
  Shader.create("SkyProcedural", [
16220
- new ShaderPass(skyProceduralVs, skyProceduralFs, forwardPassTags)
16231
+ new ShaderPass("Forward", skyProceduralVs, skyProceduralFs, forwardPassTags)
16221
16232
  ]);
16222
16233
  Shader.create("particle-shader", [
16223
- new ShaderPass(particleVs, particleFs, forwardPassTags)
16234
+ new ShaderPass("Forward", particleVs, particleFs, forwardPassTags)
16224
16235
  ]);
16225
16236
  Shader.create("SpriteMask", [
16226
- new ShaderPass(spriteMaskVs, spriteMaskFs, forwardPassTags)
16237
+ new ShaderPass("Forward", spriteMaskVs, spriteMaskFs, forwardPassTags)
16227
16238
  ]);
16228
16239
  Shader.create("Sprite", [
16229
- new ShaderPass(spriteVs, spriteFs, forwardPassTags)
16240
+ new ShaderPass("Forward", spriteVs, spriteFs, forwardPassTags)
16230
16241
  ]);
16231
16242
  Shader.create("background-texture", [
16232
- new ShaderPass(backgroundTextureVs, backgroundTextureFs, forwardPassTags)
16243
+ new ShaderPass("Forward", backgroundTextureVs, backgroundTextureFs, forwardPassTags)
16233
16244
  ]);
16234
16245
  };
16235
16246
  return ShaderPool;
@@ -16309,11 +16320,11 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16309
16320
  ShaderPool.init();
16310
16321
  /**
16311
16322
  * Engine.
16312
- */ var Engine = /*#__PURE__*/ function(EventDispatcher) {
16313
- _inherits(Engine, EventDispatcher);
16323
+ */ var Engine = /*#__PURE__*/ function(EventDispatcher1) {
16324
+ _inherits(Engine, EventDispatcher1);
16314
16325
  function Engine(canvas, hardwareRenderer, configuration) {
16315
16326
  var _this;
16316
- _this = EventDispatcher.call(this) || this;
16327
+ _this = EventDispatcher1.call(this) || this;
16317
16328
  /** @internal */ _this._physicsInitialized = false;
16318
16329
  /** @internal */ _this._physicalObjectsMap = {};
16319
16330
  /* @internal */ _this._lastRenderState = new RenderState();
@@ -16412,9 +16423,6 @@ ShaderPool.init();
16412
16423
  /**
16413
16424
  * Update the engine loop manually. If you call engine.run(), you generally don't need to call this function.
16414
16425
  */ _proto.update = function update() {
16415
- if (this._isDeviceLost) {
16416
- return;
16417
- }
16418
16426
  var time = this._time;
16419
16427
  time._update();
16420
16428
  var deltaTime = time.deltaTime;
@@ -16464,7 +16472,9 @@ ShaderPool.init();
16464
16472
  scene4._componentsManager.callScriptOnLateUpdate(deltaTime);
16465
16473
  }
16466
16474
  // Render scene and fire `onBeginRender` and `onEndRender`
16467
- this._render(loopScenes);
16475
+ if (!this._isDeviceLost) {
16476
+ this._render(loopScenes);
16477
+ }
16468
16478
  // Handling invalid scripts and fire `onDestroy`
16469
16479
  for(var i5 = 0; i5 < sceneCount; i5++){
16470
16480
  var scene5 = loopScenes[i5];
@@ -16929,7 +16939,7 @@ ShaderPool.init();
16929
16939
  program.uploadAll(program.materialUniformBlock, materialShaderData);
16930
16940
  program.uploadUnGroupTextures();
16931
16941
  renderState._apply(engine, false, pass._renderStateDataMap, materialShaderData);
16932
- rhi.drawPrimitive(mesh, mesh.subMesh, program);
16942
+ rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
16933
16943
  cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
16934
16944
  };
16935
16945
  _create_class(Sky, [
@@ -16942,8 +16952,8 @@ ShaderPool.init();
16942
16952
  },
16943
16953
  set: function set(value) {
16944
16954
  if (this._material !== value) {
16945
- var _this__material;
16946
- value == null ? void 0 : value._addReferCount(1);
16955
+ var _value, _this__material;
16956
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
16947
16957
  (_this__material = this._material) == null ? void 0 : _this__material._addReferCount(-1);
16948
16958
  this._material = value;
16949
16959
  }
@@ -16958,8 +16968,8 @@ ShaderPool.init();
16958
16968
  },
16959
16969
  set: function set(value) {
16960
16970
  if (this._mesh !== value) {
16961
- var _this__mesh;
16962
- value == null ? void 0 : value._addReferCount(1);
16971
+ var _value, _this__mesh;
16972
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
16963
16973
  (_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addReferCount(-1);
16964
16974
  this._mesh = value;
16965
16975
  }
@@ -17085,8 +17095,8 @@ ShaderPool.init();
17085
17095
  },
17086
17096
  set: function set(value) {
17087
17097
  if (this._texture !== value) {
17088
- var _this__texture;
17089
- value == null ? void 0 : value._addReferCount(1);
17098
+ var _value, _this__texture;
17099
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
17090
17100
  (_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
17091
17101
  this._texture = value;
17092
17102
  this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
@@ -17310,11 +17320,11 @@ ShaderPool.init();
17310
17320
 
17311
17321
  /**
17312
17322
  * Ambient light.
17313
- */ var AmbientLight = /*#__PURE__*/ function(ReferResource) {
17314
- _inherits(AmbientLight, ReferResource);
17323
+ */ var AmbientLight = /*#__PURE__*/ function(ReferResource1) {
17324
+ _inherits(AmbientLight, ReferResource1);
17315
17325
  function AmbientLight(engine) {
17316
17326
  var _this;
17317
- _this = ReferResource.call(this, engine) || this;
17327
+ _this = ReferResource1.call(this, engine) || this;
17318
17328
  _this._diffuseSolidColor = new miniprogram.Color(0.212, 0.227, 0.259);
17319
17329
  _this._diffuseIntensity = 1.0;
17320
17330
  _this._specularIntensity = 1.0;
@@ -17596,11 +17606,11 @@ ShaderPool.init();
17596
17606
 
17597
17607
  /**
17598
17608
  * Light base class.
17599
- */ var Light = /*#__PURE__*/ function(Component) {
17600
- _inherits(Light, Component);
17609
+ */ var Light = /*#__PURE__*/ function(Component1) {
17610
+ _inherits(Light, Component1);
17601
17611
  function Light() {
17602
17612
  var _this;
17603
- _this = Component.apply(this, arguments) || this;
17613
+ _this = Component1.apply(this, arguments) || this;
17604
17614
  /** Light Intensity */ _this.intensity = 1;
17605
17615
  /**
17606
17616
  * Culling mask - which layers the light affect.
@@ -17675,11 +17685,11 @@ __decorate([
17675
17685
 
17676
17686
  /**
17677
17687
  * Directional light.
17678
- */ var DirectLight = /*#__PURE__*/ function(Light) {
17679
- _inherits(DirectLight, Light);
17688
+ */ var DirectLight = /*#__PURE__*/ function(Light1) {
17689
+ _inherits(DirectLight, Light1);
17680
17690
  function DirectLight() {
17681
17691
  var _this;
17682
- _this = Light.apply(this, arguments) || this;
17692
+ _this = Light1.apply(this, arguments) || this;
17683
17693
  _this._reverseDirection = new miniprogram.Vector3();
17684
17694
  return _this;
17685
17695
  }
@@ -17775,11 +17785,11 @@ __decorate([
17775
17785
 
17776
17786
  /**
17777
17787
  * Point light.
17778
- */ var PointLight = /*#__PURE__*/ function(Light) {
17779
- _inherits(PointLight, Light);
17788
+ */ var PointLight = /*#__PURE__*/ function(Light1) {
17789
+ _inherits(PointLight, Light1);
17780
17790
  function PointLight() {
17781
17791
  var _this;
17782
- _this = Light.apply(this, arguments) || this;
17792
+ _this = Light1.apply(this, arguments) || this;
17783
17793
  /** Defines a distance cutoff at which the light's intensity must be considered zero. */ _this.distance = 100;
17784
17794
  return _this;
17785
17795
  }
@@ -17873,11 +17883,11 @@ __decorate([
17873
17883
 
17874
17884
  /**
17875
17885
  * Spot light.
17876
- */ var SpotLight = /*#__PURE__*/ function(Light) {
17877
- _inherits(SpotLight, Light);
17886
+ */ var SpotLight = /*#__PURE__*/ function(Light1) {
17887
+ _inherits(SpotLight, Light1);
17878
17888
  function SpotLight() {
17879
17889
  var _this;
17880
- _this = Light.apply(this, arguments) || this;
17890
+ _this = Light1.apply(this, arguments) || this;
17881
17891
  /** Defines a distance cutoff at which the light's intensity must be considered zero. */ _this.distance = 100;
17882
17892
  /** Angle, in radians, from centre of spotlight where falloff begins. */ _this.angle = Math.PI / 6;
17883
17893
  /** Angle, in radians, from falloff begins to ends. */ _this.penumbra = Math.PI / 12;
@@ -18158,11 +18168,11 @@ __decorate([
18158
18168
 
18159
18169
  /**
18160
18170
  * Scene.
18161
- */ var Scene = /*#__PURE__*/ function(EngineObject) {
18162
- _inherits(Scene, EngineObject);
18171
+ */ var Scene = /*#__PURE__*/ function(EngineObject1) {
18172
+ _inherits(Scene, EngineObject1);
18163
18173
  function Scene(engine, name) {
18164
18174
  var _this;
18165
- _this = EngineObject.call(this, engine) || this;
18175
+ _this = EngineObject1.call(this, engine) || this;
18166
18176
  /** Physics. */ _this.physics = new PhysicsScene(_assert_this_initialized(_this));
18167
18177
  /** If cast shadows. */ _this.castShadows = true;
18168
18178
  /** The resolution of the shadow maps. */ _this.shadowResolution = exports.ShadowResolution.Medium;
@@ -18389,7 +18399,7 @@ __decorate([
18389
18399
  /**
18390
18400
  * @internal
18391
18401
  */ _proto._onDestroy = function _onDestroy() {
18392
- EngineObject.prototype._onDestroy.call(this);
18402
+ EngineObject1.prototype._onDestroy.call(this);
18393
18403
  // Remove from sceneManager
18394
18404
  var sceneManager = this._engine.sceneManager;
18395
18405
  sceneManager.removeScene(this);
@@ -18590,11 +18600,11 @@ __decorate([
18590
18600
 
18591
18601
  /**
18592
18602
  * Script class, used for logic writing.
18593
- */ var Script = /*#__PURE__*/ function(Component) {
18594
- _inherits(Script, Component);
18603
+ */ var Script = /*#__PURE__*/ function(Component1) {
18604
+ _inherits(Script, Component1);
18595
18605
  function Script() {
18596
18606
  var _this;
18597
- _this = Component.apply(this, arguments) || this;
18607
+ _this = Component1.apply(this, arguments) || this;
18598
18608
  /** @internal */ _this._started = false;
18599
18609
  /** @internal */ _this._onStartIndex = -1;
18600
18610
  /** @internal */ _this._onUpdateIndex = -1;
@@ -18749,7 +18759,7 @@ __decorate([
18749
18759
  /**
18750
18760
  * @internal
18751
18761
  */ _proto._onDestroy = function _onDestroy() {
18752
- Component.prototype._onDestroy.call(this);
18762
+ Component1.prototype._onDestroy.call(this);
18753
18763
  this.scene._componentsManager.addPendingDestroyScript(this);
18754
18764
  };
18755
18765
  return Script;
@@ -18952,9 +18962,10 @@ var passNum = 0;
18952
18962
  /**
18953
18963
  * Render queue.
18954
18964
  */ var RenderQueue = /*#__PURE__*/ function() {
18955
- function RenderQueue(engine) {
18965
+ function RenderQueue(engine, renderQueueType) {
18956
18966
  this.elements = [];
18957
18967
  this._initSpriteBatcher(engine);
18968
+ this._renderQueueType = renderQueueType;
18958
18969
  }
18959
18970
  var _proto = RenderQueue.prototype;
18960
18971
  /**
@@ -18973,10 +18984,10 @@ var passNum = 0;
18973
18984
  var sceneData = scene.shaderData;
18974
18985
  var cameraData = camera.shaderData;
18975
18986
  var pipelineStageKey = RenderContext.pipelineStageKey;
18987
+ var renderQueueType = this._renderQueueType;
18976
18988
  for(var i = 0, n = elements.length; i < n; i++){
18977
18989
  var element = elements[i];
18978
18990
  var data = element.data, shaderPasses = element.shaderPasses;
18979
- var renderStates = data.material.renderStates;
18980
18991
  var renderPassFlag = data.component.entity.layer;
18981
18992
  if (!(renderPassFlag & mask)) {
18982
18993
  continue;
@@ -18989,6 +19000,7 @@ var passNum = 0;
18989
19000
  var material = data.material.destroyed ? engine._magentaMaterial : data.material;
18990
19001
  var rendererData = renderer.shaderData;
18991
19002
  var materialData = material.shaderData;
19003
+ var renderStates = material.renderStates;
18992
19004
  // union render global macro and material self macro.
18993
19005
  ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
18994
19006
  for(var j = 0, m = shaderPasses.length; j < m; j++){
@@ -18996,6 +19008,10 @@ var passNum = 0;
18996
19008
  if (shaderPass.getTagValue(pipelineStageKey) !== pipelineStageTagValue) {
18997
19009
  continue;
18998
19010
  }
19011
+ var _shaderPass__renderState;
19012
+ if (((_shaderPass__renderState = shaderPass._renderState) != null ? _shaderPass__renderState : renderStates[j]).renderQueueType !== renderQueueType) {
19013
+ continue;
19014
+ }
18999
19015
  var program = shaderPass._getShaderProgram(engine, compileMacros);
19000
19016
  if (!program.isValid) {
19001
19017
  continue;
@@ -19045,8 +19061,8 @@ var passNum = 0;
19045
19061
  program.uploadUnGroupTextures();
19046
19062
  }
19047
19063
  }
19048
- var _shaderPass__renderState;
19049
- var renderState = (_shaderPass__renderState = shaderPass._renderState) != null ? _shaderPass__renderState : renderStates[j];
19064
+ var _shaderPass__renderState1;
19065
+ var renderState = (_shaderPass__renderState1 = shaderPass._renderState) != null ? _shaderPass__renderState1 : renderStates[j];
19050
19066
  renderState._apply(engine, renderer.entity.transform._isFrontFaceInvert(), shaderPass._renderStateDataMap, material.shaderData);
19051
19067
  rhi.drawPrimitive(primitive, data.subPrimitive, program);
19052
19068
  }
@@ -19231,12 +19247,14 @@ var passNum = 0;
19231
19247
  * @param mipmap - Need render target mipmap
19232
19248
  * @returns Render target
19233
19249
  */ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, mipmap) {
19234
- var currentColorTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.getColorTexture(0);
19235
- var currentDepthTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.depthTexture;
19250
+ var _currentRenderTarget, _currentRenderTarget1;
19251
+ var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
19252
+ var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
19236
19253
  var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
19237
19254
  var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
19238
19255
  if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
19239
- currentRenderTarget == null ? void 0 : currentRenderTarget.destroy();
19256
+ var _currentRenderTarget2;
19257
+ (_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
19240
19258
  currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
19241
19259
  currentRenderTarget.isGCIgnored = true;
19242
19260
  }
@@ -19762,11 +19780,11 @@ var /**
19762
19780
 
19763
19781
  /**
19764
19782
  * Cascade shadow caster pass.
19765
- */ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass) {
19766
- _inherits(CascadedShadowCasterPass, PipelinePass);
19783
+ */ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass1) {
19784
+ _inherits(CascadedShadowCasterPass, PipelinePass1);
19767
19785
  function CascadedShadowCasterPass(camera) {
19768
19786
  var _this;
19769
- _this = PipelinePass.call(this, camera.engine) || this;
19787
+ _this = PipelinePass1.call(this, camera.engine) || this;
19770
19788
  _this._shadowMapSize = new miniprogram.Vector4();
19771
19789
  _this._shadowBias = new miniprogram.Vector2();
19772
19790
  _this._shadowSliceData = new ShadowSliceData();
@@ -20038,9 +20056,9 @@ var /**
20038
20056
  * Culling results.
20039
20057
  */ var CullingResults = /*#__PURE__*/ function() {
20040
20058
  function CullingResults(engine) {
20041
- this.opaqueQueue = new RenderQueue(engine);
20042
- this.transparentQueue = new RenderQueue(engine);
20043
- this.alphaTestQueue = new RenderQueue(engine);
20059
+ this.opaqueQueue = new RenderQueue(engine, exports.RenderQueueType.Opaque);
20060
+ this.transparentQueue = new RenderQueue(engine, exports.RenderQueueType.Transparent);
20061
+ this.alphaTestQueue = new RenderQueue(engine, exports.RenderQueueType.AlphaTest);
20044
20062
  }
20045
20063
  var _proto = CullingResults.prototype;
20046
20064
  _proto.reset = function reset() {
@@ -20064,11 +20082,11 @@ var /**
20064
20082
  /**
20065
20083
  * @internal
20066
20084
  * Depth only pass.
20067
- */ var DepthOnlyPass = /*#__PURE__*/ function(PipelinePass) {
20068
- _inherits(DepthOnlyPass, PipelinePass);
20085
+ */ var DepthOnlyPass = /*#__PURE__*/ function(PipelinePass1) {
20086
+ _inherits(DepthOnlyPass, PipelinePass1);
20069
20087
  function DepthOnlyPass(engine) {
20070
20088
  var _this;
20071
- _this = PipelinePass.call(this, engine) || this;
20089
+ _this = PipelinePass1.call(this, engine) || this;
20072
20090
  _this._supportDepthTexture = engine._hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture);
20073
20091
  return _this;
20074
20092
  }
@@ -20202,12 +20220,13 @@ var /**
20202
20220
  var opaqueQueue = cullingResults.opaqueQueue, alphaTestQueue = cullingResults.alphaTestQueue, transparentQueue = cullingResults.transparentQueue;
20203
20221
  pass.preRender(camera, opaqueQueue, alphaTestQueue, transparentQueue);
20204
20222
  if (pass.enabled) {
20223
+ var _renderTarget, _renderTarget1, _renderTarget2;
20205
20224
  var engine = camera.engine, scene = camera.scene;
20206
20225
  var background = scene.background;
20207
20226
  var rhi = engine._hardwareRenderer;
20208
20227
  var renderTarget = camera.renderTarget || pass.renderTarget;
20209
20228
  rhi.activeRenderTarget(renderTarget, camera.viewport, mipLevel);
20210
- renderTarget == null ? void 0 : renderTarget._setRenderTargetInfo(cubeFace, mipLevel);
20229
+ (_renderTarget = renderTarget) == null ? void 0 : _renderTarget._setRenderTargetInfo(cubeFace, mipLevel);
20211
20230
  var _pass_clearFlags;
20212
20231
  var clearFlags = (_pass_clearFlags = pass.clearFlags) != null ? _pass_clearFlags : camera.clearFlags;
20213
20232
  var _pass_clearColor;
@@ -20229,8 +20248,8 @@ var /**
20229
20248
  }
20230
20249
  cullingResults.transparentQueue.render(camera, pass.mask, exports.PipelineStage.Forward);
20231
20250
  }
20232
- renderTarget == null ? void 0 : renderTarget._blitRenderTarget();
20233
- renderTarget == null ? void 0 : renderTarget.generateMipmaps();
20251
+ (_renderTarget1 = renderTarget) == null ? void 0 : _renderTarget1._blitRenderTarget();
20252
+ (_renderTarget2 = renderTarget) == null ? void 0 : _renderTarget2.generateMipmaps();
20234
20253
  }
20235
20254
  pass.postRender(camera, cullingResults.opaqueQueue, cullingResults.alphaTestQueue, cullingResults.transparentQueue);
20236
20255
  };
@@ -20250,23 +20269,24 @@ var /**
20250
20269
  for(var i = 0, n = replacementSubShaders.length; i < n; i++){
20251
20270
  var subShader = replacementSubShaders[i];
20252
20271
  if (subShader.getTagValue(replacementTag) === materialSubShader.getTagValue(replacementTag)) {
20253
- this.pushRenderDataWihShader(context, data, subShader.passes, renderStates);
20272
+ this.pushRenderDataWithShader(context, data, subShader.passes, renderStates);
20254
20273
  break;
20255
20274
  }
20256
20275
  }
20257
20276
  } else {
20258
- this.pushRenderDataWihShader(context, data, replacementSubShaders[0].passes, renderStates);
20277
+ this.pushRenderDataWithShader(context, data, replacementSubShaders[0].passes, renderStates);
20259
20278
  }
20260
20279
  } else {
20261
- this.pushRenderDataWihShader(context, data, materialSubShader.passes, renderStates);
20280
+ this.pushRenderDataWithShader(context, data, materialSubShader.passes, renderStates);
20262
20281
  }
20263
20282
  };
20264
- _proto.pushRenderDataWihShader = function pushRenderDataWihShader(context, element, shaderPasses, renderStates) {
20283
+ _proto.pushRenderDataWithShader = function pushRenderDataWithShader(context, element, shaderPasses, renderStates) {
20265
20284
  var _this__cullingResults = this._cullingResults, opaqueQueue = _this__cullingResults.opaqueQueue, alphaTestQueue = _this__cullingResults.alphaTestQueue, transparentQueue = _this__cullingResults.transparentQueue;
20266
20285
  var renderElementPool = context.camera.engine._renderElementPool;
20267
20286
  var renderQueueAddedFlags = 0x0;
20268
20287
  for(var i = 0, n = shaderPasses.length; i < n; i++){
20269
- var renderQueueType = renderStates[i].renderQueueType;
20288
+ var _shaderPasses_i__renderState;
20289
+ var renderQueueType = ((_shaderPasses_i__renderState = shaderPasses[i]._renderState) != null ? _shaderPasses_i__renderState : renderStates[i]).renderQueueType;
20270
20290
  if (renderQueueAddedFlags & 1 << renderQueueType) {
20271
20291
  continue;
20272
20292
  }
@@ -20302,7 +20322,7 @@ var /**
20302
20322
  program.uploadAll(program.materialUniformBlock, material.shaderData);
20303
20323
  program.uploadUnGroupTextures();
20304
20324
  (pass._renderState || material.renderState)._apply(engine, false, pass._renderStateDataMap, material.shaderData);
20305
- rhi.drawPrimitive(mesh, mesh.subMesh, program);
20325
+ rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
20306
20326
  };
20307
20327
  _proto._callRender = function _callRender(context) {
20308
20328
  var engine = context.camera.engine;
@@ -20357,11 +20377,11 @@ var MathTemp = function MathTemp() {
20357
20377
  (function() {
20358
20378
  MathTemp.tempVec2 = new miniprogram.Vector2();
20359
20379
  })();
20360
- exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
20361
- _inherits(Camera1, Component);
20380
+ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
20381
+ _inherits(Camera1, Component1);
20362
20382
  function Camera1(entity) {
20363
20383
  var _this;
20364
- _this = Component.call(this, entity) || this;
20384
+ _this = Component1.call(this, entity) || this;
20365
20385
  /** Whether to enable frustum culling, it is enabled by default. */ _this.enableFrustumCulling = true;
20366
20386
  /**
20367
20387
  * Determining what to clear when rendering by a Camera.
@@ -20589,7 +20609,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
20589
20609
  * @inheritdoc
20590
20610
  */ _proto._onDestroy = function _onDestroy() {
20591
20611
  var _this__renderPipeline;
20592
- Component.prototype._onDestroy.call(this);
20612
+ Component1.prototype._onDestroy.call(this);
20593
20613
  (_this__renderPipeline = this._renderPipeline) == null ? void 0 : _this__renderPipeline.destroy();
20594
20614
  this._isInvViewProjDirty.destroy();
20595
20615
  this._isViewMatrixDirty.destroy();
@@ -20857,8 +20877,8 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
20857
20877
  },
20858
20878
  set: function set(value) {
20859
20879
  if (this._renderTarget !== value) {
20860
- var _this__renderTarget;
20861
- value == null ? void 0 : value._addReferCount(1);
20880
+ var _value, _this__renderTarget;
20881
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
20862
20882
  (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
20863
20883
  this._renderTarget = value;
20864
20884
  this._updatePixelViewport();
@@ -21116,11 +21136,11 @@ var MultiExecutor = /*#__PURE__*/ function() {
21116
21136
  RenderFace[RenderFace[/** Render double face. */ "Double"] = 2] = "Double";
21117
21137
  })(exports.RenderFace || (exports.RenderFace = {}));
21118
21138
 
21119
- var BaseMaterial = /*#__PURE__*/ function(Material) {
21120
- _inherits(BaseMaterial, Material);
21139
+ var BaseMaterial = /*#__PURE__*/ function(Material1) {
21140
+ _inherits(BaseMaterial, Material1);
21121
21141
  function BaseMaterial(engine, shader) {
21122
21142
  var _this;
21123
- _this = Material.call(this, engine, shader) || this;
21143
+ _this = Material1.call(this, engine, shader) || this;
21124
21144
  _this._renderFace = exports.RenderFace.Front;
21125
21145
  _this._isTransparent = false;
21126
21146
  _this._blendMode = exports.BlendMode.Normal;
@@ -21209,7 +21229,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21209
21229
  * Clone to the target material.
21210
21230
  * @param target - target material
21211
21231
  */ _proto.cloneTo = function cloneTo(target) {
21212
- Material.prototype.cloneTo.call(this, target);
21232
+ Material1.prototype.cloneTo.call(this, target);
21213
21233
  target._renderFace = this._renderFace;
21214
21234
  target._isTransparent = this._isTransparent;
21215
21235
  target._blendMode = this._blendMode;
@@ -21360,11 +21380,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21360
21380
 
21361
21381
  /**
21362
21382
  * Blinn-phong Material.
21363
- */ var BlinnPhongMaterial = /*#__PURE__*/ function(BaseMaterial) {
21364
- _inherits(BlinnPhongMaterial, BaseMaterial);
21383
+ */ var BlinnPhongMaterial = /*#__PURE__*/ function(BaseMaterial1) {
21384
+ _inherits(BlinnPhongMaterial, BaseMaterial1);
21365
21385
  function BlinnPhongMaterial(engine) {
21366
21386
  var _this;
21367
- _this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
21387
+ _this = BaseMaterial1.call(this, engine, Shader.find("blinn-phong")) || this;
21368
21388
  var shaderData = _this.shaderData;
21369
21389
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
21370
21390
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
@@ -21554,11 +21574,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21554
21574
 
21555
21575
  /**
21556
21576
  * PBR (Physically-Based Rendering) Material.
21557
- */ var PBRBaseMaterial = /*#__PURE__*/ function(BaseMaterial) {
21558
- _inherits(PBRBaseMaterial, BaseMaterial);
21577
+ */ var PBRBaseMaterial = /*#__PURE__*/ function(BaseMaterial1) {
21578
+ _inherits(PBRBaseMaterial, BaseMaterial1);
21559
21579
  function PBRBaseMaterial(engine, shader) {
21560
21580
  var _this;
21561
- _this = BaseMaterial.call(this, engine, shader) || this;
21581
+ _this = BaseMaterial1.call(this, engine, shader) || this;
21562
21582
  var shaderData = _this.shaderData;
21563
21583
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
21564
21584
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
@@ -21823,11 +21843,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21823
21843
 
21824
21844
  /**
21825
21845
  * PBR (Metallic-Roughness Workflow) Material.
21826
- */ var PBRMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
21827
- _inherits(PBRMaterial, PBRBaseMaterial);
21846
+ */ var PBRMaterial = /*#__PURE__*/ function(PBRBaseMaterial1) {
21847
+ _inherits(PBRMaterial, PBRBaseMaterial1);
21828
21848
  function PBRMaterial(engine) {
21829
21849
  var _this;
21830
- _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
21850
+ _this = PBRBaseMaterial1.call(this, engine, Shader.find("pbr")) || this;
21831
21851
  _this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
21832
21852
  _this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
21833
21853
  _this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
@@ -21913,11 +21933,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21913
21933
 
21914
21934
  /**
21915
21935
  * PBR (Specular-Glossiness Workflow) Material.
21916
- */ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
21917
- _inherits(PBRSpecularMaterial, PBRBaseMaterial);
21936
+ */ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial1) {
21937
+ _inherits(PBRSpecularMaterial, PBRBaseMaterial1);
21918
21938
  function PBRSpecularMaterial(engine) {
21919
21939
  var _this;
21920
- _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr-specular")) || this;
21940
+ _this = PBRBaseMaterial1.call(this, engine, Shader.find("pbr-specular")) || this;
21921
21941
  _this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new miniprogram.Color(1, 1, 1, 1));
21922
21942
  _this.shaderData.setFloat(PBRSpecularMaterial._glossinessProp, 1.0);
21923
21943
  return _this;
@@ -21991,11 +22011,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21991
22011
 
21992
22012
  /**
21993
22013
  * Unlit Material.
21994
- */ var UnlitMaterial = /*#__PURE__*/ function(BaseMaterial) {
21995
- _inherits(UnlitMaterial, BaseMaterial);
22014
+ */ var UnlitMaterial = /*#__PURE__*/ function(BaseMaterial1) {
22015
+ _inherits(UnlitMaterial, BaseMaterial1);
21996
22016
  function UnlitMaterial(engine) {
21997
22017
  var _this;
21998
- _this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
22018
+ _this = BaseMaterial1.call(this, engine, Shader.find("unlit")) || this;
21999
22019
  var shaderData = _this.shaderData;
22000
22020
  shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
22001
22021
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
@@ -22077,11 +22097,11 @@ exports.TextVerticalAlignment = void 0;
22077
22097
 
22078
22098
  /**
22079
22099
  * Sprite Atlas.
22080
- */ var SpriteAtlas = /*#__PURE__*/ function(ReferResource) {
22081
- _inherits(SpriteAtlas, ReferResource);
22100
+ */ var SpriteAtlas = /*#__PURE__*/ function(ReferResource1) {
22101
+ _inherits(SpriteAtlas, ReferResource1);
22082
22102
  function SpriteAtlas(engine) {
22083
22103
  var _this;
22084
- _this = ReferResource.call(this, engine) || this;
22104
+ _this = ReferResource1.call(this, engine) || this;
22085
22105
  _this._sprites = new Array();
22086
22106
  _this._spriteNamesToIndex = {};
22087
22107
  return _this;
@@ -22127,7 +22147,7 @@ exports.TextVerticalAlignment = void 0;
22127
22147
  /**
22128
22148
  * @internal
22129
22149
  */ _proto._onDestroy = function _onDestroy() {
22130
- ReferResource.prototype._onDestroy.call(this);
22150
+ ReferResource1.prototype._onDestroy.call(this);
22131
22151
  var _this = this, sprites = _this._sprites;
22132
22152
  for(var i = 0, n = sprites.length; i < n; i++){
22133
22153
  sprites[i].destroy();
@@ -22170,8 +22190,8 @@ exports.TextVerticalAlignment = void 0;
22170
22190
 
22171
22191
  /**
22172
22192
  * 2D sprite.
22173
- */ var Sprite = /*#__PURE__*/ function(ReferResource) {
22174
- _inherits(Sprite, ReferResource);
22193
+ */ var Sprite = /*#__PURE__*/ function(ReferResource1) {
22194
+ _inherits(Sprite, ReferResource1);
22175
22195
  function Sprite(engine, texture, region, pivot, border, name) {
22176
22196
  if (texture === void 0) texture = null;
22177
22197
  if (region === void 0) region = null;
@@ -22179,7 +22199,7 @@ exports.TextVerticalAlignment = void 0;
22179
22199
  if (border === void 0) border = null;
22180
22200
  if (name === void 0) name = null;
22181
22201
  var _this;
22182
- _this = ReferResource.call(this, engine) || this;
22202
+ _this = ReferResource1.call(this, engine) || this;
22183
22203
  _this._automaticWidth = 0;
22184
22204
  _this._automaticHeight = 0;
22185
22205
  _this._customWidth = undefined;
@@ -22255,13 +22275,13 @@ exports.TextVerticalAlignment = void 0;
22255
22275
  * @internal
22256
22276
  */ _proto._addReferCount = function _addReferCount(value) {
22257
22277
  var _this__atlas;
22258
- ReferResource.prototype._addReferCount.call(this, value);
22278
+ ReferResource1.prototype._addReferCount.call(this, value);
22259
22279
  (_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addReferCount(value);
22260
22280
  };
22261
22281
  /**
22262
22282
  * @internal
22263
22283
  */ _proto._onDestroy = function _onDestroy() {
22264
- ReferResource.prototype._onDestroy.call(this);
22284
+ ReferResource1.prototype._onDestroy.call(this);
22265
22285
  this._positions.length = 0;
22266
22286
  this._positions = null;
22267
22287
  this._uvs.length = 0;
@@ -23023,11 +23043,11 @@ var TiledType;
23023
23043
 
23024
23044
  /**
23025
23045
  * Renders a Sprite for 2D graphics.
23026
- */ var SpriteRenderer = /*#__PURE__*/ function(Renderer) {
23027
- _inherits(SpriteRenderer, Renderer);
23046
+ */ var SpriteRenderer = /*#__PURE__*/ function(Renderer1) {
23047
+ _inherits(SpriteRenderer, Renderer1);
23028
23048
  function SpriteRenderer(entity) {
23029
23049
  var _this;
23030
- _this = Renderer.call(this, entity) || this;
23050
+ _this = Renderer1.call(this, entity) || this;
23031
23051
  _this._tileMode = exports.SpriteTileMode.Continuous;
23032
23052
  _this._tiledAdaptiveThreshold = 0.5;
23033
23053
  _this._color = new miniprogram.Color(1, 1, 1, 1);
@@ -23050,7 +23070,7 @@ var TiledType;
23050
23070
  /**
23051
23071
  * @internal
23052
23072
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
23053
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23073
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23054
23074
  target._assembler.resetData(target);
23055
23075
  target.sprite = this._sprite;
23056
23076
  target.drawMode = this._drawMode;
@@ -23098,7 +23118,7 @@ var TiledType;
23098
23118
  /**
23099
23119
  * @internal
23100
23120
  */ _proto._onDestroy = function _onDestroy() {
23101
- Renderer.prototype._onDestroy.call(this);
23121
+ Renderer1.prototype._onDestroy.call(this);
23102
23122
  var sprite = this._sprite;
23103
23123
  if (sprite) {
23104
23124
  sprite._addReferCount(-1);
@@ -23485,11 +23505,11 @@ var /**
23485
23505
 
23486
23506
  /**
23487
23507
  * Renders a text for 2D graphics.
23488
- */ var TextRenderer = /*#__PURE__*/ function(Renderer) {
23489
- _inherits(TextRenderer, Renderer);
23508
+ */ var TextRenderer = /*#__PURE__*/ function(Renderer1) {
23509
+ _inherits(TextRenderer, Renderer1);
23490
23510
  function TextRenderer(entity) {
23491
23511
  var _this;
23492
- _this = Renderer.call(this, entity) || this;
23512
+ _this = Renderer1.call(this, entity) || this;
23493
23513
  /** @internal */ _this._subFont = null;
23494
23514
  /** @internal */ _this._charRenderDatas = [];
23495
23515
  _this._dirtyFlag = 15;
@@ -23524,7 +23544,7 @@ var /**
23524
23544
  /**
23525
23545
  * @internal
23526
23546
  */ _proto._onDestroy = function _onDestroy() {
23527
- Renderer.prototype._onDestroy.call(this);
23547
+ Renderer1.prototype._onDestroy.call(this);
23528
23548
  // Clear render data.
23529
23549
  var charRenderDatas = this._charRenderDatas;
23530
23550
  for(var i = 0, n = charRenderDatas.length; i < n; ++i){
@@ -23540,7 +23560,7 @@ var /**
23540
23560
  /**
23541
23561
  * @internal
23542
23562
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
23543
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23563
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23544
23564
  target.font = this._font;
23545
23565
  target._subFont = this._subFont;
23546
23566
  };
@@ -23772,7 +23792,7 @@ var /**
23772
23792
  /**
23773
23793
  * @internal
23774
23794
  */ _proto._onTransformChanged = function _onTransformChanged(bit) {
23775
- Renderer.prototype._onTransformChanged.call(this, bit);
23795
+ Renderer1.prototype._onTransformChanged.call(this, bit);
23776
23796
  this._setDirtyFlagTrue(0x4 | 0x8);
23777
23797
  };
23778
23798
  _create_class(TextRenderer, [
@@ -24352,11 +24372,11 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
24352
24372
 
24353
24373
  /**
24354
24374
  * Stores keyframe based animations.
24355
- */ var AnimationClip = /*#__PURE__*/ function(EngineObject) {
24356
- _inherits(AnimationClip, EngineObject);
24375
+ */ var AnimationClip = /*#__PURE__*/ function(EngineObject1) {
24376
+ _inherits(AnimationClip, EngineObject1);
24357
24377
  function AnimationClip(name) {
24358
24378
  var _this;
24359
- _this = EngineObject.call(this, null) || this;
24379
+ _this = EngineObject1.call(this, null) || this;
24360
24380
  _this.name = name;
24361
24381
  _this./** @internal */ _curveBindings = [];
24362
24382
  _this._length = 0;
@@ -24365,18 +24385,27 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
24365
24385
  }
24366
24386
  var _proto = AnimationClip.prototype;
24367
24387
  _proto.addEvent = function addEvent(param, time, parameter) {
24388
+ var newEvent;
24368
24389
  if (typeof param === "string") {
24369
24390
  var event = new AnimationEvent();
24370
24391
  event.functionName = param;
24371
24392
  event.time = time;
24372
24393
  event.parameter = parameter;
24373
- this._events.push(event);
24394
+ newEvent = event;
24374
24395
  } else {
24375
- this._events.push(param);
24396
+ newEvent = param;
24397
+ }
24398
+ var events = this._events;
24399
+ var count = events.length;
24400
+ var eventTime = newEvent.time;
24401
+ var maxEventTime = count ? events[count - 1].time : 0;
24402
+ if (eventTime >= maxEventTime) {
24403
+ events.push(newEvent);
24404
+ } else {
24405
+ var index = count;
24406
+ while(--index >= 0 && eventTime < events[index].time);
24407
+ events.splice(index + 1, 0, newEvent);
24376
24408
  }
24377
- this._events.sort(function(a, b) {
24378
- return a.time - b.time;
24379
- });
24380
24409
  };
24381
24410
  /**
24382
24411
  * Clears all events from the clip.
@@ -24602,11 +24631,11 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
24602
24631
  }();
24603
24632
 
24604
24633
  var _AnimationArrayCurve;
24605
- exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(AnimationCurve) {
24606
- _inherits(AnimationArrayCurve, AnimationCurve);
24634
+ exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(AnimationCurve1) {
24635
+ _inherits(AnimationArrayCurve, AnimationCurve1);
24607
24636
  function AnimationArrayCurve() {
24608
24637
  var _this;
24609
- _this = AnimationCurve.call(this) || this;
24638
+ _this = AnimationCurve1.call(this) || this;
24610
24639
  _this._evaluateData.value = [];
24611
24640
  return _this;
24612
24641
  }
@@ -24697,11 +24726,11 @@ exports.AnimationArrayCurve = __decorate([
24697
24726
  ], exports.AnimationArrayCurve);
24698
24727
 
24699
24728
  var _AnimationBoolCurve;
24700
- exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(AnimationCurve) {
24701
- _inherits(AnimationBoolCurve, AnimationCurve);
24729
+ exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(AnimationCurve1) {
24730
+ _inherits(AnimationBoolCurve, AnimationCurve1);
24702
24731
  function AnimationBoolCurve() {
24703
24732
  var _this;
24704
- _this = AnimationCurve.call(this) || this;
24733
+ _this = AnimationCurve1.call(this) || this;
24705
24734
  _this._evaluateData.value = false;
24706
24735
  return _this;
24707
24736
  }
@@ -24759,11 +24788,11 @@ exports.AnimationBoolCurve = __decorate([
24759
24788
  ], exports.AnimationBoolCurve);
24760
24789
 
24761
24790
  var _AnimationColorCurve;
24762
- exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(AnimationCurve) {
24763
- _inherits(AnimationColorCurve, AnimationCurve);
24791
+ exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(AnimationCurve1) {
24792
+ _inherits(AnimationColorCurve, AnimationCurve1);
24764
24793
  function AnimationColorCurve() {
24765
24794
  var _this;
24766
- _this = AnimationCurve.call(this) || this;
24795
+ _this = AnimationCurve1.call(this) || this;
24767
24796
  _this._evaluateData.value = new miniprogram.Color();
24768
24797
  return _this;
24769
24798
  }
@@ -24861,16 +24890,16 @@ exports.AnimationColorCurve = __decorate([
24861
24890
  ], exports.AnimationColorCurve);
24862
24891
 
24863
24892
  var _AnimationFloatArrayCurve;
24864
- exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ function(AnimationCurve) {
24865
- _inherits(AnimationFloatArrayCurve, AnimationCurve);
24893
+ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ function(AnimationCurve1) {
24894
+ _inherits(AnimationFloatArrayCurve, AnimationCurve1);
24866
24895
  function AnimationFloatArrayCurve() {
24867
- return AnimationCurve.apply(this, arguments);
24896
+ return AnimationCurve1.apply(this, arguments);
24868
24897
  }
24869
24898
  var _proto = AnimationFloatArrayCurve.prototype;
24870
24899
  /**
24871
24900
  * @inheritdoc
24872
24901
  */ _proto.addKey = function addKey(key) {
24873
- AnimationCurve.prototype.addKey.call(this, key);
24902
+ AnimationCurve1.prototype.addKey.call(this, key);
24874
24903
  var evaluateData = this._evaluateData;
24875
24904
  if (!evaluateData.value || evaluateData.value.length !== key.value.length) {
24876
24905
  var size = key.value.length;
@@ -24966,11 +24995,11 @@ exports.AnimationFloatArrayCurve = __decorate([
24966
24995
  ], exports.AnimationFloatArrayCurve);
24967
24996
 
24968
24997
  var _AnimationFloatCurve;
24969
- exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(AnimationCurve) {
24970
- _inherits(AnimationFloatCurve, AnimationCurve);
24998
+ exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(AnimationCurve1) {
24999
+ _inherits(AnimationFloatCurve, AnimationCurve1);
24971
25000
  function AnimationFloatCurve() {
24972
25001
  var _this;
24973
- _this = AnimationCurve.call(this) || this;
25002
+ _this = AnimationCurve1.call(this) || this;
24974
25003
  _this._evaluateData.value = 0;
24975
25004
  return _this;
24976
25005
  }
@@ -25040,11 +25069,11 @@ exports.AnimationFloatCurve = __decorate([
25040
25069
  ], exports.AnimationFloatCurve);
25041
25070
 
25042
25071
  var _AnimationQuaternionCurve;
25043
- exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ function(AnimationCurve) {
25044
- _inherits(AnimationQuaternionCurve1, AnimationCurve);
25072
+ exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ function(AnimationCurve1) {
25073
+ _inherits(AnimationQuaternionCurve1, AnimationCurve1);
25045
25074
  function AnimationQuaternionCurve1() {
25046
25075
  var _this;
25047
- _this = AnimationCurve.call(this) || this;
25076
+ _this = AnimationCurve1.call(this) || this;
25048
25077
  _this._evaluateData.value = new miniprogram.Quaternion();
25049
25078
  return _this;
25050
25079
  }
@@ -25149,11 +25178,11 @@ exports.AnimationQuaternionCurve = __decorate([
25149
25178
  ], exports.AnimationQuaternionCurve);
25150
25179
 
25151
25180
  var _AnimationVector2Curve;
25152
- exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function(AnimationCurve) {
25153
- _inherits(AnimationVector2Curve, AnimationCurve);
25181
+ exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function(AnimationCurve1) {
25182
+ _inherits(AnimationVector2Curve, AnimationCurve1);
25154
25183
  function AnimationVector2Curve() {
25155
25184
  var _this;
25156
- _this = AnimationCurve.call(this) || this;
25185
+ _this = AnimationCurve1.call(this) || this;
25157
25186
  _this._evaluateData.value = new miniprogram.Vector2();
25158
25187
  return _this;
25159
25188
  }
@@ -25239,11 +25268,11 @@ exports.AnimationVector2Curve = __decorate([
25239
25268
  ], exports.AnimationVector2Curve);
25240
25269
 
25241
25270
  var _AnimationVector3Curve;
25242
- exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function(AnimationCurve) {
25243
- _inherits(AnimationVector3Curve, AnimationCurve);
25271
+ exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function(AnimationCurve1) {
25272
+ _inherits(AnimationVector3Curve, AnimationCurve1);
25244
25273
  function AnimationVector3Curve() {
25245
25274
  var _this;
25246
- _this = AnimationCurve.call(this) || this;
25275
+ _this = AnimationCurve1.call(this) || this;
25247
25276
  _this._evaluateData.value = new miniprogram.Vector3();
25248
25277
  return _this;
25249
25278
  }
@@ -25341,11 +25370,11 @@ exports.AnimationVector3Curve = __decorate([
25341
25370
  ], exports.AnimationVector3Curve);
25342
25371
 
25343
25372
  var _AnimationVector4Curve;
25344
- exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function(AnimationCurve) {
25345
- _inherits(AnimationVector4Curve, AnimationCurve);
25373
+ exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function(AnimationCurve1) {
25374
+ _inherits(AnimationVector4Curve, AnimationCurve1);
25346
25375
  function AnimationVector4Curve() {
25347
25376
  var _this;
25348
- _this = AnimationCurve.call(this) || this;
25377
+ _this = AnimationCurve1.call(this) || this;
25349
25378
  _this._evaluateData.value = new miniprogram.Vector4();
25350
25379
  return _this;
25351
25380
  }
@@ -25443,10 +25472,10 @@ exports.AnimationVector4Curve = __decorate([
25443
25472
  ], exports.AnimationVector4Curve);
25444
25473
 
25445
25474
  var _AnimationRefCurve;
25446
- exports.AnimationRefCurve = (_AnimationRefCurve = /*#__PURE__*/ function(AnimationCurve) {
25447
- _inherits(AnimationRefCurve, AnimationCurve);
25475
+ exports.AnimationRefCurve = (_AnimationRefCurve = /*#__PURE__*/ function(AnimationCurve1) {
25476
+ _inherits(AnimationRefCurve, AnimationCurve1);
25448
25477
  function AnimationRefCurve() {
25449
- return AnimationCurve.call(this);
25478
+ return AnimationCurve1.call(this);
25450
25479
  }
25451
25480
  /**
25452
25481
  * @internal
@@ -25470,11 +25499,11 @@ exports.AnimationRefCurve = __decorate([
25470
25499
  ], exports.AnimationRefCurve);
25471
25500
 
25472
25501
  var _AnimationRectCurve;
25473
- exports.AnimationRectCurve = (_AnimationRectCurve = /*#__PURE__*/ function(AnimationCurve) {
25474
- _inherits(AnimationRectCurve, AnimationCurve);
25502
+ exports.AnimationRectCurve = (_AnimationRectCurve = /*#__PURE__*/ function(AnimationCurve1) {
25503
+ _inherits(AnimationRectCurve, AnimationCurve1);
25475
25504
  function AnimationRectCurve() {
25476
25505
  var _this;
25477
- _this = AnimationCurve.call(this) || this;
25506
+ _this = AnimationCurve1.call(this) || this;
25478
25507
  _this._evaluateData.value = new miniprogram.Rect();
25479
25508
  return _this;
25480
25509
  }
@@ -25580,6 +25609,7 @@ exports.AnimatorLayerBlendingMode = void 0;
25580
25609
  this.playState = AnimatorStatePlayState.UnStarted;
25581
25610
  this.clipTime = state.clipStartTime * state.clip.length;
25582
25611
  this.currentEventIndex = 0;
25612
+ this.currentTransitionIndex = 0;
25583
25613
  };
25584
25614
  _proto.update = function update(isBackwards) {
25585
25615
  var state = this.state;
@@ -25636,11 +25666,11 @@ exports.AnimatorLayerBlendingMode = void 0;
25636
25666
 
25637
25667
  /**
25638
25668
  * The controller of the animation system.
25639
- */ var Animator = /*#__PURE__*/ function(Component) {
25640
- _inherits(Animator, Component);
25669
+ */ var Animator = /*#__PURE__*/ function(Component1) {
25670
+ _inherits(Animator, Component1);
25641
25671
  function Animator(entity) {
25642
25672
  var _this;
25643
- _this = Component.call(this, entity) || this;
25673
+ _this = Component1.call(this, entity) || this;
25644
25674
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
25645
25675
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
25646
25676
  /** @internal */ _this._onUpdateIndex = -1;
@@ -25704,7 +25734,7 @@ exports.AnimatorLayerBlendingMode = void 0;
25704
25734
  manuallyTransition.duration = normalizedTransitionDuration;
25705
25735
  manuallyTransition.offset = normalizedTimeOffset;
25706
25736
  manuallyTransition.destinationState = state;
25707
- if (this._crossFadeByTransition(manuallyTransition, layerIndex)) {
25737
+ if (this._crossFadeByTransition(manuallyTransition, playLayerIndex)) {
25708
25738
  this.update(0);
25709
25739
  }
25710
25740
  };
@@ -25747,7 +25777,7 @@ exports.AnimatorLayerBlendingMode = void 0;
25747
25777
  * Get the playing state from the target layerIndex.
25748
25778
  * @param layerIndex - The layer index
25749
25779
  */ _proto.getCurrentAnimatorState = function getCurrentAnimatorState(layerIndex) {
25750
- var _this__animatorLayersData_layerIndex, _this__animatorLayersData_layerIndex_srcPlayData;
25780
+ var _this__animatorLayersData_layerIndex_srcPlayData, _this__animatorLayersData_layerIndex;
25751
25781
  return (_this__animatorLayersData_layerIndex = this._animatorLayersData[layerIndex]) == null ? void 0 : (_this__animatorLayersData_layerIndex_srcPlayData = _this__animatorLayersData_layerIndex.srcPlayData) == null ? void 0 : _this__animatorLayersData_layerIndex_srcPlayData.state;
25752
25782
  };
25753
25783
  /**
@@ -25938,11 +25968,9 @@ exports.AnimatorLayerBlendingMode = void 0;
25938
25968
  _proto._updateLayer = function _updateLayer(layerIndex, firstLayer, deltaTime, aniUpdate) {
25939
25969
  var _this__animatorController_layers_layerIndex = this._animatorController.layers[layerIndex], blendingMode = _this__animatorController_layers_layerIndex.blendingMode, weight = _this__animatorController_layers_layerIndex.weight;
25940
25970
  var layerData = this._animatorLayersData[layerIndex];
25941
- var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
25971
+ var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData;
25942
25972
  var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
25943
25973
  firstLayer && (weight = 1.0);
25944
- //@todo: All situations should be checked, optimizations will follow later.
25945
- layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
25946
25974
  switch(layerData.layerState){
25947
25975
  case LayerState.Playing:
25948
25976
  this._updatePlayingState(srcPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
@@ -25961,6 +25989,7 @@ exports.AnimatorLayerBlendingMode = void 0;
25961
25989
  _proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
25962
25990
  var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
25963
25991
  var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
25992
+ var transitions = state.transitions;
25964
25993
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
25965
25994
  var speed = state.speed * this.speed;
25966
25995
  playData.frameTime += speed * delta;
@@ -25969,8 +25998,9 @@ exports.AnimatorLayerBlendingMode = void 0;
25969
25998
  var finished = playState === AnimatorStatePlayState.Finished;
25970
25999
  if (aniUpdate || finished) {
25971
26000
  for(var i = curveBindings.length - 1; i >= 0; i--){
26001
+ var _layerOwner;
25972
26002
  var layerOwner = curveLayerOwner[i];
25973
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26003
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
25974
26004
  if (!owner) continue;
25975
26005
  var curve = curveBindings[i].curve;
25976
26006
  if (curve.keys.length) {
@@ -25993,6 +26023,12 @@ exports.AnimatorLayerBlendingMode = void 0;
25993
26023
  } else {
25994
26024
  this._callAnimatorScriptOnUpdate(state, layerIndex);
25995
26025
  }
26026
+ if (transitions.length) {
26027
+ var layerState = layerData.layerState;
26028
+ if (layerState !== LayerState.CrossFading && layerState !== LayerState.FixedCrossFading) {
26029
+ this._checkTransition(playData, transitions, layerIndex, lastClipTime, clipTime);
26030
+ }
26031
+ }
25996
26032
  };
25997
26033
  _proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
25998
26034
  var speed = this.speed;
@@ -26019,8 +26055,9 @@ exports.AnimatorLayerBlendingMode = void 0;
26019
26055
  var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
26020
26056
  if (aniUpdate || finished) {
26021
26057
  for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
26058
+ var _layerOwner;
26022
26059
  var layerOwner = crossLayerOwnerCollection[i];
26023
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26060
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
26024
26061
  if (!owner) continue;
26025
26062
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
26026
26063
  var destCurveIndex = layerOwner.crossDestCurveIndex;
@@ -26067,8 +26104,9 @@ exports.AnimatorLayerBlendingMode = void 0;
26067
26104
  // When the animator is culled (aniUpdate=false), if the play state has finished, the final value needs to be calculated and saved to be applied directly.
26068
26105
  if (aniUpdate || finished) {
26069
26106
  for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
26107
+ var _layerOwner;
26070
26108
  var layerOwner = crossLayerOwnerCollection[i];
26071
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26109
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
26072
26110
  if (!owner) continue;
26073
26111
  var curveIndex = layerOwner.crossDestCurveIndex;
26074
26112
  this._checkRevertOwner(owner, additive);
@@ -26096,8 +26134,9 @@ exports.AnimatorLayerBlendingMode = void 0;
26096
26134
  var curveLayerOwner = playData.stateData.curveLayerOwner;
26097
26135
  var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
26098
26136
  for(var i = curveBindings.length - 1; i >= 0; i--){
26137
+ var _layerOwner;
26099
26138
  var layerOwner = curveLayerOwner[i];
26100
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26139
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
26101
26140
  if (!owner) continue;
26102
26141
  this._checkRevertOwner(owner, additive);
26103
26142
  owner.applyValue(layerOwner.finalValue, weight, additive);
@@ -26133,21 +26172,59 @@ exports.AnimatorLayerBlendingMode = void 0;
26133
26172
  }
26134
26173
  }
26135
26174
  };
26136
- _proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
26137
- var state = stateData.state, clipTime = stateData.clipTime;
26138
- var transitions = state.transitions;
26139
- var duration = state._getDuration();
26140
- for(var i = 0, n = transitions.length; i < n; ++i){
26141
- var transition = transitions[i];
26142
- if (duration * transition.exitTime <= clipTime) {
26143
- crossFadeTransition !== transition && this._crossFadeByTransition(transition, layerIndex);
26175
+ _proto._checkTransition = function _checkTransition(playState, transitions, layerIndex, lastClipTime, clipTime) {
26176
+ var state = playState.state;
26177
+ var clipDuration = state.clip.length;
26178
+ if (this.speed * state.speed >= 0) {
26179
+ if (clipTime < lastClipTime) {
26180
+ this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipEndTime * clipDuration);
26181
+ playState.currentTransitionIndex = 0;
26182
+ this._checkSubTransition(playState, transitions, layerIndex, state.clipStartTime * clipDuration, clipTime);
26183
+ } else {
26184
+ this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
26185
+ }
26186
+ } else {
26187
+ if (clipTime > lastClipTime) {
26188
+ this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipStartTime * clipDuration);
26189
+ playState.currentTransitionIndex = transitions.length - 1;
26190
+ this._checkBackwardsSubTransition(playState, transitions, layerIndex, clipTime, state.clipEndTime * clipDuration);
26191
+ } else {
26192
+ this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
26193
+ }
26194
+ }
26195
+ };
26196
+ _proto._checkSubTransition = function _checkSubTransition(playState, transitions, layerIndex, lastClipTime, curClipTime) {
26197
+ var transitionIndex = playState.currentTransitionIndex;
26198
+ var duration = playState.state._getDuration();
26199
+ for(var n = transitions.length; transitionIndex < n; transitionIndex++){
26200
+ var transition = transitions[transitionIndex];
26201
+ var exitTime = transition.exitTime * duration;
26202
+ if (exitTime > curClipTime) {
26203
+ break;
26204
+ }
26205
+ if (exitTime >= lastClipTime) {
26206
+ this._crossFadeByTransition(transition, layerIndex);
26207
+ playState.currentTransitionIndex = Math.min(transitionIndex + 1, n - 1);
26208
+ }
26209
+ }
26210
+ };
26211
+ _proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, curClipTime) {
26212
+ var transitionIndex = playState.currentTransitionIndex;
26213
+ var duration = playState.state._getDuration();
26214
+ for(; transitionIndex >= 0; transitionIndex--){
26215
+ var transition = transitions[transitionIndex];
26216
+ var exitTime = transition.exitTime * duration;
26217
+ if (exitTime < curClipTime) {
26218
+ break;
26219
+ }
26220
+ if (exitTime <= lastClipTime) {
26221
+ this._crossFadeByTransition(transition, layerIndex);
26222
+ playState.currentTransitionIndex = Math.max(transitionIndex - 1, 0);
26144
26223
  }
26145
26224
  }
26146
26225
  };
26147
26226
  _proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
26148
- var name = transition.destinationState.name;
26149
- var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
26150
- var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
26227
+ var crossState = transition.destinationState;
26151
26228
  if (!crossState) {
26152
26229
  return false;
26153
26230
  }
@@ -26155,10 +26232,10 @@ exports.AnimatorLayerBlendingMode = void 0;
26155
26232
  Logger.warn("The state named " + name + " has no AnimationClip data.");
26156
26233
  return false;
26157
26234
  }
26158
- var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
26235
+ var animatorLayerData = this._getAnimatorLayerData(layerIndex);
26159
26236
  var layerState = animatorLayerData.layerState;
26160
26237
  var destPlayData = animatorLayerData.destPlayData;
26161
- var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
26238
+ var animatorStateData = this._getAnimatorStateData(crossState.name, crossState, animatorLayerData, layerIndex);
26162
26239
  var duration = crossState._getDuration();
26163
26240
  var offset = duration * transition.offset;
26164
26241
  destPlayData.reset(crossState, animatorStateData, offset);
@@ -26261,8 +26338,9 @@ exports.AnimatorLayerBlendingMode = void 0;
26261
26338
  _proto._checkAutoPlay = function _checkAutoPlay() {
26262
26339
  var layers = this._animatorController.layers;
26263
26340
  for(var i = 0, n = layers.length; i < n; ++i){
26341
+ var _stateMachine;
26264
26342
  var stateMachine = layers[i].stateMachine;
26265
- if (stateMachine == null ? void 0 : stateMachine.defaultState) {
26343
+ if ((_stateMachine = stateMachine) == null ? void 0 : _stateMachine.defaultState) {
26266
26344
  this.play(stateMachine.defaultState.name, i);
26267
26345
  }
26268
26346
  }
@@ -26441,7 +26519,17 @@ __decorate([
26441
26519
  * Add an outgoing transition to the destination state.
26442
26520
  * @param transition - The transition
26443
26521
  */ _proto.addTransition = function addTransition(transition) {
26444
- this._transitions.push(transition);
26522
+ var transitions = this._transitions;
26523
+ var count = transitions.length;
26524
+ var time = transition.exitTime;
26525
+ var maxExitTime = count ? transitions[count - 1].exitTime : 0;
26526
+ if (time >= maxExitTime) {
26527
+ transitions.push(transition);
26528
+ } else {
26529
+ var index = count;
26530
+ while(--index >= 0 && time < transitions[index].exitTime);
26531
+ transitions.splice(index + 1, 0, transition);
26532
+ }
26445
26533
  };
26446
26534
  /**
26447
26535
  * Remove a transition from the state.
@@ -26619,11 +26707,11 @@ exports.AnimatorConditionMode = void 0;
26619
26707
 
26620
26708
  /**
26621
26709
  * SkyBoxMaterial.
26622
- */ var SkyBoxMaterial = /*#__PURE__*/ function(Material) {
26623
- _inherits(SkyBoxMaterial, Material);
26710
+ */ var SkyBoxMaterial = /*#__PURE__*/ function(Material1) {
26711
+ _inherits(SkyBoxMaterial, Material1);
26624
26712
  function SkyBoxMaterial(engine) {
26625
26713
  var _this;
26626
- _this = Material.call(this, engine, Shader.find("skybox")) || this;
26714
+ _this = Material1.call(this, engine, Shader.find("skybox")) || this;
26627
26715
  _this._textureDecodeRGBM = false;
26628
26716
  _this._tintColor = new miniprogram.Color(1, 1, 1, 1);
26629
26717
  _this.renderState.rasterState.cullMode = exports.CullMode.Off;
@@ -26729,11 +26817,11 @@ exports.SunMode = void 0;
26729
26817
  })(exports.SunMode || (exports.SunMode = {}));
26730
26818
  /**
26731
26819
  * Sky procedural material.
26732
- */ var SkyProceduralMaterial = /*#__PURE__*/ function(Material) {
26733
- _inherits(SkyProceduralMaterial, Material);
26820
+ */ var SkyProceduralMaterial = /*#__PURE__*/ function(Material1) {
26821
+ _inherits(SkyProceduralMaterial, Material1);
26734
26822
  function SkyProceduralMaterial(engine) {
26735
26823
  var _this;
26736
- _this = Material.call(this, engine, Shader.find("SkyProcedural")) || this;
26824
+ _this = Material1.call(this, engine, Shader.find("SkyProcedural")) || this;
26737
26825
  _this.sunMode = 2;
26738
26826
  _this.sunSize = 0.04;
26739
26827
  _this.sunSizeConvergence = 5;
@@ -27281,11 +27369,11 @@ __decorate([
27281
27369
 
27282
27370
  /**
27283
27371
  * Color over lifetime module.
27284
- */ var ColorOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
27285
- _inherits(ColorOverLifetimeModule, ParticleGeneratorModule);
27372
+ */ var ColorOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
27373
+ _inherits(ColorOverLifetimeModule, ParticleGeneratorModule1);
27286
27374
  function ColorOverLifetimeModule() {
27287
27375
  var _this;
27288
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
27376
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27289
27377
  /** Color gradient over lifetime. */ _this.color = new ParticleCompositeGradient(new ParticleGradient([
27290
27378
  new GradientColorKey(0.0, new miniprogram.Color(1, 1, 1)),
27291
27379
  new GradientColorKey(1.0, new miniprogram.Color(1, 1, 1))
@@ -27444,11 +27532,11 @@ __decorate([
27444
27532
 
27445
27533
  /**
27446
27534
  * The EmissionModule of a Particle Generator.
27447
- */ var EmissionModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
27448
- _inherits(EmissionModule, ParticleGeneratorModule);
27535
+ */ var EmissionModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
27536
+ _inherits(EmissionModule, ParticleGeneratorModule1);
27449
27537
  function EmissionModule() {
27450
27538
  var _this;
27451
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
27539
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27452
27540
  /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10);
27453
27541
  /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0);
27454
27542
  /** @internal */ _this._shapeRand = new miniprogram.Rand(0, ParticleRandomSubSeeds.Shape);
@@ -27820,11 +27908,11 @@ __decorate([
27820
27908
 
27821
27909
  /**
27822
27910
  * Rotate particles throughout their lifetime.
27823
- */ var RotationOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
27824
- _inherits(RotationOverLifetimeModule, ParticleGeneratorModule);
27911
+ */ var RotationOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
27912
+ _inherits(RotationOverLifetimeModule, ParticleGeneratorModule1);
27825
27913
  function RotationOverLifetimeModule() {
27826
27914
  var _this;
27827
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
27915
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27828
27916
  /** Specifies whether the rotation is separate on each axis, when disabled only z axis is used. */ _this.separateAxes = false;
27829
27917
  /** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
27830
27918
  /** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
@@ -28050,11 +28138,11 @@ __decorate([
28050
28138
 
28051
28139
  /**
28052
28140
  * Size over lifetime module.
28053
- */ var SizeOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
28054
- _inherits(SizeOverLifetimeModule, ParticleGeneratorModule);
28141
+ */ var SizeOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
28142
+ _inherits(SizeOverLifetimeModule, ParticleGeneratorModule1);
28055
28143
  function SizeOverLifetimeModule() {
28056
28144
  var _this;
28057
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
28145
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28058
28146
  /** Specifies whether the Size is separate on each axis. */ _this.separateAxes = false;
28059
28147
  /** Size curve over lifetime for x axis. */ _this.sizeX = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
28060
28148
  /** Size curve over lifetime for y axis. */ _this.sizeY = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
@@ -28162,11 +28250,11 @@ __decorate([
28162
28250
 
28163
28251
  /**
28164
28252
  * Texture sheet animation module.
28165
- */ var TextureSheetAnimationModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
28166
- _inherits(TextureSheetAnimationModule, ParticleGeneratorModule);
28253
+ */ var TextureSheetAnimationModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
28254
+ _inherits(TextureSheetAnimationModule, ParticleGeneratorModule1);
28167
28255
  function TextureSheetAnimationModule() {
28168
28256
  var _this;
28169
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
28257
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28170
28258
  /** Start frame of the texture sheet. */ _this.startFrame = new ParticleCompositeCurve(0);
28171
28259
  /** Frame over time curve of the texture sheet. */ _this.frameOverTime = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
28172
28260
  /** Texture sheet animation type. */ _this.type = /** Animate over the whole texture sheet from left to right, top to bottom. */ 0;
@@ -28267,11 +28355,11 @@ var TextureSheetAnimationType;
28267
28355
 
28268
28356
  /**
28269
28357
  * Velocity over lifetime module.
28270
- */ var VelocityOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
28271
- _inherits(VelocityOverLifetimeModule, ParticleGeneratorModule);
28358
+ */ var VelocityOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
28359
+ _inherits(VelocityOverLifetimeModule, ParticleGeneratorModule1);
28272
28360
  function VelocityOverLifetimeModule() {
28273
28361
  var _this;
28274
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
28362
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28275
28363
  /** Velocity over lifetime for x axis. */ _this.velocityX = new ParticleCompositeCurve(0);
28276
28364
  /** Velocity over lifetime for z axis. */ _this.velocityY = new ParticleCompositeCurve(0);
28277
28365
  /** Velocity over lifetime for z axis. */ _this.velocityZ = new ParticleCompositeCurve(0);
@@ -28933,11 +29021,11 @@ __decorate([
28933
29021
 
28934
29022
  /**
28935
29023
  * Particle Renderer Component.
28936
- */ var ParticleRenderer = /*#__PURE__*/ function(Renderer) {
28937
- _inherits(ParticleRenderer, Renderer);
29024
+ */ var ParticleRenderer = /*#__PURE__*/ function(Renderer1) {
29025
+ _inherits(ParticleRenderer, Renderer1);
28938
29026
  function ParticleRenderer(entity) {
28939
29027
  var _this;
28940
- _this = Renderer.call(this, entity) || this;
29028
+ _this = Renderer1.call(this, entity) || this;
28941
29029
  /** Particle generator. */ _this.generator = new ParticleGenerator(_assert_this_initialized(_this));
28942
29030
  /** Specifies how much particles stretch depending on their velocity. */ _this.velocityScale = 0;
28943
29031
  /** How much are the particles stretched in their direction of motion, defined as the length of the particle compared to its width. */ _this.lengthScale = 2;
@@ -28972,7 +29060,7 @@ __decorate([
28972
29060
  if (generator._firstActiveElement === generator._firstFreeElement) {
28973
29061
  return;
28974
29062
  }
28975
- Renderer.prototype._prepareRender.call(this, context);
29063
+ Renderer1.prototype._prepareRender.call(this, context);
28976
29064
  };
28977
29065
  /**
28978
29066
  * @internal
@@ -29061,9 +29149,10 @@ __decorate([
29061
29149
  set: function set(value) {
29062
29150
  var lastMesh = this._mesh;
29063
29151
  if (lastMesh !== value) {
29152
+ var _lastMesh, _value;
29064
29153
  this._mesh = value;
29065
- lastMesh == null ? void 0 : lastMesh._addReferCount(-1);
29066
- value == null ? void 0 : value._addReferCount(1);
29154
+ (_lastMesh = lastMesh) == null ? void 0 : _lastMesh._addReferCount(-1);
29155
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
29067
29156
  if (this.renderMode === exports.ParticleRenderMode.Mesh) {
29068
29157
  this.generator._reorganizeGeometryBuffers();
29069
29158
  }
@@ -29196,11 +29285,11 @@ __decorate([
29196
29285
 
29197
29286
  /**
29198
29287
  * Particle shape that emits particles from a box.
29199
- */ var BoxShape = /*#__PURE__*/ function(BaseShape) {
29200
- _inherits(BoxShape, BaseShape);
29288
+ */ var BoxShape = /*#__PURE__*/ function(BaseShape1) {
29289
+ _inherits(BoxShape, BaseShape1);
29201
29290
  function BoxShape() {
29202
29291
  var _this;
29203
- _this = BaseShape.call(this) || this;
29292
+ _this = BaseShape1.call(this) || this;
29204
29293
  /** The size of the box. */ _this.size = new miniprogram.Vector3(1, 1, 1);
29205
29294
  _this.shapeType = ParticleShapeType.Box;
29206
29295
  return _this;
@@ -29235,11 +29324,11 @@ __decorate([
29235
29324
 
29236
29325
  /**
29237
29326
  * Particle shape that emits particles from a circle.
29238
- */ var CircleShape = /*#__PURE__*/ function(BaseShape) {
29239
- _inherits(CircleShape, BaseShape);
29327
+ */ var CircleShape = /*#__PURE__*/ function(BaseShape1) {
29328
+ _inherits(CircleShape, BaseShape1);
29240
29329
  function CircleShape() {
29241
29330
  var _this;
29242
- _this = BaseShape.call(this) || this;
29331
+ _this = BaseShape1.call(this) || this;
29243
29332
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29244
29333
  /** Angle of the circle arc to emit particles from. */ _this.arc = 360.0;
29245
29334
  /** The mode to generate particles around the arc. */ _this.arcMode = exports.ParticleShapeArcMode.Random;
@@ -29276,11 +29365,11 @@ __decorate([
29276
29365
 
29277
29366
  /**
29278
29367
  * Cone shape.
29279
- */ var ConeShape = /*#__PURE__*/ function(BaseShape) {
29280
- _inherits(ConeShape, BaseShape);
29368
+ */ var ConeShape = /*#__PURE__*/ function(BaseShape1) {
29369
+ _inherits(ConeShape, BaseShape1);
29281
29370
  function ConeShape() {
29282
29371
  var _this;
29283
- _this = BaseShape.call(this) || this;
29372
+ _this = BaseShape1.call(this) || this;
29284
29373
  /** Angle of the cone to emit particles from. */ _this.angle = 25.0;
29285
29374
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29286
29375
  /** Length of the cone to emit particles from. */ _this.length = 5.0;
@@ -29341,11 +29430,11 @@ exports.ConeEmitType = void 0;
29341
29430
 
29342
29431
  /**
29343
29432
  * Particle shape that emits particles from a hemisphere.
29344
- */ var HemisphereShape = /*#__PURE__*/ function(BaseShape) {
29345
- _inherits(HemisphereShape, BaseShape);
29433
+ */ var HemisphereShape = /*#__PURE__*/ function(BaseShape1) {
29434
+ _inherits(HemisphereShape, BaseShape1);
29346
29435
  function HemisphereShape() {
29347
29436
  var _this;
29348
- _this = BaseShape.call(this) || this;
29437
+ _this = BaseShape1.call(this) || this;
29349
29438
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29350
29439
  _this.shapeType = ParticleShapeType.Hemisphere;
29351
29440
  return _this;
@@ -29366,11 +29455,11 @@ exports.ConeEmitType = void 0;
29366
29455
 
29367
29456
  /**
29368
29457
  * Particle shape that emits particles from a sphere.
29369
- */ var SphereShape = /*#__PURE__*/ function(BaseShape) {
29370
- _inherits(SphereShape, BaseShape);
29458
+ */ var SphereShape = /*#__PURE__*/ function(BaseShape1) {
29459
+ _inherits(SphereShape, BaseShape1);
29371
29460
  function SphereShape() {
29372
29461
  var _this;
29373
- _this = BaseShape.call(this) || this;
29462
+ _this = BaseShape1.call(this) || this;
29374
29463
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29375
29464
  _this.shapeType = ParticleShapeType.Sphere;
29376
29465
  return _this;
@@ -29392,11 +29481,11 @@ var FRAG_SHADER = "#define GLSLIFY 1\nvarying vec2 v_uv;uniform sampler2D u_text
29392
29481
  var VERT_SHADER = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;uniform mat4 camera_ProjMat;uniform mat4 camera_ViewMat;void main(){gl_Position=camera_ProjMat*camera_ViewMat*vec4(POSITION,1.0);v_uv=TEXCOORD_0;}"; // eslint-disable-line
29393
29482
 
29394
29483
  Shader.create("trail", VERT_SHADER, FRAG_SHADER);
29395
- var TrailMaterial = /*#__PURE__*/ function(Material) {
29396
- _inherits(TrailMaterial, Material);
29484
+ var TrailMaterial = /*#__PURE__*/ function(Material1) {
29485
+ _inherits(TrailMaterial, Material1);
29397
29486
  function TrailMaterial(engine) {
29398
29487
  var _this;
29399
- _this = Material.call(this, engine, Shader.find("trail")) || this;
29488
+ _this = Material1.call(this, engine, Shader.find("trail")) || this;
29400
29489
  var target = _this.renderState.blendState.targetBlendState;
29401
29490
  target.enabled = true;
29402
29491
  target.sourceColorBlendFactor = target.sourceAlphaBlendFactor = exports.BlendFactor.SourceAlpha;
@@ -29410,11 +29499,11 @@ var TrailMaterial = /*#__PURE__*/ function(Material) {
29410
29499
  var _tempVector3 = new miniprogram.Vector3();
29411
29500
  /**
29412
29501
  * @deprecated
29413
- */ var TrailRenderer = /*#__PURE__*/ function(MeshRenderer) {
29414
- _inherits(TrailRenderer, MeshRenderer);
29502
+ */ var TrailRenderer = /*#__PURE__*/ function(MeshRenderer1) {
29503
+ _inherits(TrailRenderer, MeshRenderer1);
29415
29504
  function TrailRenderer(entity, props) {
29416
29505
  var _this;
29417
- _this = MeshRenderer.call(this, entity) || this;
29506
+ _this = MeshRenderer1.call(this, entity) || this;
29418
29507
  _this._stroke = props.stroke || 0.2;
29419
29508
  _this._minSeg = props.minSeg || 0.02;
29420
29509
  _this._lifetime = props.lifetime || 1000;
@@ -29483,7 +29572,7 @@ var _tempVector3 = new miniprogram.Vector3();
29483
29572
  this._updateStrapVertices(context.camera, this._points);
29484
29573
  this._updateStrapCoords();
29485
29574
  this._vertexBuffer.setData(this._vertices);
29486
- MeshRenderer.prototype._render.call(this, context);
29575
+ MeshRenderer1.prototype._render.call(this, context);
29487
29576
  };
29488
29577
  _proto._initGeometry = function _initGeometry() {
29489
29578
  var mesh = new BufferMesh(this._entity.engine);
@@ -29598,11 +29687,11 @@ var _tempVector3 = new miniprogram.Vector3();
29598
29687
  * skybox.specularTexture = cubeTexture;
29599
29688
  * }
29600
29689
  * ```
29601
- */ var Probe = /*#__PURE__*/ function(Script) {
29602
- _inherits(Probe, Script);
29690
+ */ var Probe = /*#__PURE__*/ function(Script1) {
29691
+ _inherits(Probe, Script1);
29603
29692
  function Probe() {
29604
29693
  var _this;
29605
- _this = Script.apply(this, arguments) || this;
29694
+ _this = Script1.apply(this, arguments) || this;
29606
29695
  /**
29607
29696
  * Probe's layer, render everything by default.
29608
29697
  */ _this.probeLayer = exports.Layer.Everything;
@@ -29665,11 +29754,11 @@ var cacheUp = new miniprogram.Vector3();
29665
29754
  var cacheDir = new miniprogram.Vector3();
29666
29755
  /**
29667
29756
  * Cube probe, generate cubeTexture, used for dynamic environment reflection and other effects.
29668
- */ var CubeProbe = /*#__PURE__*/ function(Probe) {
29669
- _inherits(CubeProbe, Probe);
29757
+ */ var CubeProbe = /*#__PURE__*/ function(Probe1) {
29758
+ _inherits(CubeProbe, Probe1);
29670
29759
  function CubeProbe() {
29671
29760
  var _this;
29672
- _this = Probe.apply(this, arguments) || this;
29761
+ _this = Probe1.apply(this, arguments) || this;
29673
29762
  /**
29674
29763
  * The position of the probe can be set, the default is the origin [0,0,0].
29675
29764
  */ _this.position = new miniprogram.Vector3(0, 0, 0);
@@ -29680,7 +29769,7 @@ var cacheDir = new miniprogram.Vector3();
29680
29769
  var _proto = CubeProbe.prototype;
29681
29770
  _proto.onBeginRender = function onBeginRender(camera) {
29682
29771
  if (!this.enabled) return;
29683
- Probe.prototype.onBeginRender.call(this, camera);
29772
+ Probe1.prototype.onBeginRender.call(this, camera);
29684
29773
  this._storeCamera(camera);
29685
29774
  // Render 6 faces
29686
29775
  for(var faceIndex = 0; faceIndex < 6; faceIndex++){
@@ -29689,7 +29778,7 @@ var cacheDir = new miniprogram.Vector3();
29689
29778
  camera.render(exports.TextureCubeFace.PositiveX + faceIndex);
29690
29779
  }
29691
29780
  this._restoreCamera(camera);
29692
- Probe.prototype._reset.call(this);
29781
+ Probe1.prototype._reset.call(this);
29693
29782
  };
29694
29783
  /**
29695
29784
  * Store original camera parameters.