@galacean/engine-core 2.0.0-alpha.13 → 2.0.0-alpha.15

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
@@ -1650,6 +1650,14 @@ SystemInfo._initialize();
1650
1650
  return this._height;
1651
1651
  }
1652
1652
  },
1653
+ {
1654
+ key: "colorTextures",
1655
+ get: /**
1656
+ * Render color textures.
1657
+ */ function get() {
1658
+ return this._colorTextures;
1659
+ }
1660
+ },
1653
1661
  {
1654
1662
  key: "colorTextureCount",
1655
1663
  get: /**
@@ -22282,275 +22290,978 @@ PrimitiveMesh._sphereSeedCells = new Float32Array([
22282
22290
  PrimitiveMesh._sphereEdgeIdx = 0;
22283
22291
  PrimitiveMesh._spherePoleIdx = 0;
22284
22292
 
22285
- function _is_native_reflect_construct() {
22286
- // Since Reflect.construct can't be properly polyfilled, some
22287
- // implementations (e.g. core-js@2) don't set the correct internal slots.
22288
- // Those polyfills don't allow us to subclass built-ins, so we need to
22289
- // use our fallback implementation.
22290
- try {
22291
- // If the internal slots aren't set, this throws an error similar to
22292
- // TypeError: this is not a Boolean object.
22293
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
22294
- } catch (_) {}
22295
- return (_is_native_reflect_construct = function() {
22296
- return !!result;
22297
- })();
22298
- }
22299
-
22300
- function _construct(Parent, args, Class) {
22301
- if (_is_native_reflect_construct()) _construct = Reflect.construct;
22302
- else {
22303
- _construct = function construct(Parent, args, Class) {
22304
- var a = [null];
22305
- a.push.apply(a, args);
22306
- var Constructor = Function.bind.apply(Parent, a);
22307
- var instance = new Constructor();
22308
-
22309
- if (Class) _set_prototype_of(instance, Class.prototype);
22310
-
22311
- return instance;
22312
- };
22313
- }
22314
-
22315
- return _construct.apply(null, arguments);
22316
- }
22317
-
22318
- var ComponentCloner = /*#__PURE__*/ function() {
22319
- function ComponentCloner() {}
22320
- /**
22321
- * Clone component.
22322
- * @param source - Clone source
22323
- * @param target - Clone target
22324
- */ ComponentCloner.cloneComponent = function cloneComponent(source, target, srcRoot, targetRoot, deepInstanceMap) {
22325
- var cloneModes = CloneManager.getCloneMode(source.constructor);
22326
- for(var k in source){
22327
- CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
22293
+ /**
22294
+ * @internal
22295
+ * Utility functions for remapping Entity/Component references during cloning.
22296
+ */ var CloneUtils = /*#__PURE__*/ function() {
22297
+ function CloneUtils() {}
22298
+ CloneUtils.remapEntity = function remapEntity(srcRoot, targetRoot, entity) {
22299
+ var paths = CloneUtils._tempRemapPath;
22300
+ var success = CloneUtils._getEntityHierarchyPath(srcRoot, entity, paths);
22301
+ return success ? CloneUtils._getEntityByHierarchyPath(targetRoot, paths) : entity;
22302
+ };
22303
+ CloneUtils.remapComponent = function remapComponent(srcRoot, targetRoot, component) {
22304
+ var _CloneUtils__getEntityByHierarchyPath;
22305
+ var paths = CloneUtils._tempRemapPath;
22306
+ var success = CloneUtils._getEntityHierarchyPath(srcRoot, component.entity, paths);
22307
+ return success ? (_CloneUtils__getEntityByHierarchyPath = CloneUtils._getEntityByHierarchyPath(targetRoot, paths)) == null ? void 0 : _CloneUtils__getEntityByHierarchyPath.getComponent(component.constructor) : component;
22308
+ };
22309
+ CloneUtils._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
22310
+ inversePath.length = 0;
22311
+ while(searchEntity !== rootEntity){
22312
+ var parent = searchEntity.parent;
22313
+ if (!parent) {
22314
+ return false;
22315
+ }
22316
+ inversePath.push(searchEntity.siblingIndex);
22317
+ searchEntity = parent;
22328
22318
  }
22329
- if (source._cloneTo) {
22330
- source._cloneTo(target, srcRoot, targetRoot);
22319
+ return true;
22320
+ };
22321
+ CloneUtils._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
22322
+ var entity = rootEntity;
22323
+ for(var i = inversePath.length - 1; i >= 0; i--){
22324
+ entity = entity.children[inversePath[i]];
22331
22325
  }
22326
+ return entity;
22332
22327
  };
22333
- return ComponentCloner;
22328
+ return CloneUtils;
22334
22329
  }();
22330
+ CloneUtils._tempRemapPath = [];
22335
22331
 
22336
22332
  /**
22337
- * The entity modify flags.
22338
- */ var EntityModifyFlags = /*#__PURE__*/ function(EntityModifyFlags) {
22339
- /** The parent changes. */ EntityModifyFlags[EntityModifyFlags["Parent"] = 1] = "Parent";
22340
- /** The child changes. */ EntityModifyFlags[EntityModifyFlags["Child"] = 2] = "Child";
22341
- return EntityModifyFlags;
22342
- }({});
22343
-
22344
- /**
22345
- * Entity, be used as components container.
22346
- */ var Entity = /*#__PURE__*/ function(EngineObject) {
22347
- _inherits(Entity, EngineObject);
22348
- function Entity(engine, name) {
22349
- for(var _len = arguments.length, components = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
22350
- components[_key - 2] = arguments[_key];
22351
- }
22333
+ * Skin used for skinned mesh renderer.
22334
+ */ var Skin = /*#__PURE__*/ function(EngineObject) {
22335
+ _inherits(Skin, EngineObject);
22336
+ function Skin(name) {
22352
22337
  var _this;
22353
- _this = EngineObject.call(this, engine) || this, /** The layer the entity belongs to. */ _this.layer = Layer.Layer0, /** @internal */ _this._isActiveInHierarchy = false, /** @internal */ _this._isActiveInScene = false, /** @internal */ _this._components = [], /** @internal */ _this._scripts = new DisorderedArray(), /** @internal */ _this._children = [], /** @internal */ _this._isRoot = false, /** @internal */ _this._isActive = true, /** @internal */ _this._siblingIndex = -1, /** @internal */ _this._isTemplate = false, /** @internal */ _this._updateFlagManager = new UpdateFlagManager(), _this._parent = null, //--------------------------------------------------------------deprecated----------------------------------------------------------------
22354
- _this._invModelMatrix = new Matrix();
22355
- _this.name = name != null ? name : "Entity";
22356
- for(var i = 0, n = components.length; i < n; i++){
22357
- _this.addComponent(components[i]);
22358
- }
22359
- !_this._transform && _this.addComponent(Transform);
22360
- _this._inverseWorldMatFlag = _this.registerWorldChangeFlag();
22338
+ _this = EngineObject.call(this, null) || this, _this.name = name, _this.inverseBindMatrices = new Array(), _this._updatedManager = new UpdateFlagManager(), _this._bones = new Array(), _this._updateMark = -1, _this.joints = [];
22361
22339
  return _this;
22362
22340
  }
22363
- var _proto = Entity.prototype;
22341
+ var _proto = Skin.prototype;
22364
22342
  /**
22365
- * Add component based on the component type.
22366
- * @param type - The type of the component
22367
- * @param args - The arguments of the component
22368
- * @returns The component which has been added
22369
- */ _proto.addComponent = function addComponent(type) {
22370
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
22371
- args[_key - 1] = arguments[_key];
22343
+ * @internal
22344
+ */ _proto._updateSkinMatrices = function _updateSkinMatrices(renderer) {
22345
+ if (this._updateMark === renderer.engine.time.frameCount) {
22346
+ return;
22372
22347
  }
22373
- ComponentsDependencies._addCheck(this, type);
22374
- var component = _construct(type, [].concat([
22375
- this
22376
- ], args));
22377
- this._components.push(component);
22378
- // @todo: temporary solution
22379
- if (_instanceof(component, Transform)) this._setTransform(component);
22380
- component._setActive(true, ActiveChangeFlag.All);
22381
- return component;
22382
- };
22383
- /**
22384
- * Get component which match the type.
22385
- * @param type - The type of the component
22386
- * @returns The first component which match type
22387
- */ _proto.getComponent = function getComponent(type) {
22388
- var components = this._components;
22389
- for(var i = 0, n = components.length; i < n; i++){
22390
- var component = components[i];
22391
- if (_instanceof(component, type)) {
22392
- return component;
22348
+ var _this = this, bones = _this.bones, bindMatrices = _this.inverseBindMatrices, skinMatrices = _this._skinMatrices;
22349
+ var _this_rootBone;
22350
+ var worldToLocal = ((_this_rootBone = this.rootBone) != null ? _this_rootBone : renderer.entity).getInvModelMatrix();
22351
+ for(var i = bones.length - 1; i >= 0; i--){
22352
+ var bone = bones[i];
22353
+ var offset = i * 16;
22354
+ if (bone) {
22355
+ Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, skinMatrices, offset);
22356
+ } else {
22357
+ skinMatrices.set(bindMatrices[i].elements, offset);
22393
22358
  }
22359
+ Utils._floatMatrixMultiply(worldToLocal, skinMatrices, offset, skinMatrices, offset);
22394
22360
  }
22395
- return null;
22361
+ this._updateMark = renderer.engine.time.frameCount;
22396
22362
  };
22397
22363
  /**
22398
- * Get components which match the type.
22399
- * @param type - The type of the component
22400
- * @param results - The components which match type
22401
- * @returns The components which match type
22402
- */ _proto.getComponents = function getComponents(type, results) {
22403
- results.length = 0;
22404
- var components = this._components;
22405
- for(var i = 0, n = components.length; i < n; i++){
22406
- var component = components[i];
22407
- if (_instanceof(component, type)) {
22408
- results.push(component);
22364
+ * @internal
22365
+ */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
22366
+ // Clone rootBone
22367
+ var rootBone = this.rootBone;
22368
+ if (rootBone) {
22369
+ target.rootBone = CloneUtils.remapEntity(srcRoot, targetRoot, rootBone);
22370
+ }
22371
+ // Clone bones
22372
+ var bones = this.bones;
22373
+ if (bones.length > 0) {
22374
+ var boneCount = bones.length;
22375
+ var destBones = new Array(boneCount);
22376
+ for(var i = 0; i < boneCount; i++){
22377
+ destBones[i] = CloneUtils.remapEntity(srcRoot, targetRoot, bones[i]);
22409
22378
  }
22379
+ target.bones = destBones;
22410
22380
  }
22411
- return results;
22412
- };
22413
- /**
22414
- * Get the components which match the type of the entity and it's children.
22415
- * @param type - The component type
22416
- * @param results - The components collection
22417
- * @returns The components collection which match the type
22418
- */ _proto.getComponentsIncludeChildren = function getComponentsIncludeChildren(type, results) {
22419
- results.length = 0;
22420
- this._getComponentsInChildren(type, results);
22421
- return results;
22422
22381
  };
22423
- _proto.addChild = function addChild(indexOrChild, child) {
22424
- var index;
22425
- if (typeof indexOrChild === "number") {
22426
- index = indexOrChild;
22427
- } else {
22428
- index = undefined;
22429
- child = indexOrChild;
22382
+ _create_class(Skin, [
22383
+ {
22384
+ key: "rootBone",
22385
+ get: /**
22386
+ * Root bone.
22387
+ */ function get() {
22388
+ return this._rootBone;
22389
+ },
22390
+ set: function set(value) {
22391
+ if (this._rootBone !== value) {
22392
+ this._updatedManager.dispatch(1, value);
22393
+ this._rootBone = value;
22394
+ }
22395
+ }
22396
+ },
22397
+ {
22398
+ key: "bones",
22399
+ get: /**
22400
+ * Bones of the skin.
22401
+ */ function get() {
22402
+ return this._bones;
22403
+ },
22404
+ set: function set(value) {
22405
+ var bones = this._bones;
22406
+ var _value_length;
22407
+ var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
22408
+ var lastBoneCount = bones.length;
22409
+ bones.length = boneCount;
22410
+ for(var i = 0; i < boneCount; i++){
22411
+ bones[i] = value[i];
22412
+ }
22413
+ if (lastBoneCount !== boneCount) {
22414
+ this._skinMatrices = new Float32Array(boneCount * 16);
22415
+ this._updatedManager.dispatch(0, boneCount);
22416
+ }
22417
+ }
22418
+ },
22419
+ {
22420
+ key: "skeleton",
22421
+ get: /** @deprecated Please use `rootBone` instead. */ function get() {
22422
+ var _this_rootBone;
22423
+ return (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.name;
22424
+ },
22425
+ set: function set(value) {
22426
+ var rootBone = this._rootBone;
22427
+ if (rootBone) {
22428
+ rootBone.name = value;
22429
+ }
22430
+ }
22430
22431
  }
22431
- child._setParent(this, index);
22432
- };
22432
+ ]);
22433
+ return Skin;
22434
+ }(EngineObject);
22435
+ __decorate([
22436
+ deepClone
22437
+ ], Skin.prototype, "inverseBindMatrices", void 0);
22438
+ __decorate([
22439
+ ignoreClone
22440
+ ], Skin.prototype, "_skinMatrices", void 0);
22441
+ __decorate([
22442
+ ignoreClone
22443
+ ], Skin.prototype, "_updatedManager", void 0);
22444
+ __decorate([
22445
+ ignoreClone
22446
+ ], Skin.prototype, "_rootBone", void 0);
22447
+ __decorate([
22448
+ ignoreClone
22449
+ ], Skin.prototype, "_bones", void 0);
22450
+ __decorate([
22451
+ ignoreClone
22452
+ ], Skin.prototype, "_updateMark", void 0);
22453
+ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
22454
+ SkinUpdateFlag[SkinUpdateFlag["BoneCountChanged"] = 0] = "BoneCountChanged";
22455
+ SkinUpdateFlag[SkinUpdateFlag["RootBoneChanged"] = 1] = "RootBoneChanged";
22456
+ return SkinUpdateFlag;
22457
+ }({});
22458
+
22459
+ /**
22460
+ * SkinnedMeshRenderer.
22461
+ */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
22462
+ _inherits(SkinnedMeshRenderer, MeshRenderer);
22463
+ function SkinnedMeshRenderer(entity) {
22464
+ var _this;
22465
+ _this = MeshRenderer.call(this, entity) || this, _this._localBounds = new BoundingBox(), _this._jointDataCreateCache = new Vector2(-1, -1);
22466
+ _this._skin = null;
22467
+ var rhi = _this.entity.engine._hardwareRenderer;
22468
+ var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
22469
+ // Limit size to 256 to avoid some problem:
22470
+ // For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
22471
+ // For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
22472
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
22473
+ _this._maxVertexUniformVectors = maxVertexUniformVectors;
22474
+ _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_this);
22475
+ _this._onSkinUpdated = _this._onSkinUpdated.bind(_this);
22476
+ var localBounds = _this._localBounds;
22477
+ // @ts-ignore
22478
+ localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
22479
+ // @ts-ignore
22480
+ localBounds.max._onValueChanged = _this._onLocalBoundsChanged;
22481
+ return _this;
22482
+ }
22483
+ var _proto = SkinnedMeshRenderer.prototype;
22433
22484
  /**
22434
- * Remove child entity.
22435
- * @param child - The child entity which want to be removed
22436
- */ _proto.removeChild = function removeChild(child) {
22437
- if (child._parent !== this) return;
22438
- child._setParent(null);
22485
+ * @internal
22486
+ */ _proto._onDestroy = function _onDestroy() {
22487
+ var _this__jointTexture;
22488
+ MeshRenderer.prototype._onDestroy.call(this);
22489
+ this._jointDataCreateCache = null;
22490
+ this._skin = null;
22491
+ this._blendShapeWeights = null;
22492
+ this._localBounds = null;
22493
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
22494
+ this._jointTexture = null;
22439
22495
  };
22440
22496
  /**
22441
- * @deprecated Please use `children` property instead.
22442
- * Find child entity by index.
22443
- * @param index - The index of the child entity
22444
- * @returns The component which be found
22445
- */ _proto.getChild = function getChild(index) {
22446
- return this._children[index];
22497
+ * @internal
22498
+ */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
22499
+ MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
22500
+ if (this.skin) {
22501
+ target._applySkin(null, target.skin);
22502
+ }
22503
+ this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
22447
22504
  };
22448
- /**
22449
- * Find entity by name.
22450
- * @param name - The name of the entity which want to be found
22451
- * @returns The component which be found
22452
- */ _proto.findByName = function findByName(name) {
22453
- if (name === this.name) {
22454
- return this;
22505
+ _proto._update = function _update(context) {
22506
+ var skin = this.skin;
22507
+ if ((skin == null ? void 0 : skin.bones.length) > 0) {
22508
+ skin._updateSkinMatrices(this);
22455
22509
  }
22456
- var children = this._children;
22457
- for(var i = 0, n = children.length; i < n; i++){
22458
- var target = children[i].findByName(name);
22459
- if (target) {
22460
- return target;
22510
+ var shaderData = this.shaderData;
22511
+ var mesh = this.mesh;
22512
+ var blendShapeManager = mesh._blendShapeManager;
22513
+ blendShapeManager._updateShaderData(shaderData, this);
22514
+ var bones = skin == null ? void 0 : skin.bones;
22515
+ if (bones) {
22516
+ var bsUniformOccupiesCount = blendShapeManager._uniformOccupiesCount;
22517
+ var boneCount = bones.length;
22518
+ var boneDataCreateCache = this._jointDataCreateCache;
22519
+ var boneCountChange = boneCount !== boneDataCreateCache.x;
22520
+ if (boneCountChange || bsUniformOccupiesCount !== boneDataCreateCache.y) {
22521
+ // directly use max joint count to avoid shader recompile
22522
+ var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
22523
+ if (boneCount > remainUniformJointCount) {
22524
+ var engine = this.engine;
22525
+ if (engine._hardwareRenderer.canIUseMoreJoints) {
22526
+ if (boneCountChange) {
22527
+ var _this__jointTexture;
22528
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
22529
+ this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
22530
+ this._jointTexture.filterMode = TextureFilterMode.Point;
22531
+ this._jointTexture.isGCIgnored = true;
22532
+ }
22533
+ shaderData.disableMacro("RENDERER_JOINTS_NUM");
22534
+ shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
22535
+ shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
22536
+ } else {
22537
+ Logger.error("component's joints count(" + boneCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
22538
+ }
22539
+ } else {
22540
+ var _this__jointTexture1;
22541
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
22542
+ shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
22543
+ shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
22544
+ shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, skin._skinMatrices);
22545
+ }
22546
+ boneDataCreateCache.set(boneCount, bsUniformOccupiesCount);
22547
+ }
22548
+ if (this._jointTexture) {
22549
+ this._jointTexture.setPixelBuffer(skin._skinMatrices);
22461
22550
  }
22462
22551
  }
22463
- return null;
22552
+ MeshRenderer.prototype._update.call(this, context);
22464
22553
  };
22465
22554
  /**
22466
- * Find the entity by path.
22467
- * @param path - The path of the entity eg: /entity
22468
- * @returns The component which be found
22469
- */ _proto.findByPath = function findByPath(path) {
22470
- var splits = path.split("/").filter(Boolean);
22471
- if (!splits.length) {
22472
- return this;
22555
+ * @internal
22556
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
22557
+ var _this_skin;
22558
+ var rootBone = (_this_skin = this.skin) == null ? void 0 : _this_skin.rootBone;
22559
+ if (rootBone) {
22560
+ BoundingBox.transform(this._localBounds, this._transformEntity.transform.worldMatrix, worldBounds);
22561
+ } else {
22562
+ MeshRenderer.prototype._updateBounds.call(this, worldBounds);
22473
22563
  }
22474
- return Entity._findChildByName(this, 0, splits, 0);
22475
- };
22476
- /**
22477
- * Create child entity.
22478
- * @param name - The child entity's name
22479
- * @returns The child entity
22480
- */ _proto.createChild = function createChild(name) {
22481
- var transform = this._transform;
22482
- var child = transform ? new Entity(this.engine, name, transform.constructor) : new Entity(this.engine, name);
22483
- child.layer = this.layer;
22484
- child.parent = this;
22485
- return child;
22486
22564
  };
22487
- /**
22488
- * Clear children entities.
22489
- */ _proto.clearChildren = function clearChildren() {
22490
- var children = this._children;
22491
- for(var i = children.length - 1; i >= 0; i--){
22492
- var child = children[i];
22493
- child._parent = null;
22494
- var activeChangeFlag = ActiveChangeFlag.None;
22495
- child._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
22496
- child._isActiveInScene && (activeChangeFlag |= ActiveChangeFlag.Scene);
22497
- activeChangeFlag && child._processInActive(activeChangeFlag);
22498
- Entity._traverseSetOwnerScene(child, null); // Must after child._processInActive().
22565
+ _proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
22566
+ var mesh = this._mesh;
22567
+ var newBlendShapeCount = mesh ? mesh.blendShapeCount : 0;
22568
+ var lastBlendShapeWeights = this._blendShapeWeights;
22569
+ if (lastBlendShapeWeights) {
22570
+ var lastBlendShapeWeightsCount = lastBlendShapeWeights.length;
22571
+ if (lastBlendShapeWeightsCount !== newBlendShapeCount) {
22572
+ var newBlendShapeWeights = new Float32Array(newBlendShapeCount);
22573
+ if (newBlendShapeCount > lastBlendShapeWeightsCount) {
22574
+ newBlendShapeWeights.set(lastBlendShapeWeights);
22575
+ } else {
22576
+ for(var i = 0; i < newBlendShapeCount; i++){
22577
+ newBlendShapeWeights[i] = lastBlendShapeWeights[i];
22578
+ }
22579
+ }
22580
+ this._blendShapeWeights = newBlendShapeWeights;
22581
+ }
22582
+ } else {
22583
+ this._blendShapeWeights = new Float32Array(newBlendShapeCount);
22499
22584
  }
22500
- children.length = 0;
22501
- };
22502
- /**
22503
- * Clone this entity include children and components.
22504
- * @returns Cloned entity
22505
- */ _proto.clone = function clone() {
22506
- var cloneEntity = this._createCloneEntity();
22507
- this._parseCloneEntity(this, cloneEntity, this, cloneEntity, new Map());
22508
- return cloneEntity;
22509
- };
22510
- /**
22511
- * Listen for changes in the world pose of this `Entity`.
22512
- * @returns Change flag
22513
- */ _proto.registerWorldChangeFlag = function registerWorldChangeFlag() {
22514
- return this._updateFlagManager.createFlag(BoolUpdateFlag);
22515
22585
  };
22516
- /**
22517
- * @internal
22518
- */ _proto._markAsTemplate = function _markAsTemplate(templateResource) {
22519
- this._isTemplate = true;
22520
- this._templateResource = templateResource;
22586
+ _proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
22587
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
22521
22588
  };
22522
- _proto._createCloneEntity = function _createCloneEntity() {
22523
- var componentConstructors = Entity._tempComponentConstructors;
22524
- var components = this._components;
22525
- for(var i = 0, n = components.length; i < n; i++){
22526
- componentConstructors[i] = components[i].constructor;
22589
+ _proto._onSkinUpdated = function _onSkinUpdated(type, value) {
22590
+ switch(type){
22591
+ case SkinUpdateFlag.BoneCountChanged:
22592
+ var shaderData = this.shaderData;
22593
+ if (value > 0) {
22594
+ shaderData.enableMacro("RENDERER_HAS_SKIN");
22595
+ shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, value);
22596
+ } else {
22597
+ shaderData.disableMacro("RENDERER_HAS_SKIN");
22598
+ }
22599
+ break;
22600
+ case SkinUpdateFlag.RootBoneChanged:
22601
+ this._setTransformEntity(value);
22602
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
22603
+ break;
22527
22604
  }
22528
- var cloneEntity = _construct(Entity, [].concat([
22529
- this.engine,
22530
- this.name
22531
- ], componentConstructors));
22532
- componentConstructors.length = 0;
22533
- var templateResource = this._templateResource;
22534
- if (templateResource) {
22535
- cloneEntity._templateResource = templateResource;
22536
- templateResource._addReferCount(1);
22605
+ };
22606
+ _proto._applySkin = function _applySkin(lastSkin, value) {
22607
+ var _lastSkin_bones, _value_bones;
22608
+ var _lastSkin_bones_length;
22609
+ var lastSkinBoneCount = (_lastSkin_bones_length = lastSkin == null ? void 0 : (_lastSkin_bones = lastSkin.bones) == null ? void 0 : _lastSkin_bones.length) != null ? _lastSkin_bones_length : 0;
22610
+ var _lastSkin_rootBone;
22611
+ var lastRootBone = (_lastSkin_rootBone = lastSkin == null ? void 0 : lastSkin.rootBone) != null ? _lastSkin_rootBone : this.entity;
22612
+ lastSkin == null ? void 0 : lastSkin._updatedManager.removeListener(this._onSkinUpdated);
22613
+ var _value_bones_length;
22614
+ var skinBoneCount = (_value_bones_length = value == null ? void 0 : (_value_bones = value.bones) == null ? void 0 : _value_bones.length) != null ? _value_bones_length : 0;
22615
+ var _value_rootBone;
22616
+ var rootBone = (_value_rootBone = value == null ? void 0 : value.rootBone) != null ? _value_rootBone : this.entity;
22617
+ value == null ? void 0 : value._updatedManager.addListener(this._onSkinUpdated);
22618
+ if (lastSkinBoneCount !== skinBoneCount) {
22619
+ this._onSkinUpdated(SkinUpdateFlag.BoneCountChanged, skinBoneCount);
22537
22620
  }
22538
- cloneEntity.layer = this.layer;
22539
- cloneEntity._isActive = this._isActive;
22540
- var srcChildren = this._children;
22541
- for(var i1 = 0, n1 = srcChildren.length; i1 < n1; i1++){
22542
- cloneEntity.addChild(srcChildren[i1]._createCloneEntity());
22621
+ if (lastRootBone !== rootBone) {
22622
+ this._onSkinUpdated(SkinUpdateFlag.RootBoneChanged, rootBone);
22543
22623
  }
22544
- return cloneEntity;
22545
22624
  };
22546
- _proto._parseCloneEntity = function _parseCloneEntity(src, target, srcRoot, targetRoot, deepInstanceMap) {
22547
- var srcChildren = src._children;
22548
- var targetChildren = target._children;
22549
- for(var i = 0, n = srcChildren.length; i < n; i++){
22550
- this._parseCloneEntity(srcChildren[i], targetChildren[i], srcRoot, targetRoot, deepInstanceMap);
22551
- }
22552
- var components = src._components;
22553
- for(var i1 = 0, n1 = components.length; i1 < n1; i1++){
22625
+ _create_class(SkinnedMeshRenderer, [
22626
+ {
22627
+ key: "skin",
22628
+ get: /**
22629
+ * Skin of the SkinnedMeshRenderer.
22630
+ */ function get() {
22631
+ return this._skin;
22632
+ },
22633
+ set: function set(value) {
22634
+ var lastSkin = this._skin;
22635
+ if (lastSkin !== value) {
22636
+ this._applySkin(lastSkin, value);
22637
+ this._skin = value;
22638
+ }
22639
+ }
22640
+ },
22641
+ {
22642
+ key: "blendShapeWeights",
22643
+ get: /**
22644
+ * The weights of the BlendShapes.
22645
+ * @remarks Array index is BlendShape index.
22646
+ */ function get() {
22647
+ this._checkBlendShapeWeightLength();
22648
+ return this._blendShapeWeights;
22649
+ },
22650
+ set: function set(value) {
22651
+ this._checkBlendShapeWeightLength();
22652
+ var blendShapeWeights = this._blendShapeWeights;
22653
+ if (value.length <= blendShapeWeights.length) {
22654
+ blendShapeWeights.set(value);
22655
+ } else {
22656
+ for(var i = 0, n = blendShapeWeights.length; i < n; i++){
22657
+ blendShapeWeights[i] = value[i];
22658
+ }
22659
+ }
22660
+ }
22661
+ },
22662
+ {
22663
+ key: "localBounds",
22664
+ get: /**
22665
+ * Local bounds.
22666
+ */ function get() {
22667
+ return this._localBounds;
22668
+ },
22669
+ set: function set(value) {
22670
+ if (this._localBounds !== value) {
22671
+ this._localBounds.copyFrom(value);
22672
+ }
22673
+ }
22674
+ },
22675
+ {
22676
+ key: "rootBone",
22677
+ get: /**
22678
+ * @deprecated use {@link SkinnedMeshRenderer.skin.rootBone} instead.
22679
+ */ function get() {
22680
+ return this.skin.rootBone;
22681
+ },
22682
+ set: function set(value) {
22683
+ this.skin.rootBone = value;
22684
+ }
22685
+ },
22686
+ {
22687
+ key: "bones",
22688
+ get: /**
22689
+ * @deprecated use {@link SkinnedMeshRenderer.skin.bones} instead.
22690
+ */ function get() {
22691
+ return this.skin.bones;
22692
+ },
22693
+ set: function set(value) {
22694
+ this.skin.bones = value;
22695
+ }
22696
+ }
22697
+ ]);
22698
+ return SkinnedMeshRenderer;
22699
+ }(MeshRenderer);
22700
+ // @TODO: different shader type should use different count, not always 48
22701
+ /** @internal */ SkinnedMeshRenderer._baseVertexUniformVectorCount = 48;
22702
+ SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
22703
+ SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
22704
+ SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
22705
+ __decorate([
22706
+ ignoreClone
22707
+ ], SkinnedMeshRenderer.prototype, "_condensedBlendShapeWeights", void 0);
22708
+ __decorate([
22709
+ deepClone
22710
+ ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
22711
+ __decorate([
22712
+ ignoreClone
22713
+ ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
22714
+ __decorate([
22715
+ ignoreClone
22716
+ ], SkinnedMeshRenderer.prototype, "_blendShapeWeights", void 0);
22717
+ __decorate([
22718
+ ignoreClone
22719
+ ], SkinnedMeshRenderer.prototype, "_maxVertexUniformVectors", void 0);
22720
+ __decorate([
22721
+ ignoreClone
22722
+ ], SkinnedMeshRenderer.prototype, "_jointTexture", void 0);
22723
+ __decorate([
22724
+ deepClone
22725
+ ], SkinnedMeshRenderer.prototype, "_skin", void 0);
22726
+ __decorate([
22727
+ ignoreClone
22728
+ ], SkinnedMeshRenderer.prototype, "_onLocalBoundsChanged", null);
22729
+ __decorate([
22730
+ ignoreClone
22731
+ ], SkinnedMeshRenderer.prototype, "_onSkinUpdated", null);
22732
+
22733
+ /**
22734
+ * @internal
22735
+ */ var BasicResources = /*#__PURE__*/ function() {
22736
+ function BasicResources(engine) {
22737
+ this.engine = engine;
22738
+ // prettier-ignore
22739
+ var vertices = new Float32Array([
22740
+ -1,
22741
+ -1,
22742
+ 0,
22743
+ 1,
22744
+ 3,
22745
+ -1,
22746
+ 2,
22747
+ 1,
22748
+ -1,
22749
+ 3,
22750
+ 0,
22751
+ -1
22752
+ ]); // left-top
22753
+ // prettier-ignore
22754
+ var flipYVertices = new Float32Array([
22755
+ 3,
22756
+ -1,
22757
+ 2,
22758
+ 0,
22759
+ -1,
22760
+ -1,
22761
+ 0,
22762
+ 0,
22763
+ -1,
22764
+ 3,
22765
+ 0,
22766
+ 2
22767
+ ]); // left-top
22768
+ var blitMaterial = new Material(engine, Shader.find("blit"));
22769
+ blitMaterial._addReferCount(1);
22770
+ blitMaterial.renderState.depthState.enabled = false;
22771
+ blitMaterial.renderState.depthState.writeEnabled = false;
22772
+ var blitScreenMaterial = new Material(engine, Shader.find("blit-screen"));
22773
+ blitScreenMaterial._addReferCount(1);
22774
+ blitScreenMaterial.renderState.depthState.enabled = false;
22775
+ blitScreenMaterial.renderState.depthState.writeEnabled = false;
22776
+ this.blitMaterial = blitMaterial;
22777
+ this.blitScreenMaterial = blitScreenMaterial;
22778
+ this.blitMesh = this._createBlitMesh(engine, vertices);
22779
+ this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
22780
+ // Create white and magenta textures
22781
+ var whitePixel = new Uint8Array([
22782
+ 255,
22783
+ 255,
22784
+ 255,
22785
+ 255
22786
+ ]);
22787
+ this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
22788
+ this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
22789
+ var isWebGL2 = engine._hardwareRenderer.isWebGL2;
22790
+ if (isWebGL2) {
22791
+ this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
22792
+ var whitePixel32 = new Uint32Array([
22793
+ 255,
22794
+ 255,
22795
+ 255,
22796
+ 255
22797
+ ]);
22798
+ this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
22799
+ }
22800
+ this.spriteDefaultMaterial = this._create2DMaterial(engine, Shader.find("Sprite"));
22801
+ this.textDefaultMaterial = this._create2DMaterial(engine, Shader.find("Text"));
22802
+ this.spriteMaskDefaultMaterial = this._createSpriteMaskMaterial(engine);
22803
+ this.meshMagentaMaterial = this._createMagentaMaterial(engine, "unlit");
22804
+ this.particleMagentaMaterial = this._createMagentaMaterial(engine, "particle-shader");
22805
+ }
22806
+ var _proto = BasicResources.prototype;
22807
+ /**
22808
+ * @internal
22809
+ */ _proto._getBlinnPhongMaterial = function _getBlinnPhongMaterial() {
22810
+ return this._blinnPhongMaterial || (this._blinnPhongMaterial = new BlinnPhongMaterial(this.engine));
22811
+ };
22812
+ /**
22813
+ * @internal
22814
+ */ _proto._initialize = function _initialize() {
22815
+ var _this = this;
22816
+ return new Promise(function(resolve, reject) {
22817
+ PrefilteredDFG.create(_this.engine).then(function(texture) {
22818
+ _this._prefilteredDFGTexture = texture;
22819
+ resolve(_this);
22820
+ }).catch(reject);
22821
+ });
22822
+ };
22823
+ _proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
22824
+ var mesh = new ModelMesh(engine);
22825
+ mesh._addReferCount(1);
22826
+ mesh.setVertexElements([
22827
+ new VertexElement("POSITION_UV", 0, VertexElementFormat.Vector4, 0)
22828
+ ]);
22829
+ var buffer = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices, BufferUsage.Static, true);
22830
+ mesh.setVertexBufferBinding(buffer, 16);
22831
+ mesh.addSubMesh(0, 3, MeshTopology.Triangles);
22832
+ engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
22833
+ _inherits(_class, ContentRestorer);
22834
+ function _class() {
22835
+ return ContentRestorer.call(this, mesh) || this;
22836
+ }
22837
+ var _proto = _class.prototype;
22838
+ _proto.restoreContent = function restoreContent() {
22839
+ buffer.setData(buffer.data);
22840
+ };
22841
+ return _class;
22842
+ }(ContentRestorer))());
22843
+ return mesh;
22844
+ };
22845
+ _proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel, isSRGBColorSpace) {
22846
+ var texture;
22847
+ switch(type){
22848
+ case 0:
22849
+ var texture2D = new Texture2D(engine, 1, 1, format, false, isSRGBColorSpace);
22850
+ texture2D.setPixelBuffer(pixel);
22851
+ texture = texture2D;
22852
+ break;
22853
+ case 2:
22854
+ var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false, isSRGBColorSpace);
22855
+ texture2DArray.setPixelBuffer(0, pixel);
22856
+ texture = texture2DArray;
22857
+ break;
22858
+ case 1:
22859
+ var textureCube = new TextureCube(engine, 1, format, false, isSRGBColorSpace);
22860
+ for(var i = 0; i < 6; i++){
22861
+ textureCube.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
22862
+ }
22863
+ texture = textureCube;
22864
+ break;
22865
+ default:
22866
+ throw "Invalid texture type";
22867
+ }
22868
+ texture.isGCIgnored = true;
22869
+ engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
22870
+ _inherits(_class, ContentRestorer);
22871
+ function _class() {
22872
+ return ContentRestorer.call(this, texture) || this;
22873
+ }
22874
+ var _proto = _class.prototype;
22875
+ _proto.restoreContent = function restoreContent() {
22876
+ switch(type){
22877
+ case 0:
22878
+ this.resource.setPixelBuffer(pixel);
22879
+ break;
22880
+ case 2:
22881
+ this.resource.setPixelBuffer(0, pixel);
22882
+ break;
22883
+ case 1:
22884
+ for(var i = 0; i < 6; i++){
22885
+ this.resource.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
22886
+ }
22887
+ break;
22888
+ }
22889
+ };
22890
+ return _class;
22891
+ }(ContentRestorer))());
22892
+ return texture;
22893
+ };
22894
+ _proto._create2DMaterial = function _create2DMaterial(engine, shader) {
22895
+ var material = new Material(engine, shader);
22896
+ var renderState = material.renderState;
22897
+ var target = renderState.blendState.targetBlendState;
22898
+ target.enabled = true;
22899
+ target.sourceColorBlendFactor = BlendFactor.SourceAlpha;
22900
+ target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
22901
+ target.sourceAlphaBlendFactor = BlendFactor.One;
22902
+ target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
22903
+ target.colorBlendOperation = target.alphaBlendOperation = BlendOperation.Add;
22904
+ renderState.depthState.writeEnabled = false;
22905
+ renderState.rasterState.cullMode = CullMode.Off;
22906
+ renderState.renderQueueType = RenderQueueType.Transparent;
22907
+ material.isGCIgnored = true;
22908
+ return material;
22909
+ };
22910
+ _proto._createMagentaMaterial = function _createMagentaMaterial(engine, shaderName) {
22911
+ var material = new Material(engine, Shader.find(shaderName));
22912
+ material.isGCIgnored = true;
22913
+ material.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
22914
+ return material;
22915
+ };
22916
+ _proto._createSpriteMaskMaterial = function _createSpriteMaskMaterial(engine) {
22917
+ var material = new Material(engine, Shader.find("SpriteMask"));
22918
+ material.isGCIgnored = true;
22919
+ return material;
22920
+ };
22921
+ BasicResources.getMaskInteractionRenderStates = function getMaskInteractionRenderStates(maskInteraction) {
22922
+ var visibleInsideMask = maskInteraction === SpriteMaskInteraction.VisibleInsideMask;
22923
+ var renderStates;
22924
+ var compareFunction;
22925
+ if (visibleInsideMask) {
22926
+ renderStates = BasicResources._maskReadInsideRenderStates;
22927
+ if (renderStates) {
22928
+ return renderStates;
22929
+ }
22930
+ BasicResources._maskReadInsideRenderStates = renderStates = {};
22931
+ compareFunction = CompareFunction.LessEqual;
22932
+ } else {
22933
+ renderStates = BasicResources._maskReadOutsideRenderStates;
22934
+ if (renderStates) {
22935
+ return renderStates;
22936
+ }
22937
+ BasicResources._maskReadOutsideRenderStates = renderStates = {};
22938
+ compareFunction = CompareFunction.Greater;
22939
+ }
22940
+ renderStates[RenderStateElementKey.StencilStateEnabled] = true;
22941
+ renderStates[RenderStateElementKey.StencilStateWriteMask] = 0x00;
22942
+ renderStates[RenderStateElementKey.StencilStateReferenceValue] = 1;
22943
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = compareFunction;
22944
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = compareFunction;
22945
+ return renderStates;
22946
+ };
22947
+ BasicResources.getMaskTypeRenderStates = function getMaskTypeRenderStates(maskType) {
22948
+ var isIncrement = maskType === RenderQueueMaskType.Increment;
22949
+ var renderStates;
22950
+ var passOperation;
22951
+ if (isIncrement) {
22952
+ renderStates = BasicResources._maskWriteIncrementRenderStates;
22953
+ if (renderStates) {
22954
+ return renderStates;
22955
+ }
22956
+ BasicResources._maskWriteIncrementRenderStates = renderStates = {};
22957
+ passOperation = StencilOperation.IncrementSaturate;
22958
+ } else {
22959
+ renderStates = BasicResources._maskWriteDecrementRenderStates;
22960
+ if (renderStates) {
22961
+ return renderStates;
22962
+ }
22963
+ BasicResources._maskWriteDecrementRenderStates = renderStates = {};
22964
+ passOperation = StencilOperation.DecrementSaturate;
22965
+ }
22966
+ renderStates[RenderStateElementKey.StencilStateEnabled] = true;
22967
+ renderStates[RenderStateElementKey.StencilStatePassOperationFront] = passOperation;
22968
+ renderStates[RenderStateElementKey.StencilStatePassOperationBack] = passOperation;
22969
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = CompareFunction.Always;
22970
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = CompareFunction.Always;
22971
+ var failStencilOperation = StencilOperation.Keep;
22972
+ renderStates[RenderStateElementKey.StencilStateFailOperationFront] = failStencilOperation;
22973
+ renderStates[RenderStateElementKey.StencilStateFailOperationBack] = failStencilOperation;
22974
+ renderStates[RenderStateElementKey.StencilStateZFailOperationFront] = failStencilOperation;
22975
+ renderStates[RenderStateElementKey.StencilStateZFailOperationBack] = failStencilOperation;
22976
+ renderStates[RenderStateElementKey.BlendStateColorWriteMask0] = ColorWriteMask.None;
22977
+ renderStates[RenderStateElementKey.DepthStateEnabled] = false;
22978
+ renderStates[RenderStateElementKey.RasterStateCullMode] = CullMode.Off;
22979
+ return renderStates;
22980
+ };
22981
+ _create_class(BasicResources, [
22982
+ {
22983
+ key: "prefilteredDFGTexture",
22984
+ get: function get() {
22985
+ return this._prefilteredDFGTexture;
22986
+ }
22987
+ }
22988
+ ]);
22989
+ return BasicResources;
22990
+ }();
22991
+ BasicResources._maskReadInsideRenderStates = null;
22992
+ BasicResources._maskReadOutsideRenderStates = null;
22993
+ BasicResources._maskWriteIncrementRenderStates = null;
22994
+ BasicResources._maskWriteDecrementRenderStates = null;
22995
+
22996
+ function _is_native_reflect_construct() {
22997
+ // Since Reflect.construct can't be properly polyfilled, some
22998
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
22999
+ // Those polyfills don't allow us to subclass built-ins, so we need to
23000
+ // use our fallback implementation.
23001
+ try {
23002
+ // If the internal slots aren't set, this throws an error similar to
23003
+ // TypeError: this is not a Boolean object.
23004
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
23005
+ } catch (_) {}
23006
+ return (_is_native_reflect_construct = function() {
23007
+ return !!result;
23008
+ })();
23009
+ }
23010
+
23011
+ function _construct(Parent, args, Class) {
23012
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
23013
+ else {
23014
+ _construct = function construct(Parent, args, Class) {
23015
+ var a = [null];
23016
+ a.push.apply(a, args);
23017
+ var Constructor = Function.bind.apply(Parent, a);
23018
+ var instance = new Constructor();
23019
+
23020
+ if (Class) _set_prototype_of(instance, Class.prototype);
23021
+
23022
+ return instance;
23023
+ };
23024
+ }
23025
+
23026
+ return _construct.apply(null, arguments);
23027
+ }
23028
+
23029
+ var ComponentCloner = /*#__PURE__*/ function() {
23030
+ function ComponentCloner() {}
23031
+ /**
23032
+ * Clone component.
23033
+ * @param source - Clone source
23034
+ * @param target - Clone target
23035
+ */ ComponentCloner.cloneComponent = function cloneComponent(source, target, srcRoot, targetRoot, deepInstanceMap) {
23036
+ var cloneModes = CloneManager.getCloneMode(source.constructor);
23037
+ for(var k in source){
23038
+ CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
23039
+ }
23040
+ if (source._cloneTo) {
23041
+ source._cloneTo(target, srcRoot, targetRoot);
23042
+ }
23043
+ };
23044
+ return ComponentCloner;
23045
+ }();
23046
+
23047
+ /**
23048
+ * The entity modify flags.
23049
+ */ var EntityModifyFlags = /*#__PURE__*/ function(EntityModifyFlags) {
23050
+ /** The parent changes. */ EntityModifyFlags[EntityModifyFlags["Parent"] = 1] = "Parent";
23051
+ /** The child changes. */ EntityModifyFlags[EntityModifyFlags["Child"] = 2] = "Child";
23052
+ return EntityModifyFlags;
23053
+ }({});
23054
+
23055
+ /**
23056
+ * Entity, be used as components container.
23057
+ */ var Entity = /*#__PURE__*/ function(EngineObject) {
23058
+ _inherits(Entity, EngineObject);
23059
+ function Entity(engine, name) {
23060
+ for(var _len = arguments.length, components = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
23061
+ components[_key - 2] = arguments[_key];
23062
+ }
23063
+ var _this;
23064
+ _this = EngineObject.call(this, engine) || this, /** The layer the entity belongs to. */ _this.layer = Layer.Layer0, /** @internal */ _this._isActiveInHierarchy = false, /** @internal */ _this._isActiveInScene = false, /** @internal */ _this._components = [], /** @internal */ _this._scripts = new DisorderedArray(), /** @internal */ _this._children = [], /** @internal */ _this._isRoot = false, /** @internal */ _this._isActive = true, /** @internal */ _this._siblingIndex = -1, /** @internal */ _this._isTemplate = false, /** @internal */ _this._updateFlagManager = new UpdateFlagManager(), _this._parent = null, //--------------------------------------------------------------deprecated----------------------------------------------------------------
23065
+ _this._invModelMatrix = new Matrix();
23066
+ _this.name = name != null ? name : "Entity";
23067
+ for(var i = 0, n = components.length; i < n; i++){
23068
+ _this.addComponent(components[i]);
23069
+ }
23070
+ !_this._transform && _this.addComponent(Transform);
23071
+ _this._inverseWorldMatFlag = _this.registerWorldChangeFlag();
23072
+ return _this;
23073
+ }
23074
+ var _proto = Entity.prototype;
23075
+ /**
23076
+ * Add component based on the component type.
23077
+ * @param type - The type of the component
23078
+ * @param args - The arguments of the component
23079
+ * @returns The component which has been added
23080
+ */ _proto.addComponent = function addComponent(type) {
23081
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
23082
+ args[_key - 1] = arguments[_key];
23083
+ }
23084
+ ComponentsDependencies._addCheck(this, type);
23085
+ var component = _construct(type, [].concat([
23086
+ this
23087
+ ], args));
23088
+ this._components.push(component);
23089
+ // @todo: temporary solution
23090
+ if (_instanceof(component, Transform)) this._setTransform(component);
23091
+ component._setActive(true, ActiveChangeFlag.All);
23092
+ return component;
23093
+ };
23094
+ /**
23095
+ * Get component which match the type.
23096
+ * @param type - The type of the component
23097
+ * @returns The first component which match type
23098
+ */ _proto.getComponent = function getComponent(type) {
23099
+ var components = this._components;
23100
+ for(var i = 0, n = components.length; i < n; i++){
23101
+ var component = components[i];
23102
+ if (_instanceof(component, type)) {
23103
+ return component;
23104
+ }
23105
+ }
23106
+ return null;
23107
+ };
23108
+ /**
23109
+ * Get components which match the type.
23110
+ * @param type - The type of the component
23111
+ * @param results - The components which match type
23112
+ * @returns The components which match type
23113
+ */ _proto.getComponents = function getComponents(type, results) {
23114
+ results.length = 0;
23115
+ var components = this._components;
23116
+ for(var i = 0, n = components.length; i < n; i++){
23117
+ var component = components[i];
23118
+ if (_instanceof(component, type)) {
23119
+ results.push(component);
23120
+ }
23121
+ }
23122
+ return results;
23123
+ };
23124
+ /**
23125
+ * Get the components which match the type of the entity and it's children.
23126
+ * @param type - The component type
23127
+ * @param results - The components collection
23128
+ * @returns The components collection which match the type
23129
+ */ _proto.getComponentsIncludeChildren = function getComponentsIncludeChildren(type, results) {
23130
+ results.length = 0;
23131
+ this._getComponentsInChildren(type, results);
23132
+ return results;
23133
+ };
23134
+ _proto.addChild = function addChild(indexOrChild, child) {
23135
+ var index;
23136
+ if (typeof indexOrChild === "number") {
23137
+ index = indexOrChild;
23138
+ } else {
23139
+ index = undefined;
23140
+ child = indexOrChild;
23141
+ }
23142
+ child._setParent(this, index);
23143
+ };
23144
+ /**
23145
+ * Remove child entity.
23146
+ * @param child - The child entity which want to be removed
23147
+ */ _proto.removeChild = function removeChild(child) {
23148
+ if (child._parent !== this) return;
23149
+ child._setParent(null);
23150
+ };
23151
+ /**
23152
+ * @deprecated Please use `children` property instead.
23153
+ * Find child entity by index.
23154
+ * @param index - The index of the child entity
23155
+ * @returns The component which be found
23156
+ */ _proto.getChild = function getChild(index) {
23157
+ return this._children[index];
23158
+ };
23159
+ /**
23160
+ * Find entity by name.
23161
+ * @param name - The name of the entity which want to be found
23162
+ * @returns The component which be found
23163
+ */ _proto.findByName = function findByName(name) {
23164
+ if (name === this.name) {
23165
+ return this;
23166
+ }
23167
+ var children = this._children;
23168
+ for(var i = 0, n = children.length; i < n; i++){
23169
+ var target = children[i].findByName(name);
23170
+ if (target) {
23171
+ return target;
23172
+ }
23173
+ }
23174
+ return null;
23175
+ };
23176
+ /**
23177
+ * Find the entity by path.
23178
+ * @param path - The path of the entity eg: /entity
23179
+ * @returns The component which be found
23180
+ */ _proto.findByPath = function findByPath(path) {
23181
+ var splits = path.split("/").filter(Boolean);
23182
+ if (!splits.length) {
23183
+ return this;
23184
+ }
23185
+ return Entity._findChildByName(this, 0, splits, 0);
23186
+ };
23187
+ /**
23188
+ * Create child entity.
23189
+ * @param name - The child entity's name
23190
+ * @returns The child entity
23191
+ */ _proto.createChild = function createChild(name) {
23192
+ var transform = this._transform;
23193
+ var child = transform ? new Entity(this.engine, name, transform.constructor) : new Entity(this.engine, name);
23194
+ child.layer = this.layer;
23195
+ child.parent = this;
23196
+ return child;
23197
+ };
23198
+ /**
23199
+ * Clear children entities.
23200
+ */ _proto.clearChildren = function clearChildren() {
23201
+ var children = this._children;
23202
+ for(var i = children.length - 1; i >= 0; i--){
23203
+ var child = children[i];
23204
+ child._parent = null;
23205
+ var activeChangeFlag = ActiveChangeFlag.None;
23206
+ child._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
23207
+ child._isActiveInScene && (activeChangeFlag |= ActiveChangeFlag.Scene);
23208
+ activeChangeFlag && child._processInActive(activeChangeFlag);
23209
+ Entity._traverseSetOwnerScene(child, null); // Must after child._processInActive().
23210
+ }
23211
+ children.length = 0;
23212
+ };
23213
+ /**
23214
+ * Clone this entity include children and components.
23215
+ * @returns Cloned entity
23216
+ */ _proto.clone = function clone() {
23217
+ var cloneEntity = this._createCloneEntity();
23218
+ this._parseCloneEntity(this, cloneEntity, this, cloneEntity, new Map());
23219
+ return cloneEntity;
23220
+ };
23221
+ /**
23222
+ * Listen for changes in the world pose of this `Entity`.
23223
+ * @returns Change flag
23224
+ */ _proto.registerWorldChangeFlag = function registerWorldChangeFlag() {
23225
+ return this._updateFlagManager.createFlag(BoolUpdateFlag);
23226
+ };
23227
+ /**
23228
+ * @internal
23229
+ */ _proto._markAsTemplate = function _markAsTemplate(templateResource) {
23230
+ this._isTemplate = true;
23231
+ this._templateResource = templateResource;
23232
+ };
23233
+ _proto._createCloneEntity = function _createCloneEntity() {
23234
+ var componentConstructors = Entity._tempComponentConstructors;
23235
+ var components = this._components;
23236
+ for(var i = 0, n = components.length; i < n; i++){
23237
+ componentConstructors[i] = components[i].constructor;
23238
+ }
23239
+ var cloneEntity = _construct(Entity, [].concat([
23240
+ this.engine,
23241
+ this.name
23242
+ ], componentConstructors));
23243
+ componentConstructors.length = 0;
23244
+ var templateResource = this._templateResource;
23245
+ if (templateResource) {
23246
+ cloneEntity._templateResource = templateResource;
23247
+ templateResource._addReferCount(1);
23248
+ }
23249
+ cloneEntity.layer = this.layer;
23250
+ cloneEntity._isActive = this._isActive;
23251
+ var srcChildren = this._children;
23252
+ for(var i1 = 0, n1 = srcChildren.length; i1 < n1; i1++){
23253
+ cloneEntity.addChild(srcChildren[i1]._createCloneEntity());
23254
+ }
23255
+ return cloneEntity;
23256
+ };
23257
+ _proto._parseCloneEntity = function _parseCloneEntity(src, target, srcRoot, targetRoot, deepInstanceMap) {
23258
+ var srcChildren = src._children;
23259
+ var targetChildren = target._children;
23260
+ for(var i = 0, n = srcChildren.length; i < n; i++){
23261
+ this._parseCloneEntity(srcChildren[i], targetChildren[i], srcRoot, targetRoot, deepInstanceMap);
23262
+ }
23263
+ var components = src._components;
23264
+ for(var i1 = 0, n1 = components.length; i1 < n1; i1++){
22554
23265
  ComponentCloner.cloneComponent(components[i1], target._components[i1], srcRoot, targetRoot, deepInstanceMap);
22555
23266
  }
22556
23267
  };
@@ -22817,843 +23528,152 @@ var ComponentCloner = /*#__PURE__*/ function() {
22817
23528
  };
22818
23529
  /**
22819
23530
  * @internal
22820
- */ Entity._traverseSetOwnerScene = function _traverseSetOwnerScene(entity, scene) {
22821
- entity._scene = scene;
22822
- var children = entity._children;
22823
- for(var i = children.length - 1; i >= 0; i--){
22824
- this._traverseSetOwnerScene(children[i], scene);
22825
- }
22826
- };
22827
- /**
22828
- * @internal
22829
- */ Entity._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
22830
- inversePath.length = 0;
22831
- while(searchEntity !== rootEntity){
22832
- var parent = searchEntity.parent;
22833
- if (!parent) {
22834
- return false;
22835
- }
22836
- inversePath.push(searchEntity.siblingIndex);
22837
- searchEntity = parent;
22838
- }
22839
- return true;
22840
- };
22841
- /**
22842
- * @internal
22843
- */ Entity._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
22844
- var entity = rootEntity;
22845
- for(var i = inversePath.length - 1; i >= 0; i--){
22846
- entity = entity.children[inversePath[i]];
22847
- }
22848
- return entity;
22849
- };
22850
- /**
22851
- * @internal
22852
- */ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
22853
- var count = children.length - 1;
22854
- for(var i = entity._siblingIndex; i < count; i++){
22855
- var child = children[i + 1];
22856
- children[i] = child;
22857
- child._siblingIndex = i;
22858
- }
22859
- children.length = count;
22860
- entity._siblingIndex = -1;
22861
- };
22862
- /**
22863
- * @internal
22864
- */ Entity._addToChildren = function _addToChildren(children, entity, index) {
22865
- var childCount = children.length;
22866
- children.length = childCount + 1;
22867
- if (index === undefined) {
22868
- children[childCount] = entity;
22869
- entity._siblingIndex = childCount;
22870
- } else {
22871
- if (index < 0 || index > childCount) {
22872
- throw "The index " + index + " is out of child list bounds " + childCount;
22873
- }
22874
- for(var i = childCount; i > index; i--){
22875
- var swapChild = children[i - 1];
22876
- swapChild._siblingIndex = i;
22877
- children[i] = swapChild;
22878
- }
22879
- entity._siblingIndex = index;
22880
- children[index] = entity;
22881
- }
22882
- };
22883
- _create_class(Entity, [
22884
- {
22885
- key: "transform",
22886
- get: /**
22887
- * The transform of this entity.
22888
- */ function get() {
22889
- return this._transform;
22890
- }
22891
- },
22892
- {
22893
- key: "isActive",
22894
- get: /**
22895
- * Whether to activate locally.
22896
- */ function get() {
22897
- return this._isActive;
22898
- },
22899
- set: function set(value) {
22900
- if (value !== this._isActive) {
22901
- this._isActive = value;
22902
- if (value) {
22903
- var parent = this._parent;
22904
- var activeChangeFlag = ActiveChangeFlag.None;
22905
- if (this._isRoot && this._scene._isActiveInEngine) {
22906
- activeChangeFlag |= ActiveChangeFlag.All;
22907
- } else {
22908
- (parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
22909
- (parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
22910
- }
22911
- activeChangeFlag && this._processActive(activeChangeFlag);
22912
- } else {
22913
- var activeChangeFlag1 = ActiveChangeFlag.None;
22914
- this._isActiveInHierarchy && (activeChangeFlag1 |= ActiveChangeFlag.Hierarchy);
22915
- this._isActiveInScene && (activeChangeFlag1 |= ActiveChangeFlag.Scene);
22916
- activeChangeFlag1 && this._processInActive(activeChangeFlag1);
22917
- }
22918
- }
22919
- }
22920
- },
22921
- {
22922
- key: "isActiveInHierarchy",
22923
- get: /**
22924
- * Whether it is active in the hierarchy.
22925
- */ function get() {
22926
- return this._isActiveInHierarchy;
22927
- }
22928
- },
22929
- {
22930
- key: "parent",
22931
- get: /**
22932
- * The parent entity.
22933
- */ function get() {
22934
- return this._parent;
22935
- },
22936
- set: function set(value) {
22937
- this._setParent(value);
22938
- }
22939
- },
22940
- {
22941
- key: "children",
22942
- get: /**
22943
- * The children entities
22944
- */ function get() {
22945
- return this._children;
22946
- }
22947
- },
22948
- {
22949
- key: "childCount",
22950
- get: /**
22951
- * @deprecated Please use `children.length` property instead.
22952
- * Number of the children entities
22953
- */ function get() {
22954
- return this._children.length;
22955
- }
22956
- },
22957
- {
22958
- key: "scene",
22959
- get: /**
22960
- * The scene the entity belongs to.
22961
- */ function get() {
22962
- return this._scene;
22963
- }
22964
- },
22965
- {
22966
- key: "siblingIndex",
22967
- get: /**
22968
- * The sibling index.
22969
- */ function get() {
22970
- return this._siblingIndex;
22971
- },
22972
- set: function set(value) {
22973
- if (this._siblingIndex === -1) {
22974
- throw "The entity " + this.name + " is not in the hierarchy";
22975
- }
22976
- if (this._isRoot) {
22977
- this._setSiblingIndex(this._scene._rootEntities, value);
22978
- } else {
22979
- var parent = this._parent;
22980
- this._setSiblingIndex(parent._children, value);
22981
- parent._dispatchModify(EntityModifyFlags.Child, parent);
22982
- }
22983
- }
22984
- }
22985
- ]);
22986
- return Entity;
22987
- }(EngineObject);
22988
- /** @internal */ Entity._tempComponentConstructors = [];
22989
-
22990
- /**
22991
- * Skin used for skinned mesh renderer.
22992
- */ var Skin = /*#__PURE__*/ function(EngineObject) {
22993
- _inherits(Skin, EngineObject);
22994
- function Skin(name) {
22995
- var _this;
22996
- _this = EngineObject.call(this, null) || this, _this.name = name, _this.inverseBindMatrices = new Array(), _this._updatedManager = new UpdateFlagManager(), _this._bones = new Array(), _this._updateMark = -1, _this.joints = [];
22997
- return _this;
22998
- }
22999
- var _proto = Skin.prototype;
23000
- /**
23001
- * @internal
23002
- */ _proto._updateSkinMatrices = function _updateSkinMatrices(renderer) {
23003
- if (this._updateMark === renderer.engine.time.frameCount) {
23004
- return;
23005
- }
23006
- var _this = this, bones = _this.bones, bindMatrices = _this.inverseBindMatrices, skinMatrices = _this._skinMatrices;
23007
- var _this_rootBone;
23008
- var worldToLocal = ((_this_rootBone = this.rootBone) != null ? _this_rootBone : renderer.entity).getInvModelMatrix();
23009
- for(var i = bones.length - 1; i >= 0; i--){
23010
- var bone = bones[i];
23011
- var offset = i * 16;
23012
- if (bone) {
23013
- Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, skinMatrices, offset);
23014
- } else {
23015
- skinMatrices.set(bindMatrices[i].elements, offset);
23016
- }
23017
- Utils._floatMatrixMultiply(worldToLocal, skinMatrices, offset, skinMatrices, offset);
23018
- }
23019
- this._updateMark = renderer.engine.time.frameCount;
23020
- };
23021
- /**
23022
- * @internal
23023
- */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
23024
- var paths = new Array();
23025
- // Clone rootBone
23026
- var rootBone = this.rootBone;
23027
- if (rootBone) {
23028
- var success = Entity._getEntityHierarchyPath(srcRoot, rootBone, paths);
23029
- target.rootBone = success ? Entity._getEntityByHierarchyPath(targetRoot, paths) : rootBone;
23030
- }
23031
- // Clone bones
23032
- var bones = this.bones;
23033
- if (bones.length > 0) {
23034
- var boneCount = bones.length;
23035
- var destBones = new Array(boneCount);
23036
- for(var i = 0; i < boneCount; i++){
23037
- var bone = bones[i];
23038
- var success1 = Entity._getEntityHierarchyPath(srcRoot, bone, paths);
23039
- destBones[i] = success1 ? Entity._getEntityByHierarchyPath(targetRoot, paths) : bone;
23040
- }
23041
- target.bones = destBones;
23042
- }
23043
- };
23044
- _create_class(Skin, [
23045
- {
23046
- key: "rootBone",
23047
- get: /**
23048
- * Root bone.
23049
- */ function get() {
23050
- return this._rootBone;
23051
- },
23052
- set: function set(value) {
23053
- if (this._rootBone !== value) {
23054
- this._updatedManager.dispatch(1, value);
23055
- this._rootBone = value;
23056
- }
23057
- }
23058
- },
23059
- {
23060
- key: "bones",
23061
- get: /**
23062
- * Bones of the skin.
23063
- */ function get() {
23064
- return this._bones;
23065
- },
23066
- set: function set(value) {
23067
- var bones = this._bones;
23068
- var _value_length;
23069
- var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
23070
- var lastBoneCount = bones.length;
23071
- bones.length = boneCount;
23072
- for(var i = 0; i < boneCount; i++){
23073
- bones[i] = value[i];
23074
- }
23075
- if (lastBoneCount !== boneCount) {
23076
- this._skinMatrices = new Float32Array(boneCount * 16);
23077
- this._updatedManager.dispatch(0, boneCount);
23078
- }
23079
- }
23080
- },
23081
- {
23082
- key: "skeleton",
23083
- get: /** @deprecated Please use `rootBone` instead. */ function get() {
23084
- var _this_rootBone;
23085
- return (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.name;
23086
- },
23087
- set: function set(value) {
23088
- var rootBone = this._rootBone;
23089
- if (rootBone) {
23090
- rootBone.name = value;
23091
- }
23092
- }
23093
- }
23094
- ]);
23095
- return Skin;
23096
- }(EngineObject);
23097
- __decorate([
23098
- deepClone
23099
- ], Skin.prototype, "inverseBindMatrices", void 0);
23100
- __decorate([
23101
- ignoreClone
23102
- ], Skin.prototype, "_skinMatrices", void 0);
23103
- __decorate([
23104
- ignoreClone
23105
- ], Skin.prototype, "_updatedManager", void 0);
23106
- __decorate([
23107
- ignoreClone
23108
- ], Skin.prototype, "_rootBone", void 0);
23109
- __decorate([
23110
- ignoreClone
23111
- ], Skin.prototype, "_bones", void 0);
23112
- __decorate([
23113
- ignoreClone
23114
- ], Skin.prototype, "_updateMark", void 0);
23115
- var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
23116
- SkinUpdateFlag[SkinUpdateFlag["BoneCountChanged"] = 0] = "BoneCountChanged";
23117
- SkinUpdateFlag[SkinUpdateFlag["RootBoneChanged"] = 1] = "RootBoneChanged";
23118
- return SkinUpdateFlag;
23119
- }({});
23120
-
23121
- /**
23122
- * SkinnedMeshRenderer.
23123
- */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
23124
- _inherits(SkinnedMeshRenderer, MeshRenderer);
23125
- function SkinnedMeshRenderer(entity) {
23126
- var _this;
23127
- _this = MeshRenderer.call(this, entity) || this, _this._localBounds = new BoundingBox(), _this._jointDataCreateCache = new Vector2(-1, -1);
23128
- _this._skin = null;
23129
- var rhi = _this.entity.engine._hardwareRenderer;
23130
- var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
23131
- // Limit size to 256 to avoid some problem:
23132
- // For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
23133
- // For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
23134
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
23135
- _this._maxVertexUniformVectors = maxVertexUniformVectors;
23136
- _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_this);
23137
- _this._onSkinUpdated = _this._onSkinUpdated.bind(_this);
23138
- var localBounds = _this._localBounds;
23139
- // @ts-ignore
23140
- localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
23141
- // @ts-ignore
23142
- localBounds.max._onValueChanged = _this._onLocalBoundsChanged;
23143
- return _this;
23144
- }
23145
- var _proto = SkinnedMeshRenderer.prototype;
23146
- /**
23147
- * @internal
23148
- */ _proto._onDestroy = function _onDestroy() {
23149
- var _this__jointTexture;
23150
- MeshRenderer.prototype._onDestroy.call(this);
23151
- this._jointDataCreateCache = null;
23152
- this._skin = null;
23153
- this._blendShapeWeights = null;
23154
- this._localBounds = null;
23155
- (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
23156
- this._jointTexture = null;
23157
- };
23158
- /**
23159
- * @internal
23160
- */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
23161
- MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
23162
- if (this.skin) {
23163
- target._applySkin(null, target.skin);
23164
- }
23165
- this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
23166
- };
23167
- _proto._update = function _update(context) {
23168
- var skin = this.skin;
23169
- if ((skin == null ? void 0 : skin.bones.length) > 0) {
23170
- skin._updateSkinMatrices(this);
23171
- }
23172
- var shaderData = this.shaderData;
23173
- var mesh = this.mesh;
23174
- var blendShapeManager = mesh._blendShapeManager;
23175
- blendShapeManager._updateShaderData(shaderData, this);
23176
- var bones = skin == null ? void 0 : skin.bones;
23177
- if (bones) {
23178
- var bsUniformOccupiesCount = blendShapeManager._uniformOccupiesCount;
23179
- var boneCount = bones.length;
23180
- var boneDataCreateCache = this._jointDataCreateCache;
23181
- var boneCountChange = boneCount !== boneDataCreateCache.x;
23182
- if (boneCountChange || bsUniformOccupiesCount !== boneDataCreateCache.y) {
23183
- // directly use max joint count to avoid shader recompile
23184
- var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
23185
- if (boneCount > remainUniformJointCount) {
23186
- var engine = this.engine;
23187
- if (engine._hardwareRenderer.canIUseMoreJoints) {
23188
- if (boneCountChange) {
23189
- var _this__jointTexture;
23190
- (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
23191
- this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
23192
- this._jointTexture.filterMode = TextureFilterMode.Point;
23193
- this._jointTexture.isGCIgnored = true;
23194
- }
23195
- shaderData.disableMacro("RENDERER_JOINTS_NUM");
23196
- shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
23197
- shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
23198
- } else {
23199
- Logger.error("component's joints count(" + boneCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
23200
- }
23201
- } else {
23202
- var _this__jointTexture1;
23203
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
23204
- shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
23205
- shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
23206
- shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, skin._skinMatrices);
23207
- }
23208
- boneDataCreateCache.set(boneCount, bsUniformOccupiesCount);
23209
- }
23210
- if (this._jointTexture) {
23211
- this._jointTexture.setPixelBuffer(skin._skinMatrices);
23212
- }
23213
- }
23214
- MeshRenderer.prototype._update.call(this, context);
23215
- };
23216
- /**
23217
- * @internal
23218
- */ _proto._updateBounds = function _updateBounds(worldBounds) {
23219
- var _this_skin;
23220
- var rootBone = (_this_skin = this.skin) == null ? void 0 : _this_skin.rootBone;
23221
- if (rootBone) {
23222
- BoundingBox.transform(this._localBounds, this._transformEntity.transform.worldMatrix, worldBounds);
23223
- } else {
23224
- MeshRenderer.prototype._updateBounds.call(this, worldBounds);
23225
- }
23226
- };
23227
- _proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
23228
- var mesh = this._mesh;
23229
- var newBlendShapeCount = mesh ? mesh.blendShapeCount : 0;
23230
- var lastBlendShapeWeights = this._blendShapeWeights;
23231
- if (lastBlendShapeWeights) {
23232
- var lastBlendShapeWeightsCount = lastBlendShapeWeights.length;
23233
- if (lastBlendShapeWeightsCount !== newBlendShapeCount) {
23234
- var newBlendShapeWeights = new Float32Array(newBlendShapeCount);
23235
- if (newBlendShapeCount > lastBlendShapeWeightsCount) {
23236
- newBlendShapeWeights.set(lastBlendShapeWeights);
23237
- } else {
23238
- for(var i = 0; i < newBlendShapeCount; i++){
23239
- newBlendShapeWeights[i] = lastBlendShapeWeights[i];
23240
- }
23241
- }
23242
- this._blendShapeWeights = newBlendShapeWeights;
23243
- }
23244
- } else {
23245
- this._blendShapeWeights = new Float32Array(newBlendShapeCount);
23246
- }
23247
- };
23248
- _proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
23249
- this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
23250
- };
23251
- _proto._onSkinUpdated = function _onSkinUpdated(type, value) {
23252
- switch(type){
23253
- case SkinUpdateFlag.BoneCountChanged:
23254
- var shaderData = this.shaderData;
23255
- if (value > 0) {
23256
- shaderData.enableMacro("RENDERER_HAS_SKIN");
23257
- shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, value);
23258
- } else {
23259
- shaderData.disableMacro("RENDERER_HAS_SKIN");
23260
- }
23261
- break;
23262
- case SkinUpdateFlag.RootBoneChanged:
23263
- this._setTransformEntity(value);
23264
- this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
23265
- break;
23531
+ */ Entity._traverseSetOwnerScene = function _traverseSetOwnerScene(entity, scene) {
23532
+ entity._scene = scene;
23533
+ var children = entity._children;
23534
+ for(var i = children.length - 1; i >= 0; i--){
23535
+ this._traverseSetOwnerScene(children[i], scene);
23266
23536
  }
23267
23537
  };
23268
- _proto._applySkin = function _applySkin(lastSkin, value) {
23269
- var _lastSkin_bones, _value_bones;
23270
- var _lastSkin_bones_length;
23271
- var lastSkinBoneCount = (_lastSkin_bones_length = lastSkin == null ? void 0 : (_lastSkin_bones = lastSkin.bones) == null ? void 0 : _lastSkin_bones.length) != null ? _lastSkin_bones_length : 0;
23272
- var _lastSkin_rootBone;
23273
- var lastRootBone = (_lastSkin_rootBone = lastSkin == null ? void 0 : lastSkin.rootBone) != null ? _lastSkin_rootBone : this.entity;
23274
- lastSkin == null ? void 0 : lastSkin._updatedManager.removeListener(this._onSkinUpdated);
23275
- var _value_bones_length;
23276
- var skinBoneCount = (_value_bones_length = value == null ? void 0 : (_value_bones = value.bones) == null ? void 0 : _value_bones.length) != null ? _value_bones_length : 0;
23277
- var _value_rootBone;
23278
- var rootBone = (_value_rootBone = value == null ? void 0 : value.rootBone) != null ? _value_rootBone : this.entity;
23279
- value == null ? void 0 : value._updatedManager.addListener(this._onSkinUpdated);
23280
- if (lastSkinBoneCount !== skinBoneCount) {
23281
- this._onSkinUpdated(SkinUpdateFlag.BoneCountChanged, skinBoneCount);
23538
+ /**
23539
+ * @internal
23540
+ */ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
23541
+ var count = children.length - 1;
23542
+ for(var i = entity._siblingIndex; i < count; i++){
23543
+ var child = children[i + 1];
23544
+ children[i] = child;
23545
+ child._siblingIndex = i;
23282
23546
  }
23283
- if (lastRootBone !== rootBone) {
23284
- this._onSkinUpdated(SkinUpdateFlag.RootBoneChanged, rootBone);
23547
+ children.length = count;
23548
+ entity._siblingIndex = -1;
23549
+ };
23550
+ /**
23551
+ * @internal
23552
+ */ Entity._addToChildren = function _addToChildren(children, entity, index) {
23553
+ var childCount = children.length;
23554
+ children.length = childCount + 1;
23555
+ if (index === undefined) {
23556
+ children[childCount] = entity;
23557
+ entity._siblingIndex = childCount;
23558
+ } else {
23559
+ if (index < 0 || index > childCount) {
23560
+ throw "The index " + index + " is out of child list bounds " + childCount;
23561
+ }
23562
+ for(var i = childCount; i > index; i--){
23563
+ var swapChild = children[i - 1];
23564
+ swapChild._siblingIndex = i;
23565
+ children[i] = swapChild;
23566
+ }
23567
+ entity._siblingIndex = index;
23568
+ children[index] = entity;
23285
23569
  }
23286
23570
  };
23287
- _create_class(SkinnedMeshRenderer, [
23571
+ _create_class(Entity, [
23288
23572
  {
23289
- key: "skin",
23573
+ key: "transform",
23290
23574
  get: /**
23291
- * Skin of the SkinnedMeshRenderer.
23575
+ * The transform of this entity.
23292
23576
  */ function get() {
23293
- return this._skin;
23294
- },
23295
- set: function set(value) {
23296
- var lastSkin = this._skin;
23297
- if (lastSkin !== value) {
23298
- this._applySkin(lastSkin, value);
23299
- this._skin = value;
23300
- }
23577
+ return this._transform;
23301
23578
  }
23302
23579
  },
23303
23580
  {
23304
- key: "blendShapeWeights",
23581
+ key: "isActive",
23305
23582
  get: /**
23306
- * The weights of the BlendShapes.
23307
- * @remarks Array index is BlendShape index.
23583
+ * Whether to activate locally.
23308
23584
  */ function get() {
23309
- this._checkBlendShapeWeightLength();
23310
- return this._blendShapeWeights;
23585
+ return this._isActive;
23311
23586
  },
23312
23587
  set: function set(value) {
23313
- this._checkBlendShapeWeightLength();
23314
- var blendShapeWeights = this._blendShapeWeights;
23315
- if (value.length <= blendShapeWeights.length) {
23316
- blendShapeWeights.set(value);
23317
- } else {
23318
- for(var i = 0, n = blendShapeWeights.length; i < n; i++){
23319
- blendShapeWeights[i] = value[i];
23588
+ if (value !== this._isActive) {
23589
+ this._isActive = value;
23590
+ if (value) {
23591
+ var parent = this._parent;
23592
+ var activeChangeFlag = ActiveChangeFlag.None;
23593
+ if (this._isRoot && this._scene._isActiveInEngine) {
23594
+ activeChangeFlag |= ActiveChangeFlag.All;
23595
+ } else {
23596
+ (parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
23597
+ (parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
23598
+ }
23599
+ activeChangeFlag && this._processActive(activeChangeFlag);
23600
+ } else {
23601
+ var activeChangeFlag1 = ActiveChangeFlag.None;
23602
+ this._isActiveInHierarchy && (activeChangeFlag1 |= ActiveChangeFlag.Hierarchy);
23603
+ this._isActiveInScene && (activeChangeFlag1 |= ActiveChangeFlag.Scene);
23604
+ activeChangeFlag1 && this._processInActive(activeChangeFlag1);
23320
23605
  }
23321
23606
  }
23322
23607
  }
23323
23608
  },
23324
23609
  {
23325
- key: "localBounds",
23610
+ key: "isActiveInHierarchy",
23326
23611
  get: /**
23327
- * Local bounds.
23612
+ * Whether it is active in the hierarchy.
23328
23613
  */ function get() {
23329
- return this._localBounds;
23330
- },
23331
- set: function set(value) {
23332
- if (this._localBounds !== value) {
23333
- this._localBounds.copyFrom(value);
23334
- }
23614
+ return this._isActiveInHierarchy;
23335
23615
  }
23336
23616
  },
23337
23617
  {
23338
- key: "rootBone",
23618
+ key: "parent",
23339
23619
  get: /**
23340
- * @deprecated use {@link SkinnedMeshRenderer.skin.rootBone} instead.
23620
+ * The parent entity.
23341
23621
  */ function get() {
23342
- return this.skin.rootBone;
23622
+ return this._parent;
23343
23623
  },
23344
23624
  set: function set(value) {
23345
- this.skin.rootBone = value;
23625
+ this._setParent(value);
23346
23626
  }
23347
23627
  },
23348
23628
  {
23349
- key: "bones",
23629
+ key: "children",
23350
23630
  get: /**
23351
- * @deprecated use {@link SkinnedMeshRenderer.skin.bones} instead.
23631
+ * The children entities
23352
23632
  */ function get() {
23353
- return this.skin.bones;
23354
- },
23355
- set: function set(value) {
23356
- this.skin.bones = value;
23357
- }
23358
- }
23359
- ]);
23360
- return SkinnedMeshRenderer;
23361
- }(MeshRenderer);
23362
- // @TODO: different shader type should use different count, not always 48
23363
- /** @internal */ SkinnedMeshRenderer._baseVertexUniformVectorCount = 48;
23364
- SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
23365
- SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
23366
- SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
23367
- __decorate([
23368
- ignoreClone
23369
- ], SkinnedMeshRenderer.prototype, "_condensedBlendShapeWeights", void 0);
23370
- __decorate([
23371
- deepClone
23372
- ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
23373
- __decorate([
23374
- ignoreClone
23375
- ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
23376
- __decorate([
23377
- ignoreClone
23378
- ], SkinnedMeshRenderer.prototype, "_blendShapeWeights", void 0);
23379
- __decorate([
23380
- ignoreClone
23381
- ], SkinnedMeshRenderer.prototype, "_maxVertexUniformVectors", void 0);
23382
- __decorate([
23383
- ignoreClone
23384
- ], SkinnedMeshRenderer.prototype, "_jointTexture", void 0);
23385
- __decorate([
23386
- deepClone
23387
- ], SkinnedMeshRenderer.prototype, "_skin", void 0);
23388
- __decorate([
23389
- ignoreClone
23390
- ], SkinnedMeshRenderer.prototype, "_onLocalBoundsChanged", null);
23391
- __decorate([
23392
- ignoreClone
23393
- ], SkinnedMeshRenderer.prototype, "_onSkinUpdated", null);
23394
-
23395
- /**
23396
- * @internal
23397
- */ var BasicResources = /*#__PURE__*/ function() {
23398
- function BasicResources(engine) {
23399
- this.engine = engine;
23400
- // prettier-ignore
23401
- var vertices = new Float32Array([
23402
- -1,
23403
- -1,
23404
- 0,
23405
- 1,
23406
- 3,
23407
- -1,
23408
- 2,
23409
- 1,
23410
- -1,
23411
- 3,
23412
- 0,
23413
- -1
23414
- ]); // left-top
23415
- // prettier-ignore
23416
- var flipYVertices = new Float32Array([
23417
- 3,
23418
- -1,
23419
- 2,
23420
- 0,
23421
- -1,
23422
- -1,
23423
- 0,
23424
- 0,
23425
- -1,
23426
- 3,
23427
- 0,
23428
- 2
23429
- ]); // left-top
23430
- var blitMaterial = new Material(engine, Shader.find("blit"));
23431
- blitMaterial._addReferCount(1);
23432
- blitMaterial.renderState.depthState.enabled = false;
23433
- blitMaterial.renderState.depthState.writeEnabled = false;
23434
- var blitScreenMaterial = new Material(engine, Shader.find("blit-screen"));
23435
- blitScreenMaterial._addReferCount(1);
23436
- blitScreenMaterial.renderState.depthState.enabled = false;
23437
- blitScreenMaterial.renderState.depthState.writeEnabled = false;
23438
- this.blitMaterial = blitMaterial;
23439
- this.blitScreenMaterial = blitScreenMaterial;
23440
- this.blitMesh = this._createBlitMesh(engine, vertices);
23441
- this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
23442
- // Create white and magenta textures
23443
- var whitePixel = new Uint8Array([
23444
- 255,
23445
- 255,
23446
- 255,
23447
- 255
23448
- ]);
23449
- this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
23450
- this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
23451
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
23452
- if (isWebGL2) {
23453
- this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
23454
- var whitePixel32 = new Uint32Array([
23455
- 255,
23456
- 255,
23457
- 255,
23458
- 255
23459
- ]);
23460
- this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
23461
- }
23462
- this.spriteDefaultMaterial = this._create2DMaterial(engine, Shader.find("Sprite"));
23463
- this.textDefaultMaterial = this._create2DMaterial(engine, Shader.find("Text"));
23464
- this.spriteMaskDefaultMaterial = this._createSpriteMaskMaterial(engine);
23465
- this.meshMagentaMaterial = this._createMagentaMaterial(engine, "unlit");
23466
- this.particleMagentaMaterial = this._createMagentaMaterial(engine, "particle-shader");
23467
- }
23468
- var _proto = BasicResources.prototype;
23469
- /**
23470
- * @internal
23471
- */ _proto._getBlinnPhongMaterial = function _getBlinnPhongMaterial() {
23472
- return this._blinnPhongMaterial || (this._blinnPhongMaterial = new BlinnPhongMaterial(this.engine));
23473
- };
23474
- /**
23475
- * @internal
23476
- */ _proto._initialize = function _initialize() {
23477
- var _this = this;
23478
- return new Promise(function(resolve, reject) {
23479
- PrefilteredDFG.create(_this.engine).then(function(texture) {
23480
- _this._prefilteredDFGTexture = texture;
23481
- resolve(_this);
23482
- }).catch(reject);
23483
- });
23484
- };
23485
- _proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
23486
- var mesh = new ModelMesh(engine);
23487
- mesh._addReferCount(1);
23488
- mesh.setVertexElements([
23489
- new VertexElement("POSITION_UV", 0, VertexElementFormat.Vector4, 0)
23490
- ]);
23491
- var buffer = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices, BufferUsage.Static, true);
23492
- mesh.setVertexBufferBinding(buffer, 16);
23493
- mesh.addSubMesh(0, 3, MeshTopology.Triangles);
23494
- engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
23495
- _inherits(_class, ContentRestorer);
23496
- function _class() {
23497
- return ContentRestorer.call(this, mesh) || this;
23498
- }
23499
- var _proto = _class.prototype;
23500
- _proto.restoreContent = function restoreContent() {
23501
- buffer.setData(buffer.data);
23502
- };
23503
- return _class;
23504
- }(ContentRestorer))());
23505
- return mesh;
23506
- };
23507
- _proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel, isSRGBColorSpace) {
23508
- var texture;
23509
- switch(type){
23510
- case 0:
23511
- var texture2D = new Texture2D(engine, 1, 1, format, false, isSRGBColorSpace);
23512
- texture2D.setPixelBuffer(pixel);
23513
- texture = texture2D;
23514
- break;
23515
- case 2:
23516
- var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false, isSRGBColorSpace);
23517
- texture2DArray.setPixelBuffer(0, pixel);
23518
- texture = texture2DArray;
23519
- break;
23520
- case 1:
23521
- var textureCube = new TextureCube(engine, 1, format, false, isSRGBColorSpace);
23522
- for(var i = 0; i < 6; i++){
23523
- textureCube.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
23524
- }
23525
- texture = textureCube;
23526
- break;
23527
- default:
23528
- throw "Invalid texture type";
23529
- }
23530
- texture.isGCIgnored = true;
23531
- engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
23532
- _inherits(_class, ContentRestorer);
23533
- function _class() {
23534
- return ContentRestorer.call(this, texture) || this;
23535
- }
23536
- var _proto = _class.prototype;
23537
- _proto.restoreContent = function restoreContent() {
23538
- switch(type){
23539
- case 0:
23540
- this.resource.setPixelBuffer(pixel);
23541
- break;
23542
- case 2:
23543
- this.resource.setPixelBuffer(0, pixel);
23544
- break;
23545
- case 1:
23546
- for(var i = 0; i < 6; i++){
23547
- this.resource.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
23548
- }
23549
- break;
23550
- }
23551
- };
23552
- return _class;
23553
- }(ContentRestorer))());
23554
- return texture;
23555
- };
23556
- _proto._create2DMaterial = function _create2DMaterial(engine, shader) {
23557
- var material = new Material(engine, shader);
23558
- var renderState = material.renderState;
23559
- var target = renderState.blendState.targetBlendState;
23560
- target.enabled = true;
23561
- target.sourceColorBlendFactor = BlendFactor.SourceAlpha;
23562
- target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
23563
- target.sourceAlphaBlendFactor = BlendFactor.One;
23564
- target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
23565
- target.colorBlendOperation = target.alphaBlendOperation = BlendOperation.Add;
23566
- renderState.depthState.writeEnabled = false;
23567
- renderState.rasterState.cullMode = CullMode.Off;
23568
- renderState.renderQueueType = RenderQueueType.Transparent;
23569
- material.isGCIgnored = true;
23570
- return material;
23571
- };
23572
- _proto._createMagentaMaterial = function _createMagentaMaterial(engine, shaderName) {
23573
- var material = new Material(engine, Shader.find(shaderName));
23574
- material.isGCIgnored = true;
23575
- material.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
23576
- return material;
23577
- };
23578
- _proto._createSpriteMaskMaterial = function _createSpriteMaskMaterial(engine) {
23579
- var material = new Material(engine, Shader.find("SpriteMask"));
23580
- material.isGCIgnored = true;
23581
- return material;
23582
- };
23583
- BasicResources.getMaskInteractionRenderStates = function getMaskInteractionRenderStates(maskInteraction) {
23584
- var visibleInsideMask = maskInteraction === SpriteMaskInteraction.VisibleInsideMask;
23585
- var renderStates;
23586
- var compareFunction;
23587
- if (visibleInsideMask) {
23588
- renderStates = BasicResources._maskReadInsideRenderStates;
23589
- if (renderStates) {
23590
- return renderStates;
23591
- }
23592
- BasicResources._maskReadInsideRenderStates = renderStates = {};
23593
- compareFunction = CompareFunction.LessEqual;
23594
- } else {
23595
- renderStates = BasicResources._maskReadOutsideRenderStates;
23596
- if (renderStates) {
23597
- return renderStates;
23633
+ return this._children;
23598
23634
  }
23599
- BasicResources._maskReadOutsideRenderStates = renderStates = {};
23600
- compareFunction = CompareFunction.Greater;
23601
- }
23602
- renderStates[RenderStateElementKey.StencilStateEnabled] = true;
23603
- renderStates[RenderStateElementKey.StencilStateWriteMask] = 0x00;
23604
- renderStates[RenderStateElementKey.StencilStateReferenceValue] = 1;
23605
- renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = compareFunction;
23606
- renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = compareFunction;
23607
- return renderStates;
23608
- };
23609
- BasicResources.getMaskTypeRenderStates = function getMaskTypeRenderStates(maskType) {
23610
- var isIncrement = maskType === RenderQueueMaskType.Increment;
23611
- var renderStates;
23612
- var passOperation;
23613
- if (isIncrement) {
23614
- renderStates = BasicResources._maskWriteIncrementRenderStates;
23615
- if (renderStates) {
23616
- return renderStates;
23635
+ },
23636
+ {
23637
+ key: "childCount",
23638
+ get: /**
23639
+ * @deprecated Please use `children.length` property instead.
23640
+ * Number of the children entities
23641
+ */ function get() {
23642
+ return this._children.length;
23617
23643
  }
23618
- BasicResources._maskWriteIncrementRenderStates = renderStates = {};
23619
- passOperation = StencilOperation.IncrementSaturate;
23620
- } else {
23621
- renderStates = BasicResources._maskWriteDecrementRenderStates;
23622
- if (renderStates) {
23623
- return renderStates;
23644
+ },
23645
+ {
23646
+ key: "scene",
23647
+ get: /**
23648
+ * The scene the entity belongs to.
23649
+ */ function get() {
23650
+ return this._scene;
23624
23651
  }
23625
- BasicResources._maskWriteDecrementRenderStates = renderStates = {};
23626
- passOperation = StencilOperation.DecrementSaturate;
23627
- }
23628
- renderStates[RenderStateElementKey.StencilStateEnabled] = true;
23629
- renderStates[RenderStateElementKey.StencilStatePassOperationFront] = passOperation;
23630
- renderStates[RenderStateElementKey.StencilStatePassOperationBack] = passOperation;
23631
- renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = CompareFunction.Always;
23632
- renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = CompareFunction.Always;
23633
- var failStencilOperation = StencilOperation.Keep;
23634
- renderStates[RenderStateElementKey.StencilStateFailOperationFront] = failStencilOperation;
23635
- renderStates[RenderStateElementKey.StencilStateFailOperationBack] = failStencilOperation;
23636
- renderStates[RenderStateElementKey.StencilStateZFailOperationFront] = failStencilOperation;
23637
- renderStates[RenderStateElementKey.StencilStateZFailOperationBack] = failStencilOperation;
23638
- renderStates[RenderStateElementKey.BlendStateColorWriteMask0] = ColorWriteMask.None;
23639
- renderStates[RenderStateElementKey.DepthStateEnabled] = false;
23640
- renderStates[RenderStateElementKey.RasterStateCullMode] = CullMode.Off;
23641
- return renderStates;
23642
- };
23643
- _create_class(BasicResources, [
23652
+ },
23644
23653
  {
23645
- key: "prefilteredDFGTexture",
23646
- get: function get() {
23647
- return this._prefilteredDFGTexture;
23654
+ key: "siblingIndex",
23655
+ get: /**
23656
+ * The sibling index.
23657
+ */ function get() {
23658
+ return this._siblingIndex;
23659
+ },
23660
+ set: function set(value) {
23661
+ if (this._siblingIndex === -1) {
23662
+ throw "The entity " + this.name + " is not in the hierarchy";
23663
+ }
23664
+ if (this._isRoot) {
23665
+ this._setSiblingIndex(this._scene._rootEntities, value);
23666
+ } else {
23667
+ var parent = this._parent;
23668
+ this._setSiblingIndex(parent._children, value);
23669
+ parent._dispatchModify(EntityModifyFlags.Child, parent);
23670
+ }
23648
23671
  }
23649
23672
  }
23650
23673
  ]);
23651
- return BasicResources;
23652
- }();
23653
- BasicResources._maskReadInsideRenderStates = null;
23654
- BasicResources._maskReadOutsideRenderStates = null;
23655
- BasicResources._maskWriteIncrementRenderStates = null;
23656
- BasicResources._maskWriteDecrementRenderStates = null;
23674
+ return Entity;
23675
+ }(EngineObject);
23676
+ /** @internal */ Entity._tempComponentConstructors = [];
23657
23677
 
23658
23678
  var ObjectPool = /*#__PURE__*/ function() {
23659
23679
  function ObjectPool(type) {
@@ -24149,6 +24169,7 @@ PrimitiveChunk.subMeshPool = new ReturnableObjectPool(SubMesh, 10);
24149
24169
  /** AudioClip, include ogg, wav and mp3. */ AssetType["Audio"] = "Audio";
24150
24170
  /** Project asset. */ AssetType["Project"] = "project";
24151
24171
  /** PhysicsMaterial. */ AssetType["PhysicsMaterial"] = "PhysicsMaterial";
24172
+ /** RenderTarget. */ AssetType["RenderTarget"] = "RenderTarget";
24152
24173
  return AssetType;
24153
24174
  }({});
24154
24175
 
@@ -29017,6 +29038,184 @@ var PointerMethods = /*#__PURE__*/ function(PointerMethods) {
29017
29038
  return PointerMethods;
29018
29039
  }({});
29019
29040
 
29041
+ /**
29042
+ * Signal is a typed event mechanism for Galacean Engine.
29043
+ * @typeParam T - Tuple type of the signal arguments
29044
+ */ var Signal = /*#__PURE__*/ function() {
29045
+ function Signal() {
29046
+ this._listeners = new SafeLoopArray();
29047
+ }
29048
+ var _proto = Signal.prototype;
29049
+ _proto.on = function on(fnOrTarget, targetOrMethodName) {
29050
+ for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
29051
+ args[_key - 2] = arguments[_key];
29052
+ }
29053
+ this._addListener.apply(this, [].concat([
29054
+ fnOrTarget,
29055
+ targetOrMethodName,
29056
+ false
29057
+ ], args));
29058
+ };
29059
+ _proto.once = function once(fnOrTarget, targetOrMethodName) {
29060
+ for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
29061
+ args[_key - 2] = arguments[_key];
29062
+ }
29063
+ this._addListener.apply(this, [].concat([
29064
+ fnOrTarget,
29065
+ targetOrMethodName,
29066
+ true
29067
+ ], args));
29068
+ };
29069
+ _proto.off = function off(fnOrTarget, targetOrMethodName) {
29070
+ if (typeof fnOrTarget === "function") {
29071
+ var target = targetOrMethodName != null ? targetOrMethodName : null;
29072
+ this._listeners.findAndRemove(function(listener) {
29073
+ if (listener.fn === fnOrTarget && listener.target === target) {
29074
+ listener.destroyed = true;
29075
+ return true;
29076
+ }
29077
+ return false;
29078
+ });
29079
+ } else {
29080
+ var target1 = fnOrTarget;
29081
+ var methodName = targetOrMethodName;
29082
+ this._listeners.findAndRemove(function(listener) {
29083
+ if (listener.target === target1 && listener.methodName === methodName) {
29084
+ listener.destroyed = true;
29085
+ return true;
29086
+ }
29087
+ return false;
29088
+ });
29089
+ }
29090
+ };
29091
+ /**
29092
+ * Remove all listeners, or all listeners for a specific target.
29093
+ * @param target - If provided, only remove listeners bound to this target
29094
+ */ _proto.removeAll = function removeAll(target) {
29095
+ if (target !== undefined) {
29096
+ this._listeners.findAndRemove(function(listener) {
29097
+ if (listener.target === target) {
29098
+ return listener.destroyed = true;
29099
+ }
29100
+ return false;
29101
+ });
29102
+ } else {
29103
+ this._listeners.findAndRemove(function(listener) {
29104
+ return listener.destroyed = true;
29105
+ });
29106
+ }
29107
+ };
29108
+ /**
29109
+ * Invoke the signal, calling all listeners in order.
29110
+ * @param args - Arguments to pass to each listener
29111
+ */ _proto.invoke = function invoke() {
29112
+ var _this, _loop = function(i, n) {
29113
+ var listener = listeners[i];
29114
+ if (listener.destroyed) return "continue";
29115
+ if (listener.methodName && listener.target.destroyed) {
29116
+ listener.destroyed = true;
29117
+ _this._listeners.findAndRemove(function(l) {
29118
+ return l === listener;
29119
+ });
29120
+ return "continue";
29121
+ }
29122
+ listener.fn.apply(listener.target, args);
29123
+ if (listener.once) {
29124
+ listener.destroyed = true;
29125
+ _this._listeners.findAndRemove(function(l) {
29126
+ return l === listener;
29127
+ });
29128
+ }
29129
+ };
29130
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
29131
+ args[_key] = arguments[_key];
29132
+ }
29133
+ var listeners = this._listeners.getLoopArray();
29134
+ for(var i = 0, n = listeners.length; i < n; i++)_this = this, _loop(i);
29135
+ };
29136
+ /**
29137
+ * @internal
29138
+ * Clone listeners to target signal, remapping entity/component references.
29139
+ */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
29140
+ var listeners = this._listeners.getLoopArray();
29141
+ for(var i = 0, n = listeners.length; i < n; i++){
29142
+ var listener = listeners[i];
29143
+ if (listener.destroyed || !listener.methodName) continue;
29144
+ var clonedTarget = CloneUtils.remapComponent(srcRoot, targetRoot, listener.target);
29145
+ if (clonedTarget) {
29146
+ var clonedArgs = this._cloneArguments(listener.arguments, srcRoot, targetRoot);
29147
+ if (listener.once) {
29148
+ var _target;
29149
+ (_target = target).once.apply(_target, [].concat([
29150
+ clonedTarget,
29151
+ listener.methodName
29152
+ ], clonedArgs));
29153
+ } else {
29154
+ var _target1;
29155
+ (_target1 = target).on.apply(_target1, [].concat([
29156
+ clonedTarget,
29157
+ listener.methodName
29158
+ ], clonedArgs));
29159
+ }
29160
+ }
29161
+ }
29162
+ };
29163
+ _proto._cloneArguments = function _cloneArguments(args, srcRoot, targetRoot) {
29164
+ if (!args || args.length === 0) return [];
29165
+ var len = args.length;
29166
+ var clonedArgs = new Array(len);
29167
+ for(var i = 0; i < len; i++){
29168
+ var arg = args[i];
29169
+ if (_instanceof(arg, Entity)) {
29170
+ clonedArgs[i] = CloneUtils.remapEntity(srcRoot, targetRoot, arg);
29171
+ } else if (_instanceof(arg, Component)) {
29172
+ clonedArgs[i] = CloneUtils.remapComponent(srcRoot, targetRoot, arg);
29173
+ } else {
29174
+ clonedArgs[i] = arg;
29175
+ }
29176
+ }
29177
+ return clonedArgs;
29178
+ };
29179
+ _proto._addListener = function _addListener(fnOrTarget, targetOrMethodName, once) {
29180
+ for(var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++){
29181
+ args[_key - 3] = arguments[_key];
29182
+ }
29183
+ if (typeof fnOrTarget === "function") {
29184
+ this._listeners.push({
29185
+ fn: fnOrTarget,
29186
+ target: targetOrMethodName != null ? targetOrMethodName : null,
29187
+ once: once
29188
+ });
29189
+ } else {
29190
+ var _target, _target1;
29191
+ var target = fnOrTarget;
29192
+ var methodName = targetOrMethodName;
29193
+ var fn = args.length > 0 ? function() {
29194
+ for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
29195
+ signalArgs[_key] = arguments[_key];
29196
+ }
29197
+ return (_target = target)[methodName].apply(_target, [].concat(args, signalArgs));
29198
+ } : function() {
29199
+ for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
29200
+ signalArgs[_key] = arguments[_key];
29201
+ }
29202
+ return (_target1 = target)[methodName].apply(_target1, [].concat(signalArgs));
29203
+ };
29204
+ this._listeners.push({
29205
+ fn: fn,
29206
+ target: target,
29207
+ once: once,
29208
+ methodName: methodName,
29209
+ arguments: args
29210
+ });
29211
+ }
29212
+ };
29213
+ return Signal;
29214
+ }();
29215
+ __decorate([
29216
+ ignoreClone
29217
+ ], Signal.prototype, "_listeners", void 0);
29218
+
29020
29219
  /**
29021
29220
  * Loader abstract class.
29022
29221
  */ var Loader = /*#__PURE__*/ function() {
@@ -38328,5 +38527,5 @@ __decorate([
38328
38527
 
38329
38528
  Polyfill.registerPolyfill();
38330
38529
 
38331
- export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
38530
+ export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, CloneUtils, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Signal, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
38332
38531
  //# sourceMappingURL=module.js.map