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