@galacean/engine 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/browser.js CHANGED
@@ -988,11 +988,15 @@
988
988
  var normal = plane.normal;
989
989
  var zeroTolerance = MathUtil.zeroTolerance;
990
990
  var dir = Vector3.dot(normal, ray.direction);
991
+ var position = Vector3.dot(normal, ray.origin);
991
992
  // Parallel
992
993
  if (Math.abs(dir) < zeroTolerance) {
994
+ // Check if ray origin is on the plane
995
+ if (Math.abs(position + plane.distance) < zeroTolerance) {
996
+ return 0;
997
+ }
993
998
  return -1;
994
999
  }
995
- var position = Vector3.dot(normal, ray.origin);
996
1000
  var distance = (-plane.distance - position) / dir;
997
1001
  if (distance < 0) {
998
1002
  if (distance < -zeroTolerance) {
@@ -6735,6 +6739,14 @@
6735
6739
  return this._height;
6736
6740
  }
6737
6741
  },
6742
+ {
6743
+ key: "colorTextures",
6744
+ get: /**
6745
+ * Render color textures.
6746
+ */ function get() {
6747
+ return this._colorTextures;
6748
+ }
6749
+ },
6738
6750
  {
6739
6751
  key: "colorTextureCount",
6740
6752
  get: /**
@@ -27088,274 +27100,973 @@
27088
27100
  ]);
27089
27101
  PrimitiveMesh._sphereEdgeIdx = 0;
27090
27102
  PrimitiveMesh._spherePoleIdx = 0;
27091
- function _is_native_reflect_construct$1() {
27092
- // Since Reflect.construct can't be properly polyfilled, some
27093
- // implementations (e.g. core-js@2) don't set the correct internal slots.
27094
- // Those polyfills don't allow us to subclass built-ins, so we need to
27095
- // use our fallback implementation.
27096
- try {
27097
- // If the internal slots aren't set, this throws an error similar to
27098
- // TypeError: this is not a Boolean object.
27099
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
27100
- } catch (_) {}
27101
- return (_is_native_reflect_construct$1 = function _is_native_reflect_construct() {
27102
- return !!result;
27103
- })();
27104
- }
27105
- function _construct$1(Parent, args, Class) {
27106
- if (_is_native_reflect_construct$1()) _construct$1 = Reflect.construct;
27107
- else {
27108
- _construct$1 = function construct(Parent, args, Class) {
27109
- var a = [
27110
- null
27111
- ];
27112
- a.push.apply(a, args);
27113
- var Constructor = Function.bind.apply(Parent, a);
27114
- var instance = new Constructor();
27115
- if (Class) _set_prototype_of$2(instance, Class.prototype);
27116
- return instance;
27117
- };
27118
- }
27119
- return _construct$1.apply(null, arguments);
27120
- }
27121
- var ComponentCloner = /*#__PURE__*/ function() {
27122
- function ComponentCloner() {}
27123
- /**
27124
- * Clone component.
27125
- * @param source - Clone source
27126
- * @param target - Clone target
27127
- */ ComponentCloner.cloneComponent = function cloneComponent(source, target, srcRoot, targetRoot, deepInstanceMap) {
27128
- var cloneModes = CloneManager.getCloneMode(source.constructor);
27129
- for(var k in source){
27130
- CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
27103
+ /**
27104
+ * @internal
27105
+ * Utility functions for remapping Entity/Component references during cloning.
27106
+ */ var CloneUtils = /*#__PURE__*/ function() {
27107
+ function CloneUtils() {}
27108
+ CloneUtils.remapEntity = function remapEntity(srcRoot, targetRoot, entity) {
27109
+ var paths = CloneUtils._tempRemapPath;
27110
+ var success = CloneUtils._getEntityHierarchyPath(srcRoot, entity, paths);
27111
+ return success ? CloneUtils._getEntityByHierarchyPath(targetRoot, paths) : entity;
27112
+ };
27113
+ CloneUtils.remapComponent = function remapComponent(srcRoot, targetRoot, component) {
27114
+ var _CloneUtils__getEntityByHierarchyPath;
27115
+ var paths = CloneUtils._tempRemapPath;
27116
+ var success = CloneUtils._getEntityHierarchyPath(srcRoot, component.entity, paths);
27117
+ return success ? (_CloneUtils__getEntityByHierarchyPath = CloneUtils._getEntityByHierarchyPath(targetRoot, paths)) == null ? void 0 : _CloneUtils__getEntityByHierarchyPath.getComponent(component.constructor) : component;
27118
+ };
27119
+ CloneUtils._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
27120
+ inversePath.length = 0;
27121
+ while(searchEntity !== rootEntity){
27122
+ var parent = searchEntity.parent;
27123
+ if (!parent) {
27124
+ return false;
27125
+ }
27126
+ inversePath.push(searchEntity.siblingIndex);
27127
+ searchEntity = parent;
27131
27128
  }
27132
- if (source._cloneTo) {
27133
- source._cloneTo(target, srcRoot, targetRoot);
27129
+ return true;
27130
+ };
27131
+ CloneUtils._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
27132
+ var entity = rootEntity;
27133
+ for(var i = inversePath.length - 1; i >= 0; i--){
27134
+ entity = entity.children[inversePath[i]];
27134
27135
  }
27136
+ return entity;
27135
27137
  };
27136
- return ComponentCloner;
27138
+ return CloneUtils;
27137
27139
  }();
27140
+ CloneUtils._tempRemapPath = [];
27138
27141
  /**
27139
- * The entity modify flags.
27140
- */ var EntityModifyFlags = /*#__PURE__*/ function(EntityModifyFlags) {
27141
- /** The parent changes. */ EntityModifyFlags[EntityModifyFlags["Parent"] = 1] = "Parent";
27142
- /** The child changes. */ EntityModifyFlags[EntityModifyFlags["Child"] = 2] = "Child";
27143
- return EntityModifyFlags;
27144
- }({});
27145
- /**
27146
- * Entity, be used as components container.
27147
- */ var Entity = /*#__PURE__*/ function(EngineObject) {
27148
- _inherits$2(Entity, EngineObject);
27149
- function Entity(engine, name) {
27150
- for(var _len = arguments.length, components = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
27151
- components[_key - 2] = arguments[_key];
27152
- }
27142
+ * Skin used for skinned mesh renderer.
27143
+ */ var Skin = /*#__PURE__*/ function(EngineObject) {
27144
+ _inherits$2(Skin, EngineObject);
27145
+ function Skin(name) {
27153
27146
  var _this;
27154
- _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, _this._invModelMatrix = new Matrix();
27155
- _this.name = name != null ? name : "Entity";
27156
- for(var i = 0, n = components.length; i < n; i++){
27157
- _this.addComponent(components[i]);
27158
- }
27159
- !_this._transform && _this.addComponent(Transform);
27160
- _this._inverseWorldMatFlag = _this.registerWorldChangeFlag();
27147
+ _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 = [];
27161
27148
  return _this;
27162
27149
  }
27163
- var _proto = Entity.prototype;
27150
+ var _proto = Skin.prototype;
27164
27151
  /**
27165
- * Add component based on the component type.
27166
- * @param type - The type of the component
27167
- * @param args - The arguments of the component
27168
- * @returns The component which has been added
27169
- */ _proto.addComponent = function addComponent(type) {
27170
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
27171
- args[_key - 1] = arguments[_key];
27152
+ * @internal
27153
+ */ _proto._updateSkinMatrices = function _updateSkinMatrices(renderer) {
27154
+ if (this._updateMark === renderer.engine.time.frameCount) {
27155
+ return;
27172
27156
  }
27173
- ComponentsDependencies._addCheck(this, type);
27174
- var component = _construct$1(type, [].concat([
27175
- this
27176
- ], args));
27177
- this._components.push(component);
27178
- // @todo: temporary solution
27179
- if (_instanceof1$2(component, Transform)) this._setTransform(component);
27180
- component._setActive(true, ActiveChangeFlag.All);
27181
- return component;
27182
- };
27183
- /**
27184
- * Get component which match the type.
27185
- * @param type - The type of the component
27186
- * @returns The first component which match type
27187
- */ _proto.getComponent = function getComponent(type) {
27188
- var components = this._components;
27189
- for(var i = 0, n = components.length; i < n; i++){
27190
- var component = components[i];
27191
- if (_instanceof1$2(component, type)) {
27192
- return component;
27157
+ var _this = this, bones = _this.bones, bindMatrices = _this.inverseBindMatrices, skinMatrices = _this._skinMatrices;
27158
+ var _this_rootBone;
27159
+ var worldToLocal = ((_this_rootBone = this.rootBone) != null ? _this_rootBone : renderer.entity).getInvModelMatrix();
27160
+ for(var i = bones.length - 1; i >= 0; i--){
27161
+ var bone = bones[i];
27162
+ var offset = i * 16;
27163
+ if (bone) {
27164
+ Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, skinMatrices, offset);
27165
+ } else {
27166
+ skinMatrices.set(bindMatrices[i].elements, offset);
27193
27167
  }
27168
+ Utils._floatMatrixMultiply(worldToLocal, skinMatrices, offset, skinMatrices, offset);
27194
27169
  }
27195
- return null;
27170
+ this._updateMark = renderer.engine.time.frameCount;
27196
27171
  };
27197
27172
  /**
27198
- * Get components which match the type.
27199
- * @param type - The type of the component
27200
- * @param results - The components which match type
27201
- * @returns The components which match type
27202
- */ _proto.getComponents = function getComponents(type, results) {
27203
- results.length = 0;
27204
- var components = this._components;
27205
- for(var i = 0, n = components.length; i < n; i++){
27206
- var component = components[i];
27207
- if (_instanceof1$2(component, type)) {
27208
- results.push(component);
27173
+ * @internal
27174
+ */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
27175
+ // Clone rootBone
27176
+ var rootBone = this.rootBone;
27177
+ if (rootBone) {
27178
+ target.rootBone = CloneUtils.remapEntity(srcRoot, targetRoot, rootBone);
27179
+ }
27180
+ // Clone bones
27181
+ var bones = this.bones;
27182
+ if (bones.length > 0) {
27183
+ var boneCount = bones.length;
27184
+ var destBones = new Array(boneCount);
27185
+ for(var i = 0; i < boneCount; i++){
27186
+ destBones[i] = CloneUtils.remapEntity(srcRoot, targetRoot, bones[i]);
27209
27187
  }
27188
+ target.bones = destBones;
27210
27189
  }
27211
- return results;
27212
- };
27213
- /**
27214
- * Get the components which match the type of the entity and it's children.
27215
- * @param type - The component type
27216
- * @param results - The components collection
27217
- * @returns The components collection which match the type
27218
- */ _proto.getComponentsIncludeChildren = function getComponentsIncludeChildren(type, results) {
27219
- results.length = 0;
27220
- this._getComponentsInChildren(type, results);
27221
- return results;
27222
27190
  };
27223
- _proto.addChild = function addChild(indexOrChild, child) {
27224
- var index;
27225
- if (typeof indexOrChild === "number") {
27226
- index = indexOrChild;
27227
- } else {
27228
- index = undefined;
27229
- child = indexOrChild;
27191
+ _create_class$2(Skin, [
27192
+ {
27193
+ key: "rootBone",
27194
+ get: /**
27195
+ * Root bone.
27196
+ */ function get() {
27197
+ return this._rootBone;
27198
+ },
27199
+ set: function set(value) {
27200
+ if (this._rootBone !== value) {
27201
+ this._updatedManager.dispatch(1, value);
27202
+ this._rootBone = value;
27203
+ }
27204
+ }
27205
+ },
27206
+ {
27207
+ key: "bones",
27208
+ get: /**
27209
+ * Bones of the skin.
27210
+ */ function get() {
27211
+ return this._bones;
27212
+ },
27213
+ set: function set(value) {
27214
+ var bones = this._bones;
27215
+ var _value_length;
27216
+ var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
27217
+ var lastBoneCount = bones.length;
27218
+ bones.length = boneCount;
27219
+ for(var i = 0; i < boneCount; i++){
27220
+ bones[i] = value[i];
27221
+ }
27222
+ if (lastBoneCount !== boneCount) {
27223
+ this._skinMatrices = new Float32Array(boneCount * 16);
27224
+ this._updatedManager.dispatch(0, boneCount);
27225
+ }
27226
+ }
27227
+ },
27228
+ {
27229
+ key: "skeleton",
27230
+ get: /** @deprecated Please use `rootBone` instead. */ function get() {
27231
+ var _this_rootBone;
27232
+ return (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.name;
27233
+ },
27234
+ set: function set(value) {
27235
+ var rootBone = this._rootBone;
27236
+ if (rootBone) {
27237
+ rootBone.name = value;
27238
+ }
27239
+ }
27230
27240
  }
27231
- child._setParent(this, index);
27232
- };
27241
+ ]);
27242
+ return Skin;
27243
+ }(EngineObject);
27244
+ __decorate$1([
27245
+ deepClone
27246
+ ], Skin.prototype, "inverseBindMatrices", void 0);
27247
+ __decorate$1([
27248
+ ignoreClone
27249
+ ], Skin.prototype, "_skinMatrices", void 0);
27250
+ __decorate$1([
27251
+ ignoreClone
27252
+ ], Skin.prototype, "_updatedManager", void 0);
27253
+ __decorate$1([
27254
+ ignoreClone
27255
+ ], Skin.prototype, "_rootBone", void 0);
27256
+ __decorate$1([
27257
+ ignoreClone
27258
+ ], Skin.prototype, "_bones", void 0);
27259
+ __decorate$1([
27260
+ ignoreClone
27261
+ ], Skin.prototype, "_updateMark", void 0);
27262
+ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
27263
+ SkinUpdateFlag[SkinUpdateFlag["BoneCountChanged"] = 0] = "BoneCountChanged";
27264
+ SkinUpdateFlag[SkinUpdateFlag["RootBoneChanged"] = 1] = "RootBoneChanged";
27265
+ return SkinUpdateFlag;
27266
+ }({});
27267
+ /**
27268
+ * SkinnedMeshRenderer.
27269
+ */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
27270
+ _inherits$2(SkinnedMeshRenderer, MeshRenderer);
27271
+ function SkinnedMeshRenderer(entity) {
27272
+ var _this;
27273
+ _this = MeshRenderer.call(this, entity) || this, _this._localBounds = new BoundingBox(), _this._jointDataCreateCache = new Vector2(-1, -1);
27274
+ _this._skin = null;
27275
+ var rhi = _this.entity.engine._hardwareRenderer;
27276
+ var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
27277
+ // Limit size to 256 to avoid some problem:
27278
+ // 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!
27279
+ // 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.
27280
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
27281
+ _this._maxVertexUniformVectors = maxVertexUniformVectors;
27282
+ _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_this);
27283
+ _this._onSkinUpdated = _this._onSkinUpdated.bind(_this);
27284
+ var localBounds = _this._localBounds;
27285
+ // @ts-ignore
27286
+ localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
27287
+ // @ts-ignore
27288
+ localBounds.max._onValueChanged = _this._onLocalBoundsChanged;
27289
+ return _this;
27290
+ }
27291
+ var _proto = SkinnedMeshRenderer.prototype;
27233
27292
  /**
27234
- * Remove child entity.
27235
- * @param child - The child entity which want to be removed
27236
- */ _proto.removeChild = function removeChild(child) {
27237
- if (child._parent !== this) return;
27238
- child._setParent(null);
27293
+ * @internal
27294
+ */ _proto._onDestroy = function _onDestroy() {
27295
+ var _this__jointTexture;
27296
+ MeshRenderer.prototype._onDestroy.call(this);
27297
+ this._jointDataCreateCache = null;
27298
+ this._skin = null;
27299
+ this._blendShapeWeights = null;
27300
+ this._localBounds = null;
27301
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
27302
+ this._jointTexture = null;
27239
27303
  };
27240
27304
  /**
27241
- * @deprecated Please use `children` property instead.
27242
- * Find child entity by index.
27243
- * @param index - The index of the child entity
27244
- * @returns The component which be found
27245
- */ _proto.getChild = function getChild(index) {
27246
- return this._children[index];
27305
+ * @internal
27306
+ */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
27307
+ MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
27308
+ if (this.skin) {
27309
+ target._applySkin(null, target.skin);
27310
+ }
27311
+ this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
27247
27312
  };
27248
- /**
27249
- * Find entity by name.
27250
- * @param name - The name of the entity which want to be found
27251
- * @returns The component which be found
27252
- */ _proto.findByName = function findByName(name) {
27253
- if (name === this.name) {
27254
- return this;
27313
+ _proto._update = function _update(context) {
27314
+ var skin = this.skin;
27315
+ if ((skin == null ? void 0 : skin.bones.length) > 0) {
27316
+ skin._updateSkinMatrices(this);
27255
27317
  }
27256
- var children = this._children;
27257
- for(var i = 0, n = children.length; i < n; i++){
27258
- var target = children[i].findByName(name);
27259
- if (target) {
27260
- return target;
27318
+ var shaderData = this.shaderData;
27319
+ var mesh = this.mesh;
27320
+ var blendShapeManager = mesh._blendShapeManager;
27321
+ blendShapeManager._updateShaderData(shaderData, this);
27322
+ var bones = skin == null ? void 0 : skin.bones;
27323
+ if (bones) {
27324
+ var bsUniformOccupiesCount = blendShapeManager._uniformOccupiesCount;
27325
+ var boneCount = bones.length;
27326
+ var boneDataCreateCache = this._jointDataCreateCache;
27327
+ var boneCountChange = boneCount !== boneDataCreateCache.x;
27328
+ if (boneCountChange || bsUniformOccupiesCount !== boneDataCreateCache.y) {
27329
+ // directly use max joint count to avoid shader recompile
27330
+ var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
27331
+ if (boneCount > remainUniformJointCount) {
27332
+ var engine = this.engine;
27333
+ if (engine._hardwareRenderer.canIUseMoreJoints) {
27334
+ if (boneCountChange) {
27335
+ var _this__jointTexture;
27336
+ (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
27337
+ this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
27338
+ this._jointTexture.filterMode = TextureFilterMode.Point;
27339
+ this._jointTexture.isGCIgnored = true;
27340
+ }
27341
+ shaderData.disableMacro("RENDERER_JOINTS_NUM");
27342
+ shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
27343
+ shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
27344
+ } else {
27345
+ 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);
27346
+ }
27347
+ } else {
27348
+ var _this__jointTexture1;
27349
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
27350
+ shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
27351
+ shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
27352
+ shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, skin._skinMatrices);
27353
+ }
27354
+ boneDataCreateCache.set(boneCount, bsUniformOccupiesCount);
27355
+ }
27356
+ if (this._jointTexture) {
27357
+ this._jointTexture.setPixelBuffer(skin._skinMatrices);
27261
27358
  }
27262
27359
  }
27263
- return null;
27360
+ MeshRenderer.prototype._update.call(this, context);
27264
27361
  };
27265
27362
  /**
27266
- * Find the entity by path.
27267
- * @param path - The path of the entity eg: /entity
27268
- * @returns The component which be found
27269
- */ _proto.findByPath = function findByPath(path) {
27270
- var splits = path.split("/").filter(Boolean);
27271
- if (!splits.length) {
27272
- return this;
27363
+ * @internal
27364
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
27365
+ var _this_skin;
27366
+ var rootBone = (_this_skin = this.skin) == null ? void 0 : _this_skin.rootBone;
27367
+ if (rootBone) {
27368
+ BoundingBox.transform(this._localBounds, this._transformEntity.transform.worldMatrix, worldBounds);
27369
+ } else {
27370
+ MeshRenderer.prototype._updateBounds.call(this, worldBounds);
27273
27371
  }
27274
- return Entity._findChildByName(this, 0, splits, 0);
27275
- };
27276
- /**
27277
- * Create child entity.
27278
- * @param name - The child entity's name
27279
- * @returns The child entity
27280
- */ _proto.createChild = function createChild(name) {
27281
- var transform = this._transform;
27282
- var child = transform ? new Entity(this.engine, name, transform.constructor) : new Entity(this.engine, name);
27283
- child.layer = this.layer;
27284
- child.parent = this;
27285
- return child;
27286
27372
  };
27287
- /**
27288
- * Clear children entities.
27289
- */ _proto.clearChildren = function clearChildren() {
27290
- var children = this._children;
27291
- for(var i = children.length - 1; i >= 0; i--){
27292
- var child = children[i];
27293
- child._parent = null;
27294
- var activeChangeFlag = ActiveChangeFlag.None;
27295
- child._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
27296
- child._isActiveInScene && (activeChangeFlag |= ActiveChangeFlag.Scene);
27297
- activeChangeFlag && child._processInActive(activeChangeFlag);
27298
- Entity._traverseSetOwnerScene(child, null); // Must after child._processInActive().
27373
+ _proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
27374
+ var mesh = this._mesh;
27375
+ var newBlendShapeCount = mesh ? mesh.blendShapeCount : 0;
27376
+ var lastBlendShapeWeights = this._blendShapeWeights;
27377
+ if (lastBlendShapeWeights) {
27378
+ var lastBlendShapeWeightsCount = lastBlendShapeWeights.length;
27379
+ if (lastBlendShapeWeightsCount !== newBlendShapeCount) {
27380
+ var newBlendShapeWeights = new Float32Array(newBlendShapeCount);
27381
+ if (newBlendShapeCount > lastBlendShapeWeightsCount) {
27382
+ newBlendShapeWeights.set(lastBlendShapeWeights);
27383
+ } else {
27384
+ for(var i = 0; i < newBlendShapeCount; i++){
27385
+ newBlendShapeWeights[i] = lastBlendShapeWeights[i];
27386
+ }
27387
+ }
27388
+ this._blendShapeWeights = newBlendShapeWeights;
27389
+ }
27390
+ } else {
27391
+ this._blendShapeWeights = new Float32Array(newBlendShapeCount);
27299
27392
  }
27300
- children.length = 0;
27301
- };
27302
- /**
27303
- * Clone this entity include children and components.
27304
- * @returns Cloned entity
27305
- */ _proto.clone = function clone() {
27306
- var cloneEntity = this._createCloneEntity();
27307
- this._parseCloneEntity(this, cloneEntity, this, cloneEntity, new Map());
27308
- return cloneEntity;
27309
- };
27310
- /**
27311
- * Listen for changes in the world pose of this `Entity`.
27312
- * @returns Change flag
27313
- */ _proto.registerWorldChangeFlag = function registerWorldChangeFlag() {
27314
- return this._updateFlagManager.createFlag(BoolUpdateFlag);
27315
27393
  };
27316
- /**
27317
- * @internal
27318
- */ _proto._markAsTemplate = function _markAsTemplate(templateResource) {
27319
- this._isTemplate = true;
27320
- this._templateResource = templateResource;
27394
+ _proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
27395
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
27321
27396
  };
27322
- _proto._createCloneEntity = function _createCloneEntity() {
27323
- var componentConstructors = Entity._tempComponentConstructors;
27324
- var components = this._components;
27325
- for(var i = 0, n = components.length; i < n; i++){
27326
- componentConstructors[i] = components[i].constructor;
27327
- }
27328
- var cloneEntity = _construct$1(Entity, [].concat([
27329
- this.engine,
27330
- this.name
27331
- ], componentConstructors));
27332
- componentConstructors.length = 0;
27333
- var templateResource = this._templateResource;
27334
- if (templateResource) {
27335
- cloneEntity._templateResource = templateResource;
27336
- templateResource._addReferCount(1);
27337
- }
27338
- cloneEntity.layer = this.layer;
27339
- cloneEntity._isActive = this._isActive;
27340
- var srcChildren = this._children;
27341
- for(var i1 = 0, n1 = srcChildren.length; i1 < n1; i1++){
27342
- cloneEntity.addChild(srcChildren[i1]._createCloneEntity());
27397
+ _proto._onSkinUpdated = function _onSkinUpdated(type, value) {
27398
+ switch(type){
27399
+ case SkinUpdateFlag.BoneCountChanged:
27400
+ var shaderData = this.shaderData;
27401
+ if (value > 0) {
27402
+ shaderData.enableMacro("RENDERER_HAS_SKIN");
27403
+ shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, value);
27404
+ } else {
27405
+ shaderData.disableMacro("RENDERER_HAS_SKIN");
27406
+ }
27407
+ break;
27408
+ case SkinUpdateFlag.RootBoneChanged:
27409
+ this._setTransformEntity(value);
27410
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
27411
+ break;
27343
27412
  }
27344
- return cloneEntity;
27345
27413
  };
27346
- _proto._parseCloneEntity = function _parseCloneEntity(src, target, srcRoot, targetRoot, deepInstanceMap) {
27347
- var srcChildren = src._children;
27348
- var targetChildren = target._children;
27349
- for(var i = 0, n = srcChildren.length; i < n; i++){
27350
- this._parseCloneEntity(srcChildren[i], targetChildren[i], srcRoot, targetRoot, deepInstanceMap);
27414
+ _proto._applySkin = function _applySkin(lastSkin, value) {
27415
+ var _lastSkin_bones, _value_bones;
27416
+ var _lastSkin_bones_length;
27417
+ var lastSkinBoneCount = (_lastSkin_bones_length = lastSkin == null ? void 0 : (_lastSkin_bones = lastSkin.bones) == null ? void 0 : _lastSkin_bones.length) != null ? _lastSkin_bones_length : 0;
27418
+ var _lastSkin_rootBone;
27419
+ var lastRootBone = (_lastSkin_rootBone = lastSkin == null ? void 0 : lastSkin.rootBone) != null ? _lastSkin_rootBone : this.entity;
27420
+ lastSkin == null ? void 0 : lastSkin._updatedManager.removeListener(this._onSkinUpdated);
27421
+ var _value_bones_length;
27422
+ var skinBoneCount = (_value_bones_length = value == null ? void 0 : (_value_bones = value.bones) == null ? void 0 : _value_bones.length) != null ? _value_bones_length : 0;
27423
+ var _value_rootBone;
27424
+ var rootBone = (_value_rootBone = value == null ? void 0 : value.rootBone) != null ? _value_rootBone : this.entity;
27425
+ value == null ? void 0 : value._updatedManager.addListener(this._onSkinUpdated);
27426
+ if (lastSkinBoneCount !== skinBoneCount) {
27427
+ this._onSkinUpdated(SkinUpdateFlag.BoneCountChanged, skinBoneCount);
27351
27428
  }
27352
- var components = src._components;
27353
- for(var i1 = 0, n1 = components.length; i1 < n1; i1++){
27354
- ComponentCloner.cloneComponent(components[i1], target._components[i1], srcRoot, targetRoot, deepInstanceMap);
27429
+ if (lastRootBone !== rootBone) {
27430
+ this._onSkinUpdated(SkinUpdateFlag.RootBoneChanged, rootBone);
27355
27431
  }
27356
27432
  };
27357
- /**
27358
- * Destroy self.
27433
+ _create_class$2(SkinnedMeshRenderer, [
27434
+ {
27435
+ key: "skin",
27436
+ get: /**
27437
+ * Skin of the SkinnedMeshRenderer.
27438
+ */ function get() {
27439
+ return this._skin;
27440
+ },
27441
+ set: function set(value) {
27442
+ var lastSkin = this._skin;
27443
+ if (lastSkin !== value) {
27444
+ this._applySkin(lastSkin, value);
27445
+ this._skin = value;
27446
+ }
27447
+ }
27448
+ },
27449
+ {
27450
+ key: "blendShapeWeights",
27451
+ get: /**
27452
+ * The weights of the BlendShapes.
27453
+ * @remarks Array index is BlendShape index.
27454
+ */ function get() {
27455
+ this._checkBlendShapeWeightLength();
27456
+ return this._blendShapeWeights;
27457
+ },
27458
+ set: function set(value) {
27459
+ this._checkBlendShapeWeightLength();
27460
+ var blendShapeWeights = this._blendShapeWeights;
27461
+ if (value.length <= blendShapeWeights.length) {
27462
+ blendShapeWeights.set(value);
27463
+ } else {
27464
+ for(var i = 0, n = blendShapeWeights.length; i < n; i++){
27465
+ blendShapeWeights[i] = value[i];
27466
+ }
27467
+ }
27468
+ }
27469
+ },
27470
+ {
27471
+ key: "localBounds",
27472
+ get: /**
27473
+ * Local bounds.
27474
+ */ function get() {
27475
+ return this._localBounds;
27476
+ },
27477
+ set: function set(value) {
27478
+ if (this._localBounds !== value) {
27479
+ this._localBounds.copyFrom(value);
27480
+ }
27481
+ }
27482
+ },
27483
+ {
27484
+ key: "rootBone",
27485
+ get: /**
27486
+ * @deprecated use {@link SkinnedMeshRenderer.skin.rootBone} instead.
27487
+ */ function get() {
27488
+ return this.skin.rootBone;
27489
+ },
27490
+ set: function set(value) {
27491
+ this.skin.rootBone = value;
27492
+ }
27493
+ },
27494
+ {
27495
+ key: "bones",
27496
+ get: /**
27497
+ * @deprecated use {@link SkinnedMeshRenderer.skin.bones} instead.
27498
+ */ function get() {
27499
+ return this.skin.bones;
27500
+ },
27501
+ set: function set(value) {
27502
+ this.skin.bones = value;
27503
+ }
27504
+ }
27505
+ ]);
27506
+ return SkinnedMeshRenderer;
27507
+ }(MeshRenderer);
27508
+ // @TODO: different shader type should use different count, not always 48
27509
+ /** @internal */ SkinnedMeshRenderer._baseVertexUniformVectorCount = 48;
27510
+ SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
27511
+ SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
27512
+ SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
27513
+ __decorate$1([
27514
+ ignoreClone
27515
+ ], SkinnedMeshRenderer.prototype, "_condensedBlendShapeWeights", void 0);
27516
+ __decorate$1([
27517
+ deepClone
27518
+ ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
27519
+ __decorate$1([
27520
+ ignoreClone
27521
+ ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
27522
+ __decorate$1([
27523
+ ignoreClone
27524
+ ], SkinnedMeshRenderer.prototype, "_blendShapeWeights", void 0);
27525
+ __decorate$1([
27526
+ ignoreClone
27527
+ ], SkinnedMeshRenderer.prototype, "_maxVertexUniformVectors", void 0);
27528
+ __decorate$1([
27529
+ ignoreClone
27530
+ ], SkinnedMeshRenderer.prototype, "_jointTexture", void 0);
27531
+ __decorate$1([
27532
+ deepClone
27533
+ ], SkinnedMeshRenderer.prototype, "_skin", void 0);
27534
+ __decorate$1([
27535
+ ignoreClone
27536
+ ], SkinnedMeshRenderer.prototype, "_onLocalBoundsChanged", null);
27537
+ __decorate$1([
27538
+ ignoreClone
27539
+ ], SkinnedMeshRenderer.prototype, "_onSkinUpdated", null);
27540
+ /**
27541
+ * @internal
27542
+ */ var BasicResources = /*#__PURE__*/ function() {
27543
+ function BasicResources(engine) {
27544
+ this.engine = engine;
27545
+ // prettier-ignore
27546
+ var vertices = new Float32Array([
27547
+ -1,
27548
+ -1,
27549
+ 0,
27550
+ 1,
27551
+ 3,
27552
+ -1,
27553
+ 2,
27554
+ 1,
27555
+ -1,
27556
+ 3,
27557
+ 0,
27558
+ -1
27559
+ ]); // left-top
27560
+ // prettier-ignore
27561
+ var flipYVertices = new Float32Array([
27562
+ 3,
27563
+ -1,
27564
+ 2,
27565
+ 0,
27566
+ -1,
27567
+ -1,
27568
+ 0,
27569
+ 0,
27570
+ -1,
27571
+ 3,
27572
+ 0,
27573
+ 2
27574
+ ]); // left-top
27575
+ var blitMaterial = new Material(engine, Shader.find("blit"));
27576
+ blitMaterial._addReferCount(1);
27577
+ blitMaterial.renderState.depthState.enabled = false;
27578
+ blitMaterial.renderState.depthState.writeEnabled = false;
27579
+ var blitScreenMaterial = new Material(engine, Shader.find("blit-screen"));
27580
+ blitScreenMaterial._addReferCount(1);
27581
+ blitScreenMaterial.renderState.depthState.enabled = false;
27582
+ blitScreenMaterial.renderState.depthState.writeEnabled = false;
27583
+ this.blitMaterial = blitMaterial;
27584
+ this.blitScreenMaterial = blitScreenMaterial;
27585
+ this.blitMesh = this._createBlitMesh(engine, vertices);
27586
+ this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
27587
+ // Create white and magenta textures
27588
+ var whitePixel = new Uint8Array([
27589
+ 255,
27590
+ 255,
27591
+ 255,
27592
+ 255
27593
+ ]);
27594
+ this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
27595
+ this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
27596
+ var isWebGL2 = engine._hardwareRenderer.isWebGL2;
27597
+ if (isWebGL2) {
27598
+ this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
27599
+ var whitePixel32 = new Uint32Array([
27600
+ 255,
27601
+ 255,
27602
+ 255,
27603
+ 255
27604
+ ]);
27605
+ this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
27606
+ }
27607
+ this.spriteDefaultMaterial = this._create2DMaterial(engine, Shader.find("Sprite"));
27608
+ this.textDefaultMaterial = this._create2DMaterial(engine, Shader.find("Text"));
27609
+ this.spriteMaskDefaultMaterial = this._createSpriteMaskMaterial(engine);
27610
+ this.meshMagentaMaterial = this._createMagentaMaterial(engine, "unlit");
27611
+ this.particleMagentaMaterial = this._createMagentaMaterial(engine, "particle-shader");
27612
+ }
27613
+ var _proto = BasicResources.prototype;
27614
+ /**
27615
+ * @internal
27616
+ */ _proto._getBlinnPhongMaterial = function _getBlinnPhongMaterial() {
27617
+ return this._blinnPhongMaterial || (this._blinnPhongMaterial = new BlinnPhongMaterial(this.engine));
27618
+ };
27619
+ /**
27620
+ * @internal
27621
+ */ _proto._initialize = function _initialize() {
27622
+ var _this = this;
27623
+ return new Promise(function(resolve, reject) {
27624
+ PrefilteredDFG.create(_this.engine).then(function(texture) {
27625
+ _this._prefilteredDFGTexture = texture;
27626
+ resolve(_this);
27627
+ }).catch(reject);
27628
+ });
27629
+ };
27630
+ _proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
27631
+ var mesh = new ModelMesh(engine);
27632
+ mesh._addReferCount(1);
27633
+ mesh.setVertexElements([
27634
+ new VertexElement("POSITION_UV", 0, VertexElementFormat.Vector4, 0)
27635
+ ]);
27636
+ var buffer = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices, BufferUsage.Static, true);
27637
+ mesh.setVertexBufferBinding(buffer, 16);
27638
+ mesh.addSubMesh(0, 3, MeshTopology.Triangles);
27639
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
27640
+ _inherits$2(_class, ContentRestorer);
27641
+ function _class() {
27642
+ return ContentRestorer.call(this, mesh) || this;
27643
+ }
27644
+ var _proto = _class.prototype;
27645
+ _proto.restoreContent = function restoreContent() {
27646
+ buffer.setData(buffer.data);
27647
+ };
27648
+ return _class;
27649
+ }(ContentRestorer))());
27650
+ return mesh;
27651
+ };
27652
+ _proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel, isSRGBColorSpace) {
27653
+ var texture;
27654
+ switch(type){
27655
+ case 0:
27656
+ var texture2D = new Texture2D(engine, 1, 1, format, false, isSRGBColorSpace);
27657
+ texture2D.setPixelBuffer(pixel);
27658
+ texture = texture2D;
27659
+ break;
27660
+ case 2:
27661
+ var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false, isSRGBColorSpace);
27662
+ texture2DArray.setPixelBuffer(0, pixel);
27663
+ texture = texture2DArray;
27664
+ break;
27665
+ case 1:
27666
+ var textureCube = new TextureCube(engine, 1, format, false, isSRGBColorSpace);
27667
+ for(var i = 0; i < 6; i++){
27668
+ textureCube.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
27669
+ }
27670
+ texture = textureCube;
27671
+ break;
27672
+ default:
27673
+ throw "Invalid texture type";
27674
+ }
27675
+ texture.isGCIgnored = true;
27676
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
27677
+ _inherits$2(_class, ContentRestorer);
27678
+ function _class() {
27679
+ return ContentRestorer.call(this, texture) || this;
27680
+ }
27681
+ var _proto = _class.prototype;
27682
+ _proto.restoreContent = function restoreContent() {
27683
+ switch(type){
27684
+ case 0:
27685
+ this.resource.setPixelBuffer(pixel);
27686
+ break;
27687
+ case 2:
27688
+ this.resource.setPixelBuffer(0, pixel);
27689
+ break;
27690
+ case 1:
27691
+ for(var i = 0; i < 6; i++){
27692
+ this.resource.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
27693
+ }
27694
+ break;
27695
+ }
27696
+ };
27697
+ return _class;
27698
+ }(ContentRestorer))());
27699
+ return texture;
27700
+ };
27701
+ _proto._create2DMaterial = function _create2DMaterial(engine, shader) {
27702
+ var material = new Material(engine, shader);
27703
+ var renderState = material.renderState;
27704
+ var target = renderState.blendState.targetBlendState;
27705
+ target.enabled = true;
27706
+ target.sourceColorBlendFactor = BlendFactor.SourceAlpha;
27707
+ target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
27708
+ target.sourceAlphaBlendFactor = BlendFactor.One;
27709
+ target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
27710
+ target.colorBlendOperation = target.alphaBlendOperation = BlendOperation.Add;
27711
+ renderState.depthState.writeEnabled = false;
27712
+ renderState.rasterState.cullMode = CullMode.Off;
27713
+ renderState.renderQueueType = RenderQueueType.Transparent;
27714
+ material.isGCIgnored = true;
27715
+ return material;
27716
+ };
27717
+ _proto._createMagentaMaterial = function _createMagentaMaterial(engine, shaderName) {
27718
+ var material = new Material(engine, Shader.find(shaderName));
27719
+ material.isGCIgnored = true;
27720
+ material.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
27721
+ return material;
27722
+ };
27723
+ _proto._createSpriteMaskMaterial = function _createSpriteMaskMaterial(engine) {
27724
+ var material = new Material(engine, Shader.find("SpriteMask"));
27725
+ material.isGCIgnored = true;
27726
+ return material;
27727
+ };
27728
+ BasicResources.getMaskInteractionRenderStates = function getMaskInteractionRenderStates(maskInteraction) {
27729
+ var visibleInsideMask = maskInteraction === SpriteMaskInteraction.VisibleInsideMask;
27730
+ var renderStates;
27731
+ var compareFunction;
27732
+ if (visibleInsideMask) {
27733
+ renderStates = BasicResources._maskReadInsideRenderStates;
27734
+ if (renderStates) {
27735
+ return renderStates;
27736
+ }
27737
+ BasicResources._maskReadInsideRenderStates = renderStates = {};
27738
+ compareFunction = CompareFunction.LessEqual;
27739
+ } else {
27740
+ renderStates = BasicResources._maskReadOutsideRenderStates;
27741
+ if (renderStates) {
27742
+ return renderStates;
27743
+ }
27744
+ BasicResources._maskReadOutsideRenderStates = renderStates = {};
27745
+ compareFunction = CompareFunction.Greater;
27746
+ }
27747
+ renderStates[RenderStateElementKey.StencilStateEnabled] = true;
27748
+ renderStates[RenderStateElementKey.StencilStateWriteMask] = 0x00;
27749
+ renderStates[RenderStateElementKey.StencilStateReferenceValue] = 1;
27750
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = compareFunction;
27751
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = compareFunction;
27752
+ return renderStates;
27753
+ };
27754
+ BasicResources.getMaskTypeRenderStates = function getMaskTypeRenderStates(maskType) {
27755
+ var isIncrement = maskType === RenderQueueMaskType.Increment;
27756
+ var renderStates;
27757
+ var passOperation;
27758
+ if (isIncrement) {
27759
+ renderStates = BasicResources._maskWriteIncrementRenderStates;
27760
+ if (renderStates) {
27761
+ return renderStates;
27762
+ }
27763
+ BasicResources._maskWriteIncrementRenderStates = renderStates = {};
27764
+ passOperation = StencilOperation.IncrementSaturate;
27765
+ } else {
27766
+ renderStates = BasicResources._maskWriteDecrementRenderStates;
27767
+ if (renderStates) {
27768
+ return renderStates;
27769
+ }
27770
+ BasicResources._maskWriteDecrementRenderStates = renderStates = {};
27771
+ passOperation = StencilOperation.DecrementSaturate;
27772
+ }
27773
+ renderStates[RenderStateElementKey.StencilStateEnabled] = true;
27774
+ renderStates[RenderStateElementKey.StencilStatePassOperationFront] = passOperation;
27775
+ renderStates[RenderStateElementKey.StencilStatePassOperationBack] = passOperation;
27776
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = CompareFunction.Always;
27777
+ renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = CompareFunction.Always;
27778
+ var failStencilOperation = StencilOperation.Keep;
27779
+ renderStates[RenderStateElementKey.StencilStateFailOperationFront] = failStencilOperation;
27780
+ renderStates[RenderStateElementKey.StencilStateFailOperationBack] = failStencilOperation;
27781
+ renderStates[RenderStateElementKey.StencilStateZFailOperationFront] = failStencilOperation;
27782
+ renderStates[RenderStateElementKey.StencilStateZFailOperationBack] = failStencilOperation;
27783
+ renderStates[RenderStateElementKey.BlendStateColorWriteMask0] = ColorWriteMask.None;
27784
+ renderStates[RenderStateElementKey.DepthStateEnabled] = false;
27785
+ renderStates[RenderStateElementKey.RasterStateCullMode] = CullMode.Off;
27786
+ return renderStates;
27787
+ };
27788
+ _create_class$2(BasicResources, [
27789
+ {
27790
+ key: "prefilteredDFGTexture",
27791
+ get: function get() {
27792
+ return this._prefilteredDFGTexture;
27793
+ }
27794
+ }
27795
+ ]);
27796
+ return BasicResources;
27797
+ }();
27798
+ BasicResources._maskReadInsideRenderStates = null;
27799
+ BasicResources._maskReadOutsideRenderStates = null;
27800
+ BasicResources._maskWriteIncrementRenderStates = null;
27801
+ BasicResources._maskWriteDecrementRenderStates = null;
27802
+ function _is_native_reflect_construct$1() {
27803
+ // Since Reflect.construct can't be properly polyfilled, some
27804
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
27805
+ // Those polyfills don't allow us to subclass built-ins, so we need to
27806
+ // use our fallback implementation.
27807
+ try {
27808
+ // If the internal slots aren't set, this throws an error similar to
27809
+ // TypeError: this is not a Boolean object.
27810
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
27811
+ } catch (_) {}
27812
+ return (_is_native_reflect_construct$1 = function _is_native_reflect_construct() {
27813
+ return !!result;
27814
+ })();
27815
+ }
27816
+ function _construct$1(Parent, args, Class) {
27817
+ if (_is_native_reflect_construct$1()) _construct$1 = Reflect.construct;
27818
+ else {
27819
+ _construct$1 = function construct(Parent, args, Class) {
27820
+ var a = [
27821
+ null
27822
+ ];
27823
+ a.push.apply(a, args);
27824
+ var Constructor = Function.bind.apply(Parent, a);
27825
+ var instance = new Constructor();
27826
+ if (Class) _set_prototype_of$2(instance, Class.prototype);
27827
+ return instance;
27828
+ };
27829
+ }
27830
+ return _construct$1.apply(null, arguments);
27831
+ }
27832
+ var ComponentCloner = /*#__PURE__*/ function() {
27833
+ function ComponentCloner() {}
27834
+ /**
27835
+ * Clone component.
27836
+ * @param source - Clone source
27837
+ * @param target - Clone target
27838
+ */ ComponentCloner.cloneComponent = function cloneComponent(source, target, srcRoot, targetRoot, deepInstanceMap) {
27839
+ var cloneModes = CloneManager.getCloneMode(source.constructor);
27840
+ for(var k in source){
27841
+ CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
27842
+ }
27843
+ if (source._cloneTo) {
27844
+ source._cloneTo(target, srcRoot, targetRoot);
27845
+ }
27846
+ };
27847
+ return ComponentCloner;
27848
+ }();
27849
+ /**
27850
+ * The entity modify flags.
27851
+ */ var EntityModifyFlags = /*#__PURE__*/ function(EntityModifyFlags) {
27852
+ /** The parent changes. */ EntityModifyFlags[EntityModifyFlags["Parent"] = 1] = "Parent";
27853
+ /** The child changes. */ EntityModifyFlags[EntityModifyFlags["Child"] = 2] = "Child";
27854
+ return EntityModifyFlags;
27855
+ }({});
27856
+ /**
27857
+ * Entity, be used as components container.
27858
+ */ var Entity = /*#__PURE__*/ function(EngineObject) {
27859
+ _inherits$2(Entity, EngineObject);
27860
+ function Entity(engine, name) {
27861
+ for(var _len = arguments.length, components = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
27862
+ components[_key - 2] = arguments[_key];
27863
+ }
27864
+ var _this;
27865
+ _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, _this._invModelMatrix = new Matrix();
27866
+ _this.name = name != null ? name : "Entity";
27867
+ for(var i = 0, n = components.length; i < n; i++){
27868
+ _this.addComponent(components[i]);
27869
+ }
27870
+ !_this._transform && _this.addComponent(Transform);
27871
+ _this._inverseWorldMatFlag = _this.registerWorldChangeFlag();
27872
+ return _this;
27873
+ }
27874
+ var _proto = Entity.prototype;
27875
+ /**
27876
+ * Add component based on the component type.
27877
+ * @param type - The type of the component
27878
+ * @param args - The arguments of the component
27879
+ * @returns The component which has been added
27880
+ */ _proto.addComponent = function addComponent(type) {
27881
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
27882
+ args[_key - 1] = arguments[_key];
27883
+ }
27884
+ ComponentsDependencies._addCheck(this, type);
27885
+ var component = _construct$1(type, [].concat([
27886
+ this
27887
+ ], args));
27888
+ this._components.push(component);
27889
+ // @todo: temporary solution
27890
+ if (_instanceof1$2(component, Transform)) this._setTransform(component);
27891
+ component._setActive(true, ActiveChangeFlag.All);
27892
+ return component;
27893
+ };
27894
+ /**
27895
+ * Get component which match the type.
27896
+ * @param type - The type of the component
27897
+ * @returns The first component which match type
27898
+ */ _proto.getComponent = function getComponent(type) {
27899
+ var components = this._components;
27900
+ for(var i = 0, n = components.length; i < n; i++){
27901
+ var component = components[i];
27902
+ if (_instanceof1$2(component, type)) {
27903
+ return component;
27904
+ }
27905
+ }
27906
+ return null;
27907
+ };
27908
+ /**
27909
+ * Get components which match the type.
27910
+ * @param type - The type of the component
27911
+ * @param results - The components which match type
27912
+ * @returns The components which match type
27913
+ */ _proto.getComponents = function getComponents(type, results) {
27914
+ results.length = 0;
27915
+ var components = this._components;
27916
+ for(var i = 0, n = components.length; i < n; i++){
27917
+ var component = components[i];
27918
+ if (_instanceof1$2(component, type)) {
27919
+ results.push(component);
27920
+ }
27921
+ }
27922
+ return results;
27923
+ };
27924
+ /**
27925
+ * Get the components which match the type of the entity and it's children.
27926
+ * @param type - The component type
27927
+ * @param results - The components collection
27928
+ * @returns The components collection which match the type
27929
+ */ _proto.getComponentsIncludeChildren = function getComponentsIncludeChildren(type, results) {
27930
+ results.length = 0;
27931
+ this._getComponentsInChildren(type, results);
27932
+ return results;
27933
+ };
27934
+ _proto.addChild = function addChild(indexOrChild, child) {
27935
+ var index;
27936
+ if (typeof indexOrChild === "number") {
27937
+ index = indexOrChild;
27938
+ } else {
27939
+ index = undefined;
27940
+ child = indexOrChild;
27941
+ }
27942
+ child._setParent(this, index);
27943
+ };
27944
+ /**
27945
+ * Remove child entity.
27946
+ * @param child - The child entity which want to be removed
27947
+ */ _proto.removeChild = function removeChild(child) {
27948
+ if (child._parent !== this) return;
27949
+ child._setParent(null);
27950
+ };
27951
+ /**
27952
+ * @deprecated Please use `children` property instead.
27953
+ * Find child entity by index.
27954
+ * @param index - The index of the child entity
27955
+ * @returns The component which be found
27956
+ */ _proto.getChild = function getChild(index) {
27957
+ return this._children[index];
27958
+ };
27959
+ /**
27960
+ * Find entity by name.
27961
+ * @param name - The name of the entity which want to be found
27962
+ * @returns The component which be found
27963
+ */ _proto.findByName = function findByName(name) {
27964
+ if (name === this.name) {
27965
+ return this;
27966
+ }
27967
+ var children = this._children;
27968
+ for(var i = 0, n = children.length; i < n; i++){
27969
+ var target = children[i].findByName(name);
27970
+ if (target) {
27971
+ return target;
27972
+ }
27973
+ }
27974
+ return null;
27975
+ };
27976
+ /**
27977
+ * Find the entity by path.
27978
+ * @param path - The path of the entity eg: /entity
27979
+ * @returns The component which be found
27980
+ */ _proto.findByPath = function findByPath(path) {
27981
+ var splits = path.split("/").filter(Boolean);
27982
+ if (!splits.length) {
27983
+ return this;
27984
+ }
27985
+ return Entity._findChildByName(this, 0, splits, 0);
27986
+ };
27987
+ /**
27988
+ * Create child entity.
27989
+ * @param name - The child entity's name
27990
+ * @returns The child entity
27991
+ */ _proto.createChild = function createChild(name) {
27992
+ var transform = this._transform;
27993
+ var child = transform ? new Entity(this.engine, name, transform.constructor) : new Entity(this.engine, name);
27994
+ child.layer = this.layer;
27995
+ child.parent = this;
27996
+ return child;
27997
+ };
27998
+ /**
27999
+ * Clear children entities.
28000
+ */ _proto.clearChildren = function clearChildren() {
28001
+ var children = this._children;
28002
+ for(var i = children.length - 1; i >= 0; i--){
28003
+ var child = children[i];
28004
+ child._parent = null;
28005
+ var activeChangeFlag = ActiveChangeFlag.None;
28006
+ child._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
28007
+ child._isActiveInScene && (activeChangeFlag |= ActiveChangeFlag.Scene);
28008
+ activeChangeFlag && child._processInActive(activeChangeFlag);
28009
+ Entity._traverseSetOwnerScene(child, null); // Must after child._processInActive().
28010
+ }
28011
+ children.length = 0;
28012
+ };
28013
+ /**
28014
+ * Clone this entity include children and components.
28015
+ * @returns Cloned entity
28016
+ */ _proto.clone = function clone() {
28017
+ var cloneEntity = this._createCloneEntity();
28018
+ this._parseCloneEntity(this, cloneEntity, this, cloneEntity, new Map());
28019
+ return cloneEntity;
28020
+ };
28021
+ /**
28022
+ * Listen for changes in the world pose of this `Entity`.
28023
+ * @returns Change flag
28024
+ */ _proto.registerWorldChangeFlag = function registerWorldChangeFlag() {
28025
+ return this._updateFlagManager.createFlag(BoolUpdateFlag);
28026
+ };
28027
+ /**
28028
+ * @internal
28029
+ */ _proto._markAsTemplate = function _markAsTemplate(templateResource) {
28030
+ this._isTemplate = true;
28031
+ this._templateResource = templateResource;
28032
+ };
28033
+ _proto._createCloneEntity = function _createCloneEntity() {
28034
+ var componentConstructors = Entity._tempComponentConstructors;
28035
+ var components = this._components;
28036
+ for(var i = 0, n = components.length; i < n; i++){
28037
+ componentConstructors[i] = components[i].constructor;
28038
+ }
28039
+ var cloneEntity = _construct$1(Entity, [].concat([
28040
+ this.engine,
28041
+ this.name
28042
+ ], componentConstructors));
28043
+ componentConstructors.length = 0;
28044
+ var templateResource = this._templateResource;
28045
+ if (templateResource) {
28046
+ cloneEntity._templateResource = templateResource;
28047
+ templateResource._addReferCount(1);
28048
+ }
28049
+ cloneEntity.layer = this.layer;
28050
+ cloneEntity._isActive = this._isActive;
28051
+ var srcChildren = this._children;
28052
+ for(var i1 = 0, n1 = srcChildren.length; i1 < n1; i1++){
28053
+ cloneEntity.addChild(srcChildren[i1]._createCloneEntity());
28054
+ }
28055
+ return cloneEntity;
28056
+ };
28057
+ _proto._parseCloneEntity = function _parseCloneEntity(src, target, srcRoot, targetRoot, deepInstanceMap) {
28058
+ var srcChildren = src._children;
28059
+ var targetChildren = target._children;
28060
+ for(var i = 0, n = srcChildren.length; i < n; i++){
28061
+ this._parseCloneEntity(srcChildren[i], targetChildren[i], srcRoot, targetRoot, deepInstanceMap);
28062
+ }
28063
+ var components = src._components;
28064
+ for(var i1 = 0, n1 = components.length; i1 < n1; i1++){
28065
+ ComponentCloner.cloneComponent(components[i1], target._components[i1], srcRoot, targetRoot, deepInstanceMap);
28066
+ }
28067
+ };
28068
+ /**
28069
+ * Destroy self.
27359
28070
  */ _proto.destroy = function destroy() {
27360
28071
  EngineObject.prototype.destroy.call(this);
27361
28072
  if (!this._destroyed) {
@@ -27626,29 +28337,6 @@
27626
28337
  };
27627
28338
  /**
27628
28339
  * @internal
27629
- */ Entity._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
27630
- inversePath.length = 0;
27631
- while(searchEntity !== rootEntity){
27632
- var parent = searchEntity.parent;
27633
- if (!parent) {
27634
- return false;
27635
- }
27636
- inversePath.push(searchEntity.siblingIndex);
27637
- searchEntity = parent;
27638
- }
27639
- return true;
27640
- };
27641
- /**
27642
- * @internal
27643
- */ Entity._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
27644
- var entity = rootEntity;
27645
- for(var i = inversePath.length - 1; i >= 0; i--){
27646
- entity = entity.children[inversePath[i]];
27647
- }
27648
- return entity;
27649
- };
27650
- /**
27651
- * @internal
27652
28340
  */ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
27653
28341
  var count = children.length - 1;
27654
28342
  for(var i = entity._siblingIndex; i < count; i++){
@@ -27658,799 +28346,134 @@
27658
28346
  }
27659
28347
  children.length = count;
27660
28348
  entity._siblingIndex = -1;
27661
- };
27662
- /**
27663
- * @internal
27664
- */ Entity._addToChildren = function _addToChildren(children, entity, index) {
27665
- var childCount = children.length;
27666
- children.length = childCount + 1;
27667
- if (index === undefined) {
27668
- children[childCount] = entity;
27669
- entity._siblingIndex = childCount;
27670
- } else {
27671
- if (index < 0 || index > childCount) {
27672
- throw "The index " + index + " is out of child list bounds " + childCount;
27673
- }
27674
- for(var i = childCount; i > index; i--){
27675
- var swapChild = children[i - 1];
27676
- swapChild._siblingIndex = i;
27677
- children[i] = swapChild;
27678
- }
27679
- entity._siblingIndex = index;
27680
- children[index] = entity;
27681
- }
27682
- };
27683
- _create_class$2(Entity, [
27684
- {
27685
- key: "transform",
27686
- get: /**
27687
- * The transform of this entity.
27688
- */ function get() {
27689
- return this._transform;
27690
- }
27691
- },
27692
- {
27693
- key: "isActive",
27694
- get: /**
27695
- * Whether to activate locally.
27696
- */ function get() {
27697
- return this._isActive;
27698
- },
27699
- set: function set(value) {
27700
- if (value !== this._isActive) {
27701
- this._isActive = value;
27702
- if (value) {
27703
- var parent = this._parent;
27704
- var activeChangeFlag = ActiveChangeFlag.None;
27705
- if (this._isRoot && this._scene._isActiveInEngine) {
27706
- activeChangeFlag |= ActiveChangeFlag.All;
27707
- } else {
27708
- (parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
27709
- (parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
27710
- }
27711
- activeChangeFlag && this._processActive(activeChangeFlag);
27712
- } else {
27713
- var activeChangeFlag1 = ActiveChangeFlag.None;
27714
- this._isActiveInHierarchy && (activeChangeFlag1 |= ActiveChangeFlag.Hierarchy);
27715
- this._isActiveInScene && (activeChangeFlag1 |= ActiveChangeFlag.Scene);
27716
- activeChangeFlag1 && this._processInActive(activeChangeFlag1);
27717
- }
27718
- }
27719
- }
27720
- },
27721
- {
27722
- key: "isActiveInHierarchy",
27723
- get: /**
27724
- * Whether it is active in the hierarchy.
27725
- */ function get() {
27726
- return this._isActiveInHierarchy;
27727
- }
27728
- },
27729
- {
27730
- key: "parent",
27731
- get: /**
27732
- * The parent entity.
27733
- */ function get() {
27734
- return this._parent;
27735
- },
27736
- set: function set(value) {
27737
- this._setParent(value);
27738
- }
27739
- },
27740
- {
27741
- key: "children",
27742
- get: /**
27743
- * The children entities
27744
- */ function get() {
27745
- return this._children;
27746
- }
27747
- },
27748
- {
27749
- key: "childCount",
27750
- get: /**
27751
- * @deprecated Please use `children.length` property instead.
27752
- * Number of the children entities
27753
- */ function get() {
27754
- return this._children.length;
27755
- }
27756
- },
27757
- {
27758
- key: "scene",
27759
- get: /**
27760
- * The scene the entity belongs to.
27761
- */ function get() {
27762
- return this._scene;
27763
- }
27764
- },
27765
- {
27766
- key: "siblingIndex",
27767
- get: /**
27768
- * The sibling index.
27769
- */ function get() {
27770
- return this._siblingIndex;
27771
- },
27772
- set: function set(value) {
27773
- if (this._siblingIndex === -1) {
27774
- throw "The entity " + this.name + " is not in the hierarchy";
27775
- }
27776
- if (this._isRoot) {
27777
- this._setSiblingIndex(this._scene._rootEntities, value);
27778
- } else {
27779
- var parent = this._parent;
27780
- this._setSiblingIndex(parent._children, value);
27781
- parent._dispatchModify(EntityModifyFlags.Child, parent);
27782
- }
27783
- }
27784
- }
27785
- ]);
27786
- return Entity;
27787
- }(EngineObject);
27788
- /** @internal */ Entity._tempComponentConstructors = [];
27789
- /**
27790
- * Skin used for skinned mesh renderer.
27791
- */ var Skin = /*#__PURE__*/ function(EngineObject) {
27792
- _inherits$2(Skin, EngineObject);
27793
- function Skin(name) {
27794
- var _this;
27795
- _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 = [];
27796
- return _this;
27797
- }
27798
- var _proto = Skin.prototype;
27799
- /**
27800
- * @internal
27801
- */ _proto._updateSkinMatrices = function _updateSkinMatrices(renderer) {
27802
- if (this._updateMark === renderer.engine.time.frameCount) {
27803
- return;
27804
- }
27805
- var _this = this, bones = _this.bones, bindMatrices = _this.inverseBindMatrices, skinMatrices = _this._skinMatrices;
27806
- var _this_rootBone;
27807
- var worldToLocal = ((_this_rootBone = this.rootBone) != null ? _this_rootBone : renderer.entity).getInvModelMatrix();
27808
- for(var i = bones.length - 1; i >= 0; i--){
27809
- var bone = bones[i];
27810
- var offset = i * 16;
27811
- if (bone) {
27812
- Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, skinMatrices, offset);
27813
- } else {
27814
- skinMatrices.set(bindMatrices[i].elements, offset);
27815
- }
27816
- Utils._floatMatrixMultiply(worldToLocal, skinMatrices, offset, skinMatrices, offset);
27817
- }
27818
- this._updateMark = renderer.engine.time.frameCount;
27819
- };
27820
- /**
27821
- * @internal
27822
- */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
27823
- var paths = new Array();
27824
- // Clone rootBone
27825
- var rootBone = this.rootBone;
27826
- if (rootBone) {
27827
- var success = Entity._getEntityHierarchyPath(srcRoot, rootBone, paths);
27828
- target.rootBone = success ? Entity._getEntityByHierarchyPath(targetRoot, paths) : rootBone;
27829
- }
27830
- // Clone bones
27831
- var bones = this.bones;
27832
- if (bones.length > 0) {
27833
- var boneCount = bones.length;
27834
- var destBones = new Array(boneCount);
27835
- for(var i = 0; i < boneCount; i++){
27836
- var bone = bones[i];
27837
- var success1 = Entity._getEntityHierarchyPath(srcRoot, bone, paths);
27838
- destBones[i] = success1 ? Entity._getEntityByHierarchyPath(targetRoot, paths) : bone;
27839
- }
27840
- target.bones = destBones;
27841
- }
27842
- };
27843
- _create_class$2(Skin, [
27844
- {
27845
- key: "rootBone",
27846
- get: /**
27847
- * Root bone.
27848
- */ function get() {
27849
- return this._rootBone;
27850
- },
27851
- set: function set(value) {
27852
- if (this._rootBone !== value) {
27853
- this._updatedManager.dispatch(1, value);
27854
- this._rootBone = value;
27855
- }
27856
- }
27857
- },
27858
- {
27859
- key: "bones",
27860
- get: /**
27861
- * Bones of the skin.
27862
- */ function get() {
27863
- return this._bones;
27864
- },
27865
- set: function set(value) {
27866
- var bones = this._bones;
27867
- var _value_length;
27868
- var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
27869
- var lastBoneCount = bones.length;
27870
- bones.length = boneCount;
27871
- for(var i = 0; i < boneCount; i++){
27872
- bones[i] = value[i];
27873
- }
27874
- if (lastBoneCount !== boneCount) {
27875
- this._skinMatrices = new Float32Array(boneCount * 16);
27876
- this._updatedManager.dispatch(0, boneCount);
27877
- }
27878
- }
27879
- },
27880
- {
27881
- key: "skeleton",
27882
- get: /** @deprecated Please use `rootBone` instead. */ function get() {
27883
- var _this_rootBone;
27884
- return (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.name;
27885
- },
27886
- set: function set(value) {
27887
- var rootBone = this._rootBone;
27888
- if (rootBone) {
27889
- rootBone.name = value;
27890
- }
27891
- }
27892
- }
27893
- ]);
27894
- return Skin;
27895
- }(EngineObject);
27896
- __decorate$1([
27897
- deepClone
27898
- ], Skin.prototype, "inverseBindMatrices", void 0);
27899
- __decorate$1([
27900
- ignoreClone
27901
- ], Skin.prototype, "_skinMatrices", void 0);
27902
- __decorate$1([
27903
- ignoreClone
27904
- ], Skin.prototype, "_updatedManager", void 0);
27905
- __decorate$1([
27906
- ignoreClone
27907
- ], Skin.prototype, "_rootBone", void 0);
27908
- __decorate$1([
27909
- ignoreClone
27910
- ], Skin.prototype, "_bones", void 0);
27911
- __decorate$1([
27912
- ignoreClone
27913
- ], Skin.prototype, "_updateMark", void 0);
27914
- var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
27915
- SkinUpdateFlag[SkinUpdateFlag["BoneCountChanged"] = 0] = "BoneCountChanged";
27916
- SkinUpdateFlag[SkinUpdateFlag["RootBoneChanged"] = 1] = "RootBoneChanged";
27917
- return SkinUpdateFlag;
27918
- }({});
27919
- /**
27920
- * SkinnedMeshRenderer.
27921
- */ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
27922
- _inherits$2(SkinnedMeshRenderer, MeshRenderer);
27923
- function SkinnedMeshRenderer(entity) {
27924
- var _this;
27925
- _this = MeshRenderer.call(this, entity) || this, _this._localBounds = new BoundingBox(), _this._jointDataCreateCache = new Vector2(-1, -1);
27926
- _this._skin = null;
27927
- var rhi = _this.entity.engine._hardwareRenderer;
27928
- var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
27929
- // Limit size to 256 to avoid some problem:
27930
- // 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!
27931
- // 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.
27932
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
27933
- _this._maxVertexUniformVectors = maxVertexUniformVectors;
27934
- _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_this);
27935
- _this._onSkinUpdated = _this._onSkinUpdated.bind(_this);
27936
- var localBounds = _this._localBounds;
27937
- // @ts-ignore
27938
- localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
27939
- // @ts-ignore
27940
- localBounds.max._onValueChanged = _this._onLocalBoundsChanged;
27941
- return _this;
27942
- }
27943
- var _proto = SkinnedMeshRenderer.prototype;
27944
- /**
27945
- * @internal
27946
- */ _proto._onDestroy = function _onDestroy() {
27947
- var _this__jointTexture;
27948
- MeshRenderer.prototype._onDestroy.call(this);
27949
- this._jointDataCreateCache = null;
27950
- this._skin = null;
27951
- this._blendShapeWeights = null;
27952
- this._localBounds = null;
27953
- (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
27954
- this._jointTexture = null;
27955
- };
27956
- /**
27957
- * @internal
27958
- */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
27959
- MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
27960
- if (this.skin) {
27961
- target._applySkin(null, target.skin);
27962
- }
27963
- this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
27964
- };
27965
- _proto._update = function _update(context) {
27966
- var skin = this.skin;
27967
- if ((skin == null ? void 0 : skin.bones.length) > 0) {
27968
- skin._updateSkinMatrices(this);
27969
- }
27970
- var shaderData = this.shaderData;
27971
- var mesh = this.mesh;
27972
- var blendShapeManager = mesh._blendShapeManager;
27973
- blendShapeManager._updateShaderData(shaderData, this);
27974
- var bones = skin == null ? void 0 : skin.bones;
27975
- if (bones) {
27976
- var bsUniformOccupiesCount = blendShapeManager._uniformOccupiesCount;
27977
- var boneCount = bones.length;
27978
- var boneDataCreateCache = this._jointDataCreateCache;
27979
- var boneCountChange = boneCount !== boneDataCreateCache.x;
27980
- if (boneCountChange || bsUniformOccupiesCount !== boneDataCreateCache.y) {
27981
- // directly use max joint count to avoid shader recompile
27982
- var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
27983
- if (boneCount > remainUniformJointCount) {
27984
- var engine = this.engine;
27985
- if (engine._hardwareRenderer.canIUseMoreJoints) {
27986
- if (boneCountChange) {
27987
- var _this__jointTexture;
27988
- (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
27989
- this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
27990
- this._jointTexture.filterMode = TextureFilterMode.Point;
27991
- this._jointTexture.isGCIgnored = true;
27992
- }
27993
- shaderData.disableMacro("RENDERER_JOINTS_NUM");
27994
- shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
27995
- shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
27996
- } else {
27997
- 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);
27998
- }
27999
- } else {
28000
- var _this__jointTexture1;
28001
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
28002
- shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
28003
- shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
28004
- shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, skin._skinMatrices);
28005
- }
28006
- boneDataCreateCache.set(boneCount, bsUniformOccupiesCount);
28007
- }
28008
- if (this._jointTexture) {
28009
- this._jointTexture.setPixelBuffer(skin._skinMatrices);
28010
- }
28011
- }
28012
- MeshRenderer.prototype._update.call(this, context);
28013
- };
28014
- /**
28015
- * @internal
28016
- */ _proto._updateBounds = function _updateBounds(worldBounds) {
28017
- var _this_skin;
28018
- var rootBone = (_this_skin = this.skin) == null ? void 0 : _this_skin.rootBone;
28019
- if (rootBone) {
28020
- BoundingBox.transform(this._localBounds, this._transformEntity.transform.worldMatrix, worldBounds);
28021
- } else {
28022
- MeshRenderer.prototype._updateBounds.call(this, worldBounds);
28023
- }
28024
- };
28025
- _proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
28026
- var mesh = this._mesh;
28027
- var newBlendShapeCount = mesh ? mesh.blendShapeCount : 0;
28028
- var lastBlendShapeWeights = this._blendShapeWeights;
28029
- if (lastBlendShapeWeights) {
28030
- var lastBlendShapeWeightsCount = lastBlendShapeWeights.length;
28031
- if (lastBlendShapeWeightsCount !== newBlendShapeCount) {
28032
- var newBlendShapeWeights = new Float32Array(newBlendShapeCount);
28033
- if (newBlendShapeCount > lastBlendShapeWeightsCount) {
28034
- newBlendShapeWeights.set(lastBlendShapeWeights);
28035
- } else {
28036
- for(var i = 0; i < newBlendShapeCount; i++){
28037
- newBlendShapeWeights[i] = lastBlendShapeWeights[i];
28038
- }
28039
- }
28040
- this._blendShapeWeights = newBlendShapeWeights;
28041
- }
28042
- } else {
28043
- this._blendShapeWeights = new Float32Array(newBlendShapeCount);
28044
- }
28045
- };
28046
- _proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
28047
- this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
28048
- };
28049
- _proto._onSkinUpdated = function _onSkinUpdated(type, value) {
28050
- switch(type){
28051
- case SkinUpdateFlag.BoneCountChanged:
28052
- var shaderData = this.shaderData;
28053
- if (value > 0) {
28054
- shaderData.enableMacro("RENDERER_HAS_SKIN");
28055
- shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, value);
28056
- } else {
28057
- shaderData.disableMacro("RENDERER_HAS_SKIN");
28058
- }
28059
- break;
28060
- case SkinUpdateFlag.RootBoneChanged:
28061
- this._setTransformEntity(value);
28062
- this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
28063
- break;
28064
- }
28065
- };
28066
- _proto._applySkin = function _applySkin(lastSkin, value) {
28067
- var _lastSkin_bones, _value_bones;
28068
- var _lastSkin_bones_length;
28069
- var lastSkinBoneCount = (_lastSkin_bones_length = lastSkin == null ? void 0 : (_lastSkin_bones = lastSkin.bones) == null ? void 0 : _lastSkin_bones.length) != null ? _lastSkin_bones_length : 0;
28070
- var _lastSkin_rootBone;
28071
- var lastRootBone = (_lastSkin_rootBone = lastSkin == null ? void 0 : lastSkin.rootBone) != null ? _lastSkin_rootBone : this.entity;
28072
- lastSkin == null ? void 0 : lastSkin._updatedManager.removeListener(this._onSkinUpdated);
28073
- var _value_bones_length;
28074
- var skinBoneCount = (_value_bones_length = value == null ? void 0 : (_value_bones = value.bones) == null ? void 0 : _value_bones.length) != null ? _value_bones_length : 0;
28075
- var _value_rootBone;
28076
- var rootBone = (_value_rootBone = value == null ? void 0 : value.rootBone) != null ? _value_rootBone : this.entity;
28077
- value == null ? void 0 : value._updatedManager.addListener(this._onSkinUpdated);
28078
- if (lastSkinBoneCount !== skinBoneCount) {
28079
- this._onSkinUpdated(SkinUpdateFlag.BoneCountChanged, skinBoneCount);
28080
- }
28081
- if (lastRootBone !== rootBone) {
28082
- this._onSkinUpdated(SkinUpdateFlag.RootBoneChanged, rootBone);
28349
+ };
28350
+ /**
28351
+ * @internal
28352
+ */ Entity._addToChildren = function _addToChildren(children, entity, index) {
28353
+ var childCount = children.length;
28354
+ children.length = childCount + 1;
28355
+ if (index === undefined) {
28356
+ children[childCount] = entity;
28357
+ entity._siblingIndex = childCount;
28358
+ } else {
28359
+ if (index < 0 || index > childCount) {
28360
+ throw "The index " + index + " is out of child list bounds " + childCount;
28361
+ }
28362
+ for(var i = childCount; i > index; i--){
28363
+ var swapChild = children[i - 1];
28364
+ swapChild._siblingIndex = i;
28365
+ children[i] = swapChild;
28366
+ }
28367
+ entity._siblingIndex = index;
28368
+ children[index] = entity;
28083
28369
  }
28084
28370
  };
28085
- _create_class$2(SkinnedMeshRenderer, [
28371
+ _create_class$2(Entity, [
28086
28372
  {
28087
- key: "skin",
28373
+ key: "transform",
28088
28374
  get: /**
28089
- * Skin of the SkinnedMeshRenderer.
28375
+ * The transform of this entity.
28090
28376
  */ function get() {
28091
- return this._skin;
28092
- },
28093
- set: function set(value) {
28094
- var lastSkin = this._skin;
28095
- if (lastSkin !== value) {
28096
- this._applySkin(lastSkin, value);
28097
- this._skin = value;
28098
- }
28377
+ return this._transform;
28099
28378
  }
28100
28379
  },
28101
28380
  {
28102
- key: "blendShapeWeights",
28381
+ key: "isActive",
28103
28382
  get: /**
28104
- * The weights of the BlendShapes.
28105
- * @remarks Array index is BlendShape index.
28383
+ * Whether to activate locally.
28106
28384
  */ function get() {
28107
- this._checkBlendShapeWeightLength();
28108
- return this._blendShapeWeights;
28385
+ return this._isActive;
28109
28386
  },
28110
28387
  set: function set(value) {
28111
- this._checkBlendShapeWeightLength();
28112
- var blendShapeWeights = this._blendShapeWeights;
28113
- if (value.length <= blendShapeWeights.length) {
28114
- blendShapeWeights.set(value);
28115
- } else {
28116
- for(var i = 0, n = blendShapeWeights.length; i < n; i++){
28117
- blendShapeWeights[i] = value[i];
28388
+ if (value !== this._isActive) {
28389
+ this._isActive = value;
28390
+ if (value) {
28391
+ var parent = this._parent;
28392
+ var activeChangeFlag = ActiveChangeFlag.None;
28393
+ if (this._isRoot && this._scene._isActiveInEngine) {
28394
+ activeChangeFlag |= ActiveChangeFlag.All;
28395
+ } else {
28396
+ (parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
28397
+ (parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
28398
+ }
28399
+ activeChangeFlag && this._processActive(activeChangeFlag);
28400
+ } else {
28401
+ var activeChangeFlag1 = ActiveChangeFlag.None;
28402
+ this._isActiveInHierarchy && (activeChangeFlag1 |= ActiveChangeFlag.Hierarchy);
28403
+ this._isActiveInScene && (activeChangeFlag1 |= ActiveChangeFlag.Scene);
28404
+ activeChangeFlag1 && this._processInActive(activeChangeFlag1);
28118
28405
  }
28119
28406
  }
28120
28407
  }
28121
28408
  },
28122
28409
  {
28123
- key: "localBounds",
28410
+ key: "isActiveInHierarchy",
28124
28411
  get: /**
28125
- * Local bounds.
28412
+ * Whether it is active in the hierarchy.
28126
28413
  */ function get() {
28127
- return this._localBounds;
28128
- },
28129
- set: function set(value) {
28130
- if (this._localBounds !== value) {
28131
- this._localBounds.copyFrom(value);
28132
- }
28414
+ return this._isActiveInHierarchy;
28133
28415
  }
28134
28416
  },
28135
28417
  {
28136
- key: "rootBone",
28418
+ key: "parent",
28137
28419
  get: /**
28138
- * @deprecated use {@link SkinnedMeshRenderer.skin.rootBone} instead.
28420
+ * The parent entity.
28139
28421
  */ function get() {
28140
- return this.skin.rootBone;
28422
+ return this._parent;
28141
28423
  },
28142
28424
  set: function set(value) {
28143
- this.skin.rootBone = value;
28425
+ this._setParent(value);
28144
28426
  }
28145
28427
  },
28146
28428
  {
28147
- key: "bones",
28429
+ key: "children",
28148
28430
  get: /**
28149
- * @deprecated use {@link SkinnedMeshRenderer.skin.bones} instead.
28431
+ * The children entities
28150
28432
  */ function get() {
28151
- return this.skin.bones;
28152
- },
28153
- set: function set(value) {
28154
- this.skin.bones = value;
28155
- }
28156
- }
28157
- ]);
28158
- return SkinnedMeshRenderer;
28159
- }(MeshRenderer);
28160
- // @TODO: different shader type should use different count, not always 48
28161
- /** @internal */ SkinnedMeshRenderer._baseVertexUniformVectorCount = 48;
28162
- SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
28163
- SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
28164
- SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
28165
- __decorate$1([
28166
- ignoreClone
28167
- ], SkinnedMeshRenderer.prototype, "_condensedBlendShapeWeights", void 0);
28168
- __decorate$1([
28169
- deepClone
28170
- ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
28171
- __decorate$1([
28172
- ignoreClone
28173
- ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
28174
- __decorate$1([
28175
- ignoreClone
28176
- ], SkinnedMeshRenderer.prototype, "_blendShapeWeights", void 0);
28177
- __decorate$1([
28178
- ignoreClone
28179
- ], SkinnedMeshRenderer.prototype, "_maxVertexUniformVectors", void 0);
28180
- __decorate$1([
28181
- ignoreClone
28182
- ], SkinnedMeshRenderer.prototype, "_jointTexture", void 0);
28183
- __decorate$1([
28184
- deepClone
28185
- ], SkinnedMeshRenderer.prototype, "_skin", void 0);
28186
- __decorate$1([
28187
- ignoreClone
28188
- ], SkinnedMeshRenderer.prototype, "_onLocalBoundsChanged", null);
28189
- __decorate$1([
28190
- ignoreClone
28191
- ], SkinnedMeshRenderer.prototype, "_onSkinUpdated", null);
28192
- /**
28193
- * @internal
28194
- */ var BasicResources = /*#__PURE__*/ function() {
28195
- function BasicResources(engine) {
28196
- this.engine = engine;
28197
- // prettier-ignore
28198
- var vertices = new Float32Array([
28199
- -1,
28200
- -1,
28201
- 0,
28202
- 1,
28203
- 3,
28204
- -1,
28205
- 2,
28206
- 1,
28207
- -1,
28208
- 3,
28209
- 0,
28210
- -1
28211
- ]); // left-top
28212
- // prettier-ignore
28213
- var flipYVertices = new Float32Array([
28214
- 3,
28215
- -1,
28216
- 2,
28217
- 0,
28218
- -1,
28219
- -1,
28220
- 0,
28221
- 0,
28222
- -1,
28223
- 3,
28224
- 0,
28225
- 2
28226
- ]); // left-top
28227
- var blitMaterial = new Material(engine, Shader.find("blit"));
28228
- blitMaterial._addReferCount(1);
28229
- blitMaterial.renderState.depthState.enabled = false;
28230
- blitMaterial.renderState.depthState.writeEnabled = false;
28231
- var blitScreenMaterial = new Material(engine, Shader.find("blit-screen"));
28232
- blitScreenMaterial._addReferCount(1);
28233
- blitScreenMaterial.renderState.depthState.enabled = false;
28234
- blitScreenMaterial.renderState.depthState.writeEnabled = false;
28235
- this.blitMaterial = blitMaterial;
28236
- this.blitScreenMaterial = blitScreenMaterial;
28237
- this.blitMesh = this._createBlitMesh(engine, vertices);
28238
- this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
28239
- // Create white and magenta textures
28240
- var whitePixel = new Uint8Array([
28241
- 255,
28242
- 255,
28243
- 255,
28244
- 255
28245
- ]);
28246
- this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
28247
- this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
28248
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
28249
- if (isWebGL2) {
28250
- this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
28251
- var whitePixel32 = new Uint32Array([
28252
- 255,
28253
- 255,
28254
- 255,
28255
- 255
28256
- ]);
28257
- this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
28258
- }
28259
- this.spriteDefaultMaterial = this._create2DMaterial(engine, Shader.find("Sprite"));
28260
- this.textDefaultMaterial = this._create2DMaterial(engine, Shader.find("Text"));
28261
- this.spriteMaskDefaultMaterial = this._createSpriteMaskMaterial(engine);
28262
- this.meshMagentaMaterial = this._createMagentaMaterial(engine, "unlit");
28263
- this.particleMagentaMaterial = this._createMagentaMaterial(engine, "particle-shader");
28264
- }
28265
- var _proto = BasicResources.prototype;
28266
- /**
28267
- * @internal
28268
- */ _proto._getBlinnPhongMaterial = function _getBlinnPhongMaterial() {
28269
- return this._blinnPhongMaterial || (this._blinnPhongMaterial = new BlinnPhongMaterial(this.engine));
28270
- };
28271
- /**
28272
- * @internal
28273
- */ _proto._initialize = function _initialize() {
28274
- var _this = this;
28275
- return new Promise(function(resolve, reject) {
28276
- PrefilteredDFG.create(_this.engine).then(function(texture) {
28277
- _this._prefilteredDFGTexture = texture;
28278
- resolve(_this);
28279
- }).catch(reject);
28280
- });
28281
- };
28282
- _proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
28283
- var mesh = new ModelMesh(engine);
28284
- mesh._addReferCount(1);
28285
- mesh.setVertexElements([
28286
- new VertexElement("POSITION_UV", 0, VertexElementFormat.Vector4, 0)
28287
- ]);
28288
- var buffer = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices, BufferUsage.Static, true);
28289
- mesh.setVertexBufferBinding(buffer, 16);
28290
- mesh.addSubMesh(0, 3, MeshTopology.Triangles);
28291
- engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
28292
- _inherits$2(_class, ContentRestorer);
28293
- function _class() {
28294
- return ContentRestorer.call(this, mesh) || this;
28295
- }
28296
- var _proto = _class.prototype;
28297
- _proto.restoreContent = function restoreContent() {
28298
- buffer.setData(buffer.data);
28299
- };
28300
- return _class;
28301
- }(ContentRestorer))());
28302
- return mesh;
28303
- };
28304
- _proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel, isSRGBColorSpace) {
28305
- var texture;
28306
- switch(type){
28307
- case 0:
28308
- var texture2D = new Texture2D(engine, 1, 1, format, false, isSRGBColorSpace);
28309
- texture2D.setPixelBuffer(pixel);
28310
- texture = texture2D;
28311
- break;
28312
- case 2:
28313
- var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false, isSRGBColorSpace);
28314
- texture2DArray.setPixelBuffer(0, pixel);
28315
- texture = texture2DArray;
28316
- break;
28317
- case 1:
28318
- var textureCube = new TextureCube(engine, 1, format, false, isSRGBColorSpace);
28319
- for(var i = 0; i < 6; i++){
28320
- textureCube.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
28321
- }
28322
- texture = textureCube;
28323
- break;
28324
- default:
28325
- throw "Invalid texture type";
28326
- }
28327
- texture.isGCIgnored = true;
28328
- engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
28329
- _inherits$2(_class, ContentRestorer);
28330
- function _class() {
28331
- return ContentRestorer.call(this, texture) || this;
28332
- }
28333
- var _proto = _class.prototype;
28334
- _proto.restoreContent = function restoreContent() {
28335
- switch(type){
28336
- case 0:
28337
- this.resource.setPixelBuffer(pixel);
28338
- break;
28339
- case 2:
28340
- this.resource.setPixelBuffer(0, pixel);
28341
- break;
28342
- case 1:
28343
- for(var i = 0; i < 6; i++){
28344
- this.resource.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
28345
- }
28346
- break;
28347
- }
28348
- };
28349
- return _class;
28350
- }(ContentRestorer))());
28351
- return texture;
28352
- };
28353
- _proto._create2DMaterial = function _create2DMaterial(engine, shader) {
28354
- var material = new Material(engine, shader);
28355
- var renderState = material.renderState;
28356
- var target = renderState.blendState.targetBlendState;
28357
- target.enabled = true;
28358
- target.sourceColorBlendFactor = BlendFactor.SourceAlpha;
28359
- target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
28360
- target.sourceAlphaBlendFactor = BlendFactor.One;
28361
- target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
28362
- target.colorBlendOperation = target.alphaBlendOperation = BlendOperation.Add;
28363
- renderState.depthState.writeEnabled = false;
28364
- renderState.rasterState.cullMode = CullMode.Off;
28365
- renderState.renderQueueType = RenderQueueType.Transparent;
28366
- material.isGCIgnored = true;
28367
- return material;
28368
- };
28369
- _proto._createMagentaMaterial = function _createMagentaMaterial(engine, shaderName) {
28370
- var material = new Material(engine, Shader.find(shaderName));
28371
- material.isGCIgnored = true;
28372
- material.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
28373
- return material;
28374
- };
28375
- _proto._createSpriteMaskMaterial = function _createSpriteMaskMaterial(engine) {
28376
- var material = new Material(engine, Shader.find("SpriteMask"));
28377
- material.isGCIgnored = true;
28378
- return material;
28379
- };
28380
- BasicResources.getMaskInteractionRenderStates = function getMaskInteractionRenderStates(maskInteraction) {
28381
- var visibleInsideMask = maskInteraction === SpriteMaskInteraction.VisibleInsideMask;
28382
- var renderStates;
28383
- var compareFunction;
28384
- if (visibleInsideMask) {
28385
- renderStates = BasicResources._maskReadInsideRenderStates;
28386
- if (renderStates) {
28387
- return renderStates;
28388
- }
28389
- BasicResources._maskReadInsideRenderStates = renderStates = {};
28390
- compareFunction = CompareFunction.LessEqual;
28391
- } else {
28392
- renderStates = BasicResources._maskReadOutsideRenderStates;
28393
- if (renderStates) {
28394
- return renderStates;
28433
+ return this._children;
28395
28434
  }
28396
- BasicResources._maskReadOutsideRenderStates = renderStates = {};
28397
- compareFunction = CompareFunction.Greater;
28398
- }
28399
- renderStates[RenderStateElementKey.StencilStateEnabled] = true;
28400
- renderStates[RenderStateElementKey.StencilStateWriteMask] = 0x00;
28401
- renderStates[RenderStateElementKey.StencilStateReferenceValue] = 1;
28402
- renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = compareFunction;
28403
- renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = compareFunction;
28404
- return renderStates;
28405
- };
28406
- BasicResources.getMaskTypeRenderStates = function getMaskTypeRenderStates(maskType) {
28407
- var isIncrement = maskType === RenderQueueMaskType.Increment;
28408
- var renderStates;
28409
- var passOperation;
28410
- if (isIncrement) {
28411
- renderStates = BasicResources._maskWriteIncrementRenderStates;
28412
- if (renderStates) {
28413
- return renderStates;
28435
+ },
28436
+ {
28437
+ key: "childCount",
28438
+ get: /**
28439
+ * @deprecated Please use `children.length` property instead.
28440
+ * Number of the children entities
28441
+ */ function get() {
28442
+ return this._children.length;
28414
28443
  }
28415
- BasicResources._maskWriteIncrementRenderStates = renderStates = {};
28416
- passOperation = StencilOperation.IncrementSaturate;
28417
- } else {
28418
- renderStates = BasicResources._maskWriteDecrementRenderStates;
28419
- if (renderStates) {
28420
- return renderStates;
28444
+ },
28445
+ {
28446
+ key: "scene",
28447
+ get: /**
28448
+ * The scene the entity belongs to.
28449
+ */ function get() {
28450
+ return this._scene;
28421
28451
  }
28422
- BasicResources._maskWriteDecrementRenderStates = renderStates = {};
28423
- passOperation = StencilOperation.DecrementSaturate;
28424
- }
28425
- renderStates[RenderStateElementKey.StencilStateEnabled] = true;
28426
- renderStates[RenderStateElementKey.StencilStatePassOperationFront] = passOperation;
28427
- renderStates[RenderStateElementKey.StencilStatePassOperationBack] = passOperation;
28428
- renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = CompareFunction.Always;
28429
- renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = CompareFunction.Always;
28430
- var failStencilOperation = StencilOperation.Keep;
28431
- renderStates[RenderStateElementKey.StencilStateFailOperationFront] = failStencilOperation;
28432
- renderStates[RenderStateElementKey.StencilStateFailOperationBack] = failStencilOperation;
28433
- renderStates[RenderStateElementKey.StencilStateZFailOperationFront] = failStencilOperation;
28434
- renderStates[RenderStateElementKey.StencilStateZFailOperationBack] = failStencilOperation;
28435
- renderStates[RenderStateElementKey.BlendStateColorWriteMask0] = ColorWriteMask.None;
28436
- renderStates[RenderStateElementKey.DepthStateEnabled] = false;
28437
- renderStates[RenderStateElementKey.RasterStateCullMode] = CullMode.Off;
28438
- return renderStates;
28439
- };
28440
- _create_class$2(BasicResources, [
28452
+ },
28441
28453
  {
28442
- key: "prefilteredDFGTexture",
28443
- get: function get() {
28444
- return this._prefilteredDFGTexture;
28454
+ key: "siblingIndex",
28455
+ get: /**
28456
+ * The sibling index.
28457
+ */ function get() {
28458
+ return this._siblingIndex;
28459
+ },
28460
+ set: function set(value) {
28461
+ if (this._siblingIndex === -1) {
28462
+ throw "The entity " + this.name + " is not in the hierarchy";
28463
+ }
28464
+ if (this._isRoot) {
28465
+ this._setSiblingIndex(this._scene._rootEntities, value);
28466
+ } else {
28467
+ var parent = this._parent;
28468
+ this._setSiblingIndex(parent._children, value);
28469
+ parent._dispatchModify(EntityModifyFlags.Child, parent);
28470
+ }
28445
28471
  }
28446
28472
  }
28447
28473
  ]);
28448
- return BasicResources;
28449
- }();
28450
- BasicResources._maskReadInsideRenderStates = null;
28451
- BasicResources._maskReadOutsideRenderStates = null;
28452
- BasicResources._maskWriteIncrementRenderStates = null;
28453
- BasicResources._maskWriteDecrementRenderStates = null;
28474
+ return Entity;
28475
+ }(EngineObject);
28476
+ /** @internal */ Entity._tempComponentConstructors = [];
28454
28477
  var ObjectPool = /*#__PURE__*/ function() {
28455
28478
  function ObjectPool(type) {
28456
28479
  this._type = type;
@@ -28937,6 +28960,7 @@
28937
28960
  /** AudioClip, include ogg, wav and mp3. */ AssetType["Audio"] = "Audio";
28938
28961
  /** Project asset. */ AssetType["Project"] = "project";
28939
28962
  /** PhysicsMaterial. */ AssetType["PhysicsMaterial"] = "PhysicsMaterial";
28963
+ /** RenderTarget. */ AssetType["RenderTarget"] = "RenderTarget";
28940
28964
  return AssetType;
28941
28965
  }({});
28942
28966
  var SafeLoopArray = /*#__PURE__*/ function() {
@@ -33726,6 +33750,183 @@
33726
33750
  PointerMethods["onPointerDrop"] = "onPointerDrop";
33727
33751
  return PointerMethods;
33728
33752
  }({});
33753
+ /**
33754
+ * Signal is a typed event mechanism for Galacean Engine.
33755
+ * @typeParam T - Tuple type of the signal arguments
33756
+ */ var Signal = /*#__PURE__*/ function() {
33757
+ function Signal() {
33758
+ this._listeners = new SafeLoopArray();
33759
+ }
33760
+ var _proto = Signal.prototype;
33761
+ _proto.on = function on(fnOrTarget, targetOrMethodName) {
33762
+ for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
33763
+ args[_key - 2] = arguments[_key];
33764
+ }
33765
+ this._addListener.apply(this, [].concat([
33766
+ fnOrTarget,
33767
+ targetOrMethodName,
33768
+ false
33769
+ ], args));
33770
+ };
33771
+ _proto.once = function once(fnOrTarget, targetOrMethodName) {
33772
+ for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
33773
+ args[_key - 2] = arguments[_key];
33774
+ }
33775
+ this._addListener.apply(this, [].concat([
33776
+ fnOrTarget,
33777
+ targetOrMethodName,
33778
+ true
33779
+ ], args));
33780
+ };
33781
+ _proto.off = function off(fnOrTarget, targetOrMethodName) {
33782
+ if (typeof fnOrTarget === "function") {
33783
+ var target = targetOrMethodName != null ? targetOrMethodName : null;
33784
+ this._listeners.findAndRemove(function(listener) {
33785
+ if (listener.fn === fnOrTarget && listener.target === target) {
33786
+ listener.destroyed = true;
33787
+ return true;
33788
+ }
33789
+ return false;
33790
+ });
33791
+ } else {
33792
+ var target1 = fnOrTarget;
33793
+ var methodName = targetOrMethodName;
33794
+ this._listeners.findAndRemove(function(listener) {
33795
+ if (listener.target === target1 && listener.methodName === methodName) {
33796
+ listener.destroyed = true;
33797
+ return true;
33798
+ }
33799
+ return false;
33800
+ });
33801
+ }
33802
+ };
33803
+ /**
33804
+ * Remove all listeners, or all listeners for a specific target.
33805
+ * @param target - If provided, only remove listeners bound to this target
33806
+ */ _proto.removeAll = function removeAll(target) {
33807
+ if (target !== undefined) {
33808
+ this._listeners.findAndRemove(function(listener) {
33809
+ if (listener.target === target) {
33810
+ return listener.destroyed = true;
33811
+ }
33812
+ return false;
33813
+ });
33814
+ } else {
33815
+ this._listeners.findAndRemove(function(listener) {
33816
+ return listener.destroyed = true;
33817
+ });
33818
+ }
33819
+ };
33820
+ /**
33821
+ * Invoke the signal, calling all listeners in order.
33822
+ * @param args - Arguments to pass to each listener
33823
+ */ _proto.invoke = function invoke() {
33824
+ var _this, _loop = function _loop(i, n) {
33825
+ var listener = listeners[i];
33826
+ if (listener.destroyed) return "continue";
33827
+ if (listener.methodName && listener.target.destroyed) {
33828
+ listener.destroyed = true;
33829
+ _this._listeners.findAndRemove(function(l) {
33830
+ return l === listener;
33831
+ });
33832
+ return "continue";
33833
+ }
33834
+ listener.fn.apply(listener.target, args);
33835
+ if (listener.once) {
33836
+ listener.destroyed = true;
33837
+ _this._listeners.findAndRemove(function(l) {
33838
+ return l === listener;
33839
+ });
33840
+ }
33841
+ };
33842
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
33843
+ args[_key] = arguments[_key];
33844
+ }
33845
+ var listeners = this._listeners.getLoopArray();
33846
+ for(var i = 0, n = listeners.length; i < n; i++)_this = this, _loop(i);
33847
+ };
33848
+ /**
33849
+ * @internal
33850
+ * Clone listeners to target signal, remapping entity/component references.
33851
+ */ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
33852
+ var listeners = this._listeners.getLoopArray();
33853
+ for(var i = 0, n = listeners.length; i < n; i++){
33854
+ var listener = listeners[i];
33855
+ if (listener.destroyed || !listener.methodName) continue;
33856
+ var clonedTarget = CloneUtils.remapComponent(srcRoot, targetRoot, listener.target);
33857
+ if (clonedTarget) {
33858
+ var clonedArgs = this._cloneArguments(listener.arguments, srcRoot, targetRoot);
33859
+ if (listener.once) {
33860
+ var _target;
33861
+ (_target = target).once.apply(_target, [].concat([
33862
+ clonedTarget,
33863
+ listener.methodName
33864
+ ], clonedArgs));
33865
+ } else {
33866
+ var _target1;
33867
+ (_target1 = target).on.apply(_target1, [].concat([
33868
+ clonedTarget,
33869
+ listener.methodName
33870
+ ], clonedArgs));
33871
+ }
33872
+ }
33873
+ }
33874
+ };
33875
+ _proto._cloneArguments = function _cloneArguments(args, srcRoot, targetRoot) {
33876
+ if (!args || args.length === 0) return [];
33877
+ var len = args.length;
33878
+ var clonedArgs = new Array(len);
33879
+ for(var i = 0; i < len; i++){
33880
+ var arg = args[i];
33881
+ if (_instanceof1$2(arg, Entity)) {
33882
+ clonedArgs[i] = CloneUtils.remapEntity(srcRoot, targetRoot, arg);
33883
+ } else if (_instanceof1$2(arg, Component)) {
33884
+ clonedArgs[i] = CloneUtils.remapComponent(srcRoot, targetRoot, arg);
33885
+ } else {
33886
+ clonedArgs[i] = arg;
33887
+ }
33888
+ }
33889
+ return clonedArgs;
33890
+ };
33891
+ _proto._addListener = function _addListener(fnOrTarget, targetOrMethodName, once) {
33892
+ for(var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++){
33893
+ args[_key - 3] = arguments[_key];
33894
+ }
33895
+ if (typeof fnOrTarget === "function") {
33896
+ this._listeners.push({
33897
+ fn: fnOrTarget,
33898
+ target: targetOrMethodName != null ? targetOrMethodName : null,
33899
+ once: once
33900
+ });
33901
+ } else {
33902
+ var _target, _target1;
33903
+ var target = fnOrTarget;
33904
+ var methodName = targetOrMethodName;
33905
+ var fn = args.length > 0 ? function fn() {
33906
+ for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
33907
+ signalArgs[_key] = arguments[_key];
33908
+ }
33909
+ return (_target = target)[methodName].apply(_target, [].concat(args, signalArgs));
33910
+ } : function() {
33911
+ for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
33912
+ signalArgs[_key] = arguments[_key];
33913
+ }
33914
+ return (_target1 = target)[methodName].apply(_target1, [].concat(signalArgs));
33915
+ };
33916
+ this._listeners.push({
33917
+ fn: fn,
33918
+ target: target,
33919
+ once: once,
33920
+ methodName: methodName,
33921
+ arguments: args
33922
+ });
33923
+ }
33924
+ };
33925
+ return Signal;
33926
+ }();
33927
+ __decorate$1([
33928
+ ignoreClone
33929
+ ], Signal.prototype, "_listeners", void 0);
33729
33930
  /**
33730
33931
  * Loader abstract class.
33731
33932
  */ var Loader = /*#__PURE__*/ function() {
@@ -43000,6 +43201,7 @@
43000
43201
  CircleShape: CircleShape,
43001
43202
  ClearableObjectPool: ClearableObjectPool,
43002
43203
  CloneManager: CloneManager,
43204
+ CloneUtils: CloneUtils,
43003
43205
  get Collider () { return exports.Collider; },
43004
43206
  ColliderShape: ColliderShape,
43005
43207
  ColliderShapeUpAxis: ColliderShapeUpAxis,
@@ -43156,6 +43358,7 @@
43156
43358
  ShadowCascadesMode: ShadowCascadesMode,
43157
43359
  ShadowResolution: ShadowResolution,
43158
43360
  ShadowType: ShadowType,
43361
+ Signal: Signal,
43159
43362
  get SimpleSpriteAssembler () { return exports.SimpleSpriteAssembler; },
43160
43363
  SizeOverLifetimeModule: SizeOverLifetimeModule,
43161
43364
  Skin: Skin,
@@ -44112,7 +44315,7 @@
44112
44315
  return {
44113
44316
  internalFormat: isSRGBColorSpace ? gl.SRGB8 : isWebGL2 ? gl.RGB8 : gl.RGB,
44114
44317
  baseFormat: isSRGBColorSpace ? isWebGL2 ? gl.RGB : gl.SRGB8 : gl.RGB,
44115
- readFormat: gl.RGB,
44318
+ readFormat: isWebGL2 ? gl.RGBA : gl.RGB,
44116
44319
  dataType: gl.UNSIGNED_BYTE,
44117
44320
  isCompressed: false,
44118
44321
  alignment: 1
@@ -44187,6 +44390,7 @@
44187
44390
  return {
44188
44391
  internalFormat: gl.R11F_G11F_B10F,
44189
44392
  baseFormat: gl.RGB,
44393
+ readFormat: gl.RGBA,
44190
44394
  dataType: gl.FLOAT,
44191
44395
  isCompressed: false,
44192
44396
  alignment: 4
@@ -46237,9 +46441,7 @@
46237
46441
  for(var key in item.props)_this = this, _loop(key);
46238
46442
  }
46239
46443
  return Promise.all(promises).then(function() {
46240
- var handle = ReflectionParser.customParseComponentHandles[instance.constructor.name];
46241
- if (handle) return handle(instance, item);
46242
- else return instance;
46444
+ return instance;
46243
46445
  });
46244
46446
  };
46245
46447
  _proto.parseMethod = function parseMethod(instance, methodName, methodParams) {
@@ -46258,6 +46460,29 @@
46258
46460
  }
46259
46461
  });
