@galacean/engine 1.0.0-beta.13 → 1.0.0-beta.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
@@ -14226,6 +14226,7 @@
14226
14226
  /**
14227
14227
  * @override
14228
14228
  */ _proto._onDestroy = function _onDestroy() {
14229
+ ReferResource.prototype._onDestroy.call(this);
14229
14230
  this._shader = null;
14230
14231
  this._shaderData = null;
14231
14232
  this._renderStates.length = 0;
@@ -20075,10 +20076,10 @@
20075
20076
  var vertexElements = [];
20076
20077
  var vertexStride = this.createVertexElements(vertexElements);
20077
20078
  // vertices
20078
- var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
20079
+ var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * vertexStride, exports.BufferUsage.Dynamic);
20079
20080
  vertexBuffer.isGCIgnored = true;
20080
20081
  // indices
20081
- var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
20082
+ var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 6, exports.BufferUsage.Dynamic);
20082
20083
  indiceBuffer.isGCIgnored = true;
20083
20084
  mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
20084
20085
  mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
@@ -27237,6 +27238,7 @@
27237
27238
  curKeyframeIndex: 0,
27238
27239
  value: null
27239
27240
  };
27241
+ this.updateMark = 0;
27240
27242
  this.target = target;
27241
27243
  this.type = type;
27242
27244
  this.property = property;
@@ -28678,9 +28680,9 @@
28678
28680
  _this = Component.call(this, entity) || this;
