@galacean/engine-core 0.9.12 → 0.9.14
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/main.js +479 -212
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +479 -212
- package/dist/module.js +479 -212
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Camera.d.ts +5 -2
- package/types/RenderPipeline/ClassPool.d.ts +3 -1
- package/types/RenderPipeline/IPoolElement.d.ts +3 -0
- package/types/RenderPipeline/MeshRenderElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteMaskElement.d.ts +3 -1
- package/types/RenderPipeline/TextRenderElement.d.ts +3 -1
- package/types/Renderer.d.ts +5 -2
- package/types/Scene.d.ts +10 -4
- package/types/animation/Animator.d.ts +5 -4
- package/types/animation/enums/LayerState.d.ts +3 -1
- package/types/animation/internal/AnimationCurveLayerOwner.d.ts +1 -0
- package/types/graphic/SubMesh.d.ts +3 -1
- package/types/material/Material.d.ts +5 -2
package/dist/main.js
CHANGED
|
@@ -2242,6 +2242,28 @@ var /** @internal */ PromiseState;
|
|
|
2242
2242
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
2243
2243
|
*/ _proto.gc = function gc() {
|
|
2244
2244
|
this._gc(false);
|
|
2245
|
+
var engine = this.engine;
|
|
2246
|
+
engine._renderElementPool.garbageCollection();
|
|
2247
|
+
engine._spriteElementPool.garbageCollection();
|
|
2248
|
+
engine._spriteMaskElementPool.garbageCollection();
|
|
2249
|
+
engine._textElementPool.garbageCollection();
|
|
2250
|
+
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
2251
|
+
_componentsManager._renderers.garbageCollection();
|
|
2252
|
+
// @ts-ignore
|
|
2253
|
+
_componentsManager._onStartScripts.garbageCollection();
|
|
2254
|
+
// @ts-ignore
|
|
2255
|
+
_componentsManager._onUpdateScripts.garbageCollection();
|
|
2256
|
+
// @ts-ignore
|
|
2257
|
+
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
2258
|
+
// @ts-ignore
|
|
2259
|
+
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
2260
|
+
// @ts-ignore
|
|
2261
|
+
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
2262
|
+
// @ts-ignore
|
|
2263
|
+
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
2264
|
+
_lightManager._spotLights.garbageCollection();
|
|
2265
|
+
_lightManager._pointLights.garbageCollection();
|
|
2266
|
+
_lightManager._directLights.garbageCollection();
|
|
2245
2267
|
};
|
|
2246
2268
|
/**
|
|
2247
2269
|
* @internal
|
|
@@ -4084,6 +4106,11 @@ var TransformModifyFlags;
|
|
|
4084
4106
|
* @returns Cloned entity
|
|
4085
4107
|
*/ _proto.clone = function clone() {
|
|
4086
4108
|
var cloneEntity = new Entity(this._engine, this.name);
|
|
4109
|
+
var _this = this, hookResource = _this._hookResource;
|
|
4110
|
+
if (hookResource) {
|
|
4111
|
+
cloneEntity._hookResource = hookResource;
|
|
4112
|
+
hookResource._addRefCount(1);
|
|
4113
|
+
}
|
|
4087
4114
|
cloneEntity._isActive = this._isActive;
|
|
4088
4115
|
cloneEntity.transform.localMatrix = this.transform.localMatrix;
|
|
4089
4116
|
var children = this._children;
|
|
@@ -4108,6 +4135,10 @@ var TransformModifyFlags;
|
|
|
4108
4135
|
return;
|
|
4109
4136
|
}
|
|
4110
4137
|
EngineObject.prototype.destroy.call(this);
|
|
4138
|
+
if (this._hookResource) {
|
|
4139
|
+
this._hookResource._addRefCount(-1);
|
|
4140
|
+
this._hookResource = null;
|
|
4141
|
+
}
|
|
4111
4142
|
var components = this._components;
|
|
4112
4143
|
for(var i = components.length - 1; i >= 0; i--){
|
|
4113
4144
|
components[i].destroy();
|
|
@@ -9784,9 +9815,9 @@ __decorate([
|
|
|
9784
9815
|
function Material(engine, shader) {
|
|
9785
9816
|
var _this;
|
|
9786
9817
|
_this = RefObject.call(this, engine) || this;
|
|
9787
|
-
/** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
9788
9818
|
/** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
|
|
9789
9819
|
;
|
|
9820
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
9790
9821
|
_this.shader = shader;
|
|
9791
9822
|
return _this;
|
|
9792
9823
|
}
|
|
@@ -9818,8 +9849,21 @@ __decorate([
|
|
|
9818
9849
|
*/ _proto._preRender = function _preRender(renderElement) {};
|
|
9819
9850
|
/**
|
|
9820
9851
|
* @override
|
|
9821
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
9852
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
9853
|
+
this._shader = null;
|
|
9854
|
+
this._shaderData = null;
|
|
9855
|
+
this._renderStates.length = 0;
|
|
9856
|
+
this._renderStates = null;
|
|
9857
|
+
};
|
|
9822
9858
|
_create_class(Material, [
|
|
9859
|
+
{
|
|
9860
|
+
key: "shaderData",
|
|
9861
|
+
get: /**
|
|
9862
|
+
* Shader data.
|
|
9863
|
+
*/ function get() {
|
|
9864
|
+
return this._shaderData;
|
|
9865
|
+
}
|
|
9866
|
+
},
|
|
9823
9867
|
{
|
|
9824
9868
|
key: "shader",
|
|
9825
9869
|
get: /**
|
|
@@ -9888,6 +9932,12 @@ __decorate([
|
|
|
9888
9932
|
*/ _proto.resetPool = function resetPool() {
|
|
9889
9933
|
this._elementPoolIndex = 0;
|
|
9890
9934
|
};
|
|
9935
|
+
_proto.garbageCollection = function garbageCollection() {
|
|
9936
|
+
var _this = this, pool = _this._elementPool;
|
|
9937
|
+
for(var i = pool.length - 1; i >= 0; i--){
|
|
9938
|
+
pool[i].dispose && pool[i].dispose();
|
|
9939
|
+
}
|
|
9940
|
+
};
|
|
9891
9941
|
return ClassPool;
|
|
9892
9942
|
}();
|
|
9893
9943
|
|
|
@@ -9910,6 +9960,9 @@ var RenderElement = function RenderElement() {
|
|
|
9910
9960
|
this.renderState = renderState;
|
|
9911
9961
|
this.shaderPass = shaderPass;
|
|
9912
9962
|
};
|
|
9963
|
+
_proto.dispose = function dispose() {
|
|
9964
|
+
this.component = this.mesh = this.subMesh = this.material = this.renderState = this.shaderPass = null;
|
|
9965
|
+
};
|
|
9913
9966
|
return MeshRenderElement;
|
|
9914
9967
|
}(RenderElement);
|
|
9915
9968
|
|
|
@@ -9955,6 +10008,9 @@ var SpriteElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
9955
10008
|
this.renderState = renderState;
|
|
9956
10009
|
this.shaderPass = shaderPass;
|
|
9957
10010
|
};
|
|
10011
|
+
_proto.dispose = function dispose() {
|
|
10012
|
+
this.component = this.renderData = this.material = this.texture = this.renderState = this.shaderPass = null;
|
|
10013
|
+
};
|
|
9958
10014
|
return SpriteElement;
|
|
9959
10015
|
}(RenderElement);
|
|
9960
10016
|
|
|
@@ -9973,6 +10029,9 @@ var SpriteMaskElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
9973
10029
|
this.renderData = renderData;
|
|
9974
10030
|
this.material = material;
|
|
9975
10031
|
};
|
|
10032
|
+
_proto.dispose = function dispose() {
|
|
10033
|
+
this.component = this.renderData = this.material = null;
|
|
10034
|
+
};
|
|
9976
10035
|
return SpriteMaskElement;
|
|
9977
10036
|
}(RenderElement);
|
|
9978
10037
|
|
|
@@ -9991,7 +10050,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
9991
10050
|
function Renderer1(entity) {
|
|
9992
10051
|
var _this;
|
|
9993
10052
|
_this = Component.call(this, entity) || this;
|
|
9994
|
-
/** ShaderData related to renderer. */ _this.shaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
9995
10053
|
/** @internal */ _this._onUpdateIndex = -1;
|
|
9996
10054
|
/** @internal */ _this._rendererIndex = -1;
|
|
9997
10055
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
@@ -9999,6 +10057,7 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
9999
10057
|
_this._overrideUpdate = false;
|
|
10000
10058
|
_this._materials = [];
|
|
10001
10059
|
_this._dirtyUpdateFlag = 0;
|
|
10060
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
10002
10061
|
_this._mvMatrix = new engineMath.Matrix();
|
|
10003
10062
|
_this._mvpMatrix = new engineMath.Matrix();
|
|
10004
10063
|
_this._mvInvMatrix = new engineMath.Matrix();
|
|
@@ -10145,6 +10204,17 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10145
10204
|
var _materials_i;
|
|
10146
10205
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addRefCount(-1);
|
|
10147
10206
|
}
|
|
10207
|
+
this._entity = null;
|
|
10208
|
+
this._globalShaderMacro = null;
|
|
10209
|
+
this._bounds = null;
|
|
10210
|
+
this._materials = null;
|
|
10211
|
+
this._shaderData = null;
|
|
10212
|
+
this._mvMatrix = null;
|
|
10213
|
+
this._mvpMatrix = null;
|
|
10214
|
+
this._mvInvMatrix = null;
|
|
10215
|
+
this._normalMatrix = null;
|
|
10216
|
+
this._materialsInstanced = null;
|
|
10217
|
+
this._rendererLayer = null;
|
|
10148
10218
|
};
|
|
10149
10219
|
_proto._updateShaderData = function _updateShaderData(context) {
|
|
10150
10220
|
var entity = this.entity;
|
|
@@ -10206,6 +10276,14 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10206
10276
|
this._dirtyUpdateFlag |= 0x1;
|
|
10207
10277
|
};
|
|
10208
10278
|
_create_class(Renderer1, [
|
|
10279
|
+
{
|
|
10280
|
+
key: "shaderData",
|
|
10281
|
+
get: /**
|
|
10282
|
+
* ShaderData related to renderer.
|
|
10283
|
+
*/ function get() {
|
|
10284
|
+
return this._shaderData;
|
|
10285
|
+
}
|
|
10286
|
+
},
|
|
10209
10287
|
{
|
|
10210
10288
|
key: "isCulled",
|
|
10211
10289
|
get: /**
|
|
@@ -10290,9 +10368,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10290
10368
|
}(), function() {
|
|
10291
10369
|
_Renderer._rendererLayerProperty = Shader.getPropertyByName("oasis_RendererLayer");
|
|
10292
10370
|
}(), _Renderer);
|
|
10293
|
-
__decorate([
|
|
10294
|
-
deepClone
|
|
10295
|
-
], exports.Renderer.prototype, "shaderData", void 0);
|
|
10296
10371
|
__decorate([
|
|
10297
10372
|
ignoreClone
|
|
10298
10373
|
], exports.Renderer.prototype, "_distanceForSort", void 0);
|
|
@@ -10320,6 +10395,9 @@ __decorate([
|
|
|
10320
10395
|
__decorate([
|
|
10321
10396
|
ignoreClone
|
|
10322
10397
|
], exports.Renderer.prototype, "_dirtyUpdateFlag", void 0);
|
|
10398
|
+
__decorate([
|
|
10399
|
+
deepClone
|
|
10400
|
+
], exports.Renderer.prototype, "_shaderData", void 0);
|
|
10323
10401
|
__decorate([
|
|
10324
10402
|
ignoreClone
|
|
10325
10403
|
], exports.Renderer.prototype, "_mvMatrix", void 0);
|
|
@@ -10574,6 +10652,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10574
10652
|
sprite._addRefCount(-1);
|
|
10575
10653
|
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10576
10654
|
}
|
|
10655
|
+
this._entity = null;
|
|
10577
10656
|
this._sprite = null;
|
|
10578
10657
|
this._renderData = null;
|
|
10579
10658
|
};
|
|
@@ -11179,14 +11258,19 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11179
11258
|
|
|
11180
11259
|
/**
|
|
11181
11260
|
* Sub-mesh, mainly contains drawing information.
|
|
11182
|
-
*/ var SubMesh = function
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11261
|
+
*/ var SubMesh = /*#__PURE__*/ function() {
|
|
11262
|
+
function SubMesh(start, count, topology) {
|
|
11263
|
+
if (start === void 0) start = 0;
|
|
11264
|
+
if (count === void 0) count = 0;
|
|
11265
|
+
if (topology === void 0) topology = exports.MeshTopology.Triangles;
|
|
11266
|
+
this.start = start;
|
|
11267
|
+
this.count = count;
|
|
11268
|
+
this.topology = topology;
|
|
11269
|
+
}
|
|
11270
|
+
var _proto = SubMesh.prototype;
|
|
11271
|
+
_proto.dispose = function dispose() {};
|
|
11272
|
+
return SubMesh;
|
|
11273
|
+
}();
|
|
11190
11274
|
|
|
11191
11275
|
/**
|
|
11192
11276
|
* Mesh.
|
|
@@ -11302,6 +11386,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11302
11386
|
this._indexBufferBinding = null;
|
|
11303
11387
|
this._vertexElements = null;
|
|
11304
11388
|
this._vertexElementMap = null;
|
|
11389
|
+
this._updateFlagManager = null;
|
|
11305
11390
|
this._platformPrimitive.destroy();
|
|
11306
11391
|
};
|
|
11307
11392
|
_proto._setVertexElements = function _setVertexElements(elements) {
|
|
@@ -12987,8 +13072,8 @@ var VertexChangedFlags;
|
|
|
12987
13072
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
12988
13073
|
Renderer.prototype._onDestroy.call(this);
|
|
12989
13074
|
var mesh = this._mesh;
|
|
12990
|
-
if (mesh
|
|
12991
|
-
mesh._addRefCount(-1);
|
|
13075
|
+
if (mesh) {
|
|
13076
|
+
mesh.destroyed || mesh._addRefCount(-1);
|
|
12992
13077
|
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
12993
13078
|
this._mesh = null;
|
|
12994
13079
|
}
|
|
@@ -13325,10 +13410,21 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13325
13410
|
* @internal
|
|
13326
13411
|
* @override
|
|
13327
13412
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
13328
|
-
var
|
|
13413
|
+
var _this__rootBone, _this__jointTexture;
|
|
13329
13414
|
MeshRenderer.prototype._onDestroy.call(this);
|
|
13330
|
-
(
|
|
13415
|
+
(_this__rootBone = this._rootBone) == null ? void 0 : _this__rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
13416
|
+
this._rootBone = null;
|
|
13417
|
+
this._jointDataCreateCache = null;
|
|
13418
|
+
this._skin = null;
|
|
13419
|
+
this._blendShapeWeights = null;
|
|
13420
|
+
this._localBounds = null;
|
|
13421
|
+
this._jointMatrices = null;
|
|
13331
13422
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13423
|
+
this._jointTexture = null;
|
|
13424
|
+
if (this._jointEntities) {
|
|
13425
|
+
this._jointEntities.length = 0;
|
|
13426
|
+
this._jointEntities = null;
|
|
13427
|
+
}
|
|
13332
13428
|
};
|
|
13333
13429
|
/**
|
|
13334
13430
|
* @internal
|
|
@@ -14716,6 +14812,11 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
14716
14812
|
_this.multiRenderData = true;
|
|
14717
14813
|
return _this;
|
|
14718
14814
|
}
|
|
14815
|
+
var _proto = TextRenderElement.prototype;
|
|
14816
|
+
_proto.dispose = function dispose() {
|
|
14817
|
+
this.component = this.material = this.renderState = this.shaderPass = null;
|
|
14818
|
+
this.charElements.length = 0;
|
|
14819
|
+
};
|
|
14719
14820
|
return TextRenderElement;
|
|
14720
14821
|
}(RenderElement);
|
|
14721
14822
|
|
|
@@ -14863,7 +14964,6 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
14863
14964
|
this.texture = null;
|
|
14864
14965
|
this.solidColor = null;
|
|
14865
14966
|
this.sky.destroy();
|
|
14866
|
-
this._engine = null;
|
|
14867
14967
|
};
|
|
14868
14968
|
/**
|
|
14869
14969
|
* @internal
|
|
@@ -15248,8 +15348,6 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
15248
15348
|
function Scene(engine, name) {
|
|
15249
15349
|
var _this;
|
|
15250
15350
|
_this = EngineObject.call(this, engine) || this;
|
|
15251
|
-
/** The background of the scene. */ _this.background = new Background(_this._engine);
|
|
15252
|
-
/** Scene-related shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Scene);
|
|
15253
15351
|
/** If cast shadows. */ _this.castShadows = true;
|
|
15254
15352
|
/** The resolution of the shadow maps. */ _this.shadowResolution = exports.ShadowResolution.Medium;
|
|
15255
15353
|
/** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
|
|
@@ -15259,6 +15357,8 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
15259
15357
|
/** @internal */ _this._isActiveInEngine = false;
|
|
15260
15358
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
15261
15359
|
/** @internal */ _this._rootEntities = [];
|
|
15360
|
+
_this._background = new Background(_this._engine);
|
|
15361
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Scene);
|
|
15262
15362
|
_this._shadowCascades = exports.ShadowCascadesMode.NoCascades;
|
|
15263
15363
|
_this._fogMode = exports.FogMode.None;
|
|
15264
15364
|
_this._fogColor = new engineMath.Color(0.5, 0.5, 0.5, 1.0);
|
|
@@ -15420,6 +15520,8 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
15420
15520
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
15421
15521
|
if (sunLightIndex !== -1) {
|
|
15422
15522
|
this._sunLight = lightManager._directLights.get(sunLightIndex);
|
|
15523
|
+
} else {
|
|
15524
|
+
this._sunLight = null;
|
|
15423
15525
|
}
|
|
15424
15526
|
if (this.castShadows && this._sunLight && this._sunLight.shadowType !== exports.ShadowType.None) {
|
|
15425
15527
|
shaderData.enableMacro("SHADOW_TYPE", this._sunLight.shadowType.toString());
|
|
@@ -15479,6 +15581,22 @@ var TextRenderElement = /*#__PURE__*/ function(RenderElement) {
|
|
|
15479
15581
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
15480
15582
|
};
|
|
15481
15583
|
_create_class(Scene, [
|
|
15584
|
+
{
|
|
15585
|
+
key: "shaderData",
|
|
15586
|
+
get: /**
|
|
15587
|
+
* Scene-related shader data.
|
|
15588
|
+
*/ function get() {
|
|
15589
|
+
return this._shaderData;
|
|
15590
|
+
}
|
|
15591
|
+
},
|
|
15592
|
+
{
|
|
15593
|
+
key: "background",
|
|
15594
|
+
get: /**
|
|
15595
|
+
* The background of the scene.
|
|
15596
|
+
*/ function get() {
|
|
15597
|
+
return this._background;
|
|
15598
|
+
}
|
|
15599
|
+
},
|
|
15482
15600
|
{
|
|
15483
15601
|
key: "shadowCascades",
|
|
15484
15602
|
get: /**
|
|
@@ -17770,7 +17888,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
17770
17888
|
function Camera1(entity) {
|
|
17771
17889
|
var _this;
|
|
17772
17890
|
_this = Component.call(this, entity) || this;
|
|
17773
|
-
/** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
17774
17891
|
/** Rendering priority - A Camera with higher priority will be rendered on top of a camera with lower priority. */ _this.priority = 0;
|
|
17775
17892
|
/** Whether to enable frustum culling, it is enabled by default. */ _this.enableFrustumCulling = true;
|
|
17776
17893
|
/**
|
|
@@ -17784,6 +17901,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
17784
17901
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
17785
17902
|
/** @internal */ _this._frustum = new engineMath.BoundingFrustum();
|
|
17786
17903
|
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
17904
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
17787
17905
|
_this._isProjMatSetting = false;
|
|
17788
17906
|
_this._nearClipPlane = 0.1;
|
|
17789
17907
|
_this._farClipPlane = 100;
|
|
@@ -17982,6 +18100,20 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
17982
18100
|
this._isInvViewProjDirty.destroy();
|
|
17983
18101
|
this._isViewMatrixDirty.destroy();
|
|
17984
18102
|
this.shaderData._addRefCount(-1);
|
|
18103
|
+
this._entity = null;
|
|
18104
|
+
this._globalShaderMacro = null;
|
|
18105
|
+
this._frustum = null;
|
|
18106
|
+
this._renderPipeline = null;
|
|
18107
|
+
this._virtualCamera = null;
|
|
18108
|
+
this._shaderData = null;
|
|
18109
|
+
this._frustumViewChangeFlag = null;
|
|
18110
|
+
this._transform = null;
|
|
18111
|
+
this._isViewMatrixDirty = null;
|
|
18112
|
+
this._isInvViewProjDirty = null;
|
|
18113
|
+
this._viewport = null;
|
|
18114
|
+
this._inverseProjectionMatrix = null;
|
|
18115
|
+
this._lastAspectSize = null;
|
|
18116
|
+
this._invViewProjMat = null;
|
|
17985
18117
|
};
|
|
17986
18118
|
_proto._projMatChange = function _projMatChange() {
|
|
17987
18119
|
this._isFrustumProjectDirty = true;
|
|
@@ -18021,6 +18153,14 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18021
18153
|
return this._inverseProjectionMatrix;
|
|
18022
18154
|
};
|
|
18023
18155
|
_create_class(Camera1, [
|
|
18156
|
+
{
|
|
18157
|
+
key: "shaderData",
|
|
18158
|
+
get: /**
|
|
18159
|
+
* Shader data.
|
|
18160
|
+
*/ function get() {
|
|
18161
|
+
return this._shaderData;
|
|
18162
|
+
}
|
|
18163
|
+
},
|
|
18024
18164
|
{
|
|
18025
18165
|
key: "nearClipPlane",
|
|
18026
18166
|
get: /**
|
|
@@ -20089,6 +20229,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
20089
20229
|
sprite._addRefCount(-1);
|
|
20090
20230
|
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20091
20231
|
}
|
|
20232
|
+
this._entity = null;
|
|
20092
20233
|
this._color = null;
|
|
20093
20234
|
this._sprite = null;
|
|
20094
20235
|
this._assembler = null;
|
|
@@ -21328,8 +21469,6 @@ var DirtyFlag;
|
|
|
21328
21469
|
* @internal
|
|
21329
21470
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
21330
21471
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
21331
|
-
this.crossCurveMark = 0;
|
|
21332
|
-
this.hasSavedDefaultValue = false;
|
|
21333
21472
|
this.baseEvaluateData = {
|
|
21334
21473
|
curKeyframeIndex: 0,
|
|
21335
21474
|
value: null
|
|
@@ -21342,7 +21481,7 @@ var DirtyFlag;
|
|
|
21342
21481
|
this.type = type;
|
|
21343
21482
|
this.property = property;
|
|
21344
21483
|
this.component = target.getComponent(type);
|
|
21345
|
-
this.
|
|
21484
|
+
this.cureType = cureType;
|
|
21346
21485
|
var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
|
|
21347
21486
|
this._assembler = new assemblerType();
|
|
21348
21487
|
this._assembler.initialize(this);
|
|
@@ -21351,89 +21490,80 @@ var DirtyFlag;
|
|
|
21351
21490
|
}
|
|
21352
21491
|
}
|
|
21353
21492
|
var _proto = AnimationCurveOwner.prototype;
|
|
21354
|
-
_proto.
|
|
21355
|
-
|
|
21356
|
-
if (additive) {
|
|
21357
|
-
var value = curve._evaluateAdditive(time, this.baseEvaluateData);
|
|
21358
|
-
var cureType = this._cureType;
|
|
21359
|
-
if (cureType._isReferenceType) {
|
|
21360
|
-
cureType._additiveValue(value, layerWeight, this.referenceTargetValue);
|
|
21361
|
-
} else {
|
|
21362
|
-
var assembler = this._assembler;
|
|
21363
|
-
var originValue = assembler.getTargetValue();
|
|
21364
|
-
var additiveValue = cureType._additiveValue(value, layerWeight, originValue);
|
|
21365
|
-
assembler.setTargetValue(additiveValue);
|
|
21366
|
-
}
|
|
21367
|
-
} else {
|
|
21368
|
-
var value1 = curve._evaluate(time, this.baseEvaluateData);
|
|
21369
|
-
this._applyValue(value1, layerWeight);
|
|
21370
|
-
}
|
|
21371
|
-
}
|
|
21493
|
+
_proto.evaluateValue = function evaluateValue(curve, time, additive) {
|
|
21494
|
+
return additive ? curve._evaluateAdditive(time, this.baseEvaluateData) : curve._evaluate(time, this.baseEvaluateData);
|
|
21372
21495
|
};
|
|
21373
|
-
_proto.
|
|
21374
|
-
var srcValue = srcCurve && srcCurve.keys.length ? additive ? srcCurve._evaluateAdditive(srcTime, this.baseEvaluateData) : srcCurve._evaluate(srcTime, this.baseEvaluateData) : additive ? this.
|
|
21375
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
21376
|
-
this.
|
|
21496
|
+
_proto.evaluateCrossFadeValue = function evaluateCrossFadeValue(srcCurve, destCurve, srcTime, destTime, crossWeight, additive) {
|
|
21497
|
+
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;
|
|
21498
|
+
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;
|
|
21499
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
21377
21500
|
};
|
|
21378
|
-
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight,
|
|
21379
|
-
var srcValue = additive ? this.
|
|
21380
|
-
var destValue = destCurve && destCurve.keys.length ? additive ? destCurve._evaluateAdditive(destTime, this.crossEvaluateData) : destCurve._evaluate(destTime, this.crossEvaluateData) : additive ? this.
|
|
21381
|
-
this.
|
|
21501
|
+
_proto.crossFadeFromPoseAndApplyValue = function crossFadeFromPoseAndApplyValue(destCurve, destTime, crossWeight, additive) {
|
|
21502
|
+
var srcValue = additive ? this.cureType._subtractValue(this.fixedPoseValue, this.defaultValue, this.baseEvaluateData.value) : this.fixedPoseValue;
|
|
21503
|
+
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;
|
|
21504
|
+
return this._lerpValue(srcValue, destValue, crossWeight);
|
|
21382
21505
|
};
|
|
21383
21506
|
_proto.revertDefaultValue = function revertDefaultValue() {
|
|
21384
21507
|
this._assembler.setTargetValue(this.defaultValue);
|
|
21385
21508
|
};
|
|
21509
|
+
_proto.getEvaluateValue = function getEvaluateValue(out) {
|
|
21510
|
+
if (this.cureType._isReferenceType) {
|
|
21511
|
+
this.cureType._copyValue(this.baseEvaluateData.value, out);
|
|
21512
|
+
return out;
|
|
21513
|
+
} else {
|
|
21514
|
+
return this.baseEvaluateData.value;
|
|
21515
|
+
}
|
|
21516
|
+
};
|
|
21386
21517
|
_proto.saveDefaultValue = function saveDefaultValue() {
|
|
21387
|
-
if (this.
|
|
21388
|
-
this.
|
|
21518
|
+
if (this.cureType._isReferenceType) {
|
|
21519
|
+
this.cureType._copyValue(this.referenceTargetValue, this.defaultValue);
|
|
21389
21520
|
} else {
|
|
21390
21521
|
this.defaultValue = this._assembler.getTargetValue();
|
|
21391
21522
|
}
|
|
21392
|
-
this.hasSavedDefaultValue = true;
|
|
21393
21523
|
};
|
|
21394
21524
|
_proto.saveFixedPoseValue = function saveFixedPoseValue() {
|
|
21395
|
-
if (this.
|
|
21396
|
-
this.
|
|
21525
|
+
if (this.cureType._isReferenceType) {
|
|
21526
|
+
this.cureType._copyValue(this.referenceTargetValue, this.fixedPoseValue);
|
|
21397
21527
|
} else {
|
|
21398
21528
|
this.fixedPoseValue = this._assembler.getTargetValue();
|
|
21399
21529
|
}
|
|
21400
21530
|
};
|
|
21401
|
-
_proto.
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21531
|
+
_proto.applyValue = function applyValue(value, weight, additive) {
|
|
21532
|
+
var cureType = this.cureType;
|
|
21533
|
+
if (additive) {
|
|
21534
|
+
if (cureType._isReferenceType) {
|
|
21535
|
+
cureType._additiveValue(value, weight, this.referenceTargetValue);
|
|
21405
21536
|
} else {
|
|
21406
|
-
this._assembler
|
|
21537
|
+
var assembler = this._assembler;
|
|
21538
|
+
var originValue = assembler.getTargetValue();
|
|
21539
|
+
var additiveValue = cureType._additiveValue(value, weight, originValue);
|
|
21540
|
+
assembler.setTargetValue(additiveValue);
|
|
21407
21541
|
}
|
|
21408
21542
|
} else {
|
|
21409
|
-
if (
|
|
21410
|
-
|
|
21411
|
-
|
|
21543
|
+
if (weight === 1.0) {
|
|
21544
|
+
if (cureType._isReferenceType) {
|
|
21545
|
+
cureType._copyValue(value, this.referenceTargetValue);
|
|
21546
|
+
} else {
|
|
21547
|
+
this._assembler.setTargetValue(value);
|
|
21548
|
+
}
|
|
21412
21549
|
} else {
|
|
21413
|
-
|
|
21414
|
-
|
|
21415
|
-
|
|
21550
|
+
if (cureType._isReferenceType) {
|
|
21551
|
+
var targetValue = this.referenceTargetValue;
|
|
21552
|
+
cureType._lerpValue(targetValue, value, weight, targetValue);
|
|
21553
|
+
} else {
|
|
21554
|
+
var originValue1 = this._assembler.getTargetValue();
|
|
21555
|
+
var lerpValue = cureType._lerpValue(originValue1, value, weight);
|
|
21556
|
+
this._assembler.setTargetValue(lerpValue);
|
|
21557
|
+
}
|
|
21416
21558
|
}
|
|
21417
21559
|
}
|
|
21418
21560
|
};
|
|
21419
|
-
_proto.
|
|
21420
|
-
|
|
21421
|
-
|
|
21422
|
-
out = this.baseEvaluateData.value;
|
|
21423
|
-
this._cureType._lerpValue(srcValue, destValue, crossWeight, out);
|
|
21424
|
-
} else {
|
|
21425
|
-
out = this._cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
21426
|
-
}
|
|
21427
|
-
if (additive) {
|
|
21428
|
-
if (this._cureType._isReferenceType) {
|
|
21429
|
-
this._cureType._additiveValue(out, layerWeight, this.referenceTargetValue);
|
|
21430
|
-
} else {
|
|
21431
|
-
var originValue = this._assembler.getTargetValue();
|
|
21432
|
-
var lerpValue = this._cureType._additiveValue(out, layerWeight, originValue);
|
|
21433
|
-
this._assembler.setTargetValue(lerpValue);
|
|
21434
|
-
}
|
|
21561
|
+
_proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
21562
|
+
if (this.cureType._isReferenceType) {
|
|
21563
|
+
return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
|
|
21435
21564
|
} else {
|
|
21436
|
-
this.
|
|
21565
|
+
this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
|
|
21566
|
+
return this.baseEvaluateData.value;
|
|
21437
21567
|
}
|
|
21438
21568
|
};
|
|
21439
21569
|
AnimationCurveOwner.registerAssembler = function registerAssembler(componentType, property, assemblerType) {
|
|
@@ -21527,6 +21657,27 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
|
|
|
21527
21657
|
}();
|
|
21528
21658
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
21529
21659
|
|
|
21660
|
+
/**
|
|
21661
|
+
* @internal
|
|
21662
|
+
*/ var AnimationCurveLayerOwner = /*#__PURE__*/ function() {
|
|
21663
|
+
function AnimationCurveLayerOwner() {
|
|
21664
|
+
this.crossCurveMark = 0;
|
|
21665
|
+
}
|
|
21666
|
+
var _proto = AnimationCurveLayerOwner.prototype;
|
|
21667
|
+
_proto.initFinalValue = function initFinalValue() {
|
|
21668
|
+
var _this_curveOwner = this.curveOwner, cureType = _this_curveOwner.cureType, defaultValue = _this_curveOwner.defaultValue;
|
|
21669
|
+
if (cureType._isReferenceType) {
|
|
21670
|
+
cureType._copyValue(defaultValue, this.finalValue);
|
|
21671
|
+
} else {
|
|
21672
|
+
this.finalValue = defaultValue;
|
|
21673
|
+
}
|
|
21674
|
+
};
|
|
21675
|
+
_proto.saveFinalValue = function saveFinalValue() {
|
|
21676
|
+
this.finalValue = this.curveOwner.getEvaluateValue(this.finalValue);
|
|
21677
|
+
};
|
|
21678
|
+
return AnimationCurveLayerOwner;
|
|
21679
|
+
}();
|
|
21680
|
+
|
|
21530
21681
|
/**
|
|
21531
21682
|
* Associate AnimationCurve and the Entity
|
|
21532
21683
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -21540,10 +21691,22 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
21540
21691
|
var curveType = this.curve.constructor;
|
|
21541
21692
|
var owner = new AnimationCurveOwner(entity, this.type, this.property, curveType);
|
|
21542
21693
|
curveType._initializeOwner(owner);
|
|
21694
|
+
owner.saveDefaultValue();
|
|
21543
21695
|
return owner;
|
|
21544
21696
|
};
|
|
21545
21697
|
/**
|
|
21546
21698
|
* @internal
|
|
21699
|
+
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
21700
|
+
var curveType = this.curve.constructor;
|
|
21701
|
+
var layerOwner = new AnimationCurveLayerOwner();
|
|
21702
|
+
curveType._initializeLayerOwner(layerOwner);
|
|
21703
|
+
layerOwner.curveOwner = owner;
|
|
21704
|
+
// If curve.keys.length is 0, updateFinishedState will assign 0 to the target, causing an error, so initialize by assigning defaultValue to finalValue.
|
|
21705
|
+
layerOwner.initFinalValue();
|
|
21706
|
+
return layerOwner;
|
|
21707
|
+
};
|
|
21708
|
+
/**
|
|
21709
|
+
* @internal
|
|
21547
21710
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
|
|
21548
21711
|
var instanceId = entity.instanceId;
|
|
21549
21712
|
if (!this._tempCurveOwner[instanceId]) {
|
|
@@ -21623,7 +21786,8 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
21623
21786
|
var targetEntity = entity.findByPath(curveData.relativePath);
|
|
21624
21787
|
if (targetEntity) {
|
|
21625
21788
|
var curveOwner = curveData._getTempCurveOwner(targetEntity);
|
|
21626
|
-
curveOwner.
|
|
21789
|
+
var value = curveOwner.evaluateValue(curveData.curve, time, false);
|
|
21790
|
+
curveOwner.applyValue(value, 1, false);
|
|
21627
21791
|
}
|
|
21628
21792
|
}
|
|
21629
21793
|
};
|
|
@@ -21767,6 +21931,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
21767
21931
|
break;
|
|
21768
21932
|
}
|
|
21769
21933
|
}
|
|
21934
|
+
evaluateData.value = value;
|
|
21770
21935
|
return value;
|
|
21771
21936
|
};
|
|
21772
21937
|
/**
|
|
@@ -21823,6 +21988,11 @@ exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Ani
|
|
|
21823
21988
|
};
|
|
21824
21989
|
/**
|
|
21825
21990
|
* @internal
|
|
21991
|
+
*/ AnimationArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
21992
|
+
owner.finalValue = [];
|
|
21993
|
+
};
|
|
21994
|
+
/**
|
|
21995
|
+
* @internal
|
|
21826
21996
|
*/ AnimationArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
21827
21997
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
21828
21998
|
var src = srcValue[i];
|
|
@@ -21913,6 +22083,11 @@ exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Anima
|
|
|
21913
22083
|
};
|
|
21914
22084
|
/**
|
|
21915
22085
|
* @internal
|
|
22086
|
+
*/ AnimationBoolCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22087
|
+
owner.finalValue = false;
|
|
22088
|
+
};
|
|
22089
|
+
/**
|
|
22090
|
+
* @internal
|
|
21916
22091
|
*/ AnimationBoolCurve._lerpValue = function _lerpValue(srcValue, destValue) {
|
|
21917
22092
|
return destValue;
|
|
21918
22093
|
};
|
|
@@ -21970,6 +22145,11 @@ exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Ani
|
|
|
21970
22145
|
};
|
|
21971
22146
|
/**
|
|
21972
22147
|
* @internal
|
|
22148
|
+
*/ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22149
|
+
owner.finalValue = new engineMath.Color();
|
|
22150
|
+
};
|
|
22151
|
+
/**
|
|
22152
|
+
* @internal
|
|
21973
22153
|
*/ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
21974
22154
|
engineMath.Color.lerp(srcValue, destValue, weight, out);
|
|
21975
22155
|
return out;
|
|
@@ -22077,6 +22257,12 @@ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ fu
|
|
|
22077
22257
|
};
|
|
22078
22258
|
/**
|
|
22079
22259
|
* @internal
|
|
22260
|
+
*/ AnimationFloatArrayCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22261
|
+
var size = owner.curveOwner.referenceTargetValue.length;
|
|
22262
|
+
owner.finalValue = new Float32Array(size);
|
|
22263
|
+
};
|
|
22264
|
+
/**
|
|
22265
|
+
* @internal
|
|
22080
22266
|
*/ AnimationFloatArrayCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
22081
22267
|
for(var i = 0, n = out.length; i < n; ++i){
|
|
22082
22268
|
var src = srcValue[i];
|
|
@@ -22167,6 +22353,11 @@ exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Ani
|
|
|
22167
22353
|
};
|
|
22168
22354
|
/**
|
|
22169
22355
|
* @internal
|
|
22356
|
+
*/ AnimationFloatCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22357
|
+
owner.finalValue = 0;
|
|
22358
|
+
};
|
|
22359
|
+
/**
|
|
22360
|
+
* @internal
|
|
22170
22361
|
*/ AnimationFloatCurve._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
|
|
22171
22362
|
return srcValue + (destValue - srcValue) * crossWeight;
|
|
22172
22363
|
};
|
|
@@ -22236,6 +22427,11 @@ exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ fu
|
|
|
22236
22427
|
};
|
|
22237
22428
|
/**
|
|
22238
22429
|
* @internal
|
|
22430
|
+
*/ AnimationQuaternionCurve1._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22431
|
+
owner.finalValue = new engineMath.Quaternion();
|
|
22432
|
+
};
|
|
22433
|
+
/**
|
|
22434
|
+
* @internal
|
|
22239
22435
|
*/ AnimationQuaternionCurve1._lerpValue = function _lerpValue(src, dest, weight, out) {
|
|
22240
22436
|
engineMath.Quaternion.slerp(src, dest, weight, out);
|
|
22241
22437
|
return out;
|
|
@@ -22340,6 +22536,11 @@ exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function
|
|
|
22340
22536
|
};
|
|
22341
22537
|
/**
|
|
22342
22538
|
* @internal
|
|
22539
|
+
*/ AnimationVector2Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22540
|
+
owner.finalValue = new engineMath.Vector2();
|
|
22541
|
+
};
|
|
22542
|
+
/**
|
|
22543
|
+
* @internal
|
|
22343
22544
|
*/ AnimationVector2Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
22344
22545
|
engineMath.Vector2.lerp(srcValue, destValue, weight, out);
|
|
22345
22546
|
return out;
|
|
@@ -22425,6 +22626,11 @@ exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function
|
|
|
22425
22626
|
};
|
|
22426
22627
|
/**
|
|
22427
22628
|
* @internal
|
|
22629
|
+
*/ AnimationVector3Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22630
|
+
owner.finalValue = new engineMath.Vector3();
|
|
22631
|
+
};
|
|
22632
|
+
/**
|
|
22633
|
+
* @internal
|
|
22428
22634
|
*/ AnimationVector3Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
22429
22635
|
engineMath.Vector3.lerp(srcValue, destValue, weight, out);
|
|
22430
22636
|
return out;
|
|
@@ -22522,6 +22728,11 @@ exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function
|
|
|
22522
22728
|
};
|
|
22523
22729
|
/**
|
|
22524
22730
|
* @internal
|
|
22731
|
+
*/ AnimationVector4Curve._initializeLayerOwner = function _initializeLayerOwner(owner) {
|
|
22732
|
+
owner.finalValue = new engineMath.Vector4();
|
|
22733
|
+
};
|
|
22734
|
+
/**
|
|
22735
|
+
* @internal
|
|
22525
22736
|
*/ AnimationVector4Curve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
|
|
22526
22737
|
engineMath.Vector4.lerp(srcValue, destValue, weight, out);
|
|
22527
22738
|
return out;
|
|
@@ -22631,13 +22842,21 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22631
22842
|
LayerState[LayerState[/** Playing state. */ "Playing"] = 1] = "Playing";
|
|
22632
22843
|
LayerState[LayerState[/** CrossFading state. */ "CrossFading"] = 2] = "CrossFading";
|
|
22633
22844
|
LayerState[LayerState[/** FixedCrossFading state. */ "FixedCrossFading"] = 3] = "FixedCrossFading";
|
|
22845
|
+
LayerState[LayerState[/** Finished state. */ "Finished"] = 4] = "Finished";
|
|
22634
22846
|
})(LayerState || (LayerState = {}));
|
|
22635
22847
|
|
|
22636
22848
|
/**
|
|
22637
22849
|
* @internal
|
|
22638
|
-
*/ var AnimationEventHandler = function
|
|
22639
|
-
|
|
22640
|
-
|
|
22850
|
+
*/ var AnimationEventHandler = /*#__PURE__*/ function() {
|
|
22851
|
+
function AnimationEventHandler() {
|
|
22852
|
+
this.handlers = [];
|
|
22853
|
+
}
|
|
22854
|
+
var _proto = AnimationEventHandler.prototype;
|
|
22855
|
+
_proto.dispose = function dispose() {
|
|
22856
|
+
this.handlers.length = 0;
|
|
22857
|
+
};
|
|
22858
|
+
return AnimationEventHandler;
|
|
22859
|
+
}();
|
|
22641
22860
|
|
|
22642
22861
|
/**
|
|
22643
22862
|
* Transitions define when and how the state machine switch from on state to another. AnimatorTransition always originate from a StateMachine or a StateMachine entry.
|
|
@@ -22695,12 +22914,14 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22695
22914
|
* @internal
|
|
22696
22915
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
22697
22916
|
function AnimatorLayerData() {
|
|
22917
|
+
this.curveOwnerPool = Object.create(null);
|
|
22698
22918
|
this.animatorStateDataMap = {};
|
|
22699
22919
|
this.srcPlayData = new AnimatorStatePlayData();
|
|
22700
22920
|
this.destPlayData = new AnimatorStatePlayData();
|
|
22701
22921
|
this.layerState = LayerState.Standby;
|
|
22702
22922
|
this.crossCurveMark = 0;
|
|
22703
22923
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
22924
|
+
this.crossLayerOwnerCollection = [];
|
|
22704
22925
|
}
|
|
22705
22926
|
var _proto = AnimatorLayerData.prototype;
|
|
22706
22927
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -22715,7 +22936,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22715
22936
|
/**
|
|
22716
22937
|
* @internal
|
|
22717
22938
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
22718
|
-
this.
|
|
22939
|
+
this.curveLayerOwner = [];
|
|
22719
22940
|
this.eventHandlers = [];
|
|
22720
22941
|
};
|
|
22721
22942
|
|
|
@@ -22729,8 +22950,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22729
22950
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
22730
22951
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
22731
22952
|
_this._animatorLayersData = [];
|
|
22732
|
-
_this.
|
|
22733
|
-
_this.
|
|
22953
|
+
_this._curveOwnerPool = Object.create(null);
|
|
22954
|
+
_this._needRevertCurveOwners = [];
|
|
22734
22955
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
22735
22956
|
_this._tempAnimatorStateInfo = {
|
|
22736
22957
|
layerIndex: -1,
|
|
@@ -22753,7 +22974,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22753
22974
|
this._reset();
|
|
22754
22975
|
}
|
|
22755
22976
|
var stateInfo = this._getAnimatorStateInfo(stateName, layerIndex);
|
|
22756
|
-
var state = stateInfo.state;
|
|
22977
|
+
var state = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
22757
22978
|
if (!state) {
|
|
22758
22979
|
return;
|
|
22759
22980
|
}
|
|
@@ -22762,9 +22983,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22762
22983
|
return;
|
|
22763
22984
|
}
|
|
22764
22985
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
22765
|
-
|
|
22766
|
-
|
|
22767
|
-
this._preparePlay(animatorLayerData, state, animatorStateData);
|
|
22986
|
+
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData, playLayerIndex);
|
|
22987
|
+
this._preparePlay(animatorLayerData, state);
|
|
22768
22988
|
animatorLayerData.layerState = LayerState.Playing;
|
|
22769
22989
|
animatorLayerData.srcPlayData.reset(state, animatorStateData, state._getDuration() * normalizedTimeOffset);
|
|
22770
22990
|
};
|
|
@@ -22815,6 +23035,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22815
23035
|
return;
|
|
22816
23036
|
}
|
|
22817
23037
|
deltaTime *= this.speed;
|
|
23038
|
+
this._revertCurveOwners();
|
|
22818
23039
|
for(var i1 = 0, n1 = animatorController.layers.length; i1 < n1; i1++){
|
|
22819
23040
|
var animatorLayerData = this._getAnimatorLayerData(i1);
|
|
22820
23041
|
if (animatorLayerData.layerState === LayerState.Standby) {
|
|
@@ -22855,17 +23076,17 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22855
23076
|
/**
|
|
22856
23077
|
* @internal
|
|
22857
23078
|
*/ _proto._reset = function _reset() {
|
|
22858
|
-
var _this = this, animationCurveOwners = _this.
|
|
23079
|
+
var _this = this, animationCurveOwners = _this._curveOwnerPool;
|
|
22859
23080
|
for(var instanceId in animationCurveOwners){
|
|
22860
23081
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
22861
23082
|
for(var property in propertyOwners){
|
|
22862
23083
|
var owner = propertyOwners[property];
|
|
22863
|
-
owner.
|
|
23084
|
+
owner.revertDefaultValue();
|
|
22864
23085
|
}
|
|
22865
23086
|
}
|
|
22866
23087
|
this._animatorLayersData.length = 0;
|
|
22867
|
-
this.
|
|
22868
|
-
this.
|
|
23088
|
+
this._needRevertCurveOwners.length = 0;
|
|
23089
|
+
this._curveOwnerPool = {};
|
|
22869
23090
|
this._animationEventHandlerPool.resetPool();
|
|
22870
23091
|
if (this._controllerUpdateFlag) {
|
|
22871
23092
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -22892,38 +23113,51 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22892
23113
|
stateInfo.state = state;
|
|
22893
23114
|
return stateInfo;
|
|
22894
23115
|
};
|
|
22895
|
-
_proto.
|
|
22896
|
-
var curveOwners = stateData.curveOwners;
|
|
22897
|
-
for(var i = curveOwners.length - 1; i >= 0; i--){
|
|
22898
|
-
var _curveOwners_i;
|
|
22899
|
-
(_curveOwners_i = curveOwners[i]) == null ? void 0 : _curveOwners_i.saveDefaultValue();
|
|
22900
|
-
}
|
|
22901
|
-
};
|
|
22902
|
-
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
23116
|
+
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData, layerIndex) {
|
|
22903
23117
|
var animatorStateDataMap = animatorLayerData.animatorStateDataMap;
|
|
22904
23118
|
var animatorStateData = animatorStateDataMap[stateName];
|
|
22905
23119
|
if (!animatorStateData) {
|
|
22906
23120
|
animatorStateData = new AnimatorStateData();
|
|
22907
23121
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
22908
|
-
this._saveAnimatorStateData(animatorState, animatorStateData);
|
|
23122
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex);
|
|
22909
23123
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
22910
23124
|
}
|
|
22911
23125
|
return animatorStateData;
|
|
22912
23126
|
};
|
|
22913
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
|
|
22914
|
-
var _this = this, entity = _this.entity,
|
|
22915
|
-
var
|
|
23127
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData, layerIndex) {
|
|
23128
|
+
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
23129
|
+
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
23130
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
22916
23131
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
22917
23132
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
22918
23133
|
var curve = curves[i];
|
|
22919
23134
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
22920
23135
|
if (targetEntity) {
|
|
23136
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
22921
23137
|
var property = curve.property;
|
|
22922
23138
|
var instanceId = targetEntity.instanceId;
|
|
22923
|
-
var
|
|
22924
|
-
|
|
23139
|
+
var needRevert = false;
|
|
23140
|
+
var baseAnimatorLayerData = this._animatorLayersData[0];
|
|
23141
|
+
var baseLayerCurveOwnerPool = baseAnimatorLayerData.curveOwnerPool;
|
|
23142
|
+
if (this.animatorController.layers[layerIndex].blendingMode === exports.AnimatorLayerBlendingMode.Additive && layerIndex > 0 && !(baseLayerCurveOwnerPool[instanceId] && baseLayerCurveOwnerPool[instanceId][property])) {
|
|
23143
|
+
needRevert = true;
|
|
23144
|
+
}
|
|
23145
|
+
// Get owner
|
|
23146
|
+
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
23147
|
+
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
|
|
23148
|
+
//@todo: There is performance waste here, which will be handled together with organizing AnimatorStateData later. The logic is changing from runtime to initialization.
|
|
23149
|
+
if (needRevert) {
|
|
23150
|
+
this._needRevertCurveOwners.push(owner);
|
|
23151
|
+
} else {
|
|
23152
|
+
var index = this._needRevertCurveOwners.indexOf(owner);
|
|
23153
|
+
index > -1 && this._needRevertCurveOwners.splice(index, 1);
|
|
23154
|
+
}
|
|
23155
|
+
// Get layer owner
|
|
23156
|
+
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
23157
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
23158
|
+
curveLayerOwner[i] = layerOwner;
|
|
22925
23159
|
} else {
|
|
22926
|
-
|
|
23160
|
+
curveLayerOwner[i] = null;
|
|
22927
23161
|
console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
22928
23162
|
}
|
|
22929
23163
|
}
|
|
@@ -22951,65 +23185,60 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
22951
23185
|
};
|
|
22952
23186
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
22953
23187
|
animatorLayerData.crossCurveMark++;
|
|
22954
|
-
|
|
23188
|
+
animatorLayerData.crossLayerOwnerCollection.length = 0;
|
|
22955
23189
|
};
|
|
22956
|
-
_proto.
|
|
22957
|
-
|
|
22958
|
-
|
|
22959
|
-
|
|
23190
|
+
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
23191
|
+
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
23192
|
+
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
23193
|
+
animatorLayerData.crossLayerOwnerCollection.push(layerOwner);
|
|
22960
23194
|
};
|
|
22961
23195
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
22962
|
-
var crossCurveData = this._crossOwnerCollection;
|
|
22963
|
-
var crossCurveMark = animatorLayerData.crossCurveMark;
|
|
22964
23196
|
// Add src cross curve data.
|
|
22965
|
-
this._prepareSrcCrossData(
|
|
23197
|
+
this._prepareSrcCrossData(animatorLayerData, false);
|
|
22966
23198
|
// Add dest cross curve data.
|
|
22967
|
-
this._prepareDestCrossData(
|
|
23199
|
+
this._prepareDestCrossData(animatorLayerData, false);
|
|
22968
23200
|
};
|
|
22969
23201
|
_proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
|
|
22970
|
-
var crossOwnerCollection = this._crossOwnerCollection;
|
|
22971
|
-
var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
|
|
22972
23202
|
// Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
|
|
22973
|
-
srcPlayData.state && this._prepareSrcCrossData(
|
|
23203
|
+
animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
|
|
22974
23204
|
// Add dest cross curve data.
|
|
22975
|
-
this._prepareDestCrossData(
|
|
23205
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
22976
23206
|
};
|
|
22977
23207
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
22978
|
-
var
|
|
23208
|
+
var crossLayerOwnerCollection = animatorLayerData.crossLayerOwnerCollection;
|
|
22979
23209
|
// Save current cross curve data owner fixed pose.
|
|
22980
|
-
for(var i =
|
|
22981
|
-
var
|
|
22982
|
-
|
|
23210
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
23211
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
23212
|
+
if (!layerOwner) continue;
|
|
23213
|
+
layerOwner.curveOwner.saveFixedPoseValue();
|
|
22983
23214
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
22984
|
-
|
|
23215
|
+
layerOwner.crossDestCurveIndex = -1;
|
|
22985
23216
|
}
|
|
22986
23217
|
// prepare dest AnimatorState cross data.
|
|
22987
|
-
this._prepareDestCrossData(
|
|
22988
|
-
};
|
|
22989
|
-
_proto._prepareSrcCrossData = function _prepareSrcCrossData(
|
|
22990
|
-
var
|
|
22991
|
-
for(var i =
|
|
22992
|
-
var
|
|
22993
|
-
if (!
|
|
22994
|
-
|
|
22995
|
-
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
22999
|
-
|
|
23000
|
-
|
|
23001
|
-
var
|
|
23002
|
-
|
|
23003
|
-
|
|
23004
|
-
if (
|
|
23005
|
-
|
|
23006
|
-
crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
|
|
23218
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
23219
|
+
};
|
|
23220
|
+
_proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
|
|
23221
|
+
var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
|
|
23222
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
23223
|
+
var layerOwner = curveLayerOwner[i];
|
|
23224
|
+
if (!layerOwner) continue;
|
|
23225
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23226
|
+
saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
|
|
23227
|
+
this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
|
|
23228
|
+
}
|
|
23229
|
+
};
|
|
23230
|
+
_proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
|
|
23231
|
+
var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
|
|
23232
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
23233
|
+
var layerOwner = curveLayerOwner[i];
|
|
23234
|
+
if (!layerOwner) continue;
|
|
23235
|
+
if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
|
|
23236
|
+
layerOwner.crossDestCurveIndex = i;
|
|
23007
23237
|
} else {
|
|
23008
|
-
owner.
|
|
23238
|
+
var owner = layerOwner.curveOwner;
|
|
23009
23239
|
saveFixed && owner.saveFixedPoseValue();
|
|
23010
|
-
|
|
23011
|
-
|
|
23012
|
-
this._addCrossCurveData(crossCurveData, owner, -1, i);
|
|
23240
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23241
|
+
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
23013
23242
|
}
|
|
23014
23243
|
}
|
|
23015
23244
|
};
|
|
@@ -23024,7 +23253,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23024
23253
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, crossFadeTransitionInfo = layerData.crossFadeTransition;
|
|
23025
23254
|
var additive = blendingMode === exports.AnimatorLayerBlendingMode.Additive;
|
|
23026
23255
|
firstLayer && (weight = 1.0);
|
|
23027
|
-
|
|
23256
|
+
//@todo: All situations should be checked, optimizations will follow later.
|
|
23028
23257
|
layerData.layerState !== LayerState.FixedCrossFading && this._checkTransition(srcPlayData, crossFadeTransitionInfo, layerIndex);
|
|
23029
23258
|
switch(layerData.layerState){
|
|
23030
23259
|
case LayerState.Playing:
|
|
@@ -23036,26 +23265,36 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23036
23265
|
case LayerState.CrossFading:
|
|
23037
23266
|
this._updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, deltaTime, additive, aniUpdate);
|
|
23038
23267
|
break;
|
|
23268
|
+
case LayerState.Finished:
|
|
23269
|
+
this._updateFinishedState(srcPlayData, weight, additive, aniUpdate);
|
|
23270
|
+
break;
|
|
23039
23271
|
}
|
|
23040
23272
|
};
|
|
23041
23273
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23042
|
-
var _playData_stateData = playData.stateData,
|
|
23274
|
+
var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
|
|
23043
23275
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
23044
23276
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
23045
23277
|
playData.update(this.speed < 0);
|
|
23046
|
-
if (!aniUpdate) {
|
|
23047
|
-
return;
|
|
23048
|
-
}
|
|
23049
23278
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
var
|
|
23053
|
-
|
|
23279
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
23280
|
+
if (aniUpdate || finished) {
|
|
23281
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
23282
|
+
var layerOwner = curveLayerOwner[i];
|
|
23283
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
23284
|
+
if (!owner) continue;
|
|
23285
|
+
var curve = curveBindings[i].curve;
|
|
23286
|
+
if (curve.keys.length) {
|
|
23287
|
+
var value = owner.evaluateValue(curve, clipTime, additive);
|
|
23288
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
23289
|
+
finished && layerOwner.saveFinalValue();
|
|
23290
|
+
}
|
|
23291
|
+
}
|
|
23054
23292
|
}
|
|
23055
23293
|
playData.frameTime += state.speed * delta;
|
|
23056
23294
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
23057
|
-
layerData.layerState = LayerState.
|
|
23295
|
+
layerData.layerState = LayerState.Finished;
|
|
23058
23296
|
}
|
|
23297
|
+
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
23059
23298
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
23060
23299
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
23061
23300
|
}
|
|
@@ -23066,7 +23305,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23066
23305
|
}
|
|
23067
23306
|
};
|
|
23068
23307
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23069
|
-
var
|
|
23308
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
23070
23309
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
23071
23310
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
23072
23311
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -23075,18 +23314,27 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23075
23314
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
23076
23315
|
var lastSrcClipTime = srcPlayData.clipTime;
|
|
23077
23316
|
var lastDestClipTime = destPlayData.clipTime;
|
|
23078
|
-
var
|
|
23079
|
-
crossWeight
|
|
23317
|
+
var duration = destState._getDuration() * layerData.crossFadeTransition.duration;
|
|
23318
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
23319
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
23080
23320
|
srcPlayData.update(this.speed < 0);
|
|
23081
23321
|
destPlayData.update(this.speed < 0);
|
|
23082
|
-
var srcPlayState = srcPlayData.playState;
|
|
23083
|
-
var destPlayState = destPlayData.playState;
|
|
23084
|
-
|
|
23085
|
-
if (
|
|
23086
|
-
|
|
23322
|
+
var srcClipTime = srcPlayData.clipTime, srcPlayState = srcPlayData.playState;
|
|
23323
|
+
var destClipTime = destPlayData.clipTime, destPlayState = destPlayData.playState;
|
|
23324
|
+
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
23325
|
+
if (aniUpdate || finished) {
|
|
23326
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
23327
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
23328
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
23329
|
+
if (!owner) continue;
|
|
23330
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
23331
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
23332
|
+
var value = owner.evaluateCrossFadeValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, additive);
|
|
23333
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
23334
|
+
finished && layerOwner.saveFinalValue();
|
|
23335
|
+
}
|
|
23087
23336
|
}
|
|
23088
|
-
|
|
23089
|
-
var destClipTime = destPlayData.clipTime;
|
|
23337
|
+
this._updateCrossFadeData(layerData, crossWeight, delta, false);
|
|
23090
23338
|
srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
|
|
23091
23339
|
destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
|
|
23092
23340
|
if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
|
|
@@ -23105,28 +23353,34 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23105
23353
|
} else {
|
|
23106
23354
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
23107
23355
|
}
|
|
23108
|
-
for(var i = crossCurveDataCollection.length - 1; i >= 0; i--){
|
|
23109
|
-
var crossCurveData = crossCurveDataCollection[i];
|
|
23110
|
-
var crossSrcCurveIndex = crossCurveData.crossSrcCurveIndex, crossDestCurveIndex = crossCurveData.crossDestCurveIndex;
|
|
23111
|
-
crossCurveData.crossFadeAndApplyValue(crossSrcCurveIndex >= 0 ? srcCurves[crossSrcCurveIndex].curve : null, crossDestCurveIndex >= 0 ? destCurves[crossDestCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
23112
|
-
}
|
|
23113
23356
|
};
|
|
23114
|
-
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex,
|
|
23115
|
-
var
|
|
23357
|
+
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23358
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
23116
23359
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
23117
23360
|
var eventHandlers = stateData.eventHandlers;
|
|
23118
23361
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
23119
23362
|
var lastDestClipTime = destPlayData.clipTime;
|
|
23120
|
-
var
|
|
23121
|
-
crossWeight
|
|
23363
|
+
var duration = state._getDuration() * layerData.crossFadeTransition.duration;
|
|
23364
|
+
var crossWeight = Math.abs(destPlayData.frameTime) / duration;
|
|
23365
|
+
(crossWeight >= 1.0 || duration === 0) && (crossWeight = 1.0);
|
|
23122
23366
|
destPlayData.update(this.speed < 0);
|
|
23123
23367
|
var playState = destPlayData.playState;
|
|
23124
23368
|
this._updateCrossFadeData(layerData, crossWeight, delta, true);
|
|
23125
|
-
if (!aniUpdate) {
|
|
23126
|
-
return;
|
|
23127
|
-
}
|
|
23128
23369
|
var destClipTime = destPlayData.clipTime;
|
|
23129
|
-
|
|
23370
|
+
var finished = playState === AnimatorStatePlayState.Finished;
|
|
23371
|
+
// 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.
|
|
23372
|
+
if (aniUpdate || finished) {
|
|
23373
|
+
for(var i = crossLayerOwnerCollection.length - 1; i >= 0; i--){
|
|
23374
|
+
var layerOwner = crossLayerOwnerCollection[i];
|
|
23375
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
23376
|
+
if (!owner) continue;
|
|
23377
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
23378
|
+
var value = layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
23379
|
+
aniUpdate && owner.applyValue(value, weight, additive);
|
|
23380
|
+
finished && layerOwner.saveFinalValue();
|
|
23381
|
+
}
|
|
23382
|
+
}
|
|
23383
|
+
//@todo: srcState is missing the judgment of the most recent period."
|
|
23130
23384
|
eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
|
|
23131
23385
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
23132
23386
|
this._callAnimatorScriptOnEnter(state, layerIndex);
|
|
@@ -23136,10 +23390,18 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23136
23390
|
} else {
|
|
23137
23391
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
23138
23392
|
}
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
|
|
23142
|
-
|
|
23393
|
+
};
|
|
23394
|
+
_proto._updateFinishedState = function _updateFinishedState(playData, weight, additive, aniUpdate) {
|
|
23395
|
+
if (!aniUpdate) {
|
|
23396
|
+
return;
|
|
23397
|
+
}
|
|
23398
|
+
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
23399
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
23400
|
+
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
23401
|
+
var layerOwner = curveLayerOwner[i];
|
|
23402
|
+
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
23403
|
+
if (!owner) continue;
|
|
23404
|
+
owner.applyValue(layerOwner.finalValue, weight, additive);
|
|
23143
23405
|
}
|
|
23144
23406
|
};
|
|
23145
23407
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -23147,7 +23409,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23147
23409
|
destPlayData.frameTime += destPlayData.state.speed * delta;
|
|
23148
23410
|
if (crossWeight === 1.0) {
|
|
23149
23411
|
if (destPlayData.playState === AnimatorStatePlayState.Finished) {
|
|
23150
|
-
layerData.layerState = LayerState.
|
|
23412
|
+
layerData.layerState = LayerState.Finished;
|
|
23151
23413
|
} else {
|
|
23152
23414
|
layerData.layerState = LayerState.Playing;
|
|
23153
23415
|
}
|
|
@@ -23157,25 +23419,24 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23157
23419
|
fixed || (layerData.srcPlayData.frameTime += layerData.srcPlayData.state.speed * delta);
|
|
23158
23420
|
}
|
|
23159
23421
|
};
|
|
23160
|
-
_proto._preparePlay = function _preparePlay(layerData, playState
|
|
23422
|
+
_proto._preparePlay = function _preparePlay(layerData, playState) {
|
|
23161
23423
|
if (layerData.layerState === LayerState.Playing) {
|
|
23162
23424
|
var srcPlayData = layerData.srcPlayData;
|
|
23163
23425
|
if (srcPlayData.state !== playState) {
|
|
23164
|
-
var
|
|
23165
|
-
for(var i =
|
|
23166
|
-
var
|
|
23167
|
-
|
|
23426
|
+
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
23427
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
23428
|
+
var _curveLayerOwner_i;
|
|
23429
|
+
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
23430
|
+
owner.revertDefaultValue();
|
|
23168
23431
|
}
|
|
23169
|
-
this._saveDefaultValues(playStateData);
|
|
23170
23432
|
}
|
|
23171
23433
|
} else {
|
|
23172
|
-
// layerState is CrossFading, FixedCrossFading, Standby
|
|
23173
|
-
var
|
|
23174
|
-
for(var i1 =
|
|
23175
|
-
var owner1 =
|
|
23176
|
-
owner1.
|
|
23434
|
+
// layerState is CrossFading, FixedCrossFading, Standby, Finished
|
|
23435
|
+
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
23436
|
+
for(var i1 = crossLayerOwnerCollection.length - 1; i1 >= 0; i1--){
|
|
23437
|
+
var owner1 = crossLayerOwnerCollection[i1].curveOwner;
|
|
23438
|
+
owner1.revertDefaultValue();
|
|
23177
23439
|
}
|
|
23178
|
-
this._saveDefaultValues(playStateData);
|
|
23179
23440
|
}
|
|
23180
23441
|
};
|
|
23181
23442
|
_proto._checkTransition = function _checkTransition(stateData, crossFadeTransition, layerIndex) {
|
|
@@ -23192,7 +23453,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23192
23453
|
_proto._crossFadeByTransition = function _crossFadeByTransition(transition, layerIndex) {
|
|
23193
23454
|
var name = transition.destinationState.name;
|
|
23194
23455
|
var stateInfo = this._getAnimatorStateInfo(name, layerIndex);
|
|
23195
|
-
var crossState = stateInfo.state;
|
|
23456
|
+
var crossState = stateInfo.state, playLayerIndex = stateInfo.layerIndex;
|
|
23196
23457
|
if (!crossState) {
|
|
23197
23458
|
return;
|
|
23198
23459
|
}
|
|
@@ -23200,21 +23461,21 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23200
23461
|
console.warn("The state named " + name + " has no AnimationClip data.");
|
|
23201
23462
|
return;
|
|
23202
23463
|
}
|
|
23203
|
-
var animatorLayerData = this._getAnimatorLayerData(
|
|
23464
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
23204
23465
|
var layerState = animatorLayerData.layerState;
|
|
23205
23466
|
var destPlayData = animatorLayerData.destPlayData;
|
|
23206
|
-
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData);
|
|
23467
|
+
var animatorStateData = this._getAnimatorStateData(name, crossState, animatorLayerData, playLayerIndex);
|
|
23207
23468
|
var duration = crossState._getDuration();
|
|
23208
23469
|
var offset = duration * transition.offset;
|
|
23209
23470
|
destPlayData.reset(crossState, animatorStateData, offset);
|
|
23210
23471
|
switch(layerState){
|
|
23211
|
-
// Maybe not play, maybe end.
|
|
23212
23472
|
case LayerState.Standby:
|
|
23213
23473
|
animatorLayerData.layerState = LayerState.FixedCrossFading;
|
|
23214
23474
|
this._clearCrossData(animatorLayerData);
|
|
23215
23475
|
this._prepareStandbyCrossFading(animatorLayerData);
|
|
23216
23476
|
break;
|
|
23217
23477
|
case LayerState.Playing:
|
|
23478
|
+
case LayerState.Finished:
|
|
23218
23479
|
animatorLayerData.layerState = LayerState.CrossFading;
|
|
23219
23480
|
this._clearCrossData(animatorLayerData);
|
|
23220
23481
|
this._prepareCrossFading(animatorLayerData);
|
|
@@ -23311,6 +23572,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23311
23572
|
}
|
|
23312
23573
|
}
|
|
23313
23574
|
};
|
|
23575
|
+
_proto._revertCurveOwners = function _revertCurveOwners() {
|
|
23576
|
+
var curveOwners = this._needRevertCurveOwners;
|
|
23577
|
+
for(var i = 0, n = curveOwners.length; i < n; ++i){
|
|
23578
|
+
curveOwners[i].revertDefaultValue();
|
|
23579
|
+
}
|
|
23580
|
+
};
|
|
23314
23581
|
_create_class(Animator, [
|
|
23315
23582
|
{
|
|
23316
23583
|
key: "animatorController",
|
|
@@ -23342,10 +23609,10 @@ __decorate([
|
|
|
23342
23609
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
23343
23610
|
__decorate([
|
|
23344
23611
|
ignoreClone
|
|
23345
|
-
], Animator.prototype, "
|
|
23612
|
+
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
23346
23613
|
__decorate([
|
|
23347
23614
|
ignoreClone
|
|
23348
|
-
], Animator.prototype, "
|
|
23615
|
+
], Animator.prototype, "_needRevertCurveOwners", void 0);
|
|
23349
23616
|
__decorate([
|
|
23350
23617
|
ignoreClone
|
|
23351
23618
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|