46260
46462
  };
46463
+ _proto.parseSignal = function parseSignal(signalRef) {
46464
+ var _this = this;
46465
+ var signal = new Signal();
46466
+ return Promise.all(signalRef.listeners.map(function(listener) {
46467
+ return Promise.all([
46468
+ _this.parseBasicType(listener.target),
46469
+ listener.arguments ? Promise.all(listener.arguments.map(function(a) {
46470
+ return _this.parseBasicType(a);
46471
+ })) : Promise.resolve([])
46472
+ ]).then(function(param) {
46473
+ var target = param[0], resolvedArgs = param[1];
46474
+ if (target) {
46475
+ var _signal;
46476
+ (_signal = signal).on.apply(_signal, [].concat([
46477
+ target,
46478
+ listener.methodName
46479
+ ], resolvedArgs));
46480
+ }
46481
+ });
46482
+ })).then(function() {
46483
+ return signal;
46484
+ });
46485
+ };
46261
46486
  _proto.parseBasicType = function parseBasicType(value, originValue) {
46262
46487
  var _this = this;
46263
46488
  if (Array.isArray(value)) {
@@ -46287,6 +46512,8 @@
46287
46512
  } else if (ReflectionParser._isEntityRef(value)) {
46288
46513
  // entity reference
46289
46514
  return Promise.resolve(this._context.entityMap.get(value.entityId));
46515
+ } else if (ReflectionParser._isSignalRef(value)) {
46516
+ return this.parseSignal(value);
46290
46517
  } else if (originValue) {
46291
46518
  var _this2, _loop = function _loop(key) {
46292
46519
  if (key === "methods") {
@@ -46342,9 +46569,6 @@
46342
46569
  return Promise.resolve(entity);
46343
46570
  }
46344
46571
  };
46345
- ReflectionParser.registerCustomParseComponent = function registerCustomParseComponent(componentType, handle) {
46346
- this.customParseComponentHandles[componentType] = handle;
46347
- };
46348
46572
  ReflectionParser._isClass = function _isClass(value) {
46349
46573
  return value["class"] !== undefined;
46350
46574
  };
@@ -46360,12 +46584,14 @@
46360
46584
  ReflectionParser._isComponentRef = function _isComponentRef(value) {
46361
46585
  return value["ownerId"] !== undefined && value["componentId"] !== undefined;
46362
46586
  };
46587
+ ReflectionParser._isSignalRef = function _isSignalRef(value) {
46588
+ return value["listeners"] !== undefined;
46589
+ };
46363
46590
  ReflectionParser._isMethodObject = function _isMethodObject(value) {
46364
46591
  return Array.isArray(value == null ? void 0 : value.params);
46365
46592
  };
46366
46593
  return ReflectionParser;
46367
46594
  }();
46368
- ReflectionParser.customParseComponentHandles = new Map();
46369
46595
  exports.Texture2DDecoder = /*#__PURE__*/ function() {
46370
46596
  function Texture2DDecoder() {}
46371
46597
  Texture2DDecoder.decode = function decode(engine, bufferReader, restoredTexture) {
@@ -52019,6 +52245,53 @@
52019
52245
  "physMat"
52020
52246
  ])
52021
52247
  ], PhysicsMaterialLoader);