28679
28681
  /** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
28680
28682
  /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
28683
+ _this._updateMark = 0;
28681
28684
  _this._animatorLayersData = [];
28682
28685
  _this._curveOwnerPool = Object.create(null);
28683
- _this._needRevertCurveOwners = [];
28684
28686
  _this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
28685
28687
  _this._tempAnimatorStateInfo = {
28686
28688
  layerIndex: -1,
@@ -28709,10 +28711,10 @@
28709
28711
  return;
28710
28712
  }
28711
28713
  if (!state.clip) {
28712
- console.warn("The state named " + stateName + " has no AnimationClip data.");
28714
+ Logger.warn("The state named " + stateName + " has no AnimationClip data.");
28713
28715
  return;
28714
28716
  }
28715
- var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
28717
+ var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
28716
28718
  var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
28717
28719
  this._preparePlay(animatorLayerData, state);
28718
28720
  animatorLayerData.layerState = LayerState.Playing;
@@ -28731,8 +28733,8 @@
28731
28733
  if ((_this__controllerUpdateFlag = this._controllerUpdateFlag) == null ? void 0 : _this__controllerUpdateFlag.flag) {
28732
28734
  this._reset();
28733
28735
  }
28734
- var state = this._getAnimatorStateInfo(stateName, layerIndex).state;
28735
- var manuallyTransition = this._getAnimatorLayerData(layerIndex).manuallyTransition;
28736
+ var _this__getAnimatorStateInfo = this._getAnimatorStateInfo(stateName, layerIndex), state = _this__getAnimatorStateInfo.state, playLayerIndex = _this__getAnimatorStateInfo.layerIndex;
28737
+ var manuallyTransition = this._getAnimatorLayerData(playLayerIndex).manuallyTransition;
28736
28738
  manuallyTransition.duration = normalizedTransitionDuration;
28737
28739
  manuallyTransition.offset = normalizedTimeOffset;
28738
28740
  manuallyTransition.destinationState = state;
@@ -28765,7 +28767,7 @@
28765
28767
  return;
28766
28768
  }
28767
28769
  deltaTime *= this.speed;
28768
- this._revertCurveOwners();
28770
+ this._updateMark++;
28769
28771
  for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
28770
28772
  var animatorLayerData = this._getAnimatorLayerData(i1);
28771
28773
  if (animatorLayerData.layerState === LayerState.Standby) {
@@ -28813,7 +28815,6 @@
28813
28815
  }
28814
28816
  }
28815
28817
  this._animatorLayersData.length = 0;
28816
- this._needRevertCurveOwners.length = 0;
28817
28818
  this._curveOwnerPool = {};
28818
28819
  this._animationEventHandlerPool.resetPool();
28819
28820
  if (this._controllerUpdateFlag) {
@@ -28855,8 +28856,8 @@
28855
28856
  _proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
28856
28857
  var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
28857
28858
  var curveLayerOwner = animatorStateData.curveLayerOwner;
28858
- var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
28859
28859
  var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
28860
+ var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
28860
28861
  for(var i = curves.length - 1; i >= 0; i--){
28861
28862
  var curve = curves[i];
28862
28863
  var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
@@ -28864,29 +28865,16 @@
28864
28865
  var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
28865
28866
  var property = curve.property;
28866
28867
  var instanceId = targetEntity.instanceId;
28867
- var needRevert = false;
28868
- var baseAnimatorLayerData = this._animatorLayersData[0];
28869
- var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
28870
- if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
28871
- needRevert = true;
28872
- }
28873
28868
  // Get owner
28874
28869
  var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
28875
28870
  var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
28876
- //@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
28877
- if (needRevert) {
28878
- this._needRevertCurveOwners.push(owner);
28879
- } else {
28880
- var index = this._needRevertCurveOwners.indexOf(owner);
28881
- index > -1 && this._needRevertCurveOwners.splice(index, 1);
28882
- }
28883
28871
  // Get layer owner
28884
28872
  var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
28885
28873
  var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
28886
28874
  curveLayerOwner[i] = layerOwner;
28887
28875
  } else {
28888
28876
  curveLayerOwner[i] = null;
28889
- console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
28877
+ Logger.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
28890
28878
  }
28891
28879
  }
28892
28880
  };
@@ -29012,6 +29000,7 @@
29012
29000
  if (!owner) continue;
29013
29001
  var curve = curveBindings[i].curve;
29014
29002
  if (curve.keys.length) {
29003
+ this._checkRevertOwner(owner, additive);
29015
29004
  var value = owner.evaluateValue(curve, clipTime, additive);
29016
29005
  aniUpdate && owner.applyValue(value, weight, additive);
29017
29006
  finished && layerOwner.saveFinalValue();
@@ -29057,6 +29046,7 @@
29057
29046
  if (!owner) continue;
29058
29047
  var srcCurveIndex = layerOwner.crossSrcCurveIndex;
29059
29048
  var destCurveIndex = layerOwner.crossDestCurveIndex;
29049
+ this._checkRevertOwner(owner, additive);
29060
29050
  var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
29061
29051
  aniUpdate && owner.applyValue(value, weight, additive);
29062
29052
  finished && layerOwner.saveFinalValue();
@@ -29103,6 +29093,7 @@
29103
29093
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29104
29094
  if (!owner) continue;
29105
29095
  var curveIndex = layerOwner.crossDestCurveIndex;
29096
+ this._checkRevertOwner(owner, additive);
29106
29097
  var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
29107
29098
  aniUpdate && owner.applyValue(value, weight, additive);
29108
29099
  finished && layerOwner.saveFinalValue();
@@ -29129,6 +29120,7 @@
29129
29120
  var layerOwner = curveLayerOwner[i];
29130
29121
  var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
29131
29122
  if (!owner) continue;
29123
+ this._checkRevertOwner(owner, additive);
29132
29124
  owner.applyValue(layerOwner.finalValue, weight, additive);
29133
29125
  }
29134
29126
  };
@@ -29154,16 +29146,14 @@
29154
29146
  var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
29155
29147
  for(var i = curveLayerOwner.length - 1; i >= 0; i--){
29156
29148
  var _curveLayerOwner_i;
29157
- var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
29158
- owner.revertDefaultValue();
29149
+ (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.revertDefaultValue();
29159
29150
  }
29160
29151
  }
29161
29152
  } else {
29162
29153
  // layerState is CrossFading, FixedCrossFading, Standby, Finished
29163
29154
  var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
29164
29155
  for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
29165
- var owner1 = crossLayerOwnerCollection[i1].curveOwner;
29166
- owner1.revertDefaultValue();
29156
+ crossLayerOwnerCollection[i1].curveOwner.revertDefaultValue();
29167
29157
  }
29168
29158
  }
29169
29159
  };
@@ -29186,7 +29176,7 @@
29186
29176
  return;
29187
29177
  }
29188
29178
  if (!crossState.clip) {
29189
- console.warn("The state named " + name + " has no AnimationClip data.");
29179
+ Logger.warn("The state named " + name + " has no AnimationClip data.");
29190
29180
  return;
29191
29181
  }
29192
29182
  var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
@@ -29198,12 +29188,12 @@
29198
29188
  destPlayData.reset(crossState, animatorStateData, offset);
29199
29189
  switch(layerState){
29200
29190
  case LayerState.Standby:
29191
+ case LayerState.Finished:
29201
29192
  animatorLayerData.layerState = LayerState.FixedCrossFading;
29202
29193
  this._clearCrossData(animatorLayerData);
29203
29194
  this._prepareStandbyCrossFading(animatorLayerData);
29204
29195
  break;
29205
29196
  case LayerState.Playing:
29206
- case LayerState.Finished:
29207
29197
  animatorLayerData.layerState = LayerState.CrossFading;
29208
29198
  this._clearCrossData(animatorLayerData);
29209
29199
  this._prepareCrossFading(animatorLayerData);
@@ -29300,11 +29290,11 @@
29300
29290
  }
29301
29291
  }
29302
29292
  };
29303
- _proto._revertCurveOwners = function _revertCurveOwners() {
29304
- var curveOwners = this._needRevertCurveOwners;
29305
- for(var i = 0, n = curveOwners.length; i < n; ++i){
29306
- curveOwners[i].revertDefaultValue();
29293
+ _proto._checkRevertOwner = function _checkRevertOwner(owner, additive) {
29294
+ if (additive && owner.updateMark !== this._updateMark) {
29295
+ owner.revertDefaultValue();
29307
29296
  }
29297
+ owner.updateMark = this._updateMark;
29308
29298
  };
29309
29299
  _create_class$3(Animator, [
29310
29300
  {
@@ -29334,13 +29324,13 @@
29334
29324
  ], Animator.prototype, "_controllerUpdateFlag", void 0);
29335
29325
  __decorate$1([
29336
29326
  ignoreClone
29337
- ], Animator.prototype, "_animatorLayersData", void 0);
29327
+ ], Animator.prototype, "_updateMark", void 0);
29338
29328
  __decorate$1([
29339
29329
  ignoreClone
29340
- ], Animator.prototype, "_curveOwnerPool", void 0);
29330
+ ], Animator.prototype, "_animatorLayersData", void 0);
29341
29331
  __decorate$1([
29342
29332
  ignoreClone
29343
- ], Animator.prototype, "_needRevertCurveOwners", void 0);
29333
+ ], Animator.prototype, "_curveOwnerPool", void 0);
29344
29334
  __decorate$1([
29345
29335
  ignoreClone
29346
29336
  ], Animator.prototype, "_animationEventHandlerPool", void 0);
@@ -35894,8 +35884,14 @@
35894
35884
  resourceManager.addContentRestorer(restorer);
35895
35885
  masterPromiseInfo.resolve(glTFResource);
35896
35886
  }).catch(function(e) {
35897
- console.error(e);
35898
- masterPromiseInfo.reject("Error loading glTF model from " + url + " .");
35887
+ var msg = "Error loading glTF model from " + url + " .";
35888
+ Logger.error(msg);
35889
+ masterPromiseInfo.reject(msg);
35890
+ context.defaultSceneRootPromiseInfo.reject(e);
35891
+ context.texturesPromiseInfo.reject(e);
35892
+ context.materialsPromiseInfo.reject(e);
35893
+ context.meshesPromiseInfo.reject(e);
35894
+ context.animationClipsPromiseInfo.reject(e);
35899
35895
  });
35900
35896
  return context.promiseMap;
35901
35897
  };
@@ -37417,7 +37413,7 @@
37417
37413
  decode(data, resourceManager.engine).then(function(mesh) {
37418
37414
  resolve(mesh);
37419
37415
  });
37420
- });
37416
+ }).catch(reject);
37421
37417
  });
37422
37418
  };
37423
37419
  return MeshLoader;
@@ -37435,14 +37431,14 @@
37435
37431
  var _proto = EditorTextureLoader.prototype;
37436
37432
  _proto.load = function load(item, resourceManager) {
37437
37433
  var _this = this;
37438
- return new AssetPromise(function(resolve) {
37434
+ return new AssetPromise(function(resolve, reject) {
37439
37435
  _this.request(item.url, {
37440
37436
  type: "arraybuffer"
37441
37437
  }).then(function(data) {
37442
37438
  decode(data, resourceManager.engine).then(function(texture) {
37443
37439
  resolve(texture);
37444
37440
  });
37445
- });
37441
+ }).catch(reject);
37446
37442
  });
37447
37443
  };
37448
37444
  return EditorTextureLoader;
@@ -38307,7 +38303,7 @@
38307
38303
  ], GALACEAN_animation_event);
38308
38304
 
38309
38305
  //@ts-ignore
38310
- var version = "1.0.0-beta.13";
38306
+ var version = "1.0.0-beta.15";
38311
38307
  console.log("Galacean engine version: " + version);
38312
38308
  for(var key in CoreObjects){
38313
38309
  Loader.registerClass(key, CoreObjects[key]);