@galacean/engine 1.0.0-beta.11 → 1.0.0-beta.13
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 +319 -168
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -5642,6 +5642,13 @@
|
|
|
5642
5642
|
TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 30] = "Depth24Stencil8";
|
|
5643
5643
|
TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 31] = "Depth32Stencil8";
|
|
5644
5644
|
})(exports.TextureFormat || (exports.TextureFormat = {}));
|
|
5645
|
+
/**
|
|
5646
|
+
* Texture usage.
|
|
5647
|
+
*/ exports.TextureUsage = void 0;
|
|
5648
|
+
(function(TextureUsage) {
|
|
5649
|
+
TextureUsage[TextureUsage[/** The content of the texture is intended to be specified once. */ "Static"] = 0] = "Static";
|
|
5650
|
+
TextureUsage[TextureUsage[/** The content of the texture is intended to be updated frequently, with better performance. */ "Dynamic"] = 1] = "Dynamic";
|
|
5651
|
+
})(exports.TextureUsage || (exports.TextureUsage = {}));
|
|
5645
5652
|
/**
|
|
5646
5653
|
* Wrapping mode of the texture.
|
|
5647
5654
|
*/ exports.TextureWrapMode = void 0;
|
|
@@ -5779,6 +5786,14 @@
|
|
|
5779
5786
|
return this._height;
|
|
5780
5787
|
}
|
|
5781
5788
|
},
|
|
5789
|
+
{
|
|
5790
|
+
key: "usage",
|
|
5791
|
+
get: /**
|
|
5792
|
+
* The usage of the texture.
|
|
5793
|
+
*/ function get() {
|
|
5794
|
+
return this._usage;
|
|
5795
|
+
}
|
|
5796
|
+
},
|
|
5782
5797
|
{
|
|
5783
5798
|
key: "wrapModeU",
|
|
5784
5799
|
get: /**
|
|
@@ -6019,14 +6034,16 @@
|
|
|
6019
6034
|
/**
|
|
6020
6035
|
* Two-dimensional texture.
|
|
6021
6036
|
*/ var Texture2D = /*#__PURE__*/ function(Texture) {
|
|
6022
|
-
var Texture2D = function Texture2D(engine, width, height, format, mipmap) {
|
|
6037
|
+
var Texture2D = function Texture2D(engine, width, height, format, mipmap, usage) {
|
|
6023
6038
|
if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
|
|
6024
6039
|
if (mipmap === void 0) mipmap = true;
|
|
6040
|
+
if (usage === void 0) usage = exports.TextureUsage.Static;
|
|
6025
6041
|
var _this;
|
|
6026
6042
|
_this = Texture.call(this, engine) || this;
|
|
6027
6043
|
_this._mipmap = mipmap;
|
|
6028
6044
|
_this._width = width;
|
|
6029
6045
|
_this._height = height;
|
|
6046
|
+
_this._usage = usage;
|
|
6030
6047
|
_this._format = format;
|
|
6031
6048
|
_this._mipmapCount = _this._getMipmapCount();
|
|
6032
6049
|
_this._isDepthTexture = format == exports.TextureFormat.Depth || format == exports.TextureFormat.DepthStencil || format == exports.TextureFormat.Depth16 || format == exports.TextureFormat.Depth24 || format == exports.TextureFormat.Depth32 || format == exports.TextureFormat.Depth24Stencil8 || format == exports.TextureFormat.Depth32Stencil8;
|
|
@@ -7116,29 +7133,7 @@
|
|
|
7116
7133
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
7117
7134
|
*/ _proto.gc = function gc() {
|
|
7118
7135
|
this._gc(false);
|
|
7119
|
-
|
|
7120
|
-
engine._renderElementPool.garbageCollection();
|
|
7121
|
-
engine._meshRenderDataPool.garbageCollection();
|
|
7122
|
-
engine._spriteRenderDataPool.garbageCollection();
|
|
7123
|
-
engine._spriteMaskRenderDataPool.garbageCollection();
|
|
7124
|
-
engine._textRenderDataPool.garbageCollection();
|
|
7125
|
-
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
7126
|
-
_componentsManager._renderers.garbageCollection();
|
|
7127
|
-
// @ts-ignore
|
|
7128
|
-
_componentsManager._onStartScripts.garbageCollection();
|
|
7129
|
-
// @ts-ignore
|
|
7130
|
-
_componentsManager._onUpdateScripts.garbageCollection();
|
|
7131
|
-
// @ts-ignore
|
|
7132
|
-
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
7133
|
-
// @ts-ignore
|
|
7134
|
-
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
7135
|
-
// @ts-ignore
|
|
7136
|
-
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
7137
|
-
// @ts-ignore
|
|
7138
|
-
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
7139
|
-
_lightManager._spotLights.garbageCollection();
|
|
7140
|
-
_lightManager._pointLights.garbageCollection();
|
|
7141
|
-
_lightManager._directLights.garbageCollection();
|
|
7136
|
+
this.engine._pendingGC();
|
|
7142
7137
|
};
|
|
7143
7138
|
/**
|
|
7144
7139
|
* Add content restorer.
|
|
@@ -8056,6 +8051,17 @@
|
|
|
8056
8051
|
componentContainer.length = 0;
|
|
8057
8052
|
this._componentsContainerPool.push(componentContainer);
|
|
8058
8053
|
};
|
|
8054
|
+
/**
|
|
8055
|
+
* @internal
|
|
8056
|
+
*/ _proto._gc = function _gc() {
|
|
8057
|
+
this._renderers.garbageCollection();
|
|
8058
|
+
this._onStartScripts.garbageCollection();
|
|
8059
|
+
this._onUpdateScripts.garbageCollection();
|
|
8060
|
+
this._onLateUpdateScripts.garbageCollection();
|
|
8061
|
+
this._onPhysicsUpdateScripts.garbageCollection();
|
|
8062
|
+
this._onUpdateAnimations.garbageCollection();
|
|
8063
|
+
this._onUpdateRenderers.garbageCollection();
|
|
8064
|
+
};
|
|
8059
8065
|
return ComponentsManager;
|
|
8060
8066
|
}();
|
|
8061
8067
|
/**
|
|
@@ -10665,6 +10671,11 @@
|
|
|
10665
10671
|
elements[i]._onLateUpdate();
|
|
10666
10672
|
}
|
|
10667
10673
|
};
|
|
10674
|
+
/**
|
|
10675
|
+
* @internal
|
|
10676
|
+
*/ _proto._gc = function _gc() {
|
|
10677
|
+
this._colliders.garbageCollection();
|
|
10678
|
+
};
|
|
10668
10679
|
_proto._setGravity = function _setGravity() {
|
|
10669
10680
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
10670
10681
|
};
|
|
@@ -13209,6 +13220,13 @@
|
|
|
13209
13220
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
13210
13221
|
}
|
|
13211
13222
|
};
|
|
13223
|
+
/**
|
|
13224
|
+
* @internal
|
|
13225
|
+
*/ _proto._gc = function _gc() {
|
|
13226
|
+
this._spotLights.garbageCollection();
|
|
13227
|
+
this._pointLights.garbageCollection();
|
|
13228
|
+
this._directLights.garbageCollection();
|
|
13229
|
+
};
|
|
13212
13230
|
return LightManager;
|
|
13213
13231
|
}();
|
|
13214
13232
|
/**
|
|
@@ -21485,6 +21503,7 @@
|
|
|
21485
21503
|
_this._frameInProcess = false;
|
|
21486
21504
|
_this._waitingDestroy = false;
|
|
21487
21505
|
_this._isDeviceLost = false;
|
|
21506
|
+
_this._waitingGC = false;
|
|
21488
21507
|
_this._animate = function() {
|
|
21489
21508
|
if (_this._vSyncCount) {
|
|
21490
21509
|
_this._requestId = requestAnimationFrame(_this._animate);
|
|
@@ -21588,6 +21607,10 @@
|
|
|
21588
21607
|
if (this._waitingDestroy) {
|
|
21589
21608
|
this._destroy();
|
|
21590
21609
|
}
|
|
21610
|
+
if (this._waitingGC) {
|
|
21611
|
+
this._gc();
|
|
21612
|
+
this._waitingGC = false;
|
|
21613
|
+
}
|
|
21591
21614
|
this._frameInProcess = false;
|
|
21592
21615
|
};
|
|
21593
21616
|
/**
|
|
@@ -21746,6 +21769,15 @@
|
|
|
21746
21769
|
};
|
|
21747
21770
|
/**
|
|
21748
21771
|
* @internal
|
|
21772
|
+
*/ _proto._pendingGC = function _pendingGC() {
|
|
21773
|
+
if (this._frameInProcess) {
|
|
21774
|
+
this._waitingGC = true;
|
|
21775
|
+
} else {
|
|
21776
|
+
this._gc();
|
|
21777
|
+
}
|
|
21778
|
+
};
|
|
21779
|
+
/**
|
|
21780
|
+
* @internal
|
|
21749
21781
|
*/ _proto._initialize = function _initialize(configuration) {
|
|
21750
21782
|
var _this = this;
|
|
21751
21783
|
var physics = configuration.physics;
|
|
@@ -21808,6 +21840,16 @@
|
|
|
21808
21840
|
console.error(error);
|
|
21809
21841
|
});
|
|
21810
21842
|
};
|
|
21843
|
+
_proto._gc = function _gc() {
|
|
21844
|
+
this._renderElementPool.garbageCollection();
|
|
21845
|
+
this._meshRenderDataPool.garbageCollection();
|
|
21846
|
+
this._spriteRenderDataPool.garbageCollection();
|
|
21847
|
+
this._spriteMaskRenderDataPool.garbageCollection();
|
|
21848
|
+
this._textRenderDataPool.garbageCollection();
|
|
21849
|
+
this._componentsManager._gc();
|
|
21850
|
+
this._lightManager._gc();
|
|
21851
|
+
this.physicsManager._gc();
|
|
21852
|
+
};
|
|
21811
21853
|
_create_class$3(Engine, [
|
|
21812
21854
|
{
|
|
21813
21855
|
key: "settings",
|
|
@@ -27187,7 +27229,6 @@
|
|
|
27187
27229
|
* @internal
|
|
27188
27230
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
27189
27231
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
27190
|
-
this.hasSavedDefaultValue = false;
|
|
27191
27232
|
this.baseEvaluateData = {
|
|
27192
27233
|
curKeyframeIndex: 0,
|
|
27193
27234
|
value: null
|
|
@@ -27200,7 +27241,7 @@
|
|
|
27200
27241
|
this.type = type;
|
|
27201
27242
|
this.property = property;
|
|
27202
27243
|
this.component = target.getComponent(type);
|
|
27203
|
-
this.
|
|
27244
|
+
this.cureType = cureType;
|
|
27204
27245
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
27205
27246
|
this._assembler = new assemblerType();
|
|
27206
27247
|
this._assembler.initialize(this);
|
|
@@ -27209,89 +27250,80 @@
|
|
|
27209
27250
|
}
|
|
27210
27251
|
}
|
|
27211
27252
|
var _proto = AnimationCurveOwner.prototype;
|
|
27212
|
-
_proto.
|
|
27213
|
-
|
|
27214
|
-
if (additive) {
|
|
27215
|
-
var value = curve._evaluateAdditive(time, this.baseEvaluateData);
|
|
27216
|
-
var cureType = this._cureType;
|
|
27217
|
-
if (cureType._isReferenceType) {
|
|
27218
|
-
cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
|
|
27219
|
-
} else {
|
|
27220
|
-
var assembler = this._assembler;
|
|
27221
|
-
var originValue = assembler.getTargetValue();
|
|
27222
|
-
var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
|
|
27223
|
-
assembler.setTargetValue(additiveValue);
|
|
27224
|
-
}
|
|
27225
|
-
} else {
|
|
27226
|
-
var value1 = curve._evaluate(time, this.baseEvaluateData);
|
|
27227
|
-
this._applyValue(value1, layerWeight);
|
|
27228
|
-
}
|
|
27229
|
-
}
|
|
27253
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
27254
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
27230
27255
|
};
|
|
27231
|
-
_proto.
|
|
27232
|
-
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.
|
|
27233
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
27234
|
-
this.
|
|
27256
|
+
_proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
|
|
27257
|
+
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.cureType._getZeroValue(this.baseEvaluateData.value) : this.defaultValue;
|
|
27258
|
+
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
|
|
27259
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
27235
27260
|
};
|
|
27236
|
-
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight,
|
|
27237
|
-
var srcValue = additive ? this.
|
|
27238
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
27239
|
-
this.
|
|
27261
|
+
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
|
|
27262
|
+
var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
|
|
27263
|
+
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.cureType._getZeroValue(this.crossEvaluateData.value) : this.defaultValue;
|
|
27264
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
27240
27265
|
};
|
|
27241
27266
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
27242
27267
|
this._assembler.setTargetValue(this.defaultValue);
|
|
27243
27268
|
};
|
|
27269
|
+
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
27270
|
+
if (this.cureType._isReferenceType) {
|
|
27271
|
+
this.cureType._copyValue(this.baseEvaluateData.value, out);
|
|
27272
|
+
return out;
|
|
27273
|
+
} else {
|
|
27274
|
+
return this.baseEvaluateData.value;
|
|
27275
|
+
}
|
|
27276
|
+
};
|
|
27244
27277
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
27245
|
-
if (this.
|
|
27246
|
-
this.
|
|
27278
|
+
if (this.cureType._isReferenceType) {
|
|
27279
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
27247
27280
|
} else {
|
|
27248
27281
|
this.defaultValue = this._assembler.getTargetValue();
|
|
27249
27282
|
}
|
|
27250
|
-
this.hasSavedDefaultValue = true;
|
|
27251
27283
|
};
|
|
27252
27284
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
27253
|
-
if (this.
|
|
27254
|
-
this.
|
|
27285
|
+
if (this.cureType._isReferenceType) {
|
|
27286
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
27255
27287
|
} else {
|
|
27256
27288
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
27257
27289
|
}
|
|
27258
27290
|
};
|
|
27259
|
-
_proto.
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27291
|
+
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
27292
|
+
var cureType = this.cureType;
|
|
27293
|
+
if (additive) {
|
|
27294
|
+
if (cureType._isReferenceType) {
|
|
27295
|
+
cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
27263
27296
|
} else {
|
|
27264
|
-
this._assembler
|
|
27297
|
+
var assembler = this._assembler;
|
|
27298
|
+
var originValue = assembler.getTargetValue();
|
|
27299
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
27300
|
+
assembler.setTargetValue(additiveValue);
|
|
27265
27301
|
}
|
|
27266
27302
|
} else {
|
|
27267
|
-
if (
|
|
27268
|
-
|
|
27269
|
-
|
|
27303
|
+
if (weight === 1.0) {
|
|
27304
|
+
if (cureType._isReferenceType) {
|
|
27305
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
27306
|
+
} else {
|
|
27307
|
+
this._assembler.setTargetValue(value);
|
|
27308
|
+
}
|
|
27270
27309
|
} else {
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27310
|
+
if (cureType._isReferenceType) {
|
|
27311
|
+
var targetValue = this.referenceTargetValue;
|
|
27312
|
+
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
27313
|
+
} else {
|
|
27314
|
+
var originValue1 = this._assembler.getTargetValue();
|
|
27315
|
+
var lerpValue = cureType._lerpValue(originValue1, value, weight);
|
|
27316
|
+
this._assembler.setTargetValue(lerpValue);
|
|
27317
|
+
}
|
|
27274
27318
|
}
|
|
27275
27319
|
}
|
|
27276
27320
|
};
|
|
27277
|
-
_proto.
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
out = this.baseEvaluateData.value;
|
|
27281
|
-
this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
|
|
27282
|
-
} else {
|
|
27283
|
-
out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
27284
|
-
}
|
|
27285
|
-
if (additive) {
|
|
27286
|
-
if (this._cureType._isReferenceType) {
|
|
27287
|
-
this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
|
|
27288
|
-
} else {
|
|
27289
|
-
var originValue = this._assembler.getTargetValue();
|
|
27290
|
-
var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
|
|
27291
|
-
this._assembler.setTargetValue(lerpValue);
|
|
27292
|
-
}
|
|
27321
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
27322
|
+
if (this.cureType._isReferenceType) {
|
|
27323
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
27293
27324
|
} else {
|
|
27294
|
-
this.
|
|
27325
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
27326
|
+
return this.baseEvaluateData.value;
|
|
27295
27327
|
}
|
|
27296
27328
|
};
|
|
27297
27329
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -27382,9 +27414,24 @@
|
|
|
27382
27414
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
27383
27415
|
/**
|
|
27384
27416
|
* @internal
|
|
27385
|
-
*/ var AnimationCurveLayerOwner = function
|
|
27386
|
-
|
|
27387
|
-
|
|
27417
|
+
*/ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
|
|
27418
|
+
var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
27419
|
+
this.crossCurveMark = 0;
|
|
27420
|
+
};
|
|
27421
|
+
var _proto = AnimationCurveLayerOwner.prototype;
|
|
27422
|
+
_proto.initFinalValue = function initFinalValue() {
|
|
27423
|
+
var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
|
|
27424
|
+
if (cureType._isReferenceType) {
|
|
27425
|
+
cureType._copyValue(defaultValue, this.finalValue);
|
|
27426
|
+
} else {
|
|
27427
|
+
this.finalValue = defaultValue;
|
|
27428
|
+
}
|
|
27429
|
+
};
|
|
27430
|
+
_proto.saveFinalValue = function saveFinalValue() {
|
|
27431
|
+
this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
|
|
27432
|
+
};
|
|
27433
|
+
return AnimationCurveLayerOwner;
|
|
27434
|
+
}();
|
|
27388
27435
|
/**
|
|
27389
27436
|
* Associate AnimationCurve and the Entity
|
|
27390
27437
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -27398,13 +27445,18 @@
|
|
|
27398
27445
|
var curveType = this.curve.constructor;
|
|
27399
27446
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
27400
27447
|
curveType._initializeOwner(owner);
|
|
27448
|
+
owner.saveDefaultValue();
|
|
27401
27449
|
return owner;
|
|
27402
27450
|
};
|
|
27403
27451
|
/**
|
|
27404
27452
|
* @internal
|
|
27405
27453
|
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
27454
|
+
var curveType = this.curve.constructor;
|
|
27406
27455
|
var layerOwner = new AnimationCurveLayerOwner();
|
|
27407
27456
|
layerOwner.curveOwner = owner;
|
|
27457
|
+
curveType._initializeLayerOwner(layerOwner);
|
|
27458
|
+
// If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
|
|
27459
|
+
layerOwner.initFinalValue();
|
|
27408
27460
|
return layerOwner;
|
|
27409
27461
|
};
|
|
27410
27462
|
/**
|
|
@@ -27489,7 +27541,8 @@
|
|
|
27489
27541
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
27490
27542
|
if (targetEntity) {
|
|
27491
27543
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
27492
|
-
curveOwner.
|
|
27544
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
27545
|
+
curveOwner.applyValue(value, 1, false);
|
|
27493
27546
|
}
|
|
27494
27547
|
}
|
|
27495
27548
|
};
|
|
@@ -27631,6 +27684,7 @@
|
|
|
27631
27684
|
break;
|
|
27632
27685
|
}
|
|
27633
27686
|
}
|
|
27687
|
+
evaluateData.value = value;
|
|
27634
27688
|
return value;
|
|
27635
27689
|
};
|
|
27636
27690
|
/**
|
|
@@ -27686,6 +27740,11 @@
|
|
|
27686
27740
|
};
|
|
27687
27741
|
/**
|
|
27688
27742
|
* @internal
|
|
27743
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
27744
|
+
owner.finalValue = [];
|
|
27745
|
+
};
|
|
27746
|
+
/**
|
|
27747
|
+
* @internal
|
|
27689
27748
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
27690
27749
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
27691
27750
|
var src = srcValue[i];
|
|
@@ -27775,6 +27834,11 @@
|
|
|
27775
27834
|
};
|
|
27776
27835
|
/**
|
|
27777
27836
|
* @internal
|
|
27837
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
27838
|
+
owner.finalValue = false;
|
|
27839
|
+
};
|
|
27840
|
+
/**
|
|
27841
|
+
* @internal
|
|
27778
27842
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
27779
27843
|
return destValue;
|
|
27780
27844
|
};
|
|
@@ -27831,6 +27895,11 @@
|
|
|
27831
27895
|
};
|
|
27832
27896
|
/**
|
|
27833
27897
|
* @internal
|
|
27898
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
27899
|
+
owner.finalValue = new Color$1();
|
|
27900
|
+
};
|
|
27901
|
+
/**
|
|
27902
|
+
* @internal
|
|
27834
27903
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
27835
27904
|
Color$1.lerp(srcValue, destValue, weight, out);
|
|
27836
27905
|
return out;
|
|
@@ -27936,6 +28005,12 @@
|
|
|
27936
28005
|
};
|
|
27937
28006
|
/**
|
|
27938
28007
|
* @internal
|
|
28008
|
+
*/ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28009
|
+
var size = owner.curveOwner.referenceTargetValue.length;
|
|
28010
|
+
owner.finalValue = new Float32Array(size);
|
|
28011
|
+
};
|
|
28012
|
+
/**
|
|
28013
|
+
* @internal
|
|
27939
28014
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
27940
28015
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
27941
28016
|
var src = srcValue[i];
|
|
@@ -28025,6 +28100,11 @@
|
|
|
28025
28100
|
};
|
|
28026
28101
|
/**
|
|
28027
28102
|
* @internal
|
|
28103
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28104
|
+
owner.finalValue = 0;
|
|
28105
|
+
};
|
|
28106
|
+
/**
|
|
28107
|
+
* @internal
|
|
28028
28108
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
28029
28109
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
28030
28110
|
};
|
|
@@ -28093,6 +28173,11 @@
|
|
|
28093
28173
|
};
|
|
28094
28174
|
/**
|
|
28095
28175
|
* @internal
|
|
28176
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28177
|
+
owner.finalValue = new Quaternion();
|
|
28178
|
+
};
|
|
28179
|
+
/**
|
|
28180
|
+
* @internal
|
|
28096
28181
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
28097
28182
|
Quaternion.slerp(src, dest, weight, out);
|
|
28098
28183
|
return out;
|
|
@@ -28196,6 +28281,11 @@
|
|
|
28196
28281
|
};
|
|
28197
28282
|
/**
|
|
28198
28283
|
* @internal
|
|
28284
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28285
|
+
owner.finalValue = new Vector2();
|
|
28286
|
+
};
|
|
28287
|
+
/**
|
|
28288
|
+
* @internal
|
|
28199
28289
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
28200
28290
|
Vector2.lerp(srcValue, destValue, weight, out);
|
|
28201
28291
|
return out;
|
|
@@ -28280,6 +28370,11 @@
|
|
|
28280
28370
|
};
|
|
28281
28371
|
/**
|
|
28282
28372
|
* @internal
|
|
28373
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28374
|
+
owner.finalValue = new Vector3();
|
|
28375
|
+
};
|
|
28376
|
+
/**
|
|
28377
|
+
* @internal
|
|
28283
28378
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
28284
28379
|
Vector3.lerp(srcValue, destValue, weight, out);
|
|
28285
28380
|
return out;
|
|
@@ -28376,6 +28471,11 @@
|
|
|
28376
28471
|
};
|
|
28377
28472
|
/**
|
|
28378
28473
|
* @internal
|
|
28474
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
28475
|
+
owner.finalValue = new Vector4();
|
|
28476
|
+
};
|
|
28477
|
+
/**
|
|
28478
|
+
* @internal
|
|
28379
28479
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
28380
28480
|
Vector4.lerp(srcValue, destValue, weight, out);
|
|
28381
28481
|
return out;
|
|
@@ -28481,6 +28581,7 @@
|
|
|
28481
28581
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
28482
28582
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
28483
28583
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
28584
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
28484
28585
|
})(LayerState || (LayerState = {}));
|
|
28485
28586
|
/**
|
|
28486
28587
|
* @internal
|
|
@@ -28552,7 +28653,7 @@
|
|
|
28552
28653
|
this.layerState = LayerState.Standby;
|
|
28553
28654
|
this.crossCurveMark = 0;
|
|
28554
28655
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
28555
|
-
this.
|
|
28656
|
+
this.crossLayerOwnerCollection = [];
|
|
28556
28657
|
};
|
|
28557
28658
|
var _proto = AnimatorLayerData.prototype;
|
|
28558
28659
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -28579,6 +28680,7 @@
|
|
|
28579
28680
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
28580
28681
|
_this._animatorLayersData = [];
|
|
28581
28682
|
_this._curveOwnerPool = Object.create(null);
|
|
28683
|
+
_this._needRevertCurveOwners = [];
|
|
28582
28684
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
28583
28685
|
_this._tempAnimatorStateInfo = {
|
|
28584
28686
|
layerIndex: -1,
|
|
@@ -28602,7 +28704,7 @@
|
|
|
28602
28704
|
this._reset();
|
|
28603
28705
|
}
|
|
28604
28706
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
28605
|
-
var state = stateInfo.state;
|
|
28707
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
28606
28708
|
if (!state) {
|
|
28607
28709
|
return;
|
|
28608
28710
|
}
|
|
@@ -28611,8 +28713,8 @@
|
|
|
28611
28713
|
return;
|
|
28612
28714
|
}
|
|
28613
28715
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
28614
|
-
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
28615
|
-
this._preparePlay(animatorLayerData, state
|
|
28716
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
28717
|
+
this._preparePlay(animatorLayerData, state);
|
|
28616
28718
|
animatorLayerData.layerState = LayerState.Playing;
|
|
28617
28719
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
28618
28720
|
};
|
|
@@ -28663,6 +28765,7 @@
|
|
|
28663
28765
|
return;
|
|
28664
28766
|
}
|
|
28665
28767
|
deltaTime *= this.speed;
|
|
28768
|
+
this._revertCurveOwners();
|
|
28666
28769
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
28667
28770
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
28668
28771
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -28706,10 +28809,11 @@
|
|
|
28706
28809
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
28707
28810
|
for(var property in propertyOwners){
|
|
28708
28811
|
var owner = propertyOwners[property];
|
|
28709
|
-
owner.
|
|
28812
|
+
owner.revertDefaultValue();
|
|
28710
28813
|
}
|
|
28711
28814
|
}
|
|
28712
28815
|
this._animatorLayersData.length = 0;
|
|
28816
|
+
this._needRevertCurveOwners.length = 0;
|
|
28713
28817
|
this._curveOwnerPool = {};
|
|
28714
28818
|
this._animationEventHandlerPool.resetPool();
|
|
28715
28819
|
if (this._controllerUpdateFlag) {
|
|
@@ -28737,25 +28841,18 @@
|
|
|
28737
28841
|
stateInfo.state = state;
|
|
28738
28842
|
return stateInfo;
|
|
28739
28843
|
};
|
|
28740
|
-
_proto.
|
|
28741
|
-
var curveLayerOwner = stateData.curveLayerOwner;
|
|
28742
|
-
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
28743
|
-
var _curveLayerOwner_i;
|
|
28744
|
-
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
28745
|
-
}
|
|
28746
|
-
};
|
|
28747
|
-
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
28844
|
+
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
|
|
28748
28845
|
var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
|
|
28749
28846
|
var animatorStateData = animatorStateDataMap[stateName];
|
|
28750
28847
|
if (!animatorStateData) {
|
|
28751
28848
|
animatorStateData = new AnimatorStateData();
|
|
28752
28849
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
28753
|
-
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
28850
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
|
|
28754
28851
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
28755
28852
|
}
|
|
28756
28853
|
return animatorStateData;
|
|
28757
28854
|
};
|
|
28758
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
28855
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
|
|
28759
28856
|
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
28760
28857
|
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
28761
28858
|
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
@@ -28767,9 +28864,22 @@
|
|
|
28767
28864
|
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
28768
28865
|
var property = curve.property;
|
|
28769
28866
|
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
|
+
}
|
|
28770
28873
|
// Get owner
|
|
28771
28874
|
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
28772
28875
|
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
|
+
}
|
|
28773
28883
|
// Get layer owner
|
|
28774
28884
|
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
28775
28885
|
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
@@ -28803,12 +28913,12 @@
|
|
|
28803
28913
|
};
|
|
28804
28914
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
28805
28915
|
animatorLayerData.crossCurveMark++;
|
|
28806
|
-
animatorLayerData.
|
|
28916
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
28807
28917
|
};
|
|
28808
28918
|
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
28809
28919
|
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
28810
28920
|
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
28811
|
-
animatorLayerData.
|
|
28921
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
28812
28922
|
};
|
|
28813
28923
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
28814
28924
|
// Add src cross curve data.
|
|
@@ -28823,10 +28933,10 @@
|
|
|
28823
28933
|
this._prepareDestCrossData(animatorLayerData, true);
|
|
28824
28934
|
};
|
|
28825
28935
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
28826
|
-
var
|
|
28936
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
28827
28937
|
// Save current cross curve data owner fixed pose.
|
|
28828
|
-
for(var i =
|
|
28829
|
-
var layerOwner =
|
|
28938
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
28939
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
28830
28940
|
if (!layerOwner) continue;
|
|
28831
28941
|
layerOwner.curveOwner.saveFixedPoseValue();
|
|
28832
28942
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
@@ -28854,7 +28964,6 @@
|
|
|
28854
28964
|
layerOwner.crossDestCurveIndex = i;
|
|
28855
28965
|
} else {
|
|
28856
28966
|
var owner = layerOwner.curveOwner;
|
|
28857
|
-
owner.saveDefaultValue();
|
|
28858
28967
|
saveFixed && owner.saveFixedPoseValue();
|
|
28859
28968
|
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28860
28969
|
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
@@ -28872,7 +28981,7 @@
|
|
|
28872
28981
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
28873
28982
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
28874
28983
|
firstLayer && (weight = 1.0);
|
|
28875
|
-
|
|
28984
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
28876
28985
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
28877
28986
|
switch(layerData.layerState){
|
|
28878
28987
|
case LayerState.Playing:
|
|
@@ -28884,6 +28993,9 @@
|
|
|
28884
28993
|
case LayerState.CrossFading:
|
|
28885
28994
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
28886
28995
|
break;
|
|
28996
|
+
case LayerState.Finished:
|
|
28997
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
28998
|
+
break;
|
|
28887
28999
|
}
|
|
28888
29000
|
};
|
|
28889
29001
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
@@ -28891,19 +29003,26 @@
|
|
|
28891
29003
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
28892
29004
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
28893
29005
|
playData.update(this.speed < 0);
|
|
28894
|
-
if (!aniUpdate) {
|
|
28895
|
-
return;
|
|
28896
|
-
}
|
|
28897
29006
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
28898
|
-
|
|
28899
|
-
|
|
28900
|
-
var
|
|
28901
|
-
|
|
29007
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
29008
|
+
if (aniUpdate || finished) {
|
|
29009
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
29010
|
+
var layerOwner = curveLayerOwner[i];
|
|
29011
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29012
|
+
if (!owner) continue;
|
|
29013
|
+
var curve = curveBindings[i].curve;
|
|
29014
|
+
if (curve.keys.length) {
|
|
29015
|
+
var value = owner.evaluateValue(curve, clipTime, additive);
|
|
29016
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
29017
|
+
finished && layerOwner.saveFinalValue();
|
|
29018
|
+
}
|
|
29019
|
+
}
|
|
28902
29020
|
}
|
|
28903
29021
|
playData.frameTime += state.speed * delta;
|
|
28904
29022
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
28905
|
-
layerData.layerState = LayerState.
|
|
29023
|
+
layerData.layerState = LayerState.Finished;
|
|
28906
29024
|
}
|
|
29025
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
28907
29026
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
28908
29027
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
28909
29028
|
}
|
|
@@ -28914,7 +29033,7 @@
|
|
|
28914
29033
|
}
|
|
28915
29034
|
};
|
|
28916
29035
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
28917
|
-
var
|
|
29036
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
28918
29037
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
28919
29038
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
28920
29039
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -28923,18 +29042,27 @@
|
|
|
28923
29042
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
28924
29043
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
28925
29044
|
var lastDestClipTime = destPlayData.clipTime;
|
|
28926
|
-
var
|
|
28927
|
-
crossWeight
|
|
29045
|
+
var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
|
|
29046
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
29047
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
28928
29048
|
srcPlayData.update(this.speed < 0);
|
|
28929
29049
|
destPlayData.update(this.speed < 0);
|
|
28930
|
-
var srcPlayState = srcPlayData.playState;
|
|
28931
|
-
var destPlayState = destPlayData.playState;
|
|
28932
|
-
|
|
28933
|
-
if (
|
|
28934
|
-
|
|
29050
|
+
var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
|
|
29051
|
+
var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
|
|
29052
|
+
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
29053
|
+
if (aniUpdate || finished) {
|
|
29054
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
29055
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
29056
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29057
|
+
if (!owner) continue;
|
|
29058
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
29059
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
29060
|
+
var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
|
|
29061
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
29062
|
+
finished && layerOwner.saveFinalValue();
|
|
29063
|
+
}
|
|
28935
29064
|
}
|
|
28936
|
-
|
|
28937
|
-
var destClipTime = destPlayData.clipTime;
|
|
29065
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
28938
29066
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
28939
29067
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
28940
29068
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -28953,30 +29081,34 @@
|
|
|
28953
29081
|
} else {
|
|
28954
29082
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
28955
29083
|
}
|
|
28956
|
-
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
28957
|
-
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
28958
|
-
if (!layerOwner) continue;
|
|
28959
|
-
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
28960
|
-
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
28961
|
-
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
28962
|
-
}
|
|
28963
29084
|
};
|
|
28964
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
28965
|
-
var
|
|
29085
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
29086
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
28966
29087
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
28967
29088
|
var eventHandlers = stateData.eventHandlers;
|
|
28968
29089
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
28969
29090
|
var lastDestClipTime = destPlayData.clipTime;
|
|
28970
|
-
var
|
|
28971
|
-
crossWeight
|
|
29091
|
+
var duration = state._getDuration() * layerData.crossFadeTransition.duration;
|
|
29092
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
29093
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
28972
29094
|
destPlayData.update(this.speed < 0);
|
|
28973
29095
|
var playState = destPlayData.playState;
|
|
28974
29096
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
28975
|
-
if (!aniUpdate) {
|
|
28976
|
-
return;
|
|
28977
|
-
}
|
|
28978
29097
|
var destClipTime = destPlayData.clipTime;
|
|
28979
|
-
|
|
29098
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
29099
|
+
// When the animator is culled (aniUpdate=false), if the play state has finished, the final value needs to be calculated and saved to be applied directly.
|
|
29100
|
+
if (aniUpdate || finished) {
|
|
29101
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
29102
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
29103
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29104
|
+
if (!owner) continue;
|
|
29105
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
29106
|
+
var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
29107
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
29108
|
+
finished && layerOwner.saveFinalValue();
|
|
29109
|
+
}
|
|
29110
|
+
}
|
|
29111
|
+
//@todo: srcState is missing the judgment of the most recent period."
|
|
28980
29112
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
28981
29113
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
28982
29114
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -28986,11 +29118,18 @@
|
|
|
28986
29118
|
} else {
|
|
28987
29119
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
28988
29120
|
}
|
|
28989
|
-
|
|
28990
|
-
|
|
28991
|
-
|
|
28992
|
-
|
|
28993
|
-
|
|
29121
|
+
};
|
|
29122
|
+
_proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
|
|
29123
|
+
if (!aniUpdate) {
|
|
29124
|
+
return;
|
|
29125
|
+
}
|
|
29126
|
+
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
29127
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
29128
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
29129
|
+
var layerOwner = curveLayerOwner[i];
|
|
29130
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
29131
|
+
if (!owner) continue;
|
|
29132
|
+
owner.applyValue(layerOwner.finalValue, weight, additive);
|
|
28994
29133
|
}
|
|
28995
29134
|
};
|
|
28996
29135
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -28998,7 +29137,7 @@
|
|
|
28998
29137
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
28999
29138
|
if (crossWeight === 1.0) {
|
|
29000
29139
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
29001
|
-
layerData.layerState = LayerState.
|
|
29140
|
+
layerData.layerState = LayerState.Finished;
|
|
29002
29141
|
} else {
|
|
29003
29142
|
layerData.layerState = LayerState.Playing;
|
|
29004
29143
|
}
|
|
@@ -29008,7 +29147,7 @@
|
|
|
29008
29147
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
29009
29148
|
}
|
|
29010
29149
|
};
|
|
29011
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
29150
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
29012
29151
|
if (layerData.layerState === LayerState.Playing) {
|
|
29013
29152
|
var srcPlayData = layerData.srcPlayData;
|
|
29014
29153
|
if (srcPlayData.state !== playState) {
|
|
@@ -29016,18 +29155,16 @@
|
|
|
29016
29155
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
29017
29156
|
var _curveLayerOwner_i;
|
|
29018
29157
|
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
29019
|
-
|
|
29158
|
+
owner.revertDefaultValue();
|
|
29020
29159
|
}
|
|
29021
|
-
this._saveDefaultValues(playStateData);
|
|
29022
29160
|
}
|
|
29023
29161
|
} else {
|
|
29024
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
29025
|
-
var
|
|
29026
|
-
for(var i1 =
|
|
29027
|
-
var owner1 =
|
|
29028
|
-
owner1.
|
|
29162
|
+
// layerState is CrossFading, FixedCrossFading, Standby, Finished
|
|
29163
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
29164
|
+
for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
|
|
29165
|
+
var owner1 = crossLayerOwnerCollection[i1].curveOwner;
|
|
29166
|
+
owner1.revertDefaultValue();
|
|
29029
29167
|
}
|
|
29030
|
-
this._saveDefaultValues(playStateData);
|
|
29031
29168
|
}
|
|
29032
29169
|
};
|
|
29033
29170
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -29044,7 +29181,7 @@
|
|
|
29044
29181
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
29045
29182
|
var name = transition.destinationState.name;
|
|
29046
29183
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
29047
|
-
var crossState = stateInfo.state;
|
|
29184
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
29048
29185
|
if (!crossState) {
|
|
29049
29186
|
return;
|
|
29050
29187
|
}
|
|
@@ -29052,21 +29189,21 @@
|
|
|
29052
29189
|
console.warn("The state named " + name + " has no AnimationClip data.");
|
|
29053
29190
|
return;
|
|
29054
29191
|
}
|
|
29055
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
29192
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
29056
29193
|
var layerState = animatorLayerData.layerState;
|
|
29057
29194
|
var destPlayData = animatorLayerData.destPlayData;
|
|
29058
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
29195
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
29059
29196
|
var duration = crossState._getDuration();
|
|
29060
29197
|
var offset = duration * transition.offset;
|
|
29061
29198
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
29062
29199
|
switch(layerState){
|
|
29063
|
-
// Maybe not play, maybe end.
|
|
29064
29200
|
case LayerState.Standby:
|
|
29065
29201
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
29066
29202
|
this._clearCrossData(animatorLayerData);
|
|
29067
29203
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
29068
29204
|
break;
|
|
29069
29205
|
case LayerState.Playing:
|
|
29206
|
+
case LayerState.Finished:
|
|
29070
29207
|
animatorLayerData.layerState = LayerState.CrossFading;
|
|
29071
29208
|
this._clearCrossData(animatorLayerData);
|
|
29072
29209
|
this._prepareCrossFading(animatorLayerData);
|
|
@@ -29163,6 +29300,12 @@
|
|
|
29163
29300
|
}
|
|
29164
29301
|
}
|
|
29165
29302
|
};
|
|
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();
|
|
29307
|
+
}
|
|
29308
|
+
};
|
|
29166
29309
|
_create_class$3(Animator, [
|
|
29167
29310
|
{
|
|
29168
29311
|
key: "animatorController",
|
|
@@ -29195,6 +29338,9 @@
|
|
|
29195
29338
|
__decorate$1([
|
|
29196
29339
|
ignoreClone
|
|
29197
29340
|
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
29341
|
+
__decorate$1([
|
|
29342
|
+
ignoreClone
|
|
29343
|
+
], Animator.prototype, "_needRevertCurveOwners", void 0);
|
|
29198
29344
|
__decorate$1([
|
|
29199
29345
|
ignoreClone
|
|
29200
29346
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|
|
@@ -31062,6 +31208,7 @@
|
|
|
31062
31208
|
get TextureDepthCompareFunction () { return exports.TextureDepthCompareFunction; },
|
|
31063
31209
|
get TextureFilterMode () { return exports.TextureFilterMode; },
|
|
31064
31210
|
get TextureFormat () { return exports.TextureFormat; },
|
|
31211
|
+
get TextureUsage () { return exports.TextureUsage; },
|
|
31065
31212
|
get TextureWrapMode () { return exports.TextureWrapMode; },
|
|
31066
31213
|
Time: Time,
|
|
31067
31214
|
TrailMaterial: TrailMaterial,
|
|
@@ -31829,9 +31976,9 @@
|
|
|
31829
31976
|
var isWebGL2 = this._isWebGL2;
|
|
31830
31977
|
var _this__formatDetail = this._formatDetail, internalFormat = _this__formatDetail.internalFormat, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
|
|
31831
31978
|
// @ts-ignore
|
|
31832
|
-
var _this__texture = this._texture, mipmapCount = _this__texture.mipmapCount, width = _this__texture.width, height = _this__texture.height, _isDepthTexture = _this__texture._isDepthTexture;
|
|
31979
|
+
var _this__texture = this._texture, mipmapCount = _this__texture.mipmapCount, width = _this__texture.width, height = _this__texture.height, usage = _this__texture.usage, _isDepthTexture = _this__texture._isDepthTexture;
|
|
31833
31980
|
this._bind();
|
|
31834
|
-
if (isWebGL2 && !(baseFormat === gl.LUMINANCE_ALPHA || baseFormat === gl.ALPHA)) {
|
|
31981
|
+
if (isWebGL2 && !(baseFormat === gl.LUMINANCE_ALPHA || baseFormat === gl.ALPHA) && usage !== exports.TextureUsage.Dynamic) {
|
|
31835
31982
|
gl.texStorage2D(this._target, mipmapCount, internalFormat, width, height);
|
|
31836
31983
|
} else {
|
|
31837
31984
|
if (!isCube) {
|
|
@@ -32623,11 +32770,15 @@
|
|
|
32623
32770
|
* {@inheritDoc IPlatformTexture2D.setImageSource}
|
|
32624
32771
|
*/ _proto.setImageSource = function setImageSource(imageSource, mipLevel, flipY, premultiplyAlpha, x, y) {
|
|
32625
32772
|
var gl = this._gl;
|
|
32626
|
-
var _this__formatDetail = this._formatDetail, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
|
|
32773
|
+
var _this__formatDetail = this._formatDetail, internalFormat = _this__formatDetail.internalFormat, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
|
|
32627
32774
|
this._bind();
|
|
32628
32775
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, +flipY);
|
|
32629
32776
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, +premultiplyAlpha);
|
|
32630
|
-
|
|
32777
|
+
if (this._texture.usage === exports.TextureUsage.Dynamic) {
|
|
32778
|
+
gl.texImage2D(this._target, mipLevel, internalFormat, baseFormat, dataType, imageSource);
|
|
32779
|
+
} else {
|
|
32780
|
+
gl.texSubImage2D(this._target, mipLevel, x || 0, y || 0, baseFormat, dataType, imageSource);
|
|
32781
|
+
}
|
|
32631
32782
|
};
|
|
32632
32783
|
/**
|
|
32633
32784
|
* {@inheritDoc IPlatformTexture2D.getPixelBuffer }
|
|
@@ -38156,7 +38307,7 @@
|
|
|
38156
38307
|
], GALACEAN_animation_event);
|
|
38157
38308
|
|
|
38158
38309
|
//@ts-ignore
|
|
38159
|
-
var version = "1.0.0-beta.
|
|
38310
|
+
var version = "1.0.0-beta.13";
|
|
38160
38311
|
console.log("Galacean engine version: " + version);
|
|
38161
38312
|
for(var key in CoreObjects){
|
|
38162
38313
|
Loader.registerClass(key, CoreObjects[key]);
|