52248
+ var RenderTargetLoader = /*#__PURE__*/ function(Loader) {
52249
+ _inherits(RenderTargetLoader, Loader);
52250
+ function RenderTargetLoader() {
52251
+ return Loader.apply(this, arguments) || this;
52252
+ }
52253
+ var _proto = RenderTargetLoader.prototype;
52254
+ _proto.load = function load(item, resourceManager) {
52255
+ var engine = resourceManager.engine;
52256
+ return resourceManager // @ts-ignore
52257
+ ._request(item.url, _extends({}, item, {
52258
+ type: "json"
52259
+ })).then(function(data) {
52260
+ var width = data.width, height = data.height, colorFormats = data.colorFormats, depthFormat = data.depthFormat, antiAliasing = data.antiAliasing, autoGenerateMipmaps = data.autoGenerateMipmaps;
52261
+ var colorTextureProps = data.colorTextures;
52262
+ var colorTextures = colorFormats.map(function(format, i) {
52263
+ var props = colorTextureProps == null ? void 0 : colorTextureProps[i];
52264
+ var _props_mipmap;
52265
+ var mipmap = (_props_mipmap = props == null ? void 0 : props.mipmap) != null ? _props_mipmap : true;
52266
+ var _props_isSRGBColorSpace;
52267
+ var isSRGB = (_props_isSRGBColorSpace = props == null ? void 0 : props.isSRGBColorSpace) != null ? _props_isSRGBColorSpace : format === TextureFormat.R8G8B8A8;
52268
+ var texture = new Texture2D(engine, width, height, format, mipmap, isSRGB);
52269
+ if (props) {
52270
+ if (props.filterMode != null) texture.filterMode = props.filterMode;
52271
+ if (props.wrapModeU != null) texture.wrapModeU = props.wrapModeU;
52272
+ if (props.wrapModeV != null) texture.wrapModeV = props.wrapModeV;
52273
+ if (props.anisoLevel != null) texture.anisoLevel = props.anisoLevel;
52274
+ }
52275
+ return texture;
52276
+ });
52277
+ var depth = depthFormat === -1 ? null : depthFormat;
52278
+ var rt = new RenderTarget(engine, width, height, colorTextures, depth, antiAliasing);
52279
+ if (autoGenerateMipmaps != null) rt.autoGenerateMipmaps = autoGenerateMipmaps;
52280
+ // Notify pending sub-asset requests for colorTextures
52281
+ for(var i = 0, n = colorTextures.length; i < n; i++){
52282
+ // @ts-ignore
52283
+ resourceManager._onSubAssetSuccess(item.url, "colorTextures[" + i + "]", colorTextures[i]);
52284
+ }
52285
+ return rt;
52286
+ });
52287
+ };
52288
+ return RenderTargetLoader;
52289
+ }(Loader);
52290
+ RenderTargetLoader = __decorate([
52291
+ resourceLoader(AssetType.RenderTarget, [
52292
+ "renderTarget"
52293
+ ])
52294
+ ], RenderTargetLoader);
52022
52295
  var SceneLoader = /*#__PURE__*/ function(Loader) {
52023
52296
  _inherits(SceneLoader, Loader);
52024
52297
  function SceneLoader() {
@@ -52159,20 +52432,6 @@
52159
52432
  "scene"
52160
52433
  ], true)
