@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/module.js CHANGED
@@ -184,6 +184,31 @@ function _inherits(subClass, superClass) {
184
184
  return this;
185
185
  };
186
186
  /**
187
+ * Copy from array like object.
188
+ * @param source - Array like object
189
+ * @param offset - The start offset
190
+ * @returns This color
191
+ */ _proto.copyFromArray = function copyFromArray(source, offset) {
192
+ if (offset === void 0) offset = 0;
193
+ this._r = source[offset];
194
+ this._g = source[offset + 1];
195
+ this._b = source[offset + 2];
196
+ this._a = source[offset + 3];
197
+ this._onValueChanged && this._onValueChanged();
198
+ return this;
199
+ };
200
+ /**
201
+ * Copy the value of this color to an array.
202
+ * @param out - The color
203
+ * @param outOffset - The start offset
204
+ */ _proto.copyToArray = function copyToArray(out, outOffset) {
205
+ if (outOffset === void 0) outOffset = 0;
206
+ out[outOffset] = this._r;
207
+ out[outOffset + 1] = this._g;
208
+ out[outOffset + 2] = this._b;
209
+ out[outOffset + 3] = this._a;
210
+ };
211
+ /**
187
212
  * Modify components (r, g, b) of this color from gamma space to linear space.
188
213
  * @param out - The color in linear space
189
214
  * @returns The color in linear space
@@ -371,28 +396,33 @@ function _inherits(subClass, superClass) {
371
396
  return Color;
372
397
  }();
373
398
 
374
- /******************************************************************************
375
- Copyright (c) Microsoft Corporation.
376
-
377
- Permission to use, copy, modify, and/or distribute this software for any
378
- purpose with or without fee is hereby granted.
379
-
380
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
381
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
382
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
383
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
384
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
385
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
386
- PERFORMANCE OF THIS SOFTWARE.
387
- ***************************************************************************** */
388
-
389
- function __decorate(decorators, target, key, desc) {
390
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
391
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
392
- 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;
393
- return c > 3 && r && Object.defineProperty(target, key, r), r;
399
+ /******************************************************************************
400
+ Copyright (c) Microsoft Corporation.
401
+
402
+ Permission to use, copy, modify, and/or distribute this software for any
403
+ purpose with or without fee is hereby granted.
404
+
405
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
406
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
407
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
408
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
409
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
410
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
411
+ PERFORMANCE OF THIS SOFTWARE.
412
+ ***************************************************************************** */
413
+
414
+ function __decorate(decorators, target, key, desc) {
415
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
416
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
417
+ 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;
418
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
394
419
  }
395
420
 
421
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
422
+ var e = new Error(message);
423
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
424
+ };
425
+
396
426
  function _instanceof(left, right) {
397
427
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
398
428
  return !!right[Symbol.hasInstance](left);
@@ -607,11 +637,11 @@ __decorate([
607
637
 
608
638
  /**
609
639
  * The base class of assets, with reference counting capability.
610
- */ var ReferResource = /*#__PURE__*/ function(EngineObject) {
611
- _inherits(ReferResource, EngineObject);
640
+ */ var ReferResource = /*#__PURE__*/ function(EngineObject1) {
641
+ _inherits(ReferResource, EngineObject1);
612
642
  function ReferResource(engine) {
613
643
  var _this;
614
- _this = EngineObject.call(this, engine) || this;
644
+ _this = EngineObject1.call(this, engine) || this;
615
645
  /** Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc(). */ _this.isGCIgnored = false;
616
646
  _this._refCount = 0;
617
647
  engine.resourceManager._addReferResource(_assert_this_initialized(_this));
@@ -627,7 +657,7 @@ __decorate([
627
657
  if (!force && this._refCount !== 0) {
628
658
  return false;
629
659
  }
630
- EngineObject.prototype.destroy.call(this);
660
+ EngineObject1.prototype.destroy.call(this);
631
661
  return true;
632
662
  };
633
663
  /**
@@ -648,7 +678,7 @@ __decorate([
648
678
  /**
649
679
  * @internal
650
680
  */ _proto._onDestroy = function _onDestroy() {
651
- EngineObject.prototype._onDestroy.call(this);
681
+ EngineObject1.prototype._onDestroy.call(this);
652
682
  this._engine.resourceManager._deleteReferResource(this);
653
683
  var refCount = this._getReferCount();
654
684
  if (refCount > 0) {
@@ -781,11 +811,11 @@ __decorate([
781
811
  TextureWrapMode[TextureWrapMode[/** Mirror repeat mode. tiling will be mirrored and repeated if it exceeds the texture boundary. */ "Mirror"] = 2] = "Mirror";
782
812
  })(TextureWrapMode || (TextureWrapMode = {}));
783
813
 
784
- var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
785
- _inherits(GraphicsResource, ReferResource);
814
+ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
815
+ _inherits(GraphicsResource, ReferResource1);
786
816
  function GraphicsResource(engine) {
787
817
  var _this;
788
- _this = ReferResource.call(this, engine) || this;
818
+ _this = ReferResource1.call(this, engine) || this;
789
819
  /** @internal */ _this._isContentLost = false;
790
820
  engine.resourceManager._addGraphicResource(_assert_this_initialized(_this));
791
821
  return _this;
@@ -794,7 +824,7 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
794
824
  /**
795
825
  * @internal
796
826
  */ _proto._onDestroy = function _onDestroy() {
797
- ReferResource.prototype._onDestroy.call(this);
827
+ ReferResource1.prototype._onDestroy.call(this);
798
828
  this.engine.resourceManager._deleteGraphicResource(this);
799
829
  };
800
830
  _create_class(GraphicsResource, [
@@ -846,11 +876,11 @@ var Logger = {
846
876
 
847
877
  /**
848
878
  * The base class of texture, contains some common functions of texture-related classes.
849
- */ var Texture = /*#__PURE__*/ function(GraphicsResource) {
850
- _inherits(Texture, GraphicsResource);
879
+ */ var Texture = /*#__PURE__*/ function(GraphicsResource1) {
880
+ _inherits(Texture, GraphicsResource1);
851
881
  function Texture() {
852
882
  var _this;
853
- _this = GraphicsResource.apply(this, arguments) || this;
883
+ _this = GraphicsResource1.apply(this, arguments) || this;
854
884
  /** @internal */ _this._isDepthTexture = false;
855
885
  _this._anisoLevel = 1;
856
886
  _this._useDepthCompareMode = false;
@@ -887,7 +917,7 @@ var Logger = {
887
917
  /**
888
918
  * @internal
889
919
  */ _proto._onDestroy = function _onDestroy() {
890
- GraphicsResource.prototype._onDestroy.call(this);
920
+ GraphicsResource1.prototype._onDestroy.call(this);
891
921
  this._platformTexture.destroy();
892
922
  this._platformTexture = null;
893
923
  };
@@ -1027,13 +1057,13 @@ var Logger = {
1027
1057
 
1028
1058
  /**
1029
1059
  * The render target used for off-screen rendering.
1030
- */ var RenderTarget = /*#__PURE__*/ function(GraphicsResource) {
1031
- _inherits(RenderTarget, GraphicsResource);
1060
+ */ var RenderTarget = /*#__PURE__*/ function(GraphicsResource1) {
1061
+ _inherits(RenderTarget, GraphicsResource1);
1032
1062
  function RenderTarget(engine, width, height, renderTexture, depth, antiAliasing) {
1033
1063
  if (depth === void 0) depth = RenderBufferDepthFormat.Depth;
1034
1064
  if (antiAliasing === void 0) antiAliasing = 1;
1035
1065
  var _this;
1036
- _this = GraphicsResource.call(this, engine) || this;
1066
+ _this = GraphicsResource1.call(this, engine) || this;
1037
1067
  _this._autoGenerateMipmaps = true;
1038
1068
  _this._width = width;
1039
1069
  _this._height = height;
@@ -1089,7 +1119,7 @@ var Logger = {
1089
1119
  * @internal
1090
1120
  */ _proto._onDestroy = function _onDestroy() {
1091
1121
  var _this__depthTexture;
1092
- GraphicsResource.prototype._onDestroy.call(this);
1122
+ GraphicsResource1.prototype._onDestroy.call(this);
1093
1123
  this._platformRenderTarget.destroy();
1094
1124
  var _this = this, colorTextures = _this._colorTextures;
1095
1125
  for(var i = 0, n = colorTextures.length; i < n; i++){
@@ -1175,14 +1205,14 @@ var Logger = {
1175
1205
 
1176
1206
  /**
1177
1207
  * Two-dimensional texture.
1178
- */ var Texture2D = /*#__PURE__*/ function(Texture) {
1179
- _inherits(Texture2D, Texture);
1208
+ */ var Texture2D = /*#__PURE__*/ function(Texture1) {
1209
+ _inherits(Texture2D, Texture1);
1180
1210
  function Texture2D(engine, width, height, format, mipmap, usage) {
1181
1211
  if (format === void 0) format = TextureFormat.R8G8B8A8;
1182
1212
  if (mipmap === void 0) mipmap = true;
1183
1213
  if (usage === void 0) usage = TextureUsage.Static;
1184
1214
  var _this;
1185
- _this = Texture.call(this, engine) || this;
1215
+ _this = Texture1.call(this, engine) || this;
1186
1216
  _this._mipmap = mipmap;
1187
1217
  _this._width = width;
1188
1218
  _this._height = height;
@@ -1245,20 +1275,20 @@ var Logger = {
1245
1275
  * @internal
1246
1276
  */ _proto._rebuild = function _rebuild() {
1247
1277
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2D(this);
1248
- Texture.prototype._rebuild.call(this);
1278
+ Texture1.prototype._rebuild.call(this);
1249
1279
  };
1250
1280
  return Texture2D;
1251
1281
  }(Texture);
1252
1282
 
1253
1283
  /**
1254
1284
  * Two-dimensional texture array.
1255
- */ var Texture2DArray = /*#__PURE__*/ function(Texture) {
1256
- _inherits(Texture2DArray, Texture);
1285
+ */ var Texture2DArray = /*#__PURE__*/ function(Texture1) {
1286
+ _inherits(Texture2DArray, Texture1);
1257
1287
  function Texture2DArray(engine, width, height, length, format, mipmap) {
1258
1288
  if (format === void 0) format = TextureFormat.R8G8B8A8;
1259
1289
  if (mipmap === void 0) mipmap = true;
1260
1290
  var _this;
1261
- _this = Texture.call(this, engine) || this;
1291
+ _this = Texture1.call(this, engine) || this;
1262
1292
  _this._mipmap = mipmap;
1263
1293
  _this._width = width;
1264
1294
  _this._height = height;
@@ -1323,7 +1353,7 @@ var Logger = {
1323
1353
  * @internal
1324
1354
  */ _proto._rebuild = function _rebuild() {
1325
1355
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
1326
- Texture.prototype._rebuild.call(this);
1356
+ Texture1.prototype._rebuild.call(this);
1327
1357
  };
1328
1358
  _create_class(Texture2DArray, [
1329
1359
  {
@@ -1340,13 +1370,13 @@ var Logger = {
1340
1370
 
1341
1371
  /**
1342
1372
  * Cube texture.
1343
- */ var TextureCube = /*#__PURE__*/ function(Texture) {
1344
- _inherits(TextureCube, Texture);
1373
+ */ var TextureCube = /*#__PURE__*/ function(Texture1) {
1374
+ _inherits(TextureCube, Texture1);
1345
1375
  function TextureCube(engine, size, format, mipmap) {
1346
1376
  if (format === void 0) format = TextureFormat.R8G8B8A8;
1347
1377
  if (mipmap === void 0) mipmap = true;
1348
1378
  var _this;
1349
- _this = Texture.call(this, engine) || this;
1379
+ _this = Texture1.call(this, engine) || this;
1350
1380
  _this._mipmap = mipmap;
1351
1381
  _this._width = size;
1352
1382
  _this._height = size;
@@ -1409,18 +1439,18 @@ var Logger = {
1409
1439
  * @internal
1410
1440
  */ _proto._rebuild = function _rebuild() {
1411
1441
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTextureCube(this);
1412
- Texture.prototype._rebuild.call(this);
1442
+ Texture1.prototype._rebuild.call(this);
1413
1443
  };
1414
1444
  return TextureCube;
1415
1445
  }(Texture);
1416
1446
 
1417
1447
  /**
1418
1448
  * @internal
1419
- */ var FontAtlas = /*#__PURE__*/ function(ReferResource) {
1420
- _inherits(FontAtlas, ReferResource);
1449
+ */ var FontAtlas = /*#__PURE__*/ function(ReferResource1) {
1450
+ _inherits(FontAtlas, ReferResource1);
1421
1451
  function FontAtlas(engine) {
1422
1452
  var _this;
1423
- _this = ReferResource.call(this, engine) || this;
1453
+ _this = ReferResource1.call(this, engine) || this;
1424
1454
  _this._charInfoMap = {};
1425
1455
  _this._space = 1;
1426
1456
  _this._curX = 1;
@@ -1483,7 +1513,7 @@ var Logger = {
1483
1513
  /**
1484
1514
  * @internal
1485
1515
  */ _proto._onDestroy = function _onDestroy() {
1486
- ReferResource.prototype._onDestroy.call(this);
1516
+ ReferResource1.prototype._onDestroy.call(this);
1487
1517
  this.texture.destroy();
1488
1518
  this.texture = null;
1489
1519
  this._charInfoMap = {};
@@ -2032,12 +2062,12 @@ var Logger = {
2032
2062
 
2033
2063
  /**
2034
2064
  * Font.
2035
- */ var Font = /*#__PURE__*/ function(ReferResource) {
2036
- _inherits(Font, ReferResource);
2065
+ */ var Font = /*#__PURE__*/ function(ReferResource1) {
2066
+ _inherits(Font, ReferResource1);
2037
2067
  function Font(engine, name) {
2038
2068
  if (name === void 0) name = "";
2039
2069
  var _this;
2040
- _this = ReferResource.call(this, engine) || this;
2070
+ _this = ReferResource1.call(this, engine) || this;
2041
2071
  _this._name = "";
2042
2072
  _this._subFontMap = {};
2043
2073
  _this._name = name;
@@ -2060,7 +2090,7 @@ var Logger = {
2060
2090
  /**
2061
2091
  * @internal
2062
2092
  */ _proto._onDestroy = function _onDestroy() {
2063
- ReferResource.prototype._onDestroy.call(this);
2093
+ ReferResource1.prototype._onDestroy.call(this);
2064
2094
  var subFontMap = this._subFontMap;
2065
2095
  for(var k in subFontMap){
2066
2096
  subFontMap[k].destroy();
@@ -2289,8 +2319,9 @@ var Logger = {
2289
2319
  /**
2290
2320
  * @internal
2291
2321
  */ ShaderProperty._getShaderPropertyGroup = function _getShaderPropertyGroup(propertyName) {
2322
+ var _shaderProperty;
2292
2323
  var shaderProperty = ShaderProperty._propertyNameMap[propertyName];
2293
- return shaderProperty == null ? void 0 : shaderProperty._group;
2324
+ return (_shaderProperty = shaderProperty) == null ? void 0 : _shaderProperty._group;
2294
2325
  };
2295
2326
  _create_class(ShaderProperty, [
2296
2327
  {
@@ -2500,11 +2531,11 @@ var ActiveChangeFlag;
2500
2531
 
2501
2532
  /**
2502
2533
  * The base class of the components.
2503
- */ var Component = /*#__PURE__*/ function(EngineObject) {
2504
- _inherits(Component, EngineObject);
2534
+ */ var Component = /*#__PURE__*/ function(EngineObject1) {
2535
+ _inherits(Component, EngineObject1);
2505
2536
  function Component(entity) {
2506
2537
  var _this;
2507
- _this = EngineObject.call(this, entity.engine) || this;
2538
+ _this = EngineObject1.call(this, entity.engine) || this;
2508
2539
  /** @internal */ _this._awoken = false;
2509
2540
  _this._phasedActive = false;
2510
2541
  _this._phasedActiveInScene = false;
@@ -2572,7 +2603,7 @@ var ActiveChangeFlag;
2572
2603
  /**
2573
2604
  * @internal
2574
2605
  */ _proto._onDestroy = function _onDestroy() {
2575
- EngineObject.prototype._onDestroy.call(this);
2606
+ EngineObject1.prototype._onDestroy.call(this);
2576
2607
  var entity = this._entity;
2577
2608
  entity._removeComponent(this);
2578
2609
  if (this._enabled) {
@@ -3048,11 +3079,11 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3048
3079
 
3049
3080
  /**
3050
3081
  * Bool update flag.
3051
- */ var BoolUpdateFlag = /*#__PURE__*/ function(UpdateFlag) {
3052
- _inherits(BoolUpdateFlag, UpdateFlag);
3082
+ */ var BoolUpdateFlag = /*#__PURE__*/ function(UpdateFlag1) {
3083
+ _inherits(BoolUpdateFlag, UpdateFlag1);
3053
3084
  function BoolUpdateFlag() {
3054
3085
  var _this;
3055
- _this = UpdateFlag.apply(this, arguments) || this;
3086
+ _this = UpdateFlag1.apply(this, arguments) || this;
3056
3087
  /** Bool flag. */ _this.flag = true;
3057
3088
  return _this;
3058
3089
  }
@@ -3128,11 +3159,11 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3128
3159
 
3129
3160
  /**
3130
3161
  * Used to implement transformation related functions.
3131
- */ var Transform = /*#__PURE__*/ function(Component) {
3132
- _inherits(Transform, Component);
3162
+ */ var Transform = /*#__PURE__*/ function(Component1) {
3163
+ _inherits(Transform, Component1);
3133
3164
  function Transform(entity) {
3134
3165
  var _this;
3135
- _this = Component.call(this, entity) || this;
3166
+ _this = Component1.call(this, entity) || this;
3136
3167
  _this._position = new Vector3();
3137
3168
  _this._rotation = new Vector3();
3138
3169
  _this._rotationQuaternion = new Quaternion();
@@ -3318,7 +3349,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
3318
3349
  return isInvert;
3319
3350
  };
3320
3351
  _proto._onDestroy = function _onDestroy() {
3321
- Component.prototype._onDestroy.call(this);
3352
+ Component1.prototype._onDestroy.call(this);
3322
3353
  //@ts-ignore
3323
3354
  this._worldPosition._onValueChanged = null;
3324
3355
  //@ts-ignore
@@ -3951,11 +3982,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
3951
3982
 
3952
3983
  /**
3953
3984
  * Entity, be used as components container.
3954
- */ var Entity = /*#__PURE__*/ function(EngineObject) {
3955
- _inherits(Entity, EngineObject);
3985
+ */ var Entity = /*#__PURE__*/ function(EngineObject1) {
3986
+ _inherits(Entity, EngineObject1);
3956
3987
  function Entity(engine, name) {
3957
3988
  var _this;
3958
- _this = EngineObject.call(this, engine) || this;
3989
+ _this = EngineObject1.call(this, engine) || this;
3959
3990
  /** The layer the entity belongs to. */ _this.layer = Layer.Layer0;
3960
3991
  /** @internal */ _this._isActiveInHierarchy = false;
3961
3992
  /** @internal */ _this._isActiveInScene = false;
@@ -4191,7 +4222,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
4191
4222
  if (this._destroyed) {
4192
4223
  return;
4193
4224
  }
4194
- EngineObject.prototype.destroy.call(this);
4225
+ EngineObject1.prototype.destroy.call(this);
4195
4226
  if (this._hookResource) {
4196
4227
  this._hookResource._addReferCount(-1);
4197
4228
  this._hookResource = null;
@@ -4206,11 +4237,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
4206
4237
  children[0].destroy();
4207
4238
  }
4208
4239
  if (this._isRoot) {
4209
- this._scene._removeFromEntityList(this);
4210
- this._isRoot = false;
4240
+ this._scene.removeRootEntity(this);
4211
4241
  } else {
4212
- this._removeFromParent();
4242
+ this._setParent(null);
4213
4243
  }
4244
+ this.isActive = false;
4214
4245
  };
4215
4246
  /**
4216
4247
  * @internal
@@ -4454,8 +4485,9 @@ var ComponentCloner = /*#__PURE__*/ function() {
4454
4485
  if (this._isRoot && this._scene._isActiveInEngine) {
4455
4486
  activeChangeFlag |= ActiveChangeFlag.All;
4456
4487
  } else {
4457
- (parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
4458
- (parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
4488
+ var _parent, _parent1;
4489
+ ((_parent = parent) == null ? void 0 : _parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
4490
+ ((_parent1 = parent) == null ? void 0 : _parent1._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
4459
4491
  }
4460
4492
  activeChangeFlag && this._processActive(activeChangeFlag);
4461
4493
  } else {
@@ -4665,6 +4697,7 @@ var RenderStateElementKey;
4665
4697
  RenderStateElementKey[RenderStateElementKey[/** Raster state fill mode key. */ "RasterStateCullMode"] = 25] = "RasterStateCullMode";
4666
4698
  RenderStateElementKey[RenderStateElementKey[/** Raster state cull mode key. */ "RasterStateDepthBias"] = 26] = "RasterStateDepthBias";
4667
4699
  RenderStateElementKey[RenderStateElementKey[/** Raster state depth bias key. */ "RasterStateSlopeScaledDepthBias"] = 27] = "RasterStateSlopeScaledDepthBias";
4700
+ RenderStateElementKey[RenderStateElementKey[/** Render queue type key. */ "RenderQueueType"] = 28] = "RenderQueueType";
4668
4701
  })(RenderStateElementKey || (RenderStateElementKey = {}));
4669
4702
 
4670
4703
  /**
@@ -5186,14 +5219,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
5186
5219
  return src.replace(regex, replace);
5187
5220
  };
5188
5221
  /**
5189
- * GLSL extension.
5190
- * @param extensions - such as ["GL_EXT_shader_texture_lod"]
5191
- * */ ShaderFactory.parseExtension = function parseExtension(extensions) {
5192
- return extensions.map(function(e) {
5193
- return "#extension " + e + " : enable\n";
5194
- }).join("");
5195
- };
5196
- /**
5197
5222
  * Convert lower GLSL version to GLSL 300 es.
5198
5223
  * @param shader - code
5199
5224
  * @param isFrag - Whether it is a fragment shader.
@@ -5232,6 +5257,15 @@ var ShaderFactory = /*#__PURE__*/ function() {
5232
5257
  };
5233
5258
  return ShaderFactory;
5234
5259
  }();
5260
+ (function() {
5261
+ /** @internal */ ShaderFactory._shaderExtension = [
5262
+ "GL_EXT_shader_texture_lod",
5263
+ "GL_OES_standard_derivatives",
5264
+ "GL_EXT_draw_buffers"
5265
+ ].map(function(e) {
5266
+ return "#extension " + e + " : enable\n";
5267
+ }).join("");
5268
+ })();
5235
5269
 
5236
5270
  /**
5237
5271
  * Shader tag key.
@@ -5279,6 +5313,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
5279
5313
  _proto.getTagValue = function getTagValue(keyOrKeyName) {
5280
5314
  return this._tagsMap[typeof keyOrKeyName == "string" ? ShaderTagKey.getByName(keyOrKeyName)._uniqueId : keyOrKeyName._uniqueId];
5281
5315
  };
5316
+ _create_class(ShaderPart, [
5317
+ {
5318
+ key: "name",
5319
+ get: /**
5320
+ * Name.
5321
+ */ function get() {
5322
+ return this._name;
5323
+ }
5324
+ }
5325
+ ]);
5282
5326
  return ShaderPart;
5283
5327
  }();
5284
5328
 
@@ -5896,19 +5940,29 @@ var ShaderFactory = /*#__PURE__*/ function() {
5896
5940
 
5897
5941
  /**
5898
5942
  * Shader pass containing vertex and fragment source.
5899
- */ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
5900
- _inherits(ShaderPass, ShaderPart);
5901
- function ShaderPass(vertexSource, fragmentSource, tags) {
5902
- if (tags === void 0) tags = {
5903
- pipelineStage: PipelineStage.Forward
5904
- };
5943
+ */ var ShaderPass = /*#__PURE__*/ function(ShaderPart1) {
5944
+ _inherits(ShaderPass, ShaderPart1);
5945
+ function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSource, fragmentSourceOrTags, tags) {
5905
5946
  var _this;
5906
- _this = ShaderPart.call(this) || this;
5947
+ _this = ShaderPart1.call(this) || this;
5907
5948
  /** @internal */ _this._shaderPassId = 0;
5908
5949
  /** @internal */ _this._renderStateDataMap = {};
5909
5950
  _this._shaderPassId = ShaderPass._shaderPassCounter++;
5910
- _this._vertexSource = vertexSource;
5911
- _this._fragmentSource = fragmentSource;
5951
+ if (typeof fragmentSourceOrTags === "string") {
5952
+ _this._name = nameOrVertexSource;
5953
+ _this._vertexSource = vertexSourceOrFragmentSource;
5954
+ _this._fragmentSource = fragmentSourceOrTags;
5955
+ tags = tags != null ? tags : {
5956
+ pipelineStage: PipelineStage.Forward
5957
+ };
5958
+ } else {
5959
+ _this._name = "Default";
5960
+ _this._vertexSource = nameOrVertexSource;
5961
+ _this._fragmentSource = vertexSourceOrFragmentSource;
5962
+ tags = fragmentSourceOrTags != null ? fragmentSourceOrTags : {
5963
+ pipelineStage: PipelineStage.Forward
5964
+ };
5965
+ }
5912
5966
  for(var key in tags){
5913
5967
  _this.setTag(key, tags[key]);
5914
5968
  }
@@ -5937,7 +5991,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
5937
5991
  precisionStr += "#define HAS_DERIVATIVES\n";
5938
5992
  }
5939
5993
  var vertexSource = " " + versionStr + "\n " + graphicAPI + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._vertexSource);
5940
- var fragmentSource = " " + versionStr + "\n " + graphicAPI + "\n " + (isWebGL2 ? "" : ShaderFactory.parseExtension(Shader._shaderExtension)) + "\n " + precisionStr + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._fragmentSource);
5994
+ var fragmentSource = " " + versionStr + "\n " + graphicAPI + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._fragmentSource);
5941
5995
  if (isWebGL2) {
5942
5996
  vertexSource = ShaderFactory.convertTo300(vertexSource);
5943
5997
  fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
@@ -5954,12 +6008,12 @@ var ShaderFactory = /*#__PURE__*/ function() {
5954
6008
 
5955
6009
  /**
5956
6010
  * Sub shader.
5957
- */ var SubShader = /*#__PURE__*/ function(ShaderPart) {
5958
- _inherits(SubShader, ShaderPart);
6011
+ */ var SubShader = /*#__PURE__*/ function(ShaderPart1) {
6012
+ _inherits(SubShader, ShaderPart1);
5959
6013
  function SubShader(name, passes, tags) {
5960
6014
  var _this;
5961
- _this = ShaderPart.call(this) || this;
5962
- _this.name = name;
6015
+ _this = ShaderPart1.call(this) || this;
6016
+ _this._name = name;
5963
6017
  var passCount = passes.length;
5964
6018
  if (passCount < 1) {
5965
6019
  throw " count must large than 0.";
@@ -6533,6 +6587,11 @@ var ShaderFactory = /*#__PURE__*/ function() {
6533
6587
  this.depthState._applyShaderDataValue(renderStateDataMap, shaderData);
6534
6588
  this.stencilState._applyShaderDataValue(renderStateDataMap, shaderData);
6535
6589
  this.rasterState._applyShaderDataValue(renderStateDataMap, shaderData);
6590
+ var renderQueueType = renderStateDataMap[RenderStateElementKey.RenderQueueType];
6591
+ if (renderQueueType !== undefined) {
6592
+ var _shaderData_getFloat;
6593
+ this.renderQueueType = (_shaderData_getFloat = shaderData.getFloat(renderQueueType)) != null ? _shaderData_getFloat : RenderQueueType.Opaque;
6594
+ }
6536
6595
  };
6537
6596
  /**
6538
6597
  * @internal
@@ -6597,14 +6656,24 @@ var ShaderFactory = /*#__PURE__*/ function() {
6597
6656
  var shaderInfo = Shader._shaderLab.parseShader(nameOrShaderSource);
6598
6657
  var subShaderList = shaderInfo.subShaders.map(function(subShaderInfo) {
6599
6658
  var passList = subShaderInfo.passes.map(function(passInfo) {
6600
- var shaderPass = new ShaderPass(passInfo.vertexSource, passInfo.fragmentSource, passInfo.tags);
6659
+ if (typeof passInfo === "string") {
6660
+ var _Shader_find_subShaders_find, _Shader_find;
6661
+ // Use pass reference
6662
+ var paths = passInfo.split("/");
6663
+ return (_Shader_find = Shader.find(paths[0])) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
6664
+ return subShader.name === paths[1];
6665
+ })) == null ? void 0 : _Shader_find_subShaders_find.passes.find(function(pass) {
6666
+ return pass.name === paths[2];
6667
+ });
6668
+ }
6669
+ var shaderPass = new ShaderPass(passInfo.name, passInfo.vertexSource, passInfo.fragmentSource, passInfo.tags);
6601
6670
  var renderStates = passInfo.renderStates;
6602
6671
  var renderState = new RenderState();
6603
6672
  shaderPass._renderState = renderState;
6604
6673
  // Parse const render state
6605
6674
  var constRenderStateInfo = renderStates[0];
6606
6675
  for(var k in constRenderStateInfo){
6607
- Shader._applyConstRenderStates(renderState, k, constRenderStateInfo[k]);
6676
+ Shader._applyConstRenderStates(renderState, parseInt(k), constRenderStateInfo[k]);
6608
6677
  }
6609
6678
  // Parse variable render state
6610
6679
  var variableRenderStateInfo = renderStates[1];
@@ -6734,6 +6803,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
6734
6803
  case RenderStateElementKey.RasterStateSlopeScaledDepthBias:
6735
6804
  renderState.rasterState.slopeScaledDepthBias = value;
6736
6805
  break;
6806
+ case RenderStateElementKey.RenderQueueType:
6807
+ renderState.renderQueueType = value;
6808
+ break;
6737
6809
  }
6738
6810
  };
6739
6811
  Shader.getMacroByName = function getMacroByName(name, value) {
@@ -6763,13 +6835,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
6763
6835
  (function() {
6764
6836
  /** @internal */ Shader._compileMacros = new ShaderMacroCollection();
6765
6837
  })();
6766
- (function() {
6767
- /** @internal */ Shader._shaderExtension = [
6768
- "GL_EXT_shader_texture_lod",
6769
- "GL_OES_standard_derivatives",
6770
- "GL_EXT_draw_buffers"
6771
- ];
6772
- })();
6773
6838
  (function() {
6774
6839
  Shader._shaderMap = Object.create(null);
6775
6840
  })();
@@ -7100,11 +7165,11 @@ var RenderElement = /*#__PURE__*/ function() {
7100
7165
 
7101
7166
  // @ts-ignore
7102
7167
  var _Renderer;
7103
- var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
7104
- _inherits(Renderer1, Component);
7168
+ var Renderer = (_Renderer = /*#__PURE__*/ function(Component1) {
7169
+ _inherits(Renderer1, Component1);
7105
7170
  function Renderer1(entity) {
7106
7171
  var _this;
7107
- _this = Component.call(this, entity) || this;
7172
+ _this = Component1.call(this, entity) || this;
7108
7173
  /** @internal */ _this._onUpdateIndex = -1;
7109
7174
  /** @internal */ _this._rendererIndex = -1;
7110
7175
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
@@ -7250,7 +7315,7 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
7250
7315
  /**
7251
7316
  * @internal
7252
7317
  */ _proto._onDestroy = function _onDestroy() {
7253
- Component.prototype._onDestroy.call(this);
7318
+ Component1.prototype._onDestroy.call(this);
7254
7319
  this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
7255
7320
  this.shaderData._addReferCount(-1);
7256
7321
  var materials = this._materials;
@@ -7648,11 +7713,11 @@ SimpleSpriteAssembler = __decorate([
7648
7713
 
7649
7714
  /**
7650
7715
  * A component for masking Sprites.
7651
- */ var SpriteMask = /*#__PURE__*/ function(Renderer) {
7652
- _inherits(SpriteMask, Renderer);
7716
+ */ var SpriteMask = /*#__PURE__*/ function(Renderer1) {
7717
+ _inherits(SpriteMask, Renderer1);
7653
7718
  function SpriteMask(entity) {
7654
7719
  var _this;
7655
- _this = Renderer.call(this, entity) || this;
7720
+ _this = Renderer1.call(this, entity) || this;
7656
7721
  /** The mask layers the sprite mask influence to. */ _this.influenceLayers = SpriteMaskLayer.Everything;
7657
7722
  _this._sprite = null;
7658
7723
  _this._automaticWidth = 0;
@@ -7673,7 +7738,7 @@ SimpleSpriteAssembler = __decorate([
7673
7738
  /**
7674
7739
  * @internal
7675
7740
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
7676
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
7741
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
7677
7742
  target.sprite = this._sprite;
7678
7743
  };
7679
7744
  /**
@@ -7716,7 +7781,7 @@ SimpleSpriteAssembler = __decorate([
7716
7781
  * @internal
7717
7782
  * @inheritdoc
7718
7783
  */ _proto._onDestroy = function _onDestroy() {
7719
- Renderer.prototype._onDestroy.call(this);
7784
+ Renderer1.prototype._onDestroy.call(this);
7720
7785
  var sprite = this._sprite;
7721
7786
  if (sprite) {
7722
7787
  sprite._addReferCount(-1);
@@ -8161,13 +8226,13 @@ var BufferUtil = /*#__PURE__*/ function() {
8161
8226
 
8162
8227
  /**
8163
8228
  * Buffer.
8164
- */ var Buffer = /*#__PURE__*/ function(GraphicsResource) {
8165
- _inherits(Buffer, GraphicsResource);
8229
+ */ var Buffer = /*#__PURE__*/ function(GraphicsResource1) {
8230
+ _inherits(Buffer, GraphicsResource1);
8166
8231
  function Buffer(engine, type, byteLengthOrData, bufferUsage, readable) {
8167
8232
  if (bufferUsage === void 0) bufferUsage = BufferUsage.Static;
8168
8233
  if (readable === void 0) readable = false;
8169
8234
  var _this;
8170
- _this = GraphicsResource.call(this, engine) || this;
8235
+ _this = GraphicsResource1.call(this, engine) || this;
8171
8236
  /** @internal */ _this._dataUpdateManager = new UpdateFlagManager();
8172
8237
  _this._engine = engine;
8173
8238
  _this._type = type;
@@ -8234,7 +8299,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8234
8299
  /**
8235
8300
  * @internal
8236
8301
  */ _proto._onDestroy = function _onDestroy() {
8237
- GraphicsResource.prototype._onDestroy.call(this);
8302
+ GraphicsResource1.prototype._onDestroy.call(this);
8238
8303
  this._platformBuffer.destroy();
8239
8304
  };
8240
8305
  _create_class(Buffer, [
@@ -8358,11 +8423,11 @@ var BufferUtil = /*#__PURE__*/ function() {
8358
8423
  /**
8359
8424
  * @internal
8360
8425
  * Primitive.
8361
- */ var Primitive = /*#__PURE__*/ function(GraphicsResource) {
8362
- _inherits(Primitive, GraphicsResource);
8426
+ */ var Primitive = /*#__PURE__*/ function(GraphicsResource1) {
8427
+ _inherits(Primitive, GraphicsResource1);
8363
8428
  function Primitive(engine) {
8364
8429
  var _this;
8365
- _this = GraphicsResource.call(this, engine) || this;
8430
+ _this = GraphicsResource1.call(this, engine) || this;
8366
8431
  _this.enableVAO = true;
8367
8432
  _this.instanceCount = 0;
8368
8433
  _this.vertexBufferBindings = [];
@@ -8427,9 +8492,9 @@ var BufferUtil = /*#__PURE__*/ function() {
8427
8492
  var referCount = this._getReferCount();
8428
8493
  var vertexBufferBindings = this.vertexBufferBindings;
8429
8494
  if (referCount > 0) {
8430
- var _vertexBufferBindings_index;
8495
+ var _vertexBufferBindings_index, _binding;
8431
8496
  (_vertexBufferBindings_index = vertexBufferBindings[index]) == null ? void 0 : _vertexBufferBindings_index.buffer._addReferCount(-referCount);
8432
- binding == null ? void 0 : binding.buffer._addReferCount(referCount);
8497
+ (_binding = binding) == null ? void 0 : _binding.buffer._addReferCount(referCount);
8433
8498
  }
8434
8499
  vertexBufferBindings[index] = binding;
8435
8500
  this._bufferStructChanged = true;
@@ -8452,8 +8517,9 @@ var BufferUtil = /*#__PURE__*/ function() {
8452
8517
  var lastBinding = this.indexBufferBinding;
8453
8518
  var referCount = this._getReferCount();
8454
8519
  if (lastBinding !== binding) {
8520
+ var _lastBinding, _lastBinding1, _binding;
8455
8521
  this._indexBufferBinding = binding;
8456
- referCount > 0 && (lastBinding == null ? void 0 : lastBinding.buffer._addReferCount(-referCount));
8522
+ referCount > 0 && ((_lastBinding = lastBinding) == null ? void 0 : _lastBinding.buffer._addReferCount(-referCount));
8457
8523
  if (binding) {
8458
8524
  referCount > 0 && binding.buffer._addReferCount(referCount);
8459
8525
  this._glIndexType = BufferUtil._getGLIndexType(binding.format);
@@ -8461,7 +8527,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8461
8527
  } else {
8462
8528
  this._glIndexType = undefined;
8463
8529
  }
8464
- this._bufferStructChanged = (lastBinding == null ? void 0 : lastBinding.buffer) !== (binding == null ? void 0 : binding.buffer);
8530
+ this._bufferStructChanged = ((_lastBinding1 = lastBinding) == null ? void 0 : _lastBinding1.buffer) !== ((_binding = binding) == null ? void 0 : _binding.buffer);
8465
8531
  }
8466
8532
  };
8467
8533
  _proto.draw = function draw(shaderProgram, subMesh) {
@@ -8470,7 +8536,7 @@ var BufferUtil = /*#__PURE__*/ function() {
8470
8536
  };
8471
8537
  _proto._addReferCount = function _addReferCount(value) {
8472
8538
  var _this_indexBufferBinding;
8473
- GraphicsResource.prototype._addReferCount.call(this, value);
8539
+ GraphicsResource1.prototype._addReferCount.call(this, value);
8474
8540
  var vertexBufferBindings = this.vertexBufferBindings;
8475
8541
  for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
8476
8542
  var _vertexBufferBindings_i;
@@ -8505,11 +8571,11 @@ var BufferUtil = /*#__PURE__*/ function() {
8505
8571
 
8506
8572
  /**
8507
8573
  * Mesh.
8508
- */ var Mesh = /*#__PURE__*/ function(ReferResource) {
8509
- _inherits(Mesh, ReferResource);
8574
+ */ var Mesh = /*#__PURE__*/ function(ReferResource1) {
8575
+ _inherits(Mesh, ReferResource1);
8510
8576
  function Mesh(engine, name) {
8511
8577
  var _this;
8512
- _this = ReferResource.call(this, engine) || this;
8578
+ _this = ReferResource1.call(this, engine) || this;
8513
8579
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
8514
8580
  _this._bounds = new BoundingBox();
8515
8581
  _this._subMeshes = [];
@@ -8584,13 +8650,13 @@ var BufferUtil = /*#__PURE__*/ function() {
8584
8650
  this._primitive.setVertexBufferBinding(index, binding);
8585
8651
  };
8586
8652
  _proto._addReferCount = function _addReferCount(value) {
8587
- ReferResource.prototype._addReferCount.call(this, value);
8653
+ ReferResource1.prototype._addReferCount.call(this, value);
8588
8654
  this._primitive._addReferCount(value);
8589
8655
  };
8590
8656
  /**
8591
8657
  * @internal
8592
8658
  */ _proto._onDestroy = function _onDestroy() {
8593
- ReferResource.prototype._onDestroy.call(this);
8659
+ ReferResource1.prototype._onDestroy.call(this);
8594
8660
  this._primitive.destroy();
8595
8661
  };
8596
8662
  /**
@@ -8836,10 +8902,10 @@ var BlendShapeFrameDirty;
8836
8902
 
8837
8903
  /**
8838
8904
  * BufferMesh.
8839
- */ var BufferMesh = /*#__PURE__*/ function(Mesh) {
8840
- _inherits(BufferMesh, Mesh);
8905
+ */ var BufferMesh = /*#__PURE__*/ function(Mesh1) {
8906
+ _inherits(BufferMesh, Mesh1);
8841
8907
  function BufferMesh() {
8842
- return Mesh.apply(this, arguments);
8908
+ return Mesh1.apply(this, arguments);
8843
8909
  }
8844
8910
  var _proto = BufferMesh.prototype;
8845
8911
  /**
@@ -8922,11 +8988,11 @@ var BlendShapeFrameDirty;
8922
8988
 
8923
8989
  /**
8924
8990
  * MeshRenderer Component.
8925
- */ var MeshRenderer = /*#__PURE__*/ function(Renderer) {
8926
- _inherits(MeshRenderer, Renderer);
8991
+ */ var MeshRenderer = /*#__PURE__*/ function(Renderer1) {
8992
+ _inherits(MeshRenderer, Renderer1);
8927
8993
  function MeshRenderer(entity) {
8928
8994
  var _this;
8929
- _this = Renderer.call(this, entity) || this;
8995
+ _this = Renderer1.call(this, entity) || this;
8930
8996
  _this._enableVertexColor = false;
8931
8997
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
8932
8998
  return _this;
@@ -8935,7 +9001,7 @@ var BlendShapeFrameDirty;
8935
9001
  /**
8936
9002
  * @internal
8937
9003
  */ _proto._onDestroy = function _onDestroy() {
8938
- Renderer.prototype._onDestroy.call(this);
9004
+ Renderer1.prototype._onDestroy.call(this);
8939
9005
  var mesh = this._mesh;
8940
9006
  if (mesh) {
8941
9007
  mesh.destroyed || mesh._addReferCount(-1);
@@ -8946,7 +9012,7 @@ var BlendShapeFrameDirty;
8946
9012
  /**
8947
9013
  * @internal
8948
9014
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
8949
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
9015
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
8950
9016
  target.mesh = this._mesh;
8951
9017
  };
8952
9018
  /**
@@ -8956,7 +9022,7 @@ var BlendShapeFrameDirty;
8956
9022
  Logger.error("mesh is null.");
8957
9023
  return;
8958
9024
  }
8959
- Renderer.prototype._prepareRender.call(this, context);
9025
+ Renderer1.prototype._prepareRender.call(this, context);
8960
9026
  };
8961
9027
  /**
8962
9028
  * @internal
@@ -9569,11 +9635,11 @@ var /**
9569
9635
 
9570
9636
  /**
9571
9637
  * Mesh containing common vertex elements of the model.
9572
- */ var ModelMesh = /*#__PURE__*/ function(Mesh) {
9573
- _inherits(ModelMesh, Mesh);
9638
+ */ var ModelMesh = /*#__PURE__*/ function(Mesh1) {
9639
+ _inherits(ModelMesh, Mesh1);
9574
9640
  function ModelMesh(engine, name) {
9575
9641
  var _this;
9576
- _this = Mesh.call(this, engine) || this;
9642
+ _this = Mesh1.call(this, engine) || this;
9577
9643
  /** @internal */ _this._internalVertexBufferIndex = -1;
9578
9644
  _this._vertexCount = 0;
9579
9645
  _this._vertexCountDirty = false;
@@ -9616,13 +9682,14 @@ var /**
9616
9682
  * Set positions for the mesh.
9617
9683
  * @param positions - The positions for the mesh
9618
9684
  */ _proto.setPositions = function setPositions(positions) {
9685
+ var _positions;
9619
9686
  if (!this._positions && !positions) {
9620
9687
  return;
9621
9688
  }
9622
9689
  this._updateAdvancedVertexDataMarks(0x1, 0);
9623
9690
  this._positions = positions;
9624
9691
  var _positions_length;
9625
- this._vertexCount = (_positions_length = positions == null ? void 0 : positions.length) != null ? _positions_length : 0;
9692
+ this._vertexCount = (_positions_length = (_positions = positions) == null ? void 0 : _positions.length) != null ? _positions_length : 0;
9626
9693
  this._vertexCountDirty = false;
9627
9694
  };
9628
9695
  /**
@@ -9949,9 +10016,10 @@ var /**
9949
10016
  var vertexBufferInfos = this._vertexBufferInfos;
9950
10017
  var vertexBufferBindings = this._primitive.vertexBufferBindings;
9951
10018
  for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
10019
+ var _vertexBufferInfo;
9952
10020
  var vertexBufferInfo = vertexBufferInfos[i];
9953
10021
  // VertexBufferInfo maybe undefined
9954
- if (vertexBufferInfo == null ? void 0 : vertexBufferInfo.uploadAdvancedData) {
10022
+ if ((_vertexBufferInfo = vertexBufferInfo) == null ? void 0 : _vertexBufferInfo.uploadAdvancedData) {
9955
10023
  var _vertexBufferBindings_i;
9956
10024
  var buffer = (_vertexBufferBindings_i = vertexBufferBindings[i]) == null ? void 0 : _vertexBufferBindings_i.buffer;
9957
10025
  buffer.setData(buffer.data);
@@ -9966,7 +10034,8 @@ var /**
9966
10034
  var indexBuffer = (_this__primitive_indexBufferBinding = this._primitive.indexBufferBinding) == null ? void 0 : _this__primitive_indexBufferBinding._buffer;
9967
10035
  if (indices) {
9968
10036
  if (!indexBuffer || indices.byteLength != indexBuffer.byteLength) {
9969
- indexBuffer == null ? void 0 : indexBuffer.destroy();
10037
+ var _indexBuffer;
10038
+ (_indexBuffer = indexBuffer) == null ? void 0 : _indexBuffer.destroy();
9970
10039
  var newIndexBuffer = new Buffer(this._engine, BufferBindFlag.IndexBuffer, indices);
9971
10040
  this._setIndexBufferBinding(new IndexBufferBinding(newIndexBuffer, this._indicesFormat));
9972
10041
  } else {
@@ -10076,7 +10145,7 @@ var /**
10076
10145
  // Remove listener from previous binding
10077
10146
  var previousBinding = vertexBufferBindings[index];
10078
10147
  previousBinding && previousBinding.buffer._dataUpdateManager.removeListener(onVertexBufferChanged);
10079
- Mesh.prototype._setVertexBufferBinding.call(this, index, binding);
10148
+ Mesh1.prototype._setVertexBufferBinding.call(this, index, binding);
10080
10149
  // Add listener to new binding and trigger update
10081
10150
  if (binding) {
10082
10151
  var _updateInfos, _index;
@@ -10108,7 +10177,7 @@ var /**
10108
10177
  /**
10109
10178
  * @internal
10110
10179
  */ _proto._onDestroy = function _onDestroy() {
10111
- Mesh.prototype._onDestroy.call(this);
10180
+ Mesh1.prototype._onDestroy.call(this);
10112
10181
  this._releaseCache(true);
10113
10182
  };
10114
10183
  _proto._getVertexElementData = function _getVertexElementData(vertices, vertexAttribute, vertexElementIndex, readVertexData) {
@@ -10184,13 +10253,14 @@ var /**
10184
10253
  });
10185
10254
  };
10186
10255
  _proto._readVertexData = function _readVertexData(attributeType, onVertexParse) {
10256
+ var _bufferBinding;
10187
10257
  var primitive = this._primitive;
10188
10258
  var vertexElement = primitive._vertexElementMap[attributeType];
10189
10259
  if (!vertexElement) {
10190
10260
  return null;
10191
10261
  }
10192
10262
  var bufferBinding = primitive.vertexBufferBindings[vertexElement.bindingIndex];
10193
- var buffer = bufferBinding == null ? void 0 : bufferBinding.buffer;
10263
+ var buffer = (_bufferBinding = bufferBinding) == null ? void 0 : _bufferBinding.buffer;
10194
10264
  if (!buffer) {
10195
10265
  return null;
10196
10266
  }
@@ -10344,11 +10414,12 @@ var /**
10344
10414
  });
10345
10415
  };
10346
10416
  _proto._writeAdvancedVertexData = function _writeAdvancedVertexData(attribute, elementIndex, onVertexWrite) {
10417
+ var _bufferBinding;
10347
10418
  var primitive = this._primitive;
10348
10419
  var vertexElement = primitive._vertexElementMap[attribute];
10349
10420
  var bindingIndex = vertexElement.bindingIndex;
10350
10421
  var bufferBinding = primitive.vertexBufferBindings[bindingIndex];
10351
- var buffer = bufferBinding == null ? void 0 : bufferBinding.buffer;
10422
+ var buffer = (_bufferBinding = bufferBinding) == null ? void 0 : _bufferBinding.buffer;
10352
10423
  if (!buffer) {
10353
10424
  return;
10354
10425
  }
@@ -10644,11 +10715,11 @@ var VertexElementIndex;
10644
10715
 
10645
10716
  /**
10646
10717
  * @internal
10647
- */ var PrimitiveMeshRestorer = /*#__PURE__*/ function(ContentRestorer) {
10648
- _inherits(PrimitiveMeshRestorer, ContentRestorer);
10718
+ */ var PrimitiveMeshRestorer = /*#__PURE__*/ function(ContentRestorer1) {
10719
+ _inherits(PrimitiveMeshRestorer, ContentRestorer1);
10649
10720
  function PrimitiveMeshRestorer(resource, primitiveInfo) {
10650
10721
  var _this;
10651
- _this = ContentRestorer.call(this, resource) || this;
10722
+ _this = ContentRestorer1.call(this, resource) || this;
10652
10723
  _this.primitiveInfo = primitiveInfo;
10653
10724
  return _this;
10654
10725
  }
@@ -11653,11 +11724,11 @@ var PrimitiveType;
11653
11724
 
11654
11725
  /**
11655
11726
  * Mesh skin data, equal glTF skins define
11656
- */ var Skin = /*#__PURE__*/ function(EngineObject) {
11657
- _inherits(Skin, EngineObject);
11727
+ */ var Skin = /*#__PURE__*/ function(EngineObject1) {
11728
+ _inherits(Skin, EngineObject1);
11658
11729
  function Skin(name) {
11659
11730
  var _this;
11660
- _this = EngineObject.call(this, null) || this;
11731
+ _this = EngineObject1.call(this, null) || this;
11661
11732
  _this.name = name;
11662
11733
  _this._bones = [];
11663
11734
  _this.inverseBindMatrices = []; // inverse bind matrix array
@@ -11670,11 +11741,11 @@ var PrimitiveType;
11670
11741
 
11671
11742
  /**
11672
11743
  * SkinnedMeshRenderer.
11673
- */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
11674
- _inherits(SkinnedMeshRenderer, MeshRenderer);
11744
+ */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer1) {
11745
+ _inherits(SkinnedMeshRenderer, MeshRenderer1);
11675
11746
  function SkinnedMeshRenderer(entity) {
11676
11747
  var _this;
11677
- _this = MeshRenderer.call(this, entity) || this;
11748
+ _this = MeshRenderer1.call(this, entity) || this;
11678
11749
  _this._jointDataCreateCache = new Vector2(-1, -1);
11679
11750
  _this._localBounds = new BoundingBox();
11680
11751
  _this._skin = null;
@@ -11772,7 +11843,7 @@ var PrimitiveType;
11772
11843
  * @internal
11773
11844
  */ _proto._onDestroy = function _onDestroy() {
11774
11845
  var _this__rootBone, _this__jointTexture;
11775
- MeshRenderer.prototype._onDestroy.call(this);
11846
+ MeshRenderer1.prototype._onDestroy.call(this);
11776
11847
  (_this__rootBone = this._rootBone) == null ? void 0 : _this__rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
11777
11848
  this._rootBone = null;
11778
11849
  this._jointDataCreateCache = null;
@@ -11787,7 +11858,7 @@ var PrimitiveType;
11787
11858
  /**
11788
11859
  * @internal
11789
11860
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
11790
- MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
11861
+ MeshRenderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
11791
11862
  var paths = new Array();
11792
11863
  // Clone rootBone
11793
11864
  if (this.rootBone) {
@@ -11821,7 +11892,7 @@ var PrimitiveType;
11821
11892
  var worldMatrix = this._rootBone.transform.worldMatrix;
11822
11893
  BoundingBox.transform(localBounds, worldMatrix, worldBounds);
11823
11894
  } else {
11824
- MeshRenderer.prototype._updateBounds.call(this, worldBounds);
11895
+ MeshRenderer1.prototype._updateBounds.call(this, worldBounds);
11825
11896
  }
11826
11897
  };
11827
11898
  _proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
@@ -11930,11 +12001,11 @@ var PrimitiveType;
11930
12001
  },
11931
12002
  set: function set(value) {
11932
12003
  if (this._bones !== value) {
11933
- var _this__bones;
12004
+ var _this__bones, _value;
11934
12005
  var _this__bones_length;
11935
12006
  var lastBoneCount = (_this__bones_length = (_this__bones = this._bones) == null ? void 0 : _this__bones.length) != null ? _this__bones_length : 0;
11936
12007
  var _value_length;
11937
- var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
12008
+ var boneCount = (_value_length = (_value = value) == null ? void 0 : _value.length) != null ? _value_length : 0;
11938
12009
  if (lastBoneCount !== boneCount) {
11939
12010
  var shaderData = this.shaderData;
11940
12011
  if (boneCount > 0) {
@@ -12180,10 +12251,10 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12180
12251
  Basic2DBatcher._canUploadSameBuffer = true;
12181
12252
  })();
12182
12253
 
12183
- var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
12184
- _inherits(SpriteMaskBatcher, Basic2DBatcher);
12254
+ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher1) {
12255
+ _inherits(SpriteMaskBatcher, Basic2DBatcher1);
12185
12256
  function SpriteMaskBatcher() {
12186
- return Basic2DBatcher.apply(this, arguments);
12257
+ return Basic2DBatcher1.apply(this, arguments);
12187
12258
  }
12188
12259
  var _proto = SpriteMaskBatcher.prototype;
12189
12260
  _proto.createVertexElements = function createVertexElements(vertexElements) {
@@ -12252,7 +12323,7 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
12252
12323
  program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
12253
12324
  program.uploadAll(program.materialUniformBlock, material.shaderData);
12254
12325
  material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
12255
- engine._hardwareRenderer.drawPrimitive(mesh, subMesh, program);
12326
+ engine._hardwareRenderer.drawPrimitive(mesh._primitive, subMesh, program);
12256
12327
  }
12257
12328
  };
12258
12329
  return SpriteMaskBatcher;
@@ -12320,11 +12391,11 @@ var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
12320
12391
  return SpriteMaskManager;
12321
12392
  }();
12322
12393
 
12323
- var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData) {
12324
- _inherits(SpriteMaskRenderData, RenderData);
12394
+ var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData1) {
12395
+ _inherits(SpriteMaskRenderData, RenderData1);
12325
12396
  function SpriteMaskRenderData() {
12326
12397
  var _this;
12327
- _this = RenderData.call(this) || this;
12398
+ _this = RenderData1.call(this) || this;
12328
12399
  _this.isAdd = true;
12329
12400
  _this.multiRenderData = false;
12330
12401
  return _this;
@@ -12341,11 +12412,11 @@ var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData) {
12341
12412
  return SpriteMaskRenderData;
12342
12413
  }(RenderData);
12343
12414
 
12344
- var SpriteRenderData = /*#__PURE__*/ function(RenderData) {
12345
- _inherits(SpriteRenderData, RenderData);
12415
+ var SpriteRenderData = /*#__PURE__*/ function(RenderData1) {
12416
+ _inherits(SpriteRenderData, RenderData1);
12346
12417
  function SpriteRenderData() {
12347
12418
  var _this;
12348
- _this = RenderData.call(this) || this;
12419
+ _this = RenderData1.call(this) || this;
12349
12420
  _this.multiRenderData = false;
12350
12421
  return _this;
12351
12422
  }
@@ -12364,11 +12435,11 @@ var SpriteRenderData = /*#__PURE__*/ function(RenderData) {
12364
12435
  return SpriteRenderData;
12365
12436
  }(RenderData);
12366
12437
 
12367
- var TextRenderData = /*#__PURE__*/ function(RenderData) {
12368
- _inherits(TextRenderData, RenderData);
12438
+ var TextRenderData = /*#__PURE__*/ function(RenderData1) {
12439
+ _inherits(TextRenderData, RenderData1);
12369
12440
  function TextRenderData() {
12370
12441
  var _this;
12371
- _this = RenderData.call(this) || this;
12442
+ _this = RenderData1.call(this) || this;
12372
12443
  _this.charsData = [];
12373
12444
  _this.multiRenderData = true;
12374
12445
  return _this;
@@ -12414,6 +12485,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
12414
12485
  AssetType[/** HDR to cube. */ "HDR"] = "HDR";
12415
12486
  AssetType[/** Font. */ "Font"] = "Font";
12416
12487
  AssetType[/** Source Font, include ttf、 otf and woff. */ "SourceFont"] = "SourceFont";
12488
+ AssetType[/** Project asset. */ "Project"] = "project";
12417
12489
  })(AssetType || (AssetType = {}));
12418
12490
 
12419
12491
  var SafeLoopArray = /*#__PURE__*/ function() {
@@ -13700,11 +13772,11 @@ SystemInfo._initialize();
13700
13772
  CameraClearFlags[CameraClearFlags[/* Clear color with scene background, depth, and stencil. */ "All"] = 0x7] = "All";
13701
13773
  })(CameraClearFlags || (CameraClearFlags = {}));
13702
13774
 
13703
- var Collider = /*#__PURE__*/ function(Component) {
13704
- _inherits(Collider, Component);
13775
+ var Collider = /*#__PURE__*/ function(Component1) {
13776
+ _inherits(Collider, Component1);
13705
13777
  function Collider(entity) {
13706
13778
  var _this;
13707
- _this = Component.call(this, entity) || this;
13779
+ _this = Component1.call(this, entity) || this;
13708
13780
  /** @internal */ _this._index = -1;
13709
13781
  _this._shapes = [];
13710
13782
  _this._updateFlag = _this.entity.transform.registerWorldChangeFlag();
@@ -13779,7 +13851,7 @@ var Collider = /*#__PURE__*/ function(Component) {
13779
13851
  /**
13780
13852
  * @internal
13781
13853
  */ _proto._onDestroy = function _onDestroy() {
13782
- Component.prototype._onDestroy.call(this);
13854
+ Component1.prototype._onDestroy.call(this);
13783
13855
  this.clearShapes();
13784
13856
  this._nativeCollider.destroy();
13785
13857
  };
@@ -14085,11 +14157,11 @@ var Collision = function Collision() {
14085
14157
 
14086
14158
  /**
14087
14159
  * The character controllers.
14088
- */ var CharacterController = /*#__PURE__*/ function(Collider) {
14089
- _inherits(CharacterController, Collider);
14160
+ */ var CharacterController = /*#__PURE__*/ function(Collider1) {
14161
+ _inherits(CharacterController, Collider1);
14090
14162
  function CharacterController(entity) {
14091
14163
  var _this;
14092
- _this = Collider.call(this, entity) || this;
14164
+ _this = Collider1.call(this, entity) || this;
14093
14165
  _this._stepOffset = 0.5;
14094
14166
  _this._nonWalkableMode = ControllerNonWalkableMode.PreventClimbing;
14095
14167
  _this._upDirection = new Vector3(0, 1, 0);
@@ -14117,14 +14189,14 @@ var Collision = function Collision() {
14117
14189
  if (this._shapes.length > 0) {
14118
14190
  throw "only allow single shape on controller!";
14119
14191
  }
14120
- Collider.prototype.addShape.call(this, shape);
14192
+ Collider1.prototype.addShape.call(this, shape);
14121
14193
  this._updateFlag.flag = true;
14122
14194
  };
14123
14195
  /**
14124
14196
  * Remove all shape attached.
14125
14197
  */ _proto.clearShapes = function clearShapes() {
14126
14198
  if (this._shapes.length > 0) {
14127
- Collider.prototype.removeShape.call(this, this._shapes[0]);
14199
+ Collider1.prototype.removeShape.call(this, this._shapes[0]);
14128
14200
  }
14129
14201
  };
14130
14202
  /**
@@ -14224,11 +14296,11 @@ var Collision = function Collision() {
14224
14296
 
14225
14297
  /**
14226
14298
  * A dynamic collider can act with self-defined movement or physical force.
14227
- */ var DynamicCollider = /*#__PURE__*/ function(Collider) {
14228
- _inherits(DynamicCollider, Collider);
14299
+ */ var DynamicCollider = /*#__PURE__*/ function(Collider1) {
14300
+ _inherits(DynamicCollider, Collider1);
14229
14301
  function DynamicCollider(entity) {
14230
14302
  var _this;
14231
- _this = Collider.call(this, entity) || this;
14303
+ _this = Collider1.call(this, entity) || this;
14232
14304
  _this._linearDamping = 0;
14233
14305
  _this._angularDamping = 0.05;
14234
14306
  _this._linearVelocity = new Vector3();
@@ -14633,11 +14705,11 @@ var DynamicColliderConstraints;
14633
14705
  /**
14634
14706
  * A static collider component that will not move.
14635
14707
  * @remarks Mostly used for object which always stays at the same place and never moves around.
14636
- */ var StaticCollider = /*#__PURE__*/ function(Collider) {
14637
- _inherits(StaticCollider, Collider);
14708
+ */ var StaticCollider = /*#__PURE__*/ function(Collider1) {
14709
+ _inherits(StaticCollider, Collider1);
14638
14710
  function StaticCollider(entity) {
14639
14711
  var _this;
14640
- _this = Collider.call(this, entity) || this;
14712
+ _this = Collider1.call(this, entity) || this;
14641
14713
  var transform = _this.entity.transform;
14642
14714
  _this._nativeCollider = PhysicsScene._nativePhysics.createStaticCollider(transform.worldPosition, transform.worldRotationQuaternion);
14643
14715
  return _this;
@@ -14663,11 +14735,11 @@ var DynamicColliderConstraints;
14663
14735
  ControllerCollisionFlag[ControllerCollisionFlag[/** Character has collision below. */ "Down"] = 4] = "Down";
14664
14736
  })(ControllerCollisionFlag || (ControllerCollisionFlag = {}));
14665
14737
 
14666
- var Joint = /*#__PURE__*/ function(Component) {
14667
- _inherits(Joint, Component);
14738
+ var Joint = /*#__PURE__*/ function(Component1) {
14739
+ _inherits(Joint, Component1);
14668
14740
  function Joint(entity) {
14669
14741
  var _this;
14670
- _this = Component.call(this, entity) || this;
14742
+ _this = Component1.call(this, entity) || this;
14671
14743
  _this._connectedCollider = new JointCollider();
14672
14744
  _this._collider = new JointCollider();
14673
14745
  _this._force = 0;
@@ -14806,10 +14878,10 @@ Joint = __decorate([
14806
14878
 
14807
14879
  /*
14808
14880
  * A fixed joint permits no relative movement between two colliders. ie the colliders are glued together.
14809
- */ var FixedJoint = /*#__PURE__*/ function(Joint) {
14810
- _inherits(FixedJoint, Joint);
14881
+ */ var FixedJoint = /*#__PURE__*/ function(Joint1) {
14882
+ _inherits(FixedJoint, Joint1);
14811
14883
  function FixedJoint() {
14812
- return Joint.apply(this, arguments);
14884
+ return Joint1.apply(this, arguments);
14813
14885
  }
14814
14886
  var _proto = FixedJoint.prototype;
14815
14887
  /**
@@ -14827,20 +14899,21 @@ Joint = __decorate([
14827
14899
  * @internal
14828
14900
  */ var HingeJointFlag;
14829
14901
  (function(HingeJointFlag) {
14830
- HingeJointFlag[HingeJointFlag[/** enable the limit */ "LimitEnabled"] = 1] = "LimitEnabled";
14831
- HingeJointFlag[HingeJointFlag[/** enable the drive */ "DriveEnabled"] = 2] = "DriveEnabled";
14832
- HingeJointFlag[HingeJointFlag[/** if the existing velocity is beyond the drive velocity, do not add force */ "DriveFreeSpin"] = 4] = "DriveFreeSpin";
14902
+ HingeJointFlag[HingeJointFlag[/** None. */ "None"] = 0] = "None";
14903
+ HingeJointFlag[HingeJointFlag[/** Enable the limit. */ "LimitEnabled"] = 1] = "LimitEnabled";
14904
+ HingeJointFlag[HingeJointFlag[/** Enable the drive. */ "DriveEnabled"] = 2] = "DriveEnabled";
14905
+ HingeJointFlag[HingeJointFlag[/** If the existing velocity is beyond the drive velocity, do not add force. */ "DriveFreeSpin"] = 4] = "DriveFreeSpin";
14833
14906
  })(HingeJointFlag || (HingeJointFlag = {}));
14834
14907
 
14835
14908
  /**
14836
14909
  * A joint which behaves in a similar way to a hinge or axle.
14837
- */ var HingeJoint = /*#__PURE__*/ function(Joint) {
14838
- _inherits(HingeJoint, Joint);
14910
+ */ var HingeJoint = /*#__PURE__*/ function(Joint1) {
14911
+ _inherits(HingeJoint, Joint1);
14839
14912
  function HingeJoint() {
14840
14913
  var _this;
14841
- _this = Joint.apply(this, arguments) || this;
14914
+ _this = Joint1.apply(this, arguments) || this;
14842
14915
  _this._axis = new Vector3(1, 0, 0);
14843
- _this._hingeFlags = 0;
14916
+ _this._hingeFlags = HingeJointFlag.None;
14844
14917
  _this._useSpring = false;
14845
14918
  return _this;
14846
14919
  }
@@ -14909,9 +14982,9 @@ Joint = __decorate([
14909
14982
  },
14910
14983
  set: function set(value) {
14911
14984
  if (value !== this.useLimits) {
14912
- this._hingeFlags |= HingeJointFlag.LimitEnabled;
14985
+ value ? this._hingeFlags |= HingeJointFlag.LimitEnabled : this._hingeFlags &= ~HingeJointFlag.LimitEnabled;
14986
+ this._nativeJoint.setHingeJointFlag(HingeJointFlag.LimitEnabled, value);
14913
14987
  }
14914
- this._nativeJoint.setHingeJointFlag(HingeJointFlag.LimitEnabled, value);
14915
14988
  }
14916
14989
  },
14917
14990
  {
@@ -14923,9 +14996,9 @@ Joint = __decorate([
14923
14996
  },
14924
14997
  set: function set(value) {
14925
14998
  if (value !== this.useMotor) {
14926
- this._hingeFlags |= HingeJointFlag.DriveEnabled;
14999
+ value ? this._hingeFlags |= HingeJointFlag.DriveEnabled : this._hingeFlags &= ~HingeJointFlag.DriveEnabled;
15000
+ this._nativeJoint.setHingeJointFlag(HingeJointFlag.DriveEnabled, value);
14927
15001
  }
14928
- this._nativeJoint.setHingeJointFlag(HingeJointFlag.DriveEnabled, value);
14929
15002
  }
14930
15003
  },
14931
15004
  {
@@ -14983,11 +15056,11 @@ Joint = __decorate([
14983
15056
 
14984
15057
  /**
14985
15058
  * A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
14986
- */ var SpringJoint = /*#__PURE__*/ function(Joint) {
14987
- _inherits(SpringJoint, Joint);
15059
+ */ var SpringJoint = /*#__PURE__*/ function(Joint1) {
15060
+ _inherits(SpringJoint, Joint1);
14988
15061
  function SpringJoint() {
14989
15062
  var _this;
14990
- _this = Joint.apply(this, arguments) || this;
15063
+ _this = Joint1.apply(this, arguments) || this;
14991
15064
  _this._minDistance = 0;
14992
15065
  _this._maxDistance = 0;
14993
15066
  _this._tolerance = 0.25;
@@ -15242,11 +15315,11 @@ Joint = __decorate([
15242
15315
 
15243
15316
  /**
15244
15317
  * Physical collider shape for box.
15245
- */ var BoxColliderShape = /*#__PURE__*/ function(ColliderShape) {
15246
- _inherits(BoxColliderShape, ColliderShape);
15318
+ */ var BoxColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15319
+ _inherits(BoxColliderShape, ColliderShape1);
15247
15320
  function BoxColliderShape() {
15248
15321
  var _this;
15249
- _this = ColliderShape.call(this) || this;
15322
+ _this = ColliderShape1.call(this) || this;
15250
15323
  _this._size = new Vector3(1, 1, 1);
15251
15324
  _this._nativeShape = PhysicsScene._nativePhysics.createBoxColliderShape(_this._id, _this._size, _this._material._nativeMaterial);
15252
15325
  _this._setSize = _this._setSize.bind(_assert_this_initialized(_this));
@@ -15278,11 +15351,11 @@ Joint = __decorate([
15278
15351
 
15279
15352
  /**
15280
15353
  * Physical collider shape for sphere.
15281
- */ var SphereColliderShape = /*#__PURE__*/ function(ColliderShape) {
15282
- _inherits(SphereColliderShape, ColliderShape);
15354
+ */ var SphereColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15355
+ _inherits(SphereColliderShape, ColliderShape1);
15283
15356
  function SphereColliderShape() {
15284
15357
  var _this;
15285
- _this = ColliderShape.call(this) || this;
15358
+ _this = ColliderShape1.call(this) || this;
15286
15359
  _this._radius = 1;
15287
15360
  _this._nativeShape = PhysicsScene._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
15288
15361
  return _this;
@@ -15308,11 +15381,11 @@ Joint = __decorate([
15308
15381
 
15309
15382
  /**
15310
15383
  * Physical collider shape plane.
15311
- */ var PlaneColliderShape = /*#__PURE__*/ function(ColliderShape) {
15312
- _inherits(PlaneColliderShape, ColliderShape);
15384
+ */ var PlaneColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15385
+ _inherits(PlaneColliderShape, ColliderShape1);
15313
15386
  function PlaneColliderShape() {
15314
15387
  var _this;
15315
- _this = ColliderShape.call(this) || this;
15388
+ _this = ColliderShape1.call(this) || this;
15316
15389
  _this._nativeShape = PhysicsScene._nativePhysics.createPlaneColliderShape(_this._id, _this._material._nativeMaterial);
15317
15390
  return _this;
15318
15391
  }
@@ -15321,11 +15394,11 @@ Joint = __decorate([
15321
15394
 
15322
15395
  /**
15323
15396
  * Physical collider shape for capsule.
15324
- */ var CapsuleColliderShape = /*#__PURE__*/ function(ColliderShape) {
15325
- _inherits(CapsuleColliderShape, ColliderShape);
15397
+ */ var CapsuleColliderShape = /*#__PURE__*/ function(ColliderShape1) {
15398
+ _inherits(CapsuleColliderShape, ColliderShape1);
15326
15399
  function CapsuleColliderShape() {
15327
15400
  var _this;
15328
- _this = ColliderShape.call(this) || this;
15401
+ _this = ColliderShape1.call(this) || this;
15329
15402
  _this._radius = 1;
15330
15403
  _this._height = 2;
15331
15404
  _this._upAxis = ColliderShapeUpAxis.Y;
@@ -15407,44 +15480,55 @@ Joint = __decorate([
15407
15480
  /**
15408
15481
  * @internal
15409
15482
  */ _proto._update = function _update() {
15410
- var _this = this, pointers = _this._pointers, nativeEvents = _this._nativeEvents;
15483
+ var _this = this, pointers = _this._pointers, nativeEvents = _this._nativeEvents, htmlCanvas = _this._htmlCanvas;
15484
+ var _this__canvas = this._canvas, width = _this__canvas.width, height = _this__canvas.height;
15485
+ var clientWidth = htmlCanvas.clientWidth, clientHeight = htmlCanvas.clientHeight;
15486
+ var _htmlCanvas_getBoundingClientRect = htmlCanvas.getBoundingClientRect(), left = _htmlCanvas_getBoundingClientRect.left, top = _htmlCanvas_getBoundingClientRect.top;
15487
+ var widthDPR = width / clientWidth;
15488
+ var heightDPR = height / clientHeight;
15411
15489
  // Clean up the pointer released in the previous frame
15412
- var lastIndex = pointers.length - 1;
15413
- if (lastIndex >= 0) {
15414
- for(var i = lastIndex; i >= 0; i--){
15415
- if (pointers[i].phase === PointerPhase.Leave) {
15416
- pointers.splice(i, 1);
15417
- }
15490
+ for(var i = pointers.length - 1; i >= 0; i--){
15491
+ if (pointers[i].phase === PointerPhase.Leave) {
15492
+ pointers.splice(i, 1);
15418
15493
  }
15419
15494
  }
15420
15495
  // Generate the pointer received for this frame
15421
- lastIndex = nativeEvents.length - 1;
15422
- if (lastIndex >= 0) {
15423
- for(var i1 = 0; i1 <= lastIndex; i1++){
15424
- var _this__getPointer;
15425
- var evt = nativeEvents[i1];
15426
- (_this__getPointer = this._getPointer(evt.pointerId)) == null ? void 0 : _this__getPointer._events.push(evt);
15496
+ for(var i1 = 0, n = nativeEvents.length; i1 < n; i1++){
15497
+ var evt = nativeEvents[i1];
15498
+ var pointerId = evt.pointerId;
15499
+ var pointer = this._getPointerByID(pointerId);
15500
+ if (pointer) {
15501
+ pointer._events.push(evt);
15502
+ } else {
15503
+ var lastCount = pointers.length;
15504
+ if (lastCount === 0 || this._multiPointerEnabled) {
15505
+ var _pointerPool, _i;
15506
+ var _this1 = this, pointerPool = _this1._pointerPool;
15507
+ // Get Pointer smallest index
15508
+ var i2 = 0;
15509
+ for(; i2 < lastCount; i2++){
15510
+ if (pointers[i2].id > i2) {
15511
+ break;
15512
+ }
15513
+ }
15514
+ pointer = (_pointerPool = pointerPool)[_i = i2] || (_pointerPool[_i] = new Pointer(i2));
15515
+ pointer._uniqueID = pointerId;
15516
+ pointer._events.push(evt);
15517
+ pointer.position.set((evt.clientX - left) * widthDPR, (evt.clientY - top) * heightDPR);
15518
+ pointers.splice(i2, 0, pointer);
15519
+ }
15427
15520
  }
15428
- nativeEvents.length = 0;
15429
15521
  }
15522
+ nativeEvents.length = 0;
15430
15523
  // Pointer handles its own events
15431
15524
  this._upList.length = this._downList.length = 0;
15432
15525
  this._buttons = PointerButton.None;
15433
- lastIndex = pointers.length - 1;
15434
- if (lastIndex >= 0) {
15435
- var frameCount = this._engine.time.frameCount;
15436
- var _this__htmlCanvas_getBoundingClientRect = this._htmlCanvas.getBoundingClientRect(), left = _this__htmlCanvas_getBoundingClientRect.left, top = _this__htmlCanvas_getBoundingClientRect.top;
15437
- var _this__htmlCanvas = this._htmlCanvas, clientWidth = _this__htmlCanvas.clientWidth, clientHeight = _this__htmlCanvas.clientHeight;
15438
- var _this__canvas = this._canvas, width = _this__canvas.width, height = _this__canvas.height;
15439
- // Device Pixel Ratio
15440
- var widthDPR = width / clientWidth;
15441
- var heightDPR = height / clientHeight;
15442
- for(var i2 = lastIndex; i2 >= 0; i2--){
15443
- var pointer = pointers[i2];
15444
- pointer._upList.length = pointer._downList.length = 0;
15445
- this._updatePointerInfo(frameCount, pointer, left, top, widthDPR, heightDPR);
15446
- this._buttons |= pointer.pressedButtons;
15447
- }
15526
+ var frameCount = this._engine.time.frameCount;
15527
+ for(var i3 = 0, n1 = pointers.length; i3 < n1; i3++){
15528
+ var pointer1 = pointers[i3];
15529
+ pointer1._upList.length = pointer1._downList.length = 0;
15530
+ this._updatePointerInfo(frameCount, pointer1, left, top, widthDPR, heightDPR);
15531
+ this._buttons |= pointer1.pressedButtons;
15448
15532
  }
15449
15533
  };
15450
15534
  /**
@@ -15543,42 +15627,14 @@ Joint = __decorate([
15543
15627
  evt.type === "pointerdown" && this._htmlCanvas.focus();
15544
15628
  this._nativeEvents.push(evt);
15545
15629
  };
15546
- _proto._getIndexByPointerID = function _getIndexByPointerID(pointerId) {
15630
+ _proto._getPointerByID = function _getPointerByID(pointerId) {
15547
15631
  var _this = this, pointers = _this._pointers;
15548
15632
  for(var i = pointers.length - 1; i >= 0; i--){
15549
15633
  if (pointers[i]._uniqueID === pointerId) {
15550
- return i;
15551
- }
15552
- }
15553
- return -1;
15554
- };
15555
- _proto._getPointer = function _getPointer(pointerId) {
15556
- var _this = this, pointers = _this._pointers;
15557
- var index = this._getIndexByPointerID(pointerId);
15558
- if (index >= 0) {
15559
- return pointers[index];
15560
- } else {
15561
- var lastCount = pointers.length;
15562
- if (lastCount === 0 || this._multiPointerEnabled) {
15563
- var _this1 = this, pointerPool = _this1._pointerPool;
15564
- // Get Pointer smallest index
15565
- var i = 0;
15566
- for(; i < lastCount; i++){
15567
- if (pointers[i].id > i) {
15568
- break;
15569
- }
15570
- }
15571
- var pointer = pointerPool[i];
15572
- if (!pointer) {
15573
- pointer = pointerPool[i] = new Pointer(i);
15574
- }
15575
- pointer._uniqueID = pointerId;
15576
- pointers.splice(i, 0, pointer);
15577
- return pointer;
15578
- } else {
15579
- return null;
15634
+ return pointers[i];
15580
15635
  }
15581
15636
  }
15637
+ return null;
15582
15638
  };
15583
15639
  _proto._updatePointerInfo = function _updatePointerInfo(frameCount, pointer, left, top, widthPixelRatio, heightPixelRatio) {
15584
15640
  var events = pointer._events, position = pointer.position;
@@ -15912,11 +15968,11 @@ Joint = __decorate([
15912
15968
 
15913
15969
  /**
15914
15970
  * Material.
15915
- */ var Material = /*#__PURE__*/ function(ReferResource) {
15916
- _inherits(Material, ReferResource);
15971
+ */ var Material = /*#__PURE__*/ function(ReferResource1) {
15972
+ _inherits(Material, ReferResource1);
15917
15973
  function Material(engine, shader) {
15918
15974
  var _this;
15919
- _this = ReferResource.call(this, engine) || this;
15975
+ _this = ReferResource1.call(this, engine) || this;
15920
15976
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
15921
15977
  ;
15922
15978
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
@@ -15941,13 +15997,13 @@ Joint = __decorate([
15941
15997
  };
15942
15998
  _proto._addReferCount = function _addReferCount(value) {
15943
15999
  if (this._destroyed) return;
15944
- ReferResource.prototype._addReferCount.call(this, value);
16000
+ ReferResource1.prototype._addReferCount.call(this, value);
15945
16001
  this.shaderData._addReferCount(value);
15946
16002
  };
15947
16003
  /**
15948
16004
  * @override
15949
16005
  */ _proto._onDestroy = function _onDestroy() {
15950
- ReferResource.prototype._onDestroy.call(this);
16006
+ ReferResource1.prototype._onDestroy.call(this);
15951
16007
  this._shader = null;
15952
16008
  this._shaderData = null;
15953
16009
  this._renderStates.length = 0;
@@ -16094,43 +16150,6 @@ Joint = __decorate([
16094
16150
  return ParticleBufferUtils;
16095
16151
  }();
16096
16152
 
16097
- function _array_like_to_array(arr, len) {
16098
- if (len == null || len > arr.length) len = arr.length;
16099
-
16100
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
16101
-
16102
- return arr2;
16103
- }
16104
-
16105
- function _array_without_holes(arr) {
16106
- if (Array.isArray(arr)) return _array_like_to_array(arr);
16107
- }
16108
-
16109
- function _iterable_to_array(iter) {
16110
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
16111
- return Array.from(iter);
16112
- }
16113
- }
16114
-
16115
- function _non_iterable_spread() {
16116
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16117
- }
16118
-
16119
- function _unsupported_iterable_to_array(o, minLen) {
16120
- if (!o) return;
16121
- if (typeof o === "string") return _array_like_to_array(o, minLen);
16122
-
16123
- var n = Object.prototype.toString.call(o).slice(8, -1);
16124
-
16125
- if (n === "Object" && o.constructor) n = o.constructor.name;
16126
- if (n === "Map" || n === "Set") return Array.from(n);
16127
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
16128
- }
16129
-
16130
- function _to_consumable_array(arr) {
16131
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
16132
- }
16133
-
16134
16153
  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
16135
16154
 
16136
16155
  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
@@ -16183,10 +16202,10 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16183
16202
  */ var ShaderPool = /*#__PURE__*/ function() {
16184
16203
  function ShaderPool() {}
16185
16204
  ShaderPool.init = function init() {
16186
- var shadowCasterPass = new ShaderPass(shadowMapVs, shadowMapFs, {
16205
+ var shadowCasterPass = new ShaderPass("ShadowCaster", shadowMapVs, shadowMapFs, {
16187
16206
  pipelineStage: PipelineStage.ShadowCaster
16188
16207
  });
16189
- var depthOnlyPass = new ShaderPass(depthOnlyVs, depthOnlyFs, {
16208
+ var depthOnlyPass = new ShaderPass("DepthOnly", depthOnlyVs, depthOnlyFs, {
16190
16209
  pipelineStage: PipelineStage.DepthOnly
16191
16210
  });
16192
16211
  var basePasses = [
@@ -16196,35 +16215,27 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16196
16215
  var forwardPassTags = {
16197
16216
  pipelineStage: PipelineStage.Forward
16198
16217
  };
16199
- Shader.create("blinn-phong", [
16200
- new ShaderPass(blinnPhongVs, blinnPhongFs, forwardPassTags)
16201
- ].concat(_to_consumable_array(basePasses)));
16202
- Shader.create("pbr", [
16203
- new ShaderPass(pbrVs, pbrFs, forwardPassTags)
16204
- ].concat(_to_consumable_array(basePasses)));
16205
- Shader.create("pbr-specular", [
16206
- new ShaderPass(pbrVs, pbrSpecularFs, forwardPassTags)
16207
- ].concat(_to_consumable_array(basePasses)));
16208
- Shader.create("unlit", [
16209
- new ShaderPass(unlitVs, unlitFs, forwardPassTags)
16210
- ].concat(_to_consumable_array(basePasses)));
16218
+ Shader.create("blinn-phong", [].concat(new ShaderPass("Forward", blinnPhongVs, blinnPhongFs, forwardPassTags), basePasses));
16219
+ Shader.create("pbr", [].concat(new ShaderPass("Forward", pbrVs, pbrFs, forwardPassTags), basePasses));
16220
+ Shader.create("pbr-specular", [].concat(new ShaderPass("Forward", pbrVs, pbrSpecularFs, forwardPassTags), basePasses));
16221
+ Shader.create("unlit", [].concat(new ShaderPass("Forward", unlitVs, unlitFs, forwardPassTags), basePasses));
16211
16222
  Shader.create("skybox", [
16212
- new ShaderPass(skyboxVs, skyboxFs, forwardPassTags)
16223
+ new ShaderPass("Forward", skyboxVs, skyboxFs, forwardPassTags)
16213
16224
  ]);
16214
16225
  Shader.create("SkyProcedural", [
16215
- new ShaderPass(skyProceduralVs, skyProceduralFs, forwardPassTags)
16226
+ new ShaderPass("Forward", skyProceduralVs, skyProceduralFs, forwardPassTags)
16216
16227
  ]);
16217
16228
  Shader.create("particle-shader", [
16218
- new ShaderPass(particleVs, particleFs, forwardPassTags)
16229
+ new ShaderPass("Forward", particleVs, particleFs, forwardPassTags)
16219
16230
  ]);
16220
16231
  Shader.create("SpriteMask", [
16221
- new ShaderPass(spriteMaskVs, spriteMaskFs, forwardPassTags)
16232
+ new ShaderPass("Forward", spriteMaskVs, spriteMaskFs, forwardPassTags)
16222
16233
  ]);
16223
16234
  Shader.create("Sprite", [
16224
- new ShaderPass(spriteVs, spriteFs, forwardPassTags)
16235
+ new ShaderPass("Forward", spriteVs, spriteFs, forwardPassTags)
16225
16236
  ]);
16226
16237
  Shader.create("background-texture", [
16227
- new ShaderPass(backgroundTextureVs, backgroundTextureFs, forwardPassTags)
16238
+ new ShaderPass("Forward", backgroundTextureVs, backgroundTextureFs, forwardPassTags)
16228
16239
  ]);
16229
16240
  };
16230
16241
  return ShaderPool;
@@ -16304,11 +16315,11 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
16304
16315
  ShaderPool.init();
16305
16316
  /**
16306
16317
  * Engine.
16307
- */ var Engine = /*#__PURE__*/ function(EventDispatcher) {
16308
- _inherits(Engine, EventDispatcher);
16318
+ */ var Engine = /*#__PURE__*/ function(EventDispatcher1) {
16319
+ _inherits(Engine, EventDispatcher1);
16309
16320
  function Engine(canvas, hardwareRenderer, configuration) {
16310
16321
  var _this;
16311
- _this = EventDispatcher.call(this) || this;
16322
+ _this = EventDispatcher1.call(this) || this;
16312
16323
  /** @internal */ _this._physicsInitialized = false;
16313
16324
  /** @internal */ _this._physicalObjectsMap = {};
16314
16325
  /* @internal */ _this._lastRenderState = new RenderState();
@@ -16407,9 +16418,6 @@ ShaderPool.init();
16407
16418
  /**
16408
16419
  * Update the engine loop manually. If you call engine.run(), you generally don't need to call this function.
16409
16420
  */ _proto.update = function update() {
16410
- if (this._isDeviceLost) {
16411
- return;
16412
- }
16413
16421
  var time = this._time;
16414
16422
  time._update();
16415
16423
  var deltaTime = time.deltaTime;
@@ -16459,7 +16467,9 @@ ShaderPool.init();
16459
16467
  scene4._componentsManager.callScriptOnLateUpdate(deltaTime);
16460
16468
  }
16461
16469
  // Render scene and fire `onBeginRender` and `onEndRender`
16462
- this._render(loopScenes);
16470
+ if (!this._isDeviceLost) {
16471
+ this._render(loopScenes);
16472
+ }
16463
16473
  // Handling invalid scripts and fire `onDestroy`
16464
16474
  for(var i5 = 0; i5 < sceneCount; i5++){
16465
16475
  var scene5 = loopScenes[i5];
@@ -16924,7 +16934,7 @@ ShaderPool.init();
16924
16934
  program.uploadAll(program.materialUniformBlock, materialShaderData);
16925
16935
  program.uploadUnGroupTextures();
16926
16936
  renderState._apply(engine, false, pass._renderStateDataMap, materialShaderData);
16927
- rhi.drawPrimitive(mesh, mesh.subMesh, program);
16937
+ rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
16928
16938
  cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
16929
16939
  };
16930
16940
  _create_class(Sky, [
@@ -16937,8 +16947,8 @@ ShaderPool.init();
16937
16947
  },
16938
16948
  set: function set(value) {
16939
16949
  if (this._material !== value) {
16940
- var _this__material;
16941
- value == null ? void 0 : value._addReferCount(1);
16950
+ var _value, _this__material;
16951
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
16942
16952
  (_this__material = this._material) == null ? void 0 : _this__material._addReferCount(-1);
16943
16953
  this._material = value;
16944
16954
  }
@@ -16953,8 +16963,8 @@ ShaderPool.init();
16953
16963
  },
16954
16964
  set: function set(value) {
16955
16965
  if (this._mesh !== value) {
16956
- var _this__mesh;
16957
- value == null ? void 0 : value._addReferCount(1);
16966
+ var _value, _this__mesh;
16967
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
16958
16968
  (_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addReferCount(-1);
16959
16969
  this._mesh = value;
16960
16970
  }
@@ -17080,8 +17090,8 @@ ShaderPool.init();
17080
17090
  },
17081
17091
  set: function set(value) {
17082
17092
  if (this._texture !== value) {
17083
- var _this__texture;
17084
- value == null ? void 0 : value._addReferCount(1);
17093
+ var _value, _this__texture;
17094
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
17085
17095
  (_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
17086
17096
  this._texture = value;
17087
17097
  this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
@@ -17305,11 +17315,11 @@ ShaderPool.init();
17305
17315
 
17306
17316
  /**
17307
17317
  * Ambient light.
17308
- */ var AmbientLight = /*#__PURE__*/ function(ReferResource) {
17309
- _inherits(AmbientLight, ReferResource);
17318
+ */ var AmbientLight = /*#__PURE__*/ function(ReferResource1) {
17319
+ _inherits(AmbientLight, ReferResource1);
17310
17320
  function AmbientLight(engine) {
17311
17321
  var _this;
17312
- _this = ReferResource.call(this, engine) || this;
17322
+ _this = ReferResource1.call(this, engine) || this;
17313
17323
  _this._diffuseSolidColor = new Color$1(0.212, 0.227, 0.259);
17314
17324
  _this._diffuseIntensity = 1.0;
17315
17325
  _this._specularIntensity = 1.0;
@@ -17591,11 +17601,11 @@ ShaderPool.init();
17591
17601
 
17592
17602
  /**
17593
17603
  * Light base class.
17594
- */ var Light = /*#__PURE__*/ function(Component) {
17595
- _inherits(Light, Component);
17604
+ */ var Light = /*#__PURE__*/ function(Component1) {
17605
+ _inherits(Light, Component1);
17596
17606
  function Light() {
17597
17607
  var _this;
17598
- _this = Component.apply(this, arguments) || this;
17608
+ _this = Component1.apply(this, arguments) || this;
17599
17609
  /** Light Intensity */ _this.intensity = 1;
17600
17610
  /**
17601
17611
  * Culling mask - which layers the light affect.
@@ -17670,11 +17680,11 @@ __decorate([
17670
17680
 
17671
17681
  /**
17672
17682
  * Directional light.
17673
- */ var DirectLight = /*#__PURE__*/ function(Light) {
17674
- _inherits(DirectLight, Light);
17683
+ */ var DirectLight = /*#__PURE__*/ function(Light1) {
17684
+ _inherits(DirectLight, Light1);
17675
17685
  function DirectLight() {
17676
17686
  var _this;
17677
- _this = Light.apply(this, arguments) || this;
17687
+ _this = Light1.apply(this, arguments) || this;
17678
17688
  _this._reverseDirection = new Vector3();
17679
17689
  return _this;
17680
17690
  }
@@ -17770,11 +17780,11 @@ __decorate([
17770
17780
 
17771
17781
  /**
17772
17782
  * Point light.
17773
- */ var PointLight = /*#__PURE__*/ function(Light) {
17774
- _inherits(PointLight, Light);
17783
+ */ var PointLight = /*#__PURE__*/ function(Light1) {
17784
+ _inherits(PointLight, Light1);
17775
17785
  function PointLight() {
17776
17786
  var _this;
17777
- _this = Light.apply(this, arguments) || this;
17787
+ _this = Light1.apply(this, arguments) || this;
17778
17788
  /** Defines a distance cutoff at which the light's intensity must be considered zero. */ _this.distance = 100;
17779
17789
  return _this;
17780
17790
  }
@@ -17868,11 +17878,11 @@ __decorate([
17868
17878
 
17869
17879
  /**
17870
17880
  * Spot light.
17871
- */ var SpotLight = /*#__PURE__*/ function(Light) {
17872
- _inherits(SpotLight, Light);
17881
+ */ var SpotLight = /*#__PURE__*/ function(Light1) {
17882
+ _inherits(SpotLight, Light1);
17873
17883
  function SpotLight() {
17874
17884
  var _this;
17875
- _this = Light.apply(this, arguments) || this;
17885
+ _this = Light1.apply(this, arguments) || this;
17876
17886
  /** Defines a distance cutoff at which the light's intensity must be considered zero. */ _this.distance = 100;
17877
17887
  /** Angle, in radians, from centre of spotlight where falloff begins. */ _this.angle = Math.PI / 6;
17878
17888
  /** Angle, in radians, from falloff begins to ends. */ _this.penumbra = Math.PI / 12;
@@ -18153,11 +18163,11 @@ __decorate([
18153
18163
 
18154
18164
  /**
18155
18165
  * Scene.
18156
- */ var Scene = /*#__PURE__*/ function(EngineObject) {
18157
- _inherits(Scene, EngineObject);
18166
+ */ var Scene = /*#__PURE__*/ function(EngineObject1) {
18167
+ _inherits(Scene, EngineObject1);
18158
18168
  function Scene(engine, name) {
18159
18169
  var _this;
18160
- _this = EngineObject.call(this, engine) || this;
18170
+ _this = EngineObject1.call(this, engine) || this;
18161
18171
  /** Physics. */ _this.physics = new PhysicsScene(_assert_this_initialized(_this));
18162
18172
  /** If cast shadows. */ _this.castShadows = true;
18163
18173
  /** The resolution of the shadow maps. */ _this.shadowResolution = ShadowResolution.Medium;
@@ -18384,7 +18394,7 @@ __decorate([
18384
18394
  /**
18385
18395
  * @internal
18386
18396
  */ _proto._onDestroy = function _onDestroy() {
18387
- EngineObject.prototype._onDestroy.call(this);
18397
+ EngineObject1.prototype._onDestroy.call(this);
18388
18398
  // Remove from sceneManager
18389
18399
  var sceneManager = this._engine.sceneManager;
18390
18400
  sceneManager.removeScene(this);
@@ -18585,11 +18595,11 @@ __decorate([
18585
18595
 
18586
18596
  /**
18587
18597
  * Script class, used for logic writing.
18588
- */ var Script = /*#__PURE__*/ function(Component) {
18589
- _inherits(Script, Component);
18598
+ */ var Script = /*#__PURE__*/ function(Component1) {
18599
+ _inherits(Script, Component1);
18590
18600
  function Script() {
18591
18601
  var _this;
18592
- _this = Component.apply(this, arguments) || this;
18602
+ _this = Component1.apply(this, arguments) || this;
18593
18603
  /** @internal */ _this._started = false;
18594
18604
  /** @internal */ _this._onStartIndex = -1;
18595
18605
  /** @internal */ _this._onUpdateIndex = -1;
@@ -18744,7 +18754,7 @@ __decorate([
18744
18754
  /**
18745
18755
  * @internal
18746
18756
  */ _proto._onDestroy = function _onDestroy() {
18747
- Component.prototype._onDestroy.call(this);
18757
+ Component1.prototype._onDestroy.call(this);
18748
18758
  this.scene._componentsManager.addPendingDestroyScript(this);
18749
18759
  };
18750
18760
  return Script;
@@ -18947,9 +18957,10 @@ var passNum = 0;
18947
18957
  /**
18948
18958
  * Render queue.
18949
18959
  */ var RenderQueue = /*#__PURE__*/ function() {
18950
- function RenderQueue(engine) {
18960
+ function RenderQueue(engine, renderQueueType) {
18951
18961
  this.elements = [];
18952
18962
  this._initSpriteBatcher(engine);
18963
+ this._renderQueueType = renderQueueType;
18953
18964
  }
18954
18965
  var _proto = RenderQueue.prototype;
18955
18966
  /**
@@ -18968,10 +18979,10 @@ var passNum = 0;
18968
18979
  var sceneData = scene.shaderData;
18969
18980
  var cameraData = camera.shaderData;
18970
18981
  var pipelineStageKey = RenderContext.pipelineStageKey;
18982
+ var renderQueueType = this._renderQueueType;
18971
18983
  for(var i = 0, n = elements.length; i < n; i++){
18972
18984
  var element = elements[i];
18973
18985
  var data = element.data, shaderPasses = element.shaderPasses;
18974
- var renderStates = data.material.renderStates;
18975
18986
  var renderPassFlag = data.component.entity.layer;
18976
18987
  if (!(renderPassFlag & mask)) {
18977
18988
  continue;
@@ -18984,6 +18995,7 @@ var passNum = 0;
18984
18995
  var material = data.material.destroyed ? engine._magentaMaterial : data.material;
18985
18996
  var rendererData = renderer.shaderData;
18986
18997
  var materialData = material.shaderData;
18998
+ var renderStates = material.renderStates;
18987
18999
  // union render global macro and material self macro.
18988
19000
  ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
18989
19001
  for(var j = 0, m = shaderPasses.length; j < m; j++){
@@ -18991,6 +19003,10 @@ var passNum = 0;
18991
19003
  if (shaderPass.getTagValue(pipelineStageKey) !== pipelineStageTagValue) {
18992
19004
  continue;
18993
19005
  }
19006
+ var _shaderPass__renderState;
19007
+ if (((_shaderPass__renderState = shaderPass._renderState) != null ? _shaderPass__renderState : renderStates[j]).renderQueueType !== renderQueueType) {
19008
+ continue;
19009
+ }
18994
19010
  var program = shaderPass._getShaderProgram(engine, compileMacros);
18995
19011
  if (!program.isValid) {
18996
19012
  continue;
@@ -19040,8 +19056,8 @@ var passNum = 0;
19040
19056
  program.uploadUnGroupTextures();
19041
19057
  }
19042
19058
  }
19043
- var _shaderPass__renderState;
19044
- var renderState = (_shaderPass__renderState = shaderPass._renderState) != null ? _shaderPass__renderState : renderStates[j];
19059
+ var _shaderPass__renderState1;
19060
+ var renderState = (_shaderPass__renderState1 = shaderPass._renderState) != null ? _shaderPass__renderState1 : renderStates[j];
19045
19061
  renderState._apply(engine, renderer.entity.transform._isFrontFaceInvert(), shaderPass._renderStateDataMap, material.shaderData);
19046
19062
  rhi.drawPrimitive(primitive, data.subPrimitive, program);
19047
19063
  }
@@ -19226,12 +19242,14 @@ var passNum = 0;
19226
19242
  * @param mipmap - Need render target mipmap
19227
19243
  * @returns Render target
19228
19244
  */ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, mipmap) {
19229
- var currentColorTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.getColorTexture(0);
19230
- var currentDepthTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.depthTexture;
19245
+ var _currentRenderTarget, _currentRenderTarget1;
19246
+ var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
19247
+ var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
19231
19248
  var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
19232
19249
  var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
19233
19250
  if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
19234
- currentRenderTarget == null ? void 0 : currentRenderTarget.destroy();
19251
+ var _currentRenderTarget2;
19252
+ (_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
19235
19253
  currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
19236
19254
  currentRenderTarget.isGCIgnored = true;
19237
19255
  }
@@ -19757,11 +19775,11 @@ var /**
19757
19775
 
19758
19776
  /**
19759
19777
  * Cascade shadow caster pass.
19760
- */ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass) {
19761
- _inherits(CascadedShadowCasterPass, PipelinePass);
19778
+ */ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass1) {
19779
+ _inherits(CascadedShadowCasterPass, PipelinePass1);
19762
19780
  function CascadedShadowCasterPass(camera) {
19763
19781
  var _this;
19764
- _this = PipelinePass.call(this, camera.engine) || this;
19782
+ _this = PipelinePass1.call(this, camera.engine) || this;
19765
19783
  _this._shadowMapSize = new Vector4();
19766
19784
  _this._shadowBias = new Vector2();
19767
19785
  _this._shadowSliceData = new ShadowSliceData();
@@ -20033,9 +20051,9 @@ var /**
20033
20051
  * Culling results.
20034
20052
  */ var CullingResults = /*#__PURE__*/ function() {
20035
20053
  function CullingResults(engine) {
20036
- this.opaqueQueue = new RenderQueue(engine);
20037
- this.transparentQueue = new RenderQueue(engine);
20038
- this.alphaTestQueue = new RenderQueue(engine);
20054
+ this.opaqueQueue = new RenderQueue(engine, RenderQueueType.Opaque);
20055
+ this.transparentQueue = new RenderQueue(engine, RenderQueueType.Transparent);
20056
+ this.alphaTestQueue = new RenderQueue(engine, RenderQueueType.AlphaTest);
20039
20057
  }
20040
20058
  var _proto = CullingResults.prototype;
20041
20059
  _proto.reset = function reset() {
@@ -20059,11 +20077,11 @@ var /**
20059
20077
  /**
20060
20078
  * @internal
20061
20079
  * Depth only pass.
20062
- */ var DepthOnlyPass = /*#__PURE__*/ function(PipelinePass) {
20063
- _inherits(DepthOnlyPass, PipelinePass);
20080
+ */ var DepthOnlyPass = /*#__PURE__*/ function(PipelinePass1) {
20081
+ _inherits(DepthOnlyPass, PipelinePass1);
20064
20082
  function DepthOnlyPass(engine) {
20065
20083
  var _this;
20066
- _this = PipelinePass.call(this, engine) || this;
20084
+ _this = PipelinePass1.call(this, engine) || this;
20067
20085
  _this._supportDepthTexture = engine._hardwareRenderer.canIUse(GLCapabilityType.depthTexture);
20068
20086
  return _this;
20069
20087
  }
@@ -20197,12 +20215,13 @@ var /**
20197
20215
  var opaqueQueue = cullingResults.opaqueQueue, alphaTestQueue = cullingResults.alphaTestQueue, transparentQueue = cullingResults.transparentQueue;
20198
20216
  pass.preRender(camera, opaqueQueue, alphaTestQueue, transparentQueue);
20199
20217
  if (pass.enabled) {
20218
+ var _renderTarget, _renderTarget1, _renderTarget2;
20200
20219
  var engine = camera.engine, scene = camera.scene;
20201
20220
  var background = scene.background;
20202
20221
  var rhi = engine._hardwareRenderer;
20203
20222
  var renderTarget = camera.renderTarget || pass.renderTarget;
20204
20223
  rhi.activeRenderTarget(renderTarget, camera.viewport, mipLevel);
20205
- renderTarget == null ? void 0 : renderTarget._setRenderTargetInfo(cubeFace, mipLevel);
20224
+ (_renderTarget = renderTarget) == null ? void 0 : _renderTarget._setRenderTargetInfo(cubeFace, mipLevel);
20206
20225
  var _pass_clearFlags;
20207
20226
  var clearFlags = (_pass_clearFlags = pass.clearFlags) != null ? _pass_clearFlags : camera.clearFlags;
20208
20227
  var _pass_clearColor;
@@ -20224,8 +20243,8 @@ var /**
20224
20243
  }
20225
20244
  cullingResults.transparentQueue.render(camera, pass.mask, PipelineStage.Forward);
20226
20245
  }
20227
- renderTarget == null ? void 0 : renderTarget._blitRenderTarget();
20228
- renderTarget == null ? void 0 : renderTarget.generateMipmaps();
20246
+ (_renderTarget1 = renderTarget) == null ? void 0 : _renderTarget1._blitRenderTarget();
20247
+ (_renderTarget2 = renderTarget) == null ? void 0 : _renderTarget2.generateMipmaps();
20229
20248
  }
20230
20249
  pass.postRender(camera, cullingResults.opaqueQueue, cullingResults.alphaTestQueue, cullingResults.transparentQueue);
20231
20250
  };
@@ -20245,23 +20264,24 @@ var /**
20245
20264
  for(var i = 0, n = replacementSubShaders.length; i < n; i++){
20246
20265
  var subShader = replacementSubShaders[i];
20247
20266
  if (subShader.getTagValue(replacementTag) === materialSubShader.getTagValue(replacementTag)) {
20248
- this.pushRenderDataWihShader(context, data, subShader.passes, renderStates);
20267
+ this.pushRenderDataWithShader(context, data, subShader.passes, renderStates);
20249
20268
  break;
20250
20269
  }
20251
20270
  }
20252
20271
  } else {
20253
- this.pushRenderDataWihShader(context, data, replacementSubShaders[0].passes, renderStates);
20272
+ this.pushRenderDataWithShader(context, data, replacementSubShaders[0].passes, renderStates);
20254
20273
  }
20255
20274
  } else {
20256
- this.pushRenderDataWihShader(context, data, materialSubShader.passes, renderStates);
20275
+ this.pushRenderDataWithShader(context, data, materialSubShader.passes, renderStates);
20257
20276
  }
20258
20277
  };
20259
- _proto.pushRenderDataWihShader = function pushRenderDataWihShader(context, element, shaderPasses, renderStates) {
20278
+ _proto.pushRenderDataWithShader = function pushRenderDataWithShader(context, element, shaderPasses, renderStates) {
20260
20279
  var _this__cullingResults = this._cullingResults, opaqueQueue = _this__cullingResults.opaqueQueue, alphaTestQueue = _this__cullingResults.alphaTestQueue, transparentQueue = _this__cullingResults.transparentQueue;
20261
20280
  var renderElementPool = context.camera.engine._renderElementPool;
20262
20281
  var renderQueueAddedFlags = 0x0;
20263
20282
  for(var i = 0, n = shaderPasses.length; i < n; i++){
20264
- var renderQueueType = renderStates[i].renderQueueType;
20283
+ var _shaderPasses_i__renderState;
20284
+ var renderQueueType = ((_shaderPasses_i__renderState = shaderPasses[i]._renderState) != null ? _shaderPasses_i__renderState : renderStates[i]).renderQueueType;
20265
20285
  if (renderQueueAddedFlags & 1 << renderQueueType) {
20266
20286
  continue;
20267
20287
  }
@@ -20297,7 +20317,7 @@ var /**
20297
20317
  program.uploadAll(program.materialUniformBlock, material.shaderData);
20298
20318
  program.uploadUnGroupTextures();
20299
20319
  (pass._renderState || material.renderState)._apply(engine, false, pass._renderStateDataMap, material.shaderData);
20300
- rhi.drawPrimitive(mesh, mesh.subMesh, program);
20320
+ rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
20301
20321
  };
20302
20322
  _proto._callRender = function _callRender(context) {
20303
20323
  var engine = context.camera.engine;
@@ -20352,11 +20372,11 @@ var MathTemp = function MathTemp() {
20352
20372
  (function() {
20353
20373
  MathTemp.tempVec2 = new Vector2();
20354
20374
  })();
20355
- var Camera = (_Camera = /*#__PURE__*/ function(Component) {
20356
- _inherits(Camera1, Component);
20375
+ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
20376
+ _inherits(Camera1, Component1);
20357
20377
  function Camera1(entity) {
20358
20378
  var _this;
20359
- _this = Component.call(this, entity) || this;
20379
+ _this = Component1.call(this, entity) || this;
20360
20380
  /** Whether to enable frustum culling, it is enabled by default. */ _this.enableFrustumCulling = true;
20361
20381
  /**
20362
20382
  * Determining what to clear when rendering by a Camera.
@@ -20584,7 +20604,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
20584
20604
  * @inheritdoc
20585
20605
  */ _proto._onDestroy = function _onDestroy() {
20586
20606
  var _this__renderPipeline;
20587
- Component.prototype._onDestroy.call(this);
20607
+ Component1.prototype._onDestroy.call(this);
20588
20608
  (_this__renderPipeline = this._renderPipeline) == null ? void 0 : _this__renderPipeline.destroy();
20589
20609
  this._isInvViewProjDirty.destroy();
20590
20610
  this._isViewMatrixDirty.destroy();
@@ -20852,8 +20872,8 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
20852
20872
  },
20853
20873
  set: function set(value) {
20854
20874
  if (this._renderTarget !== value) {
20855
- var _this__renderTarget;
20856
- value == null ? void 0 : value._addReferCount(1);
20875
+ var _value, _this__renderTarget;
20876
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
20857
20877
  (_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
20858
20878
  this._renderTarget = value;
20859
20879
  this._updatePixelViewport();
@@ -21111,11 +21131,11 @@ var MultiExecutor = /*#__PURE__*/ function() {
21111
21131
  RenderFace[RenderFace[/** Render double face. */ "Double"] = 2] = "Double";
21112
21132
  })(RenderFace || (RenderFace = {}));
21113
21133
 
21114
- var BaseMaterial = /*#__PURE__*/ function(Material) {
21115
- _inherits(BaseMaterial, Material);
21134
+ var BaseMaterial = /*#__PURE__*/ function(Material1) {
21135
+ _inherits(BaseMaterial, Material1);
21116
21136
  function BaseMaterial(engine, shader) {
21117
21137
  var _this;
21118
- _this = Material.call(this, engine, shader) || this;
21138
+ _this = Material1.call(this, engine, shader) || this;
21119
21139
  _this._renderFace = RenderFace.Front;
21120
21140
  _this._isTransparent = false;
21121
21141
  _this._blendMode = BlendMode.Normal;
@@ -21204,7 +21224,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21204
21224
  * Clone to the target material.
21205
21225
  * @param target - target material
21206
21226
  */ _proto.cloneTo = function cloneTo(target) {
21207
- Material.prototype.cloneTo.call(this, target);
21227
+ Material1.prototype.cloneTo.call(this, target);
21208
21228
  target._renderFace = this._renderFace;
21209
21229
  target._isTransparent = this._isTransparent;
21210
21230
  target._blendMode = this._blendMode;
@@ -21355,11 +21375,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21355
21375
 
21356
21376
  /**
21357
21377
  * Blinn-phong Material.
21358
- */ var BlinnPhongMaterial = /*#__PURE__*/ function(BaseMaterial) {
21359
- _inherits(BlinnPhongMaterial, BaseMaterial);
21378
+ */ var BlinnPhongMaterial = /*#__PURE__*/ function(BaseMaterial1) {
21379
+ _inherits(BlinnPhongMaterial, BaseMaterial1);
21360
21380
  function BlinnPhongMaterial(engine) {
21361
21381
  var _this;
21362
- _this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
21382
+ _this = BaseMaterial1.call(this, engine, Shader.find("blinn-phong")) || this;
21363
21383
  var shaderData = _this.shaderData;
21364
21384
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
21365
21385
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
@@ -21549,11 +21569,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21549
21569
 
21550
21570
  /**
21551
21571
  * PBR (Physically-Based Rendering) Material.
21552
- */ var PBRBaseMaterial = /*#__PURE__*/ function(BaseMaterial) {
21553
- _inherits(PBRBaseMaterial, BaseMaterial);
21572
+ */ var PBRBaseMaterial = /*#__PURE__*/ function(BaseMaterial1) {
21573
+ _inherits(PBRBaseMaterial, BaseMaterial1);
21554
21574
  function PBRBaseMaterial(engine, shader) {
21555
21575
  var _this;
21556
- _this = BaseMaterial.call(this, engine, shader) || this;
21576
+ _this = BaseMaterial1.call(this, engine, shader) || this;
21557
21577
  var shaderData = _this.shaderData;
21558
21578
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
21559
21579
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
@@ -21818,11 +21838,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21818
21838
 
21819
21839
  /**
21820
21840
  * PBR (Metallic-Roughness Workflow) Material.
21821
- */ var PBRMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
21822
- _inherits(PBRMaterial, PBRBaseMaterial);
21841
+ */ var PBRMaterial = /*#__PURE__*/ function(PBRBaseMaterial1) {
21842
+ _inherits(PBRMaterial, PBRBaseMaterial1);
21823
21843
  function PBRMaterial(engine) {
21824
21844
  var _this;
21825
- _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
21845
+ _this = PBRBaseMaterial1.call(this, engine, Shader.find("pbr")) || this;
21826
21846
  _this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
21827
21847
  _this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
21828
21848
  _this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
@@ -21908,11 +21928,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21908
21928
 
21909
21929
  /**
21910
21930
  * PBR (Specular-Glossiness Workflow) Material.
21911
- */ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
21912
- _inherits(PBRSpecularMaterial, PBRBaseMaterial);
21931
+ */ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial1) {
21932
+ _inherits(PBRSpecularMaterial, PBRBaseMaterial1);
21913
21933
  function PBRSpecularMaterial(engine) {
21914
21934
  var _this;
21915
- _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr-specular")) || this;
21935
+ _this = PBRBaseMaterial1.call(this, engine, Shader.find("pbr-specular")) || this;
21916
21936
  _this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
21917
21937
  _this.shaderData.setFloat(PBRSpecularMaterial._glossinessProp, 1.0);
21918
21938
  return _this;
@@ -21986,11 +22006,11 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
21986
22006
 
21987
22007
  /**
21988
22008
  * Unlit Material.
21989
- */ var UnlitMaterial = /*#__PURE__*/ function(BaseMaterial) {
21990
- _inherits(UnlitMaterial, BaseMaterial);
22009
+ */ var UnlitMaterial = /*#__PURE__*/ function(BaseMaterial1) {
22010
+ _inherits(UnlitMaterial, BaseMaterial1);
21991
22011
  function UnlitMaterial(engine) {
21992
22012
  var _this;
21993
- _this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
22013
+ _this = BaseMaterial1.call(this, engine, Shader.find("unlit")) || this;
21994
22014
  var shaderData = _this.shaderData;
21995
22015
  shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
21996
22016
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
@@ -22072,11 +22092,11 @@ var TextVerticalAlignment;
22072
22092
 
22073
22093
  /**
22074
22094
  * Sprite Atlas.
22075
- */ var SpriteAtlas = /*#__PURE__*/ function(ReferResource) {
22076
- _inherits(SpriteAtlas, ReferResource);
22095
+ */ var SpriteAtlas = /*#__PURE__*/ function(ReferResource1) {
22096
+ _inherits(SpriteAtlas, ReferResource1);
22077
22097
  function SpriteAtlas(engine) {
22078
22098
  var _this;
22079
- _this = ReferResource.call(this, engine) || this;
22099
+ _this = ReferResource1.call(this, engine) || this;
22080
22100
  _this._sprites = new Array();
22081
22101
  _this._spriteNamesToIndex = {};
22082
22102
  return _this;
@@ -22122,7 +22142,7 @@ var TextVerticalAlignment;
22122
22142
  /**
22123
22143
  * @internal
22124
22144
  */ _proto._onDestroy = function _onDestroy() {
22125
- ReferResource.prototype._onDestroy.call(this);
22145
+ ReferResource1.prototype._onDestroy.call(this);
22126
22146
  var _this = this, sprites = _this._sprites;
22127
22147
  for(var i = 0, n = sprites.length; i < n; i++){
22128
22148
  sprites[i].destroy();
@@ -22165,8 +22185,8 @@ var TextVerticalAlignment;
22165
22185
 
22166
22186
  /**
22167
22187
  * 2D sprite.
22168
- */ var Sprite = /*#__PURE__*/ function(ReferResource) {
22169
- _inherits(Sprite, ReferResource);
22188
+ */ var Sprite = /*#__PURE__*/ function(ReferResource1) {
22189
+ _inherits(Sprite, ReferResource1);
22170
22190
  function Sprite(engine, texture, region, pivot, border, name) {
22171
22191
  if (texture === void 0) texture = null;
22172
22192
  if (region === void 0) region = null;
@@ -22174,7 +22194,7 @@ var TextVerticalAlignment;
22174
22194
  if (border === void 0) border = null;
22175
22195
  if (name === void 0) name = null;
22176
22196
  var _this;
22177
- _this = ReferResource.call(this, engine) || this;
22197
+ _this = ReferResource1.call(this, engine) || this;
22178
22198
  _this._automaticWidth = 0;
22179
22199
  _this._automaticHeight = 0;
22180
22200
  _this._customWidth = undefined;
@@ -22250,13 +22270,13 @@ var TextVerticalAlignment;
22250
22270
  * @internal
22251
22271
  */ _proto._addReferCount = function _addReferCount(value) {
22252
22272
  var _this__atlas;
22253
- ReferResource.prototype._addReferCount.call(this, value);
22273
+ ReferResource1.prototype._addReferCount.call(this, value);
22254
22274
  (_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addReferCount(value);
22255
22275
  };
22256
22276
  /**
22257
22277
  * @internal
22258
22278
  */ _proto._onDestroy = function _onDestroy() {
22259
- ReferResource.prototype._onDestroy.call(this);
22279
+ ReferResource1.prototype._onDestroy.call(this);
22260
22280
  this._positions.length = 0;
22261
22281
  this._positions = null;
22262
22282
  this._uvs.length = 0;
@@ -23018,11 +23038,11 @@ var TiledType;
23018
23038
 
23019
23039
  /**
23020
23040
  * Renders a Sprite for 2D graphics.
23021
- */ var SpriteRenderer = /*#__PURE__*/ function(Renderer) {
23022
- _inherits(SpriteRenderer, Renderer);
23041
+ */ var SpriteRenderer = /*#__PURE__*/ function(Renderer1) {
23042
+ _inherits(SpriteRenderer, Renderer1);
23023
23043
  function SpriteRenderer(entity) {
23024
23044
  var _this;
23025
- _this = Renderer.call(this, entity) || this;
23045
+ _this = Renderer1.call(this, entity) || this;
23026
23046
  _this._tileMode = SpriteTileMode.Continuous;
23027
23047
  _this._tiledAdaptiveThreshold = 0.5;
23028
23048
  _this._color = new Color$1(1, 1, 1, 1);
@@ -23045,7 +23065,7 @@ var TiledType;
23045
23065
  /**
23046
23066
  * @internal
23047
23067
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
23048
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23068
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23049
23069
  target._assembler.resetData(target);
23050
23070
  target.sprite = this._sprite;
23051
23071
  target.drawMode = this._drawMode;
@@ -23093,7 +23113,7 @@ var TiledType;
23093
23113
  /**
23094
23114
  * @internal
23095
23115
  */ _proto._onDestroy = function _onDestroy() {
23096
- Renderer.prototype._onDestroy.call(this);
23116
+ Renderer1.prototype._onDestroy.call(this);
23097
23117
  var sprite = this._sprite;
23098
23118
  if (sprite) {
23099
23119
  sprite._addReferCount(-1);
@@ -23480,11 +23500,11 @@ var /**
23480
23500
 
23481
23501
  /**
23482
23502
  * Renders a text for 2D graphics.
23483
- */ var TextRenderer = /*#__PURE__*/ function(Renderer) {
23484
- _inherits(TextRenderer, Renderer);
23503
+ */ var TextRenderer = /*#__PURE__*/ function(Renderer1) {
23504
+ _inherits(TextRenderer, Renderer1);
23485
23505
  function TextRenderer(entity) {
23486
23506
  var _this;
23487
- _this = Renderer.call(this, entity) || this;
23507
+ _this = Renderer1.call(this, entity) || this;
23488
23508
  /** @internal */ _this._subFont = null;
23489
23509
  /** @internal */ _this._charRenderDatas = [];
23490
23510
  _this._dirtyFlag = 15;
@@ -23519,7 +23539,7 @@ var /**
23519
23539
  /**
23520
23540
  * @internal
23521
23541
  */ _proto._onDestroy = function _onDestroy() {
23522
- Renderer.prototype._onDestroy.call(this);
23542
+ Renderer1.prototype._onDestroy.call(this);
23523
23543
  // Clear render data.
23524
23544
  var charRenderDatas = this._charRenderDatas;
23525
23545
  for(var i = 0, n = charRenderDatas.length; i < n; ++i){
@@ -23535,7 +23555,7 @@ var /**
23535
23555
  /**
23536
23556
  * @internal
23537
23557
  */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
23538
- Renderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23558
+ Renderer1.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23539
23559
  target.font = this._font;
23540
23560
  target._subFont = this._subFont;
23541
23561
  };
@@ -23767,7 +23787,7 @@ var /**
23767
23787
  /**
23768
23788
  * @internal
23769
23789
  */ _proto._onTransformChanged = function _onTransformChanged(bit) {
23770
- Renderer.prototype._onTransformChanged.call(this, bit);
23790
+ Renderer1.prototype._onTransformChanged.call(this, bit);
23771
23791
  this._setDirtyFlagTrue(0x4 | 0x8);
23772
23792
  };
23773
23793
  _create_class(TextRenderer, [
@@ -24347,11 +24367,11 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
24347
24367
 
24348
24368
  /**
24349
24369
  * Stores keyframe based animations.
24350
- */ var AnimationClip = /*#__PURE__*/ function(EngineObject) {
24351
- _inherits(AnimationClip, EngineObject);
24370
+ */ var AnimationClip = /*#__PURE__*/ function(EngineObject1) {
24371
+ _inherits(AnimationClip, EngineObject1);
24352
24372
  function AnimationClip(name) {
24353
24373
  var _this;
24354
- _this = EngineObject.call(this, null) || this;
24374
+ _this = EngineObject1.call(this, null) || this;
24355
24375
  _this.name = name;
24356
24376
  _this./** @internal */ _curveBindings = [];
24357
24377
  _this._length = 0;
@@ -24360,18 +24380,27 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
24360
24380
  }
24361
24381
  var _proto = AnimationClip.prototype;
24362
24382
  _proto.addEvent = function addEvent(param, time, parameter) {
24383
+ var newEvent;
24363
24384
  if (typeof param === "string") {
24364
24385
  var event = new AnimationEvent();
24365
24386
  event.functionName = param;
24366
24387
  event.time = time;
24367
24388
  event.parameter = parameter;
24368
- this._events.push(event);
24389
+ newEvent = event;
24369
24390
  } else {
24370
- this._events.push(param);
24391
+ newEvent = param;
24392
+ }
24393
+ var events = this._events;
24394
+ var count = events.length;
24395
+ var eventTime = newEvent.time;
24396
+ var maxEventTime = count ? events[count - 1].time : 0;
24397
+ if (eventTime >= maxEventTime) {
24398
+ events.push(newEvent);
24399
+ } else {
24400
+ var index = count;
24401
+ while(--index >= 0 && eventTime < events[index].time);
24402
+ events.splice(index + 1, 0, newEvent);
24371
24403
  }
24372
- this._events.sort(function(a, b) {
24373
- return a.time - b.time;
24374
- });
24375
24404
  };
24376
24405
  /**
24377
24406
  * Clears all events from the clip.
@@ -24597,11 +24626,11 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
24597
24626
  }();
24598
24627
 
24599
24628
  var _AnimationArrayCurve;
24600
- var AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(AnimationCurve) {
24601
- _inherits(AnimationArrayCurve, AnimationCurve);
24629
+ var AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(AnimationCurve1) {
24630
+ _inherits(AnimationArrayCurve, AnimationCurve1);
24602
24631
  function AnimationArrayCurve() {
24603
24632
  var _this;
24604
- _this = AnimationCurve.call(this) || this;
24633
+ _this = AnimationCurve1.call(this) || this;
24605
24634
  _this._evaluateData.value = [];
24606
24635
  return _this;
24607
24636
  }
@@ -24692,11 +24721,11 @@ AnimationArrayCurve = __decorate([
24692
24721
  ], AnimationArrayCurve);
24693
24722
 
24694
24723
  var _AnimationBoolCurve;
24695
- var AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(AnimationCurve) {
24696
- _inherits(AnimationBoolCurve, AnimationCurve);
24724
+ var AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(AnimationCurve1) {
24725
+ _inherits(AnimationBoolCurve, AnimationCurve1);
24697
24726
  function AnimationBoolCurve() {
24698
24727
  var _this;
24699
- _this = AnimationCurve.call(this) || this;
24728
+ _this = AnimationCurve1.call(this) || this;
24700
24729
  _this._evaluateData.value = false;
24701
24730
  return _this;
24702
24731
  }
@@ -24754,11 +24783,11 @@ AnimationBoolCurve = __decorate([
24754
24783
  ], AnimationBoolCurve);
24755
24784
 
24756
24785
  var _AnimationColorCurve;
24757
- var AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(AnimationCurve) {
24758
- _inherits(AnimationColorCurve, AnimationCurve);
24786
+ var AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(AnimationCurve1) {
24787
+ _inherits(AnimationColorCurve, AnimationCurve1);
24759
24788
  function AnimationColorCurve() {
24760
24789
  var _this;
24761
- _this = AnimationCurve.call(this) || this;
24790
+ _this = AnimationCurve1.call(this) || this;
24762
24791
  _this._evaluateData.value = new Color$1();
24763
24792
  return _this;
24764
24793
  }
@@ -24856,16 +24885,16 @@ AnimationColorCurve = __decorate([
24856
24885
  ], AnimationColorCurve);
24857
24886
 
24858
24887
  var _AnimationFloatArrayCurve;
24859
- var AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ function(AnimationCurve) {
24860
- _inherits(AnimationFloatArrayCurve, AnimationCurve);
24888
+ var AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ function(AnimationCurve1) {
24889
+ _inherits(AnimationFloatArrayCurve, AnimationCurve1);
24861
24890
  function AnimationFloatArrayCurve() {
24862
- return AnimationCurve.apply(this, arguments);
24891
+ return AnimationCurve1.apply(this, arguments);
24863
24892
  }
24864
24893
  var _proto = AnimationFloatArrayCurve.prototype;
24865
24894
  /**
24866
24895
  * @inheritdoc
24867
24896
  */ _proto.addKey = function addKey(key) {
24868
- AnimationCurve.prototype.addKey.call(this, key);
24897
+ AnimationCurve1.prototype.addKey.call(this, key);
24869
24898
  var evaluateData = this._evaluateData;
24870
24899
  if (!evaluateData.value || evaluateData.value.length !== key.value.length) {
24871
24900
  var size = key.value.length;
@@ -24961,11 +24990,11 @@ AnimationFloatArrayCurve = __decorate([
24961
24990
  ], AnimationFloatArrayCurve);
24962
24991
 
24963
24992
  var _AnimationFloatCurve;
24964
- var AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(AnimationCurve) {
24965
- _inherits(AnimationFloatCurve, AnimationCurve);
24993
+ var AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(AnimationCurve1) {
24994
+ _inherits(AnimationFloatCurve, AnimationCurve1);
24966
24995
  function AnimationFloatCurve() {
24967
24996
  var _this;
24968
- _this = AnimationCurve.call(this) || this;
24997
+ _this = AnimationCurve1.call(this) || this;
24969
24998
  _this._evaluateData.value = 0;
24970
24999
  return _this;
24971
25000
  }
@@ -25035,11 +25064,11 @@ AnimationFloatCurve = __decorate([
25035
25064
  ], AnimationFloatCurve);
25036
25065
 
25037
25066
  var _AnimationQuaternionCurve;
25038
- var AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ function(AnimationCurve) {
25039
- _inherits(AnimationQuaternionCurve1, AnimationCurve);
25067
+ var AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ function(AnimationCurve1) {
25068
+ _inherits(AnimationQuaternionCurve1, AnimationCurve1);
25040
25069
  function AnimationQuaternionCurve1() {
25041
25070
  var _this;
25042
- _this = AnimationCurve.call(this) || this;
25071
+ _this = AnimationCurve1.call(this) || this;
25043
25072
  _this._evaluateData.value = new Quaternion();
25044
25073
  return _this;
25045
25074
  }
@@ -25144,11 +25173,11 @@ AnimationQuaternionCurve = __decorate([
25144
25173
  ], AnimationQuaternionCurve);
25145
25174
 
25146
25175
  var _AnimationVector2Curve;
25147
- var AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function(AnimationCurve) {
25148
- _inherits(AnimationVector2Curve, AnimationCurve);
25176
+ var AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function(AnimationCurve1) {
25177
+ _inherits(AnimationVector2Curve, AnimationCurve1);
25149
25178
  function AnimationVector2Curve() {
25150
25179
  var _this;
25151
- _this = AnimationCurve.call(this) || this;
25180
+ _this = AnimationCurve1.call(this) || this;
25152
25181
  _this._evaluateData.value = new Vector2();
25153
25182
  return _this;
25154
25183
  }
@@ -25234,11 +25263,11 @@ AnimationVector2Curve = __decorate([
25234
25263
  ], AnimationVector2Curve);
25235
25264
 
25236
25265
  var _AnimationVector3Curve;
25237
- var AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function(AnimationCurve) {
25238
- _inherits(AnimationVector3Curve, AnimationCurve);
25266
+ var AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function(AnimationCurve1) {
25267
+ _inherits(AnimationVector3Curve, AnimationCurve1);
25239
25268
  function AnimationVector3Curve() {
25240
25269
  var _this;
25241
- _this = AnimationCurve.call(this) || this;
25270
+ _this = AnimationCurve1.call(this) || this;
25242
25271
  _this._evaluateData.value = new Vector3();
25243
25272
  return _this;
25244
25273
  }
@@ -25336,11 +25365,11 @@ AnimationVector3Curve = __decorate([
25336
25365
  ], AnimationVector3Curve);
25337
25366
 
25338
25367
  var _AnimationVector4Curve;
25339
- var AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function(AnimationCurve) {
25340
- _inherits(AnimationVector4Curve, AnimationCurve);
25368
+ var AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function(AnimationCurve1) {
25369
+ _inherits(AnimationVector4Curve, AnimationCurve1);
25341
25370
  function AnimationVector4Curve() {
25342
25371
  var _this;
25343
- _this = AnimationCurve.call(this) || this;
25372
+ _this = AnimationCurve1.call(this) || this;
25344
25373
  _this._evaluateData.value = new Vector4();
25345
25374
  return _this;
25346
25375
  }
@@ -25438,10 +25467,10 @@ AnimationVector4Curve = __decorate([
25438
25467
  ], AnimationVector4Curve);
25439
25468
 
25440
25469
  var _AnimationRefCurve;
25441
- var AnimationRefCurve = (_AnimationRefCurve = /*#__PURE__*/ function(AnimationCurve) {
25442
- _inherits(AnimationRefCurve, AnimationCurve);
25470
+ var AnimationRefCurve = (_AnimationRefCurve = /*#__PURE__*/ function(AnimationCurve1) {
25471
+ _inherits(AnimationRefCurve, AnimationCurve1);
25443
25472
  function AnimationRefCurve() {
25444
- return AnimationCurve.call(this);
25473
+ return AnimationCurve1.call(this);
25445
25474
  }
25446
25475
  /**
25447
25476
  * @internal
@@ -25465,11 +25494,11 @@ AnimationRefCurve = __decorate([
25465
25494
  ], AnimationRefCurve);
25466
25495
 
25467
25496
  var _AnimationRectCurve;
25468
- var AnimationRectCurve = (_AnimationRectCurve = /*#__PURE__*/ function(AnimationCurve) {
25469
- _inherits(AnimationRectCurve, AnimationCurve);
25497
+ var AnimationRectCurve = (_AnimationRectCurve = /*#__PURE__*/ function(AnimationCurve1) {
25498
+ _inherits(AnimationRectCurve, AnimationCurve1);
25470
25499
  function AnimationRectCurve() {
25471
25500
  var _this;
25472
- _this = AnimationCurve.call(this) || this;
25501
+ _this = AnimationCurve1.call(this) || this;
25473
25502
  _this._evaluateData.value = new Rect();
25474
25503
  return _this;
25475
25504
  }
@@ -25575,6 +25604,7 @@ var AnimatorLayerBlendingMode;
25575
25604
  this.playState = AnimatorStatePlayState.UnStarted;
25576
25605
  this.clipTime = state.clipStartTime * state.clip.length;
25577
25606
  this.currentEventIndex = 0;
25607
+ this.currentTransitionIndex = 0;
25578
25608
  };
25579
25609
  _proto.update = function update(isBackwards) {
25580
25610
  var state = this.state;
@@ -25631,11 +25661,11 @@ var AnimatorLayerBlendingMode;
25631
25661
 
25632
25662
  /**
25633
25663
  * The controller of the animation system.
25634
- */ var Animator = /*#__PURE__*/ function(Component) {
25635
- _inherits(Animator, Component);
25664
+ */ var Animator = /*#__PURE__*/ function(Component1) {
25665
+ _inherits(Animator, Component1);
25636
25666
  function Animator(entity) {
25637
25667
  var _this;
25638
- _this = Component.call(this, entity) || this;
25668
+ _this = Component1.call(this, entity) || this;
25639
25669
  /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None;
25640
25670
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
25641
25671
  /** @internal */ _this._onUpdateIndex = -1;
@@ -25699,7 +25729,7 @@ var AnimatorLayerBlendingMode;
25699
25729
  manuallyTransition.duration = normalizedTransitionDuration;
25700
25730
  manuallyTransition.offset = normalizedTimeOffset;
25701
25731
  manuallyTransition.destinationState = state;
25702
- if (this._crossFadeByTransition(manuallyTransition, layerIndex)) {
25732
+ if (this._crossFadeByTransition(manuallyTransition, playLayerIndex)) {
25703
25733
  this.update(0);
25704
25734
  }
25705
25735
  };
@@ -25742,7 +25772,7 @@ var AnimatorLayerBlendingMode;
25742
25772
  * Get the playing state from the target layerIndex.
25743
25773
  * @param layerIndex - The layer index
25744
25774
  */ _proto.getCurrentAnimatorState = function getCurrentAnimatorState(layerIndex) {
25745
- var _this__animatorLayersData_layerIndex, _this__animatorLayersData_layerIndex_srcPlayData;
25775
+ var _this__animatorLayersData_layerIndex_srcPlayData, _this__animatorLayersData_layerIndex;
25746
25776
  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;
25747
25777
  };
25748
25778
  /**
@@ -25933,11 +25963,9 @@ var AnimatorLayerBlendingMode;
25933
25963
  _proto._updateLayer = function _updateLayer(layerIndex, firstLayer, deltaTime, aniUpdate) {
25934
25964
  var _this__animatorController_layers_layerIndex = this._animatorController.layers[layerIndex], blendingMode = _this__animatorController_layers_layerIndex.blendingMode, weight = _this__animatorController_layers_layerIndex.weight;
25935
25965
  var layerData = this._animatorLayersData[layerIndex];
25936
- var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
25966
+ var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData;
25937
25967
  var additive = blendingMode === AnimatorLayerBlendingMode.Additive;
25938
25968
  firstLayer && (weight = 1.0);
25939
- //@todo: All situations should be checked, optimizations will follow later.
25940
- layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
25941
25969
  switch(layerData.layerState){
25942
25970
  case LayerState.Playing:
25943
25971
  this._updatePlayingState(srcPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
@@ -25956,6 +25984,7 @@ var AnimatorLayerBlendingMode;
25956
25984
  _proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
25957
25985
  var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
25958
25986
  var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
25987
+ var transitions = state.transitions;
25959
25988
  var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
25960
25989
  var speed = state.speed * this.speed;
25961
25990
  playData.frameTime += speed * delta;
@@ -25964,8 +25993,9 @@ var AnimatorLayerBlendingMode;
25964
25993
  var finished = playState === AnimatorStatePlayState.Finished;
25965
25994
  if (aniUpdate || finished) {
25966
25995
  for(var i = curveBindings.length - 1; i >= 0; i--){
25996
+ var _layerOwner;
25967
25997
  var layerOwner = curveLayerOwner[i];
25968
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
25998
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
25969
25999
  if (!owner) continue;
25970
26000
  var curve = curveBindings[i].curve;
25971
26001
  if (curve.keys.length) {
@@ -25988,6 +26018,12 @@ var AnimatorLayerBlendingMode;
25988
26018
  } else {
25989
26019
  this._callAnimatorScriptOnUpdate(state, layerIndex);
25990
26020
  }
26021
+ if (transitions.length) {
26022
+ var layerState = layerData.layerState;
26023
+ if (layerState !== LayerState.CrossFading && layerState !== LayerState.FixedCrossFading) {
26024
+ this._checkTransition(playData, transitions, layerIndex, lastClipTime, clipTime);
26025
+ }
26026
+ }
25991
26027
  };
25992
26028
  _proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
25993
26029
  var speed = this.speed;
@@ -26014,8 +26050,9 @@ var AnimatorLayerBlendingMode;
26014
26050
  var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
26015
26051
  if (aniUpdate || finished) {
26016
26052
  for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
26053
+ var _layerOwner;
26017
26054
  var layerOwner = crossLayerOwnerCollection[i];
26018
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26055
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
26019
26056
  if (!owner) continue;
26020
26057
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
26021
26058
  var destCurveIndex = layerOwner.crossDestCurveIndex;
@@ -26062,8 +26099,9 @@ var AnimatorLayerBlendingMode;
26062
26099
  // 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.
26063
26100
  if (aniUpdate || finished) {
26064
26101
  for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
26102
+ var _layerOwner;
26065
26103
  var layerOwner = crossLayerOwnerCollection[i];
26066
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26104
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
26067
26105
  if (!owner) continue;
26068
26106
  var curveIndex = layerOwner.crossDestCurveIndex;
26069
26107
  this._checkRevertOwner(owner, additive);
@@ -26091,8 +26129,9 @@ var AnimatorLayerBlendingMode;
26091
26129
  var curveLayerOwner = playData.stateData.curveLayerOwner;
26092
26130
  var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
26093
26131
  for(var i = curveBindings.length - 1; i >= 0; i--){
26132
+ var _layerOwner;
26094
26133
  var layerOwner = curveLayerOwner[i];
26095
- var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
26134
+ var owner = (_layerOwner = layerOwner) == null ? void 0 : _layerOwner.curveOwner;
26096
26135
  if (!owner) continue;
26097
26136
  this._checkRevertOwner(owner, additive);
26098
26137
  owner.applyValue(layerOwner.finalValue, weight, additive);
@@ -26128,21 +26167,59 @@ var AnimatorLayerBlendingMode;
26128
26167
  }
26129
26168
  }
26130
26169
  };
26131
- _proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
26132
- var state = stateData.state, clipTime = stateData.clipTime;
26133
- var transitions = state.transitions;
26134
- var duration = state._getDuration();
26135
- for(var i = 0, n = transitions.length; i < n; ++i){
26136
- var transition = transitions[i];
26137
- if (duration * transition.exitTime <= clipTime) {
26138
- crossFadeTransition !== transition && this._crossFadeByTransition(transition, layerIndex);
26170
+ _proto._checkTransition = function _checkTransition(playState, transitions, layerIndex, lastClipTime, clipTime) {
26171
+ var state = playState.state;
26172
+ var clipDuration = state.clip.length;
26173
+ if (this.speed * state.speed >= 0) {
26174
+ if (clipTime < lastClipTime) {
26175
+ this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipEndTime * clipDuration);
26176
+ playState.currentTransitionIndex = 0;
26177
+ this._checkSubTransition(playState, transitions, layerIndex, state.clipStartTime * clipDuration, clipTime);
26178
+ } else {
26179
+ this._checkSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
26180
+ }
26181
+ } else {
26182
+ if (clipTime > lastClipTime) {
26183
+ this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, state.clipStartTime * clipDuration);
26184
+ playState.currentTransitionIndex = transitions.length - 1;
26185
+ this._checkBackwardsSubTransition(playState, transitions, layerIndex, clipTime, state.clipEndTime * clipDuration);
26186
+ } else {
26187
+ this._checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, clipTime);
26188
+ }
26189
+ }
26190
+ };
26191
+ _proto._checkSubTransition = function _checkSubTransition(playState, transitions, layerIndex, lastClipTime, curClipTime) {
26192
+ var transitionIndex = playState.currentTransitionIndex;
26193
+ var duration = playState.state._getDuration();
26194
+ for(var n = transitions.length; transitionIndex < n; transitionIndex++){
26195
+ var transition = transitions[transitionIndex];
26196
+ var exitTime = transition.exitTime * duration;
26197
+ if (exitTime > curClipTime) {
26198
+ break;
26199
+ }
26200
+ if (exitTime >= lastClipTime) {
26201
+ this._crossFadeByTransition(transition, layerIndex);
26202
+ playState.currentTransitionIndex = Math.min(transitionIndex + 1, n - 1);
26203
+ }
26204
+ }
26205
+ };
26206
+ _proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(playState, transitions, layerIndex, lastClipTime, curClipTime) {
26207
+ var transitionIndex = playState.currentTransitionIndex;
26208
+ var duration = playState.state._getDuration();
26209
+ for(; transitionIndex >= 0; transitionIndex--){
26210
+ var transition = transitions[transitionIndex];
26211
+ var exitTime = transition.exitTime * duration;
26212
+ if (exitTime < curClipTime) {
26213
+ break;
26214
+ }
26215
+ if (exitTime <= lastClipTime) {
26216
+ this._crossFadeByTransition(transition, layerIndex);
26217
+ playState.currentTransitionIndex = Math.max(transitionIndex - 1, 0);
26139
26218
  }
26140
26219
  }
26141
26220
  };
26142
26221
  _proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
26143
- var name = transition.destinationState.name;
26144
- var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
26145
- var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
26222
+ var crossState = transition.destinationState;
26146
26223
  if (!crossState) {
26147
26224
  return false;
26148
26225
  }
@@ -26150,10 +26227,10 @@ var AnimatorLayerBlendingMode;
26150
26227
  Logger.warn("The state named " + name + " has no AnimationClip data.");
26151
26228
  return false;
26152
26229
  }
26153
- var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
26230
+ var animatorLayerData = this._getAnimatorLayerData(layerIndex);
26154
26231
  var layerState = animatorLayerData.layerState;
26155
26232
  var destPlayData = animatorLayerData.destPlayData;
26156
- var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
26233
+ var animatorStateData = this._getAnimatorStateData(crossState.name, crossState, animatorLayerData, layerIndex);
26157
26234
  var duration = crossState._getDuration();
26158
26235
  var offset = duration * transition.offset;
26159
26236
  destPlayData.reset(crossState, animatorStateData, offset);
@@ -26256,8 +26333,9 @@ var AnimatorLayerBlendingMode;
26256
26333
  _proto._checkAutoPlay = function _checkAutoPlay() {
26257
26334
  var layers = this._animatorController.layers;
26258
26335
  for(var i = 0, n = layers.length; i < n; ++i){
26336
+ var _stateMachine;
26259
26337
  var stateMachine = layers[i].stateMachine;
26260
- if (stateMachine == null ? void 0 : stateMachine.defaultState) {
26338
+ if ((_stateMachine = stateMachine) == null ? void 0 : _stateMachine.defaultState) {
26261
26339
  this.play(stateMachine.defaultState.name, i);
26262
26340
  }
26263
26341
  }
@@ -26436,7 +26514,17 @@ __decorate([
26436
26514
  * Add an outgoing transition to the destination state.
26437
26515
  * @param transition - The transition
26438
26516
  */ _proto.addTransition = function addTransition(transition) {
26439
- this._transitions.push(transition);
26517
+ var transitions = this._transitions;
26518
+ var count = transitions.length;
26519
+ var time = transition.exitTime;
26520
+ var maxExitTime = count ? transitions[count - 1].exitTime : 0;
26521
+ if (time >= maxExitTime) {
26522
+ transitions.push(transition);
26523
+ } else {
26524
+ var index = count;
26525
+ while(--index >= 0 && time < transitions[index].exitTime);
26526
+ transitions.splice(index + 1, 0, transition);
26527
+ }
26440
26528
  };
26441
26529
  /**
26442
26530
  * Remove a transition from the state.
@@ -26614,11 +26702,11 @@ var AnimatorConditionMode;
26614
26702
 
26615
26703
  /**
26616
26704
  * SkyBoxMaterial.
26617
- */ var SkyBoxMaterial = /*#__PURE__*/ function(Material) {
26618
- _inherits(SkyBoxMaterial, Material);
26705
+ */ var SkyBoxMaterial = /*#__PURE__*/ function(Material1) {
26706
+ _inherits(SkyBoxMaterial, Material1);
26619
26707
  function SkyBoxMaterial(engine) {
26620
26708
  var _this;
26621
- _this = Material.call(this, engine, Shader.find("skybox")) || this;
26709
+ _this = Material1.call(this, engine, Shader.find("skybox")) || this;
26622
26710
  _this._textureDecodeRGBM = false;
26623
26711
  _this._tintColor = new Color$1(1, 1, 1, 1);
26624
26712
  _this.renderState.rasterState.cullMode = CullMode.Off;
@@ -26724,11 +26812,11 @@ var SunMode;
26724
26812
  })(SunMode || (SunMode = {}));
26725
26813
  /**
26726
26814
  * Sky procedural material.
26727
- */ var SkyProceduralMaterial = /*#__PURE__*/ function(Material) {
26728
- _inherits(SkyProceduralMaterial, Material);
26815
+ */ var SkyProceduralMaterial = /*#__PURE__*/ function(Material1) {
26816
+ _inherits(SkyProceduralMaterial, Material1);
26729
26817
  function SkyProceduralMaterial(engine) {
26730
26818
  var _this;
26731
- _this = Material.call(this, engine, Shader.find("SkyProcedural")) || this;
26819
+ _this = Material1.call(this, engine, Shader.find("SkyProcedural")) || this;
26732
26820
  _this.sunMode = 2;
26733
26821
  _this.sunSize = 0.04;
26734
26822
  _this.sunSizeConvergence = 5;
@@ -27276,11 +27364,11 @@ __decorate([
27276
27364
 
27277
27365
  /**
27278
27366
  * Color over lifetime module.
27279
- */ var ColorOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
27280
- _inherits(ColorOverLifetimeModule, ParticleGeneratorModule);
27367
+ */ var ColorOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
27368
+ _inherits(ColorOverLifetimeModule, ParticleGeneratorModule1);
27281
27369
  function ColorOverLifetimeModule() {
27282
27370
  var _this;
27283
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
27371
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27284
27372
  /** Color gradient over lifetime. */ _this.color = new ParticleCompositeGradient(new ParticleGradient([
27285
27373
  new GradientColorKey(0.0, new Color$1(1, 1, 1)),
27286
27374
  new GradientColorKey(1.0, new Color$1(1, 1, 1))
@@ -27439,11 +27527,11 @@ __decorate([
27439
27527
 
27440
27528
  /**
27441
27529
  * The EmissionModule of a Particle Generator.
27442
- */ var EmissionModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
27443
- _inherits(EmissionModule, ParticleGeneratorModule);
27530
+ */ var EmissionModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
27531
+ _inherits(EmissionModule, ParticleGeneratorModule1);
27444
27532
  function EmissionModule() {
27445
27533
  var _this;
27446
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
27534
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27447
27535
  /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10);
27448
27536
  /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0);
27449
27537
  /** @internal */ _this._shapeRand = new Rand(0, ParticleRandomSubSeeds.Shape);
@@ -27815,11 +27903,11 @@ __decorate([
27815
27903
 
27816
27904
  /**
27817
27905
  * Rotate particles throughout their lifetime.
27818
- */ var RotationOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
27819
- _inherits(RotationOverLifetimeModule, ParticleGeneratorModule);
27906
+ */ var RotationOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
27907
+ _inherits(RotationOverLifetimeModule, ParticleGeneratorModule1);
27820
27908
  function RotationOverLifetimeModule() {
27821
27909
  var _this;
27822
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
27910
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
27823
27911
  /** Specifies whether the rotation is separate on each axis, when disabled only z axis is used. */ _this.separateAxes = false;
27824
27912
  /** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
27825
27913
  /** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
@@ -28045,11 +28133,11 @@ __decorate([
28045
28133
 
28046
28134
  /**
28047
28135
  * Size over lifetime module.
28048
- */ var SizeOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
28049
- _inherits(SizeOverLifetimeModule, ParticleGeneratorModule);
28136
+ */ var SizeOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
28137
+ _inherits(SizeOverLifetimeModule, ParticleGeneratorModule1);
28050
28138
  function SizeOverLifetimeModule() {
28051
28139
  var _this;
28052
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
28140
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28053
28141
  /** Specifies whether the Size is separate on each axis. */ _this.separateAxes = false;
28054
28142
  /** Size curve over lifetime for x axis. */ _this.sizeX = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
28055
28143
  /** Size curve over lifetime for y axis. */ _this.sizeY = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
@@ -28157,11 +28245,11 @@ __decorate([
28157
28245
 
28158
28246
  /**
28159
28247
  * Texture sheet animation module.
28160
- */ var TextureSheetAnimationModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
28161
- _inherits(TextureSheetAnimationModule, ParticleGeneratorModule);
28248
+ */ var TextureSheetAnimationModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
28249
+ _inherits(TextureSheetAnimationModule, ParticleGeneratorModule1);
28162
28250
  function TextureSheetAnimationModule() {
28163
28251
  var _this;
28164
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
28252
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28165
28253
  /** Start frame of the texture sheet. */ _this.startFrame = new ParticleCompositeCurve(0);
28166
28254
  /** Frame over time curve of the texture sheet. */ _this.frameOverTime = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
28167
28255
  /** Texture sheet animation type. */ _this.type = /** Animate over the whole texture sheet from left to right, top to bottom. */ 0;
@@ -28262,11 +28350,11 @@ var TextureSheetAnimationType;
28262
28350
 
28263
28351
  /**
28264
28352
  * Velocity over lifetime module.
28265
- */ var VelocityOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
28266
- _inherits(VelocityOverLifetimeModule, ParticleGeneratorModule);
28353
+ */ var VelocityOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
28354
+ _inherits(VelocityOverLifetimeModule, ParticleGeneratorModule1);
28267
28355
  function VelocityOverLifetimeModule() {
28268
28356
  var _this;
28269
- _this = ParticleGeneratorModule.apply(this, arguments) || this;
28357
+ _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28270
28358
  /** Velocity over lifetime for x axis. */ _this.velocityX = new ParticleCompositeCurve(0);
28271
28359
  /** Velocity over lifetime for z axis. */ _this.velocityY = new ParticleCompositeCurve(0);
28272
28360
  /** Velocity over lifetime for z axis. */ _this.velocityZ = new ParticleCompositeCurve(0);
@@ -28928,11 +29016,11 @@ __decorate([
28928
29016
 
28929
29017
  /**
28930
29018
  * Particle Renderer Component.
28931
- */ var ParticleRenderer = /*#__PURE__*/ function(Renderer) {
28932
- _inherits(ParticleRenderer, Renderer);
29019
+ */ var ParticleRenderer = /*#__PURE__*/ function(Renderer1) {
29020
+ _inherits(ParticleRenderer, Renderer1);
28933
29021
  function ParticleRenderer(entity) {
28934
29022
  var _this;
28935
- _this = Renderer.call(this, entity) || this;
29023
+ _this = Renderer1.call(this, entity) || this;
28936
29024
  /** Particle generator. */ _this.generator = new ParticleGenerator(_assert_this_initialized(_this));
28937
29025
  /** Specifies how much particles stretch depending on their velocity. */ _this.velocityScale = 0;
28938
29026
  /** 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;
@@ -28967,7 +29055,7 @@ __decorate([
28967
29055
  if (generator._firstActiveElement === generator._firstFreeElement) {
28968
29056
  return;
28969
29057
  }
28970
- Renderer.prototype._prepareRender.call(this, context);
29058
+ Renderer1.prototype._prepareRender.call(this, context);
28971
29059
  };
28972
29060
  /**
28973
29061
  * @internal
@@ -29056,9 +29144,10 @@ __decorate([
29056
29144
  set: function set(value) {
29057
29145
  var lastMesh = this._mesh;
29058
29146
  if (lastMesh !== value) {
29147
+ var _lastMesh, _value;
29059
29148
  this._mesh = value;
29060
- lastMesh == null ? void 0 : lastMesh._addReferCount(-1);
29061
- value == null ? void 0 : value._addReferCount(1);
29149
+ (_lastMesh = lastMesh) == null ? void 0 : _lastMesh._addReferCount(-1);
29150
+ (_value = value) == null ? void 0 : _value._addReferCount(1);
29062
29151
  if (this.renderMode === ParticleRenderMode.Mesh) {
29063
29152
  this.generator._reorganizeGeometryBuffers();
29064
29153
  }
@@ -29191,11 +29280,11 @@ __decorate([
29191
29280
 
29192
29281
  /**
29193
29282
  * Particle shape that emits particles from a box.
29194
- */ var BoxShape = /*#__PURE__*/ function(BaseShape) {
29195
- _inherits(BoxShape, BaseShape);
29283
+ */ var BoxShape = /*#__PURE__*/ function(BaseShape1) {
29284
+ _inherits(BoxShape, BaseShape1);
29196
29285
  function BoxShape() {
29197
29286
  var _this;
29198
- _this = BaseShape.call(this) || this;
29287
+ _this = BaseShape1.call(this) || this;
29199
29288
  /** The size of the box. */ _this.size = new Vector3(1, 1, 1);
29200
29289
  _this.shapeType = ParticleShapeType.Box;
29201
29290
  return _this;
@@ -29230,11 +29319,11 @@ __decorate([
29230
29319
 
29231
29320
  /**
29232
29321
  * Particle shape that emits particles from a circle.
29233
- */ var CircleShape = /*#__PURE__*/ function(BaseShape) {
29234
- _inherits(CircleShape, BaseShape);
29322
+ */ var CircleShape = /*#__PURE__*/ function(BaseShape1) {
29323
+ _inherits(CircleShape, BaseShape1);
29235
29324
  function CircleShape() {
29236
29325
  var _this;
29237
- _this = BaseShape.call(this) || this;
29326
+ _this = BaseShape1.call(this) || this;
29238
29327
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29239
29328
  /** Angle of the circle arc to emit particles from. */ _this.arc = 360.0;
29240
29329
  /** The mode to generate particles around the arc. */ _this.arcMode = ParticleShapeArcMode.Random;
@@ -29271,11 +29360,11 @@ __decorate([
29271
29360
 
29272
29361
  /**
29273
29362
  * Cone shape.
29274
- */ var ConeShape = /*#__PURE__*/ function(BaseShape) {
29275
- _inherits(ConeShape, BaseShape);
29363
+ */ var ConeShape = /*#__PURE__*/ function(BaseShape1) {
29364
+ _inherits(ConeShape, BaseShape1);
29276
29365
  function ConeShape() {
29277
29366
  var _this;
29278
- _this = BaseShape.call(this) || this;
29367
+ _this = BaseShape1.call(this) || this;
29279
29368
  /** Angle of the cone to emit particles from. */ _this.angle = 25.0;
29280
29369
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29281
29370
  /** Length of the cone to emit particles from. */ _this.length = 5.0;
@@ -29336,11 +29425,11 @@ var ConeEmitType;
29336
29425
 
29337
29426
  /**
29338
29427
  * Particle shape that emits particles from a hemisphere.
29339
- */ var HemisphereShape = /*#__PURE__*/ function(BaseShape) {
29340
- _inherits(HemisphereShape, BaseShape);
29428
+ */ var HemisphereShape = /*#__PURE__*/ function(BaseShape1) {
29429
+ _inherits(HemisphereShape, BaseShape1);
29341
29430
  function HemisphereShape() {
29342
29431
  var _this;
29343
- _this = BaseShape.call(this) || this;
29432
+ _this = BaseShape1.call(this) || this;
29344
29433
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29345
29434
  _this.shapeType = ParticleShapeType.Hemisphere;
29346
29435
  return _this;
@@ -29361,11 +29450,11 @@ var ConeEmitType;
29361
29450
 
29362
29451
  /**
29363
29452
  * Particle shape that emits particles from a sphere.
29364
- */ var SphereShape = /*#__PURE__*/ function(BaseShape) {
29365
- _inherits(SphereShape, BaseShape);
29453
+ */ var SphereShape = /*#__PURE__*/ function(BaseShape1) {
29454
+ _inherits(SphereShape, BaseShape1);
29366
29455
  function SphereShape() {
29367
29456
  var _this;
29368
- _this = BaseShape.call(this) || this;
29457
+ _this = BaseShape1.call(this) || this;
29369
29458
  /** Radius of the shape to emit particles from. */ _this.radius = 1.0;
29370
29459
  _this.shapeType = ParticleShapeType.Sphere;
29371
29460
  return _this;
@@ -29387,11 +29476,11 @@ var FRAG_SHADER = "#define GLSLIFY 1\nvarying vec2 v_uv;uniform sampler2D u_text
29387
29476
  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
29388
29477
 
29389
29478
  Shader.create("trail", VERT_SHADER, FRAG_SHADER);
29390
- var TrailMaterial = /*#__PURE__*/ function(Material) {
29391
- _inherits(TrailMaterial, Material);
29479
+ var TrailMaterial = /*#__PURE__*/ function(Material1) {
29480
+ _inherits(TrailMaterial, Material1);
29392
29481
  function TrailMaterial(engine) {
29393
29482
  var _this;
29394
- _this = Material.call(this, engine, Shader.find("trail")) || this;
29483
+ _this = Material1.call(this, engine, Shader.find("trail")) || this;
29395
29484
  var target = _this.renderState.blendState.targetBlendState;
29396
29485
  target.enabled = true;
29397
29486
  target.sourceColorBlendFactor = target.sourceAlphaBlendFactor = BlendFactor.SourceAlpha;
@@ -29405,11 +29494,11 @@ var TrailMaterial = /*#__PURE__*/ function(Material) {
29405
29494
  var _tempVector3 = new Vector3();
29406
29495
  /**
29407
29496
  * @deprecated
29408
- */ var TrailRenderer = /*#__PURE__*/ function(MeshRenderer) {
29409
- _inherits(TrailRenderer, MeshRenderer);
29497
+ */ var TrailRenderer = /*#__PURE__*/ function(MeshRenderer1) {
29498
+ _inherits(TrailRenderer, MeshRenderer1);
29410
29499
  function TrailRenderer(entity, props) {
29411
29500
  var _this;
29412
- _this = MeshRenderer.call(this, entity) || this;
29501
+ _this = MeshRenderer1.call(this, entity) || this;
29413
29502
  _this._stroke = props.stroke || 0.2;
29414
29503
  _this._minSeg = props.minSeg || 0.02;
29415
29504
  _this._lifetime = props.lifetime || 1000;
@@ -29478,7 +29567,7 @@ var _tempVector3 = new Vector3();
29478
29567
  this._updateStrapVertices(context.camera, this._points);
29479
29568
  this._updateStrapCoords();
29480
29569
  this._vertexBuffer.setData(this._vertices);
29481
- MeshRenderer.prototype._render.call(this, context);
29570
+ MeshRenderer1.prototype._render.call(this, context);
29482
29571
  };
29483
29572
  _proto._initGeometry = function _initGeometry() {
29484
29573
  var mesh = new BufferMesh(this._entity.engine);
@@ -29593,11 +29682,11 @@ var _tempVector3 = new Vector3();
29593
29682
  * skybox.specularTexture = cubeTexture;
29594
29683
  * }
29595
29684
  * ```
29596
- */ var Probe = /*#__PURE__*/ function(Script) {
29597
- _inherits(Probe, Script);
29685
+ */ var Probe = /*#__PURE__*/ function(Script1) {
29686
+ _inherits(Probe, Script1);
29598
29687
  function Probe() {
29599
29688
  var _this;
29600
- _this = Script.apply(this, arguments) || this;
29689
+ _this = Script1.apply(this, arguments) || this;
29601
29690
  /**
29602
29691
  * Probe's layer, render everything by default.
29603
29692
  */ _this.probeLayer = Layer.Everything;
@@ -29660,11 +29749,11 @@ var cacheUp = new Vector3();
29660
29749
  var cacheDir = new Vector3();
29661
29750
  /**
29662
29751
  * Cube probe, generate cubeTexture, used for dynamic environment reflection and other effects.
29663
- */ var CubeProbe = /*#__PURE__*/ function(Probe) {
29664
- _inherits(CubeProbe, Probe);
29752
+ */ var CubeProbe = /*#__PURE__*/ function(Probe1) {
29753
+ _inherits(CubeProbe, Probe1);
29665
29754
  function CubeProbe() {
29666
29755
  var _this;
29667
- _this = Probe.apply(this, arguments) || this;
29756
+ _this = Probe1.apply(this, arguments) || this;
29668
29757
  /**
29669
29758
  * The position of the probe can be set, the default is the origin [0,0,0].
29670
29759
  */ _this.position = new Vector3(0, 0, 0);
@@ -29675,7 +29764,7 @@ var cacheDir = new Vector3();
29675
29764
  var _proto = CubeProbe.prototype;
29676
29765
  _proto.onBeginRender = function onBeginRender(camera) {
29677
29766
  if (!this.enabled) return;
29678
- Probe.prototype.onBeginRender.call(this, camera);
29767
+ Probe1.prototype.onBeginRender.call(this, camera);
29679
29768
  this._storeCamera(camera);
29680
29769
  // Render 6 faces
29681
29770
  for(var faceIndex = 0; faceIndex < 6; faceIndex++){
@@ -29684,7 +29773,7 @@ var cacheDir = new Vector3();
29684
29773
  camera.render(TextureCubeFace.PositiveX + faceIndex);
29685
29774
  }
29686
29775
  this._restoreCamera(camera);
29687
- Probe.prototype._reset.call(this);
29776
+ Probe1.prototype._reset.call(this);
29688
29777
  };
29689
29778
  /**
29690
29779
  * Store original camera parameters.