52161
52434
  ], SceneLoader);
52162
- ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item) {
52163
- var props;
52164
- return __generator(this, function(_state) {
52165
- props = item.props;
52166
- if (!props.font) {
52167
- // @ts-ignore
52168
- instance.font = Font.createFromOS(instance.engine, props.fontFamily || "Arial");
52169
- }
52170
- return [
52171
- 2,
52172
- instance
52173
- ];
52174
- });
52175
- }));
52176
52435
  var KHR_lights_punctual = /*#__PURE__*/ function(GLTFExtensionParser) {
52177
52436
  _inherits(KHR_lights_punctual, GLTFExtensionParser);
52178
52437
  function KHR_lights_punctual() {
@@ -52667,7 +52926,7 @@
52667
52926
  ], EXT_texture_webp);
52668
52927
 
52669
52928
  //@ts-ignore
52670
- var version = "2.0.0-alpha.13";
52929
+ var version = "2.0.0-alpha.15";
52671
52930
  console.log("Galacean Engine Version: " + version);
52672
52931
  for(var key in CoreObjects){
52673
52932
  Loader.registerClass(key, CoreObjects[key]);
@@ -52740,6 +52999,7 @@
52740
52999
  exports.CircleShape = CircleShape;
52741
53000
  exports.ClearableObjectPool = ClearableObjectPool;
52742
53001
  exports.CloneManager = CloneManager;
53002
+ exports.CloneUtils = CloneUtils;
52743
53003
  exports.ColliderShape = ColliderShape;
52744
53004
  exports.ColliderShapeUpAxis = ColliderShapeUpAxis;
52745
53005
  exports.Collision = Collision;
@@ -52925,6 +53185,7 @@
52925
53185
  exports.ShadowCascadesMode = ShadowCascadesMode;
52926
53186
  exports.ShadowResolution = ShadowResolution;
52927
53187
  exports.ShadowType = ShadowType;
53188
+ exports.Signal = Signal;
52928
53189
  exports.SizeOverLifetimeModule = SizeOverLifetimeModule;
52929
53190
  exports.Skin = Skin;
52930
53191
  exports.SkinnedMeshRenderer = SkinnedMeshRenderer;